From ea10842d95ff3b080c26a02bf8626d9d0956481b Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 18 Feb 2019 18:26:59 +0100 Subject: [PATCH] Update cranelift --- Cargo.lock | 20 ++++++++++---------- src/base.rs | 15 ++++++++------- src/debuginfo.rs | 29 +++++++++++------------------ 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2402cec1f2b..23bb51844f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,7 +114,7 @@ dependencies = [ [[package]] name = "cranelift" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-codegen 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "cranelift-frontend 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", @@ -123,7 +123,7 @@ dependencies = [ [[package]] name = "cranelift-bforest" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-entity 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", ] @@ -131,7 +131,7 @@ dependencies = [ [[package]] name = "cranelift-codegen" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-bforest 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "cranelift-codegen-meta 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", @@ -145,7 +145,7 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-entity 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", ] @@ -153,12 +153,12 @@ dependencies = [ [[package]] name = "cranelift-entity" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" [[package]] name = "cranelift-faerie" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-codegen 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "cranelift-module 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", @@ -171,7 +171,7 @@ dependencies = [ [[package]] name = "cranelift-frontend" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-codegen 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -181,7 +181,7 @@ dependencies = [ [[package]] name = "cranelift-module" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-codegen 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "cranelift-entity 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", @@ -192,7 +192,7 @@ dependencies = [ [[package]] name = "cranelift-native" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-codegen 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -202,7 +202,7 @@ dependencies = [ [[package]] name = "cranelift-simplejit" version = "0.28.0" -source = "git+https://github.com/CraneStation/cranelift.git#2145dd3ffaedaea4db1bc4f238550beae3f0492e" +source = "git+https://github.com/CraneStation/cranelift.git#50c66ae4788ff9a1715f220d2331df575017fa17" dependencies = [ "cranelift-codegen 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", "cranelift-module 0.28.0 (git+https://github.com/CraneStation/cranelift.git)", diff --git a/src/base.rs b/src/base.rs index 5eb1819e3cc..f76b3cd8593 100644 --- a/src/base.rs +++ b/src/base.rs @@ -127,13 +127,14 @@ fn trans_fn<'a, 'clif, 'tcx: 'a, B: Backend + 'static>( // Step 9. Define function cx.caches.context.func = func; - cx.module - .define_function_peek_compiled(func_id, &mut cx.caches.context, |size, context, isa| { - debug_context.as_mut().map(|x| x.define(tcx, size, context, isa, &source_info_set)); - }) - .unwrap(); - //let module = &mut cx.module; - //let caches = &cx.caches; + cx.module.define_function(func_id, &mut cx.caches.context).unwrap(); + + // Step 10. Define debuginfo for function + let context = &cx.caches.context; + let isa = cx.module.isa(); + debug_context.as_mut().map(|x| x.define(tcx, context, isa, &source_info_set)); + + // Step 11. Clear context to make it usable for the next function cx.caches.context.clear(); } diff --git a/src/debuginfo.rs b/src/debuginfo.rs index 70622d4bd49..9fab9c612e1 100644 --- a/src/debuginfo.rs +++ b/src/debuginfo.rs @@ -264,23 +264,10 @@ impl<'a, 'b, 'tcx: 'b> FunctionDebugContext<'a, 'tcx> { pub fn define( &mut self, tcx: TyCtxt, - //module: &mut Module, - code_size: u32, context: &Context, isa: &cranelift::codegen::isa::TargetIsa, source_info_set: &indexmap::IndexSet, ) { - let entry = self.debug_context.dwarf.unit.get_mut(self.entry_id); - entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(code_size as u64)); - - self.debug_context.unit_range_list.0.push(Range::StartLength { - begin: Address::Relative { - symbol: self.symbol, - addend: 0, - }, - length: code_size as u64, - }); - let line_program = &mut self.debug_context.dwarf.unit.line_program; line_program.begin_sequence(Some(Address::Relative { @@ -327,12 +314,18 @@ impl<'a, 'b, 'tcx: 'b> FunctionDebugContext<'a, 'tcx> { } } - if code_size != end { - line_program.row().address_offset = end as u64; - create_row_for_span(line_program, self.mir_span); - } + line_program.end_sequence(end as u64); - line_program.end_sequence(code_size as u64); + let entry = self.debug_context.dwarf.unit.get_mut(self.entry_id); + entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(end as u64)); + + self.debug_context.unit_range_list.0.push(Range::StartLength { + begin: Address::Relative { + symbol: self.symbol, + addend: 0, + }, + length: end as u64, + }); } }