Skip to content

Releases: ocsigen/js_of_ocaml

6.4.1

Choose a tag to compare

@hhugo hhugo released this 01 Jul 08:45

CHANGES:

Bug fixes

  • Runtime/wasm: derive the wat-module name from the basename of the input
    path in runtime/wasm/args.ml, so dune 3.24's leading-./ path-form
    representation (ocaml/dune#15156) keeps producing well-formed
    module:path lines for wasmoo_link_wasm (#2371)
  • Tests: pass file paths as literal arguments (with explicit (deps ...))
    instead of %{dep:...} in the md5/md5_nat, dump_sourcemap and
    check-prim tests, which echo the path verbatim, so dune 3.24's leading-./
    path form (ocaml/dune#15156) no longer breaks their expected output (#2384)

6.4.0

Choose a tag to compare

@hhugo hhugo released this 21 Jun 14:55
e4d950b

CHANGES:

Features/Changes

  • Compiler: initial support for OCaml 5.5.0 (#2197, #2220)
  • Compiler: OxCaml support (#2105, #2225)
  • Compiler: new variable coalescing pass, plus faster variable-naming,
    free-variable and shape-computation passes (#2166, #2321, #2198)
  • Compiler: add the --build-config and --apply-build-config flags (#2177)
  • Compiler: put more values into global variables (#2211)
  • Compiler: cosmetic minification in compact mode — !0/!1 booleans,
    drop the leading 0 in 0.x fractions, normalise exponents
    (1e+051e5), and pick backtick strings when they reduce escapes;
    --pretty output is unchanged (#1117)
  • Wasm: dynlink and toplevel support (#2186)
  • Compiler/wasm: WASI 0.1 support (#1831)
  • Wasm_of_ocaml: alternative effect implementation based on the Stack
    Switching proposal (#2189)
  • Runtime/wasm: implement the legacy num library nat primitives
    (previously no-op stubs), so arbitrary-precision integers and rationals
    now work as on the JavaScript runtime (#2263)
  • Runtime/wasm: faster string↔ArrayBuffer copies, faster small-string
    conversions, and optimized bigstring primitives (#2124, #2144)
  • Runtime/wasm: pure-Wasm zstd and BLAKE2b implementations; the runtime
    no longer relies on the JavaScript zstd/BLAKE2 shims to unmarshal
    compressed values or compute Digest.BLAKE512/256/128. This also makes
    both available under the WASI target, which has no JavaScript (#2249)
  • Runtime: initial support for quickjs-ng (#2229)
  • Lib: add Promise — type-safe bindings to JavaScript promises (even for
    'a Promise.t Promise.t), with Lwt interop in Js_of_ocaml_lwt.Promise
    (to_lwt/of_lwt) and Promise-typed Dom_html bindings
    (requestFullscreen, requestPointerLock, exitFullscreen,
    mediaElement.play, imageElement.decode, Animation.{finished,ready}).
    Breaking: mediaElement.play now returns unit Promise.t (#2031)
  • Lib: add Fetch and Abort — Fetch API binding with a typed
    AbortController/AbortSignal primitive for cancellation (#596)
  • Lib: many additional Dom_html bindings and a new Performance module
    (#2221, #2248)
  • Lib: add Console bindings for table, count, countReset and
    timeLog (#2350)
  • Lib: align Dom_svg with SVG 2 — new graphicsElement/geometryElement
    parents, style/className/dataset merged into element, SVG 2
    members, markerElement and the full SVGFE* filter-primitive family,
    every SVG element is now an event target (#519), and prop/readonly_prop
    fixes. Breaking: drops the SVG 1.1-only getTransformToElement;
    nearestViewportElement/farthestViewportElement are now typed optdef
  • Lib: implement the popover API (#1734)
  • Lib: add Intl.RelativeTimeFormat (#2070)
  • Lib: remove dead legacy-browser code from the DOM bindings (IE
    attachEvent/createElement/cancelBubble fallbacks, prefixed
    requestAnimationFrame, the Firefox 3.x File.fileName property).
    Breaking: drops the obsolete Gecko MouseScrollEvent/_DOMMouseScroll
    bindings — the mouseScrollEvent type, the MouseScrollEvent
    taggedEvent variant, CoerceTo.mouseScrollEvent and
    Event._DOMMouseScroll (#2350)

Bug fixes

  • Compiler: don't rewrite x = e + x into x += e for + (not
    commutative on strings), which reversed Filename.concat operands and
    broke Filename.temp_file in whole-program builds (#2228)
  • Compiler: fix the dead require() guard in share_constant (it matched
    "requires"), which could replace require string arguments and confuse
    bundlers (#2284)
  • Compiler: parenthesize in in conditional else-branches, arrow concise
    bodies and for-initializer yields when re-printing parsed JavaScript,
    which previously emitted output that did not parse (#2282)
  • Compiler: emit a flat dispatch loop instead of deeply nested labelled
    blocks for many sibling merge targets, avoiding parser "too much
    recursion" overflows (#2122)
  • Compiler: avoid JS stack overflow on deep mutually-recursive direct-style
    calls under --effects=double-translation (#2243)
  • Compiler: fix reference unboxing (#2210), a missing conditional
    simplification (#2217), Js_assign.simpl (#2218), and UGEINT lowering
  • Compiler/wasm: fix the int-division return type (#2197), preserve the
    physical identity of empty closures (#2207), and fix a crash on some
    function calls (#2208)
  • Runtime: hashing is now consistent across backends — JS strings with code
    points above U+00FF mix two 16-bit units per word, Hashtbl.hash of float
    arrays, bigarray tail zero-extension and float32_hash normalize like
    native; ASCII/Latin-1 strings are unchanged (#2263, #2270, #2332)
  • Runtime/wasm: bring many primitives in line with the JavaScript runtime —
    caml_wrap_exception only wraps real Errors, caml_js_meth_call
    decodes method names as UTF-8, the exception formatter grows its buffer,
    Sys.is_directory/file_exists follow symlinks, isatty returns false
    in browsers, caml_seek_in validates the destination, Array.make/
    Obj.new_block build proper float arrays, caml_unregister_named_value
    handles non-head bucket entries, the lexer only moves position memory on
    memory-action transitions, the bytecode-section accessors raise without
    --toplevel, format-string #/%+f/% f corner cases, and
    Condition.wait is a no-op with each condition variable having a distinct
    identity (#2263)
  • Runtime: marshalling fixes on both backends — Marshal.to_buffer returns
    the byte count; float arrays use CODE_DOUBLE_ARRAY (readable by native
    and Wasm); BLOCK32 sizes are decoded with an unsigned shift (≥ 2^21 fields
    no longer truncated) and a block with ≥ 2^22 fields raises instead of
    truncating; input_value on a bad object raises Failure; bigarray
    deserialization rejects bad dimensions; big-endian double arrays are
    registered in the object table (#2263, #2270)
  • Runtime: filesystem fixes (#2270) — the fake device no longer destroys a
    directory renamed into its own subtree, refuses to unlink directories,
    honors Open_append (which now implies write access), reports proper Unix
    error codes/syscalls/paths, no longer matches mount points as regexes,
    raises Sys_error on cross-device renames, keeps file sizes 64-bit on the
    node backend, and no longer deletes a file renamed onto itself; flush on
    a closed channel no longer raises
  • Runtime: O_APPEND/Open_append matches native on both backends — the
    file offset starts at 0 (so lseek/pos_out report 0 right after opening)
    and every write goes to the end of the file, even after seeking backwards
    (#2306)
  • Runtime: an empty path raises ENOENT on the JavaScript backend like
    native (and the Wasm runtime), so Unix.stat "", Unix.opendir "", etc.
    raise instead of operating on the cwd, and Sys.file_exists "" is false
    (#2354)
  • Runtime: Unix fixes — Unix.localtime computes tm_yday from the date
    (was off by one during DST) and reaches Intl safely; Unix.close frees
    the fd-table slot; Unix.error_message no longer crashes on unknown codes
    or node < 22; chmod raises Unix_error; readdir includes "." and
    "..", and add Unix.getegid / fix the Unix.getgrgid export (#2263,
    #2270, #2303, #2304)
  • Runtime: channel fixes — in_channel_of_descr/out_channel_of_descr
    allocate fresh channels (they used to share a record and loop on reads);
    refill-hook channels grow their buffer and keep pos_in/pos_out
    correct; Sys.command returns the child exit status; Sys.getenv raises
    on prototype names; Sys.isatty consults the channel's file (#2270, #2330)
  • Runtime: Str engine fixes — SIMPLEOPT/STAR/PLUS no longer read past the
    end of the string (a trailing negated class could loop forever),
    instruction arguments are no longer masked to 8 bits (regexps with > 256
    pool entries mis-indexed), and a Str.replace backreference one past the
    last group raises instead of trapping (#2263, #2270)
  • Runtime: ephemeron/weak fixes — blit_key, blit_data, get_data,
    get_copy and get_data_copy corrected (no clobbering, copy bytes and
    float arrays, no traps on JS-valued data); data is weakly keyed on the key
    object so key↔data cycles can be collected; Gc.finalise_last runs under
    --effects=cps; Gc.counters returns a plain tuple (#2263, #2270, #2274,
    #2279)
  • Runtime: numeric fixes — Digest/MD5 correct for inputs ≥ 2 GiB;
    Int64.shift_right for negatives with shift counts 41–47;
    Int64.of_string (#2223); Printf "%#x" 0 prints 0; float16 bigarray
    NaN comparison; comparing an immediate against a custom block no longer
    throws and orders correctly; Float.Array.sub/append/concat return
    tag-254 arrays; caml_bigstring_blit_* treat positions as raw offsets;
    compare_nat reads only the common digit length (#2263, #2270)
  • Runtime: float formatting and parsing — the exact decimal expansion is
    printed beyond toFixed/toExponential's limits (%.150e, %f of values
    ≥ 1e21); hex-float literals parse with correct rounding, saturate huge
    exponents instead of wrapping, and reject non-decimal/JavaScript literals;
    ldexp rounds once into the subnormal range; and float_of_string skips
    all leading whitespace (#2263, #2270)
  • Runtime: caml_float16_of_double rounds through float32 like native, so
    float16 tie values agree across the js, wasm and native backends; and
    Unix.getuid/geteuid/getgid/getegid return the real ids on Node (the
    WASI build keeps 1) (#2280)
  • Runtime: Graphics backend fixes (#2270) — consistent bottom-left pixel
    origin across all primitives, correct draw_arc quadrant, synchronous
    first draw_image, fill_rect paints the far edges, pie-slice fill_arc,
    half-pixel-centred strokes/fills for crisp lines, and round caps/joins,
    matching the native X11 backend
  • Runtime: Domain.spawn of a raising body now succeeds and Domain.join
    re-raises (with the Finished payload layout...
Read more

6.3.2

Choose a tag to compare

@hhugo hhugo released this 15 Feb 10:02
f5fe45b

CHANGES:

Changes

  • Misc: fix installation of completion files again.

6.3.1

Choose a tag to compare

@hhugo hhugo released this 13 Feb 22:58
69bd319

CHANGES:

Changes

  • Misc: fix installation of completion files in monorepo, working around
    bugs in dune

6.3.0

Choose a tag to compare

@hhugo hhugo released this 06 Feb 22:46

CHANGES:

Features/Changes

  • Misc: install shell completion script generated by cmdliner (#2140)
  • Compiler/wasm: omit code pointer from closures when not used (#2059, #2093)
  • Compiler/wasm: number unboxing (#2069, #2101)
  • Compiler/wasm: specialization of number comparisons and bigarray operations (#1954)
  • Compiler/wasm: make the type of some Wasm primitives more precise (#2100)
  • Compiler: reference unboxing (#1958)
  • Compiler: js-parser: support import/export with attributes
  • Compiler: js-parser: support 'using X = E' for resource management (#2143)
  • Compiler: js-parser: support decorators
  • Compiler: js-parser: support html-comments
  • Compiler: avoid unnecessary boolean-to-integer conversions (#2168)
  • Runtime: improved handling of NaNs (#2110)
  • Lib: allow to reference values from the runtime (#2086)
  • Lib: add Dom_html.onload for WASM-safe load handling (#1948)
  • Runtime: make eval functions more robust (#2108)
  • Compiler: added a constant sinking pass (#2167)

Bug fixes

  • Compiler: fix Global_flow.do_escape monotonicity
  • Compiler: fix static eval of caml_nativeint_to_int
  • Compiler: remove invalid conditional simplification
  • Lib: fix characterData.substringData method name typo in Dom module
  • Lib: fix various Dom_html bindings (submitEvent, mediaQueryListEvent, pointerEvent, element, inputElement, tableElement types and deprecations)
  • Lib: fix numberList type in Dom_svg to use number_t
  • Lib: fix eventSource.url type to use js_string t
  • Lib: fix file.lastModifiedDate type to use Js.date t, add lastModified
  • Lib: fix Form.get_form_elements infinite loop bug
  • Lib: fix position.timestamp type in Geolocation module
  • Lib: remove non-existent setDay and setUTCDay methods from Js.date
  • Lib: fix _ACTIVE_TEXTURE_ type in WebGL to use textureUnit
  • Compiler: fix purity of comparison functions (again) (#2092)
  • Compiler: fix inlining (#2107)
  • Compiler: allow arrow functions in for loops
  • Ppx: disable spurious warning for unused "self" in object literal (#2128)
  • Ppx: fix labelled arguments for methods (#2126)
  • Runtime/wasm: fix Unix.times (#2096)
  • Runtime: runtime with target-env=browser should not rely on "require(..)" (#2129)
  • Runtime: fix fake filesystem with path containing special regexp chars. (#2132)
  • Runtime/wasm: fix unmarshalling of compressed data (#2141)
  • Runtime: fix compilation of loops at start of exception handlers (#2151)
  • Compiler: fix parallel renaming (#2156)

6.2.0

Choose a tag to compare

@hhugo hhugo released this 30 Jul 07:24
938c18c

CHANGES:

Features/Changes

  • Compiler: exit-loop-early in more cases (#2077)
  • Runtime: support rename in fake filesystem (#2080)
  • Compiler: remove reserved keyword in ecmascript 3

Bug fixes

  • Compiler: Fix inlining. do not inline recursive functions (#2084)
  • Compiler: fix purity of caml_compare and caml_lxm_next
  • Runtime: fix Sys.rename for directories on windows

6.1.1

Choose a tag to compare

@hhugo hhugo released this 07 Jul 13:07
104e924

CHANGES:

Bug fixes

  • Compiler: Fix shape loading (#2074)

6.1.0

Choose a tag to compare

@hhugo hhugo released this 04 Jul 21:57
e7c930e

CHANGES:

Features/Changes

  • Misc: drop support for OCaml 4.12 and bellow
  • Misc: switch to dune.3.19
  • Misc: initial support for ocaml 5.4 (#2030, #2058)
  • Compiler: support for OCaml 4.14.3+trunk (#1844)
  • Compiler: add the --empty-sourcemap flag
  • Compiler: improve debug/sourcemap location of closures (#1947)
  • Compiler: optimize compilation of switches (#1921, #2057)
  • Compiler: evaluate statically more primitives (#1912, #1915, #1965, #1969)
  • Compiler: rewrote inlining pass (#1935, #2018, #2027)
  • Compiler: improve tailcall optimization (#1943)
  • Compiler: improve deadcode optimization (#1963, #1962, #1967)
  • Compiler: deadcode elimination of cyclic values (#1978)
  • Compiler: remove empty blocks (#1934)
  • Compiler: improve coloring optimization (#1971, #1984, #1986, #1989)
  • Compiler: faster constant sharing (#1988)
  • Compiler: faster js code generation (#1985, #2066)
  • Compiler: improve performance of Javascript linking
  • Compiler: more efficient code generation from bytecode (#1972)
  • Compiler: faster compilation by improving the scheduling of optimization passes (#1962, #2001, #2012, #2027)
  • Compiler: faster compilation by stopping sooner when optimizations become unproductive (#1939)
  • Compiler: Propagate arity between compilation units (#1594)
  • Compiler: Add flags to enable/disable warnings (#2052)
  • Compiler/wasm: directly write Wasm binary modules (#2000, #2003)
  • Compiler/wasm: faster wat output (#1992)
  • Compiler/wasm: use a Wasm text files preprocessor (#1822)
  • Compiler/wasm: optimize integer operations (#2032)
  • Compiler/wasm: use type analysis to remove some unnecessary uses of JavasScript strict equality (#2040)
  • Compiler/wasm: use more precise environment types (#2041)
  • Compiler/wasm: optimize calls to statically known function (#2044)
  • Runtime: use es6 class (#1840)
  • Runtime: support more Unix functions (#1829)
  • Runtime: remove polyfill for Map to simplify MlObjectTable implementation (#1846)
  • Runtime: refactor caml_xmlhttprequest_create implementation (#1846)
  • Runtime: update constant imports to use node:fs module (#1850)
  • Runtime: make Obj.dup work with floats and boxed numbers (#1871)
  • Runtime: delete BigStringReader, one should use UInt8ArrayReader instead
  • Runtime: less conversion during un-marshalling (#1889)
  • Runtime: use TextEncoder/TextDecoder for utf8-utf16 conversions
  • Runtime: use Dataview to convert between floats and bit representation
  • Runtime: optimize Str.search_forward/search_backward (#2056)
  • Runtime: deprecate caml_ba_create_from (#2056)
  • Runtime: check for unused variable in the runtime (#2056)
  • Runtime/wasm: implement BLAKE2b primitives for Wasm (#1873)
  • Runtime/wasm: support jsoo_env and keep track of backtrace status (#1881)
  • Runtime/wasm: support unmarshaling compressed data (#1898)
  • Runtime/wasm: make resuming a continuation more efficient in Wasm (#1892)
  • Runtime/wasm: use imported string constants for JavaScript strings (#2022)
  • Runtime/wasm: use DataView primitives to implement bigarrays (#1979)
  • Ppx: explicitly disallow polymorphic method (#1897)
  • Ppx: allow "function" in object literals (#1897)
  • Lib: add Dom_html.window.matchMedia & Dom_html.mediaQueryList (#2017)
  • Lib: make the Wasm version of Json.output work with native ints and JavaScript objects (#1872)

Bug fixes

  • Compiler: fix stack overflow issues with double translation (#1869)
  • Compiler: minifier fix (#1867)
  • Compiler: fix shortvar with --enable es6 (AssignTarget was not properly handled)
  • Compiler: fix assert failure with double translation (#1870)
  • Compiler: fix path rewriting of Wasm source maps (#1882)
  • Compiler: fix global dead code in presence of dead tailcall (#2010)
  • Compiler/wasm: fix bound check for empty float array (#1904)
  • Runtime: fix path normalization (#1848)
  • Runtime: fix reading from the pseudo-filesystem (#1859)
  • Runtime: fix initialization of standard streams under Windows (#1849)
  • Runtime: fix Int64.of_string overflow check (#1874)
  • Runtime: fix caml_string_concat when not using JS strings (#1874)
  • Runtime: consistent bigarray hashing across all architectures (#1977)
  • Runtime: fix caml_utf8_of_utf16 bug in high surrogate case (#2008)
  • Runtime: fix method lookup (#2034, #2038, #2039)
  • Lib: fix Dom_html.Keyboard_code.of_event (#1878)
  • Tools: fix jsoo_mktop and jsoo_mkcmis (#1877)
  • Toplevel: fix for when use-js-strings is disabled (#1997)

6.0.1

Choose a tag to compare

@hhugo hhugo released this 07 Feb 12:06
b6d60e4

CHANGES:

Features/Changes

  • Compiler/Runtime: Make resuming a continuation more efficient in js (#1765)
  • Compiler/Runtime: Effects: add an optional feature of "dynamic switching" between CPS
    and direct style, resulting in better performance when
    no effect handler is installed
  • Compiler: Merged Wasm_of_ocaml (#1724)
  • Lib: fix the type of some DOM properties and methods (#1747)
  • Lib: removed no longer relevant Js.optdef type annotations (#1769)
  • Lib: Add other textMetrics property (#1784)
  • Lib: rename Firebug to Console (#1802)
  • Test: use dune test stanzas (#1631)
  • Test: run wasm tests on windows
  • Misc: drop support for IE
  • Misc: move tests to OCaml 5.3
  • Misc: import many test from the OCaml codebase
  • Runtime: support for float16 bigarrays
  • Runtime: support more Unix functions (#1823)
  • Runtime: various filesystem fixes (#1825)

Bug fixes

  • Compiler: Fix small bug in global data flow analysis (#1768)
  • Runtime: no longer leak channels
  • Runtime: Fix Marshal.to_buffer (#1798)
  • Runtime: unmarshalling objects should refresh its id
  • Runtime: check size upper bound during array creation
  • Runtime: return sys_error when reading from a closed channels
  • Runtime: fix parsing of hex-float with very large exponent
  • Runtime: make sure [n / 0L] is not optimized away by DCE
  • Runtime: fix Unix.LargeFile.stat/lstat
  • Runtime: fix stat/lstat times
  • Runtime: fix reading from stdin in an interactive nodejs

6.0.0

Choose a tag to compare

@hhugo hhugo released this 03 Feb 23:58

CHANGES:

Features/Changes

  • Compiler/Runtime: Make resuming a continuation more efficient in js (#1765)
  • Compiler/Runtime: Effects: add an optional feature of "dynamic switching" between CPS
    and direct style, resulting in better performance when
    no effect handler is installed
  • Compiler: Merged Wasm_of_ocaml (#1724)
  • Lib: fix the type of some DOM properties and methods (#1747)
  • Lib: removed no longer relevant Js.optdef type annotations (#1769)
  • Lib: Add other textMetrics property (#1784)
  • Lib: rename Firebug to Console (#1802)
  • Test: use dune test stanzas (#1631)
  • Test: run wasm tests on windows
  • Misc: drop support for IE
  • Misc: move tests to OCaml 5.3
  • Misc: import many test from the OCaml codebase
  • Runtime: support for float16 bigarrays
  • Runtime: support more Unix functions (#1823)
  • Runtime: various filesystem fixes (#1825)

Bug fixes

  • Compiler: Fix small bug in global data flow analysis (#1768)
  • Runtime: no longer leak channels
  • Runtime: Fix Marshal.to_buffer (#1798)
  • Runtime: unmarshalling objects should refresh its id
  • Runtime: check size upper bound during array creation
  • Runtime: return sys_error when reading from a closed channels
  • Runtime: fix parsing of hex-float with very large exponent
  • Runtime: make sure [n / 0L] is not optimized away by DCE
  • Runtime: fix Unix.LargeFile.stat/lstat
  • Runtime: fix stat/lstat times
  • Runtime: fix reading from stdin in an interactive nodejs