tackle unreachables

suspend compilation on break, optimize stack ir, detect fallthrough instead of terminate
This commit is contained in:
dcode
2019-06-10 08:54:41 +02:00
parent 56dbe77a04
commit 3f35a9209f
92 changed files with 42247 additions and 54227 deletions

View File

@ -14,7 +14,11 @@ import "./i64";
import { Module } from "../../module";
Module.prototype.toText = function(this: Module) {
return binaryen.wrapModule(this.ref).emitStackIR();
// NOTE: Conversion to StackIR can yield conversion artifacts like sequences
// of unreachable statements not actually emitted by the compiler. Optimizing
// StackIR removes these again, but may also suppress useless code emitted by
// the compiler that's then no longer visible in tests. Both not ideal.
return binaryen.wrapModule(this.ref).emitStackIR(/* optimize-stack-ir */ true);
};
Module.prototype.toAsmjs = function(this: Module) {