mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 14:41:32 +00:00
Run cargo fmt.
This commit is contained in:
@ -10,7 +10,7 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
wasmer-runtime-core = { path = "../runtime-core" }
|
wasmer-runtime-core = { path = "../runtime-core" }
|
||||||
wasmparser = "0.28.0"
|
wasmparser = "0.28.0"
|
||||||
dynasm = "0.3.0"
|
dynasm = "0.3.1"
|
||||||
dynasmrt = "0.3.1"
|
dynasmrt = "0.3.1"
|
||||||
lazy_static = "1.2.0"
|
lazy_static = "1.2.0"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
backend::{ProtectedCaller, FuncResolver},
|
backend::{FuncResolver, ProtectedCaller},
|
||||||
|
module::ModuleInfo,
|
||||||
structures::Map,
|
structures::Map,
|
||||||
types::{FuncIndex, FuncSig, SigIndex},
|
types::{FuncIndex, FuncSig, SigIndex},
|
||||||
module::ModuleInfo,
|
|
||||||
};
|
};
|
||||||
use wasmparser::{Operator, Type as WpType};
|
use wasmparser::{Operator, Type as WpType};
|
||||||
|
|
||||||
@ -10,10 +10,7 @@ pub trait ModuleCodeGenerator<FCG: FunctionCodeGenerator, PC: ProtectedCaller, F
|
|||||||
fn check_precondition(&mut self, module_info: &ModuleInfo) -> Result<(), CodegenError>;
|
fn check_precondition(&mut self, module_info: &ModuleInfo) -> Result<(), CodegenError>;
|
||||||
fn next_function(&mut self) -> Result<&mut FCG, CodegenError>;
|
fn next_function(&mut self) -> Result<&mut FCG, CodegenError>;
|
||||||
fn finalize(self, module_info: &ModuleInfo) -> Result<(PC, FR), CodegenError>;
|
fn finalize(self, module_info: &ModuleInfo) -> Result<(PC, FR), CodegenError>;
|
||||||
fn feed_signatures(
|
fn feed_signatures(&mut self, signatures: Map<SigIndex, FuncSig>) -> Result<(), CodegenError>;
|
||||||
&mut self,
|
|
||||||
signatures: Map<SigIndex, FuncSig>,
|
|
||||||
) -> Result<(), CodegenError>;
|
|
||||||
fn feed_function_signatures(
|
fn feed_function_signatures(
|
||||||
&mut self,
|
&mut self,
|
||||||
assoc: Map<FuncIndex, SigIndex>,
|
assoc: Map<FuncIndex, SigIndex>,
|
||||||
|
@ -2,6 +2,7 @@ use super::codegen::*;
|
|||||||
use super::stack::{
|
use super::stack::{
|
||||||
ControlFrame, ControlStack, IfElseState, ScratchRegister, ValueInfo, ValueLocation, ValueStack,
|
ControlFrame, ControlStack, IfElseState, ScratchRegister, ValueInfo, ValueLocation, ValueStack,
|
||||||
};
|
};
|
||||||
|
use crate::protect_unix;
|
||||||
use byteorder::{ByteOrder, LittleEndian};
|
use byteorder::{ByteOrder, LittleEndian};
|
||||||
use dynasmrt::{
|
use dynasmrt::{
|
||||||
x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi, ExecutableBuffer,
|
x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi, ExecutableBuffer,
|
||||||
@ -12,18 +13,17 @@ use std::{any::Any, collections::HashMap, sync::Arc};
|
|||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
backend::{FuncResolver, ProtectedCaller, Token, UserTrapper},
|
backend::{FuncResolver, ProtectedCaller, Token, UserTrapper},
|
||||||
error::{RuntimeError, RuntimeResult},
|
error::{RuntimeError, RuntimeResult},
|
||||||
|
memory::MemoryType,
|
||||||
module::{ModuleInfo, ModuleInner},
|
module::{ModuleInfo, ModuleInner},
|
||||||
structures::{Map, TypedIndex},
|
structures::{Map, TypedIndex},
|
||||||
types::{
|
types::{
|
||||||
FuncIndex, FuncSig, LocalFuncIndex, LocalGlobalIndex, MemoryIndex, SigIndex,
|
FuncIndex, FuncSig, ImportedMemoryIndex, LocalFuncIndex, LocalGlobalIndex,
|
||||||
Type, Value, LocalMemoryIndex, ImportedMemoryIndex, LocalOrImport,
|
LocalMemoryIndex, LocalOrImport, MemoryIndex, SigIndex, Type, Value,
|
||||||
},
|
},
|
||||||
memory::MemoryType,
|
|
||||||
units::Pages,
|
units::Pages,
|
||||||
vm::{self, ImportBacking, LocalGlobal, LocalTable, LocalMemory},
|
vm::{self, ImportBacking, LocalGlobal, LocalMemory, LocalTable},
|
||||||
};
|
};
|
||||||
use wasmparser::{Operator, Type as WpType};
|
use wasmparser::{Operator, Type as WpType};
|
||||||
use crate::protect_unix;
|
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static CURRENT_EXECUTION_CONTEXT: RefCell<Vec<*const X64ExecutionContext>> = RefCell::new(Vec::new());
|
static CURRENT_EXECUTION_CONTEXT: RefCell<Vec<*const X64ExecutionContext>> = RefCell::new(Vec::new());
|
||||||
@ -262,9 +262,12 @@ pub struct X64RuntimeResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl X64ExecutionContext {
|
impl X64ExecutionContext {
|
||||||
fn get_runtime_resolver(&self, module_info: &ModuleInfo) -> Result<X64RuntimeResolver, CodegenError> {
|
fn get_runtime_resolver(
|
||||||
|
&self,
|
||||||
|
module_info: &ModuleInfo,
|
||||||
|
) -> Result<X64RuntimeResolver, CodegenError> {
|
||||||
let mut assembler = Assembler::new().unwrap();
|
let mut assembler = Assembler::new().unwrap();
|
||||||
let mut offsets: Vec<AssemblyOffset> = vec! [];
|
let mut offsets: Vec<AssemblyOffset> = vec![];
|
||||||
|
|
||||||
for i in self.func_import_count..self.function_pointers.len() {
|
for i in self.func_import_count..self.function_pointers.len() {
|
||||||
offsets.push(assembler.offset());
|
offsets.push(assembler.offset());
|
||||||
@ -272,12 +275,15 @@ impl X64ExecutionContext {
|
|||||||
&mut assembler,
|
&mut assembler,
|
||||||
module_info,
|
module_info,
|
||||||
self.function_pointers[i],
|
self.function_pointers[i],
|
||||||
self.signatures[self.function_signatures[FuncIndex::new(i)]].params().len(),
|
self.signatures[self.function_signatures[FuncIndex::new(i)]]
|
||||||
|
.params()
|
||||||
|
.len(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let code = assembler.finalize().unwrap();
|
let code = assembler.finalize().unwrap();
|
||||||
let local_pointers: Vec<FuncPtr> = offsets.iter().map(|x| FuncPtr(code.ptr(*x) as _)).collect();
|
let local_pointers: Vec<FuncPtr> =
|
||||||
|
offsets.iter().map(|x| FuncPtr(code.ptr(*x) as _)).collect();
|
||||||
|
|
||||||
Ok(X64RuntimeResolver {
|
Ok(X64RuntimeResolver {
|
||||||
_code: code,
|
_code: code,
|
||||||
@ -292,9 +298,7 @@ impl FuncResolver for X64RuntimeResolver {
|
|||||||
_module: &ModuleInner,
|
_module: &ModuleInner,
|
||||||
_local_func_index: LocalFuncIndex,
|
_local_func_index: LocalFuncIndex,
|
||||||
) -> Option<NonNull<vm::Func>> {
|
) -> Option<NonNull<vm::Func>> {
|
||||||
NonNull::new(
|
NonNull::new(self.local_pointers[_local_func_index.index() as usize].0 as *mut vm::Func)
|
||||||
self.local_pointers[_local_func_index.index() as usize].0 as *mut vm::Func,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,13 +517,22 @@ impl X64ModuleCodeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, X64RuntimeResolver> for X64ModuleCodeGenerator {
|
impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, X64RuntimeResolver>
|
||||||
|
for X64ModuleCodeGenerator
|
||||||
|
{
|
||||||
fn check_precondition(&mut self, module_info: &ModuleInfo) -> Result<(), CodegenError> {
|
fn check_precondition(&mut self, module_info: &ModuleInfo) -> Result<(), CodegenError> {
|
||||||
for mem in module_info.memories.iter().map(|(_, v)| v).chain(module_info.imported_memories.iter().map(|(_, v)| &v.1)) {
|
for mem in module_info
|
||||||
|
.memories
|
||||||
|
.iter()
|
||||||
|
.map(|(_, v)| v)
|
||||||
|
.chain(module_info.imported_memories.iter().map(|(_, v)| &v.1))
|
||||||
|
{
|
||||||
match mem.memory_type() {
|
match mem.memory_type() {
|
||||||
MemoryType::Dynamic => return Err(CodegenError {
|
MemoryType::Dynamic => {
|
||||||
message: "dynamic memory isn't supported yet"
|
return Err(CodegenError {
|
||||||
}),
|
message: "dynamic memory isn't supported yet",
|
||||||
|
})
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -574,7 +587,10 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, X64RuntimeResolve
|
|||||||
Ok(self.functions.last_mut().unwrap())
|
Ok(self.functions.last_mut().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(mut self, module_info: &ModuleInfo) -> Result<(X64ExecutionContext, X64RuntimeResolver), CodegenError> {
|
fn finalize(
|
||||||
|
mut self,
|
||||||
|
module_info: &ModuleInfo,
|
||||||
|
) -> Result<(X64ExecutionContext, X64RuntimeResolver), CodegenError> {
|
||||||
let (assembler, mut br_table_data) = match self.functions.last_mut() {
|
let (assembler, mut br_table_data) = match self.functions.last_mut() {
|
||||||
Some(x) => (x.assembler.take().unwrap(), x.br_table_data.take().unwrap()),
|
Some(x) => (x.assembler.take().unwrap(), x.br_table_data.take().unwrap()),
|
||||||
None => {
|
None => {
|
||||||
@ -646,10 +662,7 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, X64RuntimeResolve
|
|||||||
Ok((ctx, resolver))
|
Ok((ctx, resolver))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn feed_signatures(
|
fn feed_signatures(&mut self, signatures: Map<SigIndex, FuncSig>) -> Result<(), CodegenError> {
|
||||||
&mut self,
|
|
||||||
signatures: Map<SigIndex, FuncSig>,
|
|
||||||
) -> Result<(), CodegenError> {
|
|
||||||
self.signatures = Some(Arc::new(signatures));
|
self.signatures = Some(Arc::new(signatures));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -703,11 +716,15 @@ impl X64FunctionCode {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_reinterpret(value_stack: &mut ValueStack, in_ty: WpType, out_ty: WpType) -> Result<(), CodegenError> {
|
fn emit_reinterpret(
|
||||||
|
value_stack: &mut ValueStack,
|
||||||
|
in_ty: WpType,
|
||||||
|
out_ty: WpType,
|
||||||
|
) -> Result<(), CodegenError> {
|
||||||
let val = value_stack.pop()?;
|
let val = value_stack.pop()?;
|
||||||
if val.ty != in_ty {
|
if val.ty != in_ty {
|
||||||
return Err(CodegenError {
|
return Err(CodegenError {
|
||||||
message: "reinterpret type mismatch"
|
message: "reinterpret type mismatch",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
value_stack.push(out_ty);
|
value_stack.push(out_ty);
|
||||||
@ -1334,7 +1351,12 @@ impl X64FunctionCode {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_managed_call_trampoline(assembler: &mut Assembler, info: &ModuleInfo, target: FuncPtr, num_params: usize) -> Result<(), CodegenError> {
|
fn emit_managed_call_trampoline(
|
||||||
|
assembler: &mut Assembler,
|
||||||
|
info: &ModuleInfo,
|
||||||
|
target: FuncPtr,
|
||||||
|
num_params: usize,
|
||||||
|
) -> Result<(), CodegenError> {
|
||||||
dynasm!(
|
dynasm!(
|
||||||
assembler
|
assembler
|
||||||
; push rbp
|
; push rbp
|
||||||
@ -1368,7 +1390,6 @@ impl X64FunctionCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dynasm!(
|
dynasm!(
|
||||||
assembler
|
assembler
|
||||||
; mov r8, rdi // vmctx
|
; mov r8, rdi // vmctx
|
||||||
@ -1390,7 +1411,7 @@ impl X64FunctionCode {
|
|||||||
true
|
true
|
||||||
} else if info.imported_memories.len() > 0 {
|
} else if info.imported_memories.len() > 0 {
|
||||||
if info.memories.len() != 0 || info.imported_memories.len() != 1 {
|
if info.memories.len() != 0 || info.imported_memories.len() != 1 {
|
||||||
return Err(CodegenError{
|
return Err(CodegenError {
|
||||||
message: "only one linear memory is supported",
|
message: "only one linear memory is supported",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1879,7 +1900,14 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
Operator::Else => {
|
Operator::Else => {
|
||||||
// We are in a reachable true branch
|
// We are in a reachable true branch
|
||||||
if self.unreachable_depth == 1 {
|
if self.unreachable_depth == 1 {
|
||||||
if let Some(IfElseState::If(_)) = self.control_stack.as_ref().unwrap().frames.last().map(|x| x.if_else) {
|
if let Some(IfElseState::If(_)) = self
|
||||||
|
.control_stack
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.frames
|
||||||
|
.last()
|
||||||
|
.map(|x| x.if_else)
|
||||||
|
{
|
||||||
self.unreachable_depth -= 1;
|
self.unreachable_depth -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2324,7 +2352,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; shl Rd(left as u8), cl
|
; shl Rd(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32ShrU => {
|
Operator::I32ShrU => {
|
||||||
@ -2338,7 +2366,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; shr Rd(left as u8), cl
|
; shr Rd(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32ShrS => {
|
Operator::I32ShrS => {
|
||||||
@ -2352,7 +2380,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; sar Rd(left as u8), cl
|
; sar Rd(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32Rotl => {
|
Operator::I32Rotl => {
|
||||||
@ -2366,7 +2394,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; rol Rd(left as u8), cl
|
; rol Rd(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32Rotr => {
|
Operator::I32Rotr => {
|
||||||
@ -2380,7 +2408,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; ror Rd(left as u8), cl
|
; ror Rd(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
// Comparison operators.
|
// Comparison operators.
|
||||||
@ -2760,7 +2788,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; shl Rq(left as u8), cl
|
; shl Rq(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64ShrU => {
|
Operator::I64ShrU => {
|
||||||
@ -2774,7 +2802,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; shr Rq(left as u8), cl
|
; shr Rq(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64ShrS => {
|
Operator::I64ShrS => {
|
||||||
@ -2788,7 +2816,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; sar Rq(left as u8), cl
|
; sar Rq(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64Rotl => {
|
Operator::I64Rotl => {
|
||||||
@ -2802,7 +2830,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; rol Rq(left as u8), cl
|
; rol Rq(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64Rotr => {
|
Operator::I64Rotr => {
|
||||||
@ -2816,7 +2844,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
; ror Rq(left as u8), cl
|
; ror Rq(left as u8), cl
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
// Comparison operators.
|
// Comparison operators.
|
||||||
@ -3724,19 +3752,19 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
0: 48 85 ff test %rdi,%rdi
|
0: 48 85 ff test %rdi,%rdi
|
||||||
3: 78 0b js 10 <ulong2double+0x10>
|
3: 78 0b js 10 <ulong2double+0x10>
|
||||||
5: c4 e1 fb 2a c7 vcvtsi2sd %rdi,%xmm0,%xmm0
|
5: c4 e1 fb 2a c7 vcvtsi2sd %rdi,%xmm0,%xmm0
|
||||||
a: c3 retq
|
a: c3 retq
|
||||||
b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
|
b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
|
||||||
10: 48 89 f8 mov %rdi,%rax
|
10: 48 89 f8 mov %rdi,%rax
|
||||||
13: 83 e7 01 and $0x1,%edi
|
13: 83 e7 01 and $0x1,%edi
|
||||||
16: 48 d1 e8 shr %rax
|
16: 48 d1 e8 shr %rax
|
||||||
19: 48 09 f8 or %rdi,%rax
|
19: 48 09 f8 or %rdi,%rax
|
||||||
1c: c4 e1 fb 2a c0 vcvtsi2sd %rax,%xmm0,%xmm0
|
1c: c4 e1 fb 2a c0 vcvtsi2sd %rax,%xmm0,%xmm0
|
||||||
21: c5 fb 58 c0 vaddsd %xmm0,%xmm0,%xmm0
|
21: c5 fb 58 c0 vaddsd %xmm0,%xmm0,%xmm0
|
||||||
25: c3 retq
|
25: c3 retq
|
||||||
*/
|
*/
|
||||||
Operator::F32ConvertUI64 => {
|
Operator::F32ConvertUI64 => {
|
||||||
Self::emit_unop(
|
Self::emit_unop(
|
||||||
assembler,
|
assembler,
|
||||||
@ -4119,7 +4147,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F32Abs => {
|
Operator::F32Abs => {
|
||||||
@ -4133,7 +4161,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F32Neg => {
|
Operator::F32Neg => {
|
||||||
@ -4147,7 +4175,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F32Nearest => {
|
Operator::F32Nearest => {
|
||||||
@ -4163,7 +4191,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F32Floor => {
|
Operator::F32Floor => {
|
||||||
@ -4179,7 +4207,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F32Ceil => {
|
Operator::F32Ceil => {
|
||||||
@ -4195,7 +4223,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F32Trunc => {
|
Operator::F32Trunc => {
|
||||||
@ -4211,7 +4239,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::F32
|
WpType::F32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32TruncUF32 => {
|
Operator::I32TruncUF32 => {
|
||||||
@ -4219,12 +4247,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
assembler,
|
assembler,
|
||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
|assembler, _value_stack, reg| {
|
|assembler, _value_stack, reg| {
|
||||||
Self::emit_f32_int_conv_check(
|
Self::emit_f32_int_conv_check(assembler, reg, -1.0, 4294967296.0);
|
||||||
assembler,
|
|
||||||
reg,
|
|
||||||
-1.0,
|
|
||||||
4294967296.0,
|
|
||||||
);
|
|
||||||
dynasm!(
|
dynasm!(
|
||||||
assembler
|
assembler
|
||||||
; movd xmm1, Rd(reg as u8)
|
; movd xmm1, Rd(reg as u8)
|
||||||
@ -4233,7 +4256,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::I32
|
WpType::I32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32TruncSF32 => {
|
Operator::I32TruncSF32 => {
|
||||||
@ -4241,12 +4264,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
assembler,
|
assembler,
|
||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
|assembler, _value_stack, reg| {
|
|assembler, _value_stack, reg| {
|
||||||
Self::emit_f32_int_conv_check(
|
Self::emit_f32_int_conv_check(assembler, reg, -2147483904.0, 2147483648.0);
|
||||||
assembler,
|
|
||||||
reg,
|
|
||||||
-2147483904.0,
|
|
||||||
2147483648.0
|
|
||||||
);
|
|
||||||
dynasm!(
|
dynasm!(
|
||||||
assembler
|
assembler
|
||||||
; movd xmm1, Rd(reg as u8)
|
; movd xmm1, Rd(reg as u8)
|
||||||
@ -4254,7 +4272,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::I32
|
WpType::I32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64TruncUF32 => {
|
Operator::I64TruncUF32 => {
|
||||||
@ -4262,12 +4280,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
assembler,
|
assembler,
|
||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
|assembler, _value_stack, reg| {
|
|assembler, _value_stack, reg| {
|
||||||
Self::emit_f32_int_conv_check(
|
Self::emit_f32_int_conv_check(assembler, reg, -1.0, 18446744073709551616.0);
|
||||||
assembler,
|
|
||||||
reg,
|
|
||||||
-1.0,
|
|
||||||
18446744073709551616.0,
|
|
||||||
);
|
|
||||||
/*
|
/*
|
||||||
LCPI0_0:
|
LCPI0_0:
|
||||||
.long 1593835520 ## float 9.22337203E+18
|
.long 1593835520 ## float 9.22337203E+18
|
||||||
@ -4300,7 +4313,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::I64
|
WpType::I64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64TruncSF32 => {
|
Operator::I64TruncSF32 => {
|
||||||
@ -4321,7 +4334,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F32,
|
WpType::F32,
|
||||||
WpType::I64
|
WpType::I64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Add => {
|
Operator::F64Add => {
|
||||||
@ -4570,7 +4583,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Abs => {
|
Operator::F64Abs => {
|
||||||
@ -4588,7 +4601,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Neg => {
|
Operator::F64Neg => {
|
||||||
@ -4602,7 +4615,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Nearest => {
|
Operator::F64Nearest => {
|
||||||
@ -4618,7 +4631,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Floor => {
|
Operator::F64Floor => {
|
||||||
@ -4634,7 +4647,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Ceil => {
|
Operator::F64Ceil => {
|
||||||
@ -4650,7 +4663,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::F64Trunc => {
|
Operator::F64Trunc => {
|
||||||
@ -4666,7 +4679,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::F64
|
WpType::F64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32TruncUF64 => {
|
Operator::I32TruncUF64 => {
|
||||||
@ -4674,12 +4687,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
assembler,
|
assembler,
|
||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
|assembler, _value_stack, reg| {
|
|assembler, _value_stack, reg| {
|
||||||
Self::emit_f64_int_conv_check(
|
Self::emit_f64_int_conv_check(assembler, reg, -1.0, 4294967296.0);
|
||||||
assembler,
|
|
||||||
reg,
|
|
||||||
-1.0,
|
|
||||||
4294967296.0,
|
|
||||||
);
|
|
||||||
|
|
||||||
dynasm!(
|
dynasm!(
|
||||||
assembler
|
assembler
|
||||||
@ -4689,7 +4697,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::I32
|
WpType::I32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I32TruncSF64 => {
|
Operator::I32TruncSF64 => {
|
||||||
@ -4697,12 +4705,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
assembler,
|
assembler,
|
||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
|assembler, _value_stack, reg| {
|
|assembler, _value_stack, reg| {
|
||||||
Self::emit_f64_int_conv_check(
|
Self::emit_f64_int_conv_check(assembler, reg, -2147483649.0, 2147483648.0);
|
||||||
assembler,
|
|
||||||
reg,
|
|
||||||
-2147483649.0,
|
|
||||||
2147483648.0,
|
|
||||||
);
|
|
||||||
|
|
||||||
dynasm!(
|
dynasm!(
|
||||||
assembler
|
assembler
|
||||||
@ -4711,7 +4714,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::I32
|
WpType::I32,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64TruncUF64 => {
|
Operator::I64TruncUF64 => {
|
||||||
@ -4719,12 +4722,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
assembler,
|
assembler,
|
||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
|assembler, _value_stack, reg| {
|
|assembler, _value_stack, reg| {
|
||||||
Self::emit_f64_int_conv_check(
|
Self::emit_f64_int_conv_check(assembler, reg, -1.0, 18446744073709551616.0);
|
||||||
assembler,
|
|
||||||
reg,
|
|
||||||
-1.0,
|
|
||||||
18446744073709551616.0,
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LCPI0_0:
|
LCPI0_0:
|
||||||
@ -4759,7 +4757,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::I64
|
WpType::I64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::I64TruncSF64 => {
|
Operator::I64TruncSF64 => {
|
||||||
@ -4781,7 +4779,7 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
WpType::F64,
|
WpType::F64,
|
||||||
WpType::I64
|
WpType::I64,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operator::Nop => {}
|
Operator::Nop => {}
|
||||||
@ -4794,7 +4792,9 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
//MemoryType::Dynamic => self.native_trampolines.memory_size_dynamic_local,
|
//MemoryType::Dynamic => self.native_trampolines.memory_size_dynamic_local,
|
||||||
MemoryType::Dynamic => unimplemented!(),
|
MemoryType::Dynamic => unimplemented!(),
|
||||||
MemoryType::Static => self.native_trampolines.memory_size_static_local,
|
MemoryType::Static => self.native_trampolines.memory_size_static_local,
|
||||||
MemoryType::SharedStatic => self.native_trampolines.memory_size_shared_local,
|
MemoryType::SharedStatic => {
|
||||||
|
self.native_trampolines.memory_size_shared_local
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LocalOrImport::Import(import_mem_index) => {
|
LocalOrImport::Import(import_mem_index) => {
|
||||||
@ -4803,17 +4803,13 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
//MemoryType::Dynamic => self.native_trampolines.memory_size_dynamic_import,
|
//MemoryType::Dynamic => self.native_trampolines.memory_size_dynamic_import,
|
||||||
MemoryType::Dynamic => unimplemented!(),
|
MemoryType::Dynamic => unimplemented!(),
|
||||||
MemoryType::Static => self.native_trampolines.memory_size_static_import,
|
MemoryType::Static => self.native_trampolines.memory_size_static_import,
|
||||||
MemoryType::SharedStatic => self.native_trampolines.memory_size_shared_import,
|
MemoryType::SharedStatic => {
|
||||||
|
self.native_trampolines.memory_size_shared_import
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Self::emit_call_raw(
|
Self::emit_call_raw(assembler, &mut self.value_stack, label, &[], &[WpType::I32])?;
|
||||||
assembler,
|
|
||||||
&mut self.value_stack,
|
|
||||||
label,
|
|
||||||
&[],
|
|
||||||
&[WpType::I32]
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
Operator::MemoryGrow { reserved } => {
|
Operator::MemoryGrow { reserved } => {
|
||||||
let memory_index = MemoryIndex::new(reserved as usize);
|
let memory_index = MemoryIndex::new(reserved as usize);
|
||||||
@ -4824,7 +4820,9 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
//MemoryType::Dynamic => self.native_trampolines.memory_grow_dynamic_local,
|
//MemoryType::Dynamic => self.native_trampolines.memory_grow_dynamic_local,
|
||||||
MemoryType::Dynamic => unimplemented!(),
|
MemoryType::Dynamic => unimplemented!(),
|
||||||
MemoryType::Static => self.native_trampolines.memory_grow_static_local,
|
MemoryType::Static => self.native_trampolines.memory_grow_static_local,
|
||||||
MemoryType::SharedStatic => self.native_trampolines.memory_grow_shared_local,
|
MemoryType::SharedStatic => {
|
||||||
|
self.native_trampolines.memory_grow_shared_local
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LocalOrImport::Import(import_mem_index) => {
|
LocalOrImport::Import(import_mem_index) => {
|
||||||
@ -4833,7 +4831,9 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
//MemoryType::Dynamic => self.native_trampolines.memory_grow_dynamic_import,
|
//MemoryType::Dynamic => self.native_trampolines.memory_grow_dynamic_import,
|
||||||
MemoryType::Dynamic => unimplemented!(),
|
MemoryType::Dynamic => unimplemented!(),
|
||||||
MemoryType::Static => self.native_trampolines.memory_grow_static_import,
|
MemoryType::Static => self.native_trampolines.memory_grow_static_import,
|
||||||
MemoryType::SharedStatic => self.native_trampolines.memory_grow_shared_import,
|
MemoryType::SharedStatic => {
|
||||||
|
self.native_trampolines.memory_grow_shared_import
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -4842,12 +4842,12 @@ impl FunctionCodeGenerator for X64FunctionCode {
|
|||||||
&mut self.value_stack,
|
&mut self.value_stack,
|
||||||
label,
|
label,
|
||||||
&[WpType::I32],
|
&[WpType::I32],
|
||||||
&[WpType::I32]
|
&[WpType::I32],
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("{:?}", op);
|
panic!("{:?}", op);
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -4927,7 +4927,7 @@ unsafe extern "C" fn invoke_import(
|
|||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
enum CallIndirectLocalOrImport {
|
enum CallIndirectLocalOrImport {
|
||||||
Local,
|
Local,
|
||||||
Import
|
Import,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn call_indirect(
|
unsafe extern "C" fn call_indirect(
|
||||||
@ -4945,7 +4945,7 @@ unsafe extern "C" fn call_indirect(
|
|||||||
let table: &LocalTable = match local_or_import {
|
let table: &LocalTable = match local_or_import {
|
||||||
CallIndirectLocalOrImport::Local => &*(*(*vmctx).tables),
|
CallIndirectLocalOrImport::Local => &*(*(*vmctx).tables),
|
||||||
CallIndirectLocalOrImport::Import => &*(*(*vmctx).imported_tables),
|
CallIndirectLocalOrImport::Import => &*(*(*vmctx).imported_tables),
|
||||||
} ;
|
};
|
||||||
if elem_index >= table.count as usize {
|
if elem_index >= table.count as usize {
|
||||||
eprintln!("element index out of bounds");
|
eprintln!("element index out of bounds");
|
||||||
protect_unix::trigger_trap();
|
protect_unix::trigger_trap();
|
||||||
@ -5005,11 +5005,19 @@ unsafe extern "C" fn _memory_size(
|
|||||||
) -> u64 {
|
) -> u64 {
|
||||||
use wasmer_runtime_core::vmcalls;
|
use wasmer_runtime_core::vmcalls;
|
||||||
let ret = match op {
|
let ret = match op {
|
||||||
MemoryKind::DynamicLocal => vmcalls::local_dynamic_memory_size(&*vmctx, LocalMemoryIndex::new(index)),
|
MemoryKind::DynamicLocal => {
|
||||||
MemoryKind::StaticLocal => vmcalls::local_static_memory_size(&*vmctx, LocalMemoryIndex::new(index)),
|
vmcalls::local_dynamic_memory_size(&*vmctx, LocalMemoryIndex::new(index))
|
||||||
|
}
|
||||||
|
MemoryKind::StaticLocal => {
|
||||||
|
vmcalls::local_static_memory_size(&*vmctx, LocalMemoryIndex::new(index))
|
||||||
|
}
|
||||||
MemoryKind::SharedLocal => unreachable!(),
|
MemoryKind::SharedLocal => unreachable!(),
|
||||||
MemoryKind::DynamicImport => vmcalls::imported_dynamic_memory_size(&*vmctx, ImportedMemoryIndex::new(index)),
|
MemoryKind::DynamicImport => {
|
||||||
MemoryKind::StaticImport => vmcalls::imported_static_memory_size(&*vmctx, ImportedMemoryIndex::new(index)),
|
vmcalls::imported_dynamic_memory_size(&*vmctx, ImportedMemoryIndex::new(index))
|
||||||
|
}
|
||||||
|
MemoryKind::StaticImport => {
|
||||||
|
vmcalls::imported_static_memory_size(&*vmctx, ImportedMemoryIndex::new(index))
|
||||||
|
}
|
||||||
MemoryKind::SharedImport => unreachable!(),
|
MemoryKind::SharedImport => unreachable!(),
|
||||||
};
|
};
|
||||||
ret.0 as u32 as u64
|
ret.0 as u32 as u64
|
||||||
@ -5027,11 +5035,23 @@ unsafe extern "C" fn _memory_grow(
|
|||||||
assert_eq!(stack_base as usize - stack_top as usize, 8);
|
assert_eq!(stack_base as usize - stack_top as usize, 8);
|
||||||
let pages = Pages(*(stack_top as *mut u32));
|
let pages = Pages(*(stack_top as *mut u32));
|
||||||
let ret = match op {
|
let ret = match op {
|
||||||
MemoryKind::DynamicLocal => vmcalls::local_dynamic_memory_grow(&mut *vmctx, LocalMemoryIndex::new(index), pages),
|
MemoryKind::DynamicLocal => {
|
||||||
MemoryKind::StaticLocal => vmcalls::local_static_memory_grow(&mut *vmctx, LocalMemoryIndex::new(index), pages),
|
vmcalls::local_dynamic_memory_grow(&mut *vmctx, LocalMemoryIndex::new(index), pages)
|
||||||
|
}
|
||||||
|
MemoryKind::StaticLocal => {
|
||||||
|
vmcalls::local_static_memory_grow(&mut *vmctx, LocalMemoryIndex::new(index), pages)
|
||||||
|
}
|
||||||
MemoryKind::SharedLocal => unreachable!(),
|
MemoryKind::SharedLocal => unreachable!(),
|
||||||
MemoryKind::DynamicImport => vmcalls::imported_dynamic_memory_grow(&mut *vmctx, ImportedMemoryIndex::new(index), pages),
|
MemoryKind::DynamicImport => vmcalls::imported_dynamic_memory_grow(
|
||||||
MemoryKind::StaticImport => vmcalls::imported_static_memory_grow(&mut *vmctx, ImportedMemoryIndex::new(index), pages),
|
&mut *vmctx,
|
||||||
|
ImportedMemoryIndex::new(index),
|
||||||
|
pages,
|
||||||
|
),
|
||||||
|
MemoryKind::StaticImport => vmcalls::imported_static_memory_grow(
|
||||||
|
&mut *vmctx,
|
||||||
|
ImportedMemoryIndex::new(index),
|
||||||
|
pages,
|
||||||
|
),
|
||||||
MemoryKind::SharedImport => unreachable!(),
|
MemoryKind::SharedImport => unreachable!(),
|
||||||
};
|
};
|
||||||
ret as u32 as u64
|
ret as u32 as u64
|
||||||
|
@ -19,8 +19,8 @@ extern crate byteorder;
|
|||||||
mod codegen;
|
mod codegen;
|
||||||
mod codegen_x64;
|
mod codegen_x64;
|
||||||
mod parse;
|
mod parse;
|
||||||
mod stack;
|
|
||||||
mod protect_unix;
|
mod protect_unix;
|
||||||
|
mod stack;
|
||||||
|
|
||||||
use crate::codegen::{CodegenError, ModuleCodeGenerator};
|
use crate::codegen::{CodegenError, ModuleCodeGenerator};
|
||||||
use crate::parse::LoadError;
|
use crate::parse::LoadError;
|
||||||
@ -30,9 +30,7 @@ use wasmer_runtime_core::{
|
|||||||
cache::{Artifact, Error as CacheError},
|
cache::{Artifact, Error as CacheError},
|
||||||
error::{CompileError, CompileResult},
|
error::{CompileError, CompileResult},
|
||||||
module::{ModuleInfo, ModuleInner},
|
module::{ModuleInfo, ModuleInner},
|
||||||
types::{
|
types::LocalFuncIndex,
|
||||||
LocalFuncIndex,
|
|
||||||
},
|
|
||||||
vm,
|
vm,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43,7 +41,9 @@ impl CacheGen for Placeholder {
|
|||||||
_module: &ModuleInner,
|
_module: &ModuleInner,
|
||||||
) -> Result<(Box<ModuleInfo>, Box<[u8]>, Memory), CacheError> {
|
) -> Result<(Box<ModuleInfo>, Box<[u8]>, Memory), CacheError> {
|
||||||
// unimplemented!()
|
// unimplemented!()
|
||||||
Err(CacheError::Unknown("the dynasm backend doesn't support caching yet".to_string()))
|
Err(CacheError::Unknown(
|
||||||
|
"the dynasm backend doesn't support caching yet".to_string(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,9 @@ impl Compiler for SinglePassCompiler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn from_cache(&self, _artifact: Artifact, _: Token) -> Result<ModuleInner, CacheError> {
|
unsafe fn from_cache(&self, _artifact: Artifact, _: Token) -> Result<ModuleInner, CacheError> {
|
||||||
Err(CacheError::Unknown("the dynasm backend doesn't support caching yet".to_string()))
|
Err(CacheError::Unknown(
|
||||||
|
"the dynasm backend doesn't support caching yet".to_string(),
|
||||||
|
))
|
||||||
// unimplemented!("the dynasm backend doesn't support caching yet")
|
// unimplemented!("the dynasm backend doesn't support caching yet")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::codegen::{CodegenError, FunctionCodeGenerator, ModuleCodeGenerator};
|
use crate::codegen::{CodegenError, FunctionCodeGenerator, ModuleCodeGenerator};
|
||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
backend::{Backend, ProtectedCaller, FuncResolver},
|
backend::{Backend, FuncResolver, ProtectedCaller},
|
||||||
module::{
|
module::{
|
||||||
DataInitializer, ExportIndex, ImportName, ModuleInfo, StringTable, StringTableBuilder,
|
DataInitializer, ExportIndex, ImportName, ModuleInfo, StringTable, StringTableBuilder,
|
||||||
TableInitializer,
|
TableInitializer,
|
||||||
@ -14,9 +14,8 @@ use wasmer_runtime_core::{
|
|||||||
units::Pages,
|
units::Pages,
|
||||||
};
|
};
|
||||||
use wasmparser::{
|
use wasmparser::{
|
||||||
BinaryReaderError, Data, DataKind, Element, ElementKind, Export,
|
BinaryReaderError, Data, DataKind, Element, ElementKind, Export, ExternalKind, FuncType,
|
||||||
ExternalKind, FuncType, Import, ImportSectionEntryType, InitExpr, ModuleReader, Operator,
|
Import, ImportSectionEntryType, InitExpr, ModuleReader, Operator, SectionCode, Type as WpType,
|
||||||
SectionCode, Type as WpType,
|
|
||||||
WasmDecoder,
|
WasmDecoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user