]> git.lizzy.rs Git - rust.git/commitdiff
Update cranelift
authorbjorn3 <bjorn3@users.noreply.github.com>
Sat, 4 May 2019 14:15:20 +0000 (16:15 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sat, 4 May 2019 14:15:20 +0000 (16:15 +0200)
Cargo.lock
src/constant.rs
src/lib.rs
src/trap.rs
src/vtable.rs

index 21ab665f3ae42d82ef54e2402ea2d8c892413b80..19ef265e754a318bd2b07cdc536f38f6ff166f8b 100644 (file)
@@ -114,7 +114,7 @@ dependencies = [
 [[package]]
 name = "cranelift"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
  "cranelift-frontend 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
@@ -123,7 +123,7 @@ dependencies = [
 [[package]]
 name = "cranelift-bforest"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-entity 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
 ]
@@ -131,7 +131,7 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-bforest 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
  "cranelift-codegen-meta 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
@@ -145,7 +145,7 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen-meta"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-entity 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
 ]
@@ -153,12 +153,12 @@ dependencies = [
 [[package]]
 name = "cranelift-entity"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 
 [[package]]
 name = "cranelift-faerie"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
  "cranelift-module 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
@@ -171,7 +171,7 @@ dependencies = [
 [[package]]
 name = "cranelift-frontend"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-codegen 0.30.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.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
  "cranelift-entity 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
@@ -192,7 +192,7 @@ dependencies = [
 [[package]]
 name = "cranelift-native"
 version = "0.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-codegen 0.30.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.30.0"
-source = "git+https://github.com/CraneStation/cranelift.git#c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0"
+source = "git+https://github.com/CraneStation/cranelift.git#a1d8fbc8dda7984edcf334c8e3d0e4ecd6c04968"
 dependencies = [
  "cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
  "cranelift-module 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
index 87056f679a6204531d54237db88267cea1367195..282f429d74de23fcfffb278c124c7f6e1442412d 100644 (file)
@@ -179,7 +179,7 @@ fn trans_const_place<'a, 'tcx: 'a>(
 
 fn data_id_for_alloc_id<B: Backend>(module: &mut Module<B>, alloc_id: AllocId) -> DataId {
     module
-        .declare_data(&format!("__alloc_{}", alloc_id.0), Linkage::Local, false)
+        .declare_data(&format!("__alloc_{}", alloc_id.0), Linkage::Local, false, None)
         .unwrap()
 }
 
@@ -190,15 +190,16 @@ fn data_id_for_static<'a, 'tcx: 'a, B: Backend>(
     linkage: Linkage,
 ) -> DataId {
     let symbol_name = tcx.symbol_name(Instance::mono(tcx, def_id)).as_str();
+    let ty = tcx.type_of(def_id);
     let is_mutable = if tcx.is_mutable_static(def_id) {
         true
     } else {
-        !tcx.type_of(def_id)
-            .is_freeze(tcx, ParamEnv::reveal_all(), DUMMY_SP)
+        !ty.is_freeze(tcx, ParamEnv::reveal_all(), DUMMY_SP)
     };
+    let align = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().align.pref.bytes();
 
     let data_id = module
-        .declare_data(&*symbol_name, linkage, is_mutable)
+        .declare_data(&*symbol_name, linkage, is_mutable, Some(align.try_into().unwrap()))
         .unwrap();
 
     if linkage == Linkage::Preemptible {
index 562f9e5e568309d73b17ccdef5f7fa1bafc82bd9..95eb75c22c828b7dd4030d3d3cb248353d70f4a5 100644 (file)
@@ -57,6 +57,7 @@
 mod prelude {
     pub use std::any::Any;
     pub use std::collections::{HashMap, HashSet};
+    pub use std::convert::TryInto;
 
     pub use syntax::ast::{FloatTy, IntTy, UintTy};
     pub use syntax::source_map::{Pos, Span, DUMMY_SP};
@@ -213,7 +214,8 @@ fn codegen_crate<'a, 'tcx>(
         };
 
         if std::env::var("SHOULD_RUN").is_ok() {
-            let mut jit_module: Module<SimpleJITBackend> = Module::new(SimpleJITBuilder::new());
+            let mut jit_module: Module<SimpleJITBackend> =
+                Module::new(SimpleJITBuilder::new(cranelift_module::default_libcall_names()));
             assert_eq!(pointer_ty(tcx), jit_module.target_config().pointer_type());
 
             let sig = Signature {
@@ -263,7 +265,7 @@ fn codegen_crate<'a, 'tcx>(
                         build_isa(tcx.sess),
                         name + ".o",
                         FaerieTrapCollection::Disabled,
-                        FaerieBuilder::default_libcall_names(),
+                        cranelift_module::default_libcall_names(),
                     )
                     .unwrap(),
                 );
index f492bcf4b1ebd1d86d93d79a2427c1f0ef3e19fc..925d59ac255e00ec3bb7d432ae016afa3e0ec904 100644 (file)
@@ -12,7 +12,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
     let msg_bytes = format!("trap at {:?} ({}): {}\0", fx.instance, symbol_name, msg).into_bytes().into_boxed_slice();
     let mut data_ctx = DataContext::new();
     data_ctx.define(msg_bytes);
-    let msg_id = fx.module.declare_data(&(symbol_name.as_str().to_string() + msg), Linkage::Local, false).unwrap();
+    let msg_id = fx.module.declare_data(&(symbol_name.as_str().to_string() + msg), Linkage::Local, false, None).unwrap();
 
     // Ignore DuplicateDefinition error, as the data will be the same
     let _ = fx.module.define_data(msg_id, &data_ctx);
index 5c3d62e22bb49a3ec8e833b767ebc8f0dede26f6..a19b6b458c4083d068112214e5a54fd538e7ceb8 100644 (file)
@@ -136,6 +136,7 @@ fn build_vtable<'a, 'tcx: 'a>(
             &format!("vtable.{:?}.for.{:?}", trait_ref, ty),
             Linkage::Local,
             false,
+            Some(fx.tcx.data_layout.pointer_align.pref.bytes().try_into().unwrap())
         )
         .unwrap();