Stream: git-wasmtime

Topic: wasmtime / PR #2683 Fix bad jumptable block ref when DCE ...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2021 at 23:05):

cfallin requested fitzgen for a review on PR #2683.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2021 at 23:05):

cfallin opened PR #2683 from br-table-unreachable to main:

When a block is unreachable, the unreachable_code pass will remove it,
which is perfectly sensible. Jump tables factor into unreachability in
an expected way: even if a block is listed in a jump table, the block
might be unreachable if the jump table itself is unused (or used in an
unreachable block). Unfortunately, the verifier still expects all
block refs in all jump tables to be valid, even after DCE, which will
not always be the case.

This makes a simple change to the pass: after removing blocks, it scans
jump tables. Any jump table that refers to an unreachable block must
itself be unused, and so we just clear its entries. We do not bother
removing it (and renumbering all later jumptables), and we do not bother
computing full unused-ness of all jumptables, as that would be more
expensive; it's sufficient to clear out the ones that refer to
unreachable blocks, which are a subset of all unused jumptables.

Fixes #2670.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2021 at 23:28):

fitzgen submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2021 at 00:31):

cfallin merged PR #2683.


Last updated: Nov 22 2024 at 16:03 UTC