Skip to content

Commit 681a455

Browse files
authored
Rollup merge of #155249 - hoodmane:wasm-panic-in-cleanup-reland, r=bjorn3
Fix: On wasm targets, call `panic_in_cleanup` if panic occurs in cleanup Relies on rust-lang/llvm-project#194. Reland of rust-lang/rust#151771. 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. - [ ] Add test for rust-lang/rust#153948
2 parents 3d74e85 + be2f128 commit 681a455

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
@@ -1659,6 +1659,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
16591659
unimplemented!();
16601660
}
16611661

1662+
fn get_funclet_cleanuppad(&self, _funclet: &Funclet) -> RValue<'gcc> {
1663+
unimplemented!();
1664+
}
1665+
16621666
// Atomic Operations
16631667
fn atomic_cmpxchg(
16641668
&mut self,

0 commit comments

Comments
 (0)