GP-PERF-2: continuation-preserving Execute-of-user and cheaper snapshots - #4210
Open
s243a wants to merge 4 commits into
Open
GP-PERF-2: continuation-preserving Execute-of-user and cheaper snapshots#4210s243a wants to merge 4 commits into
s243a wants to merge 4 commits into
Conversation
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
marked this pull request as ready for review
September 1, 2026 13:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.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
return; interpreted callee usesexecute_user_isolated(save CP,cp=0so isolated Proceed halts, restore CP).parse_args/2+default_registry/1).copy_tableon bound A1); unifying ITE usessnapshot_lite.sub_string/5isop_builtin.drop_brackets/2and 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=0inside isolate); restoring CP makes the wrapper'sreturnthe 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 stillallocates Y frames (Y-snapshot convention, not Lua locals). Next: skipsnapshot_liteon read-only ITE conditions, and/or interndefault_registry/1at 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.plCONFORMANCE_TARGETS=javascriptis still the coordinator patch inINTEGRATION_PATCH.md(harness not edited)