From e8fc612dc24ddff24ab1a7acc4ce9277a54aa018 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 28 Sep 2018 16:56:04 -0700 Subject: [PATCH] Update to wasmparser 0.19.0. --- lib/wasm/Cargo.toml | 2 +- lib/wasm/src/code_translator.rs | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/wasm/Cargo.toml b/lib/wasm/Cargo.toml index bd2c12d46e..beada39d7d 100644 --- a/lib/wasm/Cargo.toml +++ b/lib/wasm/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" keywords = ["webassembly", "wasm"] [dependencies] -wasmparser = { version = "0.17.2", default-features = false } +wasmparser = { version = "0.19.0", default-features = false } cranelift-codegen = { path = "../codegen", version = "0.22.0", default-features = false } cranelift-entity = { path = "../entity", version = "0.22.0", default-features = false } cranelift-frontend = { path = "../frontend", version = "0.22.0", default-features = false } diff --git a/lib/wasm/src/code_translator.rs b/lib/wasm/src/code_translator.rs index 92619f1bf9..5a74db5bad 100644 --- a/lib/wasm/src/code_translator.rs +++ b/lib/wasm/src/code_translator.rs @@ -255,7 +255,7 @@ pub fn translate_operator( Operator::BrTable { table } => { let (depths, default) = table.read_table(); let mut min_depth = default; - for depth in &depths { + for depth in &*depths { if *depth < min_depth { min_depth = *depth; } @@ -273,9 +273,9 @@ pub fn translate_operator( let mut data = JumpTableData::with_capacity(depths.len()); if jump_args_count == 0 { // No jump arguments - for depth in depths { + for depth in &*depths { let ebb = { - let i = state.control_stack.len() - 1 - (depth as usize); + let i = state.control_stack.len() - 1 - (*depth as usize); let frame = &mut state.control_stack[i]; frame.set_branched_to_exit(); frame.br_destination() @@ -297,12 +297,12 @@ pub fn translate_operator( let return_count = jump_args_count; let mut dest_ebb_sequence = Vec::new(); let mut dest_ebb_map = HashMap::new(); - for depth in depths { - let branch_ebb = match dest_ebb_map.entry(depth as usize) { + for depth in &*depths { + let branch_ebb = match dest_ebb_map.entry(*depth as usize) { hash_map::Entry::Occupied(entry) => *entry.get(), hash_map::Entry::Vacant(entry) => { let ebb = builder.create_ebb(); - dest_ebb_sequence.push((depth as usize, ebb)); + dest_ebb_sequence.push((*depth as usize, ebb)); *entry.insert(ebb) } }; @@ -893,6 +893,9 @@ pub fn translate_operator( | Operator::I64AtomicRmw32UCmpxchg { .. } => { return Err(WasmError::Unsupported("proposed thread operators")); } + Operator::RefNull | Operator::RefIsNull { .. } => { + return Err(WasmError::Unsupported("proposed reference-type operators")); + } }; Ok(()) }