Repository activity
40458 results across all weeks
Compiler: make the JS lexer state mutable
Based on #2503; the diff is the single commit on top of it.
hhugoCompiler: no location events when only reading the variable names
With --pretty, the debug information is read for the variable names, which also brought in the location events, even when neither a source map nor debug information is produced. The locations are then useless.
Jérôme Vouillon (@vouillon)Compiler: omit [| 0] after [>>>] by a constant in [1, 31]
x >>> k with a constant k in [1, 31] is in [0, 2^31), so it does not need to be coerced to a 32-bit integer:
hhugoCompiler: propagate the value of the variable tested by a conditional
Along the second edge of Cond (x, _, _), x is zero; along the
Jérôme Vouillon (@vouillon)Compiler: raise exceptions with an argument through a runtime function
raise (E arg) was compiled to
hhugoCompiler: recursive-descent JavaScript parser
Replace the Menhir-based JavaScript parser (Parse_js) with a hand-written recursive-descent parser over the same Flow lexer.
hhugoCompiler: relax the invariant of assigned variables
A parameter x of a try block assigned in its body can now also be read in the arguments of the handler continuation of this block. These arguments are evaluated in the handler, in both backends, so this read does see the last value assigned to x.
Jérôme Vouillon (@vouillon)Compiler: share identical literals when parsing bytecode
The OCaml compiler allocates a global slot for each occurrence of a literal, and each slot became its own variable bound to its own copy of the constant. Literals are immutable, so slots holding identical literals now share a single variable (share_literal in parse_bytecode.ml). Since this happens at parse time, both the JavaScript and the Wasm backends bene…
hhugoCompiler: share identical structured constants
Structured constants (lists, tuples, variants, and in particular the ASTs of format strings) are immutable, but the code generator emitted a fresh array literal for each occurrence. For instance, every Format string containing @ carried its own copy of Break ("@ ", 1, 0): [0, "@ ", 1, 0] appeared 1445 times in ocamlc.byte compiled to JavaScript.
hhugoCompiler: sink pure instructions into the branch that uses them
New IR pass (Branch_sinking), run just before JavaScript code generation.
hhugoCompiler: test integers against 0 by truthiness
Two small code generation improvements.
hhugoCompiler: tune the GC space overhead
The compiler allocates a lot, and keeps a large live heap when compiling a large program. With the default space_overhead (120), the major GC accounts for about a quarter of the compilation time.
hhugoCompiler: use the bytecode hint on integer equality tests
With OCaml 5.6, EQ and NEQ instructions implementing an integer equality test (rather than a physical comparison) carry the hint Hint_int_equality_test (ocaml/ocaml#15135). Record it in the IR as Eq { int_only } / Neq { int_only }.
Jérôme Vouillon (@vouillon)Compiler: use the value of a tested variable in its branches
New IR pass (Cond_refine), run just before the last dead code elimination, JavaScript target only:
hhugoConversion counters
This adds two debug flags that count, at run time, the representation conversions executed by code compiled with wasm_of_ocaml. The counts are exact and deterministic, unlike timings. That makes them useful for judging changes to how numbers are represented: unboxing, int typing, or where conversions are placed.
Jérôme Vouillon (@vouillon)Experiment with some static evalution
Jérôme Vouillon (@vouillon)Experiment: benchmark with wasm-opt disabled
@hhugo: Benchmark summary for this experiment. This branch is #2238 (fast-o1) plus one commit that drops wasm-opt at every --opt level, so the meaningful comparison is against #2238's own run (f7d80dc26, run 5 minutes after this one), not against master: the bench UI's master comparison blends in the #2238 and #2506 changes.
Jérôme Vouillon (@vouillon)Fix float formatting to match native
Jérôme Vouillon (@vouillon)Globalize improvements
Jérôme Vouillon (@vouillon)Inlining improvements
Jérôme Vouillon (@vouillon)