Skip to content

GP-PERF-2: continuation-preserving Execute-of-user and cheaper snapshots - #4210

Open
s243a wants to merge 4 commits into
grok/wamjs-perffrom
grok/wamjs-perf2
Open

GP-PERF-2: continuation-preserving Execute-of-user and cheaper snapshots#4210
s243a wants to merge 4 commits into
grok/wamjs-perffrom
grok/wamjs-perf2

Conversation

@s243a

@s243a s243a commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Round-2 JS-WAM performance on top of grok/wamjs-perf (GP-PERF-2).

Result

Official run_differential_wamjs.sh: oracle 0.056s, wamjs 2.187s, 5067 lines, 0 divergences, 0 message mismatches, corpus 17/17.

Stage 5067 wall vs R1 3.271s vs A2 4.639s 200-line instr
A2 interpreter 4.639s 1.00× interpreter
Round 1 3.271s (docs 3.144s) 1.00× 1.42× 20,667
L1 Y-save on every Call 4.978s regression
L1b Y-save iff Y live after Call 3.014s 1.09× 1.54× 8,985
L2+L3 nil/cons + lite ITE + builtin Execute 2.211s 1.48× 2.10× 0
L4 direct JS Call/Execute 2.187s 1.50× 2.12× 0

Target was ≥3× vs round 1 / ≥4.5× vs A2. Not met. L1b paid wrapper lowering; L2 paid the snapshot cut; L4 was essentially flat.

What changed

  • Execute-of-user without stealing the query continuation: lowered-to-lowered is JS return; interpreted callee uses execute_user_isolated (save CP, cp=0 so isolated Proceed halts, restore CP).
  • Y-save on Call only when Y is live after the Call (corpus test 1 / parse_args/2 + default_registry/1).
  • T4 nil/cons dispatch (no copy_table on bound A1); unifying ITE uses snapshot_lite.
  • Direct JS function Call/Execute; Call/Execute of sub_string/5 is op_builtin.
  • drop_brackets/2 and substring wrappers lower. Argparser build has no fallbacks.

Continuation integrity

WAM Execute does not modify CP. Lowered Proceed is return true. Isolated interpreted Execute must not resume at the query CP (cp=0 inside isolate); restoring CP makes the wrapper's return the real Proceed.

Fallback list (argparser)

None. All 43 compiled predicates lower.

Residual / next lever

Unbound-A1 T4 still copies the register file; unifying ITE still snapshot_lites A/X; recursive Call still allocates Y frames (Y-snapshot convention, not Lua locals). Next: skip snapshot_lite on read-only ITE conditions, and/or intern default_registry/1 at emit time.

Gates

  • tests/test_wam_javascript_lowered.pl (nested Execute + Call-then-continue probes)
  • tests/test_wam_javascript_builtins.pl (parser / term-meta / string / profiling probes)
  • tests/test_wam_javascript_fact_sources.pl
  • Corpus 17/17; differential 0/0
  • CONFORMANCE_TARGETS=javascript is still the coordinator patch in INTEGRATION_PATCH.md (harness not edited)
Open in Web Open in Cursor 

cursoragent and others added 4 commits September 1, 2026 13:38
Lower wrappers (parse_args/2, Execute of user/builtins) without stealing
the query continuation: isolated interpreted Execute restores CP, and
JS return is Proceed for lowered callees. T4 list recursion uses nil/cons
dispatch; unifying ITE snapshots A/X lite. Call/Execute of a lowered
callee is a direct JS function call; Call of sub_string/5 is op_builtin.

Co-authored-by: johns243a <johns243a@gmail.com>
Skip the per-Call dispatch-table lookup and cp/pc save when the callee
is a hoisted lowered function. Call/Execute of sub_string/5 is op_builtin
(same first-solution as the interpreter). Profile counts live on the
inner function so UW_PROFILE still sees recursive Calls.

Co-authored-by: johns243a <johns243a@gmail.com>
All 43 argparser predicates lower (no fallback comments). Direct JS
Call/Execute, nil/cons T4, lite ITE, and execute_user_isolated are in
the emitted runtime.

Co-authored-by: johns243a <johns243a@gmail.com>
5067-line differential: 2.187s (2.12× vs A2 4.639s, 1.50× vs round-1
this-VM 3.271s), 0 divergences. Wrappers lower; interpreter instr 0 on
the 200-line profile. Residual is still the lowered-tier snapshots.

Co-authored-by: johns243a <johns243a@gmail.com>
@s243a
s243a marked this pull request as ready for review September 1, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants