Declare that all uses of the given variable must be included in stack map metadata. All values that are uses of this variable will be spilled to the stack before each safepoint and reloaded afterwards. Stack maps allow the garbage collector to identify the on-stack GC roots. Between spilling the stack and it being reloading again, the stack can be updated to facilitate moving GCs. This must be c
(&mut self, var: Variable)
| 439 | /// variable has not been declared yet. In debug builds, also panics if |
| 440 | /// the variable has already been defined. |
| 441 | pub fn declare_var_needs_stack_map(&mut self, var: Variable) { |
| 442 | log::trace!("declare_var_needs_stack_map({var:?})"); |
| 443 | let ty = self.func_ctx.variables[var]; |
| 444 | assert!(ty != types::INVALID); |
| 445 | assert!(ty.bytes() <= 16); |
| 446 | self.func_ctx.ssa.mark_var_needs_stack_map(var); |
| 447 | } |
| 448 | |
| 449 | /// Returns the Cranelift IR necessary to use a previously defined user |
| 450 | /// variable, returning an error if this is not possible. |