diff --git a/Cargo.toml b/Cargo.toml index 269d9c9..d148cc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wagen" -version = "0.1.0" +version = "0.2.0" edition = "2021" repository = "https://github.com/dylibso/wagen" license = "BSD-3-Clause" @@ -8,7 +8,7 @@ description = "A library to help generate WebAssembly" [dependencies] anyhow = "1.0.71" -wasm-encoder = {version = "0.202.0", features = ["wasmparser"]} +wasm-encoder = {version = "0.203.0", features = ["wasmparser"]} wasmparser = {version = "0.203.0"} extism-manifest = {version = "1", optional = true} extism = {version = "1", optional = true} diff --git a/examples/gc.rs b/examples/gc.rs index 7c03bc3..10141e9 100644 --- a/examples/gc.rs +++ b/examples/gc.rs @@ -30,30 +30,30 @@ impl<'a> Expr<'a> for Add { fn expr(self, builder: &mut Builder<'a>) { builder.push([ // Set a field - Instr::LocalGet(0), - Instr::LocalGet(0), + Instr::LocalGet(self.0.index()), + Instr::LocalGet(self.0.index()), Instr::StructGet { - struct_type_index: self.0.index(), + struct_type_index: self.2.index(), field_index: 0, }, - Instr::LocalGet(1), + Instr::LocalGet(self.1.index()), Instr::StructGet { - struct_type_index: self.0.index(), + struct_type_index: self.2.index(), field_index: 0, }, Instr::I32Add, Instr::StructSet { - struct_type_index: self.0.index(), + struct_type_index: self.2.index(), field_index: 0, }, // Set b field - Instr::LocalGet(0), - Instr::LocalGet(0), + Instr::LocalGet(self.0.index()), + Instr::LocalGet(self.0.index()), Instr::StructGet { struct_type_index: self.0.index(), field_index: 1, }, - Instr::LocalGet(1), + Instr::LocalGet(self.1.index()), Instr::StructGet { struct_type_index: self.0.index(), field_index: 1, diff --git a/examples/hello.rs b/examples/hello.rs index a91ad71..96ac758 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -5,6 +5,7 @@ fn main() { let extism = module.link_extism(); module.memory(MemoryType { + page_size_log2: None, minimum: 1, maximum: None, memory64: false, diff --git a/src/lib.rs b/src/lib.rs index 887b65a..5ce3344 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -234,10 +234,12 @@ impl<'a> Module<'a> { name: impl AsRef, ty: ValType, mutable: bool, + shared: bool, init: &ConstExpr, ) -> &mut Global { self.globals.global( wasm_encoder::GlobalType { + shared, val_type: ty, mutable, },