Browse Source

Including the outgoing arguments area when computing the caller's sp (#8636)

pull/8638/head
Trevor Elliott 6 months ago
committed by GitHub
parent
commit
d18477f8db
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      cranelift/codegen/src/machinst/abi.rs
  2. 2
      cranelift/codegen/src/machinst/vcode.rs

5
cranelift/codegen/src/machinst/abi.rs

@ -1942,12 +1942,13 @@ impl<M: ABIMachineSpec> Callee<M> {
frame_layout.clobber_size + frame_layout.fixed_frame_storage_size
}
/// Returns offset from the nominal SP to caller's SP.
pub fn nominal_sp_to_caller_sp_offset(&self) -> u32 {
/// Returns offset from the SP to caller's SP.
pub fn sp_to_caller_sp_offset(&self) -> u32 {
let frame_layout = self.frame_layout();
frame_layout.clobber_size
+ frame_layout.fixed_frame_storage_size
+ frame_layout.setup_area_size
+ frame_layout.outgoing_args_size
}
/// Returns the size of arguments expected on the stack.

2
cranelift/codegen/src/machinst/vcode.rs

@ -1138,7 +1138,7 @@ impl<I: VCodeInst> VCode<I> {
} else {
let slot = alloc.as_stack().unwrap();
let sp_offset = self.abi.get_spillslot_offset(slot);
let sp_to_caller_sp_offset = self.abi.nominal_sp_to_caller_sp_offset();
let sp_to_caller_sp_offset = self.abi.sp_to_caller_sp_offset();
let caller_sp_to_cfa_offset =
crate::isa::unwind::systemv::caller_sp_to_cfa_offset();
let cfa_to_sp_offset = -((sp_to_caller_sp_offset + caller_sp_to_cfa_offset) as i64);

Loading…
Cancel
Save