jit(bridge): read the traced frame's vable pointer when patching a retraced loop - #889
jit(bridge): read the traced frame's vable pointer when patching a retraced loop#889fregataa wants to merge 1 commit into
Conversation
…traced loop A loop compiled from a bridge reads the virtualizable's array lengths through orig_vable_ptr_from_trace_ctx, which preferred the MetaInterp's cached vable_ptr. That cache is clobbered when a residual call re-enters compiled code and deopts nested frames, and the residual-call epilogue only restores TraceCtx::virtualizable_heap_ptr — so the compile-time length read hit a nested callee frame whose locals_cells_stack_w is shorter than the traced frame's, tripping the field-load preamble's `assert i == len(inputargs)` (16 != 26) on synth/str_search_index_bounds under the dynasm backend. Prefer the trace-local TraceCtx pointer (RPython's orig_inpargs is the trace's own history) and keep the MetaInterp cache as last resort. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughBridge-trace virtualizable heap pointer selection now checks the context-provided pointer first, ignoring null values, and falls back to ChangesBridge pointer selection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
Closed since #876 has already resolved the same issue |
|
sorry! I missed this patch |
Summary
python3 pyre/check.py --backend dynasmfailed onsynth/str_search_index_boundswith:A loop compiled from a bridge (
trace_and_compile_from_bridge) reads the virtualizable's array lengths throughorig_vable_ptr_from_trace_ctx, which preferred the MetaInterp's cachedvable_ptr. That cache is clobbered when a residual call re-enters compiled code and deopts nested frames, and the residual-call epilogue only restoresTraceCtx::virtualizable_heap_ptr— so the compile-time length read hit a nested callee frame whoselocals_cells_stack_w(8 slots) is shorter than the traced frame's (18 slots), tripping the field-load preamble's inputargs accounting (16 = 2 reds + 6 statics + 8 vs the trace's 26 expanded inputargs).Fix
Prefer the trace-local
TraceCtx::virtualizable_heap_ptrin the bridge fallback — RPython'sorig_inpargsis the trace's own history, so the trace-local pointer is the parity-correct source — and keep the MetaInterp cache only as a last resort.Testing
synth/str_search_index_boundscompletes and its output matches CPython exactlycargo test -p majit-metainterp --release: 1510 passedpython3 pyre/check.py --backend dynasm: 342/342 ALL PASSED🤖 Generated with Claude Code
Summary by CodeRabbit