Update to wasmparser 0.14.1.

This commit is contained in:
Dan Gohman
2018-02-13 20:14:01 -08:00
parent 3ccc3f4f9b
commit 42e1616b82
4 changed files with 85 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ license = "Apache-2.0"
name = "cton_wasm" name = "cton_wasm"
[dependencies] [dependencies]
wasmparser = "0.13.0" wasmparser = "0.14.1"
cretonne = { path = "../cretonne" } cretonne = { path = "../cretonne" }
cretonne-frontend = { path = "../frontend" } cretonne-frontend = { path = "../frontend" }

View File

@@ -618,6 +618,13 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let val = state.pop1(); let val = state.pop1();
state.push1(builder.ins().bitcast(I64, val)); state.push1(builder.ins().bitcast(I64, val));
} }
Operator::I32Extend8S |
Operator::I32Extend16S |
Operator::I64Extend8S |
Operator::I64Extend16S |
Operator::I64Extend32S => {
panic!("proposed sign-extend operators not yet supported");
}
/****************************** Binary Operators ************************************/ /****************************** Binary Operators ************************************/
Operator::I32Add | Operator::I64Add => { Operator::I32Add | Operator::I64Add => {
let (arg1, arg2) = state.pop2(); let (arg1, arg2) = state.pop2();
@@ -814,6 +821,74 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let val = builder.ins().fcmp(FloatCC::LessThanOrEqual, arg1, arg2); let val = builder.ins().fcmp(FloatCC::LessThanOrEqual, arg1, arg2);
state.push1(builder.ins().bint(I32, val)); state.push1(builder.ins().bint(I32, val));
} }
Operator::Wake { .. } |
Operator::I32Wait { .. } |
Operator::I64Wait { .. } |
Operator::I32AtomicLoad { .. } |
Operator::I64AtomicLoad { .. } |
Operator::I32AtomicLoad8U { .. } |
Operator::I32AtomicLoad16U { .. } |
Operator::I64AtomicLoad8U { .. } |
Operator::I64AtomicLoad16U { .. } |
Operator::I64AtomicLoad32U { .. } |
Operator::I32AtomicStore { .. } |
Operator::I64AtomicStore { .. } |
Operator::I32AtomicStore8 { .. } |
Operator::I32AtomicStore16 { .. } |
Operator::I64AtomicStore8 { .. } |
Operator::I64AtomicStore16 { .. } |
Operator::I64AtomicStore32 { .. } |
Operator::I32AtomicRmwAdd { .. } |
Operator::I64AtomicRmwAdd { .. } |
Operator::I32AtomicRmw8UAdd { .. } |
Operator::I32AtomicRmw16UAdd { .. } |
Operator::I64AtomicRmw8UAdd { .. } |
Operator::I64AtomicRmw16UAdd { .. } |
Operator::I64AtomicRmw32UAdd { .. } |
Operator::I32AtomicRmwSub { .. } |
Operator::I64AtomicRmwSub { .. } |
Operator::I32AtomicRmw8USub { .. } |
Operator::I32AtomicRmw16USub { .. } |
Operator::I64AtomicRmw8USub { .. } |
Operator::I64AtomicRmw16USub { .. } |
Operator::I64AtomicRmw32USub { .. } |
Operator::I32AtomicRmwAnd { .. } |
Operator::I64AtomicRmwAnd { .. } |
Operator::I32AtomicRmw8UAnd { .. } |
Operator::I32AtomicRmw16UAnd { .. } |
Operator::I64AtomicRmw8UAnd { .. } |
Operator::I64AtomicRmw16UAnd { .. } |
Operator::I64AtomicRmw32UAnd { .. } |
Operator::I32AtomicRmwOr { .. } |
Operator::I64AtomicRmwOr { .. } |
Operator::I32AtomicRmw8UOr { .. } |
Operator::I32AtomicRmw16UOr { .. } |
Operator::I64AtomicRmw8UOr { .. } |
Operator::I64AtomicRmw16UOr { .. } |
Operator::I64AtomicRmw32UOr { .. } |
Operator::I32AtomicRmwXor { .. } |
Operator::I64AtomicRmwXor { .. } |
Operator::I32AtomicRmw8UXor { .. } |
Operator::I32AtomicRmw16UXor { .. } |
Operator::I64AtomicRmw8UXor { .. } |
Operator::I64AtomicRmw16UXor { .. } |
Operator::I64AtomicRmw32UXor { .. } |
Operator::I32AtomicRmwXchg { .. } |
Operator::I64AtomicRmwXchg { .. } |
Operator::I32AtomicRmw8UXchg { .. } |
Operator::I32AtomicRmw16UXchg { .. } |
Operator::I64AtomicRmw8UXchg { .. } |
Operator::I64AtomicRmw16UXchg { .. } |
Operator::I64AtomicRmw32UXchg { .. } |
Operator::I32AtomicRmwCmpxchg { .. } |
Operator::I64AtomicRmwCmpxchg { .. } |
Operator::I32AtomicRmw8UCmpxchg { .. } |
Operator::I32AtomicRmw16UCmpxchg { .. } |
Operator::I64AtomicRmw8UCmpxchg { .. } |
Operator::I64AtomicRmw16UCmpxchg { .. } |
Operator::I64AtomicRmw32UCmpxchg { .. } => {
panic!("proposed thread operators not yet supported");
}
} }
} }

View File

@@ -75,11 +75,16 @@ pub fn parse_import_section<'data>(
environ.declare_func_import(sig as SignatureIndex, module_name, field_name); environ.declare_func_import(sig as SignatureIndex, module_name, field_name);
} }
ParserState::ImportSectionEntry { ParserState::ImportSectionEntry {
ty: ImportSectionEntryType::Memory(MemoryType { limits: ref memlimits }), .. ty: ImportSectionEntryType::Memory(MemoryType {
limits: ref memlimits,
shared,
}),
..
} => { } => {
environ.declare_memory(Memory { environ.declare_memory(Memory {
pages_count: memlimits.initial as usize, pages_count: memlimits.initial as usize,
maximum: memlimits.maximum.map(|x| x as usize), maximum: memlimits.maximum.map(|x| x as usize),
shared,
}); });
} }
ParserState::ImportSectionEntry { ParserState::ImportSectionEntry {
@@ -186,6 +191,7 @@ pub fn parse_memory_section(
environ.declare_memory(Memory { environ.declare_memory(Memory {
pages_count: ty.limits.initial as usize, pages_count: ty.limits.initial as usize,
maximum: ty.limits.maximum.map(|x| x as usize), maximum: ty.limits.maximum.map(|x| x as usize),
shared: ty.shared,
}); });
} }
ParserState::EndSection => break, ParserState::EndSection => break,

View File

@@ -67,6 +67,8 @@ pub struct Memory {
pub pages_count: usize, pub pages_count: usize,
/// The maximum number of pages in the memory. /// The maximum number of pages in the memory.
pub maximum: Option<usize>, pub maximum: Option<usize>,
/// Whether the memory may be shared between multiple threads.
pub shared: bool,
} }
/// Wrapper to a `get_local` and `set_local` index. They are WebAssembly's non-SSA variables. /// Wrapper to a `get_local` and `set_local` index. They are WebAssembly's non-SSA variables.