Update wasmparser to v0.95 (#3682)

* Update wasmparser to v0.95

* Update lib/compiler/src/translator/module.rs

Co-authored-by: Syrus Akbary <me@syrusakbary.com>

---------

Co-authored-by: Syrus Akbary <me@syrusakbary.com>
This commit is contained in:
ptitSeb
2023-03-15 11:15:58 +01:00
committed by GitHub
parent 092dac1761
commit f8c0910c33
26 changed files with 606 additions and 614 deletions

12
Cargo.lock generated
View File

@ -4763,7 +4763,7 @@ dependencies = [
"wasmer-derive", "wasmer-derive",
"wasmer-types", "wasmer-types",
"wasmer-vm", "wasmer-vm",
"wasmparser 0.83.0", "wasmparser 0.95.0",
"wat", "wat",
"winapi", "winapi",
] ]
@ -4940,7 +4940,7 @@ dependencies = [
"wasmer-object", "wasmer-object",
"wasmer-types", "wasmer-types",
"wasmer-vm", "wasmer-vm",
"wasmparser 0.83.0", "wasmparser 0.95.0",
"winapi", "winapi",
] ]
@ -5436,9 +5436,13 @@ checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a"
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
version = "0.83.0" version = "0.95.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a"
dependencies = [
"indexmap",
"url",
]
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"

View File

@ -68,7 +68,7 @@ js-sys = "0.3.51"
#web-sys = { version = "0.3.51", features = [ "console" ] } #web-sys = { version = "0.3.51", features = [ "console" ] }
wasmer-derive = { path = "../derive", version = "=3.2.0-alpha.1" } wasmer-derive = { path = "../derive", version = "=3.2.0-alpha.1" }
# - Optional dependencies for `js`. # - Optional dependencies for `js`.
wasmparser = { version = "0.83", default-features = false, optional = true } wasmparser = { version = "0.95", default-features = false, optional = true }
hashbrown = { version = "0.11", optional = true } hashbrown = { version = "0.11", optional = true }
serde-wasm-bindgen = { version = "0.4.5" } serde-wasm-bindgen = { version = "0.4.5" }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View File

@ -14,10 +14,10 @@ use wasmer_types::{
}; };
use wasmparser::{ use wasmparser::{
self, BinaryReaderError, Export, ExportSectionReader, ExternalKind, FuncType as WPFunctionType, self, BinaryReaderError, Export, ExportSectionReader, ExternalKind, FunctionSectionReader,
FunctionSectionReader, GlobalSectionReader, GlobalType as WPGlobalType, ImportSectionEntryType, GlobalSectionReader, GlobalType as WPGlobalType, ImportSectionReader, MemorySectionReader,
ImportSectionReader, MemorySectionReader, MemoryType as WPMemoryType, NameSectionReader, MemoryType as WPMemoryType, NameSectionReader, Parser, Payload, TableSectionReader, TypeRef,
Parser, Payload, TableSectionReader, TypeDef, TypeSectionReader, TypeSectionReader,
}; };
pub type WasmResult<T> = Result<T, String>; pub type WasmResult<T> = Result<T, String>;
@ -283,15 +283,17 @@ pub fn translate_module<'data>(data: &'data [u8]) -> WasmResult<ModuleInfoPolyfi
parse_export_section(exports, &mut module_info)?; parse_export_section(exports, &mut module_info)?;
} }
Payload::CustomSection { Payload::CustomSection(sectionreader) => {
name: "name", // We still add the custom section data, but also read it as name section reader
data, let name = sectionreader.name();
data_offset, if name == "name" {
.. parse_name_section(
} => parse_name_section( NameSectionReader::new(sectionreader.data(), sectionreader.data_offset())
NameSectionReader::new(data, data_offset).map_err(transform_err)?, .map_err(transform_err)?,
&mut module_info, &mut module_info,
)?, )?;
}
}
_ => {} _ => {}
} }
@ -301,16 +303,15 @@ pub fn translate_module<'data>(data: &'data [u8]) -> WasmResult<ModuleInfoPolyfi
} }
/// Helper function translating wasmparser types to Wasm Type. /// Helper function translating wasmparser types to Wasm Type.
pub fn wptype_to_type(ty: wasmparser::Type) -> WasmResult<Type> { pub fn wptype_to_type(ty: wasmparser::ValType) -> WasmResult<Type> {
match ty { match ty {
wasmparser::Type::I32 => Ok(Type::I32), wasmparser::ValType::I32 => Ok(Type::I32),
wasmparser::Type::I64 => Ok(Type::I64), wasmparser::ValType::I64 => Ok(Type::I64),
wasmparser::Type::F32 => Ok(Type::F32), wasmparser::ValType::F32 => Ok(Type::F32),
wasmparser::Type::F64 => Ok(Type::F64), wasmparser::ValType::F64 => Ok(Type::F64),
wasmparser::Type::V128 => Ok(Type::V128), wasmparser::ValType::V128 => Ok(Type::V128),
wasmparser::Type::ExternRef => Ok(Type::ExternRef), wasmparser::ValType::ExternRef => Ok(Type::ExternRef),
wasmparser::Type::FuncRef => Ok(Type::FuncRef), wasmparser::ValType::FuncRef => Ok(Type::FuncRef),
ty => Err(format!("wptype_to_type: wasmparser type {:?}", ty)),
} }
} }
@ -323,7 +324,9 @@ pub fn parse_type_section(
module_info.reserve_signatures(count)?; module_info.reserve_signatures(count)?;
for entry in types { for entry in types {
if let Ok(TypeDef::Func(WPFunctionType { params, returns })) = entry { if let Ok(wasmparser::Type::Func(functype)) = entry {
let params = functype.params();
let returns = functype.results();
let sig_params: Vec<Type> = params let sig_params: Vec<Type> = params
.iter() .iter()
.map(|ty| { .map(|ty| {
@ -358,23 +361,20 @@ pub fn parse_import_section<'data>(
for entry in imports { for entry in imports {
let import = entry.map_err(transform_err)?; let import = entry.map_err(transform_err)?;
let module_name = import.module; let module_name = import.module;
let field_name = import.field; let field_name = import.name;
match import.ty { match import.ty {
ImportSectionEntryType::Function(sig) => { TypeRef::Func(sig) => {
module_info.declare_func_import( module_info.declare_func_import(
SignatureIndex::from_u32(sig), SignatureIndex::from_u32(sig),
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
ImportSectionEntryType::Module(_) | ImportSectionEntryType::Instance(_) => { TypeRef::Tag(_) => {
unimplemented!("module linking not implemented yet")
}
ImportSectionEntryType::Tag(_) => {
unimplemented!("exception handling not implemented yet") unimplemented!("exception handling not implemented yet")
} }
ImportSectionEntryType::Memory(WPMemoryType { TypeRef::Memory(WPMemoryType {
shared, shared,
memory64, memory64,
initial, initial,
@ -390,20 +390,20 @@ pub fn parse_import_section<'data>(
shared, shared,
}, },
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
ImportSectionEntryType::Global(ref ty) => { TypeRef::Global(ref ty) => {
module_info.declare_global_import( module_info.declare_global_import(
GlobalType { GlobalType {
ty: wptype_to_type(ty.content_type).unwrap(), ty: wptype_to_type(ty.content_type).unwrap(),
mutability: ty.mutable.into(), mutability: ty.mutable.into(),
}, },
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
ImportSectionEntryType::Table(ref tab) => { TypeRef::Table(ref tab) => {
module_info.declare_table_import( module_info.declare_table_import(
TableType { TableType {
ty: wptype_to_type(tab.element_type).unwrap(), ty: wptype_to_type(tab.element_type).unwrap(),
@ -411,7 +411,7 @@ pub fn parse_import_section<'data>(
maximum: tab.maximum, maximum: tab.maximum,
}, },
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
} }
@ -512,7 +512,7 @@ pub fn parse_export_section<'data>(
for entry in exports { for entry in exports {
let Export { let Export {
field, name,
ref kind, ref kind,
index, index,
} = entry.map_err(transform_err)?; } = entry.map_err(transform_err)?;
@ -522,20 +522,17 @@ pub fn parse_export_section<'data>(
// becomes a concern here. // becomes a concern here.
let index = index as usize; let index = index as usize;
match *kind { match *kind {
ExternalKind::Function => { ExternalKind::Func => {
module_info.declare_func_export(FunctionIndex::new(index), field)? module_info.declare_func_export(FunctionIndex::new(index), name)?
} }
ExternalKind::Table => { ExternalKind::Table => {
module_info.declare_table_export(TableIndex::new(index), field)? module_info.declare_table_export(TableIndex::new(index), name)?
} }
ExternalKind::Memory => { ExternalKind::Memory => {
module_info.declare_memory_export(MemoryIndex::new(index), field)? module_info.declare_memory_export(MemoryIndex::new(index), name)?
} }
ExternalKind::Global => { ExternalKind::Global => {
module_info.declare_global_export(GlobalIndex::new(index), field)? module_info.declare_global_export(GlobalIndex::new(index), name)?
}
ExternalKind::Type | ExternalKind::Module | ExternalKind::Instance => {
unimplemented!("module linking not implemented yet")
} }
ExternalKind::Tag => { ExternalKind::Tag => {
unimplemented!("exception handling not implemented yet") unimplemented!("exception handling not implemented yet")
@ -559,20 +556,20 @@ pub fn parse_name_section<'data>(
while let Ok(subsection) = names.read() { while let Ok(subsection) = names.read() {
match subsection { match subsection {
wasmparser::Name::Function(_function_subsection) => { wasmparser::Name::Function(_function_subsection) => {
// if let Some(function_names) = function_subsection //for naming in function_subsection.into_iter().flatten() {
// .get_map() // if naming.index != std::u32::MAX {
// .ok() // environ.declare_function_name(
// .and_then(parse_function_name_subsection) // FunctionIndex::from_u32(naming.index),
// { // naming.name,
// for (index, name) in function_names { // )?;
// module_info.declare_function_name(index, name)?; // }
// } //}
// }
} }
wasmparser::Name::Module(module) => { wasmparser::Name::Module {
if let Ok(name) = module.get_name() { name,
module_info.declare_module_name(name)?; name_range: _,
} } => {
module_info.declare_module_name(name)?;
} }
wasmparser::Name::Local(_) => {} wasmparser::Name::Local(_) => {}
wasmparser::Name::Label(_) wasmparser::Name::Label(_)

View File

@ -533,6 +533,10 @@ pub enum wasmer_parser_operator_t {
F32x4RelaxedMax, F32x4RelaxedMax,
F64x2RelaxedMin, F64x2RelaxedMin,
F64x2RelaxedMax, F64x2RelaxedMax,
I16x8RelaxedQ15mulrS,
I16x8DotI8x16I7x16S,
I32x4DotI8x16I7x16AddS,
F32x4RelaxedDotBf16x8AddF32x4,
} }
impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t { impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t {
@ -1044,8 +1048,8 @@ impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t {
O::V128Store16Lane { .. } => Self::V128Store16Lane, O::V128Store16Lane { .. } => Self::V128Store16Lane,
O::V128Store32Lane { .. } => Self::V128Store32Lane, O::V128Store32Lane { .. } => Self::V128Store32Lane,
O::V128Store64Lane { .. } => Self::V128Store64Lane, O::V128Store64Lane { .. } => Self::V128Store64Lane,
O::I8x16RoundingAverageU => Self::I8x16RoundingAverageU, O::I8x16AvgrU => Self::I8x16RoundingAverageU,
O::I16x8RoundingAverageU => Self::I16x8RoundingAverageU, O::I16x8AvgrU => Self::I16x8RoundingAverageU,
O::I16x8Q15MulrSatS => Self::I16x8Q15MulrSatS, O::I16x8Q15MulrSatS => Self::I16x8Q15MulrSatS,
O::F32x4DemoteF64x2Zero => Self::F32x4DemoteF64x2Zero, O::F32x4DemoteF64x2Zero => Self::F32x4DemoteF64x2Zero,
O::F64x2PromoteLowF32x4 => Self::F64x2PromoteLowF32x4, O::F64x2PromoteLowF32x4 => Self::F64x2PromoteLowF32x4,
@ -1058,18 +1062,22 @@ impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t {
O::I32x4RelaxedTruncSatF32x4U => Self::I32x4RelaxedTruncSatF32x4U, O::I32x4RelaxedTruncSatF32x4U => Self::I32x4RelaxedTruncSatF32x4U,
O::I32x4RelaxedTruncSatF64x2SZero => Self::I32x4RelaxedTruncSatF64x2SZero, O::I32x4RelaxedTruncSatF64x2SZero => Self::I32x4RelaxedTruncSatF64x2SZero,
O::I32x4RelaxedTruncSatF64x2UZero => Self::I32x4RelaxedTruncSatF64x2UZero, O::I32x4RelaxedTruncSatF64x2UZero => Self::I32x4RelaxedTruncSatF64x2UZero,
O::F32x4Fma => Self::F32x4Fma, O::F32x4RelaxedFma => Self::F32x4Fma,
O::F32x4Fms => Self::F32x4Fms, O::F32x4RelaxedFnma => Self::F32x4Fms,
O::F64x2Fma => Self::F64x2Fma, O::F64x2RelaxedFma => Self::F64x2Fma,
O::F64x2Fms => Self::F64x2Fms, O::F64x2RelaxedFnma => Self::F64x2Fms,
O::I8x16LaneSelect => Self::I8x16LaneSelect, O::I8x16RelaxedLaneselect => Self::I8x16LaneSelect,
O::I16x8LaneSelect => Self::I16x8LaneSelect, O::I16x8RelaxedLaneselect => Self::I16x8LaneSelect,
O::I32x4LaneSelect => Self::I32x4LaneSelect, O::I32x4RelaxedLaneselect => Self::I32x4LaneSelect,
O::I64x2LaneSelect => Self::I64x2LaneSelect, O::I64x2RelaxedLaneselect => Self::I64x2LaneSelect,
O::F32x4RelaxedMin => Self::F32x4RelaxedMin, O::F32x4RelaxedMin => Self::F32x4RelaxedMin,
O::F32x4RelaxedMax => Self::F32x4RelaxedMax, O::F32x4RelaxedMax => Self::F32x4RelaxedMax,
O::F64x2RelaxedMin => Self::F64x2RelaxedMin, O::F64x2RelaxedMin => Self::F64x2RelaxedMin,
O::F64x2RelaxedMax => Self::F64x2RelaxedMax, O::F64x2RelaxedMax => Self::F64x2RelaxedMax,
O::I16x8RelaxedQ15mulrS => Self::I16x8RelaxedQ15mulrS,
O::I16x8DotI8x16I7x16S => Self::I16x8DotI8x16I7x16S,
O::I32x4DotI8x16I7x16AddS => Self::I32x4DotI8x16I7x16AddS,
O::F32x4RelaxedDotBf16x8AddF32x4 => Self::F32x4RelaxedDotBf16x8AddF32x4,
} }
} }
} }

View File

@ -3,12 +3,12 @@
use cranelift_codegen::Context; use cranelift_codegen::Context;
use cranelift_codegen::MachSrcLoc; use cranelift_codegen::MachSrcLoc;
use wasmer_compiler::wasmparser::Range; use std::ops::Range;
use wasmer_types::{FunctionAddressMap, InstructionAddressMap, SourceLoc}; use wasmer_types::{FunctionAddressMap, InstructionAddressMap, SourceLoc};
pub fn get_function_address_map( pub fn get_function_address_map(
context: &Context, context: &Context,
range: Range, range: Range<usize>,
body_len: usize, body_len: usize,
) -> FunctionAddressMap { ) -> FunctionAddressMap {
let mut instructions = Vec::new(); let mut instructions = Vec::new();

View File

@ -13,7 +13,7 @@ use cranelift_codegen::ir::{AbiParam, ArgumentPurpose, Function, InstBuilder, Si
use cranelift_codegen::isa::TargetFrontendConfig; use cranelift_codegen::isa::TargetFrontendConfig;
use cranelift_frontend::FunctionBuilder; use cranelift_frontend::FunctionBuilder;
use std::convert::TryFrom; use std::convert::TryFrom;
use wasmer_compiler::wasmparser::Type; use wasmer_compiler::wasmparser::ValType;
use wasmer_types::entity::EntityRef; use wasmer_types::entity::EntityRef;
use wasmer_types::entity::PrimaryMap; use wasmer_types::entity::PrimaryMap;
use wasmer_types::VMBuiltinFunctionIndex; use wasmer_types::VMBuiltinFunctionIndex;
@ -999,11 +999,11 @@ impl<'module_environment> BaseFuncEnvironment for FuncEnvironment<'module_enviro
fn translate_ref_null( fn translate_ref_null(
&mut self, &mut self,
mut pos: cranelift_codegen::cursor::FuncCursor, mut pos: cranelift_codegen::cursor::FuncCursor,
ty: Type, ty: ValType,
) -> WasmResult<ir::Value> { ) -> WasmResult<ir::Value> {
Ok(match ty { Ok(match ty {
Type::FuncRef => pos.ins().null(self.reference_type()), ValType::FuncRef => pos.ins().null(self.reference_type()),
Type::ExternRef => pos.ins().null(self.reference_type()), ValType::ExternRef => pos.ins().null(self.reference_type()),
_ => { _ => {
return Err(WasmError::Unsupported( return Err(WasmError::Unsupported(
"`ref.null T` that is not a `funcref` or an `externref`".into(), "`ref.null T` that is not a `funcref` or an `externref`".into(),

View File

@ -92,7 +92,7 @@ use cranelift_frontend::{FunctionBuilder, Variable};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::vec::Vec; use std::vec::Vec;
use wasmer_compiler::wasmparser::{MemoryImmediate, Operator}; use wasmer_compiler::wasmparser::{MemArg, Operator};
use wasmer_compiler::{from_binaryreadererror_wasmerror, wasm_unsupported, ModuleTranslationState}; use wasmer_compiler::{from_binaryreadererror_wasmerror, wasm_unsupported, ModuleTranslationState};
use wasmer_types::{ use wasmer_types::{
FunctionIndex, GlobalIndex, MemoryIndex, SignatureIndex, TableIndex, WasmResult, FunctionIndex, GlobalIndex, MemoryIndex, SignatureIndex, TableIndex, WasmResult,
@ -235,13 +235,13 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
* block and have already been translated) and modify the value stack to use the * block and have already been translated) and modify the value stack to use the
* possible `Block`'s arguments values. * possible `Block`'s arguments values.
***********************************************************************************/ ***********************************************************************************/
Operator::Block { ty } => { Operator::Block { blockty } => {
let (params, results) = module_translation_state.blocktype_params_results(*ty)?; let (params, results) = module_translation_state.blocktype_params_results(*blockty)?;
let next = block_with_params(builder, results, environ)?; let next = block_with_params(builder, results, environ)?;
state.push_block(next, params.len(), results.len()); state.push_block(next, params.len(), results.len());
} }
Operator::Loop { ty } => { Operator::Loop { blockty } => {
let (params, results) = module_translation_state.blocktype_params_results(*ty)?; let (params, results) = module_translation_state.blocktype_params_results(*blockty)?;
let loop_body = block_with_params(builder, params, environ)?; let loop_body = block_with_params(builder, params, environ)?;
let next = block_with_params(builder, results, environ)?; let next = block_with_params(builder, results, environ)?;
canonicalise_then_jump(builder, loop_body, state.peekn(params.len())); canonicalise_then_jump(builder, loop_body, state.peekn(params.len()));
@ -257,10 +257,10 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
builder.switch_to_block(loop_body); builder.switch_to_block(loop_body);
environ.translate_loop_header(builder.cursor())?; environ.translate_loop_header(builder.cursor())?;
} }
Operator::If { ty } => { Operator::If { blockty } => {
let val = state.pop1(); let val = state.pop1();
let (params, results) = module_translation_state.blocktype_params_results(*ty)?; let (params, results) = module_translation_state.blocktype_params_results(*blockty)?;
let (destination, else_data) = if params == results { let (destination, else_data) = if params == results {
// It is possible there is no `else` block, so we will only // It is possible there is no `else` block, so we will only
// allocate a block for it if/when we find the `else`. For now, // allocate a block for it if/when we find the `else`. For now,
@ -293,7 +293,13 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
// and we add nothing; // and we add nothing;
// - either the If have an Else clause, in that case the destination of this jump // - either the If have an Else clause, in that case the destination of this jump
// instruction will be changed later when we translate the Else operator. // instruction will be changed later when we translate the Else operator.
state.push_if(destination, else_data, params.len(), results.len(), *ty); state.push_if(
destination,
else_data,
params.len(),
results.len(),
*blockty,
);
} }
Operator::Else => { Operator::Else => {
let i = state.control_stack.len() - 1; let i = state.control_stack.len() - 1;
@ -433,10 +439,10 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
state.reachable = false; state.reachable = false;
} }
Operator::BrIf { relative_depth } => translate_br_if(*relative_depth, builder, state), Operator::BrIf { relative_depth } => translate_br_if(*relative_depth, builder, state),
Operator::BrTable { table } => { Operator::BrTable { targets } => {
let default = table.default(); let default = targets.default();
let mut min_depth = default; let mut min_depth = default;
for depth in table.targets() { for depth in targets.targets() {
let depth = depth.map_err(from_binaryreadererror_wasmerror)?; let depth = depth.map_err(from_binaryreadererror_wasmerror)?;
if depth < min_depth { if depth < min_depth {
min_depth = depth; min_depth = depth;
@ -452,10 +458,10 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
} }
}; };
let val = state.pop1(); let val = state.pop1();
let mut data = JumpTableData::with_capacity(table.len() as usize); let mut data = JumpTableData::with_capacity(targets.len() as usize);
if jump_args_count == 0 { if jump_args_count == 0 {
// No jump arguments // No jump arguments
for depth in table.targets() { for depth in targets.targets() {
let depth = depth.map_err(from_binaryreadererror_wasmerror)?; let depth = depth.map_err(from_binaryreadererror_wasmerror)?;
let block = { let block = {
let i = state.control_stack.len() - 1 - (depth as usize); let i = state.control_stack.len() - 1 - (depth as usize);
@ -479,7 +485,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let return_count = jump_args_count; let return_count = jump_args_count;
let mut dest_block_sequence = vec![]; let mut dest_block_sequence = vec![];
let mut dest_block_map = HashMap::new(); let mut dest_block_map = HashMap::new();
for depth in table.targets() { for depth in targets.targets() {
let depth = depth.map_err(from_binaryreadererror_wasmerror)?; let depth = depth.map_err(from_binaryreadererror_wasmerror)?;
let branch_block = match dest_block_map.entry(depth as usize) { let branch_block = match dest_block_map.entry(depth as usize) {
hash_map::Entry::Occupied(entry) => *entry.get(), hash_map::Entry::Occupied(entry) => *entry.get(),
@ -580,10 +586,14 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
state.popn(num_args); state.popn(num_args);
state.pushn(inst_results); state.pushn(inst_results);
} }
Operator::CallIndirect { index, table_index } => { Operator::CallIndirect {
type_index,
table_index,
table_byte: _,
} => {
// `index` is the index of the function's signature and `table_index` is the index of // `index` is the index of the function's signature and `table_index` is the index of
// the table to search the function in. // the table to search the function in.
let (sigref, num_args) = state.get_indirect_sig(builder.func, *index, environ)?; let (sigref, num_args) = state.get_indirect_sig(builder.func, *type_index, environ)?;
let table = state.get_or_create_table(builder.func, *table_index, environ)?; let table = state.get_or_create_table(builder.func, *table_index, environ)?;
let callee = state.pop1(); let callee = state.pop1();
@ -596,7 +606,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
bitcast_arguments(args, &types, builder); bitcast_arguments(args, &types, builder);
let args = state.peekn(num_args); let args = state.peekn(num_args);
let sig_idx = SignatureIndex::from_u32(*index); let sig_idx = SignatureIndex::from_u32(*type_index);
let call = environ.translate_call_indirect( let call = environ.translate_call_indirect(
builder.cursor(), builder.cursor(),
@ -1299,11 +1309,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
Operator::AtomicFence { .. } => { Operator::AtomicFence { .. } => {
builder.ins().fence(); builder.ins().fence();
} }
Operator::MemoryCopy { src, dst } => { Operator::MemoryCopy { dst_mem, src_mem } => {
let src_index = MemoryIndex::from_u32(*src); let src_index = MemoryIndex::from_u32(*src_mem);
let dst_index = MemoryIndex::from_u32(*dst); let dst_index = MemoryIndex::from_u32(*dst_mem);
let src_heap = state.get_heap(builder.func, *src, environ)?; let src_heap = state.get_heap(builder.func, *src_mem, environ)?;
let dst_heap = state.get_heap(builder.func, *dst, environ)?; let dst_heap = state.get_heap(builder.func, *dst_mem, environ)?;
let len = state.pop1(); let len = state.pop1();
let src_pos = state.pop1(); let src_pos = state.pop1();
let dst_pos = state.pop1(); let dst_pos = state.pop1();
@ -1326,7 +1336,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let dest = state.pop1(); let dest = state.pop1();
environ.translate_memory_fill(builder.cursor(), heap_index, heap, dest, val, len)?; environ.translate_memory_fill(builder.cursor(), heap_index, heap, dest, val, len)?;
} }
Operator::MemoryInit { segment, mem } => { Operator::MemoryInit { data_index, mem } => {
let heap_index = MemoryIndex::from_u32(*mem); let heap_index = MemoryIndex::from_u32(*mem);
let heap = state.get_heap(builder.func, *mem, environ)?; let heap = state.get_heap(builder.func, *mem, environ)?;
let len = state.pop1(); let len = state.pop1();
@ -1336,14 +1346,14 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
builder.cursor(), builder.cursor(),
heap_index, heap_index,
heap, heap,
*segment, *data_index,
dest, dest,
src, src,
len, len,
)?; )?;
} }
Operator::DataDrop { segment } => { Operator::DataDrop { data_index } => {
environ.translate_data_drop(builder.cursor(), *segment)?; environ.translate_data_drop(builder.cursor(), *data_index)?;
} }
Operator::TableSize { table: index } => { Operator::TableSize { table: index } => {
let table = state.get_or_create_table(builder.func, *index, environ)?; let table = state.get_or_create_table(builder.func, *index, environ)?;
@ -1409,7 +1419,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
environ.translate_table_fill(builder.cursor(), table_index, dest, val, len)?; environ.translate_table_fill(builder.cursor(), table_index, dest, val, len)?;
} }
Operator::TableInit { Operator::TableInit {
segment, elem_index,
table: table_index, table: table_index,
} => { } => {
let table = state.get_or_create_table(builder.func, *table_index, environ)?; let table = state.get_or_create_table(builder.func, *table_index, environ)?;
@ -1418,7 +1428,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let dest = state.pop1(); let dest = state.pop1();
environ.translate_table_init( environ.translate_table_init(
builder.cursor(), builder.cursor(),
*segment, *elem_index,
TableIndex::from_u32(*table_index), TableIndex::from_u32(*table_index),
table, table,
dest, dest,
@ -1426,8 +1436,8 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
len, len,
)?; )?;
} }
Operator::ElemDrop { segment } => { Operator::ElemDrop { elem_index } => {
environ.translate_elem_drop(builder.cursor(), *segment)?; environ.translate_elem_drop(builder.cursor(), *elem_index)?;
} }
Operator::V128Const { value } => { Operator::V128Const { value } => {
let data = value.bytes().to_vec().into(); let data = value.bytes().to_vec().into();
@ -1590,7 +1600,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let (a, b) = pop2_with_bitcast(state, type_of(op), builder); let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().umax(a, b)) state.push1(builder.ins().umax(a, b))
} }
Operator::I8x16RoundingAverageU | Operator::I16x8RoundingAverageU => { Operator::I8x16AvgrU | Operator::I16x8AvgrU => {
let (a, b) = pop2_with_bitcast(state, type_of(op), builder); let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().avg_round(a, b)) state.push1(builder.ins().avg_round(a, b))
} }
@ -2026,18 +2036,22 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
| Operator::I32x4RelaxedTruncSatF32x4U | Operator::I32x4RelaxedTruncSatF32x4U
| Operator::I32x4RelaxedTruncSatF64x2SZero | Operator::I32x4RelaxedTruncSatF64x2SZero
| Operator::I32x4RelaxedTruncSatF64x2UZero | Operator::I32x4RelaxedTruncSatF64x2UZero
| Operator::F32x4Fma | Operator::F32x4RelaxedFma
| Operator::F32x4Fms | Operator::F32x4RelaxedFnma
| Operator::F64x2Fma | Operator::F64x2RelaxedFma
| Operator::F64x2Fms | Operator::F64x2RelaxedFnma
| Operator::I8x16LaneSelect | Operator::I8x16RelaxedLaneselect
| Operator::I16x8LaneSelect | Operator::I16x8RelaxedLaneselect
| Operator::I32x4LaneSelect | Operator::I32x4RelaxedLaneselect
| Operator::I64x2LaneSelect | Operator::I64x2RelaxedLaneselect
| Operator::F32x4RelaxedMin | Operator::F32x4RelaxedMin
| Operator::F32x4RelaxedMax | Operator::F32x4RelaxedMax
| Operator::F64x2RelaxedMin | Operator::F64x2RelaxedMin
| Operator::F64x2RelaxedMax => { | Operator::F64x2RelaxedMax
| Operator::F32x4RelaxedDotBf16x8AddF32x4
| Operator::I16x8RelaxedQ15mulrS
| Operator::I16x8DotI8x16I7x16S
| Operator::I32x4DotI8x16I7x16AddS => {
return Err(wasm_unsupported!("proposed relaxed-simd operator {:?}", op)); return Err(wasm_unsupported!("proposed relaxed-simd operator {:?}", op));
} }
}; };
@ -2058,7 +2072,7 @@ fn translate_unreachable_operator<FE: FuncEnvironment + ?Sized>(
) -> WasmResult<()> { ) -> WasmResult<()> {
debug_assert!(!state.reachable); debug_assert!(!state.reachable);
match *op { match *op {
Operator::If { ty } => { Operator::If { blockty } => {
// Push a placeholder control stack entry. The if isn't reachable, // Push a placeholder control stack entry. The if isn't reachable,
// so we don't have any branches anywhere. // so we don't have any branches anywhere.
state.push_if( state.push_if(
@ -2068,10 +2082,10 @@ fn translate_unreachable_operator<FE: FuncEnvironment + ?Sized>(
}, },
0, 0,
0, 0,
ty, blockty,
); );
} }
Operator::Loop { ty: _ } | Operator::Block { ty: _ } => { Operator::Loop { blockty: _ } | Operator::Block { blockty: _ } => {
state.push_block(ir::Block::reserved_value(), 0, 0); state.push_block(ir::Block::reserved_value(), 0, 0);
} }
Operator::Else => { Operator::Else => {
@ -2263,7 +2277,7 @@ fn get_heap_addr(
/// Prepare for a load; factors out common functionality between load and load_extend operations. /// Prepare for a load; factors out common functionality between load and load_extend operations.
fn prepare_load<FE: FuncEnvironment + ?Sized>( fn prepare_load<FE: FuncEnvironment + ?Sized>(
memarg: &MemoryImmediate, memarg: &MemArg,
loaded_bytes: u32, loaded_bytes: u32,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
@ -2293,7 +2307,7 @@ fn prepare_load<FE: FuncEnvironment + ?Sized>(
/// Translate a load instruction. /// Translate a load instruction.
fn translate_load<FE: FuncEnvironment + ?Sized>( fn translate_load<FE: FuncEnvironment + ?Sized>(
memarg: &MemoryImmediate, memarg: &MemArg,
opcode: ir::Opcode, opcode: ir::Opcode,
result_ty: Type, result_ty: Type,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
@ -2314,7 +2328,7 @@ fn translate_load<FE: FuncEnvironment + ?Sized>(
/// Translate a store instruction. /// Translate a store instruction.
fn translate_store<FE: FuncEnvironment + ?Sized>( fn translate_store<FE: FuncEnvironment + ?Sized>(
memarg: &MemoryImmediate, memarg: &MemArg,
opcode: ir::Opcode, opcode: ir::Opcode,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
@ -2359,7 +2373,7 @@ fn translate_icmp(cc: IntCC, builder: &mut FunctionBuilder, state: &mut FuncTran
fn fold_atomic_mem_addr( fn fold_atomic_mem_addr(
linear_mem_addr: Value, linear_mem_addr: Value,
memarg: &MemoryImmediate, memarg: &MemArg,
access_ty: Type, access_ty: Type,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
) -> Value { ) -> Value {
@ -2393,7 +2407,7 @@ fn fold_atomic_mem_addr(
// and then compute the final effective address. // and then compute the final effective address.
fn finalise_atomic_mem_addr<FE: FuncEnvironment + ?Sized>( fn finalise_atomic_mem_addr<FE: FuncEnvironment + ?Sized>(
linear_mem_addr: Value, linear_mem_addr: Value,
memarg: &MemoryImmediate, memarg: &MemArg,
access_ty: Type, access_ty: Type,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
@ -2445,7 +2459,7 @@ fn translate_atomic_rmw<FE: FuncEnvironment + ?Sized>(
widened_ty: Type, widened_ty: Type,
access_ty: Type, access_ty: Type,
op: AtomicRmwOp, op: AtomicRmwOp,
memarg: &MemoryImmediate, memarg: &MemArg,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
environ: &mut FE, environ: &mut FE,
@ -2491,7 +2505,7 @@ fn translate_atomic_rmw<FE: FuncEnvironment + ?Sized>(
fn translate_atomic_cas<FE: FuncEnvironment + ?Sized>( fn translate_atomic_cas<FE: FuncEnvironment + ?Sized>(
widened_ty: Type, widened_ty: Type,
access_ty: Type, access_ty: Type,
memarg: &MemoryImmediate, memarg: &MemArg,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
environ: &mut FE, environ: &mut FE,
@ -2542,7 +2556,7 @@ fn translate_atomic_cas<FE: FuncEnvironment + ?Sized>(
fn translate_atomic_load<FE: FuncEnvironment + ?Sized>( fn translate_atomic_load<FE: FuncEnvironment + ?Sized>(
widened_ty: Type, widened_ty: Type,
access_ty: Type, access_ty: Type,
memarg: &MemoryImmediate, memarg: &MemArg,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
environ: &mut FE, environ: &mut FE,
@ -2581,7 +2595,7 @@ fn translate_atomic_load<FE: FuncEnvironment + ?Sized>(
fn translate_atomic_store<FE: FuncEnvironment + ?Sized>( fn translate_atomic_store<FE: FuncEnvironment + ?Sized>(
access_ty: Type, access_ty: Type,
memarg: &MemoryImmediate, memarg: &MemArg,
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
state: &mut FuncTranslationState, state: &mut FuncTranslationState,
environ: &mut FE, environ: &mut FE,
@ -2733,7 +2747,7 @@ fn type_of(operator: &Operator) -> Type {
| Operator::I8x16MinU | Operator::I8x16MinU
| Operator::I8x16MaxS | Operator::I8x16MaxS
| Operator::I8x16MaxU | Operator::I8x16MaxU
| Operator::I8x16RoundingAverageU | Operator::I8x16AvgrU
| Operator::I8x16Bitmask | Operator::I8x16Bitmask
| Operator::I8x16Popcnt => I8X16, | Operator::I8x16Popcnt => I8X16,
@ -2770,7 +2784,7 @@ fn type_of(operator: &Operator) -> Type {
| Operator::I16x8MinU | Operator::I16x8MinU
| Operator::I16x8MaxS | Operator::I16x8MaxS
| Operator::I16x8MaxU | Operator::I16x8MaxU
| Operator::I16x8RoundingAverageU | Operator::I16x8AvgrU
| Operator::I16x8Mul | Operator::I16x8Mul
| Operator::I16x8Bitmask => I16X8, | Operator::I16x8Bitmask => I16X8,

View File

@ -12,7 +12,7 @@ use cranelift_codegen::ir::immediates::Offset32;
use cranelift_codegen::ir::{self, InstBuilder}; use cranelift_codegen::ir::{self, InstBuilder};
use cranelift_codegen::isa::TargetFrontendConfig; use cranelift_codegen::isa::TargetFrontendConfig;
use cranelift_frontend::FunctionBuilder; use cranelift_frontend::FunctionBuilder;
use wasmer_compiler::wasmparser::{Operator, Type}; use wasmer_compiler::wasmparser::{Operator, ValType};
use wasmer_types::{ use wasmer_types::{
FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, MemoryIndex, SignatureIndex, FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, MemoryIndex, SignatureIndex,
TableIndex, Type as WasmerType, WasmResult, TableIndex, Type as WasmerType, WasmResult,
@ -359,7 +359,7 @@ pub trait FuncEnvironment: TargetEnvironment {
/// null sentinel is not a null reference type pointer for your type. If you /// null sentinel is not a null reference type pointer for your type. If you
/// override this method, then you should also override /// override this method, then you should also override
/// `translate_ref_is_null` as well. /// `translate_ref_is_null` as well.
fn translate_ref_null(&mut self, pos: FuncCursor, ty: Type) -> WasmResult<ir::Value>; fn translate_ref_null(&mut self, pos: FuncCursor, ty: ValType) -> WasmResult<ir::Value>;
// { // {
// let _ = ty; // let _ = ty;
// Ok(pos.ins().null(self.reference_type(ty))) // Ok(pos.ins().null(self.reference_type(ty)))

View File

@ -63,7 +63,7 @@ pub enum ControlStackFrame {
num_return_values: usize, num_return_values: usize,
original_stack_size: usize, original_stack_size: usize,
exit_is_branched_to: bool, exit_is_branched_to: bool,
blocktype: wasmer_compiler::wasmparser::TypeOrFuncType, blocktype: wasmer_compiler::wasmparser::BlockType,
/// Was the head of the `if` reachable? /// Was the head of the `if` reachable?
head_is_reachable: bool, head_is_reachable: bool,
/// What was the reachability at the end of the consequent? /// What was the reachability at the end of the consequent?
@ -419,7 +419,7 @@ impl FuncTranslationState {
else_data: ElseData, else_data: ElseData,
num_param_types: usize, num_param_types: usize,
num_result_types: usize, num_result_types: usize,
blocktype: wasmer_compiler::wasmparser::TypeOrFuncType, blocktype: wasmer_compiler::wasmparser::BlockType,
) { ) {
debug_assert!(num_param_types <= self.stack.len()); debug_assert!(num_param_types <= self.stack.len());

View File

@ -16,9 +16,7 @@ use cranelift_codegen::ir::{self, Block, InstBuilder, ValueLabel};
use cranelift_codegen::timing; use cranelift_codegen::timing;
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable}; use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
use wasmer_compiler::wasmparser; use wasmer_compiler::wasmparser;
use wasmer_compiler::{ use wasmer_compiler::{wptype_to_type, FunctionBinaryReader, ModuleTranslationState};
wasm_unsupported, wptype_to_type, FunctionBinaryReader, ModuleTranslationState,
};
use wasmer_types::{LocalFunctionIndex, WasmResult}; use wasmer_types::{LocalFunctionIndex, WasmResult};
/// WebAssembly to Cranelift IR function translator. /// WebAssembly to Cranelift IR function translator.
@ -181,12 +179,12 @@ fn parse_local_decls<FE: FuncEnvironment + ?Sized>(
fn declare_locals<FE: FuncEnvironment + ?Sized>( fn declare_locals<FE: FuncEnvironment + ?Sized>(
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
count: u32, count: u32,
wasm_type: wasmparser::Type, wasm_type: wasmparser::ValType,
next_local: &mut usize, next_local: &mut usize,
environ: &mut FE, environ: &mut FE,
) -> WasmResult<()> { ) -> WasmResult<()> {
// All locals are initialized to 0. // All locals are initialized to 0.
use wasmparser::Type::*; use wasmparser::ValType::*;
let zeroval = match wasm_type { let zeroval = match wasm_type {
I32 => builder.ins().iconst(ir::types::I32, 0), I32 => builder.ins().iconst(ir::types::I32, 0),
I64 => builder.ins().iconst(ir::types::I64, 0), I64 => builder.ins().iconst(ir::types::I64, 0),
@ -198,7 +196,6 @@ fn declare_locals<FE: FuncEnvironment + ?Sized>(
} }
ExternRef => builder.ins().null(environ.reference_type()), ExternRef => builder.ins().null(environ.reference_type()),
FuncRef => builder.ins().null(environ.reference_type()), FuncRef => builder.ins().null(environ.reference_type()),
ty => return Err(wasm_unsupported!("unsupported local type {:?}", ty)),
}; };
let wasmer_ty = wptype_to_type(wasm_type).unwrap(); let wasmer_ty = wptype_to_type(wasm_type).unwrap();

View File

@ -7,7 +7,6 @@ use cranelift_codegen::binemit::Reloc;
use cranelift_codegen::ir::{self, AbiParam}; use cranelift_codegen::ir::{self, AbiParam};
use cranelift_codegen::isa::TargetFrontendConfig; use cranelift_codegen::isa::TargetFrontendConfig;
use cranelift_frontend::FunctionBuilder; use cranelift_frontend::FunctionBuilder;
use wasmer_compiler::wasm_unsupported;
use wasmer_compiler::wasmparser; use wasmer_compiler::wasmparser;
use wasmer_types::{FunctionType, LibCall, RelocationKind, Type, WasmError, WasmResult}; use wasmer_types::{FunctionType, LibCall, RelocationKind, Type, WasmError, WasmResult};
@ -92,36 +91,30 @@ pub fn irreloc_to_relocationkind(reloc: Reloc) -> RelocationKind {
/// Create a `Block` with the given Wasm parameters. /// Create a `Block` with the given Wasm parameters.
pub fn block_with_params<PE: TargetEnvironment + ?Sized>( pub fn block_with_params<PE: TargetEnvironment + ?Sized>(
builder: &mut FunctionBuilder, builder: &mut FunctionBuilder,
params: &[wasmparser::Type], params: &[wasmparser::ValType],
environ: &PE, environ: &PE,
) -> WasmResult<ir::Block> { ) -> WasmResult<ir::Block> {
let block = builder.create_block(); let block = builder.create_block();
for ty in params.iter() { for ty in params.iter() {
match ty { match ty {
wasmparser::Type::I32 => { wasmparser::ValType::I32 => {
builder.append_block_param(block, ir::types::I32); builder.append_block_param(block, ir::types::I32);
} }
wasmparser::Type::I64 => { wasmparser::ValType::I64 => {
builder.append_block_param(block, ir::types::I64); builder.append_block_param(block, ir::types::I64);
} }
wasmparser::Type::F32 => { wasmparser::ValType::F32 => {
builder.append_block_param(block, ir::types::F32); builder.append_block_param(block, ir::types::F32);
} }
wasmparser::Type::F64 => { wasmparser::ValType::F64 => {
builder.append_block_param(block, ir::types::F64); builder.append_block_param(block, ir::types::F64);
} }
wasmparser::Type::ExternRef | wasmparser::Type::FuncRef => { wasmparser::ValType::ExternRef | wasmparser::ValType::FuncRef => {
builder.append_block_param(block, environ.reference_type()); builder.append_block_param(block, environ.reference_type());
} }
wasmparser::Type::V128 => { wasmparser::ValType::V128 => {
builder.append_block_param(block, ir::types::I8X16); builder.append_block_param(block, ir::types::I8X16);
} }
ty => {
return Err(wasm_unsupported!(
"block_with_params: type {:?} in multi-value block's signature",
ty
))
}
} }
} }
Ok(block) Ok(block)

View File

@ -25,7 +25,7 @@ use crate::abi::{get_abi, Abi};
use crate::config::{CompiledKind, LLVM}; use crate::config::{CompiledKind, LLVM};
use crate::object_file::{load_object_file, CompiledFunction}; use crate::object_file::{load_object_file, CompiledFunction};
use std::convert::TryFrom; use std::convert::TryFrom;
use wasmer_compiler::wasmparser::{MemoryImmediate, Operator}; use wasmer_compiler::wasmparser::{MemArg, Operator};
use wasmer_compiler::{ use wasmer_compiler::{
from_binaryreadererror_wasmerror, wptype_to_type, FunctionBinaryReader, FunctionBodyData, from_binaryreadererror_wasmerror, wptype_to_type, FunctionBinaryReader, FunctionBodyData,
MiddlewareBinaryReader, ModuleMiddlewareChain, ModuleTranslationState, MiddlewareBinaryReader, ModuleMiddlewareChain, ModuleTranslationState,
@ -1028,7 +1028,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
fn annotate_user_memaccess( fn annotate_user_memaccess(
&mut self, &mut self,
memory_index: MemoryIndex, memory_index: MemoryIndex,
_memarg: &MemoryImmediate, _memarg: &MemArg,
alignment: u32, alignment: u32,
memaccess: InstructionValue<'ctx>, memaccess: InstructionValue<'ctx>,
) -> Result<(), CompileError> { ) -> Result<(), CompileError> {
@ -1051,7 +1051,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
fn resolve_memory_ptr( fn resolve_memory_ptr(
&mut self, &mut self,
memory_index: MemoryIndex, memory_index: MemoryIndex,
memarg: &MemoryImmediate, memarg: &MemArg,
ptr_ty: PointerType<'ctx>, ptr_ty: PointerType<'ctx>,
var_offset: IntValue<'ctx>, var_offset: IntValue<'ctx>,
value_size: usize, value_size: usize,
@ -1174,7 +1174,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
.into_pointer_value()) .into_pointer_value())
} }
fn trap_if_misaligned(&self, _memarg: &MemoryImmediate, ptr: PointerValue<'ctx>, align: u8) { fn trap_if_misaligned(&self, _memarg: &MemArg, ptr: PointerValue<'ctx>, align: u8) {
if align <= 1 { if align <= 1 {
return; return;
} }
@ -1394,7 +1394,9 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
if !self.state.reachable { if !self.state.reachable {
match op { match op {
Operator::Block { ty: _ } | Operator::Loop { ty: _ } | Operator::If { ty: _ } => { Operator::Block { blockty: _ }
| Operator::Loop { blockty: _ }
| Operator::If { blockty: _ } => {
self.unreachable_depth += 1; self.unreachable_depth += 1;
return Ok(()); return Ok(());
} }
@ -1420,7 +1422,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
* Control Flow instructions. * Control Flow instructions.
* https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#control-flow-instructions * https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#control-flow-instructions
***************************/ ***************************/
Operator::Block { ty } => { Operator::Block { blockty } => {
let current_block = self let current_block = self
.builder .builder
.get_insert_block() .get_insert_block()
@ -1431,7 +1433,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let phis: SmallVec<[PhiValue<'ctx>; 1]> = self let phis: SmallVec<[PhiValue<'ctx>; 1]> = self
.module_translation .module_translation
.blocktype_params_results(ty)? .blocktype_params_results(blockty)?
.1 .1
.iter() .iter()
.map(|&wp_ty| { .map(|&wp_ty| {
@ -1447,7 +1449,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
self.state.push_block(end_block, phis); self.state.push_block(end_block, phis);
self.builder.position_at_end(current_block); self.builder.position_at_end(current_block);
} }
Operator::Loop { ty } => { Operator::Loop { blockty } => {
let loop_body = self.context.append_basic_block(self.function, "loop_body"); let loop_body = self.context.append_basic_block(self.function, "loop_body");
let loop_next = self.context.append_basic_block(self.function, "loop_outer"); let loop_next = self.context.append_basic_block(self.function, "loop_outer");
let pre_loop_block = self.builder.get_insert_block().unwrap(); let pre_loop_block = self.builder.get_insert_block().unwrap();
@ -1455,7 +1457,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
self.builder.build_unconditional_branch(loop_body); self.builder.build_unconditional_branch(loop_body);
self.builder.position_at_end(loop_next); self.builder.position_at_end(loop_next);
let blocktypes = self.module_translation.blocktype_params_results(ty)?; let blocktypes = self.module_translation.blocktype_params_results(blockty)?;
let phis = blocktypes let phis = blocktypes
.1 .1
.iter() .iter()
@ -1592,7 +1594,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
.build_conditional_branch(cond_value, *frame.br_dest(), else_block); .build_conditional_branch(cond_value, *frame.br_dest(), else_block);
self.builder.position_at_end(else_block); self.builder.position_at_end(else_block);
} }
Operator::BrTable { ref table } => { Operator::BrTable { ref targets } => {
let current_block = self let current_block = self
.builder .builder
.get_insert_block() .get_insert_block()
@ -1600,7 +1602,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let index = self.state.pop1()?; let index = self.state.pop1()?;
let default_frame = self.state.frame_at_depth(table.default())?; let default_frame = self.state.frame_at_depth(targets.default())?;
let phis = if default_frame.is_loop() { let phis = if default_frame.is_loop() {
default_frame.loop_body_phis() default_frame.loop_body_phis()
@ -1613,7 +1615,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
phi.add_incoming(&[(value, current_block)]); phi.add_incoming(&[(value, current_block)]);
} }
let cases: Vec<_> = table let cases: Vec<_> = targets
.targets() .targets()
.enumerate() .enumerate()
.map(|(case_index, depth)| { .map(|(case_index, depth)| {
@ -1649,7 +1651,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
self.state.popn(args_len)?; self.state.popn(args_len)?;
self.state.reachable = false; self.state.reachable = false;
} }
Operator::If { ty } => { Operator::If { blockty } => {
let current_block = self let current_block = self
.builder .builder
.get_insert_block() .get_insert_block()
@ -1663,7 +1665,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let phis = self let phis = self
.module_translation .module_translation
.blocktype_params_results(ty)? .blocktype_params_results(blockty)?
.1 .1
.iter() .iter()
.map(|&wp_ty| { .map(|&wp_ty| {
@ -1694,7 +1696,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
self.builder.position_at_end(if_else_block); self.builder.position_at_end(if_else_block);
let block_param_types = self let block_param_types = self
.module_translation .module_translation
.blocktype_params_results(ty)? .blocktype_params_results(blockty)?
.0 .0
.iter() .iter()
.map(|&wp_ty| { .map(|&wp_ty| {
@ -2268,8 +2270,12 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
.iter() .iter()
.for_each(|ret| self.state.push1(*ret)); .for_each(|ret| self.state.push1(*ret));
} }
Operator::CallIndirect { index, table_index } => { Operator::CallIndirect {
let sigindex = SignatureIndex::from_u32(index); type_index,
table_index,
table_byte: _,
} => {
let sigindex = SignatureIndex::from_u32(type_index);
let func_type = &self.wasm_module.signatures[sigindex]; let func_type = &self.wasm_module.signatures[sigindex];
let expected_dynamic_sigindex = let expected_dynamic_sigindex =
self.ctx self.ctx
@ -3946,7 +3952,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, ""); let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res); self.state.push1(res);
} }
Operator::I8x16RoundingAverageU => { Operator::I8x16AvgrU => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?; let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i8x16(v1, i1); let (v1, _) = self.v128_into_i8x16(v1, i1);
let (v2, _) = self.v128_into_i8x16(v2, i2); let (v2, _) = self.v128_into_i8x16(v2, i2);
@ -3977,7 +3983,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, ""); let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res); self.state.push1(res);
} }
Operator::I16x8RoundingAverageU => { Operator::I16x8AvgrU => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?; let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i16x8(v1, i1); let (v1, _) = self.v128_into_i16x8(v1, i1);
let (v2, _) = self.v128_into_i16x8(v2, i2); let (v2, _) = self.v128_into_i16x8(v2, i2);
@ -8945,7 +8951,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, ""); let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res); self.state.push1(res);
} }
Operator::AtomicFence { flags: _ } => { Operator::AtomicFence => {
// Fence is a nop. // Fence is a nop.
// //
// Fence was added to preserve information about fences from // Fence was added to preserve information about fences from
@ -10946,10 +10952,10 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
size.add_attribute(AttributeLoc::Function, self.intrinsics.readonly); size.add_attribute(AttributeLoc::Function, self.intrinsics.readonly);
self.state.push1(size.try_as_basic_value().left().unwrap()); self.state.push1(size.try_as_basic_value().left().unwrap());
} }
Operator::MemoryInit { segment, mem } => { Operator::MemoryInit { data_index, mem } => {
let (dest, src, len) = self.state.pop3()?; let (dest, src, len) = self.state.pop3()?;
let mem = self.intrinsics.i32_ty.const_int(mem.into(), false); let mem = self.intrinsics.i32_ty.const_int(mem.into(), false);
let segment = self.intrinsics.i32_ty.const_int(segment.into(), false); let segment = self.intrinsics.i32_ty.const_int(data_index.into(), false);
self.builder.build_call( self.builder.build_call(
self.intrinsics.memory_init, self.intrinsics.memory_init,
&[ &[
@ -10963,24 +10969,24 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
"", "",
); );
} }
Operator::DataDrop { segment } => { Operator::DataDrop { data_index } => {
let segment = self.intrinsics.i32_ty.const_int(segment.into(), false); let segment = self.intrinsics.i32_ty.const_int(data_index.into(), false);
self.builder.build_call( self.builder.build_call(
self.intrinsics.data_drop, self.intrinsics.data_drop,
&[vmctx.as_basic_value_enum().into(), segment.into()], &[vmctx.as_basic_value_enum().into(), segment.into()],
"", "",
); );
} }
Operator::MemoryCopy { src, dst } => { Operator::MemoryCopy { dst_mem, src_mem } => {
// ignored until we support multiple memories // ignored until we support multiple memories
let _dst = dst; let _dst = dst_mem;
let (memory_copy, src) = if let Some(local_memory_index) = self let (memory_copy, src) = if let Some(local_memory_index) = self
.wasm_module .wasm_module
.local_memory_index(MemoryIndex::from_u32(src)) .local_memory_index(MemoryIndex::from_u32(src_mem))
{ {
(self.intrinsics.memory_copy, local_memory_index.as_u32()) (self.intrinsics.memory_copy, local_memory_index.as_u32())
} else { } else {
(self.intrinsics.imported_memory_copy, src) (self.intrinsics.imported_memory_copy, src_mem)
}; };
let (dest_pos, src_pos, len) = self.state.pop3()?; let (dest_pos, src_pos, len) = self.state.pop3()?;
@ -11137,9 +11143,9 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
"", "",
); );
} }
Operator::TableInit { segment, table } => { Operator::TableInit { elem_index, table } => {
let (dst, src, len) = self.state.pop3()?; let (dst, src, len) = self.state.pop3()?;
let segment = self.intrinsics.i32_ty.const_int(segment as u64, false); let segment = self.intrinsics.i32_ty.const_int(elem_index as u64, false);
let table = self.intrinsics.i32_ty.const_int(table as u64, false); let table = self.intrinsics.i32_ty.const_int(table as u64, false);
self.builder.build_call( self.builder.build_call(
self.intrinsics.table_init, self.intrinsics.table_init,
@ -11154,8 +11160,8 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
"", "",
); );
} }
Operator::ElemDrop { segment } => { Operator::ElemDrop { elem_index } => {
let segment = self.intrinsics.i32_ty.const_int(segment as u64, false); let segment = self.intrinsics.i32_ty.const_int(elem_index as u64, false);
self.builder.build_call( self.builder.build_call(
self.intrinsics.elem_drop, self.intrinsics.elem_drop,
&[self.ctx.basic().into(), segment.into()], &[self.ctx.basic().into(), segment.into()],

View File

@ -11,7 +11,7 @@ use gimli::write::Address;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use std::cmp; use std::cmp;
use std::iter; use std::iter;
use wasmer_compiler::wasmparser::{Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType}; use wasmer_compiler::wasmparser::{BlockType as WpTypeOrFuncType, Operator, ValType as WpType};
use wasmer_compiler::FunctionBodyData; use wasmer_compiler::FunctionBodyData;
#[cfg(feature = "unwind")] #[cfg(feature = "unwind")]
use wasmer_types::CompiledFunctionUnwindInfo; use wasmer_types::CompiledFunctionUnwindInfo;
@ -2711,11 +2711,15 @@ impl<'a, M: Machine> FuncGen<'a, M> {
} }
} }
} }
Operator::CallIndirect { index, table_index } => { Operator::CallIndirect {
type_index,
table_index,
table_byte: _,
} => {
// TODO: removed restriction on always being table idx 0; // TODO: removed restriction on always being table idx 0;
// does any code depend on this? // does any code depend on this?
let table_index = TableIndex::new(table_index as _); let table_index = TableIndex::new(table_index as _);
let index = SignatureIndex::new(index as usize); let index = SignatureIndex::new(type_index as usize);
let sig = self.module.signatures.get(index).unwrap(); let sig = self.module.signatures.get(index).unwrap();
let param_types: SmallVec<[WpType; 8]> = let param_types: SmallVec<[WpType; 8]> =
sig.params().iter().cloned().map(type_to_wp_type).collect(); sig.params().iter().cloned().map(type_to_wp_type).collect();
@ -2936,7 +2940,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
} }
} }
} }
Operator::If { ty } => { Operator::If { blockty } => {
let label_end = self.machine.get_label(); let label_end = self.machine.get_label();
let label_else = self.machine.get_label(); let label_else = self.machine.get_label();
@ -2946,8 +2950,8 @@ impl<'a, M: Machine> FuncGen<'a, M> {
label: label_end, label: label_end,
loop_like: false, loop_like: false,
if_else: IfElseState::If(label_else), if_else: IfElseState::If(label_else),
returns: match ty { returns: match blockty {
WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Empty => smallvec![],
WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty],
_ => { _ => {
return Err(CompileError::Codegen( return Err(CompileError::Codegen(
@ -3064,13 +3068,13 @@ impl<'a, M: Machine> FuncGen<'a, M> {
} }
self.machine.emit_label(end_label)?; self.machine.emit_label(end_label)?;
} }
Operator::Block { ty } => { Operator::Block { blockty } => {
let frame = ControlFrame { let frame = ControlFrame {
label: self.machine.get_label(), label: self.machine.get_label(),
loop_like: false, loop_like: false,
if_else: IfElseState::None, if_else: IfElseState::None,
returns: match ty { returns: match blockty {
WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Empty => smallvec![],
WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty],
_ => { _ => {
return Err(CompileError::Codegen( return Err(CompileError::Codegen(
@ -3085,7 +3089,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
}; };
self.control_stack.push(frame); self.control_stack.push(frame);
} }
Operator::Loop { ty } => { Operator::Loop { blockty } => {
self.machine.align_for_loop()?; self.machine.align_for_loop()?;
let label = self.machine.get_label(); let label = self.machine.get_label();
let state_diff_id = self.get_state_diff(); let state_diff_id = self.get_state_diff();
@ -3095,8 +3099,8 @@ impl<'a, M: Machine> FuncGen<'a, M> {
label, label,
loop_like: true, loop_like: true,
if_else: IfElseState::None, if_else: IfElseState::None,
returns: match ty { returns: match blockty {
WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![], WpTypeOrFuncType::Empty => smallvec![],
WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty], WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty],
_ => { _ => {
return Err(CompileError::Codegen( return Err(CompileError::Codegen(
@ -3150,7 +3154,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
ret, ret,
)?; )?;
} }
Operator::MemoryInit { segment, mem } => { Operator::MemoryInit { data_index, mem } => {
let len = self.value_stack.pop().unwrap(); let len = self.value_stack.pop().unwrap();
let src = self.value_stack.pop().unwrap(); let src = self.value_stack.pop().unwrap();
let dst = self.value_stack.pop().unwrap(); let dst = self.value_stack.pop().unwrap();
@ -3175,10 +3179,10 @@ impl<'a, M: Machine> FuncGen<'a, M> {
this.machine this.machine
.emit_call_register(this.machine.get_grp_for_call()) .emit_call_register(this.machine.get_grp_for_call())
}, },
// [vmctx, memory_index, segment_index, dst, src, len] // [vmctx, memory_index, data_index, dst, src, len]
[ [
Location::Imm32(mem), Location::Imm32(mem),
Location::Imm32(segment), Location::Imm32(data_index),
dst, dst,
src, src,
len, len,
@ -3197,7 +3201,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
)?; )?;
self.release_locations_only_stack(&[dst, src, len])?; self.release_locations_only_stack(&[dst, src, len])?;
} }
Operator::DataDrop { segment } => { Operator::DataDrop { data_index } => {
self.machine.move_location( self.machine.move_location(
Size::S64, Size::S64,
Location::Memory( Location::Memory(
@ -3214,20 +3218,20 @@ impl<'a, M: Machine> FuncGen<'a, M> {
this.machine this.machine
.emit_call_register(this.machine.get_grp_for_call()) .emit_call_register(this.machine.get_grp_for_call())
}, },
// [vmctx, segment_index] // [vmctx, data_index]
iter::once(Location::Imm32(segment)), iter::once(Location::Imm32(data_index)),
iter::once(WpType::I64), iter::once(WpType::I64),
)?; )?;
} }
Operator::MemoryCopy { src, dst } => { Operator::MemoryCopy { dst_mem, src_mem } => {
// ignore until we support multiple memories // ignore until we support multiple memories
let _dst = dst; let _dst = dst_mem;
let len = self.value_stack.pop().unwrap(); let len = self.value_stack.pop().unwrap();
let src_pos = self.value_stack.pop().unwrap(); let src_pos = self.value_stack.pop().unwrap();
let dst_pos = self.value_stack.pop().unwrap(); let dst_pos = self.value_stack.pop().unwrap();
self.release_locations_only_regs(&[len, src_pos, dst_pos])?; self.release_locations_only_regs(&[len, src_pos, dst_pos])?;
let memory_index = MemoryIndex::new(src as usize); let memory_index = MemoryIndex::new(src_mem as usize);
let (memory_copy_index, memory_index) = let (memory_copy_index, memory_index) =
if self.module.local_memory_index(memory_index).is_some() { if self.module.local_memory_index(memory_index).is_some() {
( (
@ -4066,12 +4070,12 @@ impl<'a, M: Machine> FuncGen<'a, M> {
self.machine.emit_label(after)?; self.machine.emit_label(after)?;
} }
Operator::BrTable { ref table } => { Operator::BrTable { ref targets } => {
let targets = table let default_target = targets.default();
let targets = targets
.targets() .targets()
.collect::<Result<Vec<_>, _>>() .collect::<Result<Vec<_>, _>>()
.map_err(|e| CompileError::Codegen(format!("BrTable read_table: {:?}", e)))?; .map_err(|e| CompileError::Codegen(format!("BrTable read_table: {:?}", e)))?;
let default_target = table.default();
let cond = self.pop_value_released()?; let cond = self.pop_value_released()?;
let table_label = self.machine.get_label(); let table_label = self.machine.get_label();
let mut table: Vec<Label> = vec![]; let mut table: Vec<Label> = vec![];
@ -4237,7 +4241,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
} }
} }
} }
Operator::AtomicFence { flags: _ } => { Operator::AtomicFence => {
// Fence is a nop. // Fence is a nop.
// //
// Fence was added to preserve information about fences from // Fence was added to preserve information about fences from
@ -6346,7 +6350,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
self.release_locations_only_stack(&[dest, val, len])?; self.release_locations_only_stack(&[dest, val, len])?;
} }
Operator::TableInit { segment, table } => { Operator::TableInit { elem_index, table } => {
let len = self.value_stack.pop().unwrap(); let len = self.value_stack.pop().unwrap();
let src = self.value_stack.pop().unwrap(); let src = self.value_stack.pop().unwrap();
let dest = self.value_stack.pop().unwrap(); let dest = self.value_stack.pop().unwrap();
@ -6373,7 +6377,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
// [vmctx, table_index, elem_index, dst, src, len] // [vmctx, table_index, elem_index, dst, src, len]
[ [
Location::Imm32(table), Location::Imm32(table),
Location::Imm32(segment), Location::Imm32(elem_index),
dest, dest,
src, src,
len, len,
@ -6393,7 +6397,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
self.release_locations_only_stack(&[dest, src, len])?; self.release_locations_only_stack(&[dest, src, len])?;
} }
Operator::ElemDrop { segment } => { Operator::ElemDrop { elem_index } => {
self.machine.move_location( self.machine.move_location(
Size::S64, Size::S64,
Location::Memory( Location::Memory(
@ -6413,7 +6417,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
.emit_call_register(this.machine.get_grp_for_call()) .emit_call_register(this.machine.get_grp_for_call())
}, },
// [vmctx, elem_index] // [vmctx, elem_index]
[Location::Imm32(segment)].iter().cloned(), [Location::Imm32(elem_index)].iter().cloned(),
[WpType::I32].iter().cloned(), [WpType::I32].iter().cloned(),
)?; )?;
} }

View File

@ -6,8 +6,8 @@ use crate::unwind::UnwindInstructions;
use dynasmrt::{AssemblyOffset, DynamicLabel}; use dynasmrt::{AssemblyOffset, DynamicLabel};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fmt::Debug; use std::fmt::Debug;
pub use wasmer_compiler::wasmparser::MemoryImmediate; pub use wasmer_compiler::wasmparser::MemArg;
use wasmer_compiler::wasmparser::Type as WpType; use wasmer_compiler::wasmparser::ValType as WpType;
use wasmer_types::{ use wasmer_types::{
Architecture, CallingConvention, CompileError, CustomSection, FunctionBody, FunctionIndex, Architecture, CallingConvention, CompileError, CustomSection, FunctionBody, FunctionIndex,
FunctionType, InstructionAddressMap, Relocation, RelocationTarget, Target, TrapCode, FunctionType, InstructionAddressMap, Relocation, RelocationTarget, Target, TrapCode,
@ -663,7 +663,7 @@ pub trait Machine {
fn i32_load( fn i32_load(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -676,7 +676,7 @@ pub trait Machine {
fn i32_load_8u( fn i32_load_8u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -689,7 +689,7 @@ pub trait Machine {
fn i32_load_8s( fn i32_load_8s(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -702,7 +702,7 @@ pub trait Machine {
fn i32_load_16u( fn i32_load_16u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -715,7 +715,7 @@ pub trait Machine {
fn i32_load_16s( fn i32_load_16s(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -728,7 +728,7 @@ pub trait Machine {
fn i32_atomic_load( fn i32_atomic_load(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -741,7 +741,7 @@ pub trait Machine {
fn i32_atomic_load_8u( fn i32_atomic_load_8u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -754,7 +754,7 @@ pub trait Machine {
fn i32_atomic_load_16u( fn i32_atomic_load_16u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -767,7 +767,7 @@ pub trait Machine {
fn i32_save( fn i32_save(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -780,7 +780,7 @@ pub trait Machine {
fn i32_save_8( fn i32_save_8(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -793,7 +793,7 @@ pub trait Machine {
fn i32_save_16( fn i32_save_16(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -806,7 +806,7 @@ pub trait Machine {
fn i32_atomic_save( fn i32_atomic_save(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -819,7 +819,7 @@ pub trait Machine {
fn i32_atomic_save_8( fn i32_atomic_save_8(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -832,7 +832,7 @@ pub trait Machine {
fn i32_atomic_save_16( fn i32_atomic_save_16(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -846,7 +846,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -860,7 +860,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -874,7 +874,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -888,7 +888,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -902,7 +902,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -916,7 +916,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -930,7 +930,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -944,7 +944,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -958,7 +958,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -972,7 +972,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -986,7 +986,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1000,7 +1000,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1014,7 +1014,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1028,7 +1028,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1042,7 +1042,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1056,7 +1056,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1070,7 +1070,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1084,7 +1084,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1099,7 +1099,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1114,7 +1114,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1129,7 +1129,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1350,7 +1350,7 @@ pub trait Machine {
fn i64_load( fn i64_load(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1363,7 +1363,7 @@ pub trait Machine {
fn i64_load_8u( fn i64_load_8u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1376,7 +1376,7 @@ pub trait Machine {
fn i64_load_8s( fn i64_load_8s(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1389,7 +1389,7 @@ pub trait Machine {
fn i64_load_32u( fn i64_load_32u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1402,7 +1402,7 @@ pub trait Machine {
fn i64_load_32s( fn i64_load_32s(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1415,7 +1415,7 @@ pub trait Machine {
fn i64_load_16u( fn i64_load_16u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1428,7 +1428,7 @@ pub trait Machine {
fn i64_load_16s( fn i64_load_16s(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1441,7 +1441,7 @@ pub trait Machine {
fn i64_atomic_load( fn i64_atomic_load(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1454,7 +1454,7 @@ pub trait Machine {
fn i64_atomic_load_8u( fn i64_atomic_load_8u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1467,7 +1467,7 @@ pub trait Machine {
fn i64_atomic_load_16u( fn i64_atomic_load_16u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1480,7 +1480,7 @@ pub trait Machine {
fn i64_atomic_load_32u( fn i64_atomic_load_32u(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1493,7 +1493,7 @@ pub trait Machine {
fn i64_save( fn i64_save(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1506,7 +1506,7 @@ pub trait Machine {
fn i64_save_8( fn i64_save_8(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1519,7 +1519,7 @@ pub trait Machine {
fn i64_save_16( fn i64_save_16(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1532,7 +1532,7 @@ pub trait Machine {
fn i64_save_32( fn i64_save_32(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1545,7 +1545,7 @@ pub trait Machine {
fn i64_atomic_save( fn i64_atomic_save(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1558,7 +1558,7 @@ pub trait Machine {
fn i64_atomic_save_8( fn i64_atomic_save_8(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1571,7 +1571,7 @@ pub trait Machine {
fn i64_atomic_save_16( fn i64_atomic_save_16(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1584,7 +1584,7 @@ pub trait Machine {
fn i64_atomic_save_32( fn i64_atomic_save_32(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1598,7 +1598,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1612,7 +1612,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1626,7 +1626,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1640,7 +1640,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1654,7 +1654,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1668,7 +1668,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1682,7 +1682,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1696,7 +1696,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1710,7 +1710,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1724,7 +1724,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1738,7 +1738,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1752,7 +1752,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1766,7 +1766,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1780,7 +1780,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1794,7 +1794,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1808,7 +1808,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1822,7 +1822,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1836,7 +1836,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1850,7 +1850,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1864,7 +1864,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1878,7 +1878,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1892,7 +1892,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1906,7 +1906,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1920,7 +1920,7 @@ pub trait Machine {
&mut self, &mut self,
loc: Location<Self::GPR, Self::SIMD>, loc: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1935,7 +1935,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1950,7 +1950,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1965,7 +1965,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1980,7 +1980,7 @@ pub trait Machine {
new: Location<Self::GPR, Self::SIMD>, new: Location<Self::GPR, Self::SIMD>,
cmp: Location<Self::GPR, Self::SIMD>, cmp: Location<Self::GPR, Self::SIMD>,
target: Location<Self::GPR, Self::SIMD>, target: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -1994,7 +1994,7 @@ pub trait Machine {
fn f32_load( fn f32_load(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -2007,7 +2007,7 @@ pub trait Machine {
fn f32_save( fn f32_save(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
canonicalize: bool, canonicalize: bool,
need_check: bool, need_check: bool,
@ -2021,7 +2021,7 @@ pub trait Machine {
fn f64_load( fn f64_load(
&mut self, &mut self,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location<Self::GPR, Self::SIMD>, ret: Location<Self::GPR, Self::SIMD>,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -2034,7 +2034,7 @@ pub trait Machine {
fn f64_save( fn f64_save(
&mut self, &mut self,
value: Location<Self::GPR, Self::SIMD>, value: Location<Self::GPR, Self::SIMD>,
memarg: &MemoryImmediate, memarg: &MemArg,
addr: Location<Self::GPR, Self::SIMD>, addr: Location<Self::GPR, Self::SIMD>,
canonicalize: bool, canonicalize: bool,
need_check: bool, need_check: bool,

View File

@ -10,7 +10,7 @@ use crate::unwind::{UnwindInstructions, UnwindOps};
use dynasmrt::{aarch64::Aarch64Relocation, VecAssembler}; use dynasmrt::{aarch64::Aarch64Relocation, VecAssembler};
#[cfg(feature = "unwind")] #[cfg(feature = "unwind")]
use gimli::{write::CallFrameInstruction, AArch64}; use gimli::{write::CallFrameInstruction, AArch64};
use wasmer_compiler::wasmparser::Type as WpType; use wasmer_compiler::wasmparser::ValType as WpType;
use wasmer_types::{ use wasmer_types::{
CallingConvention, CompileError, CustomSection, FunctionBody, FunctionIndex, FunctionType, CallingConvention, CompileError, CustomSection, FunctionBody, FunctionIndex, FunctionType,
InstructionAddressMap, Relocation, RelocationKind, RelocationTarget, SourceLoc, TrapCode, InstructionAddressMap, Relocation, RelocationKind, RelocationTarget, SourceLoc, TrapCode,
@ -960,7 +960,7 @@ impl MachineARM64 {
fn memory_op<F: FnOnce(&mut Self, GPR) -> Result<(), CompileError>>( fn memory_op<F: FnOnce(&mut Self, GPR) -> Result<(), CompileError>>(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
check_alignment: bool, check_alignment: bool,
value_size: usize, value_size: usize,
need_check: bool, need_check: bool,
@ -1120,7 +1120,7 @@ impl MachineARM64 {
_loc: Location, _loc: Location,
_target: Location, _target: Location,
_ret: Location, _ret: Location,
_memarg: &MemoryImmediate, _memarg: &MemArg,
_value_size: usize, _value_size: usize,
_memory_sz: Size, _memory_sz: Size,
_stack_sz: Size, _stack_sz: Size,
@ -3183,7 +3183,7 @@ impl Machine for MachineARM64 {
fn i32_load( fn i32_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3207,7 +3207,7 @@ impl Machine for MachineARM64 {
fn i32_load_8u( fn i32_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3231,7 +3231,7 @@ impl Machine for MachineARM64 {
fn i32_load_8s( fn i32_load_8s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3255,7 +3255,7 @@ impl Machine for MachineARM64 {
fn i32_load_16u( fn i32_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3279,7 +3279,7 @@ impl Machine for MachineARM64 {
fn i32_load_16s( fn i32_load_16s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3303,7 +3303,7 @@ impl Machine for MachineARM64 {
fn i32_atomic_load( fn i32_atomic_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3327,7 +3327,7 @@ impl Machine for MachineARM64 {
fn i32_atomic_load_8u( fn i32_atomic_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3351,7 +3351,7 @@ impl Machine for MachineARM64 {
fn i32_atomic_load_16u( fn i32_atomic_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3375,7 +3375,7 @@ impl Machine for MachineARM64 {
fn i32_save( fn i32_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3399,7 +3399,7 @@ impl Machine for MachineARM64 {
fn i32_save_8( fn i32_save_8(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3423,7 +3423,7 @@ impl Machine for MachineARM64 {
fn i32_save_16( fn i32_save_16(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3447,7 +3447,7 @@ impl Machine for MachineARM64 {
fn i32_atomic_save( fn i32_atomic_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3472,7 +3472,7 @@ impl Machine for MachineARM64 {
fn i32_atomic_save_8( fn i32_atomic_save_8(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3497,7 +3497,7 @@ impl Machine for MachineARM64 {
fn i32_atomic_save_16( fn i32_atomic_save_16(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3524,7 +3524,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3583,7 +3583,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3642,7 +3642,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3701,7 +3701,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3760,7 +3760,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3819,7 +3819,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3878,7 +3878,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3937,7 +3937,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3996,7 +3996,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4055,7 +4055,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4114,7 +4114,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4173,7 +4173,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4232,7 +4232,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4291,7 +4291,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4350,7 +4350,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4409,7 +4409,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4466,7 +4466,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4523,7 +4523,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4581,7 +4581,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4643,7 +4643,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4705,7 +4705,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5258,7 +5258,7 @@ impl Machine for MachineARM64 {
fn i64_load( fn i64_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5282,7 +5282,7 @@ impl Machine for MachineARM64 {
fn i64_load_8u( fn i64_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5306,7 +5306,7 @@ impl Machine for MachineARM64 {
fn i64_load_8s( fn i64_load_8s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5330,7 +5330,7 @@ impl Machine for MachineARM64 {
fn i64_load_16u( fn i64_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5354,7 +5354,7 @@ impl Machine for MachineARM64 {
fn i64_load_16s( fn i64_load_16s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5378,7 +5378,7 @@ impl Machine for MachineARM64 {
fn i64_load_32u( fn i64_load_32u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5402,7 +5402,7 @@ impl Machine for MachineARM64 {
fn i64_load_32s( fn i64_load_32s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5426,7 +5426,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_load( fn i64_atomic_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5450,7 +5450,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_load_8u( fn i64_atomic_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5474,7 +5474,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_load_16u( fn i64_atomic_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5498,7 +5498,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_load_32u( fn i64_atomic_load_32u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5522,7 +5522,7 @@ impl Machine for MachineARM64 {
fn i64_save( fn i64_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5546,7 +5546,7 @@ impl Machine for MachineARM64 {
fn i64_save_8( fn i64_save_8(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5570,7 +5570,7 @@ impl Machine for MachineARM64 {
fn i64_save_16( fn i64_save_16(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5594,7 +5594,7 @@ impl Machine for MachineARM64 {
fn i64_save_32( fn i64_save_32(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5618,7 +5618,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_save( fn i64_atomic_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5643,7 +5643,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_save_8( fn i64_atomic_save_8(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5668,7 +5668,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_save_16( fn i64_atomic_save_16(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5693,7 +5693,7 @@ impl Machine for MachineARM64 {
fn i64_atomic_save_32( fn i64_atomic_save_32(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5720,7 +5720,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5779,7 +5779,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5838,7 +5838,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5897,7 +5897,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5956,7 +5956,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6015,7 +6015,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6074,7 +6074,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6133,7 +6133,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6192,7 +6192,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6251,7 +6251,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6310,7 +6310,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6369,7 +6369,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6428,7 +6428,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6487,7 +6487,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6546,7 +6546,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6605,7 +6605,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6664,7 +6664,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6723,7 +6723,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6782,7 +6782,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6841,7 +6841,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6900,7 +6900,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6957,7 +6957,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7014,7 +7014,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7071,7 +7071,7 @@ impl Machine for MachineARM64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7129,7 +7129,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7191,7 +7191,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7253,7 +7253,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7315,7 +7315,7 @@ impl Machine for MachineARM64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7375,7 +7375,7 @@ impl Machine for MachineARM64 {
fn f32_load( fn f32_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7399,7 +7399,7 @@ impl Machine for MachineARM64 {
fn f32_save( fn f32_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
canonicalize: bool, canonicalize: bool,
need_check: bool, need_check: bool,
@ -7431,7 +7431,7 @@ impl Machine for MachineARM64 {
fn f64_load( fn f64_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -7455,7 +7455,7 @@ impl Machine for MachineARM64 {
fn f64_save( fn f64_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
canonicalize: bool, canonicalize: bool,
need_check: bool, need_check: bool,

View File

@ -13,7 +13,7 @@ use dynasmrt::{x64::X64Relocation, DynasmError, VecAssembler};
#[cfg(feature = "unwind")] #[cfg(feature = "unwind")]
use gimli::{write::CallFrameInstruction, X86_64}; use gimli::{write::CallFrameInstruction, X86_64};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use wasmer_compiler::wasmparser::Type as WpType; use wasmer_compiler::wasmparser::ValType as WpType;
use wasmer_types::{ use wasmer_types::{
CallingConvention, CompileError, CpuFeature, CustomSection, CustomSectionProtection, CallingConvention, CompileError, CpuFeature, CustomSection, CustomSectionProtection,
Relocation, RelocationKind, RelocationTarget, SectionBody, Target, Relocation, RelocationKind, RelocationTarget, SectionBody, Target,
@ -485,7 +485,7 @@ impl MachineX86_64 {
fn memory_op<F: FnOnce(&mut Self, GPR) -> Result<(), CompileError>>( fn memory_op<F: FnOnce(&mut Self, GPR) -> Result<(), CompileError>>(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
check_alignment: bool, check_alignment: bool,
value_size: usize, value_size: usize,
need_check: bool, need_check: bool,
@ -625,7 +625,7 @@ impl MachineX86_64 {
loc: Location, loc: Location,
target: Location, target: Location,
ret: Location, ret: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
value_size: usize, value_size: usize,
memory_sz: Size, memory_sz: Size,
stack_sz: Size, stack_sz: Size,
@ -3309,7 +3309,7 @@ impl Machine for MachineX86_64 {
fn i32_load( fn i32_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3340,7 +3340,7 @@ impl Machine for MachineX86_64 {
fn i32_load_8u( fn i32_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3372,7 +3372,7 @@ impl Machine for MachineX86_64 {
fn i32_load_8s( fn i32_load_8s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3404,7 +3404,7 @@ impl Machine for MachineX86_64 {
fn i32_load_16u( fn i32_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3436,7 +3436,7 @@ impl Machine for MachineX86_64 {
fn i32_load_16s( fn i32_load_16s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3468,7 +3468,7 @@ impl Machine for MachineX86_64 {
fn i32_atomic_load( fn i32_atomic_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3492,7 +3492,7 @@ impl Machine for MachineX86_64 {
fn i32_atomic_load_8u( fn i32_atomic_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3523,7 +3523,7 @@ impl Machine for MachineX86_64 {
fn i32_atomic_load_16u( fn i32_atomic_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3554,7 +3554,7 @@ impl Machine for MachineX86_64 {
fn i32_save( fn i32_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3585,7 +3585,7 @@ impl Machine for MachineX86_64 {
fn i32_save_8( fn i32_save_8(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3616,7 +3616,7 @@ impl Machine for MachineX86_64 {
fn i32_save_16( fn i32_save_16(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3650,7 +3650,7 @@ impl Machine for MachineX86_64 {
fn i32_atomic_save( fn i32_atomic_save(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3681,7 +3681,7 @@ impl Machine for MachineX86_64 {
fn i32_atomic_save_8( fn i32_atomic_save_8(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3712,7 +3712,7 @@ impl Machine for MachineX86_64 {
fn i32_atomic_save_16( fn i32_atomic_save_16(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3745,7 +3745,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3784,7 +3784,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3823,7 +3823,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3862,7 +3862,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3901,7 +3901,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3940,7 +3940,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -3979,7 +3979,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4011,7 +4011,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4043,7 +4043,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4075,7 +4075,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4107,7 +4107,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4139,7 +4139,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4171,7 +4171,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4203,7 +4203,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4235,7 +4235,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4267,7 +4267,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4303,7 +4303,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4340,7 +4340,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4378,7 +4378,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4432,7 +4432,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4486,7 +4486,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -4978,7 +4978,7 @@ impl Machine for MachineX86_64 {
fn i64_load( fn i64_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5009,7 +5009,7 @@ impl Machine for MachineX86_64 {
fn i64_load_8u( fn i64_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5041,7 +5041,7 @@ impl Machine for MachineX86_64 {
fn i64_load_8s( fn i64_load_8s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5073,7 +5073,7 @@ impl Machine for MachineX86_64 {
fn i64_load_16u( fn i64_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5105,7 +5105,7 @@ impl Machine for MachineX86_64 {
fn i64_load_16s( fn i64_load_16s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5137,7 +5137,7 @@ impl Machine for MachineX86_64 {
fn i64_load_32u( fn i64_load_32u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5181,7 +5181,7 @@ impl Machine for MachineX86_64 {
fn i64_load_32s( fn i64_load_32s(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5213,7 +5213,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_load( fn i64_atomic_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5237,7 +5237,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_load_8u( fn i64_atomic_load_8u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5268,7 +5268,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_load_16u( fn i64_atomic_load_16u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5299,7 +5299,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_load_32u( fn i64_atomic_load_32u(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5343,7 +5343,7 @@ impl Machine for MachineX86_64 {
fn i64_save( fn i64_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5374,7 +5374,7 @@ impl Machine for MachineX86_64 {
fn i64_save_8( fn i64_save_8(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5405,7 +5405,7 @@ impl Machine for MachineX86_64 {
fn i64_save_16( fn i64_save_16(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5436,7 +5436,7 @@ impl Machine for MachineX86_64 {
fn i64_save_32( fn i64_save_32(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5467,7 +5467,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_save( fn i64_atomic_save(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5491,7 +5491,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_save_8( fn i64_atomic_save_8(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5515,7 +5515,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_save_16( fn i64_atomic_save_16(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5539,7 +5539,7 @@ impl Machine for MachineX86_64 {
fn i64_atomic_save_32( fn i64_atomic_save_32(
&mut self, &mut self,
value: Location, value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5565,7 +5565,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5604,7 +5604,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5643,7 +5643,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5682,7 +5682,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5721,7 +5721,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5760,7 +5760,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5799,7 +5799,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5838,7 +5838,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5877,7 +5877,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5909,7 +5909,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5941,7 +5941,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -5973,7 +5973,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6005,7 +6005,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6036,7 +6036,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6067,7 +6067,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6098,7 +6098,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6129,7 +6129,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6160,7 +6160,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6191,7 +6191,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6222,7 +6222,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6253,7 +6253,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6289,7 +6289,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6326,7 +6326,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6363,7 +6363,7 @@ impl Machine for MachineX86_64 {
&mut self, &mut self,
loc: Location, loc: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6401,7 +6401,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6455,7 +6455,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6509,7 +6509,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6563,7 +6563,7 @@ impl Machine for MachineX86_64 {
new: Location, new: Location,
cmp: Location, cmp: Location,
target: Location, target: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6615,7 +6615,7 @@ impl Machine for MachineX86_64 {
fn f32_load( fn f32_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6646,7 +6646,7 @@ impl Machine for MachineX86_64 {
fn f32_save( fn f32_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
canonicalize: bool, canonicalize: bool,
need_check: bool, need_check: bool,
@ -6683,7 +6683,7 @@ impl Machine for MachineX86_64 {
fn f64_load( fn f64_load(
&mut self, &mut self,
addr: Location, addr: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
ret: Location, ret: Location,
need_check: bool, need_check: bool,
imported_memories: bool, imported_memories: bool,
@ -6714,7 +6714,7 @@ impl Machine for MachineX86_64 {
fn f64_save( fn f64_save(
&mut self, &mut self,
target_value: Location, target_value: Location,
memarg: &MemoryImmediate, memarg: &MemArg,
target_addr: Location, target_addr: Location,
canonicalize: bool, canonicalize: bool,
need_check: bool, need_check: bool,

View File

@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
wasmer-types = { path = "../types", version = "=3.2.0-alpha.1", default-features = false } wasmer-types = { path = "../types", version = "=3.2.0-alpha.1", default-features = false }
wasmer-object = { path = "../object", version = "=3.2.0-alpha.1", optional = true } wasmer-object = { path = "../object", version = "=3.2.0-alpha.1", optional = true }
wasmparser = { version = "0.83", optional = true, default-features = false } wasmparser = { version = "0.95", optional = true, default-features = false }
enumset = "1.0.2" enumset = "1.0.2"
hashbrown = { version = "0.11", optional = true } hashbrown = { version = "0.11", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true } serde = { version = "1.0", features = ["derive"], optional = true }

View File

@ -92,7 +92,6 @@ pub trait Compiler: Send {
features: &Features, features: &Features,
data: &'data [u8], data: &'data [u8],
) -> Result<(), CompileError> { ) -> Result<(), CompileError> {
let mut validator = Validator::new();
let wasm_features = WasmFeatures { let wasm_features = WasmFeatures {
bulk_memory: features.bulk_memory, bulk_memory: features.bulk_memory,
threads: features.threads, threads: features.threads,
@ -100,7 +99,6 @@ pub trait Compiler: Send {
multi_value: features.multi_value, multi_value: features.multi_value,
simd: features.simd, simd: features.simd,
tail_call: features.tail_call, tail_call: features.tail_call,
module_linking: features.module_linking,
multi_memory: features.multi_memory, multi_memory: features.multi_memory,
memory64: features.memory64, memory64: features.memory64,
exceptions: features.exceptions, exceptions: features.exceptions,
@ -110,8 +108,9 @@ pub trait Compiler: Send {
mutable_global: true, mutable_global: true,
saturating_float_to_int: true, saturating_float_to_int: true,
sign_extension: true, sign_extension: true,
component_model: false,
}; };
validator.wasm_features(wasm_features); let mut validator = Validator::new_with_features(wasm_features);
validator validator
.validate_all(data) .validate_all(data)
.map_err(|e| CompileError::Validate(format!("{}", e)))?; .map_err(|e| CompileError::Validate(format!("{}", e)))?;

View File

@ -4,8 +4,9 @@ use super::state::ModuleTranslationState;
use crate::lib::std::string::ToString; use crate::lib::std::string::ToString;
use crate::lib::std::{boxed::Box, string::String, vec::Vec}; use crate::lib::std::{boxed::Box, string::String, vec::Vec};
use crate::translate_module; use crate::translate_module;
use crate::wasmparser::{Operator, Range, Type}; use crate::wasmparser::{Operator, ValType};
use std::convert::{TryFrom, TryInto}; use std::convert::{TryFrom, TryInto};
use std::ops::Range;
use wasmer_types::entity::PrimaryMap; use wasmer_types::entity::PrimaryMap;
use wasmer_types::FunctionType; use wasmer_types::FunctionType;
use wasmer_types::WasmResult; use wasmer_types::WasmResult;
@ -32,7 +33,7 @@ pub trait FunctionBinaryReader<'a> {
fn read_local_count(&mut self) -> WasmResult<u32>; fn read_local_count(&mut self) -> WasmResult<u32>;
/// Read a `(count, value_type)` declaration of local variables of the same type. /// Read a `(count, value_type)` declaration of local variables of the same type.
fn read_local_decl(&mut self) -> WasmResult<(u32, Type)>; fn read_local_decl(&mut self) -> WasmResult<(u32, ValType)>;
/// Reads the next available `Operator`. /// Reads the next available `Operator`.
fn read_operator(&mut self) -> WasmResult<Operator<'a>>; fn read_operator(&mut self) -> WasmResult<Operator<'a>>;
@ -50,7 +51,7 @@ pub trait FunctionBinaryReader<'a> {
fn eof(&self) -> bool; fn eof(&self) -> bool;
/// Return the range (original offset, original offset + data length) /// Return the range (original offset, original offset + data length)
fn range(&self) -> Range; fn range(&self) -> Range<usize>;
} }
/// The result of translating via `ModuleEnvironment`. Function bodies are not /// The result of translating via `ModuleEnvironment`. Function bodies are not

View File

@ -34,7 +34,7 @@ mod tests {
let binary_reader_error = reader.read_bytes(10).unwrap_err(); let binary_reader_error = reader.read_bytes(10).unwrap_err();
match from_binaryreadererror_wasmerror(binary_reader_error) { match from_binaryreadererror_wasmerror(binary_reader_error) {
WasmError::InvalidWebAssembly { message, offset } => { WasmError::InvalidWebAssembly { message, offset } => {
assert_eq!(message, "Unexpected EOF"); assert_eq!(message, "unexpected end-of-file");
assert_eq!(offset, 0); assert_eq!(offset, 0);
} }
err => panic!("Unexpected error: {:?}", err), err => panic!("Unexpected error: {:?}", err),
@ -47,7 +47,7 @@ mod tests {
let binary_reader_error = reader.read_bytes(10).unwrap_err(); let binary_reader_error = reader.read_bytes(10).unwrap_err();
match from_binaryreadererror_compileerror(binary_reader_error) { match from_binaryreadererror_compileerror(binary_reader_error) {
CompileError::Wasm(WasmError::InvalidWebAssembly { message, offset }) => { CompileError::Wasm(WasmError::InvalidWebAssembly { message, offset }) => {
assert_eq!(message, "Unexpected EOF"); assert_eq!(message, "unexpected end-of-file");
assert_eq!(offset, 0); assert_eq!(offset, 0);
} }
err => panic!("Unexpected error: {:?}", err), err => panic!("Unexpected error: {:?}", err),

View File

@ -4,9 +4,9 @@
use smallvec::SmallVec; use smallvec::SmallVec;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::fmt::Debug; use std::fmt::Debug;
use std::ops::Deref; use std::ops::{Deref, Range};
use wasmer_types::{LocalFunctionIndex, MiddlewareError, ModuleInfo, WasmResult}; use wasmer_types::{LocalFunctionIndex, MiddlewareError, ModuleInfo, WasmResult};
use wasmparser::{BinaryReader, Operator, Range, Type}; use wasmparser::{BinaryReader, Operator, ValType};
use super::error::from_binaryreadererror_wasmerror; use super::error::from_binaryreadererror_wasmerror;
use crate::translator::environ::FunctionBinaryReader; use crate::translator::environ::FunctionBinaryReader;
@ -137,16 +137,16 @@ impl<'a> FunctionBinaryReader<'a> for MiddlewareBinaryReader<'a> {
.map_err(from_binaryreadererror_wasmerror) .map_err(from_binaryreadererror_wasmerror)
} }
fn read_local_decl(&mut self) -> WasmResult<(u32, Type)> { fn read_local_decl(&mut self) -> WasmResult<(u32, ValType)> {
let count = self let count = self
.state .state
.inner .inner
.read_var_u32() .read_var_u32()
.map_err(from_binaryreadererror_wasmerror)?; .map_err(from_binaryreadererror_wasmerror)?;
let ty = self let ty: ValType = self
.state .state
.inner .inner
.read_type() .read_val_type()
.map_err(from_binaryreadererror_wasmerror)?; .map_err(from_binaryreadererror_wasmerror)?;
Ok((count, ty)) Ok((count, ty))
} }
@ -204,7 +204,7 @@ impl<'a> FunctionBinaryReader<'a> for MiddlewareBinaryReader<'a> {
self.state.inner.eof() self.state.inner.eof()
} }
fn range(&self) -> Range { fn range(&self) -> Range<usize> {
self.state.inner.range() self.state.inner.range()
} }
} }

View File

@ -24,7 +24,7 @@ pub fn translate_module<'data>(
for payload in Parser::new(0).parse_all(data) { for payload in Parser::new(0).parse_all(data) {
match payload.map_err(from_binaryreadererror_wasmerror)? { match payload.map_err(from_binaryreadererror_wasmerror)? {
Payload::Version { .. } | Payload::End => {} Payload::Version { .. } | Payload::End { .. } => {}
Payload::TypeSection(types) => { Payload::TypeSection(types) => {
parse_type_section(types, &mut module_translation_state, environ)?; parse_type_section(types, &mut module_translation_state, environ)?;
@ -84,33 +84,36 @@ pub fn translate_module<'data>(
} }
Payload::InstanceSection(_) Payload::InstanceSection(_)
| Payload::AliasSection(_) | Payload::ComponentSection { .. }
| Payload::ModuleSectionStart { .. } | Payload::CoreTypeSection(_)
| Payload::ModuleSectionEntry { .. } => { | Payload::ComponentTypeSection(_)
unimplemented!("module linking not implemented yet") | Payload::ComponentInstanceSection(_)
| Payload::ComponentAliasSection(_)
| Payload::ComponentCanonicalSection(_)
| Payload::ComponentStartSection { .. }
| Payload::ComponentImportSection(_)
| Payload::ComponentExportSection(_)
| Payload::ModuleSection { .. } => {
unimplemented!("module linking not implemented. It will only be implemented if/when browsers support it")
} }
Payload::TagSection(_) => { Payload::TagSection(_) => {
unimplemented!("exception handling not implemented yet") unimplemented!("exception handling not implemented yet")
} }
Payload::CustomSection { Payload::CustomSection(sectionreader) => {
name: "name",
data,
data_offset,
..
} => {
// We still add the custom section data, but also read it as name section reader // We still add the custom section data, but also read it as name section reader
environ.custom_section("name", data)?; let name = sectionreader.name();
parse_name_section( environ.custom_section(name, sectionreader.data())?;
NameSectionReader::new(data, data_offset) if name == "name" {
.map_err(from_binaryreadererror_wasmerror)?, parse_name_section(
environ, NameSectionReader::new(sectionreader.data(), sectionreader.data_offset())
)? .map_err(from_binaryreadererror_wasmerror)?,
environ,
)?;
}
} }
Payload::CustomSection { name, data, .. } => environ.custom_section(name, data)?,
Payload::UnknownSection { .. } => unreachable!(), Payload::UnknownSection { .. } => unreachable!(),
} }
} }

View File

@ -16,7 +16,6 @@ use super::state::ModuleTranslationState;
use crate::wasm_unsupported; use crate::wasm_unsupported;
use core::convert::TryFrom; use core::convert::TryFrom;
use std::boxed::Box; use std::boxed::Box;
use std::collections::HashMap;
use std::vec::Vec; use std::vec::Vec;
use wasmer_types::entity::packed_option::ReservedValue; use wasmer_types::entity::packed_option::ReservedValue;
use wasmer_types::entity::EntityRef; use wasmer_types::entity::EntityRef;
@ -27,26 +26,22 @@ use wasmer_types::{
use wasmer_types::{WasmError, WasmResult}; use wasmer_types::{WasmError, WasmResult};
use wasmparser::{ use wasmparser::{
self, Data, DataKind, DataSectionReader, Element, ElementItem, ElementItems, ElementKind, self, Data, DataKind, DataSectionReader, Element, ElementItem, ElementItems, ElementKind,
ElementSectionReader, Export, ExportSectionReader, ExternalKind, FuncType as WPFunctionType, ElementSectionReader, Export, ExportSectionReader, ExternalKind, FunctionSectionReader,
FunctionSectionReader, GlobalSectionReader, GlobalType as WPGlobalType, ImportSectionEntryType, GlobalSectionReader, GlobalType as WPGlobalType, ImportSectionReader, MemorySectionReader,
ImportSectionReader, MemorySectionReader, MemoryType as WPMemoryType, NameSectionReader, MemoryType as WPMemoryType, NameSectionReader, Operator, TableSectionReader, TypeRef,
Naming, NamingReader, Operator, TableSectionReader, TypeDef, TypeSectionReader, TypeSectionReader,
}; };
/// Helper function translating wasmparser types to Wasm Type. /// Helper function translating wasmparser types to Wasm Type.
pub fn wptype_to_type(ty: wasmparser::Type) -> WasmResult<Type> { pub fn wptype_to_type(ty: wasmparser::ValType) -> WasmResult<Type> {
match ty { match ty {
wasmparser::Type::I32 => Ok(Type::I32), wasmparser::ValType::I32 => Ok(Type::I32),
wasmparser::Type::I64 => Ok(Type::I64), wasmparser::ValType::I64 => Ok(Type::I64),
wasmparser::Type::F32 => Ok(Type::F32), wasmparser::ValType::F32 => Ok(Type::F32),
wasmparser::Type::F64 => Ok(Type::F64), wasmparser::ValType::F64 => Ok(Type::F64),
wasmparser::Type::V128 => Ok(Type::V128), wasmparser::ValType::V128 => Ok(Type::V128),
wasmparser::Type::ExternRef => Ok(Type::ExternRef), wasmparser::ValType::ExternRef => Ok(Type::ExternRef),
wasmparser::Type::FuncRef => Ok(Type::FuncRef), wasmparser::ValType::FuncRef => Ok(Type::FuncRef),
ty => Err(wasm_unsupported!(
"wptype_to_type: wasmparser type {:?}",
ty
)),
} }
} }
@ -60,7 +55,9 @@ pub fn parse_type_section(
environ.reserve_signatures(count)?; environ.reserve_signatures(count)?;
for entry in types { for entry in types {
if let Ok(TypeDef::Func(WPFunctionType { params, returns })) = entry { if let Ok(wasmparser::Type::Func(functype)) = entry {
let params = functype.params();
let returns = functype.results();
let sig_params: Box<[Type]> = params let sig_params: Box<[Type]> = params
.iter() .iter()
.map(|ty| { .map(|ty| {
@ -77,7 +74,9 @@ pub fn parse_type_section(
.collect(); .collect();
let sig = FunctionType::new(sig_params, sig_returns); let sig = FunctionType::new(sig_params, sig_returns);
environ.declare_signature(sig)?; environ.declare_signature(sig)?;
module_translation_state.wasm_types.push((params, returns)); module_translation_state
.wasm_types
.push((params.to_vec().into(), returns.to_vec().into()));
} else { } else {
unimplemented!("module linking not implemented yet") unimplemented!("module linking not implemented yet")
} }
@ -96,23 +95,20 @@ pub fn parse_import_section<'data>(
for entry in imports { for entry in imports {
let import = entry.map_err(from_binaryreadererror_wasmerror)?; let import = entry.map_err(from_binaryreadererror_wasmerror)?;
let module_name = import.module; let module_name = import.module;
let field_name = import.field; let field_name = import.name;
match import.ty { match import.ty {
ImportSectionEntryType::Function(sig) => { TypeRef::Func(sig) => {
environ.declare_func_import( environ.declare_func_import(
SignatureIndex::from_u32(sig), SignatureIndex::from_u32(sig),
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
ImportSectionEntryType::Module(_) | ImportSectionEntryType::Instance(_) => { TypeRef::Tag(_) => {
unimplemented!("module linking not implemented yet")
}
ImportSectionEntryType::Tag(_) => {
unimplemented!("exception handling not implemented yet") unimplemented!("exception handling not implemented yet")
} }
ImportSectionEntryType::Memory(WPMemoryType { TypeRef::Memory(WPMemoryType {
shared, shared,
memory64, memory64,
initial, initial,
@ -128,20 +124,20 @@ pub fn parse_import_section<'data>(
shared, shared,
}, },
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
ImportSectionEntryType::Global(ref ty) => { TypeRef::Global(ref ty) => {
environ.declare_global_import( environ.declare_global_import(
GlobalType { GlobalType {
ty: wptype_to_type(ty.content_type).unwrap(), ty: wptype_to_type(ty.content_type).unwrap(),
mutability: ty.mutable.into(), mutability: ty.mutable.into(),
}, },
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
ImportSectionEntryType::Table(ref tab) => { TypeRef::Table(ref tab) => {
environ.declare_table_import( environ.declare_table_import(
TableType { TableType {
ty: wptype_to_type(tab.element_type).unwrap(), ty: wptype_to_type(tab.element_type).unwrap(),
@ -149,7 +145,7 @@ pub fn parse_import_section<'data>(
maximum: tab.maximum, maximum: tab.maximum,
}, },
module_name, module_name,
field_name.unwrap_or_default(), field_name,
)?; )?;
} }
} }
@ -284,7 +280,7 @@ pub fn parse_export_section<'data>(
for entry in exports { for entry in exports {
let Export { let Export {
field, name: field,
ref kind, ref kind,
index, index,
} = entry.map_err(from_binaryreadererror_wasmerror)?; } = entry.map_err(from_binaryreadererror_wasmerror)?;
@ -294,9 +290,7 @@ pub fn parse_export_section<'data>(
// becomes a concern here. // becomes a concern here.
let index = index as usize; let index = index as usize;
match *kind { match *kind {
ExternalKind::Function => { ExternalKind::Func => environ.declare_func_export(FunctionIndex::new(index), field)?,
environ.declare_func_export(FunctionIndex::new(index), field)?
}
ExternalKind::Table => environ.declare_table_export(TableIndex::new(index), field)?, ExternalKind::Table => environ.declare_table_export(TableIndex::new(index), field)?,
ExternalKind::Memory => { ExternalKind::Memory => {
environ.declare_memory_export(MemoryIndex::new(index), field)? environ.declare_memory_export(MemoryIndex::new(index), field)?
@ -304,9 +298,6 @@ pub fn parse_export_section<'data>(
ExternalKind::Global => { ExternalKind::Global => {
environ.declare_global_export(GlobalIndex::new(index), field)? environ.declare_global_export(GlobalIndex::new(index), field)?
} }
ExternalKind::Type | ExternalKind::Module | ExternalKind::Instance => {
unimplemented!("module linking not implemented yet")
}
ExternalKind::Tag => { ExternalKind::Tag => {
unimplemented!("exception handling not implemented yet") unimplemented!("exception handling not implemented yet")
} }
@ -365,7 +356,7 @@ pub fn parse_element_section<'data>(
ty, ty,
range: _, range: _,
} = entry.map_err(from_binaryreadererror_wasmerror)?; } = entry.map_err(from_binaryreadererror_wasmerror)?;
if ty != wasmparser::Type::FuncRef { if ty != wasmparser::ValType::FuncRef {
return Err(wasm_unsupported!( return Err(wasm_unsupported!(
"unsupported table element type: {:?}", "unsupported table element type: {:?}",
ty ty
@ -375,9 +366,9 @@ pub fn parse_element_section<'data>(
match kind { match kind {
ElementKind::Active { ElementKind::Active {
table_index, table_index,
init_expr, offset_expr,
} => { } => {
let mut init_expr_reader = init_expr.get_binary_reader(); let mut init_expr_reader = offset_expr.get_binary_reader();
let (base, offset) = match init_expr_reader let (base, offset) = match init_expr_reader
.read_operator() .read_operator()
.map_err(from_binaryreadererror_wasmerror)? .map_err(from_binaryreadererror_wasmerror)?
@ -426,9 +417,9 @@ pub fn parse_data_section<'data>(
match kind { match kind {
DataKind::Active { DataKind::Active {
memory_index, memory_index,
init_expr, offset_expr,
} => { } => {
let mut init_expr_reader = init_expr.get_binary_reader(); let mut init_expr_reader = offset_expr.get_binary_reader();
let (base, offset) = match init_expr_reader let (base, offset) = match init_expr_reader
.read_operator() .read_operator()
.map_err(from_binaryreadererror_wasmerror)? .map_err(from_binaryreadererror_wasmerror)?
@ -469,20 +460,20 @@ pub fn parse_name_section<'data>(
while let Ok(subsection) = names.read() { while let Ok(subsection) = names.read() {
match subsection { match subsection {
wasmparser::Name::Function(function_subsection) => { wasmparser::Name::Function(function_subsection) => {
if let Some(function_names) = function_subsection for naming in function_subsection.into_iter().flatten() {
.get_map() if naming.index != std::u32::MAX {
.ok() environ.declare_function_name(
.and_then(parse_function_name_subsection) FunctionIndex::from_u32(naming.index),
{ naming.name,
for (index, name) in function_names { )?;
environ.declare_function_name(index, name)?;
} }
} }
} }
wasmparser::Name::Module(module) => { wasmparser::Name::Module {
if let Ok(name) = module.get_name() { name,
environ.declare_module_name(name)?; name_range: _,
} } => {
environ.declare_module_name(name)?;
} }
wasmparser::Name::Local(_) => {} wasmparser::Name::Local(_) => {}
wasmparser::Name::Label(_) wasmparser::Name::Label(_)
@ -497,27 +488,3 @@ pub fn parse_name_section<'data>(
} }
Ok(()) Ok(())
} }
fn parse_function_name_subsection(
mut naming_reader: NamingReader<'_>,
) -> Option<HashMap<FunctionIndex, &str>> {
let mut function_names = HashMap::new();
for _ in 0..naming_reader.get_count() {
let Naming { index, name } = naming_reader.read().ok()?;
if index == std::u32::MAX {
// We reserve `u32::MAX` for our own use.
return None;
}
if function_names
.insert(FunctionIndex::from_u32(index), name)
.is_some()
{
// If the function index has been previously seen, then we
// break out of the loop and early return `None`, because these
// should be unique.
return None;
}
}
Some(function_names)
}

View File

@ -1,14 +1,13 @@
// This file contains code from external sources. // This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md // Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md
use crate::wasm_unsupported;
use std::boxed::Box; use std::boxed::Box;
use wasmer_types::entity::PrimaryMap; use wasmer_types::entity::PrimaryMap;
use wasmer_types::{SignatureIndex, WasmResult}; use wasmer_types::{SignatureIndex, WasmResult};
/// Map of signatures to a function's parameter and return types. /// Map of signatures to a function's parameter and return types.
pub(crate) type WasmTypes = pub(crate) type WasmTypes =
PrimaryMap<SignatureIndex, (Box<[wasmparser::Type]>, Box<[wasmparser::Type]>)>; PrimaryMap<SignatureIndex, (Box<[wasmparser::ValType]>, Box<[wasmparser::ValType]>)>;
/// Contains information decoded from the Wasm module that must be referenced /// Contains information decoded from the Wasm module that must be referenced
/// during each Wasm function's translation. /// during each Wasm function's translation.
@ -36,25 +35,24 @@ impl ModuleTranslationState {
/// Get the parameter and result types for the given Wasm blocktype. /// Get the parameter and result types for the given Wasm blocktype.
pub fn blocktype_params_results( pub fn blocktype_params_results(
&self, &self,
ty_or_ft: wasmparser::TypeOrFuncType, ty_or_ft: wasmparser::BlockType,
) -> WasmResult<(&[wasmparser::Type], &[wasmparser::Type])> { ) -> WasmResult<(&[wasmparser::ValType], &[wasmparser::ValType])> {
Ok(match ty_or_ft { Ok(match ty_or_ft {
wasmparser::TypeOrFuncType::Type(ty) => match ty { wasmparser::BlockType::Type(ty) => match ty {
wasmparser::Type::I32 => (&[], &[wasmparser::Type::I32]), wasmparser::ValType::I32 => (&[], &[wasmparser::ValType::I32]),
wasmparser::Type::I64 => (&[], &[wasmparser::Type::I64]), wasmparser::ValType::I64 => (&[], &[wasmparser::ValType::I64]),
wasmparser::Type::F32 => (&[], &[wasmparser::Type::F32]), wasmparser::ValType::F32 => (&[], &[wasmparser::ValType::F32]),
wasmparser::Type::F64 => (&[], &[wasmparser::Type::F64]), wasmparser::ValType::F64 => (&[], &[wasmparser::ValType::F64]),
wasmparser::Type::V128 => (&[], &[wasmparser::Type::V128]), wasmparser::ValType::V128 => (&[], &[wasmparser::ValType::V128]),
wasmparser::Type::ExternRef => (&[], &[wasmparser::Type::ExternRef]), wasmparser::ValType::ExternRef => (&[], &[wasmparser::ValType::ExternRef]),
wasmparser::Type::FuncRef => (&[], &[wasmparser::Type::FuncRef]), wasmparser::ValType::FuncRef => (&[], &[wasmparser::ValType::FuncRef]),
wasmparser::Type::EmptyBlockType => (&[], &[]),
ty => return Err(wasm_unsupported!("blocktype_params_results: type {:?}", ty)),
}, },
wasmparser::TypeOrFuncType::FuncType(ty_index) => { wasmparser::BlockType::FuncType(ty_index) => {
let sig_idx = SignatureIndex::from_u32(ty_index); let sig_idx = SignatureIndex::from_u32(ty_index);
let (ref params, ref results) = self.wasm_types[sig_idx]; let (ref params, ref results) = self.wasm_types[sig_idx];
(params, results) (params, results)
} }
wasmparser::BlockType::Empty => (&[], &[]),
}) })
} }
} }

View File

@ -11,7 +11,7 @@
use std::convert::TryInto; use std::convert::TryInto;
use std::fmt; use std::fmt;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use wasmer::wasmparser::{Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType}; use wasmer::wasmparser::{BlockType as WpTypeOrFuncType, Operator};
use wasmer::{ use wasmer::{
AsStoreMut, ExportIndex, FunctionMiddleware, GlobalInit, GlobalType, Instance, AsStoreMut, ExportIndex, FunctionMiddleware, GlobalInit, GlobalType, Instance,
LocalFunctionIndex, MiddlewareError, MiddlewareReaderState, ModuleMiddleware, Mutability, Type, LocalFunctionIndex, MiddlewareError, MiddlewareReaderState, ModuleMiddleware, Mutability, Type,
@ -234,7 +234,7 @@ impl<F: Fn(&Operator) -> u64 + Send + Sync> FunctionMiddleware for FunctionMeter
Operator::GlobalGet { global_index: self.global_indexes.remaining_points().as_u32() }, Operator::GlobalGet { global_index: self.global_indexes.remaining_points().as_u32() },
Operator::I64Const { value: self.accumulated_cost as i64 }, Operator::I64Const { value: self.accumulated_cost as i64 },
Operator::I64LtU, Operator::I64LtU,
Operator::If { ty: WpTypeOrFuncType::Type(WpType::EmptyBlockType) }, Operator::If { blockty: WpTypeOrFuncType::Empty },
Operator::I32Const { value: 1 }, Operator::I32Const { value: 1 },
Operator::GlobalSet { global_index: self.global_indexes.points_exhausted().as_u32() }, Operator::GlobalSet { global_index: self.global_indexes.points_exhausted().as_u32() },
Operator::Unreachable, Operator::Unreachable,

View File

@ -66,6 +66,7 @@ pub fn run_wast(mut config: crate::Config, wast_path: &str) -> anyhow::Result<()
wast.allow_instantiation_failures(&[ wast.allow_instantiation_failures(&[
"Validation error: invalid result arity: func type returns multiple values", "Validation error: invalid result arity: func type returns multiple values",
"Validation error: blocks, loops, and ifs may only produce a resulttype when multi-value is not enabled", "Validation error: blocks, loops, and ifs may only produce a resulttype when multi-value is not enabled",
"Validation error: func type returns multiple values but the multi-value feature is not enabled",
]); ]);
} }
wast.fail_fast = false; wast.fail_fast = false;