aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/wasm.zig
diff options
context:
space:
mode:
authorLuuk de Gram <Luukdegram@users.noreply.github.com>2021-02-04 21:08:19 +0100
committerLuuk de Gram <Luukdegram@users.noreply.github.com>2021-02-05 18:06:25 +0100
commit36df6a008fb009fd8fd1d3362fc850cf97723dcd (patch)
tree801a88c25477032a96f23f60506c1a6e6d16aaba /src/codegen/wasm.zig
parentaa3e0ff454d06407b4ee347c1cd0c1e09444c52c (diff)
downloadzig-36df6a008fb009fd8fd1d3362fc850cf97723dcd.tar.gz
zig-36df6a008fb009fd8fd1d3362fc850cf97723dcd.zip
Ensure function indices are correct and fix a memory leak
Diffstat (limited to 'src/codegen/wasm.zig')
-rw-r--r--src/codegen/wasm.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig
index 5be26de7cb..34e0b2f9b5 100644
--- a/src/codegen/wasm.zig
+++ b/src/codegen/wasm.zig
@@ -161,7 +161,6 @@ pub const Context = struct {
pub fn gen(self: *Context) InnerError!void {
assert(self.code.items.len == 0);
try self.genFunctype();
- const writer = self.code.writer();
// Write instructions
// TODO: check for and handle death of instructions
@@ -194,6 +193,7 @@ pub const Context = struct {
}
}
+ const writer = self.code.writer();
try writer.writeByte(wasm.opcode(.end));
// Fill in the size of the generated code to the reserved space at the