Update Cranelift to 0.52.0 (#710)
* Add unimplemented stubs for Cranelift interfaces Cranelift changes to FuncEnvironment, TargetEnvironment, and GlobalInit (see https://github.com/bytecodealliance/cranelift/pull/1073) require these changes to compile wasmtime. * Upgrade Cranelift to 0.52.0
This commit is contained in:
committed by
Yury Delendik
parent
681445b18b
commit
69683e8b67
@@ -12,9 +12,9 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||
wasmparser = "0.45.0"
|
||||
lightbeam = { path = "../lightbeam", optional = true }
|
||||
indexmap = "1.0.2"
|
||||
@@ -45,7 +45,7 @@ tempfile = "3"
|
||||
target-lexicon = { version = "0.9.0", default-features = false }
|
||||
pretty_env_logger = "0.3.0"
|
||||
rand = { version = "0.7.0", default-features = false, features = ["small_rng"] }
|
||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde", "all-arch"] }
|
||||
cranelift-codegen = { version = "0.52.0", features = ["enable-serde", "all-arch"] }
|
||||
filetime = "0.2.7"
|
||||
|
||||
[badges]
|
||||
|
||||
@@ -11,7 +11,7 @@ use cranelift_codegen::isa::TargetFrontendConfig;
|
||||
use cranelift_entity::EntityRef;
|
||||
use cranelift_wasm::{
|
||||
self, FuncIndex, GlobalIndex, GlobalVariable, MemoryIndex, SignatureIndex, TableIndex,
|
||||
WasmResult,
|
||||
TargetEnvironment, WasmError, WasmResult,
|
||||
};
|
||||
#[cfg(feature = "lightbeam")]
|
||||
use cranelift_wasm::{DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex};
|
||||
@@ -355,11 +355,13 @@ impl lightbeam::ModuleContext for FuncEnvironment<'_> {
|
||||
// TODO: type of a global
|
||||
}
|
||||
|
||||
impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'module_environment> {
|
||||
impl<'module_environment> TargetEnvironment for FuncEnvironment<'module_environment> {
|
||||
fn target_config(&self) -> TargetFrontendConfig {
|
||||
self.target_config
|
||||
}
|
||||
}
|
||||
|
||||
impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'module_environment> {
|
||||
fn make_table(&mut self, func: &mut ir::Function, index: TableIndex) -> WasmResult<ir::Table> {
|
||||
let pointer_type = self.pointer_type();
|
||||
|
||||
@@ -702,4 +704,85 @@ impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'m
|
||||
.call_indirect(func_sig, func_addr, &[vmctx, memory_index]);
|
||||
Ok(*pos.func.dfg.inst_results(call_inst).first().unwrap())
|
||||
}
|
||||
|
||||
fn translate_memory_copy(
|
||||
&mut self,
|
||||
_pos: FuncCursor,
|
||||
_index: MemoryIndex,
|
||||
_heap: ir::Heap,
|
||||
_dst: ir::Value,
|
||||
_src: ir::Value,
|
||||
_len: ir::Value,
|
||||
) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_memory_fill(
|
||||
&mut self,
|
||||
_pos: FuncCursor,
|
||||
_index: MemoryIndex,
|
||||
_heap: ir::Heap,
|
||||
_dst: ir::Value,
|
||||
_val: ir::Value,
|
||||
_len: ir::Value,
|
||||
) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_memory_init(
|
||||
&mut self,
|
||||
_pos: FuncCursor,
|
||||
_index: MemoryIndex,
|
||||
_heap: ir::Heap,
|
||||
_seg_index: u32,
|
||||
_dst: ir::Value,
|
||||
_src: ir::Value,
|
||||
_len: ir::Value,
|
||||
) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_data_drop(&mut self, _pos: FuncCursor, _seg_index: u32) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_table_size(
|
||||
&mut self,
|
||||
_pos: FuncCursor,
|
||||
_index: TableIndex,
|
||||
_table: ir::Table,
|
||||
) -> WasmResult<ir::Value> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_table_copy(
|
||||
&mut self,
|
||||
_pos: FuncCursor,
|
||||
_dst_table_index: TableIndex,
|
||||
_dst_table: ir::Table,
|
||||
_src_table_index: TableIndex,
|
||||
_src_table: ir::Table,
|
||||
_dst: ir::Value,
|
||||
_src: ir::Value,
|
||||
_len: ir::Value,
|
||||
) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_table_init(
|
||||
&mut self,
|
||||
_pos: FuncCursor,
|
||||
_seg_index: u32,
|
||||
_table_index: TableIndex,
|
||||
_table: ir::Table,
|
||||
_dst: ir::Value,
|
||||
_src: ir::Value,
|
||||
_len: ir::Value,
|
||||
) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
|
||||
fn translate_elem_drop(&mut self, _pos: FuncCursor, _seg_index: u32) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported("bulk memory".to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use cranelift_codegen::isa::TargetFrontendConfig;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use cranelift_wasm::{
|
||||
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
||||
ModuleTranslationState, SignatureIndex, Table, TableIndex, WasmResult,
|
||||
ModuleTranslationState, SignatureIndex, Table, TableIndex, TargetEnvironment, WasmResult,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
@@ -86,13 +86,15 @@ impl<'data> ModuleEnvironment<'data> {
|
||||
}
|
||||
}
|
||||
|
||||
/// This trait is useful for `translate_module` because it tells how to translate
|
||||
/// environment-dependent wasm instructions. These functions should not be called by the user.
|
||||
impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data> {
|
||||
impl<'data> TargetEnvironment for ModuleEnvironment<'data> {
|
||||
fn target_config(&self) -> TargetFrontendConfig {
|
||||
self.result.target_config
|
||||
}
|
||||
}
|
||||
|
||||
/// This trait is useful for `translate_module` because it tells how to translate
|
||||
/// environment-dependent wasm instructions. These functions should not be called by the user.
|
||||
impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data> {
|
||||
fn reserve_signatures(&mut self, num: u32) -> WasmResult<()> {
|
||||
self.result
|
||||
.module
|
||||
|
||||
@@ -11,11 +11,11 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-native = "0.50.0"
|
||||
cranelift-frontend = "0.50.0"
|
||||
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-native = "0.52.0"
|
||||
cranelift-frontend = "0.52.0"
|
||||
wasmtime-environ = { path = "../environ" }
|
||||
wasmtime-runtime = { path = "../runtime" }
|
||||
wasmtime-debug = { path = "../debug" }
|
||||
|
||||
@@ -19,7 +19,7 @@ memoffset = "0.5.3"
|
||||
itertools = "0.8.2"
|
||||
capstone = "0.6.0"
|
||||
thiserror = "1.0.9"
|
||||
cranelift-codegen = "0.50.0"
|
||||
cranelift-codegen = "0.52.0"
|
||||
multi_mut = "0.1"
|
||||
either = "1.5"
|
||||
typemap = "0.3"
|
||||
|
||||
@@ -1253,6 +1253,7 @@ fn initialize_globals(instance: &mut Instance) {
|
||||
unsafe { *to = *from };
|
||||
}
|
||||
GlobalInit::Import => panic!("locally-defined global initialized as import"),
|
||||
GlobalInit::RefNullConst => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ edition = "2018"
|
||||
wasmtime-runtime = { path = "../runtime" }
|
||||
wasmtime-environ = { path = "../environ" }
|
||||
wasmtime-jit = { path = "../jit" }
|
||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||
target-lexicon = "0.9.0"
|
||||
log = { version = "0.4.8", default-features = false }
|
||||
libc = "0.2.60"
|
||||
|
||||
@@ -16,9 +16,9 @@ wasmtime-runtime = { path = "../runtime" }
|
||||
wasmtime-environ = { path = "../environ" }
|
||||
wasmtime-jit = { path = "../jit" }
|
||||
wasi-common = { path = "../wasi-common" }
|
||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
||||
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||
target-lexicon = "0.9.0"
|
||||
log = { version = "0.4.8", default-features = false }
|
||||
wig = { path = "../wasi-common/wig" }
|
||||
|
||||
Reference in New Issue
Block a user