Merge master & correct errors
This commit is contained in:
@@ -12,13 +12,13 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
smallvec = "1.0.0"
|
smallvec = "1.0.0"
|
||||||
dynasm = "0.5.1"
|
dynasm = "0.5.2"
|
||||||
dynasmrt = "0.5.1"
|
dynasmrt = "0.5.2"
|
||||||
wasmparser = "0.44.0"
|
wasmparser = "0.44.0"
|
||||||
memoffset = "0.5.1"
|
memoffset = "0.5.3"
|
||||||
itertools = "0.8"
|
itertools = "0.8.2"
|
||||||
capstone = "0.6.0"
|
capstone = "0.6.0"
|
||||||
thiserror = "1.0.4"
|
thiserror = "1.0.9"
|
||||||
cranelift-codegen = "0.50.0"
|
cranelift-codegen = "0.50.0"
|
||||||
multi_mut = "0.1"
|
multi_mut = "0.1"
|
||||||
either = "1.5"
|
either = "1.5"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,15 @@
|
|||||||
use crate::backend::{
|
use crate::backend::{
|
||||||
ret_locs, BlockCallingConvention, CodeGenSession, Context, Label, Registers, ValueLocation,
|
ret_locs, BlockCallingConvention, CodeGenSession, Context, Label, VirtualCallingConvention,
|
||||||
VirtualCallingConvention,
|
|
||||||
};
|
};
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
use crate::backend::{Registers, ValueLocation};
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::microwasm::*;
|
use crate::microwasm::*;
|
||||||
use crate::module::{ModuleContext, SigType, Signature};
|
use crate::module::{ModuleContext, SigType, Signature};
|
||||||
use cranelift_codegen::binemit;
|
use cranelift_codegen::binemit;
|
||||||
use dynasmrt::DynasmApi;
|
use dynasmrt::DynasmApi;
|
||||||
use either::{Either, Left, Right};
|
use either::{Either, Left, Right};
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
use more_asserts::assert_ge;
|
use more_asserts::assert_ge;
|
||||||
use multi_mut::HashMapMultiMut;
|
use multi_mut::HashMapMultiMut;
|
||||||
use std::{collections::HashMap, hash::Hash};
|
use std::{collections::HashMap, hash::Hash};
|
||||||
@@ -413,13 +415,8 @@ where
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut cc : Option<BlockCallingConvention> = None;
|
let cc = if then_block_should_serialize_args
|
||||||
if then_block_should_serialize_args
|
|| else_block_should_serialize_args { let a = ctx.serialize_args(max_params)? ; Some(a) } else { None };
|
||||||
|| else_block_should_serialize_args
|
|
||||||
{
|
|
||||||
let a = ctx.serialize_args(max_params)?;
|
|
||||||
cc = Some(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
**then_cc = if then_block_should_serialize_args {
|
**then_cc = if then_block_should_serialize_args {
|
||||||
let mut cc = cc.clone().unwrap();
|
let mut cc = cc.clone().unwrap();
|
||||||
@@ -449,7 +446,7 @@ where
|
|||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
_ => return Err(Error::Microwasm(
|
_ => Err(Error::Microwasm(
|
||||||
"unimplemented: Can't pass different params to different sides of `br_if` yet".to_string(),
|
"unimplemented: Can't pass different params to different sides of `br_if` yet".to_string(),
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
@@ -813,8 +810,8 @@ where
|
|||||||
Operator::Load { ty: F32, memarg } => ctx.f32_load(memarg.offset)?,
|
Operator::Load { ty: F32, memarg } => ctx.f32_load(memarg.offset)?,
|
||||||
Operator::Load { ty: I64, memarg } => ctx.i64_load(memarg.offset)?,
|
Operator::Load { ty: I64, memarg } => ctx.i64_load(memarg.offset)?,
|
||||||
Operator::Load { ty: F64, memarg } => ctx.f64_load(memarg.offset)?,
|
Operator::Load { ty: F64, memarg } => ctx.f64_load(memarg.offset)?,
|
||||||
Operator::Store8 { ty: _, memarg } => ctx.store8(memarg.offset)?,
|
Operator::Store8 { memarg, .. } => ctx.store8(memarg.offset)?,
|
||||||
Operator::Store16 { ty: _, memarg } => ctx.store16(memarg.offset)?,
|
Operator::Store16 { memarg, .. } => ctx.store16(memarg.offset)?,
|
||||||
Operator::Store32 { memarg }
|
Operator::Store32 { memarg }
|
||||||
| Operator::Store { ty: I32, memarg }
|
| Operator::Store { ty: I32, memarg }
|
||||||
| Operator::Store { ty: F32, memarg } => ctx.store32(memarg.offset)?,
|
| Operator::Store { ty: F32, memarg } => ctx.store32(memarg.offset)?,
|
||||||
@@ -826,10 +823,10 @@ where
|
|||||||
Operator::Select => {
|
Operator::Select => {
|
||||||
ctx.select()?;
|
ctx.select()?;
|
||||||
}
|
}
|
||||||
Operator::MemorySize { reserved: _ } => {
|
Operator::MemorySize { .. } => {
|
||||||
ctx.memory_size()?;
|
ctx.memory_size()?;
|
||||||
}
|
}
|
||||||
Operator::MemoryGrow { reserved: _ } => {
|
Operator::MemoryGrow { .. } => {
|
||||||
ctx.memory_grow()?;
|
ctx.memory_grow()?;
|
||||||
}
|
}
|
||||||
Operator::Call { function_index } => {
|
Operator::Call { function_index } => {
|
||||||
|
|||||||
@@ -283,18 +283,14 @@ impl SignlessType {
|
|||||||
Type::I64 => Ok(I64),
|
Type::I64 => Ok(I64),
|
||||||
Type::F32 => Ok(F32),
|
Type::F32 => Ok(F32),
|
||||||
Type::F64 => Ok(F64),
|
Type::F64 => Ok(F64),
|
||||||
Type::EmptyBlockType => {
|
Type::EmptyBlockType => Err(BinaryReaderError {
|
||||||
return Err(BinaryReaderError {
|
|
||||||
message: "SignlessType with EmptyBlockType",
|
message: "SignlessType with EmptyBlockType",
|
||||||
offset: -1isize as usize,
|
offset: -1isize as usize,
|
||||||
})
|
}),
|
||||||
}
|
_ => Err(BinaryReaderError {
|
||||||
_ => {
|
|
||||||
return Err(BinaryReaderError {
|
|
||||||
message: "SignlessType unimplemented",
|
message: "SignlessType unimplemented",
|
||||||
offset: -1isize as usize,
|
offset: -1isize as usize,
|
||||||
})
|
}),
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,12 +300,10 @@ fn create_returns_from_wasm_type(
|
|||||||
) -> Result<Vec<SignlessType>, BinaryReaderError> {
|
) -> Result<Vec<SignlessType>, BinaryReaderError> {
|
||||||
match ty {
|
match ty {
|
||||||
wasmparser::TypeOrFuncType::Type(ty) => Ok(Vec::from_iter(Type::from_wasm(ty))),
|
wasmparser::TypeOrFuncType::Type(ty) => Ok(Vec::from_iter(Type::from_wasm(ty))),
|
||||||
wasmparser::TypeOrFuncType::FuncType(_) => {
|
wasmparser::TypeOrFuncType::FuncType(_) => Err(BinaryReaderError {
|
||||||
return Err(BinaryReaderError {
|
|
||||||
message: "Unsupported func type",
|
message: "Unsupported func type",
|
||||||
offset: -1isize as usize,
|
offset: -1isize as usize,
|
||||||
})
|
}),
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,12 @@ pub struct ExecutableModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ExecutableModule {
|
impl ExecutableModule {
|
||||||
/// Executes the function _without checking types_. This can cause undefined
|
/// Executes the function identified by `func_idx`.
|
||||||
/// memory to be accessed.
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// Executes the function _without_ checking the argument types.
|
||||||
|
/// This can cause undefined memory to be accessed.
|
||||||
pub unsafe fn execute_func_unchecked<Args: FunctionArgs<T>, T>(
|
pub unsafe fn execute_func_unchecked<Args: FunctionArgs<T>, T>(
|
||||||
&self,
|
&self,
|
||||||
func_idx: u32,
|
func_idx: u32,
|
||||||
|
|||||||
Reference in New Issue
Block a user