Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
losfair committed Feb 15, 2020
2 parents 5f4561e + 32991e6 commit 7b0f7ee
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## **[Unreleased]**

- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type.
- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types.
- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly.
- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation.
Expand Down
7 changes: 4 additions & 3 deletions lib/clif-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl FuncEnvironment for FunctionEnvironment {
let local_memory_bound = func.create_global_value(ir::GlobalValueData::Load {
base: local_memory_ptr,
offset: (vm::LocalMemory::offset_bound() as i32).into(),
global_type: ptr_type,
global_type: ir::types::I32,
readonly: false,
});

Expand Down Expand Up @@ -551,7 +551,7 @@ impl FuncEnvironment for FunctionEnvironment {
let table_count = func.create_global_value(ir::GlobalValueData::Load {
base: table_struct_ptr,
offset: (vm::LocalTable::offset_count() as i32).into(),
global_type: ptr_type,
global_type: ir::types::I32,
// The table length can change, so it can't be readonly.
readonly: false,
});
Expand Down Expand Up @@ -673,7 +673,8 @@ impl FuncEnvironment for FunctionEnvironment {
colocated: false,
});

pos.ins().symbol_value(ir::types::I64, sig_index_global)
let val = pos.ins().symbol_value(ir::types::I64, sig_index_global);
pos.ins().ireduce(ir::types::I32, val)

// let dynamic_sigindices_array_ptr = pos.ins().load(
// ptr_type,
Expand Down
4 changes: 3 additions & 1 deletion lib/clif-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ fn get_isa() -> Box<dyn isa::TargetIsa> {
builder.set("opt_level", "speed_and_size").unwrap();
builder.set("jump_tables_enabled", "false").unwrap();

if cfg!(not(test)) {
if cfg!(test) || cfg!(debug_assertions) {
builder.set("enable_verifier", "true").unwrap();
} else {
builder.set("enable_verifier", "false").unwrap();
}

Expand Down
9 changes: 7 additions & 2 deletions lib/clif-backend/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
use byteorder::{ByteOrder, LittleEndian};
use cranelift_codegen::{
binemit::{Stackmap, StackmapSink},
ir, isa, Context,
ir, isa, CodegenError, Context,
};
use rayon::prelude::*;
use std::{
Expand Down Expand Up @@ -124,7 +124,12 @@ impl FuncResolverBuilder {
&mut local_trap_sink,
&mut stackmap_sink,
)
.map_err(|e| CompileError::InternalError { msg: e.to_string() })?;
.map_err(|e| match e {
CodegenError::Verifier(v) => CompileError::InternalError {
msg: format!("Verifier error: {}", v),
},
_ => CompileError::InternalError { msg: e.to_string() },
})?;
ctx.clear();
Ok((code_buf, (reloc_sink, local_trap_sink)))
},
Expand Down
2 changes: 1 addition & 1 deletion lib/interface-types/src/decoders/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn uleb<'input, E: ParseError<&'input [u8]>>(input: &'input [u8]) -> IResult<&'i
return Err(Err::Error(make_error(input, ErrorKind::Eof)));
}

let (output, bytes) = match dbg!(input.iter().position(|&byte| byte & 0x80 == 0)) {
let (output, bytes) = match input.iter().position(|&byte| byte & 0x80 == 0) {
Some(length) if length <= 8 => (&input[length + 1..], &input[..=length]),
Some(_) => return Err(Err::Error(make_error(input, ErrorKind::TooLarge))),
None => return Err(Err::Error(make_error(input, ErrorKind::Eof))),
Expand Down

0 comments on commit 7b0f7ee

Please sign in to comment.