Conversation
cpunion
force-pushed
the
codex/asyncify-dwarf-generated-code
branch
from
October 2, 2026 07:28
c693cda to
ebbd3ff
Compare
Member
|
@kripken, do you have more context for this? |
Member
|
No, I have no more context here. @cpunion it would be good to clarify what is fixed here with a small example. Also the overview could be more specific: "Preserve instruction origins in rewritten DWARF line tables" is something we were already doing, or at least trying to. |
Member
Why is this? |
This branch has not been deployed
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.
Depends on #9196 (which depends on #9192). The standalone diff contains only instruction-origin handling. Start with the implementation and tests; five mechanically regenerated snapshots are in a separate commit. GitHub's main-based comparison still includes the unmerged prerequisites.
Fix
Asyncify's inserted rewind/unwind code must not inherit a neighboring user's source line. Surviving instructions must also retain their location when the instruction starting the original line-table row is removed.
Record origins while writing actual instructions, including instructions introduced by the binary/Stack IR writer. Treat input line rows as address intervals: recover original instructions' file/line/column/discriminator, give inserted code
line = 0, column = 0, is_stmt = false, and restore source attribution when original code resumes.Emit rows directly in writer order, coalescing unchanged attribution once. Only function-header/end-sequence records are retained separately; there is no second IR walk, full output-row map, sequence-normalization pass, or second coalescing pass. Functions without input line metadata, including Asyncify helpers, are not assigned fabricated source DWARF.
Generic line-program compression and discriminator serialization are now isolated in #9196. This PR does not handle local re-indexing, generated helper DIEs, or TinyGo's missing metadata, and does not fully resolve tinygo-org/tinygo#5736.
Validation and cost
-O1and Stack IR, original/generated instruction boundaries, discriminator and row flags, unrelated functions without line metadata, and a second roundtrip. A separate loop fixture distinguishes original traps from writer-insertedunreachableinstructions. Both regression tests fail on Correct and compact DWARF line-program encoding #9196 and pass here.wasm-opt --no-torturesuite pass locally. C++: 437 passed, one existing macOS size-test skip. Ruff and changed-line clang-format checks pass. V8-specific execution checks are left to CI.-O1, and-O1 --asyncify; the Asyncify output runs under Wasmtime and prints{"name":"dwarf","value":42}. Stripped outputs remain byte-identical to both prerequisites. The full Netbird application has not been tested.-O1-O1 --asyncifyTimes are nine-run interleaved local medians after warm-up; background system activity makes small differences inconclusive. These are debug-processing costs, not runtime performance. Asyncify executable code stays exactly 671,942 bytes; the extra debug rows increase file size and peak RSS (approximately 150 → 185 MiB, three-run medians). This simplification reduces implementation complexity but does not establish a peak-memory improvement.
This is an original contribution, developed with AI assistance.