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
34
Cargo.lock
generated
34
Cargo.lock
generated
@@ -358,18 +358,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-bforest"
|
name = "cranelift-bforest"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd05aac8cefcde54ce26178df8f36cb1f518ac691db650e7d2440c2b6b41c4dc"
|
checksum = "56aa72ef104c5d634f2f9e84ef2c47e116c1d185fae13f196b97ca84b0a514f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen"
|
name = "cranelift-codegen"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c63d9b6ff8a94f98deabab21880d7fd54996e0e16be687b6f80a3b6bdd9c188d"
|
checksum = "460b9d20793543599308d22f5a1172c196e63a780c4e9aacb0b3f4f63d63ffe1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cranelift-bforest",
|
"cranelift-bforest",
|
||||||
@@ -385,9 +385,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen-meta"
|
name = "cranelift-codegen-meta"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7cb3df51c2c07d719d02869bfac6cabd8d82ee308d5b29ca62e6528723cc33a4"
|
checksum = "cc70e4e8ccebd53a4f925147def857c9e9f7fe0fdbef4bb645a420473e012f50"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen-shared",
|
"cranelift-codegen-shared",
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
@@ -395,24 +395,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen-shared"
|
name = "cranelift-codegen-shared"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "758f9426b2e22bf83fc1a6b231a9d53cd4830751883c7f0e196ebb3c210467b3"
|
checksum = "3992000be4d18df0fe332b7c42c120de896e8ec54cd7b6cfa050910a8c9f6e2f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-entity"
|
name = "cranelift-entity"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff064733df8b98f453060264a8790393d1e807aca6942706b42f79a4f7aae9ed"
|
checksum = "722957e05064d97a3157bf0976deed0f3e8ee4f8a4ce167a7c724ca63a4e8bd9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-frontend"
|
name = "cranelift-frontend"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1eaafb5fa623dcbe19a28084a8226d7a1b17184a949c1a1f29a46b479867998d"
|
checksum = "13051964302dc7948e8869735de42591559ea55e319b9b92da5b38f8e6a75cb7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"log",
|
"log",
|
||||||
@@ -422,9 +422,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-native"
|
name = "cranelift-native"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90033dbd7293f6fad4cf9dcd769cd621d60df22b1c5a11799e86359b7447a51d"
|
checksum = "21398a0bc6ba389ea86964ac4a495426dd61080f2ddd306184777a8560fe9976"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"raw-cpuid",
|
"raw-cpuid",
|
||||||
@@ -433,9 +433,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-wasm"
|
name = "cranelift-wasm"
|
||||||
version = "0.50.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "54cb82a1071f88822763a583ec1a8688ffe5e2cda02c111d4483dd4376ed14d8"
|
checksum = "b72b7b10c09f70a604122fab76e6c4411255cf35403b68c3285566cc9d21c486"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
@@ -443,7 +443,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasmparser 0.39.3",
|
"wasmparser 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ readme = "README.md"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
wasmparser = "0.45.0"
|
wasmparser = "0.45.0"
|
||||||
lightbeam = { path = "../lightbeam", optional = true }
|
lightbeam = { path = "../lightbeam", optional = true }
|
||||||
indexmap = "1.0.2"
|
indexmap = "1.0.2"
|
||||||
@@ -45,7 +45,7 @@ tempfile = "3"
|
|||||||
target-lexicon = { version = "0.9.0", default-features = false }
|
target-lexicon = { version = "0.9.0", default-features = false }
|
||||||
pretty_env_logger = "0.3.0"
|
pretty_env_logger = "0.3.0"
|
||||||
rand = { version = "0.7.0", default-features = false, features = ["small_rng"] }
|
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"
|
filetime = "0.2.7"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use cranelift_codegen::isa::TargetFrontendConfig;
|
|||||||
use cranelift_entity::EntityRef;
|
use cranelift_entity::EntityRef;
|
||||||
use cranelift_wasm::{
|
use cranelift_wasm::{
|
||||||
self, FuncIndex, GlobalIndex, GlobalVariable, MemoryIndex, SignatureIndex, TableIndex,
|
self, FuncIndex, GlobalIndex, GlobalVariable, MemoryIndex, SignatureIndex, TableIndex,
|
||||||
WasmResult,
|
TargetEnvironment, WasmError, WasmResult,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "lightbeam")]
|
#[cfg(feature = "lightbeam")]
|
||||||
use cranelift_wasm::{DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex};
|
use cranelift_wasm::{DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex};
|
||||||
@@ -355,11 +355,13 @@ impl lightbeam::ModuleContext for FuncEnvironment<'_> {
|
|||||||
// TODO: type of a global
|
// 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 {
|
fn target_config(&self) -> TargetFrontendConfig {
|
||||||
self.target_config
|
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> {
|
fn make_table(&mut self, func: &mut ir::Function, index: TableIndex) -> WasmResult<ir::Table> {
|
||||||
let pointer_type = self.pointer_type();
|
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]);
|
.call_indirect(func_sig, func_addr, &[vmctx, memory_index]);
|
||||||
Ok(*pos.func.dfg.inst_results(call_inst).first().unwrap())
|
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_entity::PrimaryMap;
|
||||||
use cranelift_wasm::{
|
use cranelift_wasm::{
|
||||||
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
||||||
ModuleTranslationState, SignatureIndex, Table, TableIndex, WasmResult,
|
ModuleTranslationState, SignatureIndex, Table, TableIndex, TargetEnvironment, WasmResult,
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
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
|
impl<'data> TargetEnvironment for ModuleEnvironment<'data> {
|
||||||
/// environment-dependent wasm instructions. These functions should not be called by the user.
|
|
||||||
impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data> {
|
|
||||||
fn target_config(&self) -> TargetFrontendConfig {
|
fn target_config(&self) -> TargetFrontendConfig {
|
||||||
self.result.target_config
|
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<()> {
|
fn reserve_signatures(&mut self, num: u32) -> WasmResult<()> {
|
||||||
self.result
|
self.result
|
||||||
.module
|
.module
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ readme = "README.md"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-native = "0.50.0"
|
cranelift-native = "0.52.0"
|
||||||
cranelift-frontend = "0.50.0"
|
cranelift-frontend = "0.52.0"
|
||||||
wasmtime-environ = { path = "../environ" }
|
wasmtime-environ = { path = "../environ" }
|
||||||
wasmtime-runtime = { path = "../runtime" }
|
wasmtime-runtime = { path = "../runtime" }
|
||||||
wasmtime-debug = { path = "../debug" }
|
wasmtime-debug = { path = "../debug" }
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ memoffset = "0.5.3"
|
|||||||
itertools = "0.8.2"
|
itertools = "0.8.2"
|
||||||
capstone = "0.6.0"
|
capstone = "0.6.0"
|
||||||
thiserror = "1.0.9"
|
thiserror = "1.0.9"
|
||||||
cranelift-codegen = "0.50.0"
|
cranelift-codegen = "0.52.0"
|
||||||
multi_mut = "0.1"
|
multi_mut = "0.1"
|
||||||
either = "1.5"
|
either = "1.5"
|
||||||
typemap = "0.3"
|
typemap = "0.3"
|
||||||
|
|||||||
@@ -1253,6 +1253,7 @@ fn initialize_globals(instance: &mut Instance) {
|
|||||||
unsafe { *to = *from };
|
unsafe { *to = *from };
|
||||||
}
|
}
|
||||||
GlobalInit::Import => panic!("locally-defined global initialized as import"),
|
GlobalInit::Import => panic!("locally-defined global initialized as import"),
|
||||||
|
GlobalInit::RefNullConst => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ edition = "2018"
|
|||||||
wasmtime-runtime = { path = "../runtime" }
|
wasmtime-runtime = { path = "../runtime" }
|
||||||
wasmtime-environ = { path = "../environ" }
|
wasmtime-environ = { path = "../environ" }
|
||||||
wasmtime-jit = { path = "../jit" }
|
wasmtime-jit = { path = "../jit" }
|
||||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
target-lexicon = "0.9.0"
|
target-lexicon = "0.9.0"
|
||||||
log = { version = "0.4.8", default-features = false }
|
log = { version = "0.4.8", default-features = false }
|
||||||
libc = "0.2.60"
|
libc = "0.2.60"
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ wasmtime-runtime = { path = "../runtime" }
|
|||||||
wasmtime-environ = { path = "../environ" }
|
wasmtime-environ = { path = "../environ" }
|
||||||
wasmtime-jit = { path = "../jit" }
|
wasmtime-jit = { path = "../jit" }
|
||||||
wasi-common = { path = "../wasi-common" }
|
wasi-common = { path = "../wasi-common" }
|
||||||
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
|
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] }
|
||||||
target-lexicon = "0.9.0"
|
target-lexicon = "0.9.0"
|
||||||
log = { version = "0.4.8", default-features = false }
|
log = { version = "0.4.8", default-features = false }
|
||||||
wig = { path = "../wasi-common/wig" }
|
wig = { path = "../wasi-common/wig" }
|
||||||
|
|||||||
Reference in New Issue
Block a user