Stream: git-wasmtime

Topic: wasmtime / PR #8475 cranelift: Simplify allocating ABI te...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2024 at 17:42):

jameysharp opened PR #8475 from jameysharp:cleanup-abi-temps to bytecodealliance:main:

This merges several existing passes over the ABI signature that handle incoming arguments:

  1. Callee::temps_needed counted how many and what type of temporaries would be needed in some later steps, and Lower::lower allocated them.
  2. Callee::init duplicated the same logic to determine where to save those temporaries for later.
  3. Various places used the saved temporaries.

There were two kinds of temporaries allocated. One kind was the return-area pointer, which must be allocated before any instructions are lowered so that the return instructions will all use the same VReg that the prologue defines. After this commit, that allocation still happens at the same point, but now it follows the pattern of other ABI glue and uses a VRegAllocator directly.

The other kind was a truly local kind of temporary used in only one uncommon path in gen_copy_arg_to_regs. That is unnecessary because we already allocate temporaries as-needed in all other paths in that method, so this commit just follows the same pattern.

This change avoids heap-allocating two temporary Vecs during init, as well as a third Vec that was live for the entire lifetime of the Callee. The latter almost always contained only a bunch of None values, and was only used at the end of lowering.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2024 at 17:42):

jameysharp requested wasmtime-compiler-reviewers for a review on PR #8475.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2024 at 17:42):

jameysharp requested fitzgen for a review on PR #8475.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2024 at 20:40):

fitzgen submitted PR review:

Nice!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2024 at 21:03):

fitzgen merged PR #8475.


Last updated: Dec 23 2024 at 12:05 UTC