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