Skip to content

Commit be2f128

Browse files
committed
Fix: On wasm targets, call panic_in_cleanup if panic occurs in cleanup
Previously this was not correctly implemented. Each funclet may need its own terminate block, so this changes the `terminate_block` into a `terminate_blocks` `IndexVec` which can have a terminate_block for each funclet. We key on the first basic block of the funclet -- in particular, this is the start block for the old case of the top level terminate function. Rather than using a catchswitch/catchpad pair, I used a cleanuppad. The reason for the pair is to avoid catching foreign exceptions on MSVC. On wasm, it seems that the catchswitch/catchpad pair is optimized back into a single cleanuppad and a catch_all instruction is emitted which will catch foreign exceptions. Because the new logic is only used on wasm, it seemed better to take the simpler approach seeing as they do the same thing.
1 parent af8efe2 commit be2f128

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
16571657
unimplemented!();
16581658
}
16591659

1660+
fn get_funclet_cleanuppad(&self, _funclet: &Funclet) -> RValue<'gcc> {
1661+
unimplemented!();
1662+
}
1663+
16601664
// Atomic Operations
16611665
fn atomic_cmpxchg(
16621666
&mut self,

0 commit comments

Comments
 (0)