CHANGES:
Features/Changes
OCaml versions
- Compiler/Runtime: support for OCaml 5.6: use the optimization hints
recorded in the bytecode, support the bit counting primitives and
Sys.filepath_exists,Weak.get_copyno longer copies
(#1721, #2227, #2469, #2488, #2493, #2494) - Compiler/Runtime: OxCaml: block index and small-int string-like indexing
primitives; OxCaml-specific primitives are gated on//If: oxcaml
(#2342, #2463) - Compiler/Runtime: support building with Introcaml (OCaml fork with runtime
introspection), gated by theintrospectflag (#2409)
Compiler
- Compiler: require sedlex 3.8.1 (#2503)
- Compiler: faster compilation (about 25% faster than 6.4.1 on large
programs): newInt_trieandInt_setdata structures,
sharing-preservingSubstandJs_traverse.map,Js_traverse.freeas
an iterator, circular-buffer worklists, faster JavaScript printer and
lexer (#2445, #2446, #2447, #2448, #2449, #2452, #2454, #2512) - Compiler: keep the name of function expressions that do not refer to
themselves; theunused-js-varswarning now reports such names (#2449) - Compiler: emit large binary string constants as base64 literals, which are
much smaller than\xNN-escaped literals (-14% on the toplevel example)
(#2432) - Compiler: report JavaScript syntax errors as
file:line:colfollowed by
the offending line; columns start from 1 (#2464, #2471, #2491) - Compiler: the JavaScript parser accepts source phase imports
(import source x from "m") (#2523) - Compiler: drop redundant
breaks out of labelled blocks, turning the
blocks intoif/elsestatements or conditional expressions; the nesting
this introduces is bounded by--set=break_sink_depth, and the
merge_node_maxparameter is renamedlabel_depth(#2513) - Compiler: simplify the generated JavaScript (
!xfor negated
conditions, no emptyifbranches) (#2500) - Compiler: omit the
| 0coercion after an unsigned right shift by a
constant (#2531) - Compiler: inline pending expressions at the end of a
trybody, avoiding
temporaries such astry{var c = f(x); return c;}(#2532) - Compiler: bind identical literals of a bytecode program to a single
variable, which shrinks the generated code and speeds up compilation of
programs with many duplicated constants; identical literals may now be
physically equal (==) (#2547) - Compiler: fold
if (c) return a; return bintoreturn c ? a : b
(#2533) - Compiler: test integers against 0 by truthiness (
!xrather than
0 === x) when the result is only used as a condition (#2538) - Compiler: simplify
!c ? a : bintoc ? b : a(#2538) - Compiler: compare integers directly rather than comparing the result
ofcomparewith 0 (#2529) - Compiler: faster reading of debug events, used with
--prettyand
--debug-info(#2541, #2548)
Effects
- Compiler: with
--effects={cps,double-translation}, specialize calls to
known functions before the CPS transformation (#2458) - Compiler: with
--effects=double-translation, only generate a CPS version
of the functions that may run below an effect handler (#2441) - Compiler/Wasm: with
--effects=cps, no longer turn mutually recursive
functions into CPS, since Wasm has proper tail calls (#2441) - Runtime: specialize one- and two-argument partial applications in
double-translation mode (#2437)
Wasm
- Compiler/Wasm: intern string constants (program-wide with whole-program
compilation, per compilation unit otherwise) (#2436) - Compiler/Wasm: small code generation improvements (negation, physical
equality on JavaScript values, bigarray dimensions, result types of
runtime primitives, masking of i31 values, range checks in the runtime)
(#2472, #2475, #2529) - Compiler/Wasm: add
--setenv, matching js_of_ocaml (#2415) - Compiler/Wasm: emit a sourcemap mapping at the start of each function, for
the Chrome profiler (#2417) - Compiler/Wasm: the linker supports the wide arithmetic and custom
descriptor instructions (#2515) - Compiler/Wasm: store more long-lived toplevel variables in globals; fix a
crash when one of them is assigned in atrybody (#2516) - Runtime/Wasm: faster
caml_hash,compare, lexer engines,Str
searches andoutput_valuesharing detection (with WASI,output_value
now shares boxed numbers with equal contents); single bound check in
fixed-widthBytesaccesses (#2470, #2505)
Libraries
- Lib: add
WebGL2bindings; thewebglexample uses WebGL2 and a new
webgl2_particlesexample demonstrates transform feedback (#1226, #2388) - Lib: add
Crypto(Web Crypto API) bindings (#2380) - Lib: add
NotificationandClipboardbindings (#2379) - Lib: add Service Worker,
MessageChannel/MessagePortand Cache API
bindings (#2381) - Lib: add
FontFace(CSS Font Loading API) bindings (#2255) - Lib: add the Pointer Capture API to
Dom_html.element, and
getPredictedEvents,altitudeAngleandazimuthAngletopointerEvent
(#2403) - Lib: consolidate the duplicate
messageEventclass types into
('target, 'data) Dom_html.messageEvent; the old ones are deprecated
aliases (#2382, #2390) - Lib: add
Lwt_js_events.mutation/mutations(MutationObserver) (#250) - Lib:
Lwt_js_events.load/error/abortaccept any element, not only
images (#2404) - Lib (breaking):
Typed_array.float32Array_fromArrayand
float64Array_fromArraytake anumber_t js_array t, as required by
wasm_of_ocaml (#2416) - Lib (breaking): remove
js_of_ocaml-lwt.logger, aslwt_logis
deprecated (#2378) - Lib: the native stubs of the JavaScript primitives are weak symbols, so
that they can be overridden (#2435)
Toplevel
- Toplevel: new
WrappedandAsyncAPIs, andprotocol,workerand
worker_lwt_clientsublibraries to run the toplevel in a WebWorker
(#66, #833, #2377)
Bug fixes
Compiler
- Compiler: fix two reference unboxing bugs (#2426, #2489)
- Compiler: fix an invariant violation with recursive inlining
(#2482, #2495) - Compiler: fix variable coalescing with ES classes (#2462)
- Compiler: fix unsound corner cases of the JavaScript simplification
passes:||fusion of effectful conditions, droppedvardeclarations
when folding anif, catch-parameter destructuring defaults (#2393) - Compiler: fix the printing of JavaScript code: parentheses around optional
chains, no ES2021 logical assignments, keep the braces around a single
block-scoped declaration (#2465, #2502) - Compiler: keep
staticon the same line as the class element it modifies
(Safari 17 misparsed static class fields) (#2420, #2421) - Compiler: fix the JavaScript lexer on out-of-range unicode escapes, on
CR, U+2028 and U+2029 inside strings and templates, on numeric separators
in the integer part of a float, and on an HTML close comment-->after a
multi-line comment (#2503, #2524)
Effects
- Compiler: with
--effects=cpsordouble-translation, fix mutable local
variables intrybodies and exception handlers (#2484) - Compiler: with
--effects=double-translation, fix over-applications of
functions that do not perform effects (#2455) - Compiler/Wasm: with
--effects=cps, fix an assertion failure on atry
whose body modifies a local reference, when compiled without-g(#2519) - Wasm: unhandled effects raise
Effect.Unhandled(--effects=native) or
Failure(--effects=disabled) instead of failing with a runtime error;
handlers installed insideassume_no_performwork;--effects=cpsno
longer runs on a JSPI stack (#2434, #2441)
Wasm
- Compiler/Wasm:
x land ywas wrongly assumed to fit in 31 bits when only
a negative operand did (#2490) - Compiler/Wasm: fix specialized
Bigarray.Genarray.get/setaccesses,
and check the number of indices (#2427, #2505) - Compiler/Wasm: fix several bugs of the Wasm linker (#2504)
- Compiler/Wasm: fix sourcemaps and toplevels on Windows (#2397, #2418)
- Wasm: embed cmis when building a toplevel with separate compilation
(#2227) - Wasm: the runtime (zstd, blake2, wasi libc) uses a single linear memory,
as Safari does not support modules with several memories (#2405) - Wasm: resolve
.wasmassets relative to the runtime file, so that
required programs work (#2389)
Runtime
- Runtime: on Windows, the console device names (
CON,CONIN$,CONOUT$)
can be opened from node; they were resolved against the current directory
(#2525) - Runtime:
output_valuemarshals forced lazy values as their value, and
caml_hash(Wasm) follows forwarded values, as native code (#2486) - Runtime: the functions creating arrays of arbitrary length check
Sys.max_array_length(#2499) - Runtime: fix
Str.string_partial_match(OSEC-2026-21) (#2492) - Runtime:
caml_alloc_dummy_mixedtakes two arguments (OxCaml) (#2461) - Runtime: fix two nat bugs with 32-bit digits (#2460)
- Runtime: fix comparison between an immediate and a custom block (#2391)
- Runtime: preserve leading BOMs when converting strings to JavaScript
(#2414) - Runtime: fix the toplevel relocation of unit names with
use-js-string
disabled (#2429)
Libraries
- Toplevel: keep
/static/cmison the load path across
Toploop.initialize_toplevel_env(#833, #2377) - Tyxml: keep the first of repeated attributes, as browsers do (#968, #2383)
- Lib:
Form.form_elementsandForm.get_form_contentsskip
<input type="button">, as a native form submission does; a named one
was sent as a field with its value (#2466)