jit(wasm): size CA callee frames with per-token compact geometry#505
Closed
youknowone wants to merge 4 commits into
Closed
jit(wasm): size CA callee frames with per-token compact geometry#505youknowone wants to merge 4 commits into
youknowone wants to merge 4 commits into
Conversation
…shots Remove state_field_identity_const and the identity_const parameter chain: build_vable_snapshot_boxes now always emits the identity as SnapshotTagged::Box. The identity is a live input box; rewriting it to TAGCONST excluded it from liveboxes/failarg numbering, baking a trace-time object address into resume data. next_ref() now decodes the identity from the failing frame's failarg slot (resume.py:1566-1578). Assisted-by: Claude
…e pointer after collecting calls wasm_jit_ca_alloc_frame switches from the malloc+LIFO pool to a collecting nursery allocation (rewrite.py gen_malloc_nursery_varsize_frame), retiring the CA_FRAMES pool. Because a minor collection can now move the running frame and the collector cannot update wasm locals, trace bodies reload local 0 from the jitframe shadow-stack top before every post-collection home reload (_reload_frame_if_necessary, assembler.py:1369), and the CA arm reloads the caller frame via the new jf_under_top_ptr() accessor after its callee push. Trampoline fallback paths keep the documented non-moving-frame assumption. fib32 via CA: gc_majors 262 (oldgen variant) -> 4. Synthetic suite 151/151 on wasm, dynasm, cranelift. Assisted-by: Claude
Assisted-by: Claude
Replace the fixed MIN_FRAME_BYTES frame layout for CA-allocated callee frames with a per-token FrameGeometry frozen at the token's first compile: value region sized from the token's actual slot needs, then call area, dispatch key, and Ref homes at per-token offsets (jitframe.py sizes frames by the regalloc frame_depth). Arena execute_token frames keep the fixed floor. compile_bridge declines a chained bridge whose slot needs exceed the frozen geometry. Host-side frame readers and per-bridge gcmap building take the token geometry instead of the global constants. fib32 via CA: gc_minors 5034 -> 1243, wall 1.20s -> 0.66-0.69s (malloc-pool baseline 0.83s). Synthetic suite 151/151 on wasm, dynasm, cranelift. Assisted-by: Claude
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
Stacked on #501. Removes the fixed
MIN_FRAME_BYTES(2152B) layout floor for CA-allocated callee jitframes: each token freezes a compactFrameGeometryat its first compile (value region sized from the token's actual slot needs, then call area, dispatch key, and Ref homes at per-token offsets), matching how native jitframes are sized by the regalloc's actual frame depth (jitframe.pyJITFRAME_FIXED_SIZE + frame_depth).execute_tokenframes keep the fixed floor (they are shared across tokens).compile_bridgedeclines a bridge whose slot needs exceed it (safe fallback, no miscompile).Motivation / measurements (fib32 via CALL_ASSEMBLER, interleaved ×5)
#501 moved CA callee frames from a malloc+LIFO pool to nursery GC allocation, which regressed fib32 0.83s → 1.20s purely from minor-GC frequency (gc_minors 262 → 5034): every CA call allocated a ~2.3KB fixed-layout frame. A 32MB-nursery probe (0.77s, minors 629) confirmed the cost is per-minor overhead × count; native dynasm shows only 146 minors with its frame-depth-sized frames.
With compact geometry:
Output stays 2178309/exit 0. Synthetic suite 151/151 on wasm, dynasm, cranelift;
i64envandmajit-backend-wasmtests green.🤖 Generated with Claude Code