mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
Update to cranelift 0.51.
This commit is contained in:
parent
4018494f6e
commit
c2f287e65b
1495
Cargo.lock
generated
1495
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -12,13 +12,13 @@ readme = "README.md"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasmer-runtime-core = { path = "../runtime-core", version = "0.12.0" }
|
wasmer-runtime-core = { path = "../runtime-core", version = "0.12.0" }
|
||||||
cranelift-native = "0.44.0"
|
cranelift-native = { git = "https://github.com/wasmerio/cranelift", branch = "wasmer" }
|
||||||
cranelift-codegen = "0.44.0"
|
cranelift-codegen = { git = "https://github.com/wasmerio/cranelift", branch = "wasmer" }
|
||||||
cranelift-entity = "0.44.0"
|
cranelift-entity = { git = "https://github.com/wasmerio/cranelift", branch = "wasmer" }
|
||||||
cranelift-frontend = { package = "wasmer-clif-fork-frontend", version = "0.44.0" }
|
cranelift-frontend = { git = "https://github.com/wasmerio/cranelift", branch = "wasmer" }
|
||||||
cranelift-wasm = { package = "wasmer-clif-fork-wasm", version = "0.44.0" }
|
cranelift-wasm = { git = "https://github.com/wasmerio/cranelift", branch = "wasmer" }
|
||||||
target-lexicon = "0.8.1"
|
target-lexicon = "0.9"
|
||||||
wasmparser = "0.39.1"
|
wasmparser = "0.39.2"
|
||||||
byteorder = "1.3.2"
|
byteorder = "1.3.2"
|
||||||
nix = "0.15.0"
|
nix = "0.15.0"
|
||||||
libc = "0.2.60"
|
libc = "0.2.60"
|
||||||
|
@ -11,9 +11,9 @@ use cranelift_codegen::ir::{self, Ebb, Function, InstBuilder};
|
|||||||
use cranelift_codegen::isa::CallConv;
|
use cranelift_codegen::isa::CallConv;
|
||||||
use cranelift_codegen::{cursor::FuncCursor, isa};
|
use cranelift_codegen::{cursor::FuncCursor, isa};
|
||||||
use cranelift_frontend::{FunctionBuilder, Position, Variable};
|
use cranelift_frontend::{FunctionBuilder, Position, Variable};
|
||||||
use cranelift_wasm::{self, FuncTranslator};
|
use cranelift_wasm::{self, FuncTranslator, ModuleTranslationState};
|
||||||
use cranelift_wasm::{get_vmctx_value_label, translate_operator};
|
use cranelift_wasm::{get_vmctx_value_label, translate_operator};
|
||||||
use cranelift_wasm::{FuncEnvironment, ReturnMode, WasmError};
|
use cranelift_wasm::{FuncEnvironment, ReturnMode, TargetEnvironment, WasmError};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use wasmer_runtime_core::error::CompileError;
|
use wasmer_runtime_core::error::CompileError;
|
||||||
@ -247,7 +247,7 @@ pub struct FunctionEnvironment {
|
|||||||
clif_signatures: Map<SigIndex, ir::Signature>,
|
clif_signatures: Map<SigIndex, ir::Signature>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FuncEnvironment for FunctionEnvironment {
|
impl TargetEnvironment for FunctionEnvironment {
|
||||||
/// Gets configuration information needed for compiling functions
|
/// Gets configuration information needed for compiling functions
|
||||||
fn target_config(&self) -> isa::TargetFrontendConfig {
|
fn target_config(&self) -> isa::TargetFrontendConfig {
|
||||||
self.target_config
|
self.target_config
|
||||||
@ -265,6 +265,13 @@ impl FuncEnvironment for FunctionEnvironment {
|
|||||||
self.target_config().pointer_bytes()
|
self.target_config().pointer_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return Cranelift reference type.
|
||||||
|
fn reference_type(&self) -> ir::Type {
|
||||||
|
ir::types::R64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FuncEnvironment for FunctionEnvironment {
|
||||||
/// Sets up the necessary preamble definitions in `func` to access the global identified
|
/// Sets up the necessary preamble definitions in `func` to access the global identified
|
||||||
/// by `index`.
|
/// by `index`.
|
||||||
///
|
///
|
||||||
@ -802,7 +809,6 @@ impl FuncEnvironment for FunctionEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates code corresponding to wasm `memory.grow`.
|
/// Generates code corresponding to wasm `memory.grow`.
|
||||||
///
|
///
|
||||||
/// `index` refers to the linear memory to query.
|
/// `index` refers to the linear memory to query.
|
||||||
@ -931,6 +937,94 @@ impl FuncEnvironment for FunctionEnvironment {
|
|||||||
|
|
||||||
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,
|
||||||
|
_clif_mem_index: cranelift_wasm::MemoryIndex,
|
||||||
|
_heap: ir::Heap,
|
||||||
|
_dst: ir::Value,
|
||||||
|
_src: ir::Value,
|
||||||
|
_len: ir::Value,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("memory.copy not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_memory_fill(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_clif_mem_index: cranelift_wasm::MemoryIndex,
|
||||||
|
_heap: ir::Heap,
|
||||||
|
_dst: ir::Value,
|
||||||
|
_val: ir::Value,
|
||||||
|
_len: ir::Value,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("memory.fill not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_memory_init(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_clif_mem_index: cranelift_wasm::MemoryIndex,
|
||||||
|
_heap: ir::Heap,
|
||||||
|
_seg_index: u32,
|
||||||
|
_dst: ir::Value,
|
||||||
|
_src: ir::Value,
|
||||||
|
_len: ir::Value,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("memory.init not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_data_drop(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_seg_index: u32,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("data.drop not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_table_size(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_index: cranelift_wasm::TableIndex,
|
||||||
|
_table: ir::Table,
|
||||||
|
) -> cranelift_wasm::WasmResult<ir::Value> {
|
||||||
|
unimplemented!("table.size not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_table_copy(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_dst_table_index: cranelift_wasm::TableIndex,
|
||||||
|
_dst_table: ir::Table,
|
||||||
|
_src_table_index: cranelift_wasm::TableIndex,
|
||||||
|
_src_table: ir::Table,
|
||||||
|
_dst: ir::Value,
|
||||||
|
_src: ir::Value,
|
||||||
|
_len: ir::Value,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("table.copy yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_table_init(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_seg_index: u32,
|
||||||
|
_table_index: cranelift_wasm::TableIndex,
|
||||||
|
_table: ir::Table,
|
||||||
|
_dst: ir::Value,
|
||||||
|
_src: ir::Value,
|
||||||
|
_len: ir::Value,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("table.init yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn translate_elem_drop(
|
||||||
|
&mut self,
|
||||||
|
_pos: FuncCursor,
|
||||||
|
_seg_index: u32,
|
||||||
|
) -> cranelift_wasm::WasmResult<()> {
|
||||||
|
unimplemented!("elem.drop yet implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FunctionEnvironment {
|
impl FunctionEnvironment {
|
||||||
@ -1016,8 +1110,15 @@ impl FunctionCodeGenerator<CodegenError> for CraneliftFunctionCodeGenerator {
|
|||||||
&mut self.func_translator.func_ctx,
|
&mut self.func_translator.func_ctx,
|
||||||
&mut self.position,
|
&mut self.position,
|
||||||
);
|
);
|
||||||
let state = &mut self.func_translator.state;
|
let module_state = ModuleTranslationState::new();
|
||||||
translate_operator(op, &mut builder, state, &mut self.func_env)?;
|
let func_state = &mut self.func_translator.state;
|
||||||
|
translate_operator(
|
||||||
|
&module_state,
|
||||||
|
op,
|
||||||
|
&mut builder,
|
||||||
|
func_state,
|
||||||
|
&mut self.func_env,
|
||||||
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user