bleeding edge binaryen

This commit is contained in:
dcode 2019-05-23 13:20:10 +02:00
parent 81c212b208
commit fbba76ef2c
76 changed files with 560 additions and 386 deletions

6
package-lock.json generated
View File

@ -567,9 +567,9 @@
"dev": true
},
"binaryen": {
"version": "84.0.0-nightly.20190518",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-84.0.0-nightly.20190518.tgz",
"integrity": "sha512-/AhfZd3bd/yifsaCxM3WRSwT8zg9zl+G7lVWkJtr+JHqUijDoi8RHV7gOkNrOw+CAAGrm8l12KhDmkit1/crWA=="
"version": "84.0.0-nightly.20190522",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-84.0.0-nightly.20190522.tgz",
"integrity": "sha512-bxSPi3MOkFmK5W6VIlqxnOc1nYzpUCzT/tHz3C7sgbz7jTR2lOBlZnKStTJlBt018xeZK9/JpK/jXdduH7eQFg=="
},
"bluebird": {
"version": "3.5.3",

View File

@ -12,7 +12,7 @@
},
"dependencies": {
"@protobufjs/utf8": "^1.1.0",
"binaryen": "84.0.0-nightly.20190518",
"binaryen": "84.0.0-nightly.20190522",
"glob": "^7.1.3",
"long": "^4.0.0",
"opencollective-postinstall": "^2.0.0",

View File

@ -1997,7 +1997,7 @@ export function compileCall(
checkTypeAbsent(typeArguments, reportNode, prototype) |
checkArgsRequired(operands, 0, reportNode, compiler)
) return module.createUnreachable();
return module.createHost(HostOp.CurrentMemory);
return module.createHost(HostOp.MemorySize);
}
case BuiltinSymbols.memory_grow: { // memory.grow(pages: i32) -> i32
compiler.currentType = Type.i32;
@ -2005,7 +2005,7 @@ export function compileCall(
checkTypeAbsent(typeArguments, reportNode, prototype) |
checkArgsRequired(operands, 1, reportNode, compiler)
) return module.createUnreachable();
return module.createHost(HostOp.GrowMemory, null, [
return module.createHost(HostOp.MemoryGrow, null, [
compiler.compileExpression(operands[0], Type.i32, ContextualFlags.IMPLICIT)
]);
}

View File

@ -2173,7 +2173,7 @@ export class Compiler extends DiagnosticEmitter {
// of retaining it as the return value and releasing it as a variable
if (!this.skippedAutoreleases.has(expr)) {
if (returnType.isManaged) {
if (getExpressionId(expr) == ExpressionId.GetLocal) {
if (getExpressionId(expr) == ExpressionId.LocalGet) {
if (flow.isAnyLocalFlag(getGetLocalIndex(expr), LocalFlags.ANY_RETAINED)) {
flow.unsetLocalFlag(getGetLocalIndex(expr), LocalFlags.ANY_RETAINED);
this.skippedAutoreleases.add(expr);
@ -6222,7 +6222,7 @@ export class Compiler extends DiagnosticEmitter {
if (thisArg) {
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
let thisType = assert(instance.signature.thisType);
if (canAlias && getExpressionId(thisArg) == ExpressionId.GetLocal) {
if (canAlias && getExpressionId(thisArg) == ExpressionId.LocalGet) {
flow.addScopedAlias(CommonSymbols.this_, thisType, getGetLocalIndex(thisArg));
let baseInstance = (<Class>classInstance).base;
if (baseInstance) flow.addScopedAlias(CommonSymbols.super_, baseInstance.type, getGetLocalIndex(thisArg));
@ -6244,7 +6244,7 @@ export class Compiler extends DiagnosticEmitter {
for (let i = 0; i < numArguments; ++i) {
let paramExpr = args[i];
let paramType = parameterTypes[i];
if (canAlias && getExpressionId(paramExpr) == ExpressionId.GetLocal) {
if (canAlias && getExpressionId(paramExpr) == ExpressionId.LocalGet) {
flow.addScopedAlias(signature.getParameterName(i), paramType, getGetLocalIndex(paramExpr));
} else {
let argumentLocal = flow.addScopedLocal(
@ -6277,7 +6277,7 @@ export class Compiler extends DiagnosticEmitter {
initType,
ContextualFlags.IMPLICIT
);
if (canAlias && getExpressionId(initExpr) == ExpressionId.GetLocal) {
if (canAlias && getExpressionId(initExpr) == ExpressionId.LocalGet) {
flow.addScopedAlias(signature.getParameterName(i), initType, getGetLocalIndex(initExpr));
} else {
let argumentLocal = flow.addScopedLocal(
@ -6537,7 +6537,7 @@ export class Compiler extends DiagnosticEmitter {
// and a child of something else. Preventing the final release however should
// make it optimize away.
switch (getExpressionId(expr)) {
case ExpressionId.SetLocal: { // local.tee(__retain(expr))
case ExpressionId.LocalSet: { // local.tee(__retain(expr))
if (isTeeLocal(expr)) {
let index = getSetLocalIndex(expr);
if (flow.isAnyLocalFlag(index, LocalFlags.ANY_RETAINED)) {

View File

@ -173,20 +173,20 @@ export class Decompiler {
case ExpressionId.CallIndirect: {
throw new Error("not implemented");
}
case ExpressionId.GetLocal: {
case ExpressionId.LocalGet: {
this.push("$");
this.push(getGetLocalIndex(expr).toString(10));
return;
}
case ExpressionId.SetLocal: {
case ExpressionId.LocalSet: {
this.push("$");
this.push(getSetLocalIndex(expr).toString(10));
this.push(" = ");
this.decompileExpression(getSetLocalValue(expr));
return;
}
case ExpressionId.GetGlobal:
case ExpressionId.SetGlobal: {
case ExpressionId.GlobalGet:
case ExpressionId.GlobalSet: {
throw new Error("not implemented");
}
case ExpressionId.Load: {
@ -832,11 +832,11 @@ export class Decompiler {
}
case ExpressionId.Host: {
switch (getHostOp(expr)) {
case HostOp.CurrentMemory: {
case HostOp.MemorySize: {
this.push("memory.size()");
return;
}
case HostOp.GrowMemory: {
case HostOp.MemoryGrow: {
this.push("memory.grow(");
this.decompileExpression(getHostOperand(expr, 0));
this.push(")");

View File

@ -641,12 +641,12 @@ export class Flow {
// depend on a dynamic nullable state (flag = LocalFlags.NONNULL), while everything else
// has already been handled by the nullable type check above.
switch (getExpressionId(expr)) {
case ExpressionId.SetLocal: {
case ExpressionId.LocalSet: {
if (!isTeeLocal(expr)) break;
let local = this.parentFunction.localsByIndex[getSetLocalIndex(expr)];
return !local.type.is(TypeFlags.NULLABLE) || this.isLocalFlag(local.index, LocalFlags.NONNULL, false);
}
case ExpressionId.GetLocal: {
case ExpressionId.LocalGet: {
let local = this.parentFunction.localsByIndex[getGetLocalIndex(expr)];
return !local.type.is(TypeFlags.NULLABLE) || this.isLocalFlag(local.index, LocalFlags.NONNULL, false);
}
@ -658,14 +658,14 @@ export class Flow {
inheritNonnullIfTrue(expr: ExpressionRef): void {
// A: `expr` is true-ish -> Q: how did that happen?
switch (getExpressionId(expr)) {
case ExpressionId.SetLocal: {
case ExpressionId.LocalSet: {
if (!isTeeLocal(expr)) break;
let local = this.parentFunction.localsByIndex[getSetLocalIndex(expr)];
this.setLocalFlag(local.index, LocalFlags.NONNULL);
this.inheritNonnullIfTrue(getSetLocalValue(expr)); // must have been true-ish as well
break;
}
case ExpressionId.GetLocal: {
case ExpressionId.LocalGet: {
let local = this.parentFunction.localsByIndex[getGetLocalIndex(expr)];
this.setLocalFlag(local.index, LocalFlags.NONNULL);
break;
@ -854,20 +854,20 @@ export class Flow {
switch (getExpressionId(expr)) {
// overflows if the local isn't wrapped or the conversion does
case ExpressionId.GetLocal: {
case ExpressionId.LocalGet: {
let local = this.parentFunction.localsByIndex[getGetLocalIndex(expr)];
return !this.isLocalFlag(local.index, LocalFlags.WRAPPED, true)
|| canConversionOverflow(local.type, type);
}
// overflows if the value does
case ExpressionId.SetLocal: { // tee
case ExpressionId.LocalSet: { // tee
assert(isTeeLocal(expr));
return this.canOverflow(getSetLocalValue(expr), type);
}
// overflows if the conversion does (globals are wrapped on set)
case ExpressionId.GetGlobal: {
case ExpressionId.GlobalGet: {
// TODO: this is inefficient because it has to read a string
let global = assert(this.parentFunction.program.elementsByName.get(assert(getGetGlobalName(expr))));
assert(global.kind == ElementKind.GLOBAL);

View File

@ -42,10 +42,10 @@ declare function _BinaryenBreakId(): BinaryenExpressionId;
declare function _BinaryenSwitchId(): BinaryenExpressionId;
declare function _BinaryenCallId(): BinaryenExpressionId;
declare function _BinaryenCallIndirectId(): BinaryenExpressionId;
declare function _BinaryenGetLocalId(): BinaryenExpressionId;
declare function _BinaryenSetLocalId(): BinaryenExpressionId;
declare function _BinaryenGetGlobalId(): BinaryenExpressionId;
declare function _BinaryenSetGlobalId(): BinaryenExpressionId;
declare function _BinaryenLocalGetId(): BinaryenExpressionId;
declare function _BinaryenLocalSetId(): BinaryenExpressionId;
declare function _BinaryenGlobalGetId(): BinaryenExpressionId;
declare function _BinaryenGlobalSetId(): BinaryenExpressionId;
declare function _BinaryenLoadId(): BinaryenExpressionId;
declare function _BinaryenStoreId(): BinaryenExpressionId;
declare function _BinaryenConstId(): BinaryenExpressionId;
@ -221,8 +221,8 @@ declare function _BinaryenGeFloat64(): BinaryenOp;
declare type BinaryenHostOp = BinaryenOp;
declare function _BinaryenCurrentMemory(): BinaryenHostOp;
declare function _BinaryenGrowMemory(): BinaryenHostOp;
declare function _BinaryenMemorySize(): BinaryenHostOp;
declare function _BinaryenMemoryGrow(): BinaryenHostOp;
declare type BinaryenAtomicRMWOp = BinaryenOp;
@ -380,11 +380,11 @@ declare function _BinaryenBreak(module: BinaryenModuleRef, name: usize, conditio
declare function _BinaryenSwitch(module: BinaryenModuleRef, names: usize, numNames: BinaryenIndex, defaultName: usize, condition: BinaryenExpressionRef, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenCall(module: BinaryenModuleRef, target: usize, operands: usize, numOperands: BinaryenIndex, returnType: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenCallIndirect(module: BinaryenModuleRef, target: BinaryenExpressionRef, operands: usize, numOperands: BinaryenIndex, type: usize): BinaryenExpressionRef;
declare function _BinaryenGetLocal(module: BinaryenModuleRef, index: BinaryenIndex, type: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenSetLocal(module: BinaryenModuleRef, index: BinaryenIndex, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenTeeLocal(module: BinaryenModuleRef, index: BinaryenIndex, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenGetGlobal(module: BinaryenModuleRef, name: usize, type: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenSetGlobal(module: BinaryenModuleRef, name: usize, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenLocalGet(module: BinaryenModuleRef, index: BinaryenIndex, type: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenLocalSet(module: BinaryenModuleRef, index: BinaryenIndex, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenLocalTee(module: BinaryenModuleRef, index: BinaryenIndex, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenGlobalGet(module: BinaryenModuleRef, name: usize, type: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenGlobalSet(module: BinaryenModuleRef, name: usize, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenLoad(module: BinaryenModuleRef, bytes: u32, signed: i8, offset: u32, align: u32, type: BinaryenType, ptr: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenStore(module: BinaryenModuleRef, bytes: u32, offset: u32, align: u32, ptr: BinaryenExpressionRef, value: BinaryenExpressionRef, type: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenConst(module: BinaryenModuleRef, value: usize): BinaryenExpressionRef;
@ -448,16 +448,16 @@ declare function _BinaryenCallIndirectGetTarget(expr: BinaryenExpressionRef): Bi
declare function _BinaryenCallIndirectGetNumOperands(expr: BinaryenExpressionRef): BinaryenIndex;
declare function _BinaryenCallIndirectGetOperand(expr: BinaryenExpressionRef, index: BinaryenIndex): BinaryenExpressionRef;
declare function _BinaryenGetLocalGetIndex(expr: BinaryenExpressionRef): BinaryenIndex;
declare function _BinaryenLocalGetGetIndex(expr: BinaryenExpressionRef): BinaryenIndex;
declare function _BinaryenSetLocalIsTee(expr: BinaryenExpressionRef): bool;
declare function _BinaryenSetLocalGetIndex(expr: BinaryenExpressionRef): BinaryenIndex;
declare function _BinaryenSetLocalGetValue(expr: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenLocalSetIsTee(expr: BinaryenExpressionRef): bool;
declare function _BinaryenLocalSetGetIndex(expr: BinaryenExpressionRef): BinaryenIndex;
declare function _BinaryenLocalSetGetValue(expr: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenGetGlobalGetName(expr: BinaryenExpressionRef): usize;
declare function _BinaryenGlobalGetGetName(expr: BinaryenExpressionRef): usize;
declare function _BinaryenSetGlobalGetName(expr: BinaryenExpressionRef): usize;
declare function _BinaryenSetGlobalGetValue(expr: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenGlobalSetGetName(expr: BinaryenExpressionRef): usize;
declare function _BinaryenGlobalSetGetValue(expr: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenHostGetOp(expr: BinaryenExpressionRef): BinaryenOp;
declare function _BinaryenHostGetNameOperand(expr: BinaryenExpressionRef): usize;
@ -622,8 +622,8 @@ declare function _BinaryenModuleRead(input: usize, inputSize: usize): BinaryenMo
declare function _BinaryenModuleInterpret(module: BinaryenModuleRef): void;
declare function _BinaryenModuleAddDebugInfoFileName(module: BinaryenModuleRef, filename: usize): BinaryenIndex;
declare function _BinaryenModuleGetDebugInfoFileName(module: BinaryenModuleRef, index: BinaryenIndex): usize;
declare function _BinaryenGetFeatures(module: BinaryenModuleRef): BinaryenFeatureFlags;
declare function _BinaryenSetFeatures(module: BinaryenModuleRef, featureFlags: BinaryenFeatureFlags): void;
declare function _BinaryenModuleGetFeatures(module: BinaryenModuleRef): BinaryenFeatureFlags;
declare function _BinaryenModuleSetFeatures(module: BinaryenModuleRef, featureFlags: BinaryenFeatureFlags): void;
declare type BinaryenRelooperRef = usize;
declare type BinaryenRelooperBlockRef = usize;

View File

@ -46,10 +46,10 @@ export enum ExpressionId {
Switch = _BinaryenSwitchId(),
Call = _BinaryenCallId(),
CallIndirect = _BinaryenCallIndirectId(),
GetLocal = _BinaryenGetLocalId(),
SetLocal = _BinaryenSetLocalId(),
GetGlobal = _BinaryenGetGlobalId(),
SetGlobal = _BinaryenSetGlobalId(),
LocalGet = _BinaryenLocalGetId(),
LocalSet = _BinaryenLocalSetId(),
GlobalGet = _BinaryenGlobalGetId(),
GlobalSet = _BinaryenGlobalSetId(),
Load = _BinaryenLoadId(),
Store = _BinaryenStoreId(),
Const = _BinaryenConstId(),
@ -336,8 +336,8 @@ export enum BinaryOp {
}
export enum HostOp {
CurrentMemory = _BinaryenCurrentMemory(),
GrowMemory = _BinaryenGrowMemory(),
MemorySize = _BinaryenMemorySize(),
MemoryGrow = _BinaryenMemoryGrow(),
}
export enum AtomicRMWOp {
@ -526,14 +526,14 @@ export class Module {
index: i32,
type: NativeType
): ExpressionRef {
return _BinaryenGetLocal(this.ref, index, type);
return _BinaryenLocalGet(this.ref, index, type);
}
createTeeLocal(
index: i32,
value: ExpressionRef
): ExpressionRef {
return _BinaryenTeeLocal(this.ref, index, value);
return _BinaryenLocalTee(this.ref, index, value);
}
createGetGlobal(
@ -541,7 +541,7 @@ export class Module {
type: NativeType
): ExpressionRef {
var cStr = this.allocStringCached(name);
return _BinaryenGetGlobal(this.ref, cStr, type);
return _BinaryenGlobalGet(this.ref, cStr, type);
}
createLoad(
@ -630,7 +630,7 @@ export class Module {
index: Index,
value: ExpressionRef
): ExpressionRef {
return _BinaryenSetLocal(this.ref, index, value);
return _BinaryenLocalSet(this.ref, index, value);
}
createSetGlobal(
@ -638,7 +638,7 @@ export class Module {
value: ExpressionRef
): ExpressionRef {
var cStr = this.allocStringCached(name);
return _BinaryenSetGlobal(this.ref, cStr, value);
return _BinaryenGlobalSet(this.ref, cStr, value);
}
createBlock(
@ -1056,11 +1056,11 @@ export class Module {
}
getFeatures(): BinaryenFeatureFlags {
return _BinaryenGetFeatures(this.ref);
return _BinaryenModuleGetFeatures(this.ref);
}
setFeatures(featureFlags: BinaryenFeatureFlags): void {
_BinaryenSetFeatures(this.ref, featureFlags);
_BinaryenModuleSetFeatures(this.ref, featureFlags);
}
optimize(func: FunctionRef = 0): void {
@ -1221,16 +1221,16 @@ export class Module {
}
}
}
case ExpressionId.GetLocal: {
return _BinaryenGetLocal(this.ref,
_BinaryenGetLocalGetIndex(expr),
case ExpressionId.LocalGet: {
return _BinaryenLocalGet(this.ref,
_BinaryenLocalGetGetIndex(expr),
_BinaryenExpressionGetType(expr)
);
}
case ExpressionId.GetGlobal: {
let globalName = _BinaryenGetGlobalGetName(expr);
case ExpressionId.GlobalGet: {
let globalName = _BinaryenGlobalGetGetName(expr);
if (!globalName) break;
return _BinaryenGetGlobal(this.ref, globalName, _BinaryenExpressionGetType(expr));
return _BinaryenGlobalGet(this.ref, globalName, _BinaryenExpressionGetType(expr));
}
case ExpressionId.Load: {
if (!(nested1 = this.cloneExpression(_BinaryenLoadGetPtr(expr), noSideEffects, maxDepth))) {
@ -1330,23 +1330,23 @@ export function getConstValueF64(expr: ExpressionRef): f32 {
}
export function getGetLocalIndex(expr: ExpressionRef): Index {
return _BinaryenGetLocalGetIndex(expr);
return _BinaryenLocalGetGetIndex(expr);
}
export function getSetLocalIndex(expr: ExpressionRef): Index {
return _BinaryenSetLocalGetIndex(expr);
return _BinaryenLocalSetGetIndex(expr);
}
export function getSetLocalValue(expr: ExpressionRef): ExpressionRef {
return _BinaryenSetLocalGetValue(expr);
return _BinaryenLocalSetGetValue(expr);
}
export function isTeeLocal(expr: ExpressionRef): bool {
return _BinaryenSetLocalIsTee(expr);
return _BinaryenLocalSetIsTee(expr);
}
export function getGetGlobalName(expr: ExpressionRef): string | null {
return readString(_BinaryenGetGlobalGetName(expr));
return readString(_BinaryenGlobalGetGetName(expr));
}
export function getBinaryOp(expr: ExpressionRef): BinaryOp {
@ -1790,3 +1790,177 @@ export function needsExplicitUnreachable(expr: ExpressionRef): bool {
}
return true;
}
/** Traverses all expression members of an expression, calling the given visitor. */
export function traverse(expr: ExpressionRef, visit: (expr: ExpressionRef) => bool): bool {
switch (getExpressionId(expr)) {
case ExpressionId.Block: {
for (let i = 0, n = _BinaryenBlockGetNumChildren(expr); i < n; ++i) {
if (!visit(_BinaryenBlockGetChild(expr, i))) return false;
}
break;
}
case ExpressionId.If: {
if (!visit(_BinaryenIfGetCondition(expr))) return false;
if (!visit(_BinaryenIfGetIfTrue(expr))) return false;
let ifFalse = _BinaryenIfGetIfFalse(expr);
if (ifFalse) if (!visit(ifFalse)) return false;
break;
}
case ExpressionId.Loop: {
if (!visit(_BinaryenLoopGetBody(expr))) return false;
break;
}
case ExpressionId.Break: {
let condition = _BinaryenBreakGetCondition(expr);
if (condition) if (!visit(condition)) return false;
break;
}
case ExpressionId.Switch: {
if (!visit(_BinaryenSwitchGetCondition(expr))) return false;
break;
}
case ExpressionId.Call: {
for (let i = 0, n = _BinaryenCallGetNumOperands(expr); i < n; ++i) {
if (!visit(_BinaryenCallGetOperand(expr, i))) return false;
}
break;
}
case ExpressionId.CallIndirect: {
for (let i = 0, n = _BinaryenCallIndirectGetNumOperands(expr); i < n; ++i) {
if (!visit(_BinaryenCallIndirectGetOperand(expr, i))) return false;
}
break;
}
case ExpressionId.LocalGet: {
break;
}
case ExpressionId.LocalSet: {
if (!visit(_BinaryenLocalSetGetValue(expr))) return false;
break;
}
case ExpressionId.GlobalGet: {
break;
}
case ExpressionId.GlobalSet: {
if (!visit(_BinaryenGlobalSetGetValue(expr))) return false;
break;
}
case ExpressionId.Load: {
if (!visit(_BinaryenLoadGetPtr(expr))) return false;
break;
}
case ExpressionId.Store: {
if (!visit(_BinaryenStoreGetPtr(expr))) return false;
if (!visit(_BinaryenStoreGetValue(expr))) return false;
break;
}
case ExpressionId.AtomicRMW: {
if (!visit(_BinaryenAtomicRMWGetPtr(expr))) return false;
if (!visit(_BinaryenAtomicRMWGetValue(expr))) return false;
break;
}
case ExpressionId.AtomicCmpxchg: {
if (!visit(_BinaryenAtomicCmpxchgGetPtr(expr))) return false;
if (!visit(_BinaryenAtomicCmpxchgGetExpected(expr))) return false;
if (!visit(_BinaryenAtomicCmpxchgGetReplacement(expr))) return false;
break;
}
case ExpressionId.AtomicWait: {
if (!visit(_BinaryenAtomicWaitGetPtr(expr))) return false;
if (!visit(_BinaryenAtomicWaitGetExpected(expr))) return false;
if (!visit(_BinaryenAtomicWaitGetTimeout(expr))) return false;
break;
}
case ExpressionId.AtomicNotify: {
if (!visit(_BinaryenAtomicNotifyGetPtr(expr))) return false;
break;
}
case ExpressionId.SIMDExtract: {
if (!visit(_BinaryenSIMDExtractGetVec(expr))) return false;
break;
}
case ExpressionId.SIMDReplace: {
if (!visit(_BinaryenSIMDReplaceGetVec(expr))) return false;
if (!visit(_BinaryenSIMDReplaceGetValue(expr))) return false;
break;
}
case ExpressionId.SIMDShuffle: {
if (!visit(_BinaryenSIMDShuffleGetLeft(expr))) return false;
if (!visit(_BinaryenSIMDShuffleGetRight(expr))) return false;
break;
}
case ExpressionId.SIMDBitselect: {
if (!visit(_BinaryenSIMDBitselectGetLeft(expr))) return false;
if (!visit(_BinaryenSIMDBitselectGetRight(expr))) return false;
if (!visit(_BinaryenSIMDBitselectGetCond(expr))) return false;
break;
}
case ExpressionId.SIMDShift: {
if (!visit(_BinaryenSIMDShiftGetVec(expr))) return false;
if (!visit(_BinaryenSIMDShiftGetShift(expr))) return false;
break;
}
case ExpressionId.MemoryInit: {
if (!visit(_BinaryenMemoryInitGetDest(expr))) return false;
if (!visit(_BinaryenMemoryInitGetOffset(expr))) return false;
if (!visit(_BinaryenMemoryInitGetSize(expr))) return false;
break;
}
case ExpressionId.DataDrop: {
break;
}
case ExpressionId.MemoryCopy: {
if (!visit(_BinaryenMemoryCopyGetDest(expr))) return false;
if (!visit(_BinaryenMemoryCopyGetSource(expr))) return false;
if (!visit(_BinaryenMemoryCopyGetSize(expr))) return false;
break;
}
case ExpressionId.MemoryFill: {
if (!visit(_BinaryenMemoryFillGetDest(expr))) return false;
if (!visit(_BinaryenMemoryFillGetValue(expr))) return false;
if (!visit(_BinaryenMemoryFillGetSize(expr))) return false;
break;
}
case ExpressionId.Const: {
break;
}
case ExpressionId.Unary: {
if (!visit(_BinaryenUnaryGetValue(expr))) return false;
break;
}
case ExpressionId.Binary: {
if (!visit(_BinaryenBinaryGetLeft(expr))) return false;
if (!visit(_BinaryenBinaryGetRight(expr))) return false;
break;
}
case ExpressionId.Select: {
if (!visit(_BinaryenSelectGetIfTrue(expr))) return false;
if (!visit(_BinaryenSelectGetIfFalse(expr))) return false;
if (!visit(_BinaryenSelectGetCondition(expr))) return false;
break;
}
case ExpressionId.Drop: {
if (!visit(_BinaryenDropGetValue(expr))) return false;
break;
}
case ExpressionId.Return: {
if (!visit(_BinaryenReturnGetValue(expr))) return false;
break;
}
case ExpressionId.Host: {
for (let i = 0, n = _BinaryenHostGetNumOperands(expr); i < n; ++i) {
if (!visit(_BinaryenHostGetOperand(expr, i))) return false;
}
break;
}
case ExpressionId.Nop: {
break;
}
case ExpressionId.Unreachable: {
break;
}
default: assert(false);
}
return true;
}

View File

@ -347,15 +347,15 @@
global.set $builtins/I
f64.const 1.24e-322
global.set $builtins/F
current_memory
memory.size
drop
i32.const 1
grow_memory
memory.grow
drop
current_memory
memory.size
global.set $builtins/s
i32.const 1
grow_memory
memory.grow
global.set $builtins/s
i32.const 10
global.set $builtins/i

View File

@ -1215,15 +1215,15 @@
i64.const 25
f64.reinterpret_i64
global.set $builtins/F
current_memory
memory.size
drop
i32.const 1
grow_memory
memory.grow
drop
current_memory
memory.size
global.set $builtins/s
i32.const 1
grow_memory
memory.grow
global.set $builtins/s
i32.const 10
i32.const 20

View File

@ -38,7 +38,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -59,12 +59,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -49,7 +49,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -79,12 +79,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -44,7 +44,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -65,12 +65,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -56,7 +56,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -86,12 +86,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -74,7 +74,7 @@
i32.const -16
i32.and
local.tee $1
current_memory
memory.size
local.tee $3
i32.const 16
i32.shl
@ -95,12 +95,12 @@
local.get $4
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -103,7 +103,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -133,12 +133,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -24,7 +24,7 @@
i32.const -16
i32.and
local.tee $0
current_memory
memory.size
local.tee $2
i32.const 16
i32.shl
@ -45,12 +45,12 @@
local.get $3
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -49,7 +49,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -79,12 +79,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -64,7 +64,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -85,12 +85,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -328,7 +328,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -358,12 +358,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -124,7 +124,7 @@
i32.const -16
i32.and
local.tee $1
current_memory
memory.size
local.tee $3
i32.const 16
i32.shl
@ -145,12 +145,12 @@
local.get $4
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -168,7 +168,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -198,12 +198,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -22,7 +22,7 @@
i32.const -16
i32.and
local.tee $1
current_memory
memory.size
local.tee $3
i32.const 16
i32.shl
@ -43,12 +43,12 @@
local.get $4
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -55,7 +55,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -85,12 +85,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -640,14 +640,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -712,7 +712,7 @@
end
i32.const 304
i32.const 1888
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -876,7 +876,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -890,12 +890,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -906,7 +906,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -904,7 +904,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -925,7 +925,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -1030,7 +1030,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1265,7 +1265,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1287,19 +1287,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -692,14 +692,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -764,7 +764,7 @@
end
i32.const 320
i32.const 1904
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -928,7 +928,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -942,12 +942,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -958,7 +958,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -898,7 +898,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -919,7 +919,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -1024,7 +1024,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1259,7 +1259,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1281,19 +1281,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -594,14 +594,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -666,7 +666,7 @@
end
i32.const 304
i32.const 1888
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -830,7 +830,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -844,12 +844,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -860,7 +860,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -783,7 +783,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -804,7 +804,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -909,7 +909,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1144,7 +1144,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1166,19 +1166,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -594,14 +594,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -666,7 +666,7 @@
end
i32.const 304
i32.const 1888
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -830,7 +830,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -844,12 +844,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -860,7 +860,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -783,7 +783,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -804,7 +804,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -909,7 +909,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1144,7 +1144,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1166,19 +1166,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -598,14 +598,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -670,7 +670,7 @@
end
i32.const 304
i32.const 1888
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -834,7 +834,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -848,12 +848,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -864,7 +864,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -787,7 +787,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -808,7 +808,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -913,7 +913,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1148,7 +1148,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1170,19 +1170,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -596,14 +596,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -668,7 +668,7 @@
end
i32.const 304
i32.const 1888
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -832,7 +832,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -846,12 +846,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -862,7 +862,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -785,7 +785,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -806,7 +806,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -911,7 +911,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1146,7 +1146,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1168,19 +1168,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -604,14 +604,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -676,7 +676,7 @@
end
i32.const 736
i32.const 2320
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -840,7 +840,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -854,12 +854,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -870,7 +870,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -792,7 +792,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -813,7 +813,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -918,7 +918,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1153,7 +1153,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1175,19 +1175,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -80,7 +80,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -101,12 +101,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -89,7 +89,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -119,12 +119,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -36,7 +36,7 @@
i32.const -16
i32.and
local.tee $1
current_memory
memory.size
local.tee $3
i32.const 16
i32.shl
@ -57,12 +57,12 @@
local.get $4
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -60,7 +60,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -90,12 +90,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -597,14 +597,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -669,7 +669,7 @@
end
i32.const 288
i32.const 1872
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -833,7 +833,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -847,12 +847,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -863,7 +863,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -785,7 +785,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -806,7 +806,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -911,7 +911,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1146,7 +1146,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1168,19 +1168,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -49,7 +49,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -70,12 +70,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -61,7 +61,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -91,12 +91,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -649,14 +649,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -721,7 +721,7 @@
end
i32.const 608
i32.const 2192
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -885,7 +885,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -899,12 +899,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -915,7 +915,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -862,7 +862,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -883,7 +883,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -988,7 +988,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1223,7 +1223,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1245,19 +1245,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -810,14 +810,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -882,7 +882,7 @@
end
i32.const 7920
i32.const 9504
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1046,7 +1046,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -1060,12 +1060,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -1076,7 +1076,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -999,7 +999,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -1020,7 +1020,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -1125,7 +1125,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1360,7 +1360,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1382,19 +1382,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -49,7 +49,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -70,12 +70,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -60,7 +60,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -90,12 +90,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -55,7 +55,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -76,12 +76,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -67,7 +67,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -97,12 +97,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -29,7 +29,7 @@
i32.const -16
i32.and
local.tee $0
current_memory
memory.size
local.tee $2
i32.const 16
i32.shl
@ -50,12 +50,12 @@
local.get $3
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -57,7 +57,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -87,12 +87,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -610,14 +610,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -682,7 +682,7 @@
end
i32.const 512
i32.const 2096
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -846,7 +846,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -860,12 +860,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -876,7 +876,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -794,7 +794,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -815,7 +815,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -920,7 +920,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1155,7 +1155,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1177,19 +1177,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -21,7 +21,7 @@
i32.const -16
i32.and
local.tee $0
current_memory
memory.size
local.tee $2
i32.const 16
i32.shl
@ -42,12 +42,12 @@
local.get $3
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -48,7 +48,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -78,12 +78,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -39,7 +39,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -60,12 +60,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -51,7 +51,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -81,12 +81,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -92,7 +92,7 @@
i32.const -16
i32.and
local.tee $1
current_memory
memory.size
local.tee $3
i32.const 16
i32.shl
@ -113,12 +113,12 @@
local.get $4
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -119,7 +119,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -149,12 +149,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -607,14 +607,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -679,7 +679,7 @@
end
i32.const 512
i32.const 2096
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -843,7 +843,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -857,12 +857,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -873,7 +873,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -794,7 +794,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -815,7 +815,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -920,7 +920,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1155,7 +1155,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1177,19 +1177,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -77,7 +77,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -98,12 +98,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -102,7 +102,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -132,12 +132,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -151,7 +151,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -172,12 +172,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -177,7 +177,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -207,12 +207,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -860,14 +860,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -932,7 +932,7 @@
end
i32.const 7024
i32.const 8608
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1096,7 +1096,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -1110,12 +1110,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -1126,7 +1126,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -1100,7 +1100,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -1121,7 +1121,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -1226,7 +1226,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1461,7 +1461,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1483,19 +1483,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2

View File

@ -77,7 +77,7 @@
i32.const -16
i32.and
local.tee $2
current_memory
memory.size
local.tee $4
i32.const 16
i32.shl
@ -98,12 +98,12 @@
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -122,7 +122,7 @@
i32.xor
i32.and
local.set $5
current_memory
memory.size
local.set $6
local.get $5
local.get $6
@ -152,12 +152,12 @@
select
local.set $4
local.get $4
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if

View File

@ -657,14 +657,14 @@
(local $0 i32)
(local $1 i32)
i32.const 1
current_memory
memory.size
local.tee $0
i32.gt_s
if (result i32)
i32.const 1
local.get $0
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -729,7 +729,7 @@
end
i32.const 1824
i32.const 3408
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -893,7 +893,7 @@
)
(func $~lib/rt/tlsf/growMemory (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
current_memory
memory.size
local.tee $2
local.get $1
i32.const 65535
@ -907,12 +907,12 @@
local.get $1
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $1
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
@ -923,7 +923,7 @@
local.get $2
i32.const 16
i32.shl
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory

View File

@ -857,7 +857,7 @@
i32.xor
i32.and
local.set $0
current_memory
memory.size
local.set $1
local.get $0
i32.const 1572
@ -878,7 +878,7 @@
local.get $2
local.get $1
i32.sub
grow_memory
memory.grow
i32.const 0
i32.lt_s
else
@ -983,7 +983,7 @@
i32.const -1
i32.xor
i32.and
current_memory
memory.size
i32.const 16
i32.shl
call $~lib/rt/tlsf/addMemory
@ -1218,7 +1218,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
current_memory
memory.size
local.set $2
local.get $1
i32.const 65535
@ -1240,19 +1240,19 @@
select
local.set $6
local.get $6
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
unreachable
end
end
current_memory
memory.size
local.set $7
local.get $0
local.get $2