mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
d7bf0dab82
Description of problem: - wasm linker does GC in flush() - it has the mechanism where it tracks the end index of a bunch of ArrayHashMap before flush() and after flush, shrinkRetainingCapacity() them to restore them to pre-flush() state - this includes `functions`, which contains `__divti3` - flush() notices the call to `__divti3` and calls markFunctionImport(), but that function does nothing on a second update because `alive` is already set to `true` so it incorrectly skips adding the intrinsic back to `functions` I tried to remember why I thought it was OK to use this `alive` flag which is state that's not being restored after flush(). If I remember correctly, I was just leaving the code how it was before, with the plan to change the data layout after encountering this exact problem. However, I found a solution that doesn't require changing data layout, and still takes advantage of the 1-bit-per-symbol data layout.