Stream: git-wasmtime

Topic: wasmtime / PR #11271 x64: Use 8-bit jumps in pseudo-insts


view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 20:13):

alexcrichton opened PR #11271 from alexcrichton:x64-jmp-short to bytecodealliance:main:

Cranelift does not currently implement any form of "relaxation" of instructions where, for example, a 32-bit jump is shrunk to an 8-bit jump if the destination actually fits. In lieu of this Cranelift pessimistically emits 32-bit jumps on x64, for example, for all jumps between basic blocks. This is a difficult problem to solve in general but for pseudo-instructions it's a much more targeted problem which should be easier to solve.

This commit updates all pseudo-instructions in the x64 backend to use 8-bit jumps instead of full 32-bit jumps within their code bodies. It's statically known that the instructions bodies being generate are all small enough to fit in 8 bits. This helps shrink the generated code for a number of instructions whenever a pseudo-inst is used instead of basic blocks.

Optimizing jumps between basic blocks is left as a future optimization as it's likely to be much more difficult to implement than this.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 20:13):

alexcrichton requested fitzgen for a review on PR #11271.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 20:13):

alexcrichton requested wasmtime-core-reviewers for a review on PR #11271.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 20:13):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #11271.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 20:27):

alexcrichton updated PR #11271.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 23:33):

abrown submitted PR review:

Looks like smaller code for all these sequences; :+1:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 17 2025 at 23:57):

abrown merged PR #11271.


Last updated: Dec 06 2025 at 06:05 UTC