Update Binaryen and take care of WebAssembly/binaryen#1547

This commit is contained in:
dcodeIO
2018-05-14 16:55:55 +02:00
parent 5ab81a00a1
commit 6c0a5c47d9
118 changed files with 6852 additions and 6590 deletions

View File

@ -276,7 +276,9 @@ export class Compiler extends DiagnosticEmitter {
if (!options) options = new Options();
this.options = options;
this.memoryOffset = i64_new(
max(options.memoryBase, options.usizeType.byteSize) // leave space for `null`
// leave space for `null`. also functions as a sentinel for erroneous stores at offset 0.
// note that Binaryen's asm.js output utilizes the first 8 bytes for reinterpretations (#1547)
max(options.memoryBase, 8)
);
this.module = Module.create();
}
@ -5079,7 +5081,7 @@ export class Compiler extends DiagnosticEmitter {
let stmt = this.compileStatement(statements[i]);
if (getExpressionId(stmt) != ExpressionId.Nop) {
body.push(stmt);
if (flow.isAny(FlowFlags.BREAKS | FlowFlags.CONTINUES | FlowFlags.RETURNS)) break;
if (flow.is(FlowFlags.RETURNS)) break;
}
}
} else {