From ab7e9ab016e5c28f1647bd399277fc85b3b24dc8 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 14 Jun 2024 12:34:48 -0700 Subject: [PATCH] Cranelift: Traps need not be considered GC safepoints anymore After https://github.com/bytecodealliance/wasmtime/pull/8809, the mutator cannot resume from a trap so we don't need to consider them safepoints, as no GC-managed references are live after the trap. The one exception being the `debugtrap` CLIF instruction, which is technically still a resumable trap, but which exists only for emitting the equivalent of an `int3` breakpoint instruction for pausing in a debugger to inspect state, and should never be used for mutator-collector interactions. --- cranelift/codegen/src/isa/aarch64/inst/mod.rs | 5 +---- cranelift/codegen/src/isa/riscv64/inst/mod.rs | 5 +---- cranelift/codegen/src/isa/s390x/inst/mod.rs | 8 +------- cranelift/codegen/src/isa/x64/inst/mod.rs | 5 +---- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/cranelift/codegen/src/isa/aarch64/inst/mod.rs b/cranelift/codegen/src/isa/aarch64/inst/mod.rs index 6fc2a9598373..54e2a4f77d69 100644 --- a/cranelift/codegen/src/isa/aarch64/inst/mod.rs +++ b/cranelift/codegen/src/isa/aarch64/inst/mod.rs @@ -1114,10 +1114,7 @@ impl MachInst for Inst { fn is_safepoint(&self) -> bool { match self { - &Inst::Call { .. } - | &Inst::CallInd { .. } - | &Inst::TrapIf { .. } - | &Inst::Udf { .. } => true, + Inst::Call { .. } | Inst::CallInd { .. } => true, _ => false, } } diff --git a/cranelift/codegen/src/isa/riscv64/inst/mod.rs b/cranelift/codegen/src/isa/riscv64/inst/mod.rs index eee4af1cc9d7..a846c6024974 100644 --- a/cranelift/codegen/src/isa/riscv64/inst/mod.rs +++ b/cranelift/codegen/src/isa/riscv64/inst/mod.rs @@ -731,10 +731,7 @@ impl MachInst for Inst { fn is_safepoint(&self) -> bool { match self { - &Inst::Call { .. } - | &Inst::CallInd { .. } - | &Inst::TrapIf { .. } - | &Inst::Udf { .. } => true, + Inst::Call { .. } | Inst::CallInd { .. } => true, _ => false, } } diff --git a/cranelift/codegen/src/isa/s390x/inst/mod.rs b/cranelift/codegen/src/isa/s390x/inst/mod.rs index b9550a9839e0..6b1d9f531a4b 100644 --- a/cranelift/codegen/src/isa/s390x/inst/mod.rs +++ b/cranelift/codegen/src/isa/s390x/inst/mod.rs @@ -1073,13 +1073,7 @@ impl MachInst for Inst { fn is_safepoint(&self) -> bool { match self { - &Inst::Call { .. } - | &Inst::CallInd { .. } - | &Inst::Trap { .. } - | Inst::TrapIf { .. } - | &Inst::CmpTrapRR { .. } - | &Inst::CmpTrapRSImm16 { .. } - | &Inst::CmpTrapRUImm16 { .. } => true, + Inst::Call { .. } | Inst::CallInd { .. } => true, _ => false, } } diff --git a/cranelift/codegen/src/isa/x64/inst/mod.rs b/cranelift/codegen/src/isa/x64/inst/mod.rs index 34e6647f6213..fd8c375e6ea1 100644 --- a/cranelift/codegen/src/isa/x64/inst/mod.rs +++ b/cranelift/codegen/src/isa/x64/inst/mod.rs @@ -2687,10 +2687,7 @@ impl MachInst for Inst { fn is_safepoint(&self) -> bool { match self { - Inst::CallKnown { .. } - | Inst::CallUnknown { .. } - | Inst::TrapIf { .. } - | Inst::Ud2 { .. } => true, + Inst::CallKnown { .. } | Inst::CallUnknown { .. } => true, _ => false, } }