Merge pull request #132 from bjorn3/panic_unwind
Support -Cpanic=unwind without unwinding
This commit is contained in:
commit
710b7415cd
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -41,7 +41,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gccjit"
|
name = "gccjit"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
source = "git+https://github.com/antoyo/gccjit.rs#cbb07c6601ba4246fc2967c4d770403c57192ca2"
|
source = "git+https://github.com/antoyo/gccjit.rs#b9f188d2ce2c7b12211e90903f1b2cf309785b85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gccjit_sys",
|
"gccjit_sys",
|
||||||
]
|
]
|
||||||
@ -49,7 +49,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gccjit_sys"
|
name = "gccjit_sys"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/antoyo/gccjit.rs#cbb07c6601ba4246fc2967c4d770403c57192ca2"
|
source = "git+https://github.com/antoyo/gccjit.rs#b9f188d2ce2c7b12211e90903f1b2cf309785b85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.1.12",
|
"libc 0.1.12",
|
||||||
]
|
]
|
||||||
|
@ -105,6 +105,9 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
|
|||||||
context.set_keep_intermediates(true);
|
context.set_keep_intermediates(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(bjorn3): Remove once unwinding is properly implemented
|
||||||
|
context.set_allow_unreachable_blocks(true);
|
||||||
|
|
||||||
{
|
{
|
||||||
let cx = CodegenCx::new(&context, cgu, tcx, supports_128bit_integers);
|
let cx = CodegenCx::new(&context, cgu, tcx, supports_128bit_integers);
|
||||||
|
|
||||||
|
@ -435,12 +435,12 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||||||
self.block.end_with_switch(None, value, default_block, &gcc_cases);
|
self.block.end_with_switch(None, value, default_block, &gcc_cases);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invoke(&mut self, _typ: Type<'gcc>, _func: RValue<'gcc>, _args: &[RValue<'gcc>], then: Block<'gcc>, catch: Block<'gcc>, _funclet: Option<&Funclet>) -> RValue<'gcc> {
|
fn invoke(&mut self, typ: Type<'gcc>, func: RValue<'gcc>, args: &[RValue<'gcc>], then: Block<'gcc>, catch: Block<'gcc>, _funclet: Option<&Funclet>) -> RValue<'gcc> {
|
||||||
let condition = self.context.new_rvalue_from_int(self.bool_type, 0);
|
// TODO(bjorn3): Properly implement unwinding.
|
||||||
|
let call_site = self.call(typ, func, args, None);
|
||||||
|
let condition = self.context.new_rvalue_from_int(self.bool_type, 1);
|
||||||
self.llbb().end_with_conditional(None, condition, then, catch);
|
self.llbb().end_with_conditional(None, condition, then, catch);
|
||||||
self.context.new_rvalue_from_int(self.int_type, 0)
|
call_site
|
||||||
|
|
||||||
// TODO(antoyo)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unreachable(&mut self) {
|
fn unreachable(&mut self) {
|
||||||
@ -1106,7 +1106,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cleanup_landing_pad(&mut self, _ty: Type<'gcc>, _pers_fn: RValue<'gcc>) -> RValue<'gcc> {
|
fn cleanup_landing_pad(&mut self, _ty: Type<'gcc>, _pers_fn: RValue<'gcc>) -> RValue<'gcc> {
|
||||||
let field1 = self.context.new_field(None, self.u8_type, "landing_pad_field_1");
|
let field1 = self.context.new_field(None, self.u8_type.make_pointer(), "landing_pad_field_1");
|
||||||
let field2 = self.context.new_field(None, self.i32_type, "landing_pad_field_1");
|
let field2 = self.context.new_field(None, self.i32_type, "landing_pad_field_1");
|
||||||
let struct_type = self.context.new_struct_type(None, "landing_pad", &[field1, field2]);
|
let struct_type = self.context.new_struct_type(None, "landing_pad", &[field1, field2]);
|
||||||
self.current_func().new_local(None, struct_type.as_type(), "landing_pad")
|
self.current_func().new_local(None, struct_type.as_type(), "landing_pad")
|
||||||
@ -1117,7 +1117,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn resume(&mut self, _exn: RValue<'gcc>) {
|
fn resume(&mut self, _exn: RValue<'gcc>) {
|
||||||
unimplemented!();
|
// TODO(bjorn3): Properly implement unwinding.
|
||||||
|
self.unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cleanup_pad(&mut self, _parent: Option<RValue<'gcc>>, _args: &[RValue<'gcc>]) -> Funclet {
|
fn cleanup_pad(&mut self, _parent: Option<RValue<'gcc>>, _args: &[RValue<'gcc>]) -> Funclet {
|
||||||
|
@ -1086,7 +1086,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn try_intrinsic<'gcc, 'tcx>(bx: &mut Builder<'_, 'gcc, 'tcx>, try_func: RValue<'gcc>, data: RValue<'gcc>, _catch_func: RValue<'gcc>, dest: RValue<'gcc>) {
|
fn try_intrinsic<'gcc, 'tcx>(bx: &mut Builder<'_, 'gcc, 'tcx>, try_func: RValue<'gcc>, data: RValue<'gcc>, _catch_func: RValue<'gcc>, dest: RValue<'gcc>) {
|
||||||
if bx.sess().panic_strategy() == PanicStrategy::Abort {
|
// NOTE: the `|| true` here is to use the panic=abort strategy with panic=unwind too
|
||||||
|
if bx.sess().panic_strategy() == PanicStrategy::Abort || true {
|
||||||
|
// TODO(bjorn3): Properly implement unwinding and remove the `|| true` once this is done.
|
||||||
bx.call(bx.type_void(), try_func, &[data], None);
|
bx.call(bx.type_void(), try_func, &[data], None);
|
||||||
// Return 0 unconditionally from the intrinsic call;
|
// Return 0 unconditionally from the intrinsic call;
|
||||||
// we can never unwind.
|
// we can never unwind.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user