Commit Graph
503 Commits
Author SHA1 Message Date
Malte Ubl 213cf287b9 Emit inline retain/release fast paths under --optimization=speed (H30)
Re-lands perf/h30-inline-rc (00051ca0, 40398773, 07972360) behind the
speed posture. With inline RC on, every mirrored runtime RC family
retains inline and releases inline down to the rc == 1 / new cycle
candidate slow path (shapes.ts INLINE_RC_FAMILIES). Release emission is
unchanged: ShapeHost.rcHelpers is null unless LlvmTargetOptions.inlineRc
is set, and every retain/release (including capture boxes) stays a
runtime call; the %ScrMapRc type is only emitted with inline RC.

- index.ts and native/prepare.ts pass inlineRc for speed executables,
  speed object/asm emission, and speed library profiles.
- scr_runtime.h keeps H30's static asserts for the mirrored header and
  trace-slot offsets (no code change; the rebuilt macOS pack's manifest is
  identical to the baseline's).
- Tests: shapes.test.ts pins release symbols and H30's speed fast paths
  and header offsets; emitter.test.ts pins that release IR is unchanged
  and speed routes releases through the helpers. The differential harness
  gains `// @optimization: speed` (and a SCRIPTC_TEST_OPTIMIZATION=speed
  lane); corpus 4032 pins every mirrored family under speed.

Release executables stay byte-identical to the stack tip (14/14
workloads, macOS).
2026-10-08 15:46:34 -05:00
Malte Ubl c0e2d097eb Update self-hosting emission cases for the inline allocator
The full emitter inlines the small-object allocator on 64-bit host targets,
so the self-hosting layout fixture's host enables inlineAlloc for 64-bit
requests (as emitLlvmModule does), and the recursive-records case no longer
asserts the width-specific free path (64-bit pushes onto the allocator's
free list; 32-bit calls scr_cyc_free).

(Split from the stack's later "Update self-hosting emission cases for
acyclic proofs and inline allocation"; the acyclic-proof half moves to the
construction-only acyclic change.)
2026-10-08 15:36:07 -05:00
Malte Ubl 2df14f1550 Update self-hosting cases for construction-only acyclic proofs
Constructor-only references are now proven acyclic (cycle-analysis.ts), so
the self-hosting cases that meant to exercise the collector through such
edges no longer saw a cycle:

- emission: the nullable-union and mutually-recursive-class cases add an
  array edge (always mutable) to keep the traced path, and a new case pins
  the acyclic form of the nullable-union record.
- backend analysis: "removing a leaf preserves another cyclic branch"
  closes its cycle through an array edge.

(Split from the stack's later "Update self-hosting emission cases for
acyclic proofs and inline allocation"; the inline-allocation half moves to
the inline-allocation change.) tests/harness/self-hosting-emission.test.ts
and self-hosting-backend-analysis.test.ts pass at this point of the stack.
2026-10-08 15:26:31 -05:00
Malte Ubl dedb568ade Pin wrong-typed input on the schema-directed JSON.parse path
Seventeen Order inputs whose shape disagrees with the target (wrong leaf
kinds at the top level, in nested records, record arrays and string
arrays; null for object and number; missing fields; object vs array at a
field and at the root; duplicate keys; truncated JSON; 1e400 and a lone
surrogate; extra nested members; reordered keys) plus an Item[] root.
The expected lines are the output of the checked-route-only build
(perf/harness); the fast path must decline or agree on every one.
2026-10-08 15:05:00 -05:00
Malte Ubl 0c2232deb0 Parse typed JSON straight into native records
`JSON.parse(text) as T` used to build a checked-dynamic ScrDyn tree, copy
it into the native layout with the generated dynCheck builder, and then
dispose the tree. Together that was about 68% of json-records.

For record/array targets with number, boolean and string leaves, the
backend now emits a ScrJsonSchema (field offsets in declaration order,
constructors, releases) and a wrapper. The wrapper calls the new
scr_json_parse_schema, a one-pass parser that writes directly into native
records and arrays. Whenever it declines (syntax errors anywhere, kind
mismatches, missing or duplicate declared keys, excess depth) it releases
its partial value without throwing, and the wrapper reruns the unchanged
scr_json_parse + dynCheck route. Every error message and position stays
byte-identical. The lexer helpers are shared through a quiet mode and a
factored number scanner, so values decode bit-identically.

Tests: new differential corpus program json-typed-parse-direct.ts; a
dyncheck harness case comparing typed and untyped error messages through
the fused path; white-box C tests for accept/decline and leak-freedom in
scr_json.test.c; an LLVM emission test (64-bit and wasm32).

Linux (sandbox x86_64, runs=15):
| workload | baseline ms | candidate ms | change | 95% CI | verdict | size | node ms | candidate/node |
| --- | ---: | ---: | ---: | --- | --- | ---: | ---: | ---: |
| json-records | 713.2 | 249.3 | -65.0% | -65.6% .. -64.1% | faster | +2.2% | 439.04 | 0.57x |
| regex-logs | 350.8 | 353.7 | +0.8% | -0.9% .. +2.3% | neutral | +0.0% | 238.42 | 1.48x |
| ast-interp | 379.1 | 376.8 | -0.6% | -1.8% .. +0.4% | neutral | +0.0% | 227.45 | 1.66x |
| records-sort | 1200.5 | 1207.8 | +0.6% | -2.4% .. +5.7% | neutral | +0.0% | 232.17 | 5.20x |
| template-render | 248.3 | 248.1 | -0.1% | -2.3% .. +1.0% | neutral | +0.0% | 202.16 | 1.23x |
| functional-pipeline | 402.0 | 395.3 | -1.6% | -3.8% .. +0.5% | neutral | +0.0% | 254.57 | 1.55x |
| async-pipeline | 202.4 | 201.7 | -0.3% | -1.4% .. +2.0% | neutral | +0.0% | 90.14 | 2.24x |
| word-graph | 366.9 | 348.2 | -5.1% | -12.9% .. +4.3% | neutral | +0.0% | 576.56 | 0.60x |
| alloc-trees | 513.5 | 525.5 | +2.3% | -2.1% .. +4.0% | neutral | +0.0% | 132.99 | 3.95x |
| numeric-kernels | 121.4 | 122.5 | +0.8% | -1.9% .. +3.6% | neutral | +0.0% | 135.91 | 0.90x |
| validate-errors | 206.0 | 209.2 | +1.5% | -3.6% .. +4.1% | neutral | +0.0% | 703.47 | 0.30x |
| csv-numbers | 450.9 | 448.6 | -0.5% | -2.2% .. +2.0% | neutral | +0.0% | 499.25 | 0.90x |
| log-summary | 253.5 | 252.6 | -0.3% | -1.5% .. +2.0% | neutral | +0.0% | 279.67 | 0.90x |
| inventory-report | 433.7 | 433.2 | -0.1% | -6.0% .. +3.6% | neutral | +0.0% | 413.79 | 1.05x |
geomean change -7.4%; geomean candidate/node 1.321x -> 1.223x

macOS (arm64, runs=15):
| workload | baseline ms | candidate ms | change | 95% CI | verdict | size | node ms | candidate/node |
| --- | ---: | ---: | ---: | --- | --- | ---: | ---: | ---: |
| json-records | 292.3 | 153.0 | -47.7% | -50.1% .. -46.6% | faster | +0.4% | 248.7 | 0.61x |
| (all 13 other workloads neutral; see results/h16-typed-json/local-1.json) |
geomean change -4.8%; geomean candidate/node 1.497x -> 1.425x
2026-10-08 15:05:00 -05:00
Malte Ubl 994a6b9940 Raise the Linux static hello size ceiling to 80 KiB
The tree-shaking test failed on Linux x64 with "expected 68344 to be less
than 65536". Measured with the release helper/runtime-pack pipeline in a
Linux x64 sandbox (hello = console.log("hello", "world")):

  PR    file   .text  R+E segment
  #743  64256  15794  0x3f11
  #744  68416  16050  0x4011
  #764  68520  16546  0x4221

The allocator adds 256 bytes of .text to hello: the inline scr_mem_free
fast path in the release functions hello already links (scr_str_release,
scr_arr_destroy, scr_arr_gc_free, scr_cyc_free, scr_dyn_dispose). Its
slow path and address-space reservation (scr_sa_slow, scr_sa_reserve)
are already stripped from hello. ELF segments are page aligned, and #743
left only 239 bytes before the executable segment's 16 KiB page, so 17
bytes over the boundary move every later segment, and the file, by 4 KiB.

Shrinking hello back under the old ceiling is not a reasonable trade.
At the top of the stack the executable segment is 545 bytes past the
page boundary. The extra bytes come from hot-path code the later PRs add
on purpose (number-to-string fast paths in scr_f64_to_str, inline-alloc
release paths, the direct fd write), all reached through console.log's
generic argument rendering. Outlining them to save one page would undo
the optimizations those PRs add.

The ceiling's documented intent is "several native pages of
linker-version slack" above a hello that the comment put at about 41KB.
That no longer held before this stack (64256 bytes on #743, 1.2 KiB of
slack). 80 KiB restores about three pages of slack over the stack's
largest hello and still catches lost section GC (the old always-linked
runtime was about 400KB). Symbol absence remains the primary
reachability contract. The Mach-O ceiling is unchanged.

Verified in the Linux x64 sandbox: pnpm test
tests/harness/runtime-tree-shaking.test.ts fails on #744 before this
change (68416 vs 65536) and passes after it, on #744 and on #764.
2026-10-08 15:01:26 -05:00
Malte Ubl 70dfdbd61e Route strings, arrays and emitted records through the small-object allocator
Move the allocator into scr_alloc.c with inline fast paths in scr_runtime.h;
strings, array headers/slot buffers, and emitted acyclic records/classes
(scr_rt_calloc/scr_rt_free) now use it. Adds scr_alloc.test.{c,ts}.
2026-10-08 15:01:26 -05:00
Chris TateandChris Tate 08f4140293 Harden stacked CI scope and merge validation (#771)
Co-authored-by: Chris Tate <366502+ctate@users.noreply.github.com>
2026-10-08 14:57:21 -05:00
Chris TateandChris Tate 064b05a92c Run full CI for the lowest unmerged stacked PR (#770)
Co-authored-by: Chris Tate <366502+ctate@users.noreply.github.com>
2026-10-08 14:49:10 -05:00
Chris Tate 1f10e83720 Promote canary to main (#738)
- Preserve callback identity, receiver binding, and class references across unions and collections.
- Track record field presence independently of undefined values and improve native runtime behavior.
- Expand differential coverage and streamline CI bootstrap and compiler rebuild checks.
2026-10-08 11:00:13 -05:00
Chris Tate 095b619330 Add native workers and shared memory
- Add native worker execution with isolated module state, structured messages, and lifecycle controls.
- Support shared buffers and integer atomics with coordinated runtime ownership and cancellation.
- Extend compiler, runtime-pack, differential, and compatibility coverage for native concurrency.
2026-10-07 19:07:02 -05:00
Chris Tate a8bc0f6abf Optimize scalar string access and numeric calls
- Avoid materializing scalar string slices and preserve index metadata.
- Specialize known callbacks and numeric call boundaries.
- Lower proved integer remainders without changing number semantics.
2026-10-07 15:39:05 -05:00
Chris Tate 13291c68d3 Preserve interface identity and extend native library calls
- Preserve live class identity through interface receivers and object methods.
- Extend synchronous text reads and regular expression replacement callbacks.
- Keep unsupported generic dispatch boundaries explicit.
2026-10-07 13:55:11 -05:00
Chris Tate 6aa48c111a Strengthen generic type and class boundaries
- Support concrete generic inheritance, forward references, and nullable substitutions.
- Bound recursive specialization demands while preserving independent concrete uses.
- Preserve class identity through checked assertions and contextual lowering.
2026-10-07 11:47:54 -05:00
Chris Tate 4ec55cdf64 Accelerate default primitive array ordering (#721)
- Sort primitive arrays with stable native ordering and pure conversion keys.
- Preserve sparse semantics and argument effects while avoiding callback overhead.
- Verify Unicode ordering and ownership across native and WASI paths.
2026-10-07 08:15:08 -05:00
Chris Tate 4443271578 Optimize synchronous callback ownership (#720) 2026-10-07 06:48:58 -05:00
Chris Tate ec9376d48e Streamline semantic analysis and AST caching (#719) 2026-10-07 04:21:51 -05:00
Chris Tate f94e9b199d Optimize native byte record processing (#715)
- Infer complete byte-record extents and bounded output cursors for ordinary Buffer, DataView, and typed-array loops.
- Emit proved numeric fields directly while preserving checked fallbacks, error ordering, and debugger-visible storage.
- Cover aliases, partial records, expanding output, and numeric boundaries across native and WASI execution.
2026-10-06 22:19:41 -05:00
Chris Tate 763541b433 Stream string split loops
- Stream eligible split loops while preserving snapshots, bindings, and cleanup.
- Reuse unescaped piece storage and batch materialized results.
- Cover limits, Unicode, debugging, and native/WASI behavior.
2026-10-06 19:01:30 -05:00
Chris Tate 25b7fd266a Streamline structured text output
- Share bulk string writes and JSON formatting paths.
- Append scalar values directly and streamline exact integer formatting.
- Cover output boundaries and clarify runtime-pack identity failures.
2026-10-06 17:25:57 -05:00
Chris Tate f053c81f8f Refactor builtin lowering by API responsibility
- Split builtin lowering into focused API owners and keep module dispatch separate.
- Share byte conversion, receiver checks, and filesystem option parsing; remove redundant forwarding and clarify names.
- Preserve compiler output and diagnostics, with import boundaries enforced by the code-quality checks.
2026-10-06 14:13:28 -05:00
Chris Tate 9482cbadcb Optimize typed-array numeric processing (#709)
- Streamline typed-array conversion, copying, and filling.
- Share exact integer coercion across typed storage and scalar operators.
- Cover numeric boundaries, aliased buffers, and portable execution.
2026-10-06 13:07:11 -05:00
Chris Tate 0ba86b289a Optimize keyed collection and object processing
- Speed up string-keyed collections and wide object property lookup.
- Share scalable numeric-key ordering across typed and checked objects.
- Preserve property, iteration, and ownership behavior across native and WASI targets.
2026-10-06 11:49:04 -05:00
Chris Tate e0bb196a73 Optimize text and byte conversion paths
- Reduce temporary storage and per-byte overhead across Buffer conversions, bounded writes, and text encoding.
- Support runtime Buffer string encodings with consistent defaults, aliases, and catchable errors.
- Cover conversion boundaries, partial writes, malformed inputs, and retained outputs across native and WASI execution.
2026-10-06 10:27:25 -05:00
Chris Tate 0b52b24d30 Optimize stable collection ordering
- Share adaptive stable sorting across arrays and byte arrays, reusing captured values and merge inputs.
- Use bounded-domain ordering for default byte sorting.
- Preserve sparse values, stable ties, callback effects, and reference lifetimes with native and portable coverage.
2026-10-06 09:28:35 -05:00
Chris Tate 88e6e6dcd0 Streamline class callbacks and compiler source access
- Defer empty callback storage while preserving method and prototype updates.
- Reuse source and node-handle information within compiler snapshots.
- Coalesce small checker requests and avoid response copies.
2026-10-06 08:10:34 -05:00
Chris Tate 05c24f6a41 Streamline local tagged values and collection reads
- Keep projection-only tagged values in local storage across branches and reassignment.
- Fuse optional array reads and avoid temporary wrappers for tag and string conversions.
- Preserve payload ownership across mutation, sparse iteration, and exception cleanup.
2026-10-06 06:51:14 -05:00
Chris Tate d3a165997b Optimize literal dispatch and source processing
- Lower literal switches to guarded native dispatch while preserving control flow and evaluation order.
- Reduce repeated AST lookup, traversal ownership, and source classification work.
- Share UTF-8 validation and decode spans directly into final string storage.
2026-10-06 04:19:01 -05:00
Chris Tate 52cca919f5 Refactor native toolchain ownership and shared build operations
- Separate driver, fingerprint, artifact, and build responsibilities.
- Share shard selection, trace parsing, cache staging, and stamp publication.
- Preserve cache invalidation and enforce implementation imports.
2026-10-05 20:48:48 -05:00
Chris Tate 6d16696b8e Refactor container lowering and callback builders
- Give arrays, collections, iterators, and indexed objects explicit lowering owners.
- Share callback frames and live collection iteration while preserving existing behavior.
- Enforce container ownership boundaries with compiler quality checks.
2026-10-05 20:00:42 -05:00
Chris Tate 38aa6230e7 Refactor function lowering and native call contracts
- Separate function signatures, argument completion, specialization, and body construction from call dispatch.
- Share generic binding checks, argument prologues, return completion, and native input validation.
- Enforce direct implementation imports while preserving existing ABI and diagnostic behavior.
2026-10-05 19:19:32 -05:00
Chris Tate d575a5cfda Centralize builtin contracts and IR analysis ownership
- Derive builtin call names from shared signatures and keep call semantics with their ABI contracts.
- Separate runtime dependency detection, exception metadata, and library policy from the core IR while preserving existing exports.
- Enforce the frontend signature boundary and validate native compilation and policy behavior.
2026-10-05 18:36:03 -05:00
Chris Tate c08ab955ae Enforce linting and consistent source formatting
- Enforce oxlint and oxfmt for owned JavaScript and TypeScript with independent CI checks.
- Preserve compiler import boundaries and protected fixtures while cleaning up lint findings.
- Standardize source formatting and validate import, fixture, and embedded-source protections.
2026-10-05 17:51:24 -05:00
Chris Tate 665db543e2 Organize compiler conversions and builtin dispatch
- Separate conversion planning, helper generation, and timer lowering into focused modules.
- Share array, closure, record projection, and builtin dispatch logic, including timer namespace calls.
- Validate shared helpers with native correctness and differential coverage.
2026-10-05 16:21:22 -05:00
Chris Tate 98dd1b3f0f Optimize native file processing (#688)
- Read binary and text files into owned storage across filesystem entry points.
- Extend integer inference through module initialization and filtered processing loops.
- Preserve shared bindings, byte views, and filesystem error behavior.
2026-10-05 12:59:31 -05:00
Chris Tate 5de340f933 Optimize binary numeric pipelines
- Specialize standard Buffer and DataView numeric reads and writes while preserving checked errors, byte order, and unaligned access.
- Carry integer values through binary-processing loops and remove proven field bounds and receiver ownership overhead.
- Strengthen numeric IR validation and cover binary pipelines, edge cases, and native compiler parity.
2026-10-05 10:35:06 -05:00
Chris TateandEdwardXie d2cdd203fe Fix native Windows toolchain paths through package links
- Resolve installed toolchain assets from the physical manifest path.
- Cover linked-package launches in toolchain and native CLI regressions.
- Run the toolchain path regressions in Windows CI.

Fixes #682

Co-authored-by: EdwardXie <185573060+EdwardJoke@users.noreply.github.com>
2026-10-05 10:10:02 -05:00
Chris Tate 4427f1fb5a Expand native collection keys and construction
- Support boolean, bigint, and mixed value keys in native Maps and Sets.
- Reuse key hashes and copy collections directly into compact storage.
- Preserve collection identity, ordering, iteration, and ownership behavior.
2026-10-05 09:32:14 -05:00
Chris Tate 865f98ad0a Reduce temporary ownership for checked values (#681)
- Infer safe input lifetimes across checked reads, calls, conversions, and comparisons.
- Reuse immutable primitive values during construction and JSON parsing.
- Preserve callback ordering, result ownership, and exception cleanup.
2026-10-05 04:51:04 -05:00
Chris Tate c7f4cb1d42 Reduce ownership and allocation in text operations
- Extend safe borrowing across expressions and direct helpers.
- Remove redundant ownership work and avoid materializing regex predicate results.
- Support native regex string conversion with consistent flag ordering.
2026-10-05 03:48:06 -05:00
Chris Tate d31bf3c4f8 Reduce ownership overhead across helpers and collections
- Infer stable heap inputs and local aliases while preserving ownership of escaping values.
- Remove redundant ownership work from collection and byte operations.
- Cover mutation, exceptions, indirect calls, and native bootstrap behavior.
2026-10-05 02:24:35 -05:00
Chris Tate 0328efe2e3 Optimize integer loops and typed-array access
- Carry exact integer facts through branches, arithmetic, and computed indexes.
- Lower ascending, descending, and strided loops with guarded integer induction.
- Remove proven typed-array bounds checks while preserving number semantics and target-width safety.
2026-10-05 00:54:17 -05:00
Chris Tate 1d8c042a47 Separate native bootstrap validation phases
- Run command and self-rebuild checks independently in both validation lanes.
- Preserve complete local coverage and native package installation checks.
- Reject invalid phase selection and verify the CI matrix retains every contract.
2026-10-04 12:29:56 -05:00
Chris Tate 7efc573285 Add Node 24 filesystem-capacity queries (#666) 2026-10-04 11:12:43 -05:00
Chris Tate 668eb78124 Optimize native array loops and preserve live tuple iteration
- Reduce allocation and reference-management overhead in native array loops.
- Enable vectorization while preserving numeric behavior.
- Preserve live tuple iteration and cover reference lifetimes and missing values.
2026-10-04 10:38:10 -05:00
Chris Tate 46188eefe1 Add Node 24 filesystem link support (#664)
* Add Node 24 filesystem link support

* Use executable extensions in Windows link fixtures

* Remove Windows links without walking their targets

* Match Windows symlink inference and Buffer validation

* Match Node Windows symlink paths and fallback state

* Preserve Windows errors when following filesystem links
2026-10-04 09:46:00 -05:00
Chris Tate 4d3fe2c140 feat: support Node 24 filesystem timestamps (#663)
* feat: support Node 24 filesystem timestamp operations

* test: record frontend baselines for timestamp fixtures

* test: link timestamp validation into the runtime smoke test
2026-10-04 07:54:11 -05:00
Chris Tate a0b75e21bf perf: reuse class field metadata during IR validation (#662) 2026-10-04 06:45:43 -05:00
Chris Tate e7d5c67cdc Add Node 24 readable stream readers, controllers, and tee (#661) 2026-10-04 06:07:41 -05:00
Chris Tate 3aad3e8ebe Add Node 24 Web Stream pipelines and streaming encoding (#660) 2026-10-04 05:36:27 -05:00