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:
Andrew Brown
2019-12-31 10:24:56 -08:00
committed by Yury Delendik
parent 681445b18b
commit 69683e8b67
9 changed files with 125 additions and 39 deletions

View File

@@ -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()))
}
}