Skip to content

Commit 097b6b3

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 b7728f0 commit 097b6b3

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
@@ -1653,6 +1653,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
16531653
unimplemented!();
16541654
}
16551655

1656+
fn get_funclet_cleanuppad(&self, _funclet: &Funclet) -> RValue<'gcc> {
1657+
unimplemented!();
1658+
}
1659+
16561660
// Atomic Operations
16571661
fn atomic_cmpxchg(
16581662
&mut self,

0 commit comments

Comments
 (0)