Update Binaryen to latest

This commit is contained in:
dcodeIO 2018-11-22 17:15:22 +01:00
parent 21675ec162
commit b723ff3e88
8 changed files with 35 additions and 24 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
package-lock.json generated
View File

@ -549,9 +549,9 @@
"dev": true
},
"binaryen": {
"version": "52.0.0-nightly.20181108",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-52.0.0-nightly.20181108.tgz",
"integrity": "sha512-EPCTNikr5NWz63au0pIrt8snmt+Fv/YERiDD/BQIT9I0jLYB11m/oMuUA5k5kMCLsfTc2w7Sma4jKVu7VR/owA=="
"version": "55.0.0-nightly.20181122",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-55.0.0-nightly.20181122.tgz",
"integrity": "sha512-sgI5FLlZ3RrRKXYfghQhUMBttfkXE41R37r2Agq5hWU3tMGw1xANVvKho8xPNlIdrNtM9jrRVPMt7HQ/236VnQ=="
},
"bluebird": {
"version": "3.5.3",

View File

@ -12,7 +12,7 @@
},
"dependencies": {
"@protobufjs/utf8": "^1.1.0",
"binaryen": "52.0.0-nightly.20181108",
"binaryen": "55.0.0-nightly.20181122",
"glob": "^7.1.3",
"long": "^4.0.0"
},

View File

@ -414,15 +414,15 @@ declare function _BinaryenModuleInterpret(module: BinaryenModuleRef): void;
declare function _BinaryenModuleAddDebugInfoFileName(module: BinaryenModuleRef, filename: usize): BinaryenIndex;
declare function _BinaryenModuleGetDebugInfoFileName(module: BinaryenModuleRef, index: BinaryenIndex): usize;
declare type RelooperRef = usize;
declare type RelooperBlockRef = usize;
declare type BinaryenRelooperRef = usize;
declare type BinaryenRelooperBlockRef = usize;
declare function _RelooperCreate(): RelooperRef;
declare function _RelooperAddBlock(relooper: RelooperRef, code: BinaryenExpressionRef): RelooperBlockRef;
declare function _RelooperAddBranch(from: RelooperBlockRef, to: RelooperBlockRef, condition: BinaryenExpressionRef, code: BinaryenExpressionRef): void;
declare function _RelooperAddBlockWithSwitch(relooper: RelooperRef, code: BinaryenExpressionRef, condition: BinaryenExpressionRef): RelooperBlockRef;
declare function _RelooperAddBranchForSwitch(from: RelooperBlockRef, to: RelooperBlockRef, indexes: usize, numIndexes: BinaryenIndex, code: BinaryenExpressionRef): void;
declare function _RelooperRenderAndDispose(relooper: RelooperRef, entry: RelooperBlockRef, labelHelper: BinaryenIndex, module: BinaryenModuleRef): BinaryenExpressionRef;
declare function _RelooperCreate(module: BinaryenModuleRef): BinaryenRelooperRef;
declare function _RelooperAddBlock(relooper: BinaryenRelooperRef, code: BinaryenExpressionRef): BinaryenRelooperBlockRef;
declare function _RelooperAddBranch(from: BinaryenRelooperBlockRef, to: BinaryenRelooperBlockRef, condition: BinaryenExpressionRef, code: BinaryenExpressionRef): void;
declare function _RelooperAddBlockWithSwitch(relooper: BinaryenRelooperRef, code: BinaryenExpressionRef, condition: BinaryenExpressionRef): BinaryenRelooperBlockRef;
declare function _RelooperAddBranchForSwitch(from: BinaryenRelooperBlockRef, to: BinaryenRelooperBlockRef, indexes: usize, numIndexes: BinaryenIndex, code: BinaryenExpressionRef): void;
declare function _RelooperRenderAndDispose(relooper: BinaryenRelooperRef, entry: BinaryenRelooperBlockRef, labelHelper: BinaryenIndex): BinaryenExpressionRef;
declare function _BinaryenGetOptimizeLevel(): i32;
declare function _BinaryenSetOptimizeLevel(level: i32): void;

View File

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

View File

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

View File

@ -14,6 +14,8 @@ export type ExpressionRef = usize;
export type GlobalRef = usize;
export type ImportRef = usize;
export type ExportRef = usize;
export type RelooperRef = usize;
export type RelooperBlockRef = usize;
export type Index = u32;
export const enum NativeType {
@ -1329,7 +1331,7 @@ export class Relooper {
static create(module: Module): Relooper {
var relooper = new Relooper();
relooper.module = module;
relooper.ref = _RelooperCreate();
relooper.ref = _RelooperCreate(module.ref);
return relooper;
}
@ -1339,7 +1341,12 @@ export class Relooper {
return _RelooperAddBlock(this.ref, code);
}
addBranch(from: RelooperBlockRef, to: RelooperBlockRef, condition: ExpressionRef = 0, code: ExpressionRef = 0): void {
addBranch(
from: RelooperBlockRef,
to: RelooperBlockRef,
condition: ExpressionRef = 0,
code: ExpressionRef = 0
): void {
_RelooperAddBranch(from, to, condition, code);
}
@ -1347,7 +1354,12 @@ export class Relooper {
return _RelooperAddBlockWithSwitch(this.ref, code, condition);
}
addBranchForSwitch(from: RelooperBlockRef, to: RelooperBlockRef, indexes: i32[], code: ExpressionRef = 0): void {
addBranchForSwitch(
from: RelooperBlockRef,
to: RelooperBlockRef,
indexes: i32[],
code: ExpressionRef = 0
): void {
var cArr = allocI32Array(indexes);
try {
_RelooperAddBranchForSwitch(from, to, cArr, indexes.length, code);
@ -1357,7 +1369,7 @@ export class Relooper {
}
renderAndDispose(entry: RelooperBlockRef, labelHelper: Index): ExpressionRef {
return _RelooperRenderAndDispose(this.ref, entry, labelHelper, this.module.ref);
return _RelooperRenderAndDispose(this.ref, entry, labelHelper);
}
}