Skip to content

Commit 8483aa2

Browse files
committed
Cranelift: dynamic contexts: account for outgoing-args area.
1 parent d214970 commit 8483aa2

File tree

1 file changed

+3
-1
lines changed
  • cranelift/codegen/src/machinst

1 file changed

+3
-1
lines changed

cranelift/codegen/src/machinst/abi.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2495,7 +2495,9 @@ impl TryCallInfo {
24952495
TryCallHandler::Default(label) => MachExceptionHandler::Default(*label),
24962496
TryCallHandler::Context(reg) => {
24972497
let loc = if let Some(spillslot) = reg.to_spillslot() {
2498-
let offset = layout.spillslot_offset(spillslot);
2498+
// The spillslot offset is relative to the "fixed
2499+
// storage area", which comes after outgoing args.
2500+
let offset = layout.spillslot_offset(spillslot) + i64::from(layout.outgoing_args_size);
24992501
ExceptionContextLoc::SPOffset(u32::try_from(offset).expect("SP offset cannot be negative or larger than 4GiB"))
25002502
} else if let Some(realreg) = reg.to_real_reg() {
25012503
ExceptionContextLoc::GPR(realreg.hw_enc())

0 commit comments

Comments
 (0)