Stream: git-wasmtime

Topic: wasmtime / PR #4644 VCode emission: account for RA spill/...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 08 2022 at 19:48):

cfallin opened PR #4644 from fix-branch-veneer-threshold to main:

To determine whether we need to insert a "veneer island" of
branch-range extension veneers, we need to know ahead of emitting a
basic block the worst-case size of that block. This is because veneers
only go between blocks (we could plop one in the middle of a block but
that would require another jump around it and would probably pessimize
some code significantly), and we can't back up once we emit a block.

To compute this worst-case size, we take the number of instructions
and multiply by the largest possible size of one pseudoinst (e.g., on
aarch64, this is 44 bytes; it explicitly excludes the EmitIsland
pseudo-op which is used before large jumptable inline offset tables
are emitted). This is conservative, but it always works, and veneers
are somewhat rare in practice (function body >1MiB on aarch64 for
example).

Unfortunately this logic didn't account for the spill/reload/move
instructions inserted by the register allocator, and in one example in
issue #4629, a block had only one instruction but 482
edge-moves (!). This came at just the wrong time as we were
approaching the 1MiB limit on aarch64.

This PR fixes that issue, and fixes the logic to actually look at the
correct next block (next in final_order rather than numerically
next), as a bonus correctness fix.

Fixes #4629.

<!--

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 (Aug 08 2022 at 19:48):

cfallin requested alexcrichton for a review on PR #4644.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 08 2022 at 20:32):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 08 2022 at 20:57):

cfallin merged PR #4644.


Last updated: Nov 22 2024 at 16:03 UTC