ReviewOS

zig-utils/zig-js

Optimizer: execute rooted class definition effects with exact activation recovery

#1110
Closed chris opened this 10 days ago ·
10 days ago

Parent: #467. Executed on main3100f072, ReleaseSafe/Darwin, real collector.

Three required-bytecode functions returning plain, derived, and private-field classes are warmed64 times. Node and zig-js both produce[7,8,9]. Every function publishes a ready optimizer artifact, but its only runtime descriptor is at origin0 (enter_block) and its effect side-exit is also at origin0 with an empty operand stack. No class construction or heritage operation appears in those artifacts. Artifact presence is therefore not native class-effect admission.

Implement ordered class lexical-environment entry/exit, heritage's exact two-result transport, per-evaluation PrivateEnvironment preparation, and canonical class template evaluation, including computed/inferred names, captured activation views, static blocks/fields, methods/private identities and constructor initialization. Preserve precise rooted input/result transport, active environment/private/strict state, exact handler/unwind and completed-effect recovery, and callback budget/termination/OOM behavior. Unsupported surrounding control must still recover exactly while these owned effects actually execute.

Acceptance: executed native descriptor/artifact witnesses for each effect; forced off/on and tree/required-bytecode oracles in serialized/no-GIL Debug/ReleaseSafe/unsuppressed TSan; actual moving-GC and exact exception/no-replay/step/fault recovery; exact-parent class/super/private/eval failing paths; full unchanged fuzz and threading gates. Do not infer completion from published artifacts or working fallback. General class/tier parent acceptance remains separate.

10 days ago

Progress on main:\n\n- 40133162 feat(jit): execute class definition effects natively\n - native ordered enter_block/exit_block, prepare_class_heritage (two results), prepare_class_private_environment, and eval_class dispatch\n - optimizer graph admission, descriptor/result-count verification, scratch/result transport, and rooted class inputs\n - executed descriptor and runtime-operation witnesses in src/vm.zig\n\n- 98d4f9c test(jit): cover computed class recovery\n - computed class names, computed methods/static fields, private field, heritage, and static block\n - throwing static block increments exactly once per call through optimizer recovery (no replay)\n\nFocused serialized results (Zig 0.18.0-dev.146, aarch64):\n- optimizer executes native class definition effects: 2/2 passed\n- optimizer preserves computed class names and static blocks: 2/2 passed\n- native class exception resumes without replaying static effects: 2/2 passed\n\nIssue remains open pending moving-GC, OOM/step/fault recovery, forced optimizer-off/on exact-parent differential, and serialized Debug/ReleaseSafe/unsuppressed TSan/fuzz/relevant conformance gates.

10 days ago

Additional evidence on main:\n\n- cbdcd58 test(jit): witness native class moving gc\n - warms the existing computed-private class builder through optimizer publication\n - asserts an executed eval_class descriptor and runtime-operation witness\n - forces the existing moving collection path and preserves the relocated subject/result\n\nSerialized focused result (Zig 0.18.0-dev.146, aarch64):\n- computed class private environment survives an actual moving collection: 2/2 passed

10 days ago

JIT gate result after eff50cd:\n\n- zig build test-jit: 161 passed; 1 skipped; 0 failed; 0 leaked.\n- The only initial failures were stale side-exit matrix entries for class effects; eff50cd removes those now-continuable class operations from the terminal-side-exit fixtures.\n- No concurrent corpus or unit jobs were run.

10 days ago

Exact-parent differential added and pushed in 453ad44:\n\n- vm: class definitions agree across tree bytecode and native parents\n- tree-walker: passed\n- required bytecode with JIT disabled: passed\n- required bytecode with JIT enabled: passed, including an executed eval_class descriptor witness\n\nFocused serialized result: 2/2 passed.

10 days ago

Thread corpus gate completed on Zig 0.18.0-dev.146: zig build threads-test passed 246/246 corpus files. This includes moving-GC, OOM, termination, stack limits, JIT/OSR, atomics, synchronization, and VM-state cases; no failures were reported. The issue remains open pending no-GIL, bounded fuzz, sanitizer, and remaining class-specific recovery evidence.

10 days ago

Bounded fuzz gate completed: zig build threadfuzz -Dfuzz-iters=400 passed 400 deterministic programs from seed 1 with 0 failures in 209,008 ms. The issue remains open pending no-GIL, sanitizer, and remaining class-specific recovery evidence.

10 days ago

No-GIL gate completed on Zig 0.18.0-dev.146: zig build threads-test -Dthreads-parallel-js=true passed 253/253 corpus files. This included no-GIL moving-GC, OOM, termination, JIT/OSR, optimizer invalidation/reclamation, atomics/races, and VM-state coverage with no failures. The issue remains open pending sanitizer evidence and remaining class-specific recovery checks.

10 days ago

Pushed ff795be4 (test(jit): cover class step recovery). The focused VM test passed 2/2: a native eval_class witness arms the step budget from a static-block host callback, the call exits with RangeError, the callback runs once, and static effects remain exact-once (24 warm-up effects, 25 after the interrupted evaluation). No source replay occurred. The issue remains open pending full JIT rerun, sanitizer evidence, and final class recovery audit.

10 days ago

Full JIT gate after ff795be4: zig build test-jit passed 161 tests, skipped 1 platform-specific Linux writer test, with 0 failures and 0 leaks. The pushed class step-recovery coverage is included. Proceeding to the narrower unsuppressed TSan JIT gate before considering the full suite.

10 days ago

Unsuppressed TSan JIT gate completed: zig build test-jit -Dtsan=true passed 161 tests, skipped 1 platform-specific test, with 0 failures and 0 leaks. No sanitizer report was emitted. Debug and TSan JIT evidence are now green; ReleaseSafe JIT is next.

10 days ago

ReleaseSafe JIT gate completed: zig build test-jit -Doptimize=ReleaseSafe passed 161 tests, skipped 1 platform-specific test, with 0 failures and 0 leaks. Across Debug, ReleaseSafe, and unsuppressed TSan, the JIT gate is green. I am adding one native class OOM rollback witness before the final full-suite decision.

10 days ago

Pushed 6f105d3c (test(jit): cover class OOM recovery). The focused VM test passed 2/2: native eval_class receives an injected OOM during a static block, preserves one completed effect without replaying it, returns cleanly to the caller environment with depth 0 and empty GC root stacks, and records native eval_class execution. This closes the class-specific OOM/rollback coverage gap.

10 days ago

Final pushed-tree verification for #1110 is complete.

Implementation and recovery coverage landed directly on main in 40133162, 98d4f9c, cbdcd58, eff50cd, 453ad44, ff795be, and 6f105d3.

Final exact-tree gates:

  • Debug JIT: 161 passed, 1 skipped, 0 failed, 0 leaked
  • ReleaseSafe JIT: 161 passed, 1 skipped, 0 failed, 0 leaked
  • Unsuppressed TSan JIT: 161 passed, 1 skipped, 0 failed, 0 leaked; no sanitizer output
  • GIL thread corpus: 246/246
  • no-GIL thread corpus: 253/253
  • deterministic thread fuzz: 400/400

Focused witnesses cover executed native class artifacts, exact-parent tree/bytecode differentials, moving GC, exception/no-replay, step-budget recovery, and OOM rollback/teardown. The lone skip is the existing platform-specific perf-jitdump case. All commits use glennmichaeltorregosa gtorregosa@gmail.com with no trailers or coauthors.

Sign in to comment on this issue.