Skip to content

Cranelift: add ghost_use instruction #2633

Open
@bjorn3

Description

@bjorn3

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.

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.

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions