Update wasm-tools crates (#5945)

This notably updates `wasmparser` for updates to the relaxed-simd
proposal and an implementation of the function-references proposal.
Additionally there are some minor bug fixes being picked up for WIT and
the component model.
This commit is contained in:
Alex Crichton
2023-03-06 17:47:34 -06:00
committed by GitHub
parent 58430b1dd7
commit 3c9fc3ec8c
19 changed files with 203 additions and 101 deletions

View File

@@ -122,7 +122,7 @@ impl Stacks {
types.function(vec![], vec![]);
let call_func_type = types.len();
types.function(vec![wasm_encoder::ValType::FuncRef], vec![]);
types.function(vec![wasm_encoder::ValType::FUNCREF], vec![]);
section(&mut module, types);
@@ -190,7 +190,7 @@ impl Stacks {
let mut elems = wasm_encoder::ElementSection::new();
elems.declared(
wasm_encoder::ValType::FuncRef,
wasm_encoder::RefType::FUNCREF,
wasm_encoder::Elements::Functions(
&(0..num_imported_funcs + u32::try_from(self.funcs.len()).unwrap())
.collect::<Vec<_>>(),

View File

@@ -4,8 +4,8 @@ use arbitrary::{Arbitrary, Result, Unstructured};
use std::ops::RangeInclusive;
use wasm_encoder::{
CodeSection, ConstExpr, EntityType, ExportKind, ExportSection, Function, FunctionSection,
GlobalSection, ImportSection, Instruction, Module, TableSection, TableType, TypeSection,
ValType,
GlobalSection, ImportSection, Instruction, Module, RefType, TableSection, TableType,
TypeSection, ValType,
};
/// A description of a Wasm module that makes a series of `externref` table
@@ -50,27 +50,27 @@ impl TableOps {
// dynamically adjusts the stack pointer for each call that uses
// return pointers rather than statically allocating space in the
// stack frame.
vec![ValType::ExternRef, ValType::ExternRef, ValType::ExternRef],
vec![ValType::EXTERNREF, ValType::EXTERNREF, ValType::EXTERNREF],
);
// 1: "run"
let mut params: Vec<ValType> = Vec::with_capacity(self.num_params as usize);
for _i in 0..self.num_params {
params.push(ValType::ExternRef);
params.push(ValType::EXTERNREF);
}
let results = vec![];
types.function(params, results);
// 2: `take_refs`
types.function(
vec![ValType::ExternRef, ValType::ExternRef, ValType::ExternRef],
vec![ValType::EXTERNREF, ValType::EXTERNREF, ValType::EXTERNREF],
vec![],
);
// 3: `make_refs`
types.function(
vec![],
vec![ValType::ExternRef, ValType::ExternRef, ValType::ExternRef],
vec![ValType::EXTERNREF, ValType::EXTERNREF, ValType::EXTERNREF],
);
// Import the GC function.
@@ -82,7 +82,7 @@ impl TableOps {
// Define our table.
let mut tables = TableSection::new();
tables.table(TableType {
element_type: ValType::ExternRef,
element_type: RefType::EXTERNREF,
minimum: self.table_size as u32,
maximum: None,
});
@@ -92,10 +92,10 @@ impl TableOps {
for _ in 0..self.num_globals {
globals.global(
wasm_encoder::GlobalType {
val_type: wasm_encoder::ValType::ExternRef,
val_type: wasm_encoder::ValType::EXTERNREF,
mutable: true,
},
&ConstExpr::ref_null(wasm_encoder::ValType::ExternRef),
&ConstExpr::ref_null(wasm_encoder::HeapType::Extern),
);
}
@@ -108,7 +108,7 @@ impl TableOps {
// Give ourselves one scratch local that we can use in various `TableOp`
// implementations.
let mut func = Function::new(vec![(1, ValType::ExternRef)]);
let mut func = Function::new(vec![(1, ValType::EXTERNREF)]);
func.instruction(&Instruction::Loop(wasm_encoder::BlockType::Empty));
for op in &self.ops {
@@ -261,7 +261,7 @@ impl TableOp {
func.instruction(&Instruction::Drop);
}
Self::Null => {
func.instruction(&Instruction::RefNull(wasm_encoder::ValType::ExternRef));
func.instruction(&Instruction::RefNull(wasm_encoder::HeapType::Extern));
}
}
}