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. |
GitHub Actions recently updated `ubuntu-latest` to Ubuntu 26.04, which ships GCC 15's `libstdc++` headers without transitive `<cstdint>` includes. The previously pinned FuzzTest submodule fetched `abseil-cpp` `20240116.0`, which failed to compile under GCC 15's `libstdc++` due to a missing `uintptr_t` declaration in `absl/container/internal/container_memory.h`. Update `third_party/fuzztest` to the `2026-06-29` release tag (which updates `abseil-cpp` to `20260526.0`) along with two compatibility fixes: 1. Inherit `std::variant` constructors via `using variant::variant;` in the `std::variant` wrapper structs in `test/gtest/type-domains.h`, as FuzzTest's `VariantOfImpl::GetValue` now constructs custom variant types using `std::in_place_index<I>`. 2. Restore Binaryen's `CMAKE_CXX_STANDARD` (`20`) when configuring Abseil via `CMAKE_PROJECT_absl_INCLUDE` in `third_party/CMakeLists.txt`. FuzzTest's `CMakeLists.txt` unconditionally sets `CMAKE_CXX_STANDARD` to `17`, which otherwise builds `libabsl_status` with C++17 `absl::SourceLocation` while `binaryen-unittests` compiles with C++20 `std::source_location`, causing an ABI link mismatch. With `ABSL_PROPAGATE_CXX_STD` enabled, configuring Abseil with C++20 also propagates `-std=c++20` to FuzzTest.
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.
cec031d to
3ef7fa3
Compare
|
The failed fuzztest job hits the same Abseil All 17 jobs in the new CI run now pass, including |
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 (
5d31e56e); its regression tests do not depend on the other DWARF PRs.CI dependency: temporarily includes Thomas Lively's approved FuzzTest update from #9394. It fixes the
uintptr_terror in Abseil that also fails on main. This dependency can be dropped by rebasing once #9394 lands.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 14.{"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.