Update dependencies (#30)

* dev-test: update dependencies

* update wasmparser: 0.99.0 -> 0.101.1

Remove `i64` generation fix for elements as they only contain `reftype` and not `i64`

* update wasmparser: 0.101.1 -> 0.103.0

See <https://github.com/bytecodealliance/wasm-tools/pull/957> for more information

* update wasmparser: 0.103.0 -> 0.106.0

* update wasmparser: 0.106.0 -> 0.107.0
This commit is contained in:
wackbyte 2023-06-26 17:19:12 -04:00 committed by GitHub
parent ef18bb1172
commit bbaa60e8c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 19 deletions

View File

@ -4,7 +4,7 @@ version = "0.12.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
wasmparser = "0.99.0" wasmparser = "0.107.0"
[dependencies.wasm-ast] [dependencies.wasm-ast]
path = "../../wasm-ast" path = "../../wasm-ast"

View File

@ -107,8 +107,8 @@ fn write_table_list(wasm: &Module, w: &mut dyn Write) -> Result<()> {
for (i, table) in table.iter().enumerate() { for (i, table) in table.iter().enumerate() {
let index = offset + i; let index = offset + i;
let min = table.initial; let min = table.ty.initial;
let max = table.maximum.unwrap_or(0xFFFF); let max = table.ty.maximum.unwrap_or(0xFFFF);
writeln!( writeln!(
w, w,
@ -155,6 +155,8 @@ fn write_element_list(list: &[Element], type_info: &TypeInfo, w: &mut dyn Write)
unimplemented!("passive elements not supported") unimplemented!("passive elements not supported")
}; };
let index = index.unwrap_or(0);
writeln!(w, "\tdo")?; writeln!(w, "\tdo")?;
writeln!(w, "\t\tlocal target = TABLE_LIST[{index}].data")?; writeln!(w, "\t\tlocal target = TABLE_LIST[{index}].data")?;
write!(w, "\t\tlocal offset = ")?; write!(w, "\t\tlocal offset = ")?;

View File

@ -4,7 +4,7 @@ version = "0.12.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
wasmparser = "0.99.0" wasmparser = "0.107.0"
[dependencies.wasm-ast] [dependencies.wasm-ast]
path = "../../wasm-ast" path = "../../wasm-ast"

View File

@ -107,8 +107,8 @@ fn write_table_list(wasm: &Module, w: &mut dyn Write) -> Result<()> {
for (i, table) in table.iter().enumerate() { for (i, table) in table.iter().enumerate() {
let index = offset + i; let index = offset + i;
let min = table.initial; let min = table.ty.initial;
let max = table.maximum.unwrap_or(0xFFFF); let max = table.ty.maximum.unwrap_or(0xFFFF);
writeln!( writeln!(
w, w,
@ -155,6 +155,8 @@ fn write_element_list(list: &[Element], type_info: &TypeInfo, w: &mut dyn Write)
unimplemented!("passive elements not supported") unimplemented!("passive elements not supported")
}; };
let index = index.unwrap_or(0);
writeln!(w, "\tdo")?; writeln!(w, "\tdo")?;
writeln!(w, "\t\tlocal target = TABLE_LIST[{index}].data")?; writeln!(w, "\t\tlocal target = TABLE_LIST[{index}].data")?;
write!(w, "\t\tlocal offset = ")?; write!(w, "\t\tlocal offset = ")?;
@ -243,9 +245,7 @@ fn write_localize_used(
.iter() .iter()
.any(|g| g.ty.content_type == ValType::I64); .any(|g| g.ty.content_type == ValType::I64);
let has_element_i64 = wasm.element_section().iter().any(|e| e.ty == ValType::I64); if has_global_i64 {
if has_global_i64 || has_element_i64 {
loc_set.insert(("i64", "ZERO")); loc_set.insert(("i64", "ZERO"));
loc_set.insert(("i64", "ONE")); loc_set.insert(("i64", "ONE"));
loc_set.insert(("i64", "from_u32")); loc_set.insert(("i64", "from_u32"));

View File

@ -8,15 +8,15 @@ publish = false
cargo-fuzz = true cargo-fuzz = true
[dependencies] [dependencies]
libfuzzer-sys = "0.4.0" libfuzzer-sys = "0.4.6"
wasm-smith = "0.12.0" wasm-smith = "0.12.10"
wasm-ast = { path = "../wasm-ast" } wasm-ast = { path = "../wasm-ast" }
codegen-luajit = { path = "../codegen/luajit" } codegen-luajit = { path = "../codegen/luajit" }
codegen-luau = { path = "../codegen/luau" } codegen-luau = { path = "../codegen/luau" }
[dev-dependencies] [dev-dependencies]
test-generator = "0.3.0" test-generator = "0.3.1"
wast = "52.0.2" wast = "60.0.0"
[[bin]] [[bin]]
name = "luajit_translate" name = "luajit_translate"

View File

@ -4,4 +4,4 @@ version = "0.12.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
wasmparser = "0.99.0" wasmparser = "0.107.0"

View File

@ -2,8 +2,7 @@ use std::collections::HashMap;
use wasmparser::{ use wasmparser::{
BlockType, Data, Element, Export, ExternalKind, FunctionBody, Global, Import, LocalsReader, BlockType, Data, Element, Export, ExternalKind, FunctionBody, Global, Import, LocalsReader,
MemoryType, Name, NameSectionReader, Parser, Payload, Result, TableType, Type, TypeRef, MemoryType, Name, NameSectionReader, Parser, Payload, Result, Table, Type, TypeRef, ValType,
ValType,
}; };
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(PartialEq, Eq, Clone, Copy)]
@ -58,7 +57,7 @@ pub struct Module<'a> {
type_section: Vec<Type>, type_section: Vec<Type>,
import_section: Vec<Import<'a>>, import_section: Vec<Import<'a>>,
func_section: Vec<u32>, func_section: Vec<u32>,
table_section: Vec<TableType>, table_section: Vec<Table<'a>>,
memory_section: Vec<MemoryType>, memory_section: Vec<MemoryType>,
global_section: Vec<Global<'a>>, global_section: Vec<Global<'a>>,
export_section: Vec<Export<'a>>, export_section: Vec<Export<'a>>,
@ -173,7 +172,7 @@ impl<'a> Module<'a> {
} }
#[must_use] #[must_use]
pub fn table_section(&self) -> &[TableType] { pub fn table_section(&self) -> &[Table] {
&self.table_section &self.table_section
} }
@ -256,7 +255,9 @@ impl<'a> TypeInfo<'a> {
} }
pub(crate) fn by_type_index(&self, index: usize) -> (usize, usize) { pub(crate) fn by_type_index(&self, index: usize) -> (usize, usize) {
let Type::Func(ty) = &self.type_list[index]; let Type::Func(ty) = &self.type_list[index] else {
unreachable!("type at func index must be a func type");
};
(ty.params().len(), ty.results().len()) (ty.params().len(), ty.results().len())
} }