Skip to content

Commit 47171e0

Browse files
committed
Use landingpad filter to encode aborting landing pad
1 parent 8660707 commit 47171e0

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12271227
(value1, value2)
12281228
}
12291229

1230+
fn filter_landing_pad(&mut self, pers_fn: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) {
1231+
self.cleanup_landing_pad(pers_fn)
1232+
}
1233+
12301234
#[cfg(feature="master")]
12311235
fn resume(&mut self, exn0: RValue<'gcc>, _exn1: RValue<'gcc>) {
12321236
let exn_type = exn0.get_type();

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
992992
(self.extract_value(landing_pad, 0), self.extract_value(landing_pad, 1))
993993
}
994994

995+
fn filter_landing_pad(&mut self, pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) {
996+
let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false);
997+
let landing_pad = self.landing_pad(ty, pers_fn, 1 /* FIXME should this be 0? */);
998+
self.add_clause(landing_pad, self.const_array(self.type_i8p(), &[]));
999+
(self.extract_value(landing_pad, 0), self.extract_value(landing_pad, 1))
1000+
}
1001+
9951002
fn resume(&mut self, exn0: &'ll Value, exn1: &'ll Value) {
9961003
let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false);
9971004
let mut exn = self.const_poison(ty);

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
16001600
bx = Bx::build(self.cx, llbb);
16011601

16021602
let llpersonality = self.cx.eh_personality();
1603-
bx.cleanup_landing_pad(llpersonality);
1603+
bx.filter_landing_pad(llpersonality);
16041604

16051605
funclet = None;
16061606
}

compiler/rustc_codegen_ssa/src/traits/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ pub trait BuilderMethods<'a, 'tcx>:
274274

275275
// These are used by everyone except msvc
276276
fn cleanup_landing_pad(&mut self, pers_fn: Self::Value) -> (Self::Value, Self::Value);
277+
fn filter_landing_pad(&mut self, pers_fn: Self::Value) -> (Self::Value, Self::Value);
277278
fn resume(&mut self, exn0: Self::Value, exn1: Self::Value);
278279

279280
// These are used only by msvc

0 commit comments

Comments
 (0)