From fbba76ef2cef31e5487d3257fd6e62b221ce4efd Mon Sep 17 00:00:00 2001 From: dcode Date: Thu, 23 May 2019 13:20:10 +0200 Subject: [PATCH] bleeding edge binaryen --- package-lock.json | 6 +- package.json | 2 +- src/builtins.ts | 4 +- src/compiler.ts | 10 +- src/decompiler.ts | 12 +- src/flow.ts | 14 +- src/glue/binaryen.d.ts | 40 ++-- src/module.ts | 222 ++++++++++++++++-- tests/compiler/builtins.optimized.wat | 8 +- tests/compiler/builtins.untouched.wat | 8 +- tests/compiler/call-super.optimized.wat | 6 +- tests/compiler/call-super.untouched.wat | 6 +- tests/compiler/constructor.optimized.wat | 6 +- tests/compiler/constructor.untouched.wat | 6 +- tests/compiler/exports.optimized.wat | 6 +- tests/compiler/exports.untouched.wat | 6 +- tests/compiler/getter-call.optimized.wat | 6 +- tests/compiler/getter-call.untouched.wat | 6 +- tests/compiler/inlining.optimized.wat | 6 +- tests/compiler/inlining.untouched.wat | 6 +- tests/compiler/number.optimized.wat | 6 +- tests/compiler/number.untouched.wat | 6 +- .../optional-typeparameters.optimized.wat | 6 +- .../optional-typeparameters.untouched.wat | 6 +- tests/compiler/rc/global-init.optimized.wat | 14 +- tests/compiler/rc/global-init.untouched.wat | 14 +- tests/compiler/rc/local-init.optimized.wat | 14 +- tests/compiler/rc/local-init.untouched.wat | 14 +- .../rc/logical-and-mismatch.optimized.wat | 14 +- .../rc/logical-and-mismatch.untouched.wat | 14 +- .../rc/logical-or-mismatch.optimized.wat | 14 +- .../rc/logical-or-mismatch.untouched.wat | 14 +- tests/compiler/rc/rereturn.optimized.wat | 14 +- tests/compiler/rc/rereturn.untouched.wat | 14 +- .../rc/ternary-mismatch.optimized.wat | 14 +- .../rc/ternary-mismatch.untouched.wat | 14 +- .../retain-release-sanity.optimized.wat | 14 +- .../retain-release-sanity.untouched.wat | 14 +- tests/compiler/retain-release.optimized.wat | 6 +- tests/compiler/retain-release.untouched.wat | 6 +- tests/compiler/rt/instanceof.optimized.wat | 6 +- tests/compiler/rt/instanceof.untouched.wat | 6 +- tests/compiler/runtime-full.optimized.wat | 14 +- tests/compiler/runtime-full.untouched.wat | 14 +- tests/compiler/runtime-stub.optimized.wat | 6 +- tests/compiler/runtime-stub.untouched.wat | 6 +- .../compiler/std/array-literal.optimized.wat | 14 +- .../compiler/std/array-literal.untouched.wat | 14 +- tests/compiler/std/array.optimized.wat | 14 +- tests/compiler/std/array.untouched.wat | 14 +- tests/compiler/std/arraybuffer.optimized.wat | 6 +- tests/compiler/std/arraybuffer.untouched.wat | 6 +- tests/compiler/std/dataview.optimized.wat | 6 +- tests/compiler/std/dataview.untouched.wat | 6 +- tests/compiler/std/date.optimized.wat | 6 +- tests/compiler/std/date.untouched.wat | 6 +- tests/compiler/std/map.optimized.wat | 14 +- tests/compiler/std/map.untouched.wat | 14 +- tests/compiler/std/new.optimized.wat | 6 +- tests/compiler/std/new.untouched.wat | 6 +- .../compiler/std/object-literal.optimized.wat | 6 +- .../compiler/std/object-literal.untouched.wat | 6 +- .../std/operator-overloading.optimized.wat | 6 +- .../std/operator-overloading.untouched.wat | 6 +- tests/compiler/std/set.optimized.wat | 14 +- tests/compiler/std/set.untouched.wat | 14 +- tests/compiler/std/static-array.optimized.wat | 6 +- tests/compiler/std/static-array.untouched.wat | 6 +- tests/compiler/std/string-utf8.optimized.wat | 6 +- tests/compiler/std/string-utf8.untouched.wat | 6 +- tests/compiler/std/string.optimized.wat | 14 +- tests/compiler/std/string.untouched.wat | 14 +- tests/compiler/std/symbol.optimized.wat | 6 +- tests/compiler/std/symbol.untouched.wat | 6 +- tests/compiler/std/typedarray.optimized.wat | 14 +- tests/compiler/std/typedarray.untouched.wat | 14 +- 76 files changed, 560 insertions(+), 386 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9eddd1b..d7208215 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index ce9f2b52..8ff7da58 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/builtins.ts b/src/builtins.ts index 44f687c6..736ef596 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -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) ]); } diff --git a/src/compiler.ts b/src/compiler.ts index e4996703..0ba8054f 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -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 = (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)) { diff --git a/src/decompiler.ts b/src/decompiler.ts index b0f58662..3a49f3de 100644 --- a/src/decompiler.ts +++ b/src/decompiler.ts @@ -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(")"); diff --git a/src/flow.ts b/src/flow.ts index 34f09444..f70925eb 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -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); diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index f3f6376e..e23f89c7 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -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; diff --git a/src/module.ts b/src/module.ts index 653b54d3..1c07add6 100644 --- a/src/module.ts +++ b/src/module.ts @@ -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; +} diff --git a/tests/compiler/builtins.optimized.wat b/tests/compiler/builtins.optimized.wat index b30dbd65..49690ff9 100644 --- a/tests/compiler/builtins.optimized.wat +++ b/tests/compiler/builtins.optimized.wat @@ -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 diff --git a/tests/compiler/builtins.untouched.wat b/tests/compiler/builtins.untouched.wat index c3b31b21..c872652f 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -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 diff --git a/tests/compiler/call-super.optimized.wat b/tests/compiler/call-super.optimized.wat index ca177564..eff99d11 100644 --- a/tests/compiler/call-super.optimized.wat +++ b/tests/compiler/call-super.optimized.wat @@ -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 diff --git a/tests/compiler/call-super.untouched.wat b/tests/compiler/call-super.untouched.wat index 13437eaa..fb79f1a2 100644 --- a/tests/compiler/call-super.untouched.wat +++ b/tests/compiler/call-super.untouched.wat @@ -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 diff --git a/tests/compiler/constructor.optimized.wat b/tests/compiler/constructor.optimized.wat index 290cc03c..3e80c484 100644 --- a/tests/compiler/constructor.optimized.wat +++ b/tests/compiler/constructor.optimized.wat @@ -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 diff --git a/tests/compiler/constructor.untouched.wat b/tests/compiler/constructor.untouched.wat index c866850e..0587ee93 100644 --- a/tests/compiler/constructor.untouched.wat +++ b/tests/compiler/constructor.untouched.wat @@ -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 diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index 5f6568f7..04e5c73c 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -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 diff --git a/tests/compiler/exports.untouched.wat b/tests/compiler/exports.untouched.wat index 56fd0434..482b3b2b 100644 --- a/tests/compiler/exports.untouched.wat +++ b/tests/compiler/exports.untouched.wat @@ -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 diff --git a/tests/compiler/getter-call.optimized.wat b/tests/compiler/getter-call.optimized.wat index 7fe2ea87..83ce54dc 100644 --- a/tests/compiler/getter-call.optimized.wat +++ b/tests/compiler/getter-call.optimized.wat @@ -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 diff --git a/tests/compiler/getter-call.untouched.wat b/tests/compiler/getter-call.untouched.wat index d95df651..6b77d6ed 100644 --- a/tests/compiler/getter-call.untouched.wat +++ b/tests/compiler/getter-call.untouched.wat @@ -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 diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index 1d7d8513..e1fec5af 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -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 diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 0013b85e..cbdccedf 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -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 diff --git a/tests/compiler/number.optimized.wat b/tests/compiler/number.optimized.wat index ff179f24..c3df0ebb 100644 --- a/tests/compiler/number.optimized.wat +++ b/tests/compiler/number.optimized.wat @@ -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 diff --git a/tests/compiler/number.untouched.wat b/tests/compiler/number.untouched.wat index 916906e1..18554b95 100644 --- a/tests/compiler/number.untouched.wat +++ b/tests/compiler/number.untouched.wat @@ -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 diff --git a/tests/compiler/optional-typeparameters.optimized.wat b/tests/compiler/optional-typeparameters.optimized.wat index 3d33f1ef..64a1f4e3 100644 --- a/tests/compiler/optional-typeparameters.optimized.wat +++ b/tests/compiler/optional-typeparameters.optimized.wat @@ -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 diff --git a/tests/compiler/optional-typeparameters.untouched.wat b/tests/compiler/optional-typeparameters.untouched.wat index 21917a32..f4aff580 100644 --- a/tests/compiler/optional-typeparameters.untouched.wat +++ b/tests/compiler/optional-typeparameters.untouched.wat @@ -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 diff --git a/tests/compiler/rc/global-init.optimized.wat b/tests/compiler/rc/global-init.optimized.wat index 8cca0966..d659e590 100644 --- a/tests/compiler/rc/global-init.optimized.wat +++ b/tests/compiler/rc/global-init.optimized.wat @@ -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 diff --git a/tests/compiler/rc/global-init.untouched.wat b/tests/compiler/rc/global-init.untouched.wat index a4052814..edde7a6f 100644 --- a/tests/compiler/rc/global-init.untouched.wat +++ b/tests/compiler/rc/global-init.untouched.wat @@ -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 diff --git a/tests/compiler/rc/local-init.optimized.wat b/tests/compiler/rc/local-init.optimized.wat index a9fc9d35..d9136786 100644 --- a/tests/compiler/rc/local-init.optimized.wat +++ b/tests/compiler/rc/local-init.optimized.wat @@ -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 diff --git a/tests/compiler/rc/local-init.untouched.wat b/tests/compiler/rc/local-init.untouched.wat index 610b5d34..0eb1d3b4 100644 --- a/tests/compiler/rc/local-init.untouched.wat +++ b/tests/compiler/rc/local-init.untouched.wat @@ -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 diff --git a/tests/compiler/rc/logical-and-mismatch.optimized.wat b/tests/compiler/rc/logical-and-mismatch.optimized.wat index 305624ac..cf54f064 100644 --- a/tests/compiler/rc/logical-and-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-and-mismatch.optimized.wat @@ -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 diff --git a/tests/compiler/rc/logical-and-mismatch.untouched.wat b/tests/compiler/rc/logical-and-mismatch.untouched.wat index c3b7f399..9170c707 100644 --- a/tests/compiler/rc/logical-and-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-and-mismatch.untouched.wat @@ -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 diff --git a/tests/compiler/rc/logical-or-mismatch.optimized.wat b/tests/compiler/rc/logical-or-mismatch.optimized.wat index 4a004364..d8be7959 100644 --- a/tests/compiler/rc/logical-or-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-or-mismatch.optimized.wat @@ -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 diff --git a/tests/compiler/rc/logical-or-mismatch.untouched.wat b/tests/compiler/rc/logical-or-mismatch.untouched.wat index dae55a32..570cb9d9 100644 --- a/tests/compiler/rc/logical-or-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-or-mismatch.untouched.wat @@ -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 diff --git a/tests/compiler/rc/rereturn.optimized.wat b/tests/compiler/rc/rereturn.optimized.wat index 40e4480a..9af84d26 100644 --- a/tests/compiler/rc/rereturn.optimized.wat +++ b/tests/compiler/rc/rereturn.optimized.wat @@ -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 diff --git a/tests/compiler/rc/rereturn.untouched.wat b/tests/compiler/rc/rereturn.untouched.wat index c1b5e8c6..1e6304d5 100644 --- a/tests/compiler/rc/rereturn.untouched.wat +++ b/tests/compiler/rc/rereturn.untouched.wat @@ -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 diff --git a/tests/compiler/rc/ternary-mismatch.optimized.wat b/tests/compiler/rc/ternary-mismatch.optimized.wat index 4be9bccc..e1cc2a1a 100644 --- a/tests/compiler/rc/ternary-mismatch.optimized.wat +++ b/tests/compiler/rc/ternary-mismatch.optimized.wat @@ -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 diff --git a/tests/compiler/rc/ternary-mismatch.untouched.wat b/tests/compiler/rc/ternary-mismatch.untouched.wat index 30ca8d76..fe50cf5e 100644 --- a/tests/compiler/rc/ternary-mismatch.untouched.wat +++ b/tests/compiler/rc/ternary-mismatch.untouched.wat @@ -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 diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index 446da244..5790fab2 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -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 diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index b45be185..94aa0c8e 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -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 diff --git a/tests/compiler/retain-release.optimized.wat b/tests/compiler/retain-release.optimized.wat index 6aed9132..b759d692 100644 --- a/tests/compiler/retain-release.optimized.wat +++ b/tests/compiler/retain-release.optimized.wat @@ -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 diff --git a/tests/compiler/retain-release.untouched.wat b/tests/compiler/retain-release.untouched.wat index ecb167b8..66217d18 100644 --- a/tests/compiler/retain-release.untouched.wat +++ b/tests/compiler/retain-release.untouched.wat @@ -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 diff --git a/tests/compiler/rt/instanceof.optimized.wat b/tests/compiler/rt/instanceof.optimized.wat index 5a19d3e0..9cf790ec 100644 --- a/tests/compiler/rt/instanceof.optimized.wat +++ b/tests/compiler/rt/instanceof.optimized.wat @@ -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 diff --git a/tests/compiler/rt/instanceof.untouched.wat b/tests/compiler/rt/instanceof.untouched.wat index 8d5cf217..4b36d852 100644 --- a/tests/compiler/rt/instanceof.untouched.wat +++ b/tests/compiler/rt/instanceof.untouched.wat @@ -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 diff --git a/tests/compiler/runtime-full.optimized.wat b/tests/compiler/runtime-full.optimized.wat index f12d37c1..4633f913 100644 --- a/tests/compiler/runtime-full.optimized.wat +++ b/tests/compiler/runtime-full.optimized.wat @@ -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 diff --git a/tests/compiler/runtime-full.untouched.wat b/tests/compiler/runtime-full.untouched.wat index f82cacf5..cbc4a755 100644 --- a/tests/compiler/runtime-full.untouched.wat +++ b/tests/compiler/runtime-full.untouched.wat @@ -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 diff --git a/tests/compiler/runtime-stub.optimized.wat b/tests/compiler/runtime-stub.optimized.wat index b8f2923b..f902d4a7 100644 --- a/tests/compiler/runtime-stub.optimized.wat +++ b/tests/compiler/runtime-stub.optimized.wat @@ -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 diff --git a/tests/compiler/runtime-stub.untouched.wat b/tests/compiler/runtime-stub.untouched.wat index 75819233..9d217c30 100644 --- a/tests/compiler/runtime-stub.untouched.wat +++ b/tests/compiler/runtime-stub.untouched.wat @@ -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 diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index 62165f6b..88074313 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -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 diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index ee8fed3c..2df2fba8 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -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 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index fb2b7290..fab4acf9 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -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 diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 61ada9dc..8a8f74a5 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -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 diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index c73844b9..715e522f 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -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 diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 29cb965f..6db3753a 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -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 diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index cb275457..08311fd0 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -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 diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 318d134e..bfe0806e 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -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 diff --git a/tests/compiler/std/date.optimized.wat b/tests/compiler/std/date.optimized.wat index 4cd4f616..2df99f44 100644 --- a/tests/compiler/std/date.optimized.wat +++ b/tests/compiler/std/date.optimized.wat @@ -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 diff --git a/tests/compiler/std/date.untouched.wat b/tests/compiler/std/date.untouched.wat index 4350f3e8..42faa8a3 100644 --- a/tests/compiler/std/date.untouched.wat +++ b/tests/compiler/std/date.untouched.wat @@ -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 diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 743a4df3..975a3f44 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -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 diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index b6a4050c..29a662d8 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -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 diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index 7d447290..53fd28a7 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -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 diff --git a/tests/compiler/std/new.untouched.wat b/tests/compiler/std/new.untouched.wat index 485ba74a..00747a82 100644 --- a/tests/compiler/std/new.untouched.wat +++ b/tests/compiler/std/new.untouched.wat @@ -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 diff --git a/tests/compiler/std/object-literal.optimized.wat b/tests/compiler/std/object-literal.optimized.wat index 9585529f..5bffdc35 100644 --- a/tests/compiler/std/object-literal.optimized.wat +++ b/tests/compiler/std/object-literal.optimized.wat @@ -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 diff --git a/tests/compiler/std/object-literal.untouched.wat b/tests/compiler/std/object-literal.untouched.wat index 99d5e8e5..1388f5ec 100644 --- a/tests/compiler/std/object-literal.untouched.wat +++ b/tests/compiler/std/object-literal.untouched.wat @@ -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 diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index a431b3ec..50181450 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -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 diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index dad5cf0c..f1f4126e 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -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 diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 5cbc2cb8..856e886a 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -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 diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 56f20591..5c724ce2 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -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 diff --git a/tests/compiler/std/static-array.optimized.wat b/tests/compiler/std/static-array.optimized.wat index 52773fe0..86f53a41 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -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 diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index de846c95..d7dad3e0 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -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 diff --git a/tests/compiler/std/string-utf8.optimized.wat b/tests/compiler/std/string-utf8.optimized.wat index 77ce3c2f..369db30b 100644 --- a/tests/compiler/std/string-utf8.optimized.wat +++ b/tests/compiler/std/string-utf8.optimized.wat @@ -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 diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index 929127e6..78b40571 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -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 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 4c1e75bf..a55b00ae 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -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 diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 8c8275af..8356be81 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -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 diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index cfbbfa18..2dbd3001 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -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 diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 113242da..062f4a20 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -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 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 5b739fab..e8b2f036 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -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 diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 63f692af..5f250228 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -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