Update to wasmparser 0.47. (#1331)

Co-authored-by: Yury Delendik <ydelendik@mozilla.com>
This commit is contained in:
Dan Gohman
2020-01-10 15:31:37 -08:00
committed by GitHub
parent 3a13f79b66
commit 8bec6fe869
3 changed files with 19 additions and 7 deletions

View File

@@ -11,7 +11,7 @@ keywords = ["webassembly", "wasm"]
edition = "2018"
[dependencies]
wasmparser = { version = "0.45.0", default-features = false }
wasmparser = { version = "0.47.0", default-features = false }
cranelift-codegen = { path = "../cranelift-codegen", version = "0.54.0", default-features = false }
cranelift-entity = { path = "../cranelift-entity", version = "0.54.0" }
cranelift-frontend = { path = "../cranelift-frontend", version = "0.54.0", default-features = false }

View File

@@ -947,6 +947,9 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
Operator::F32Le | Operator::F64Le => {
translate_fcmp(FloatCC::LessThanOrEqual, builder, state)
}
Operator::TypedSelect { .. } => {
return Err(wasm_unsupported!("proposed typed select operator {:?}", op))
}
Operator::RefNull => state.push1(builder.ins().null(environ.reference_type())),
Operator::RefIsNull => {
let arg = state.pop1();

View File

@@ -17,14 +17,15 @@ use crate::{wasm_unsupported, HashMap};
use core::convert::TryFrom;
use cranelift_codegen::ir::immediates::V128Imm;
use cranelift_codegen::ir::{self, AbiParam, Signature};
use cranelift_entity::packed_option::ReservedValue;
use cranelift_entity::EntityRef;
use std::vec::Vec;
use wasmparser::{
self, CodeSectionReader, Data, DataKind, DataSectionReader, Element, ElementKind,
self, CodeSectionReader, Data, DataKind, DataSectionReader, Element, ElementItem, ElementKind,
ElementSectionReader, Export, ExportSectionReader, ExternalKind, FuncType,
FunctionSectionReader, GlobalSectionReader, GlobalType, ImportSectionEntryType,
ImportSectionReader, MemorySectionReader, MemoryType, NameSectionReader, Naming, NamingReader,
Operator, TableSectionReader, TypeSectionReader,
Operator, TableSectionReader, Type, TypeSectionReader,
};
/// Parses the Type section of the wasm module.
@@ -292,9 +293,14 @@ pub fn parse_element_section<'data>(
environ.reserve_table_elements(elements.get_count())?;
for entry in elements {
let Element { kind } = entry?;
let Element { kind, items, ty } = entry?;
if ty != Type::AnyFunc {
return Err(wasm_unsupported!(
"unsupported table element type: {:?}",
ty
));
}
if let ElementKind::Active {
items,
table_index,
init_expr,
} = kind
@@ -315,8 +321,11 @@ pub fn parse_element_section<'data>(
let items_reader = items.get_items_reader()?;
let mut elems = Vec::with_capacity(usize::try_from(items_reader.get_count()).unwrap());
for item in items_reader {
let x = item?;
elems.push(FuncIndex::from_u32(x));
let elem = match item? {
ElementItem::Null => FuncIndex::reserved_value(),
ElementItem::Func(index) => FuncIndex::from_u32(index),
};
elems.push(elem);
}
environ.declare_table_elements(
TableIndex::from_u32(table_index),