stage2/wasm: write exports on flush, cleanup

Exports now have a dirty flag and are rewritten on flush if this flag
has been set.

A couple other minor changes have been made based on Andrew's review.
This commit is contained in:
Isaac Freund
2020-08-16 02:21:20 +02:00
parent 97300896ed
commit 60fb50ee5a
5 changed files with 42 additions and 35 deletions

View File

@@ -52,7 +52,7 @@ pub fn genCode(buf: *ArrayList(u8), decl: *Decl) !void {
const writer = buf.writer();
// Reserve space to write the size after generating the code
try writer.writeAll(&([1]u8{undefined} ** 5));
try buf.resize(5);
// Write the size of the locals vec
// TODO: implement locals