@@ -91,8 +91,9 @@ fn lazy_per_thread_init() {
9191/// have been previously called. Additionally no Rust destructors can be on the
9292/// stack. They will be skipped and not executed.
9393#[ cfg( has_host_compiler_backend) ]
94- pub ( super ) unsafe fn raise_preexisting_trap ( ) -> ! {
95- tls:: with ( |info| unsafe { info. unwrap ( ) . unwind ( ) } )
94+ pub ( super ) unsafe fn raise_preexisting_trap ( store : & mut dyn crate :: vm:: VMStore ) -> ! {
95+ let mut nogc = AutoAssertNoGc :: new ( store. store_opaque_mut ( ) ) ;
96+ tls:: with ( |info| unsafe { info. unwrap ( ) . unwind ( & mut nogc) } )
9697}
9798
9899/// Invokes the closure `f` and returns a `bool` if it succeeded.
@@ -334,7 +335,8 @@ pub struct Trap {
334335 pub coredumpstack : Option < CoreDumpStack > ,
335336}
336337
337- /// Enumeration of different methods of raising a trap.
338+ /// Enumeration of different methods of raising a trap (or a sentinel
339+ /// for an exception).
338340#[ derive( Debug ) ]
339341pub enum TrapReason {
340342 /// A user-raised trap through `raise_user_trap`.
@@ -756,7 +758,7 @@ impl CallThreadState {
756758 // An unwind due to an already-set pending exception sets
757759 // a special UnwindState that triggers the handler-search
758760 // stack-walk on unwind().
759- UnwindReason :: Exception => {
761+ UnwindReason :: Trap ( TrapReason :: Exception ) => {
760762 self . unwind . set ( UnwindState :: ThrowException ) ;
761763 }
762764 // And if we are just propagating an existing trap that already has
@@ -934,7 +936,7 @@ impl CallThreadState {
934936 ) {
935937 let backtrace = self . capture_backtrace ( self . vm_store_context . as_ptr ( ) , Some ( ( pc, fp) ) ) ;
936938 let coredump_stack = self . capture_coredump ( self . vm_store_context . as_ptr ( ) , Some ( ( pc, fp) ) ) ;
937- self . unwind . set ( UnwindState :: UnwindPastWasm {
939+ self . unwind . set ( UnwindState :: UnwindToHost {
938940 reason : UnwindReason :: Trap ( TrapReason :: Jit {
939941 pc,
940942 faulting_addr,
0 commit comments