Skip to content

Commit

Permalink
Assert we never need to deopt a Direct location.
Browse files Browse the repository at this point in the history
  • Loading branch information
ptersilie committed Jan 15, 2025
1 parent d82f450 commit 07001c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion ykrt/src/compile/jitc_yk/codegen/x64/deopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,12 @@ pub(crate) extern "C" fn __yk_deopt(
VarLocation::ConstInt { bits: _, v } => v,
VarLocation::ConstFloat(f) => f.to_bits(),
VarLocation::ConstPtr(v) => u64::try_from(v).unwrap(),
VarLocation::Direct { .. } => {
VarLocation::Direct { frame_off, size } => {
// See comment below: this case never needs to do anything.
debug_assert_eq!(
*aotvar.get(0).unwrap(),
SMLocation::Direct(6, frame_off, u16::try_from(size).unwrap())
);
varidx += 1;
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions yksmp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Record {
}

/// Describes where live variables are stored at specific times during execution.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum Location {
/// The live variable is stored in a register. Note, that LLVM's stackmap only stores one
/// location per live variable, which is enough for reading them out. For deoptimisation
Expand All @@ -64,7 +64,7 @@ pub enum Location {
/// pointer. To get the value, we first need to compute the pointer via `rbp - offset` and then
/// dereference it. For example, the following C-code is likely going to produce an indirect
/// variable:
/// ```
/// ```ignore
/// int x = 0;
/// control_point() // Live vars: [x]
/// printf("%p", &x); // Forces x to be stack allocated.
Expand All @@ -79,7 +79,7 @@ pub enum Location {
/// value itself is a pointer to the stack. This avoids having to spill the variable to the
/// stack. For example, the following C-code is likely to produce a direct location if there
/// are no more free registers available:
/// ```
/// ```ignore
/// ...
/// int x = 0;
/// int* y = &x;
Expand Down

0 comments on commit 07001c9

Please sign in to comment.