about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2020-11-12 11:56:09 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2020-11-12 11:56:09 +0100
commit6eaa5020498edb4cfe779f286c4b34263546473e (patch)
treeb766e2ebe2ddacce0388efce98ca9f80cb05e1b6
parent96c4542dc3c7001d5a28b05d067701f2173e9eb4 (diff)
downloadrust-6eaa5020498edb4cfe779f286c4b34263546473e.tar.gz
rust-6eaa5020498edb4cfe779f286c4b34263546473e.zip
Update Cranelift for SimpleJIT changes
-rw-r--r--Cargo.lock20
-rw-r--r--src/debuginfo/emit.rs7
-rw-r--r--src/debuginfo/unwind.rs4
-rw-r--r--src/driver/jit.rs6
4 files changed, 19 insertions, 18 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c49502da5a4..67ed41e7652 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -50,7 +50,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 [[package]]
 name = "cranelift-bforest"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-entity",
 ]
@@ -58,7 +58,7 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "byteorder",
  "cranelift-bforest",
@@ -76,7 +76,7 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen-meta"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen-shared",
  "cranelift-entity",
@@ -85,17 +85,17 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen-shared"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 
 [[package]]
 name = "cranelift-entity"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 
 [[package]]
 name = "cranelift-frontend"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen",
  "log",
@@ -106,7 +106,7 @@ dependencies = [
 [[package]]
 name = "cranelift-module"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -118,7 +118,7 @@ dependencies = [
 [[package]]
 name = "cranelift-native"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen",
  "raw-cpuid",
@@ -128,7 +128,7 @@ dependencies = [
 [[package]]
 name = "cranelift-object"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -141,7 +141,7 @@ dependencies = [
 [[package]]
 name = "cranelift-simplejit"
 version = "0.68.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#b326f29885ec0f530230bf550164f805ffb04e41"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen",
  "cranelift-entity",
diff --git a/src/debuginfo/emit.rs b/src/debuginfo/emit.rs
index f6f795e4561..c21835b1fc3 100644
--- a/src/debuginfo/emit.rs
+++ b/src/debuginfo/emit.rs
@@ -76,7 +76,7 @@ impl WriterRelocate {
     #[cfg(feature = "jit")]
     pub(super) fn relocate_for_jit(
         mut self,
-        jit_product: &cranelift_simplejit::SimpleJITProduct,
+        jit_module: &cranelift_simplejit::SimpleJITModule,
     ) -> Vec<u8> {
         use std::convert::TryInto;
 
@@ -84,8 +84,9 @@ impl WriterRelocate {
             match reloc.name {
                 super::DebugRelocName::Section(_) => unreachable!(),
                 super::DebugRelocName::Symbol(sym) => {
-                    let addr = jit_product
-                        .lookup_func(cranelift_module::FuncId::from_u32(sym.try_into().unwrap()));
+                    let addr = jit_module.get_finalized_function(
+                        cranelift_module::FuncId::from_u32(sym.try_into().unwrap()),
+                    );
                     let val = (addr as u64 as i64 + reloc.addend) as u64;
                     self.writer
                         .write_udata_at(reloc.offset as usize, val, reloc.size)
diff --git a/src/debuginfo/unwind.rs b/src/debuginfo/unwind.rs
index 68138404c24..e0f62b64e6b 100644
--- a/src/debuginfo/unwind.rs
+++ b/src/debuginfo/unwind.rs
@@ -80,7 +80,7 @@ impl<'tcx> UnwindContext<'tcx> {
     #[cfg(feature = "jit")]
     pub(crate) unsafe fn register_jit(
         self,
-        jit_product: &cranelift_simplejit::SimpleJITProduct,
+        jit_module: &cranelift_simplejit::SimpleJITModule,
     ) -> Option<UnwindRegistry> {
         let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(super::target_endian(
             self.tcx,
@@ -91,7 +91,7 @@ impl<'tcx> UnwindContext<'tcx> {
             return None;
         }
 
-        let mut eh_frame = eh_frame.0.relocate_for_jit(jit_product);
+        let mut eh_frame = eh_frame.0.relocate_for_jit(jit_module);
 
         // GCC expects a terminating "empty" length, so write a 0 length at the end of the table.
         eh_frame.extend(&[0, 0, 0, 0]);
diff --git a/src/driver/jit.rs b/src/driver/jit.rs
index 96a543e64d0..07f092e212f 100644
--- a/src/driver/jit.rs
+++ b/src/driver/jit.rs
@@ -81,11 +81,11 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
 
     tcx.sess.abort_if_errors();
 
-    let jit_product = jit_module.finish();
+    jit_module.finalize_definitions();
 
-    let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_product) };
+    let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_module) };
 
-    let finalized_main: *const u8 = jit_product.lookup_func(main_func_id);
+    let finalized_main: *const u8 = jit_module.get_finalized_function(main_func_id);
 
     println!("Rustc codegen cranelift will JIT run the executable, because --jit was passed");