Skip to content

Commit

Permalink
Merge pull request wasmerio#2834 from wasmerio/cranelift-0.82
Browse files Browse the repository at this point in the history
Update cranelift to 0.82
  • Loading branch information
syrusakbary authored Apr 6, 2022
2 parents db8c4c5 + 8ec6acb commit 7e8354e
Show file tree
Hide file tree
Showing 42 changed files with 529 additions and 575 deletions.
60 changes: 24 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/exports_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
global.get $offset
global.get $length)
(data (global.get $offset) "Hello, World!"))
(data (i32.const 42) "Hello, World!"))
"#,
)?;

Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/equivalence_universal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn maybe_instantiate_singlepass(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
Ok(m) => m,
Err(e) => {
let error_message = format!("{}", e);
if error_message.contains("Validation error: invalid result arity: func type returns multiple values") || error_message.contains("Validation error: blocks, loops, and ifs accept no parameters when multi-value is not enabled") || error_message.contains("multi-value returns not yet implemented") {
if error_message.contains("Validation error: invalid result arity: func type returns multiple values") || error_message.contains("Validation error: blocks, loops, and ifs may only produce a resulttype when multi-value is not enabled") || error_message.contains("multi-value returns not yet implemented") {
return Ok(None);
}
return Err(e.into());
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/universal_singlepass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fuzz_target!(|module: WasmSmithModule| {
Ok(m) => m,
Err(e) => {
let error_message = format!("{}", e);
if error_message.contains("Validation error: invalid result arity: func type returns multiple values") || error_message.contains("Validation error: blocks, loops, and ifs accept no parameters when multi-value is not enabled") || error_message.contains("multi-value returns not yet implemented") {
if error_message.contains("Validation error: invalid result arity: func type returns multiple values") || error_message.contains("Validation error: blocks, loops, and ifs may only produce a resulttype when multi-value is not enabled") || error_message.contains("multi-value returns not yet implemented") {
return;
}
panic!("{}", e);
Expand Down
2 changes: 1 addition & 1 deletion lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ wasm-bindgen = "0.2.74"
js-sys = "0.3.51"
wasmer-derive = { path = "../derive", version = "=2.2.1" }
# - Optional dependencies for `js`.
wasmparser = { version = "0.78", default-features = false, optional = true }
wasmparser = { version = "0.83", default-features = false, optional = true }
hashbrown = { version = "0.11", optional = true }
# - Development Dependencies for `js`.
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
Expand Down
71 changes: 42 additions & 29 deletions lib/api/src/js/module_info_polyfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,28 +368,31 @@ pub fn parse_import_section<'data>(
field_name.unwrap_or_default(),
)?;
}
ImportSectionEntryType::Module(_)
| ImportSectionEntryType::Instance(_)
| ImportSectionEntryType::Event(_) => {
ImportSectionEntryType::Module(_) | ImportSectionEntryType::Instance(_) => {
unimplemented!("module linking not implemented yet")
}
ImportSectionEntryType::Memory(WPMemoryType::M32 {
limits: ref memlimits,
ImportSectionEntryType::Tag(_) => {
unimplemented!("exception handling not implemented yet")
}
ImportSectionEntryType::Memory(WPMemoryType {
shared,
memory64,
initial,
maximum,
}) => {
if memory64 {
unimplemented!("64bit memory not implemented yet");
}
module_info.declare_memory_import(
MemoryType {
minimum: Pages(memlimits.initial),
maximum: memlimits.maximum.map(Pages),
minimum: Pages(initial as u32),
maximum: maximum.map(|p| Pages(p as u32)),
shared,
},
module_name,
field_name.unwrap_or_default(),
)?;
}
ImportSectionEntryType::Memory(WPMemoryType::M64 { .. }) => {
unimplemented!("64bit memory not implemented yet")
}
ImportSectionEntryType::Global(ref ty) => {
module_info.declare_global_import(
GlobalType {
Expand All @@ -404,8 +407,8 @@ pub fn parse_import_section<'data>(
module_info.declare_table_import(
TableType {
ty: wptype_to_type(tab.element_type).unwrap(),
minimum: tab.limits.initial,
maximum: tab.limits.maximum,
minimum: tab.initial,
maximum: tab.maximum,
},
module_name,
field_name.unwrap_or_default(),
Expand Down Expand Up @@ -443,8 +446,8 @@ pub fn parse_table_section(
let table = entry.map_err(transform_err)?;
module_info.declare_table(TableType {
ty: wptype_to_type(table.element_type).unwrap(),
minimum: table.limits.initial,
maximum: table.limits.maximum,
minimum: table.initial,
maximum: table.maximum,
})?;
}

Expand All @@ -459,17 +462,20 @@ pub fn parse_memory_section(
module_info.reserve_memories(memories.get_count())?;

for entry in memories {
let memory = entry.map_err(transform_err)?;
match memory {
WPMemoryType::M32 { limits, shared } => {
module_info.declare_memory(MemoryType {
minimum: Pages(limits.initial),
maximum: limits.maximum.map(Pages),
shared,
})?;
}
WPMemoryType::M64 { .. } => unimplemented!("64bit memory not implemented yet"),
let WPMemoryType {
shared,
memory64,
initial,
maximum,
} = entry.map_err(transform_err)?;
if memory64 {
unimplemented!("64bit memory not implemented yet");
}
module_info.declare_memory(MemoryType {
minimum: Pages(initial as u32),
maximum: maximum.map(|p| Pages(p as u32)),
shared,
})?;
}

Ok(())
Expand Down Expand Up @@ -528,12 +534,12 @@ pub fn parse_export_section<'data>(
ExternalKind::Global => {
module_info.declare_global_export(GlobalIndex::new(index), field)?
}
ExternalKind::Type
| ExternalKind::Module
| ExternalKind::Instance
| ExternalKind::Event => {
ExternalKind::Type | ExternalKind::Module | ExternalKind::Instance => {
unimplemented!("module linking not implemented yet")
}
ExternalKind::Tag => {
unimplemented!("exception handling not implemented yet")
}
}
}
Ok(())
Expand Down Expand Up @@ -569,7 +575,14 @@ pub fn parse_name_section<'data>(
}
}
wasmparser::Name::Local(_) => {}
wasmparser::Name::Unknown { .. } => {}
wasmparser::Name::Label(_)
| wasmparser::Name::Type(_)
| wasmparser::Name::Table(_)
| wasmparser::Name::Memory(_)
| wasmparser::Name::Global(_)
| wasmparser::Name::Element(_)
| wasmparser::Name::Data(_)
| wasmparser::Name::Unknown { .. } => {}
};
}
Ok(())
Expand Down
36 changes: 35 additions & 1 deletion lib/c-api/src/wasm_c_api/unstable/parser/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,23 @@ pub enum wasmer_parser_operator_t {
F64x2ConvertLowI32x4U,
I32x4TruncSatF64x2SZero,
I32x4TruncSatF64x2UZero,
I8x16RelaxedSwizzle,
I32x4RelaxedTruncSatF32x4S,
I32x4RelaxedTruncSatF32x4U,
I32x4RelaxedTruncSatF64x2SZero,
I32x4RelaxedTruncSatF64x2UZero,
F32x4Fma,
F32x4Fms,
F64x2Fma,
F64x2Fms,
I8x16LaneSelect,
I16x8LaneSelect,
I32x4LaneSelect,
I64x2LaneSelect,
F32x4RelaxedMin,
F32x4RelaxedMax,
F64x2RelaxedMin,
F64x2RelaxedMax,
}

impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t {
Expand All @@ -535,7 +552,7 @@ impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t {
O::Delegate { .. } => Self::Delegate,
O::Throw { .. } => Self::Throw,
O::Rethrow { .. } => Self::Rethrow,
O::Unwind => Self::Unwind,
// O::Unwind removed
O::End => Self::End,
O::Br { .. } => Self::Br,
O::BrIf { .. } => Self::BrIf,
Expand Down Expand Up @@ -1036,6 +1053,23 @@ impl<'a> From<&Operator<'a>> for wasmer_parser_operator_t {
O::F64x2ConvertLowI32x4U => Self::F64x2ConvertLowI32x4U,
O::I32x4TruncSatF64x2SZero => Self::I32x4TruncSatF64x2SZero,
O::I32x4TruncSatF64x2UZero => Self::I32x4TruncSatF64x2UZero,
O::I8x16RelaxedSwizzle => Self::I8x16RelaxedSwizzle,
O::I32x4RelaxedTruncSatF32x4S => Self::I32x4RelaxedTruncSatF32x4S,
O::I32x4RelaxedTruncSatF32x4U => Self::I32x4RelaxedTruncSatF32x4U,
O::I32x4RelaxedTruncSatF64x2SZero => Self::I32x4RelaxedTruncSatF64x2SZero,
O::I32x4RelaxedTruncSatF64x2UZero => Self::I32x4RelaxedTruncSatF64x2UZero,
O::F32x4Fma => Self::F32x4Fma,
O::F32x4Fms => Self::F32x4Fms,
O::F64x2Fma => Self::F64x2Fma,
O::F64x2Fms => Self::F64x2Fms,
O::I8x16LaneSelect => Self::I8x16LaneSelect,
O::I16x8LaneSelect => Self::I16x8LaneSelect,
O::I32x4LaneSelect => Self::I32x4LaneSelect,
O::I64x2LaneSelect => Self::I64x2LaneSelect,
O::F32x4RelaxedMin => Self::F32x4RelaxedMin,
O::F32x4RelaxedMax => Self::F32x4RelaxedMax,
O::F64x2RelaxedMin => Self::F64x2RelaxedMin,
O::F64x2RelaxedMax => Self::F64x2RelaxedMax,
}
}
}
Loading

0 comments on commit 7e8354e

Please sign in to comment.