1
0
mirror of https://github.com/fluencelabs/assemblyscript synced 2025-05-18 10:11:27 +00:00

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

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

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

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

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

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

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