bjorn3 edited Issue #2633:
<!-- Please try to describe precisely what you would like to do in
Cranelift/Wasmtime and/or expect from it. You can answer the questions below if
they're relevant and delete this text before submitting. Thanks for opening an
issue! -->Feature
Add a new
ghost_use
instruction that accepts a value and ensures that the value can be found somewhere at runtime. It will codegen to no instructions.
<!-- What is the feature or code improvement you would like to do in
Cranelift/Wasmtime? -->Benefit
This allows extending the range for which variables are available in debuginfo beyond the last actual use of the variable. In addition it would for exanple allow a jit runtime to inspect the value for switching to and from speculatively optimized code.
<!-- What is the value of adding this in Cranelift/Wasmtime? -->Implementation
The instruction will be marked as has_other_sideeffects. It will be lowered by backends to an instruction that doesn't result in any bytes being emitted. It will tell regalloc that the value needs to be available on either in a register or on the stack.
<!-- Do you have an implementation plan, and/or ideas for data structures or
algorithms to use? -->Alternatives
- Force all variables to the stack, which regressed runtime performance
- Accept that variables are only available until the last use, resulting in a sub-optimal debugging experience.
<!-- Have you considered alternative implementations? If so, how are they
better or worse than your proposal? -->
Last updated: Nov 22 2024 at 16:03 UTC