Use stack IR when emitting text format (#312)

This commit is contained in:
Daniel Wirtz
2018-11-08 08:04:24 +01:00
committed by GitHub
parent 7135af36bd
commit 2bdc2a72f1
194 changed files with 239934 additions and 340697 deletions

View File

@ -397,9 +397,7 @@ export class Compiler extends DiagnosticEmitter {
: 0;
module.setMemory(
numPages,
this.options.isWasm64
? Module.MAX_MEMORY_WASM64
: Module.MAX_MEMORY_WASM32,
Module.UNLIMITED_MEMORY,
this.memorySegments,
options.target,
"memory"

View File

@ -5,7 +5,9 @@
declare namespace binaryen {
class Module {
constructor(ref: number);
runPasses(passes: string[]): void;
emitText(): string;
emitStackIR(optimize?: boolean): string;
emitAsmjs(): string;
}
}

View File

@ -14,7 +14,7 @@ import "./i64";
import { Module } from "../../module";
Module.prototype.toText = function(this: Module) {
return new binaryen.Module(this.ref).emitText();
return new binaryen.Module(this.ref).emitStackIR();
};
Module.prototype.toAsmjs = function(this: Module) {

View File

@ -239,12 +239,6 @@ export class Module {
private cachedByValue: usize;
/** Maximum number of pages when targeting WASM32. */
static readonly MAX_MEMORY_WASM32: Index = 0xffff;
/** Maximum number of pages when targeting WASM64. */
static readonly MAX_MEMORY_WASM64: Index = 0xffff; // TODO
static create(): Module {
var module = new Module();
module.ref = _BinaryenModuleCreate();
@ -824,6 +818,9 @@ export class Module {
}
}
/** Unlimited memory constant. */
static readonly UNLIMITED_MEMORY: Index = <Index>-1;
setMemory(
initial: Index,
maximum: Index,