Repository navigation
Conversation
bb1bd09 to
abfeadc
Compare
tlively
left a comment
There was a problem hiding this comment.
Thanks for the PR. I'll remove myself as a reviewer because I won't be able to review this effectively due to lack of DWARF expertise. As an alternative approach, you could skip passes that reorder locals, e.g. with --skip-pass=coalesce-locals.
I've left some notes below about bugs Gemini found, though.
abfeadc to
ca64016
Compare
|
Thanks for the review. Fixed both bugs and moved the implementation into wasm-debug.cpp in ca64016. I kept remapping so ReorderLocals remains available with DWARF. Rebased onto current main. All 102 Python tests, 455 C++ tests and the wasm-opt pass suite pass. The new Memory64 and truncated-operand regressions fail before the fixes and pass after them. |
cec031d to
3ef7fa3
Compare
|
The failed fuzztest job hits the same Abseil All 17 jobs in the new CI run now pass, including |
Keep input and output address widths separate when relocating location lists and DIEs. Reject truncated operands in both custom and vendored decoding paths, and cover both issues with regressions. Move the rewriter implementation into wasm-debug.cpp.
3ef7fa3 to
2651006
Compare
Problem
ReorderLocalsupdates Wasm instructions but leavesDW_OP_WASM_locationoperands pointing at the old local indices. Execution remains correct, but the debugger can silently show another variable's value.a, b, c22, 11, 3311, 22, 336666The interactive comparison includes #9194 on both sides to separate this bug from the independent line-table problems. The DWARF change is based on main (
89157cb3), which now includes the FuzzTest update from #9394. Its regression tests do not depend on the other DWARF PRs.Fix
Compose input-to-IR local mappings across reordering and coalescing, then apply the writer's final binary-local mapping to DWARF locations. This also handles the coalescing performed internally by Asyncify. Coalescing's existing DWARF-invalidating status remains: repairing indices does not repair changed variable live ranges.
Rewrite inline expressions and location lists, including shared suffixes, nested expressions and expression-level DIE/type references. If an operand grows across a LEB boundary, relocate the affected list offsets, DIE references, CU lengths and public-name tables. Collection, expression/layout relocation and public-table updates are separate stages. With unchanged CU address sizes, the common same-width case skips the
.debug_infolayout pass; expressions without DIE references are not decoded again on subsequent iterations. Instruction boundaries use a small ordered vector instead of per-instruction hash allocations. No optimization is disabled.The implementation is in
wasm-debug.cpp. Input list offsets retain the original CU address width; emitted list offsets and DIE layout use the final width. Expressions being rewritten reject truncated operands.Validation
d8is not V8. The full build and these automated checks were rerun after rebasing onto current main on November 23.{"name":"dwarf","value":42}. GDB on Linux arm64 and LLDB on macOS arm64 read the correct values in the combined verification above.TinyGo sample on the original main baseline (
82439ad0), seven alternating warmed runs on macOS arm64; timings are medians, not evidence of a speedup:Stripped outputs are byte-identical in all three configurations. This fixes local-index relocation, not all remaining DWARF limitations or variable live-range transformations.
Developed with AI assistance; the validation above was executed locally.