diff --git a/src/builtins.ts b/src/builtins.ts index ce6796e2..53b72e3f 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -633,17 +633,10 @@ export function compileCall( return module.createI32(getExpressionId(expr) == ExpressionId.Const ? 1 : 0); } case BuiltinSymbols.isManaged: { // isManaged() -> bool - if (!compiler.program.gcImplemented) { - compiler.currentType = Type.bool; - return module.createI32(0); - } let type = evaluateConstantType(compiler, typeArguments, operands, reportNode); compiler.currentType = Type.bool; if (!type) return module.createUnreachable(); - let classType = type.classReference; - return classType !== null && !classType.hasDecorator(DecoratorFlags.UNMANAGED) - ? module.createI32(1) - : module.createI32(0); + return module.createI32(type.isManaged(compiler.program) ? 1 : 0); } case BuiltinSymbols.sizeof: { // sizeof() -> usize compiler.currentType = compiler.options.usizeType; @@ -4253,7 +4246,8 @@ export function compileBuiltinArraySetWithValue( } } - var typeIsManaged = type.is(TypeFlags.REFERENCE); // FIXME: .isManaged + var program = compiler.program; + var isManaged = type.isManaged(program) && target.type.isManaged(program); var usizeType = compiler.options.usizeType; var nativeSizeType = compiler.options.nativeSizeType; var thisExpr = compiler.compileExpression( @@ -4263,7 +4257,7 @@ export function compileBuiltinArraySetWithValue( WrapMode.NONE ); var tempThis: Local | null = null; - if (typeIsManaged) { + if (isManaged) { tempThis = compiler.currentFlow.getTempLocal(target.type, false); thisExpr = module.createTeeLocal(tempThis.index, thisExpr); } @@ -4293,8 +4287,8 @@ export function compileBuiltinArraySetWithValue( } } - // handle Array: value = LINK(value, this), value - if (typeIsManaged) { + // handle Array: value = LINK(value, this) + if (isManaged) { let program = compiler.program; let linkPrototype = assert(program.linkPrototype); let linkInstance = compiler.resolver.resolveFunction(linkPrototype, [ type, target.type ]); @@ -4309,9 +4303,6 @@ export function compileBuiltinArraySetWithValue( body.unshift( module.createSetLocal(tempValue.index, valueExpr) ); - body.push( - module.createGetLocal(tempValue.index, nativeSizeType) - ); previousFlow.freeTempLocal(tempValue); previousFlow.freeTempLocal(tempThis!); tempThis = null; compiler.currentFlow = previousFlow; diff --git a/src/compiler.ts b/src/compiler.ts index af223c76..0cd75989 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -3731,7 +3731,7 @@ export class Compiler extends DiagnosticEmitter { if (!(instance && this.compileFunction(instance))) { expr = module.createUnreachable(); } else { - expr = this.makeCallDirect(instance, [ leftExpr, rightExpr ]); + expr = this.makeCallDirect(instance, [ leftExpr, rightExpr ], expression); } break; } @@ -3980,7 +3980,7 @@ export class Compiler extends DiagnosticEmitter { if (!(instance && this.compileFunction(instance))) { expr = module.createUnreachable(); } else { - expr = this.makeCallDirect(instance, [ leftExpr, rightExpr ]); + expr = this.makeCallDirect(instance, [ leftExpr, rightExpr ], expression); } break; } @@ -4011,7 +4011,7 @@ export class Compiler extends DiagnosticEmitter { if (!(instance && this.compileFunction(instance))) { expr = module.createUnreachable(); } else { - expr = this.makeCallDirect(instance, [ leftExpr, rightExpr ]); + expr = this.makeCallDirect(instance, [ leftExpr, rightExpr ], expression); } break; } @@ -4904,7 +4904,7 @@ export class Compiler extends DiagnosticEmitter { let setterInstance = this.resolver.resolveFunction(setterPrototype, null, makeMap(), ReportMode.REPORT); if (!setterInstance) return module.createUnreachable(); // call just the setter if the return value isn't of interest - if (!tee) return this.makeCallDirect(setterInstance, [ valueWithCorrectType ]); + if (!tee) return this.makeCallDirect(setterInstance, [ valueWithCorrectType ], expression); // otherwise call the setter first, then the getter let getterPrototype = assert((target).getterPrototype); // must be present let getterInstance = this.resolver.resolveFunction(getterPrototype, null, makeMap(), ReportMode.REPORT); @@ -4912,8 +4912,8 @@ export class Compiler extends DiagnosticEmitter { let returnType = getterInstance.signature.returnType; let nativeReturnType = returnType.toNativeType(); return module.createBlock(null, [ - this.makeCallDirect(setterInstance, [ valueWithCorrectType ]), - this.makeCallDirect(getterInstance) // sets currentType + this.makeCallDirect(setterInstance, [ valueWithCorrectType ], expression), + this.makeCallDirect(getterInstance, null, expression) // sets currentType ], nativeReturnType); } case ElementKind.PROPERTY: { // instance property @@ -4932,7 +4932,7 @@ export class Compiler extends DiagnosticEmitter { this.options.usizeType, WrapMode.NONE ); - return this.makeCallDirect(setterInstance, [ thisExpr, valueWithCorrectType ]); + return this.makeCallDirect(setterInstance, [ thisExpr, valueWithCorrectType ], expression); } // otherwise call the setter first, then the getter let getterInstance = assert((target).getterInstance); // must be present @@ -4949,10 +4949,10 @@ export class Compiler extends DiagnosticEmitter { this.makeCallDirect(setterInstance, [ // set and remember the target module.createTeeLocal(tempLocalIndex, thisExpr), valueWithCorrectType - ]), + ], expression), this.makeCallDirect(getterInstance, [ // get from remembered target module.createGetLocal(tempLocalIndex, nativeReturnType) - ]) + ], expression) ], nativeReturnType); } case ElementKind.CLASS: { @@ -5012,18 +5012,18 @@ export class Compiler extends DiagnosticEmitter { module.createTeeLocal(tempLocalTarget.index, thisExpr), module.createTeeLocal(tempLocalElement.index, elementExpr), valueWithCorrectType - ]), + ], expression), this.makeCallDirect(indexedGet, [ module.createGetLocal(tempLocalTarget.index, tempLocalTarget.type.toNativeType()), module.createGetLocal(tempLocalElement.index, tempLocalElement.type.toNativeType()) - ]) + ], expression) ], returnType.toNativeType()); } else { return this.makeCallDirect(indexedSet, [ thisExpr, elementExpr, valueWithCorrectType - ]); + ], expression); } } // fall-through @@ -5211,7 +5211,7 @@ export class Compiler extends DiagnosticEmitter { makeMap(flow.contextualTypeArguments) ); if (!instance) return this.module.createUnreachable(); - return this.makeCallDirect(instance, argumentExprs); + return this.makeCallDirect(instance, argumentExprs, expression); // TODO: this skips inlining because inlining requires compiling its temporary locals in // the scope of the inlined flow. might need another mechanism to lock temp. locals early, // so inlining can be performed in `makeCallDirect` instead? @@ -5515,7 +5515,7 @@ export class Compiler extends DiagnosticEmitter { ); } assert(index == numArgumentsInclThis); - return this.makeCallDirect(instance, operands); + return this.makeCallDirect(instance, operands, reportNode); } // Depends on being pre-checked in compileCallDirect @@ -5788,8 +5788,15 @@ export class Compiler extends DiagnosticEmitter { /** Creates a direct call to the specified function. */ makeCallDirect( instance: Function, - operands: ExpressionRef[] | null = null + operands: ExpressionRef[] | null, + reportNode: Node ): ExpressionRef { + if (instance.hasDecorator(DecoratorFlags.INLINE)) { + this.warning( + DiagnosticCode.TODO_Cannot_inline_inferred_calls_and_specific_internals_yet, + reportNode.range, instance.internalName + ); + } var numOperands = operands ? operands.length : 0; var numArguments = numOperands; var minArguments = instance.signature.requiredParameters; @@ -6619,40 +6626,37 @@ export class Compiler extends DiagnosticEmitter { // find out whether all elements are constant (array is static) var length = expressions.length; - var compiledValues = new Array(length); - var constantValues = new Array(length); + var constantValues: ExpressionRef[] | null = new Array(length); var nativeElementType = elementType.toNativeType(); - var isStatic = true; for (let i = 0; i < length; ++i) { let expression = expressions[i]; let expr = expression ? this.compileExpression(expression, elementType, ConversionKind.IMPLICIT, WrapMode.NONE) : elementType.toNativeZero(module); - compiledValues[i] = expr; - if (isStatic) { - expr = module.precomputeExpression(expr); - if (getExpressionId(expr) == ExpressionId.Const) { - assert(getExpressionType(expr) == nativeElementType); - constantValues[i] = expr; - } else { - if (isConst) { - this.warning( - DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, - reportNode.range - ); - } - isStatic = false; + expr = module.precomputeExpression(expr); + if (getExpressionId(expr) == ExpressionId.Const) { + assert(getExpressionType(expr) == nativeElementType); + constantValues![i] = expr; + } else { + if (isConst) { + this.warning( + DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, + reportNode.range + ); } + constantValues = null; + break; } } var program = this.program; var arrayPrototype = assert(program.arrayPrototype); var arrayInstance = assert(this.resolver.resolveClass(arrayPrototype, [ elementType ])); + var arrayBufferInstance = assert(program.arrayBufferInstance); var arrayType = arrayInstance.type; // if the array is static, make a static arraybuffer segment - if (isStatic) { + if (constantValues) { let runtimeHeaderSize = program.runtimeHeaderSize; let bufferSegment = this.ensureStaticArrayBuffer(elementType, constantValues); let bufferAddress = i64_add(bufferSegment.offset, i64_new(runtimeHeaderSize)); @@ -6669,7 +6673,6 @@ export class Compiler extends DiagnosticEmitter { // otherwise allocate a new array header and make it wrap a copy of the static buffer } else { - let arrayBufferInstance = assert(program.arrayBufferInstance); let wrapArrayPrototype = assert(program.wrapArrayPrototype); let wrapArrayInstance = this.resolver.resolveFunction(wrapArrayPrototype, [ elementType ]); if (!wrapArrayInstance) { @@ -6708,25 +6711,73 @@ export class Compiler extends DiagnosticEmitter { } var nativeArrayType = arrayType.toNativeType(); var flow = this.currentFlow; - var tempLocal = flow.parentFunction.addLocal(arrayType); // can't reuse a temp (used in compiledValues) - var stmts = new Array(2 + length); - var index = 0; - stmts[index++] = module.createSetLocal(tempLocal.index, - this.makeCallDirect(assert(arrayInstance.constructorInstance), [ - module.createI32(0), // this - module.createI32(length) - ]) + var tempThis = flow.getTempLocal(arrayType, false); + var tempDataStart = flow.getTempLocal(arrayBufferInstance.type); + var stmts = new Array(); + // tempThis = new Array(length) + stmts.push( + module.createSetLocal(tempThis.index, + this.makeCallDirect(assert(arrayInstance.constructorInstance), [ + module.createI32(0), // this + module.createI32(length) + ], reportNode) + ) ); - for (let i = 0; i < length; ++i) { - stmts[index++] = this.makeCallDirect(setter, [ - module.createGetLocal(tempLocal.index, nativeArrayType), // this - module.createI32(i), - compiledValues[i] - ]); + // tempData = tempThis.dataStart + var dataStart = assert(arrayInstance.lookupInSelf("dataStart")); + assert(dataStart.kind == ElementKind.FIELD); + stmts.push( + module.createSetLocal(tempDataStart.index, + module.createLoad(arrayType.byteSize, false, + module.createGetLocal(tempThis.index, nativeArrayType), + nativeArrayType, + (dataStart).memoryOffset + ) + ) + ); + var isManaged = elementType.isManaged(program) && arrayType.isManaged(program); + var linkInstance = isManaged + ? this.resolver.resolveFunction(assert(program.linkPrototype), [ elementType, arrayType ]) + : null; + for (let i = 0, alignLog2 = elementType.alignLog2; i < length; ++i) { + let valueExpression = expressions[i]; + let valueExpr = valueExpression + ? this.compileExpression(valueExpression, elementType, ConversionKind.IMPLICIT, WrapMode.NONE) + : elementType.toNativeZero(module); + if (isManaged) { + if (!linkInstance) { + valueExpr = module.createUnreachable(); + } else { + // value = LINK(value, tempThis) + let tempValue = flow.getAndFreeTempLocal(elementType, false); + let inlineFlow = Flow.createInline(flow.parentFunction, linkInstance); + inlineFlow.addScopedAlias(linkInstance.signature.getParameterName(0), elementType, tempValue.index); + inlineFlow.addScopedAlias(linkInstance.signature.getParameterName(1), arrayType, tempThis.index); + this.currentFlow = inlineFlow; + let body = this.compileFunctionBody(linkInstance); + stmts.push( + module.createSetLocal(tempValue.index, valueExpr) + ); + valueExpr = module.createBlock(inlineFlow.inlineReturnLabel, body, nativeElementType); + this.currentFlow = flow; + } + } + // store(tempData, value, immOffset) + stmts.push( + module.createStore(elementType.byteSize, + module.createGetLocal(tempDataStart.index, nativeArrayType), + valueExpr, + nativeElementType, + i << alignLog2 + ) + ); } - assert(index + 1 == stmts.length); - stmts[index] = module.createGetLocal(tempLocal.index, nativeArrayType); - flow.freeTempLocal(tempLocal); // but can be reused now + // -> tempThis + stmts.push( + module.createGetLocal(tempThis.index, nativeArrayType) + ); + flow.freeTempLocal(tempThis); // but can be reused now + flow.freeTempLocal(tempDataStart); this.currentType = arrayType; return module.createBlock(null, stmts, nativeArrayType); } @@ -6942,7 +6993,7 @@ export class Compiler extends DiagnosticEmitter { // TODO: base constructor might be inlined, but makeCallDirect can't do this stmts.push( module.createSetLocal(0, - this.makeCallDirect(assert(baseClass.constructorInstance), operands) + this.makeCallDirect(assert(baseClass.constructorInstance), operands, reportNode) ) ); } diff --git a/src/diagnosticMessages.generated.ts b/src/diagnosticMessages.generated.ts index dd8d4512..b77cfa3f 100644 --- a/src/diagnosticMessages.generated.ts +++ b/src/diagnosticMessages.generated.ts @@ -34,6 +34,7 @@ export enum DiagnosticCode { Module_cannot_have_multiple_start_functions = 221, _0_must_be_a_value_between_1_and_2_inclusive = 222, _0_must_be_a_power_of_two = 223, + TODO_Cannot_inline_inferred_calls_and_specific_internals_yet = 224, Unterminated_string_literal = 1002, Identifier_expected = 1003, _0_expected = 1005, @@ -169,6 +170,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 221: return "Module cannot have multiple start functions."; case 222: return "'{0}' must be a value between '{1}' and '{2}' inclusive."; case 223: return "'{0}' must be a power of two."; + case 224: return "TODO: Cannot inline inferred calls and specific internals yet."; case 1002: return "Unterminated string literal."; case 1003: return "Identifier expected."; case 1005: return "'{0}' expected."; diff --git a/src/diagnosticMessages.json b/src/diagnosticMessages.json index 12806277..44b5a363 100644 --- a/src/diagnosticMessages.json +++ b/src/diagnosticMessages.json @@ -26,6 +26,7 @@ "Module cannot have multiple start functions.": 221, "'{0}' must be a value between '{1}' and '{2}' inclusive.": 222, "'{0}' must be a power of two.": 223, + "TODO: Cannot inline inferred calls and specific internals yet.": 224, "Unterminated string literal.": 1002, "Identifier expected.": 1003, diff --git a/std/assembly/array.ts b/std/assembly/array.ts index e4af4d44..554d1a15 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -72,8 +72,11 @@ export class Array extends ArrayBufferView { @operator("[]=") // unchecked is built-in private __set(index: i32, value: T): void { ensureCapacity(this, index + 1, alignof()); - store(this.dataStart + (index << alignof()), value); - if (isManaged()) LINK(value, this); + store(this.dataStart + (index << alignof()), + isManaged() + ? LINK(value, this) + : value + ); if (index >= this.length_) this.length_ = index + 1; } @@ -131,8 +134,11 @@ export class Array extends ArrayBufferView { var newLength = this.length_ + 1; ensureCapacity(this, newLength, alignof()); this.length_ = newLength; - store(this.dataStart + ((newLength - 1) << alignof()), element); - if (isManaged()) LINK(element, this); + store(this.dataStart + ((newLength - 1) << alignof()), + isManaged() + ? LINK(element, this) + : element + ); return newLength; } @@ -146,15 +152,13 @@ export class Array extends ArrayBufferView { let thisStart = this.dataStart; for (let offset: usize = 0; offset < thisSize; offset += sizeof()) { let element = load(thisStart + offset); - store(outStart + offset, element); - LINK(element, out); + store(outStart + offset, LINK>(element, out)); } let otherStart = other.dataStart; let otherSize = otherLen << alignof(); for (let offset: usize = 0; offset < otherSize; offset += sizeof()) { let element = load(otherStart + offset); - store(outStart + thisSize + offset, element); - LINK(element, out); + store(outStart + thisSize + offset, LINK>(element, out)); } } else { memory.copy(outStart, this.dataStart, thisSize); @@ -211,8 +215,11 @@ export class Array extends ArrayBufferView { for (let index = 0; index < min(length, this.length_); ++index) { let value = load(this.dataStart + (index << alignof())); let result = callbackfn(value, index, this); - store(outStart + (index << alignof()), result); - if (isManaged()) LINK(result, out); + store(outStart + (index << alignof()), + isManaged() + ? LINK>(result, out) + : result + ); } return out; } @@ -283,8 +290,11 @@ export class Array extends ArrayBufferView { base, (newLength - 1) << alignof() ); - store(base, element); - if (isManaged()) LINK(element, this); + store(base, + isManaged() + ? LINK(element, this) + : element + ); this.length_ = newLength; return newLength; } @@ -300,8 +310,11 @@ export class Array extends ArrayBufferView { for (let i = 0; i < length; ++i) { let offset = i << alignof(); let element = load(thisBase + offset); - store(sliceBase + offset, element); - if (isManaged()) LINK(element, slice); + store(sliceBase + offset, + isManaged() + ? LINK>(element, slice) + : element + ); } return slice; } @@ -316,8 +329,11 @@ export class Array extends ArrayBufferView { var thisBase = thisStart + (start << alignof()); for (let i = 0; i < deleteCount; ++i) { let element = load(thisBase + (i << alignof())); - store(spliceStart + (i << alignof()), element); - if (isManaged()) LINK(element, splice); + store(spliceStart + (i << alignof()), + isManaged() + ? LINK>(element, splice) + : element + ); } memory.copy( splice.dataStart, diff --git a/std/assembly/arraybuffer.ts b/std/assembly/arraybuffer.ts index a9c3e1e9..a24247f2 100644 --- a/std/assembly/arraybuffer.ts +++ b/std/assembly/arraybuffer.ts @@ -2,7 +2,7 @@ import { ALLOCATE, REGISTER, HEADER, HEADER_SIZE, MAX_BYTELENGTH } from "./runti @sealed export class ArrayBuffer { - @inline static isView(value: T): bool { + static isView(value: T): bool { if (value) { if (value instanceof Int8Array) return true; if (value instanceof Uint8Array) return true; diff --git a/std/assembly/builtins.ts b/std/assembly/builtins.ts index ac0f1439..be4f7905 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -58,14 +58,17 @@ export declare function isConstant(expression: void): bool; @builtin export declare function isManaged(value?: T): bool; -// @ts-ignore: decorator -@inline -export function isNaN(value: T): bool { return value != value; } +export function isNaN(value: T): bool { + if (!isFloat()) { + if (!isInteger()) ERROR("numeric type expected"); + } + return value != value; +} -// @ts-ignore: decorator -@inline -export function isFinite(value: T): bool { - // @ts-ignore: type +export function isFinite(value: T): bool { + if (!isFloat()) { + if (!isInteger()) ERROR("numeric type expected"); + } return value - value == 0; } diff --git a/std/assembly/map.ts b/std/assembly/map.ts index c57658d8..48dcb309 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -119,15 +119,18 @@ export class Map { entry = changetype>( changetype(entries) + this.entriesOffset++ * ENTRY_SIZE() ); - entry.key = key; - entry.value = value; + // link with the map (entry is unmanaged) + entry.key = isManaged() + ? LINK(key, this) + : key; + entry.value = isManaged() + ? LINK(value, this) + : value; ++this.entriesCount; // link with previous entry in bucket let bucketPtrBase = changetype(this.buckets) + (hashCode & this.bucketsMask) * BUCKET_SIZE; entry.taggedNext = load(bucketPtrBase); store(bucketPtrBase, changetype(entry)); - if (isManaged()) LINK(key, this); - if (isManaged()) LINK(value, this); } } diff --git a/std/assembly/runtime.ts b/std/assembly/runtime.ts index c9326230..f30d41db 100644 --- a/std/assembly/runtime.ts +++ b/std/assembly/runtime.ts @@ -137,10 +137,11 @@ function doRegister(ref: usize, classId: u32): usize { /** Links a registered object with the (registered) object now referencing it. */ // @ts-ignore: decorator @unsafe @inline -export function LINK(ref: T, parentRef: TParent): void { - if (!isReference()) ERROR("reference expected"); - if (!isReference()) ERROR("reference expected"); +export function LINK(ref: T, parentRef: TParent): T { + if (!isManaged()) ERROR("managed reference expected"); + if (!isManaged()) ERROR("managed reference expected"); doLink(changetype(ref), changetype(parentRef)); + return ref; } function doLink(ref: usize, parentRef: usize): void { diff --git a/std/assembly/set.ts b/std/assembly/set.ts index 804fa16e..991741ec 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -88,11 +88,11 @@ export class Set { } has(key: K): bool { - return this.find(key, HASH(key)) !== null; + return this.find(key, HASH(key)) !== null; } add(key: K): void { - var hashCode = HASH(key); + var hashCode = HASH(key); var entry = this.find(key, hashCode); if (!entry) { // check if rehashing is necessary @@ -108,13 +108,15 @@ export class Set { entry = changetype>( changetype(entries) + this.entriesOffset++ * ENTRY_SIZE() ); - entry.key = key; + // link with the set itself (entry is unmanaged) + entry.key = isManaged() + ? LINK(key, this) + : key; ++this.entriesCount; // link with previous entry in bucket let bucketPtrBase = changetype(this.buckets) + (hashCode & this.bucketsMask) * BUCKET_SIZE; entry.taggedNext = load(bucketPtrBase); store(bucketPtrBase, changetype(entry)); - if (isManaged()) LINK(key, this); } } diff --git a/std/assembly/string.ts b/std/assembly/string.ts index 139838f7..d7666611 100644 --- a/std/assembly/string.ts +++ b/std/assembly/string.ts @@ -362,8 +362,12 @@ import { compareImpl, parse, CharCode, isWhiteSpaceOrLineTerminator } from "./ut charStr, load(changetype(this) + (i << 1)) ); - store(resultStart + (i << alignof()), REGISTER(charStr)); // result[i] = charStr - if (isManaged()) LINK(changetype(charStr), result); + // result[i] = charStr + store(resultStart + (i << alignof()), + isManaged() + ? LINK>(REGISTER(charStr), result) + : REGISTER(charStr) + ); } return result; } else if (!length) { diff --git a/std/assembly/util/number.ts b/std/assembly/util/number.ts index 1156f8a1..11278c70 100644 --- a/std/assembly/util/number.ts +++ b/std/assembly/util/number.ts @@ -620,8 +620,8 @@ export function dtoa_core(buffer: usize, value: f64): i32 { export function dtoa(value: f64): String { if (value == 0) return "0.0"; - if (!isFinite(value)) { - if (isNaN(value)) return "NaN"; + if (!isFinite(value)) { + if (isNaN(value)) return "NaN"; return select("-Infinity", "Infinity", value < 0); } var temp = ALLOCATE(MAX_DOUBLE_LENGTH << 1); @@ -681,8 +681,8 @@ export function dtoa_stream(buffer: usize, offset: usize, value: f64): u32 { store(buffer, CharCode._0, 4); return 3; } - if (!isFinite(value)) { - if (isNaN(value)) { + if (!isFinite(value)) { + if (isNaN(value)) { store(buffer, CharCode.N); store(buffer, CharCode.a, 2); store(buffer, CharCode.N, 4); diff --git a/tests/compiler/binary.optimized.wat b/tests/compiler/binary.optimized.wat index 1fc55b7b..fa85b282 100644 --- a/tests/compiler/binary.optimized.wat +++ b/tests/compiler/binary.optimized.wat @@ -83,24 +83,24 @@ local.get $0 i32.reinterpret_f32 local.tee $1 + i32.const -2147483648 + i32.and + local.set $4 + local.get $1 i32.const 23 i32.shr_u i32.const 255 i32.and - local.set $2 - local.get $1 - i32.const -2147483648 - i32.and - local.set $4 - local.get $2 + local.tee $2 i32.const 255 i32.eq local.tee $3 - if (result i32) - local.get $3 - else + i32.eqz + if i32.const 0 + local.set $3 end + local.get $3 if local.get $0 local.get $0 @@ -151,7 +151,7 @@ local.get $1 i32.const 8388608 i32.ge_u - if + if (result i32) local.get $1 i32.const 8388608 i32.eq @@ -159,9 +159,9 @@ local.get $1 i32.const 8388608 i32.sub - local.set $1 + else + local.get $1 end - local.get $1 i32.const 1 i32.shl local.set $1 @@ -254,29 +254,29 @@ (local $1 i64) (local $2 i64) (local $3 i64) - (local $4 i64) - (local $5 i32) + (local $4 i32) + (local $5 i64) local.get $0 i64.reinterpret_f64 local.tee $1 + i64.const 63 + i64.shr_u + local.set $5 + local.get $1 i64.const 52 i64.shr_u i64.const 2047 i64.and - local.set $2 - local.get $1 - i64.const 63 - i64.shr_u - local.set $4 - local.get $2 + local.tee $2 i64.const 2047 i64.eq - local.tee $5 - if (result i32) - local.get $5 - else + local.tee $4 + i32.eqz + if i32.const 0 + local.set $4 end + local.get $4 if local.get $0 local.get $0 @@ -330,7 +330,7 @@ local.get $1 i64.const 4503599627370496 i64.ge_u - if + if (result i64) local.get $1 i64.const 4503599627370496 i64.eq @@ -338,9 +338,9 @@ local.get $1 i64.const 4503599627370496 i64.sub - local.set $1 + else + local.get $1 end - local.get $1 i64.const 1 i64.shl local.set $1 @@ -395,7 +395,7 @@ i64.add i64.shr_u end - local.get $4 + local.get $5 i64.const 63 i64.shl i64.or diff --git a/tests/compiler/binary.untouched.wat b/tests/compiler/binary.untouched.wat index d029b447..19520847 100644 --- a/tests/compiler/binary.untouched.wat +++ b/tests/compiler/binary.untouched.wat @@ -2,7 +2,9 @@ (type $FUNCSIG$ddd (func (param f64 f64) (result f64))) (type $FUNCSIG$ddi (func (param f64 i32) (result f64))) (type $FUNCSIG$fff (func (param f32 f32) (result f32))) + (type $FUNCSIG$if (func (param f32) (result i32))) (type $FUNCSIG$ffi (func (param f32 i32) (result f32))) + (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$v (func)) (memory $0 0) (table $0 1 funcref) @@ -1195,7 +1197,12 @@ local.get $16 f64.mul ) - (func $~lib/math/NativeMathf.mod (; 2 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/builtins/isNaN (; 2 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.ne + ) + (func $~lib/math/NativeMathf.mod (; 3 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1248,13 +1255,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f32.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -1451,7 +1453,7 @@ local.get $2 f32.reinterpret_i32 ) - (func $~lib/math/NativeMathf.scalbn (; 3 ;) (type $FUNCSIG$ffi) (param $0 f32) (param $1 i32) (result f32) + (func $~lib/math/NativeMathf.scalbn (; 4 ;) (type $FUNCSIG$ffi) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) (local $3 i32) (local $4 i32) @@ -1541,7 +1543,7 @@ f32.reinterpret_i32 f32.mul ) - (func $~lib/math/NativeMathf.pow (; 4 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 5 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2479,7 +2481,12 @@ local.get $11 f32.mul ) - (func $~lib/math/NativeMath.mod (; 5 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/builtins/isNaN (; 6 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + local.get $0 + local.get $0 + f64.ne + ) + (func $~lib/math/NativeMath.mod (; 7 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i64) @@ -2532,13 +2539,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f64.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -2737,7 +2739,7 @@ local.get $2 f64.reinterpret_i64 ) - (func $start:binary (; 6 ;) (type $FUNCSIG$v) + (func $start:binary (; 8 ;) (type $FUNCSIG$v) global.get $binary/i i32.const 1 i32.lt_s @@ -3345,9 +3347,9 @@ call $~lib/math/NativeMath.pow global.set $binary/F ) - (func $start (; 7 ;) (type $FUNCSIG$v) + (func $start (; 9 ;) (type $FUNCSIG$v) call $start:binary ) - (func $null (; 8 ;) (type $FUNCSIG$v) + (func $null (; 10 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/builtins.untouched.wat b/tests/compiler/builtins.untouched.wat index 61f4c7f3..05cdea32 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -1,5 +1,7 @@ (module (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) + (type $FUNCSIG$if (func (param f32) (result i32))) + (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -54,16 +56,38 @@ (export "table" (table $0)) (export "test" (func $builtins/test)) (start $start) - (func $start:builtins~anonymous|0 (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/builtins/isNaN (; 1 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.ne + ) + (func $~lib/builtins/isFinite (; 2 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.sub + f32.const 0 + f32.eq + ) + (func $~lib/builtins/isNaN (; 3 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + local.get $0 + local.get $0 + f64.ne + ) + (func $~lib/builtins/isFinite (; 4 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + local.get $0 + local.get $0 + f64.sub + f64.const 0 + f64.eq + ) + (func $start:builtins~anonymous|0 (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) nop ) - (func $start:builtins (; 2 ;) (type $FUNCSIG$v) + (func $start:builtins (; 6 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i64) (local $3 i64) - (local $4 f32) - (local $5 f64) i32.const 1 i32.eqz if @@ -728,15 +752,8 @@ f32.const 1.25 f32.trunc drop - block $~lib/builtins/isNaN|inlined.0 (result i32) - f32.const 1.25 - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const 1.25 + call $~lib/builtins/isNaN i32.const 0 i32.eq i32.eqz @@ -748,15 +765,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.1 (result i32) - f32.const nan:0x400000 - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + call $~lib/builtins/isNaN i32.const 1 i32.eq i32.eqz @@ -768,17 +778,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.0 (result i32) - f32.const 1.25 - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const 1.25 + call $~lib/builtins/isFinite i32.const 1 i32.eq i32.eqz @@ -790,17 +791,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.1 (result i32) - f32.const inf - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const inf + call $~lib/builtins/isFinite i32.const 0 i32.eq i32.eqz @@ -812,18 +804,9 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.2 (result i32) - f32.const inf - f32.neg - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const inf + f32.neg + call $~lib/builtins/isFinite i32.const 0 i32.eq i32.eqz @@ -835,17 +818,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.3 (result i32) - f32.const nan:0x400000 - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + call $~lib/builtins/isFinite i32.const 0 i32.eq i32.eqz @@ -891,27 +865,11 @@ f32.const 1.25 f32.trunc global.set $builtins/f - block $~lib/builtins/isNaN|inlined.2 (result i32) - f32.const 1.25 - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const 1.25 + call $~lib/builtins/isNaN global.set $builtins/b - block $~lib/builtins/isFinite|inlined.4 (result i32) - f32.const 1.25 - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const 1.25 + call $~lib/builtins/isFinite global.set $builtins/b f64.const nan:0x8000000000000 drop @@ -951,15 +909,8 @@ f64.const 1.25 f64.trunc drop - block $~lib/builtins/isNaN|inlined.0 (result i32) - f64.const 1.25 - local.set $5 - local.get $5 - local.get $5 - f64.ne - end - i32.const 0 - i32.ne + f64.const 1.25 + call $~lib/builtins/isNaN i32.const 0 i32.eq i32.eqz @@ -971,15 +922,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.1 (result i32) - f64.const nan:0x8000000000000 - local.set $5 - local.get $5 - local.get $5 - f64.ne - end - i32.const 0 - i32.ne + f64.const nan:0x8000000000000 + call $~lib/builtins/isNaN i32.const 1 i32.eq i32.eqz @@ -991,17 +935,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.0 (result i32) - f64.const 1.25 - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const 1.25 + call $~lib/builtins/isFinite i32.const 1 i32.eq i32.eqz @@ -1013,17 +948,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.1 (result i32) - f64.const inf - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const inf + call $~lib/builtins/isFinite i32.const 0 i32.eq i32.eqz @@ -1035,18 +961,9 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.2 (result i32) - f64.const inf - f64.neg - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const inf + f64.neg + call $~lib/builtins/isFinite i32.const 0 i32.eq i32.eqz @@ -1058,17 +975,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.3 (result i32) - f64.const nan:0x8000000000000 - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const nan:0x8000000000000 + call $~lib/builtins/isFinite i32.const 0 i32.eq i32.eqz @@ -1114,27 +1022,11 @@ f64.const 1.25 f64.trunc global.set $builtins/F - block $~lib/builtins/isNaN|inlined.2 (result i32) - f64.const 1.25 - local.set $5 - local.get $5 - local.get $5 - f64.ne - end - i32.const 0 - i32.ne + f64.const 1.25 + call $~lib/builtins/isNaN global.set $builtins/b - block $~lib/builtins/isFinite|inlined.4 (result i32) - f64.const 1.25 - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const 1.25 + call $~lib/builtins/isFinite global.set $builtins/b i32.const 8 i32.load @@ -1664,15 +1556,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.3 (result i32) - f32.const nan:0x400000 - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + call $~lib/builtins/isNaN i32.eqz if i32.const 0 @@ -1682,15 +1567,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.3 (result i32) - f64.const nan:0x8000000000000 - local.set $5 - local.get $5 - local.get $5 - f64.ne - end - i32.const 0 - i32.ne + f64.const nan:0x8000000000000 + call $~lib/builtins/isNaN i32.eqz if i32.const 0 @@ -1700,17 +1578,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.5 (result i32) - f32.const nan:0x400000 - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + call $~lib/builtins/isFinite i32.eqz i32.eqz if @@ -1721,17 +1590,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.6 (result i32) - f32.const inf - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const inf + call $~lib/builtins/isFinite i32.eqz i32.eqz if @@ -1742,17 +1602,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.5 (result i32) - f64.const nan:0x8000000000000 - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const nan:0x8000000000000 + call $~lib/builtins/isFinite i32.eqz i32.eqz if @@ -1763,17 +1614,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.6 (result i32) - f64.const inf - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const inf + call $~lib/builtins/isFinite i32.eqz i32.eqz if @@ -1784,17 +1626,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.7 (result i32) - f32.const 0 - local.set $4 - local.get $4 - local.get $4 - f32.sub - f32.const 0 - f32.eq - end - i32.const 0 - i32.ne + f32.const 0 + call $~lib/builtins/isFinite i32.eqz if i32.const 0 @@ -1804,17 +1637,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isFinite|inlined.7 (result i32) - f64.const 0 - local.set $5 - local.get $5 - local.get $5 - f64.sub - f64.const 0 - f64.eq - end - i32.const 0 - i32.ne + f64.const 0 + call $~lib/builtins/isFinite i32.eqz if i32.const 0 @@ -2391,21 +2215,16 @@ f64.const 1 f64.trunc drop - block $~lib/builtins/isNaN|inlined.4 (result i32) - f64.const 1 - local.set $5 - local.get $5 - local.get $5 - f64.ne - end + f64.const 1 + call $~lib/builtins/isNaN drop ) - (func $builtins/test (; 3 ;) (type $FUNCSIG$v) + (func $builtins/test (; 7 ;) (type $FUNCSIG$v) nop ) - (func $start (; 4 ;) (type $FUNCSIG$v) + (func $start (; 8 ;) (type $FUNCSIG$v) call $start:builtins ) - (func $null (; 5 ;) (type $FUNCSIG$v) + (func $null (; 9 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/call-super.optimized.wat b/tests/compiler/call-super.optimized.wat index 0ad4a800..c6b38110 100644 --- a/tests/compiler/call-super.optimized.wat +++ b/tests/compiler/call-super.optimized.wat @@ -106,7 +106,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -120,7 +120,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/call-super.untouched.wat b/tests/compiler/call-super.untouched.wat index c9ce5337..d20fa968 100644 --- a/tests/compiler/call-super.untouched.wat +++ b/tests/compiler/call-super.untouched.wat @@ -145,7 +145,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -160,7 +160,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/constructor.optimized.wat b/tests/compiler/constructor.optimized.wat index 98c0a13f..62ed9113 100644 --- a/tests/compiler/constructor.optimized.wat +++ b/tests/compiler/constructor.optimized.wat @@ -116,7 +116,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -130,7 +130,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/constructor.untouched.wat b/tests/compiler/constructor.untouched.wat index 000ac7d8..87791bf4 100644 --- a/tests/compiler/constructor.untouched.wat +++ b/tests/compiler/constructor.untouched.wat @@ -155,7 +155,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -170,7 +170,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index 35b75ab2..ae4c975d 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -131,7 +131,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -145,7 +145,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/exports.untouched.wat b/tests/compiler/exports.untouched.wat index 9c3e2d56..d3178081 100644 --- a/tests/compiler/exports.untouched.wat +++ b/tests/compiler/exports.untouched.wat @@ -197,7 +197,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -212,7 +212,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/getter-call.optimized.wat b/tests/compiler/getter-call.optimized.wat index e35e6b1d..e9582f39 100644 --- a/tests/compiler/getter-call.optimized.wat +++ b/tests/compiler/getter-call.optimized.wat @@ -85,7 +85,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -99,7 +99,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/getter-call.untouched.wat b/tests/compiler/getter-call.untouched.wat index f7e03052..25ed4620 100644 --- a/tests/compiler/getter-call.untouched.wat +++ b/tests/compiler/getter-call.untouched.wat @@ -147,7 +147,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -162,7 +162,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index 97b00f42..ea750334 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -131,7 +131,7 @@ if i32.const 0 i32.const 48 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -145,7 +145,7 @@ if i32.const 0 i32.const 48 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 2a270c26..c109fa0e 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -411,7 +411,7 @@ if i32.const 0 i32.const 48 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -426,7 +426,7 @@ if i32.const 0 i32.const 48 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/new-without-allocator.untouched.wat b/tests/compiler/new-without-allocator.untouched.wat index 67b603f0..8536842a 100644 --- a/tests/compiler/new-without-allocator.untouched.wat +++ b/tests/compiler/new-without-allocator.untouched.wat @@ -61,7 +61,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -76,7 +76,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/number.optimized.wat b/tests/compiler/number.optimized.wat index 3dd9e106..371c950d 100644 --- a/tests/compiler/number.optimized.wat +++ b/tests/compiler/number.optimized.wat @@ -302,7 +302,7 @@ if i32.const 0 i32.const 464 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -316,7 +316,7 @@ if i32.const 0 i32.const 464 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/number.untouched.wat b/tests/compiler/number.untouched.wat index c248e7f2..3e29c6cc 100644 --- a/tests/compiler/number.untouched.wat +++ b/tests/compiler/number.untouched.wat @@ -399,7 +399,7 @@ if i32.const 0 i32.const 464 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -414,7 +414,7 @@ if i32.const 0 i32.const 464 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -3609,7 +3609,12 @@ i32.const 1792 end ) - (func $~lib/number/F32.isSafeInteger (; 27 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 27 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.ne + ) + (func $~lib/number/F32.isSafeInteger (; 28 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) (local $1 i32) local.get $0 f32.abs @@ -3625,31 +3630,28 @@ local.get $1 end ) - (func $~lib/number/F32.isInteger (; 28 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) - (local $1 f32) - (local $2 i32) - block $~lib/builtins/isFinite|inlined.0 (result i32) - local.get $0 - local.set $1 - local.get $1 - local.get $1 - f32.sub - f32.const 0 - f32.eq - end - local.tee $2 - i32.const 0 - i32.ne + (func $~lib/builtins/isFinite (; 29 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.sub + f32.const 0 + f32.eq + ) + (func $~lib/number/F32.isInteger (; 30 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + (local $1 i32) + local.get $0 + call $~lib/builtins/isFinite + local.tee $1 if (result i32) local.get $0 f32.trunc local.get $0 f32.eq else - local.get $2 + local.get $1 end ) - (func $~lib/number/F64.isSafeInteger (; 29 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + (func $~lib/number/F64.isSafeInteger (; 31 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) (local $1 i32) local.get $0 f64.abs @@ -3665,34 +3667,22 @@ local.get $1 end ) - (func $~lib/number/F64.isInteger (; 30 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) - (local $1 f64) - (local $2 i32) - block $~lib/builtins/isFinite|inlined.0 (result i32) - local.get $0 - local.set $1 - local.get $1 - local.get $1 - f64.sub - f64.const 0 - f64.eq - end - local.tee $2 - i32.const 0 - i32.ne + (func $~lib/number/F64.isInteger (; 32 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + (local $1 i32) + local.get $0 + call $~lib/builtins/isFinite + local.tee $1 if (result i32) local.get $0 f64.trunc local.get $0 f64.eq else - local.get $2 + local.get $1 end ) - (func $start:number (; 31 ;) (type $FUNCSIG$v) + (func $start:number (; 33 ;) (type $FUNCSIG$v) (local $0 i32) - (local $1 f32) - (local $2 f64) global.get $~lib/memory/HEAP_BASE i32.const 7 i32.add @@ -3874,15 +3864,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.0 (result i32) - global.get $~lib/number/F32.NaN - local.set $1 - local.get $1 - local.get $1 - f32.ne - end - i32.const 0 - i32.ne + global.get $~lib/number/F32.NaN + call $~lib/builtins/isNaN i32.eqz if i32.const 0 @@ -4015,8 +3998,6 @@ end f32.const 0 call $~lib/number/F32.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4030,8 +4011,6 @@ end f32.const -0 call $~lib/number/F32.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4046,8 +4025,6 @@ f32.const nan:0x400000 call $~lib/number/F32.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4061,8 +4038,6 @@ f32.const inf call $~lib/number/F32.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4076,8 +4051,6 @@ global.get $~lib/builtins/f32.EPSILON call $~lib/number/F32.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4090,8 +4063,6 @@ end f32.const 1 call $~lib/number/F32.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4105,8 +4076,6 @@ end f32.const -1 call $~lib/number/F32.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4120,8 +4089,6 @@ end global.get $~lib/builtins/f32.MIN_SAFE_INTEGER call $~lib/number/F32.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4135,8 +4102,6 @@ end global.get $~lib/builtins/f32.MAX_SAFE_INTEGER call $~lib/number/F32.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4151,8 +4116,6 @@ f32.const 0.5 call $~lib/number/F32.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4166,8 +4129,6 @@ f32.const -1.5 call $~lib/number/F32.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4178,15 +4139,8 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.0 (result i32) - global.get $~lib/number/F64.NaN - local.set $2 - local.get $2 - local.get $2 - f64.ne - end - i32.const 0 - i32.ne + global.get $~lib/number/F64.NaN + call $~lib/builtins/isNaN i32.eqz if i32.const 0 @@ -4319,8 +4273,6 @@ end f64.const 0 call $~lib/number/F64.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4334,8 +4286,6 @@ end f64.const -0 call $~lib/number/F64.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4350,8 +4300,6 @@ f64.const nan:0x8000000000000 call $~lib/number/F64.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4365,8 +4313,6 @@ f64.const inf call $~lib/number/F64.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4380,8 +4326,6 @@ global.get $~lib/builtins/f64.EPSILON call $~lib/number/F64.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4394,8 +4338,6 @@ end f64.const 1 call $~lib/number/F64.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4409,8 +4351,6 @@ end f64.const -1 call $~lib/number/F64.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4424,8 +4364,6 @@ end global.get $~lib/builtins/f64.MIN_SAFE_INTEGER call $~lib/number/F64.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4439,8 +4377,6 @@ end global.get $~lib/builtins/f64.MAX_SAFE_INTEGER call $~lib/number/F64.isInteger - i32.const 0 - i32.ne i32.const 1 i32.eq i32.eqz @@ -4455,8 +4391,6 @@ f64.const 0.5 call $~lib/number/F64.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4470,8 +4404,6 @@ f64.const -1.5 call $~lib/number/F64.isInteger i32.const 0 - i32.ne - i32.const 0 i32.eq i32.eqz if @@ -4483,9 +4415,9 @@ unreachable end ) - (func $start (; 32 ;) (type $FUNCSIG$v) + (func $start (; 34 ;) (type $FUNCSIG$v) call $start:number ) - (func $null (; 33 ;) (type $FUNCSIG$v) + (func $null (; 35 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index 0f616e20..d61d4985 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -106,7 +106,7 @@ if i32.const 0 i32.const 48 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -120,7 +120,7 @@ if i32.const 0 i32.const 48 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/object-literal.untouched.wat b/tests/compiler/object-literal.untouched.wat index 94d788e8..dde2789c 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -147,7 +147,7 @@ if i32.const 0 i32.const 48 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -162,7 +162,7 @@ if i32.const 0 i32.const 48 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/optional-typeparameters.optimized.wat b/tests/compiler/optional-typeparameters.optimized.wat index 7809fc33..bd858688 100644 --- a/tests/compiler/optional-typeparameters.optimized.wat +++ b/tests/compiler/optional-typeparameters.optimized.wat @@ -100,7 +100,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -114,7 +114,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/optional-typeparameters.untouched.wat b/tests/compiler/optional-typeparameters.untouched.wat index f5a70edb..c2ce724f 100644 --- a/tests/compiler/optional-typeparameters.untouched.wat +++ b/tests/compiler/optional-typeparameters.untouched.wat @@ -154,7 +154,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -169,7 +169,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index e5b3bd8e..e9f3794f 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -2,7 +2,6 @@ (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$vii (func (param i32 i32))) @@ -375,7 +374,7 @@ if i32.const 0 i32.const 224 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -389,7 +388,7 @@ if i32.const 0 i32.const 224 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -437,7 +436,7 @@ if i32.const 0 i32.const 224 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -477,1304 +476,22 @@ i32.store offset=8 local.get $0 ) - (func $~lib/util/memory/memcpy (; 10 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - loop $continue|0 - local.get $1 - i32.const 3 - i32.and - local.get $2 - local.get $2 - select - if - local.get $0 - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $continue|0 - end - end - local.get $0 - i32.const 3 - i32.and - i32.eqz - if - loop $continue|1 - local.get $2 - i32.const 16 - i32.ge_u - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 12 - i32.add - i32.load - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|1 - end - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $1 - i32.const 8 - i32.add - local.set $1 - local.get $0 - i32.const 8 - i32.add - local.set $0 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $1 - i32.const 4 - i32.add - local.set $1 - local.get $0 - i32.const 4 - i32.add - local.set $0 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load16_u - i32.store16 - local.get $1 - i32.const 2 - i32.add - local.set $1 - local.get $0 - i32.const 2 - i32.add - local.set $0 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - end - return - end - local.get $2 - i32.const 32 - i32.ge_u - if - block $break|2 - block $case2|2 - block $case1|2 - local.get $0 - i32.const 3 - i32.and - local.tee $3 - i32.const 1 - i32.ne - if - local.get $3 - i32.const 2 - i32.eq - br_if $case1|2 - local.get $3 - i32.const 3 - i32.eq - br_if $case2|2 - br $break|2 - end - local.get $1 - i32.load - local.set $5 - local.get $0 - local.get $1 - local.tee $3 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $1 - local.set $0 - local.get $1 - local.get $3 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - loop $continue|3 - local.get $2 - i32.const 17 - i32.ge_u - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.load - local.tee $3 - i32.const 8 - i32.shl - local.get $5 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 5 - i32.add - i32.load - local.tee $5 - i32.const 8 - i32.shl - local.get $3 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 9 - i32.add - i32.load - local.tee $3 - i32.const 8 - i32.shl - local.get $5 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 13 - i32.add - i32.load - local.tee $5 - i32.const 8 - i32.shl - local.get $3 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|3 - end - end - br $break|2 - end - local.get $1 - i32.load - local.set $5 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - local.get $2 - i32.const 2 - i32.sub - local.set $2 - loop $continue|4 - local.get $2 - i32.const 18 - i32.ge_u - if - local.get $0 - local.get $1 - i32.const 2 - i32.add - i32.load - local.tee $3 - i32.const 16 - i32.shl - local.get $5 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 6 - i32.add - i32.load - local.tee $5 - i32.const 16 - i32.shl - local.get $3 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 10 - i32.add - i32.load - local.tee $3 - i32.const 16 - i32.shl - local.get $5 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 14 - i32.add - i32.load - local.tee $5 - i32.const 16 - i32.shl - local.get $3 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|4 - end - end - br $break|2 - end - local.get $1 - i32.load - local.set $5 - local.get $0 - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - loop $continue|5 - local.get $2 - i32.const 19 - i32.ge_u - if - local.get $0 - local.get $1 - i32.const 3 - i32.add - i32.load - local.tee $3 - i32.const 24 - i32.shl - local.get $5 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 7 - i32.add - i32.load - local.tee $5 - i32.const 24 - i32.shl - local.get $3 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 11 - i32.add - i32.load - local.tee $3 - i32.const 24 - i32.shl - local.get $5 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 15 - i32.add - i32.load - local.tee $5 - i32.const 24 - i32.shl - local.get $3 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|5 - end - end - end - end - local.get $2 - i32.const 16 - i32.and - if - local.get $0 - local.get $1 - local.tee $3 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $1 - local.set $0 - local.get $1 - local.get $3 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - local.tee $3 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $1 - local.set $0 - local.get $1 - local.get $3 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - local.tee $3 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $1 - local.set $0 - local.get $1 - local.get $3 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - local.set $0 - local.get $3 - local.get $1 - i32.const 1 - i32.add - local.tee $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - end - ) - (func $~lib/memory/memory.copy (; 11 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $1 - i32.eq - br_if $~lib/util/memory/memmove|inlined.0 - local.get $1 - local.get $2 - i32.add - local.get $0 - i32.le_u - local.tee $3 - i32.eqz - if - local.get $0 - local.get $2 - i32.add - local.get $1 - i32.le_u - local.set $3 - end - local.get $3 - if - local.get $0 - local.get $1 - local.get $2 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end - local.get $0 - local.get $1 - i32.lt_u - if - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - loop $continue|0 - local.get $0 - i32.const 7 - i32.and - if - local.get $2 - i32.eqz - br_if $~lib/util/memory/memmove|inlined.0 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - local.get $0 - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - br $continue|0 - end - end - loop $continue|1 - local.get $2 - i32.const 8 - i32.ge_u - if - local.get $0 - local.get $1 - i64.load - i64.store - local.get $2 - i32.const 8 - i32.sub - local.set $2 - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - br $continue|1 - end - end - end - loop $continue|2 - local.get $2 - if - local.get $0 - local.tee $4 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $4 - local.get $3 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $continue|2 - end - end - else - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - loop $continue|3 - local.get $0 - local.get $2 - i32.add - i32.const 7 - i32.and - if - local.get $2 - i32.eqz - br_if $~lib/util/memory/memmove|inlined.0 - local.get $2 - i32.const 1 - i32.sub - local.tee $2 - local.get $0 - i32.add - local.get $1 - local.get $2 - i32.add - i32.load8_u - i32.store8 - br $continue|3 - end - end - loop $continue|4 - local.get $2 - i32.const 8 - i32.ge_u - if - local.get $2 - i32.const 8 - i32.sub - local.tee $2 - local.get $0 - i32.add - local.get $1 - local.get $2 - i32.add - i64.load - i64.store - br $continue|4 - end - end - end - loop $continue|5 - local.get $2 - if - local.get $2 - i32.const 1 - i32.sub - local.tee $2 - local.get $0 - i32.add - local.get $1 - local.get $2 - i32.add - i32.load8_u - i32.store8 - br $continue|5 - end - end - end - end - ) - (func $~lib/runtime/doReallocate (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $0 - i32.const 8 - i32.sub - local.tee $3 - i32.load offset=4 - local.tee $2 - local.get $1 - i32.lt_u - if - i32.const 1 - i32.const 32 - local.get $2 - i32.const 7 - i32.add - i32.clz - i32.sub - i32.shl - i32.const 0 - local.get $0 - i32.const 304 - i32.gt_u - select - i32.const 1 - i32.const 32 - local.get $1 - i32.const 7 - i32.add - i32.clz - i32.sub - i32.shl - local.tee $4 - i32.lt_u - if - local.get $4 - call $~lib/memory/memory.allocate - local.tee $4 - local.get $3 - i32.load - i32.store - local.get $4 - i32.const 8 - i32.add - local.tee $5 - local.get $0 - local.get $2 - call $~lib/memory/memory.copy - local.get $2 - local.get $5 - i32.add - local.get $1 - local.get $2 - i32.sub - call $~lib/memory/memory.fill - local.get $3 - i32.load - i32.const -1520547049 - i32.eq - if - local.get $0 - i32.const 304 - i32.le_u - if - i32.const 0 - i32.const 224 - i32.const 100 - i32.const 8 - call $~lib/env/abort - unreachable - end - end - local.get $4 - local.set $3 - local.get $5 - local.set $0 - else - local.get $0 - local.get $2 - i32.add - local.get $1 - local.get $2 - i32.sub - call $~lib/memory/memory.fill - end - end - local.get $3 - local.get $1 - i32.store offset=4 - local.get $0 - ) - (func $~lib/array/ensureCapacity (; 13 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - local.get $1 - local.get $0 - i32.load offset=8 - local.get $2 - i32.shr_u - i32.gt_u - if - local.get $1 - i32.const 1073741816 - local.get $2 - i32.shr_u - i32.gt_u - if - i32.const 0 - i32.const 104 - i32.const 10 - i32.const 64 - call $~lib/env/abort - unreachable - end - local.get $0 - i32.load - local.tee $3 - local.get $1 - local.get $2 - i32.shl - local.tee $2 - call $~lib/runtime/doReallocate - local.set $1 - local.get $1 - local.get $3 - i32.ne - if - local.get $0 - local.get $1 - i32.store - local.get $0 - local.get $1 - i32.store offset=4 - end - local.get $0 - local.get $2 - i32.store offset=8 - end - ) - (func $~lib/array/Array#__set (; 14 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 0 - call $~lib/array/ensureCapacity - local.get $1 - local.get $0 - i32.load offset=4 - i32.add - local.get $2 - i32.store8 - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array#__set (; 15 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $std/array-literal/Ref#constructor (; 16 ;) (type $FUNCSIG$i) (result i32) + (func $std/array-literal/Ref#constructor (; 10 ;) (type $FUNCSIG$i) (result i32) i32.const 0 call $~lib/runtime/doAllocate i32.const 6 call $~lib/runtime/doRegister ) - (func $std/array-literal/RefWithCtor#constructor (; 17 ;) (type $FUNCSIG$i) (result i32) + (func $std/array-literal/RefWithCtor#constructor (; 11 ;) (type $FUNCSIG$i) (result i32) i32.const 0 call $~lib/runtime/doAllocate i32.const 8 call $~lib/runtime/doRegister ) - (func $start:std/array-literal (; 18 ;) (type $FUNCSIG$v) + (func $start:std/array-literal (; 12 ;) (type $FUNCSIG$v) (local $0 i32) + (local $1 i32) + (local $2 i32) i32.const 44 i32.load i32.const 3 @@ -1900,25 +617,26 @@ i32.const 3 i32.store offset=12 local.get $0 - i32.const 0 - global.get $std/array-literal/i - call $~lib/array/Array#__set + i32.load offset=4 + local.tee $1 global.get $std/array-literal/i + local.tee $2 + i32.store8 + local.get $2 i32.const 1 i32.add global.set $std/array-literal/i - local.get $0 - i32.const 1 - global.get $std/array-literal/i - call $~lib/array/Array#__set + local.get $1 global.get $std/array-literal/i + local.tee $2 + i32.store8 offset=1 + local.get $2 i32.const 1 i32.add global.set $std/array-literal/i - local.get $0 - i32.const 2 + local.get $1 global.get $std/array-literal/i - call $~lib/array/Array#__set + i32.store8 offset=2 local.get $0 global.set $std/array-literal/dynamicArrayI8 global.get $std/array-literal/dynamicArrayI8 @@ -1978,33 +696,34 @@ call $~lib/runtime/doRegister i32.const 2 call $~lib/runtime/ArrayBufferView#constructor - local.tee $0 + local.tee $1 i32.const 0 i32.store offset=12 - local.get $0 + local.get $1 i32.const 3 i32.store offset=12 - local.get $0 - i32.const 0 - global.get $std/array-literal/i - call $~lib/array/Array#__set + local.get $1 + i32.load offset=4 + local.tee $0 global.get $std/array-literal/i + local.tee $2 + i32.store + local.get $2 i32.const 1 i32.add global.set $std/array-literal/i local.get $0 - i32.const 1 - global.get $std/array-literal/i - call $~lib/array/Array#__set global.get $std/array-literal/i + local.tee $2 + i32.store offset=4 + local.get $2 i32.const 1 i32.add global.set $std/array-literal/i local.get $0 - i32.const 2 global.get $std/array-literal/i - call $~lib/array/Array#__set - local.get $0 + i32.store offset=8 + local.get $1 global.set $std/array-literal/dynamicArrayI32 global.get $std/array-literal/dynamicArrayI32 i32.load offset=12 @@ -2068,17 +787,16 @@ i32.const 3 i32.store offset=12 local.get $0 - i32.const 0 + i32.load offset=4 + local.tee $1 call $std/array-literal/Ref#constructor - call $~lib/array/Array#__set - local.get $0 - i32.const 1 + i32.store + local.get $1 call $std/array-literal/Ref#constructor - call $~lib/array/Array#__set - local.get $0 - i32.const 2 + i32.store offset=4 + local.get $1 call $std/array-literal/Ref#constructor - call $~lib/array/Array#__set + i32.store offset=8 local.get $0 global.set $std/array-literal/dynamicArrayRef global.get $std/array-literal/dynamicArrayRef @@ -2099,25 +817,24 @@ call $~lib/runtime/doRegister i32.const 2 call $~lib/runtime/ArrayBufferView#constructor - local.tee $0 + local.tee $1 i32.const 0 i32.store offset=12 - local.get $0 + local.get $1 i32.const 3 i32.store offset=12 - local.get $0 - i32.const 0 + local.get $1 + i32.load offset=4 + local.tee $0 call $std/array-literal/RefWithCtor#constructor - call $~lib/array/Array#__set + i32.store local.get $0 - i32.const 1 call $std/array-literal/RefWithCtor#constructor - call $~lib/array/Array#__set + i32.store offset=4 local.get $0 - i32.const 2 call $std/array-literal/RefWithCtor#constructor - call $~lib/array/Array#__set - local.get $0 + i32.store offset=8 + local.get $1 global.set $std/array-literal/dynamicArrayRefWithCtor global.get $std/array-literal/dynamicArrayRefWithCtor i32.load offset=12 @@ -2132,10 +849,10 @@ unreachable end ) - (func $start (; 19 ;) (type $FUNCSIG$v) + (func $start (; 13 ;) (type $FUNCSIG$v) call $start:std/array-literal ) - (func $null (; 20 ;) (type $FUNCSIG$v) + (func $null (; 14 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index dcba2a8f..ed722563 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -470,7 +470,7 @@ if i32.const 0 i32.const 224 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -485,7 +485,7 @@ if i32.const 0 i32.const 224 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -549,7 +549,7 @@ if i32.const 0 i32.const 224 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -621,1624 +621,7 @@ i32.store offset=12 local.get $0 ) - (func $~lib/util/memory/memcpy (; 15 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - block $break|0 - loop $continue|0 - local.get $2 - if (result i32) - local.get $1 - i32.const 3 - i32.and - else - local.get $2 - end - if - block - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - end - br $continue|0 - end - end - end - local.get $0 - i32.const 3 - i32.and - i32.const 0 - i32.eq - if - block $break|1 - loop $continue|1 - local.get $2 - i32.const 16 - i32.ge_u - if - block - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 12 - i32.add - i32.load - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|1 - end - end - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.set $0 - local.get $1 - i32.const 4 - i32.add - local.set $1 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load16_u - i32.store16 - local.get $0 - i32.const 2 - i32.add - local.set $0 - local.get $1 - i32.const 2 - i32.add - local.set $1 - end - local.get $2 - i32.const 1 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - return - end - local.get $2 - i32.const 32 - i32.ge_u - if - block $break|2 - block $case2|2 - block $case1|2 - block $case0|2 - local.get $0 - i32.const 3 - i32.and - local.set $5 - local.get $5 - i32.const 1 - i32.eq - br_if $case0|2 - local.get $5 - i32.const 2 - i32.eq - br_if $case1|2 - local.get $5 - i32.const 3 - i32.eq - br_if $case2|2 - br $break|2 - end - block - local.get $1 - i32.load - local.set $3 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - block $break|3 - loop $continue|3 - local.get $2 - i32.const 17 - i32.ge_u - if - block - local.get $1 - i32.const 1 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 5 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 9 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 13 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|3 - end - end - end - br $break|2 - unreachable - end - unreachable - end - block - local.get $1 - i32.load - local.set $3 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 2 - i32.sub - local.set $2 - block $break|4 - loop $continue|4 - local.get $2 - i32.const 18 - i32.ge_u - if - block - local.get $1 - i32.const 2 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 6 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 10 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 14 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|4 - end - end - end - br $break|2 - unreachable - end - unreachable - end - block - local.get $1 - i32.load - local.set $3 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - block $break|5 - loop $continue|5 - local.get $2 - i32.const 19 - i32.ge_u - if - block - local.get $1 - i32.const 3 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 7 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 11 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 15 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|5 - end - end - end - br $break|2 - unreachable - end - unreachable - end - end - local.get $2 - i32.const 16 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 8 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 4 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 2 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 1 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - ) - (func $~lib/memory/memory.copy (; 16 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $1 - i32.eq - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $1 - local.get $2 - i32.add - local.get $0 - i32.le_u - local.tee $3 - if (result i32) - local.get $3 - else - local.get $0 - local.get $2 - i32.add - local.get $1 - i32.le_u - end - if - local.get $0 - local.get $1 - local.get $2 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end - local.get $0 - local.get $1 - i32.lt_u - if - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - block $break|0 - loop $continue|0 - local.get $0 - i32.const 7 - i32.and - if - block - local.get $2 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $2 - i32.const 1 - i32.sub - local.set $2 - block (result i32) - local.get $0 - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - end - block (result i32) - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - end - i32.load8_u - i32.store8 - end - br $continue|0 - end - end - end - block $break|1 - loop $continue|1 - local.get $2 - i32.const 8 - i32.ge_u - if - block - local.get $0 - local.get $1 - i64.load - i64.store - local.get $2 - i32.const 8 - i32.sub - local.set $2 - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - end - br $continue|1 - end - end - end - end - block $break|2 - loop $continue|2 - local.get $2 - if - block - block (result i32) - local.get $0 - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - end - block (result i32) - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - end - br $continue|2 - end - end - end - else - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - block $break|3 - loop $continue|3 - local.get $0 - local.get $2 - i32.add - i32.const 7 - i32.and - if - block - local.get $2 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $0 - local.get $2 - i32.const 1 - i32.sub - local.tee $2 - i32.add - local.get $1 - local.get $2 - i32.add - i32.load8_u - i32.store8 - end - br $continue|3 - end - end - end - block $break|4 - loop $continue|4 - local.get $2 - i32.const 8 - i32.ge_u - if - block - local.get $2 - i32.const 8 - i32.sub - local.set $2 - local.get $0 - local.get $2 - i32.add - local.get $1 - local.get $2 - i32.add - i64.load - i64.store - end - br $continue|4 - end - end - end - end - block $break|5 - loop $continue|5 - local.get $2 - if - local.get $0 - local.get $2 - i32.const 1 - i32.sub - local.tee $2 - i32.add - local.get $1 - local.get $2 - i32.add - i32.load8_u - i32.store8 - br $continue|5 - end - end - end - end - end - ) - (func $~lib/memory/memory.free (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) - (local $1 i32) - local.get $0 - local.set $1 - ) - (func $~lib/runtime/doReallocate (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - local.get $0 - global.get $~lib/runtime/HEADER_SIZE - i32.sub - local.set $2 - local.get $2 - i32.load offset=4 - local.set $3 - local.get $3 - local.get $1 - i32.lt_u - if - local.get $1 - call $~lib/runtime/ADJUSTOBLOCK - local.set $4 - local.get $3 - call $~lib/runtime/ADJUSTOBLOCK - i32.const 0 - local.get $0 - global.get $~lib/memory/HEAP_BASE - i32.gt_u - select - local.get $4 - i32.lt_u - if - local.get $4 - call $~lib/memory/memory.allocate - local.set $5 - local.get $5 - local.get $2 - i32.load - i32.store - local.get $5 - global.get $~lib/runtime/HEADER_SIZE - i32.add - local.set $6 - local.get $6 - local.get $0 - local.get $3 - call $~lib/memory/memory.copy - local.get $6 - local.get $3 - i32.add - i32.const 0 - local.get $1 - local.get $3 - i32.sub - call $~lib/memory/memory.fill - local.get $2 - i32.load - global.get $~lib/runtime/HEADER_MAGIC - i32.eq - if - local.get $0 - global.get $~lib/memory/HEAP_BASE - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 224 - i32.const 100 - i32.const 8 - call $~lib/env/abort - unreachable - end - local.get $2 - call $~lib/memory/memory.free - else - nop - end - local.get $5 - local.set $2 - local.get $6 - local.set $0 - else - local.get $0 - local.get $3 - i32.add - i32.const 0 - local.get $1 - local.get $3 - i32.sub - call $~lib/memory/memory.fill - end - else - nop - end - local.get $2 - local.get $1 - i32.store offset=4 - local.get $0 - ) - (func $~lib/array/ensureCapacity (; 19 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - local.get $1 - local.get $0 - i32.load offset=8 - local.get $2 - i32.shr_u - i32.gt_u - if - local.get $1 - global.get $~lib/runtime/MAX_BYTELENGTH - local.get $2 - i32.shr_u - i32.gt_u - if - i32.const 0 - i32.const 104 - i32.const 10 - i32.const 64 - call $~lib/env/abort - unreachable - end - local.get $0 - i32.load - local.set $3 - local.get $1 - local.get $2 - i32.shl - local.set $4 - block $~lib/runtime/REALLOCATE|inlined.0 (result i32) - local.get $3 - local.set $5 - local.get $4 - local.set $6 - local.get $5 - local.get $6 - call $~lib/runtime/doReallocate - end - local.set $6 - local.get $6 - local.get $3 - i32.ne - if - local.get $0 - local.get $6 - i32.store - local.get $0 - local.get $6 - i32.store offset=4 - end - local.get $0 - local.get $4 - i32.store offset=8 - end - ) - (func $~lib/array/Array#__set (; 20 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 0 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 0 - i32.shl - i32.add - local.get $2 - i32.store8 - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array#constructor (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 if (result i32) @@ -2263,34 +646,7 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array#__set (; 22 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $std/array-literal/Ref#constructor (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $std/array-literal/Ref#constructor (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 i32.eqz @@ -2307,7 +663,7 @@ end local.get $0 ) - (func $~lib/array/Array#constructor (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 17 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 if (result i32) @@ -2332,38 +688,11 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array#__set (; 25 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array#get:length (; 26 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=12 ) - (func $std/array-literal/RefWithCtor#constructor (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $std/array-literal/RefWithCtor#constructor (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 i32.eqz @@ -2380,7 +709,7 @@ end local.get $0 ) - (func $~lib/array/Array#constructor (; 28 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 if (result i32) @@ -2405,42 +734,13 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array#__set (; 29 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array#get:length (; 30 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=12 ) - (func $start:std/array-literal (; 31 ;) (type $FUNCSIG$v) + (func $start:std/array-literal (; 22 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - (local $2 i32) - (local $3 i32) global.get $std/array-literal/staticArrayI8 call $~lib/array/Array#get:length i32.const 3 @@ -2580,11 +880,12 @@ call $~lib/array/Array#constructor local.set $0 local.get $0 - i32.const 0 + i32.load offset=4 + local.set $1 + local.get $1 global.get $std/array-literal/i - call $~lib/array/Array#__set - local.get $0 - i32.const 1 + i32.store8 + local.get $1 block (result i32) global.get $std/array-literal/i i32.const 1 @@ -2592,9 +893,8 @@ global.set $std/array-literal/i global.get $std/array-literal/i end - call $~lib/array/Array#__set - local.get $0 - i32.const 2 + i32.store8 offset=1 + local.get $1 block (result i32) global.get $std/array-literal/i i32.const 1 @@ -2602,7 +902,7 @@ global.set $std/array-literal/i global.get $std/array-literal/i end - call $~lib/array/Array#__set + i32.store8 offset=2 local.get $0 end global.set $std/array-literal/dynamicArrayI8 @@ -2669,11 +969,12 @@ call $~lib/array/Array#constructor local.set $1 local.get $1 - i32.const 0 + i32.load offset=4 + local.set $0 + local.get $0 global.get $std/array-literal/i - call $~lib/array/Array#__set - local.get $1 - i32.const 1 + i32.store + local.get $0 block (result i32) global.get $std/array-literal/i i32.const 1 @@ -2681,9 +982,8 @@ global.set $std/array-literal/i global.get $std/array-literal/i end - call $~lib/array/Array#__set - local.get $1 - i32.const 2 + i32.store offset=4 + local.get $0 block (result i32) global.get $std/array-literal/i i32.const 1 @@ -2691,7 +991,7 @@ global.set $std/array-literal/i global.get $std/array-literal/i end - call $~lib/array/Array#__set + i32.store offset=8 local.get $1 end global.set $std/array-literal/dynamicArrayI32 @@ -2754,23 +1054,23 @@ i32.const 0 i32.const 3 call $~lib/array/Array#constructor - local.set $2 - local.get $2 - i32.const 0 + local.set $0 + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 i32.const 0 call $std/array-literal/Ref#constructor - call $~lib/array/Array#__set - local.get $2 - i32.const 1 + i32.store + local.get $1 i32.const 0 call $std/array-literal/Ref#constructor - call $~lib/array/Array#__set - local.get $2 - i32.const 2 + i32.store offset=4 + local.get $1 i32.const 0 call $std/array-literal/Ref#constructor - call $~lib/array/Array#__set - local.get $2 + i32.store offset=8 + local.get $0 end global.set $std/array-literal/dynamicArrayRef global.get $std/array-literal/dynamicArrayRef @@ -2790,23 +1090,23 @@ i32.const 0 i32.const 3 call $~lib/array/Array#constructor - local.set $3 - local.get $3 - i32.const 0 + local.set $1 + local.get $1 + i32.load offset=4 + local.set $0 + local.get $0 i32.const 0 call $std/array-literal/RefWithCtor#constructor - call $~lib/array/Array#__set - local.get $3 - i32.const 1 + i32.store + local.get $0 i32.const 0 call $std/array-literal/RefWithCtor#constructor - call $~lib/array/Array#__set - local.get $3 - i32.const 2 + i32.store offset=4 + local.get $0 i32.const 0 call $std/array-literal/RefWithCtor#constructor - call $~lib/array/Array#__set - local.get $3 + i32.store offset=8 + local.get $1 end global.set $std/array-literal/dynamicArrayRefWithCtor global.get $std/array-literal/dynamicArrayRefWithCtor @@ -2823,9 +1123,9 @@ unreachable end ) - (func $start (; 32 ;) (type $FUNCSIG$v) + (func $start (; 23 ;) (type $FUNCSIG$v) call $start:std/array-literal ) - (func $null (; 33 ;) (type $FUNCSIG$v) + (func $null (; 24 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 7a6281cd..5251bf5e 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -216,11 +216,16 @@ (data (i32.const 6296) "\02\00\00\00\10\00\00\00\c8\15\00\00h\18\00\00\00\00\00\00x\18") (data (i32.const 6320) "\01\00\00\00\0c\00\00\001\00,\002\00,\00,\004") (data (i32.const 6344) "\02\00\00\00\08\00\00\00\01\00\00\00\02") - (data (i32.const 6360) "\02\00\00\00\08\00\00\00\03\00\00\00\04") - (data (i32.const 6376) "\01\00\00\00\0e\00\00\001\00,\002\00,\003\00,\004") - (data (i32.const 6400) "\02\00\00\00\02\00\00\00\01\02") - (data (i32.const 6416) "\02\00\00\00\02\00\00\00\03\04") - (data (i32.const 6432) "\02\00\00\00\04\00\00\00\01") + (data (i32.const 6360) "\02\00\00\00\08\00\00\00\01\00\00\00\02") + (data (i32.const 6376) "\02\00\00\00\08\00\00\00\03\00\00\00\04") + (data (i32.const 6392) "\01\00\00\00\0e\00\00\001\00,\002\00,\003\00,\004") + (data (i32.const 6416) "\02\00\00\00\02\00\00\00\01\02") + (data (i32.const 6432) "\02\00\00\00\02\00\00\00\01\02") + (data (i32.const 6448) "\02\00\00\00\02\00\00\00\03\04") + (data (i32.const 6464) "\02\00\00\00\04\00\00\00\01") + (data (i32.const 6480) "\02\00\00\00\04\00\00\00\01") + (data (i32.const 6496) "\02\00\00\00\04\00\00\00\01") + (data (i32.const 6512) "\02\00\00\00\04\00\00\00\01") (table $0 56 funcref) (elem (i32.const 0) $null $start:std/array~anonymous|0 $start:std/array~anonymous|1 $start:std/array~anonymous|2 $start:std/array~anonymous|3 $start:std/array~anonymous|2 $start:std/array~anonymous|5 $start:std/array~anonymous|6 $start:std/array~anonymous|7 $start:std/array~anonymous|8 $start:std/array~anonymous|9 $start:std/array~anonymous|10 $start:std/array~anonymous|11 $start:std/array~anonymous|12 $start:std/array~anonymous|13 $start:std/array~anonymous|14 $start:std/array~anonymous|15 $start:std/array~anonymous|16 $start:std/array~anonymous|17 $start:std/array~anonymous|16 $start:std/array~anonymous|19 $start:std/array~anonymous|20 $start:std/array~anonymous|21 $start:std/array~anonymous|22 $start:std/array~anonymous|23 $start:std/array~anonymous|24 $start:std/array~anonymous|25 $start:std/array~anonymous|26 $start:std/array~anonymous|27 $start:std/array~anonymous|28 $start:std/array~anonymous|29 $start:std/array~anonymous|29 $start:std/array~anonymous|31 $start:std/array~anonymous|32 $start:std/array~anonymous|33 $start:std/array~anonymous|29 $start:std/array~anonymous|35 $start:std/array~anonymous|29 $start:std/array~anonymous|29 $start:std/array~anonymous|31 $start:std/array~anonymous|32 $start:std/array~anonymous|33 $start:std/array~anonymous|29 $start:std/array~anonymous|35 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $start:std/array~anonymous|44 $~lib/util/sort/COMPARATOR~anonymous|0 $start:std/array~anonymous|44 $start:std/array~anonymous|47 $start:std/array~anonymous|48 $~lib/util/sort/COMPARATOR~anonymous|0) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) @@ -591,12 +596,12 @@ ) (func $~lib/runtime/assertUnregistered (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - i32.const 6444 + i32.const 6524 i32.le_u if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -610,7 +615,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -658,7 +663,7 @@ if i32.const 0 i32.const 16 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -2142,7 +2147,7 @@ i32.shl i32.const 0 local.get $0 - i32.const 6444 + i32.const 6524 i32.gt_u select i32.const 1 @@ -2183,7 +2188,7 @@ i32.eq if local.get $0 - i32.const 6444 + i32.const 6524 i32.le_u if i32.const 0 @@ -2293,7 +2298,7 @@ if i32.const 0 i32.const 208 - i32.const 195 + i32.const 199 i32.const 20 call $~lib/env/abort unreachable @@ -2560,7 +2565,7 @@ if i32.const 0 i32.const 208 - i32.const 253 + i32.const 260 i32.const 20 call $~lib/env/abort unreachable @@ -4091,7 +4096,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -4587,7 +4592,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -5106,7 +5111,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -5431,7 +5436,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -9685,7 +9690,8 @@ (func $start:std/array (; 158 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - i32.const 6448 + (local $2 i32) + i32.const 6528 global.set $~lib/allocator/arena/startOffset global.get $~lib/allocator/arena/startOffset global.set $~lib/allocator/arena/offset @@ -13217,6 +13223,8 @@ i32.const 0 global.set $~lib/argc global.get $std/array/f32ArrayTyped + local.set $1 + i32.const 0 local.set $0 block $1of1 block $0of1 @@ -13227,10 +13235,10 @@ unreachable end i32.const 44 - local.set $1 + local.set $0 end - local.get $0 local.get $1 + local.get $0 call $~lib/array/Array#sort global.get $std/array/f32ArrayTyped i32.const 2576 @@ -13250,9 +13258,9 @@ i32.const 0 global.set $~lib/argc global.get $std/array/f64ArrayTyped - local.set $0 - i32.const 0 local.set $1 + i32.const 0 + local.set $0 block $1of143 block $0of144 block $outOfRange45 @@ -13262,10 +13270,10 @@ unreachable end i32.const 45 - local.set $1 + local.set $0 end - local.get $0 local.get $1 + local.get $0 call $~lib/array/Array#sort global.get $std/array/f64ArrayTyped i32.const 2712 @@ -13285,9 +13293,9 @@ i32.const 0 global.set $~lib/argc global.get $std/array/i32ArrayTyped - local.set $0 - i32.const 0 local.set $1 + i32.const 0 + local.set $0 block $1of146 block $0of147 block $outOfRange48 @@ -13297,10 +13305,10 @@ unreachable end i32.const 46 - local.set $1 + local.set $0 end - local.get $0 local.get $1 + local.get $0 call $~lib/array/Array#sort drop global.get $std/array/i32ArrayTyped @@ -13322,9 +13330,9 @@ i32.const 0 global.set $~lib/argc global.get $std/array/u32ArrayTyped - local.set $0 - i32.const 0 local.set $1 + i32.const 0 + local.set $0 block $1of149 block $0of150 block $outOfRange51 @@ -13334,10 +13342,10 @@ unreachable end i32.const 47 - local.set $1 + local.set $0 end - local.get $0 local.get $1 + local.get $0 call $~lib/array/Array#sort drop global.get $std/array/u32ArrayTyped @@ -13650,17 +13658,16 @@ i32.const 3 i32.store offset=12 local.get $0 - i32.const 0 + i32.load offset=4 + local.tee $1 call $std/array/Ref#constructor - call $~lib/array/Array#__set - local.get $0 - i32.const 1 + i32.store + local.get $1 i32.const 0 - call $~lib/array/Array#__set - local.get $0 - i32.const 2 + i32.store offset=4 + local.get $1 call $std/array/Ref#constructor - call $~lib/array/Array#__set + i32.store offset=8 local.get $0 global.set $std/array/refArr global.get $std/array/refArr @@ -13823,25 +13830,25 @@ end i32.const 2 call $~lib/array/Array>#constructor + local.tee $1 + i32.load offset=4 local.tee $0 - i32.const 0 - i32.const 6352 - i32.const 4 - i32.const 2 - call $~lib/runtime/doWrapArray - call $~lib/array/Array#__set - local.get $0 - i32.const 1 i32.const 6368 i32.const 4 i32.const 2 call $~lib/runtime/doWrapArray - call $~lib/array/Array#__set + i32.store local.get $0 + i32.const 6384 + i32.const 4 + i32.const 2 + call $~lib/runtime/doWrapArray + i32.store offset=4 + local.get $1 global.set $std/array/subarr32 global.get $std/array/subarr32 call $~lib/array/Array>#join_arr - i32.const 6384 + i32.const 6400 call $~lib/string/String.__eq i32.eqz if @@ -13866,24 +13873,24 @@ i32.const 2 i32.store offset=12 local.get $0 - i32.const 0 - i32.const 6408 + i32.load offset=4 + local.tee $1 + i32.const 6440 i32.const 7 i32.const 0 call $~lib/runtime/doWrapArray - call $~lib/array/Array#__set - local.get $0 - i32.const 1 - i32.const 6424 + i32.store + local.get $1 + i32.const 6456 i32.const 7 i32.const 0 call $~lib/runtime/doWrapArray - call $~lib/array/Array#__set + i32.store offset=4 local.get $0 global.set $std/array/subarr8 global.get $std/array/subarr8 call $~lib/array/Array>#join_arr - i32.const 6384 + i32.const 6400 call $~lib/string/String.__eq i32.eqz if @@ -13907,6 +13914,9 @@ local.get $0 i32.const 1 i32.store offset=12 + local.get $0 + i32.load offset=4 + local.set $1 i32.const 16 call $~lib/runtime/doAllocate i32.const 24 @@ -13914,23 +13924,22 @@ i32.const 1 i32.const 2 call $~lib/runtime/ArrayBufferView#constructor - local.tee $1 + local.tee $2 i32.const 0 i32.store offset=12 - local.get $1 + local.get $2 i32.const 1 i32.store offset=12 - local.get $1 - i32.const 0 - i32.const 6440 + local.get $2 + i32.load offset=4 + i32.const 6520 i32.const 8 i32.const 2 call $~lib/runtime/doWrapArray - call $~lib/array/Array#__set - local.get $0 - i32.const 0 + i32.store local.get $1 - call $~lib/array/Array#__set + local.get $2 + i32.store local.get $0 global.set $std/array/subarrU32 global.get $std/array/subarrU32 diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index d3123898..da2fc615 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -210,11 +210,16 @@ (data (i32.const 6296) "\02\00\00\00\10\00\00\00\c8\15\00\00h\18\00\00\00\00\00\00x\18\00\00") (data (i32.const 6320) "\01\00\00\00\0c\00\00\001\00,\002\00,\00,\004\00") (data (i32.const 6344) "\02\00\00\00\08\00\00\00\01\00\00\00\02\00\00\00") - (data (i32.const 6360) "\02\00\00\00\08\00\00\00\03\00\00\00\04\00\00\00") - (data (i32.const 6376) "\01\00\00\00\0e\00\00\001\00,\002\00,\003\00,\004\00") - (data (i32.const 6400) "\02\00\00\00\02\00\00\00\01\02") - (data (i32.const 6416) "\02\00\00\00\02\00\00\00\03\04") - (data (i32.const 6432) "\02\00\00\00\04\00\00\00\01\00\00\00") + (data (i32.const 6360) "\02\00\00\00\08\00\00\00\01\00\00\00\02\00\00\00") + (data (i32.const 6376) "\02\00\00\00\08\00\00\00\03\00\00\00\04\00\00\00") + (data (i32.const 6392) "\01\00\00\00\0e\00\00\001\00,\002\00,\003\00,\004\00") + (data (i32.const 6416) "\02\00\00\00\02\00\00\00\01\02") + (data (i32.const 6432) "\02\00\00\00\02\00\00\00\01\02") + (data (i32.const 6448) "\02\00\00\00\02\00\00\00\03\04") + (data (i32.const 6464) "\02\00\00\00\04\00\00\00\01\00\00\00") + (data (i32.const 6480) "\02\00\00\00\04\00\00\00\01\00\00\00") + (data (i32.const 6496) "\02\00\00\00\04\00\00\00\01\00\00\00") + (data (i32.const 6512) "\02\00\00\00\04\00\00\00\01\00\00\00") (table $0 56 funcref) (elem (i32.const 0) $null $start:std/array~anonymous|0 $start:std/array~anonymous|1 $start:std/array~anonymous|2 $start:std/array~anonymous|3 $start:std/array~anonymous|4 $start:std/array~anonymous|5 $start:std/array~anonymous|6 $start:std/array~anonymous|7 $start:std/array~anonymous|8 $start:std/array~anonymous|9 $start:std/array~anonymous|10 $start:std/array~anonymous|11 $start:std/array~anonymous|12 $start:std/array~anonymous|13 $start:std/array~anonymous|14 $start:std/array~anonymous|15 $start:std/array~anonymous|16 $start:std/array~anonymous|17 $start:std/array~anonymous|18 $start:std/array~anonymous|19 $start:std/array~anonymous|20 $start:std/array~anonymous|21 $start:std/array~anonymous|22 $start:std/array~anonymous|23 $start:std/array~anonymous|24 $start:std/array~anonymous|25 $start:std/array~anonymous|26 $start:std/array~anonymous|27 $start:std/array~anonymous|28 $start:std/array~anonymous|29 $start:std/array~anonymous|30 $start:std/array~anonymous|31 $start:std/array~anonymous|32 $start:std/array~anonymous|33 $start:std/array~anonymous|34 $start:std/array~anonymous|35 $start:std/array~anonymous|36 $start:std/array~anonymous|37 $start:std/array~anonymous|38 $start:std/array~anonymous|39 $start:std/array~anonymous|40 $start:std/array~anonymous|41 $start:std/array~anonymous|42 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|1 $start:std/array~anonymous|43 $start:std/array~anonymous|44 $start:std/array~anonymous|45 $start:std/array~anonymous|46 $start:std/array~anonymous|47 $start:std/array~anonymous|48 $~lib/util/sort/COMPARATOR~anonymous|0) (global $~lib/runtime/GC_IMPLEMENTED i32 (i32.const 0)) @@ -285,7 +290,7 @@ (global $std/array/subarr32 (mut i32) (i32.const 0)) (global $std/array/subarr8 (mut i32) (i32.const 0)) (global $std/array/subarrU32 (mut i32) (i32.const 0)) - (global $~lib/memory/HEAP_BASE i32 (i32.const 6444)) + (global $~lib/memory/HEAP_BASE i32 (i32.const 6524)) (export "memory" (memory $0)) (export "table" (table $0)) (start $start) @@ -666,7 +671,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -681,7 +686,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -745,7 +750,7 @@ if i32.const 0 i32.const 16 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -2947,7 +2952,7 @@ if i32.const 0 i32.const 208 - i32.const 195 + i32.const 199 i32.const 20 call $~lib/env/abort unreachable @@ -3306,7 +3311,7 @@ if i32.const 0 i32.const 208 - i32.const 253 + i32.const 260 i32.const 20 call $~lib/env/abort unreachable @@ -5278,7 +5283,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -5888,7 +5893,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -6523,7 +6528,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -7027,7 +7032,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -7598,7 +7603,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -7954,7 +7959,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -8211,7 +8216,7 @@ if i32.const 0 i32.const 208 - i32.const 357 + i32.const 373 i32.const 4 call $~lib/env/abort unreachable @@ -11808,34 +11813,7 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array#__set (; 216 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array#join_ref (; 217 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join_ref (; 216 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11997,18 +11975,18 @@ call $~lib/runtime/doRegister end ) - (func $~lib/array/Array#join (; 218 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 217 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array#join_ref return ) - (func $~lib/array/Array#toString (; 219 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 218 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array#join ) - (func $~lib/util/number/itoa (; 220 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/itoa (; 219 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 24 i32.shl @@ -12017,7 +11995,7 @@ call $~lib/util/number/itoa32 return ) - (func $~lib/util/number/itoa_stream (; 221 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 220 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -12092,7 +12070,7 @@ end local.get $3 ) - (func $~lib/array/Array#join_int (; 222 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join_int (; 221 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12238,25 +12216,25 @@ call $~lib/runtime/doRegister end ) - (func $~lib/array/Array#join (; 223 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 222 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array#join_int return ) - (func $~lib/array/Array#toString (; 224 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 223 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array#join ) - (func $~lib/util/number/itoa (; 225 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/itoa (; 224 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 65535 i32.and call $~lib/util/number/utoa32 return ) - (func $~lib/util/number/itoa_stream (; 226 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 225 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -12301,7 +12279,7 @@ end local.get $3 ) - (func $~lib/array/Array#join_int (; 227 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join_int (; 226 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12447,18 +12425,18 @@ call $~lib/runtime/doRegister end ) - (func $~lib/array/Array#join (; 228 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 227 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array#join_int return ) - (func $~lib/array/Array#toString (; 229 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 228 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array#join ) - (func $~lib/util/number/decimalCount64 (; 230 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/decimalCount64 (; 229 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) local.get $0 i64.const 1000000000000000 @@ -12527,7 +12505,7 @@ unreachable unreachable ) - (func $~lib/util/number/utoa64_lut (; 231 ;) (type $FUNCSIG$viji) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/util/number/utoa64_lut (; 230 ;) (type $FUNCSIG$viji) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i32) @@ -12655,7 +12633,7 @@ local.get $2 call $~lib/util/number/utoa32_lut ) - (func $~lib/util/number/utoa64 (; 232 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/utoa64 (; 231 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -12735,12 +12713,12 @@ call $~lib/runtime/doRegister end ) - (func $~lib/util/number/itoa (; 233 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/itoa (; 232 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) local.get $0 call $~lib/util/number/utoa64 return ) - (func $~lib/util/number/itoa_stream (; 234 ;) (type $FUNCSIG$iiij) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/util/number/itoa_stream (; 233 ;) (type $FUNCSIG$iiij) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -12806,7 +12784,7 @@ end local.get $3 ) - (func $~lib/array/Array#join_int (; 235 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join_int (; 234 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12952,18 +12930,18 @@ call $~lib/runtime/doRegister end ) - (func $~lib/array/Array#join (; 236 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 235 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array#join_int return ) - (func $~lib/array/Array#toString (; 237 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 236 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array#join ) - (func $~lib/util/number/itoa64 (; 238 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/itoa64 (; 237 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -13065,12 +13043,12 @@ call $~lib/runtime/doRegister end ) - (func $~lib/util/number/itoa (; 239 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/itoa (; 238 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) local.get $0 call $~lib/util/number/itoa64 return ) - (func $~lib/util/number/itoa_stream (; 240 ;) (type $FUNCSIG$iiij) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/util/number/itoa_stream (; 239 ;) (type $FUNCSIG$iiij) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -13158,7 +13136,7 @@ end local.get $3 ) - (func $~lib/array/Array#join_int (; 241 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join_int (; 240 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13304,23 +13282,23 @@ call $~lib/runtime/doRegister end ) - (func $~lib/array/Array#join (; 242 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 241 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array#join_int return ) - (func $~lib/array/Array#toString (; 243 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 242 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array#join ) - (func $~lib/array/Array#toString (; 244 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 243 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array#join ) - (func $~lib/array/Array>#join_arr (; 245 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join_arr (; 244 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13424,18 +13402,18 @@ end local.get $3 ) - (func $~lib/array/Array>#join (; 246 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 245 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array>#join_arr return ) - (func $~lib/array/Array>#toString (; 247 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#toString (; 246 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array>#join ) - (func $~lib/array/Array>#constructor (; 248 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 247 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 if (result i32) @@ -13460,41 +13438,14 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array>#__set (; 249 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/util/number/itoa (; 250 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/itoa (; 248 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 255 i32.and call $~lib/util/number/utoa32 return ) - (func $~lib/util/number/itoa_stream (; 251 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 249 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -13539,7 +13490,7 @@ end local.get $3 ) - (func $~lib/array/Array#join_int (; 252 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join_int (; 250 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13685,13 +13636,13 @@ call $~lib/runtime/doRegister end ) - (func $~lib/array/Array#join (; 253 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 251 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array#join_int return ) - (func $~lib/array/Array>#join_arr (; 254 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join_arr (; 252 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13795,18 +13746,18 @@ end local.get $3 ) - (func $~lib/array/Array>#join (; 255 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 253 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array>#join_arr return ) - (func $~lib/array/Array>#toString (; 256 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#toString (; 254 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array>#join ) - (func $~lib/array/Array>#constructor (; 257 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 255 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 if (result i32) @@ -13831,34 +13782,7 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array>#__set (; 258 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array>>#constructor (; 259 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>>#constructor (; 256 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 if (result i32) @@ -13883,34 +13807,7 @@ i32.store offset=12 local.get $0 ) - (func $~lib/array/Array>>#__set (; 260 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array>#join_arr (; 261 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join_arr (; 257 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14014,13 +13911,13 @@ end local.get $3 ) - (func $~lib/array/Array>#join (; 262 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 258 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array>#join_arr return ) - (func $~lib/array/Array>>#join_arr (; 263 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>>#join_arr (; 259 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14124,24 +14021,23 @@ end local.get $3 ) - (func $~lib/array/Array>>#join (; 264 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>>#join (; 260 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 call $~lib/array/Array>>#join_arr return ) - (func $~lib/array/Array>>#toString (; 265 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array>>#toString (; 261 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 3512 call $~lib/array/Array>>#join ) - (func $start:std/array (; 266 ;) (type $FUNCSIG$v) + (func $start:std/array (; 262 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) global.get $~lib/memory/HEAP_BASE i32.const 7 i32.add @@ -18630,22 +18526,22 @@ i32.const 0 i32.const 3 call $~lib/array/Array#constructor + local.set $0 + local.get $0 + i32.load offset=4 local.set $1 local.get $1 i32.const 0 + call $std/array/Ref#constructor + i32.store + local.get $1 + i32.const 0 + i32.store offset=4 + local.get $1 i32.const 0 call $std/array/Ref#constructor - call $~lib/array/Array#__set - local.get $1 - i32.const 1 - i32.const 0 - call $~lib/array/Array#__set - local.get $1 - i32.const 2 - i32.const 0 - call $std/array/Ref#constructor - call $~lib/array/Array#__set - local.get $1 + i32.store offset=8 + local.get $0 end global.set $std/array/refArr global.get $std/array/refArr @@ -18831,35 +18727,36 @@ i32.const 0 i32.const 2 call $~lib/array/Array>#constructor - local.set $2 - local.get $2 - i32.const 0 - block $~lib/runtime/WRAPARRAY|inlined.70 (result i32) - i32.const 6352 - local.set $1 - local.get $1 - i32.const 4 - i32.const 2 - call $~lib/runtime/doWrapArray - end - call $~lib/array/Array>#__set - local.get $2 - i32.const 1 + local.set $1 + local.get $1 + i32.load offset=4 + local.set $0 + local.get $0 block $~lib/runtime/WRAPARRAY|inlined.71 (result i32) i32.const 6368 - local.set $1 - local.get $1 + local.set $2 + local.get $2 i32.const 4 i32.const 2 call $~lib/runtime/doWrapArray end - call $~lib/array/Array>#__set - local.get $2 + i32.store + local.get $0 + block $~lib/runtime/WRAPARRAY|inlined.72 (result i32) + i32.const 6384 + local.set $2 + local.get $2 + i32.const 4 + i32.const 2 + call $~lib/runtime/doWrapArray + end + i32.store offset=4 + local.get $1 end global.set $std/array/subarr32 global.get $std/array/subarr32 call $~lib/array/Array>#toString - i32.const 6384 + i32.const 6400 call $~lib/string/String.__eq i32.eqz if @@ -18874,35 +18771,36 @@ i32.const 0 i32.const 2 call $~lib/array/Array>#constructor - local.set $3 - local.get $3 - i32.const 0 - block $~lib/runtime/WRAPARRAY|inlined.5 (result i32) - i32.const 6408 - local.set $2 - local.get $2 - i32.const 7 - i32.const 0 - call $~lib/runtime/doWrapArray - end - call $~lib/array/Array>#__set - local.get $3 - i32.const 1 + local.set $0 + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 block $~lib/runtime/WRAPARRAY|inlined.6 (result i32) - i32.const 6424 + i32.const 6440 local.set $2 local.get $2 i32.const 7 i32.const 0 call $~lib/runtime/doWrapArray end - call $~lib/array/Array>#__set - local.get $3 + i32.store + local.get $1 + block $~lib/runtime/WRAPARRAY|inlined.7 (result i32) + i32.const 6456 + local.set $2 + local.get $2 + i32.const 7 + i32.const 0 + call $~lib/runtime/doWrapArray + end + i32.store offset=4 + local.get $0 end global.set $std/array/subarr8 global.get $std/array/subarr8 call $~lib/array/Array>#toString - i32.const 6384 + i32.const 6400 call $~lib/string/String.__eq i32.eqz if @@ -18917,29 +18815,33 @@ i32.const 0 i32.const 1 call $~lib/array/Array>>#constructor - local.set $5 - local.get $5 - i32.const 0 + local.set $0 + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 block (result i32) i32.const 0 i32.const 1 call $~lib/array/Array>#constructor - local.set $4 - local.get $4 - i32.const 0 - block $~lib/runtime/WRAPARRAY|inlined.8 (result i32) - i32.const 6440 - local.set $3 - local.get $3 + local.set $2 + local.get $2 + i32.load offset=4 + local.set $3 + local.get $3 + block $~lib/runtime/WRAPARRAY|inlined.11 (result i32) + i32.const 6520 + local.set $4 + local.get $4 i32.const 8 i32.const 2 call $~lib/runtime/doWrapArray end - call $~lib/array/Array>#__set - local.get $4 + i32.store + local.get $2 end - call $~lib/array/Array>>#__set - local.get $5 + i32.store + local.get $0 end global.set $std/array/subarrU32 global.get $std/array/subarrU32 @@ -18956,9 +18858,9 @@ unreachable end ) - (func $start (; 267 ;) (type $FUNCSIG$v) + (func $start (; 263 ;) (type $FUNCSIG$v) call $start:std/array ) - (func $null (; 268 ;) (type $FUNCSIG$v) + (func $null (; 264 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index 7fbd45db..7cd6dda9 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -326,7 +326,7 @@ if i32.const 0 i32.const 64 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -340,7 +340,7 @@ if i32.const 0 i32.const 64 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -1552,7 +1552,7 @@ if i32.const 0 i32.const 64 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 992570e8..5d56658c 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -408,7 +408,7 @@ if i32.const 0 i32.const 64 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -423,7 +423,7 @@ if i32.const 0 i32.const 64 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -2052,7 +2052,7 @@ if i32.const 0 i32.const 64 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index e155ad9c..4a05a9cb 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -163,7 +163,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -177,7 +177,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index f0a7ba27..9bc3fc24 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -414,7 +414,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -429,7 +429,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -493,7 +493,7 @@ if i32.const 0 i32.const 16 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/date.optimized.wat b/tests/compiler/std/date.optimized.wat index 16c498b0..900c23f4 100644 --- a/tests/compiler/std/date.optimized.wat +++ b/tests/compiler/std/date.optimized.wat @@ -90,7 +90,7 @@ if i32.const 0 i32.const 48 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -104,7 +104,7 @@ if i32.const 0 i32.const 48 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/date.untouched.wat b/tests/compiler/std/date.untouched.wat index 949c6432..66eb060a 100644 --- a/tests/compiler/std/date.untouched.wat +++ b/tests/compiler/std/date.untouched.wat @@ -154,7 +154,7 @@ if i32.const 0 i32.const 48 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -169,7 +169,7 @@ if i32.const 0 i32.const 48 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index f9cc0a7c..2f38ffe7 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -123,7 +123,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -137,7 +137,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index deb133fb..daeb9b1e 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -160,7 +160,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -175,7 +175,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index b223702c..f81a2dbc 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -6281,35 +6281,37 @@ i64.const 63 i64.shr_u local.set $8 - local.get $3 - i64.const 1 - i64.shl - local.tee $7 - i64.const 0 - i64.eq - local.tee $6 - i32.eqz - if - local.get $4 - i64.const 2047 + block (result i32) + local.get $3 + i64.const 1 + i64.shl + local.tee $7 + i64.const 0 i64.eq - local.set $6 + local.tee $6 + i32.eqz + if + local.get $4 + i64.const 2047 + i64.eq + local.set $6 + end + local.get $6 + i32.eqz end - local.get $6 - i32.eqz - if + if (result i32) local.get $1 local.get $1 f64.ne - local.set $6 + else + local.get $6 end - local.get $6 if local.get $0 local.get $1 f64.mul - local.tee $1 - local.get $1 + local.tee $0 + local.get $0 f64.div return end @@ -6384,7 +6386,7 @@ local.get $2 local.get $3 i64.ge_u - if (result i64) + if local.get $2 local.get $3 i64.eq @@ -6392,9 +6394,9 @@ local.get $2 local.get $3 i64.sub - else - local.get $2 + local.set $2 end + local.get $2 i64.const 1 i64.shl local.set $2 @@ -6508,34 +6510,36 @@ i32.const -2147483648 i32.and local.set $8 - local.get $4 - i32.const 1 - i32.shl - local.tee $7 - i32.eqz - local.tee $5 - i32.eqz - if - local.get $3 - i32.const 255 - i32.eq - local.set $5 + block (result i32) + local.get $4 + i32.const 1 + i32.shl + local.tee $7 + i32.eqz + local.tee $5 + i32.eqz + if + local.get $3 + i32.const 255 + i32.eq + local.set $5 + end + local.get $5 + i32.eqz end - local.get $5 - i32.eqz - if + if (result i32) local.get $1 local.get $1 f32.ne - local.set $5 + else + local.get $5 end - local.get $5 if local.get $0 local.get $1 f32.mul - local.tee $1 - local.get $1 + local.tee $0 + local.get $0 f32.div return end @@ -6604,7 +6608,7 @@ local.get $2 local.get $4 i32.ge_u - if (result i32) + if local.get $2 local.get $4 i32.eq @@ -6612,9 +6616,9 @@ local.get $2 local.get $4 i32.sub - else - local.get $2 + local.set $2 end + local.get $2 i32.const 1 i32.shl local.set $2 diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index 64ab9025..4072254d 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -7798,13 +7798,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f64.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -8085,13 +8080,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f32.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -47424,17 +47414,10 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.2 (result i32) - f32.const nan:0x400000 - i32.const 1 - call $~lib/math/ipow32f - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + i32.const 1 + call $~lib/math/ipow32f + call $~lib/builtins/isNaN i32.eqz if i32.const 0 @@ -47444,17 +47427,10 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.3 (result i32) - f32.const nan:0x400000 - i32.const -1 - call $~lib/math/ipow32f - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + i32.const -1 + call $~lib/math/ipow32f + call $~lib/builtins/isNaN i32.eqz if i32.const 0 @@ -47464,17 +47440,10 @@ call $~lib/env/abort unreachable end - block $~lib/builtins/isNaN|inlined.4 (result i32) - f32.const nan:0x400000 - i32.const 2 - call $~lib/math/ipow32f - local.set $4 - local.get $4 - local.get $4 - f32.ne - end - i32.const 0 - i32.ne + f32.const nan:0x400000 + i32.const 2 + call $~lib/math/ipow32f + call $~lib/builtins/isNaN i32.eqz if i32.const 0 diff --git a/tests/compiler/std/mod.optimized.wat b/tests/compiler/std/mod.optimized.wat index 7cfa2439..83246d1d 100644 --- a/tests/compiler/std/mod.optimized.wat +++ b/tests/compiler/std/mod.optimized.wat @@ -46,35 +46,37 @@ i64.const 63 i64.shr_u local.set $8 - local.get $3 - i64.const 1 - i64.shl - local.tee $7 - i64.const 0 - i64.eq - local.tee $6 - i32.eqz - if - local.get $4 - i64.const 2047 + block (result i32) + local.get $3 + i64.const 1 + i64.shl + local.tee $7 + i64.const 0 i64.eq - local.set $6 + local.tee $6 + i32.eqz + if + local.get $4 + i64.const 2047 + i64.eq + local.set $6 + end + local.get $6 + i32.eqz end - local.get $6 - i32.eqz - if + if (result i32) local.get $1 local.get $1 f64.ne - local.set $6 + else + local.get $6 end - local.get $6 if local.get $0 local.get $1 f64.mul - local.tee $1 - local.get $1 + local.tee $0 + local.get $0 f64.div return end @@ -149,7 +151,7 @@ local.get $2 local.get $3 i64.ge_u - if (result i64) + if local.get $2 local.get $3 i64.eq @@ -157,9 +159,9 @@ local.get $2 local.get $3 i64.sub - else - local.get $2 + local.set $2 end + local.get $2 i64.const 1 i64.shl local.set $2 @@ -298,34 +300,36 @@ i32.const -2147483648 i32.and local.set $8 - local.get $4 - i32.const 1 - i32.shl - local.tee $7 - i32.eqz - local.tee $5 - i32.eqz - if - local.get $3 - i32.const 255 - i32.eq - local.set $5 + block (result i32) + local.get $4 + i32.const 1 + i32.shl + local.tee $7 + i32.eqz + local.tee $5 + i32.eqz + if + local.get $3 + i32.const 255 + i32.eq + local.set $5 + end + local.get $5 + i32.eqz end - local.get $5 - i32.eqz - if + if (result i32) local.get $1 local.get $1 f32.ne - local.set $5 + else + local.get $5 end - local.get $5 if local.get $0 local.get $1 f32.mul - local.tee $1 - local.get $1 + local.tee $0 + local.get $0 f32.div return end @@ -394,7 +398,7 @@ local.get $2 local.get $4 i32.ge_u - if (result i32) + if local.get $2 local.get $4 i32.eq @@ -402,9 +406,9 @@ local.get $2 local.get $4 i32.sub - else - local.get $2 + local.set $2 end + local.get $2 i32.const 1 i32.shl local.set $2 diff --git a/tests/compiler/std/mod.untouched.wat b/tests/compiler/std/mod.untouched.wat index 4d4deb25..15146cde 100644 --- a/tests/compiler/std/mod.untouched.wat +++ b/tests/compiler/std/mod.untouched.wat @@ -1,13 +1,13 @@ (module (type $FUNCSIG$iddd (func (param f64 f64 f64) (result i32))) (type $FUNCSIG$ddd (func (param f64 f64) (result f64))) - (type $FUNCSIG$idd (func (param f64 f64) (result i32))) (type $FUNCSIG$id (func (param f64) (result i32))) + (type $FUNCSIG$idd (func (param f64 f64) (result i32))) (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$ifff (func (param f32 f32 f32) (result i32))) (type $FUNCSIG$fff (func (param f32 f32) (result f32))) - (type $FUNCSIG$iff (func (param f32 f32) (result i32))) (type $FUNCSIG$if (func (param f32) (result i32))) + (type $FUNCSIG$iff (func (param f32 f32) (result i32))) (type $FUNCSIG$v (func)) (import "math" "mod" (func $std/mod/mod (param f64 f64) (result f64))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -21,7 +21,12 @@ (export "table" (table $0)) (export "mod" (func $std/mod/mod)) (start $start) - (func $~lib/math/NativeMath.mod (; 2 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/builtins/isNaN (; 2 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + local.get $0 + local.get $0 + f64.ne + ) + (func $~lib/math/NativeMath.mod (; 3 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i64) @@ -74,13 +79,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f64.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -279,11 +279,6 @@ local.get $2 f64.reinterpret_i64 ) - (func $~lib/builtins/isNaN (; 3 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) - local.get $0 - local.get $0 - f64.ne - ) (func $std/mod/check (; 4 ;) (type $FUNCSIG$idd) (param $0 f64) (param $1 f64) (result i32) local.get $1 call $~lib/builtins/isNaN @@ -335,7 +330,12 @@ local.get $3 end ) - (func $~lib/math/NativeMathf.mod (; 6 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/builtins/isNaN (; 6 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.ne + ) + (func $~lib/math/NativeMathf.mod (; 7 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -388,13 +388,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f32.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -591,11 +586,6 @@ local.get $2 f32.reinterpret_i32 ) - (func $~lib/builtins/isNaN (; 7 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) - local.get $0 - local.get $0 - f32.ne - ) (func $std/mod/check (; 8 ;) (type $FUNCSIG$iff) (param $0 f32) (param $1 f32) (result i32) local.get $1 call $~lib/builtins/isNaN diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index ffd13cd2..6cb9c5eb 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -84,7 +84,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -98,7 +98,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/new.untouched.wat b/tests/compiler/std/new.untouched.wat index 1e15eedf..c053cb9a 100644 --- a/tests/compiler/std/new.untouched.wat +++ b/tests/compiler/std/new.untouched.wat @@ -147,7 +147,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -162,7 +162,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index 4a930e3c..8542a050 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -167,7 +167,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -181,7 +181,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index 9f0b83fa..21a621b6 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -215,7 +215,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -230,7 +230,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/pointer.optimized.wat b/tests/compiler/std/pointer.optimized.wat index 4aac78e3..4941333c 100644 --- a/tests/compiler/std/pointer.optimized.wat +++ b/tests/compiler/std/pointer.optimized.wat @@ -1119,7 +1119,7 @@ if i32.const 0 i32.const 16 - i32.const 79 + i32.const 78 i32.const 0 call $~lib/env/abort unreachable @@ -1130,7 +1130,7 @@ if i32.const 0 i32.const 16 - i32.const 80 + i32.const 79 i32.const 0 call $~lib/env/abort unreachable @@ -1149,7 +1149,7 @@ if i32.const 0 i32.const 16 - i32.const 84 + i32.const 83 i32.const 0 call $~lib/env/abort unreachable @@ -1161,7 +1161,7 @@ if i32.const 0 i32.const 16 - i32.const 85 + i32.const 84 i32.const 0 call $~lib/env/abort unreachable @@ -1176,7 +1176,7 @@ if i32.const 0 i32.const 16 - i32.const 88 + i32.const 87 i32.const 0 call $~lib/env/abort unreachable @@ -1191,7 +1191,7 @@ if i32.const 0 i32.const 16 - i32.const 91 + i32.const 90 i32.const 0 call $~lib/env/abort unreachable @@ -1202,7 +1202,7 @@ if i32.const 0 i32.const 16 - i32.const 93 + i32.const 92 i32.const 0 call $~lib/env/abort unreachable @@ -1220,7 +1220,7 @@ if i32.const 0 i32.const 16 - i32.const 95 + i32.const 94 i32.const 0 call $~lib/env/abort unreachable @@ -1231,7 +1231,7 @@ if i32.const 0 i32.const 16 - i32.const 96 + i32.const 95 i32.const 0 call $~lib/env/abort unreachable @@ -1242,7 +1242,7 @@ if i32.const 0 i32.const 16 - i32.const 98 + i32.const 97 i32.const 0 call $~lib/env/abort unreachable @@ -1261,7 +1261,7 @@ if i32.const 0 i32.const 16 - i32.const 101 + i32.const 100 i32.const 0 call $~lib/env/abort unreachable @@ -1273,7 +1273,7 @@ if i32.const 0 i32.const 16 - i32.const 102 + i32.const 101 i32.const 0 call $~lib/env/abort unreachable @@ -1285,7 +1285,7 @@ if i32.const 0 i32.const 16 - i32.const 103 + i32.const 102 i32.const 0 call $~lib/env/abort unreachable @@ -1308,7 +1308,7 @@ if i32.const 0 i32.const 16 - i32.const 106 + i32.const 105 i32.const 0 call $~lib/env/abort unreachable @@ -1320,7 +1320,7 @@ if i32.const 0 i32.const 16 - i32.const 107 + i32.const 106 i32.const 0 call $~lib/env/abort unreachable @@ -1332,7 +1332,7 @@ if i32.const 0 i32.const 16 - i32.const 108 + i32.const 107 i32.const 0 call $~lib/env/abort unreachable @@ -1354,7 +1354,7 @@ if i32.const 0 i32.const 16 - i32.const 114 + i32.const 113 i32.const 0 call $~lib/env/abort unreachable @@ -1368,7 +1368,7 @@ if i32.const 0 i32.const 16 - i32.const 115 + i32.const 114 i32.const 0 call $~lib/env/abort unreachable @@ -1380,7 +1380,7 @@ if i32.const 0 i32.const 16 - i32.const 117 + i32.const 116 i32.const 0 call $~lib/env/abort unreachable @@ -1394,7 +1394,7 @@ if i32.const 0 i32.const 16 - i32.const 118 + i32.const 117 i32.const 0 call $~lib/env/abort unreachable @@ -1406,7 +1406,7 @@ if i32.const 0 i32.const 16 - i32.const 120 + i32.const 119 i32.const 0 call $~lib/env/abort unreachable @@ -1418,7 +1418,7 @@ if i32.const 0 i32.const 16 - i32.const 121 + i32.const 120 i32.const 0 call $~lib/env/abort unreachable @@ -1436,7 +1436,7 @@ if i32.const 0 i32.const 16 - i32.const 124 + i32.const 123 i32.const 0 call $~lib/env/abort unreachable @@ -1450,7 +1450,7 @@ if i32.const 0 i32.const 16 - i32.const 125 + i32.const 124 i32.const 0 call $~lib/env/abort unreachable @@ -1462,7 +1462,7 @@ if i32.const 0 i32.const 16 - i32.const 126 + i32.const 125 i32.const 0 call $~lib/env/abort unreachable @@ -1477,7 +1477,7 @@ if i32.const 0 i32.const 16 - i32.const 129 + i32.const 128 i32.const 0 call $~lib/env/abort unreachable @@ -1489,7 +1489,7 @@ if i32.const 0 i32.const 16 - i32.const 130 + i32.const 129 i32.const 0 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/pointer.ts b/tests/compiler/std/pointer.ts index bece2e18..b9605afd 100644 --- a/tests/compiler/std/pointer.ts +++ b/tests/compiler/std/pointer.ts @@ -2,7 +2,6 @@ class Pointer { - // FIXME: does not inline, always yields a trampoline @inline constructor(offset: usize = 0) { return changetype>(offset); } diff --git a/tests/compiler/std/pointer.untouched.wat b/tests/compiler/std/pointer.untouched.wat index 748c6458..7c94a31b 100644 --- a/tests/compiler/std/pointer.untouched.wat +++ b/tests/compiler/std/pointer.untouched.wat @@ -1767,7 +1767,7 @@ if i32.const 0 i32.const 16 - i32.const 79 + i32.const 78 i32.const 0 call $~lib/env/abort unreachable @@ -1783,7 +1783,7 @@ if i32.const 0 i32.const 16 - i32.const 80 + i32.const 79 i32.const 0 call $~lib/env/abort unreachable @@ -1817,7 +1817,7 @@ if i32.const 0 i32.const 16 - i32.const 84 + i32.const 83 i32.const 0 call $~lib/env/abort unreachable @@ -1835,7 +1835,7 @@ if i32.const 0 i32.const 16 - i32.const 85 + i32.const 84 i32.const 0 call $~lib/env/abort unreachable @@ -1861,7 +1861,7 @@ if i32.const 0 i32.const 16 - i32.const 88 + i32.const 87 i32.const 0 call $~lib/env/abort unreachable @@ -1887,7 +1887,7 @@ if i32.const 0 i32.const 16 - i32.const 91 + i32.const 90 i32.const 0 call $~lib/env/abort unreachable @@ -1903,7 +1903,7 @@ if i32.const 0 i32.const 16 - i32.const 93 + i32.const 92 i32.const 0 call $~lib/env/abort unreachable @@ -1927,7 +1927,7 @@ if i32.const 0 i32.const 16 - i32.const 95 + i32.const 94 i32.const 0 call $~lib/env/abort unreachable @@ -1943,7 +1943,7 @@ if i32.const 0 i32.const 16 - i32.const 96 + i32.const 95 i32.const 0 call $~lib/env/abort unreachable @@ -1959,7 +1959,7 @@ if i32.const 0 i32.const 16 - i32.const 98 + i32.const 97 i32.const 0 call $~lib/env/abort unreachable @@ -1991,7 +1991,7 @@ if i32.const 0 i32.const 16 - i32.const 101 + i32.const 100 i32.const 0 call $~lib/env/abort unreachable @@ -2009,7 +2009,7 @@ if i32.const 0 i32.const 16 - i32.const 102 + i32.const 101 i32.const 0 call $~lib/env/abort unreachable @@ -2027,7 +2027,7 @@ if i32.const 0 i32.const 16 - i32.const 103 + i32.const 102 i32.const 0 call $~lib/env/abort unreachable @@ -2055,7 +2055,7 @@ if i32.const 0 i32.const 16 - i32.const 106 + i32.const 105 i32.const 0 call $~lib/env/abort unreachable @@ -2073,7 +2073,7 @@ if i32.const 0 i32.const 16 - i32.const 107 + i32.const 106 i32.const 0 call $~lib/env/abort unreachable @@ -2091,7 +2091,7 @@ if i32.const 0 i32.const 16 - i32.const 108 + i32.const 107 i32.const 0 call $~lib/env/abort unreachable @@ -2130,7 +2130,7 @@ if i32.const 0 i32.const 16 - i32.const 114 + i32.const 113 i32.const 0 call $~lib/env/abort unreachable @@ -2153,7 +2153,7 @@ if i32.const 0 i32.const 16 - i32.const 115 + i32.const 114 i32.const 0 call $~lib/env/abort unreachable @@ -2176,7 +2176,7 @@ if i32.const 0 i32.const 16 - i32.const 117 + i32.const 116 i32.const 0 call $~lib/env/abort unreachable @@ -2199,7 +2199,7 @@ if i32.const 0 i32.const 16 - i32.const 118 + i32.const 117 i32.const 0 call $~lib/env/abort unreachable @@ -2212,7 +2212,7 @@ if i32.const 0 i32.const 16 - i32.const 120 + i32.const 119 i32.const 0 call $~lib/env/abort unreachable @@ -2225,7 +2225,7 @@ if i32.const 0 i32.const 16 - i32.const 121 + i32.const 120 i32.const 0 call $~lib/env/abort unreachable @@ -2263,7 +2263,7 @@ if i32.const 0 i32.const 16 - i32.const 124 + i32.const 123 i32.const 0 call $~lib/env/abort unreachable @@ -2286,7 +2286,7 @@ if i32.const 0 i32.const 16 - i32.const 125 + i32.const 124 i32.const 0 call $~lib/env/abort unreachable @@ -2299,7 +2299,7 @@ if i32.const 0 i32.const 16 - i32.const 126 + i32.const 125 i32.const 0 call $~lib/env/abort unreachable @@ -2320,7 +2320,7 @@ if i32.const 0 i32.const 16 - i32.const 129 + i32.const 128 i32.const 0 call $~lib/env/abort unreachable @@ -2333,7 +2333,7 @@ if i32.const 0 i32.const 16 - i32.const 130 + i32.const 129 i32.const 0 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/runtime.optimized.wat b/tests/compiler/std/runtime.optimized.wat index adaa3012..2b0b25aa 100644 --- a/tests/compiler/std/runtime.optimized.wat +++ b/tests/compiler/std/runtime.optimized.wat @@ -2653,7 +2653,7 @@ if i32.const 0 i32.const 232 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -2667,7 +2667,7 @@ if i32.const 0 i32.const 232 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/runtime.untouched.wat b/tests/compiler/std/runtime.untouched.wat index a91a32ae..492ff4fd 100644 --- a/tests/compiler/std/runtime.untouched.wat +++ b/tests/compiler/std/runtime.untouched.wat @@ -3342,7 +3342,7 @@ if i32.const 0 i32.const 232 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -3357,7 +3357,7 @@ if i32.const 0 i32.const 232 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 08556684..73811b2e 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -11,11 +11,9 @@ (type $FUNCSIG$iiji (func (param i32 i64 i32) (result i32))) (type $FUNCSIG$vij (func (param i32 i64))) (type $FUNCSIG$iif (func (param i32 f32) (result i32))) - (type $FUNCSIG$if (func (param f32) (result i32))) (type $FUNCSIG$iifi (func (param i32 f32 i32) (result i32))) (type $FUNCSIG$vif (func (param i32 f32))) (type $FUNCSIG$iid (func (param i32 f64) (result i32))) - (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$iidi (func (param i32 f64 i32) (result i32))) (type $FUNCSIG$vid (func (param i32 f64))) (type $FUNCSIG$i (func (result i32))) @@ -121,7 +119,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -135,7 +133,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -2960,13 +2958,11 @@ (local $2 i32) (local $3 i32) (local $4 i32) - local.get $1 - call $~lib/util/hash/hash32 - local.tee $2 - local.set $4 local.get $0 local.get $1 - local.get $2 + local.get $1 + call $~lib/util/hash/hash32 + local.tee $4 call $~lib/set/Set#find i32.eqz if @@ -3888,13 +3884,11 @@ (local $2 i32) (local $3 i32) (local $4 i32) - local.get $1 - call $~lib/util/hash/hash64 - local.tee $2 - local.set $4 local.get $0 local.get $1 - local.get $2 + local.get $1 + call $~lib/util/hash/hash64 + local.tee $4 call $~lib/set/Set#find i32.eqz if @@ -4576,12 +4570,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 56 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) - local.get $0 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - ) - (func $~lib/set/Set#find (; 57 ;) (type $FUNCSIG$iifi) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 56 ;) (type $FUNCSIG$iifi) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) local.get $0 i32.load local.get $0 @@ -4624,16 +4613,17 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 58 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#has (; 57 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32) local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/HASH + i32.reinterpret_f32 + call $~lib/util/hash/hash32 call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 59 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 58 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4731,14 +4721,15 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 60 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 59 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/HASH + i32.reinterpret_f32 + call $~lib/util/hash/hash32 local.tee $4 call $~lib/set/Set#find i32.eqz @@ -4814,7 +4805,7 @@ i32.store end ) - (func $~lib/set/Set#delete (; 61 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#delete (; 60 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) local.get $0 @@ -4876,7 +4867,7 @@ call $~lib/set/Set#rehash end ) - (func $std/set/test (; 62 ;) (type $FUNCSIG$v) + (func $std/set/test (; 61 ;) (type $FUNCSIG$v) (local $0 f32) (local $1 i32) call $~lib/set/Set#constructor @@ -5121,7 +5112,7 @@ unreachable end ) - (func $~lib/set/Set#constructor (; 63 ;) (type $FUNCSIG$i) (result i32) + (func $~lib/set/Set#constructor (; 62 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) i32.const 24 call $~lib/runtime/doAllocate @@ -5149,12 +5140,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 64 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) - local.get $0 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - ) - (func $~lib/set/Set#find (; 65 ;) (type $FUNCSIG$iidi) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 63 ;) (type $FUNCSIG$iidi) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) local.get $0 i32.load local.get $0 @@ -5197,16 +5183,17 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 66 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#has (; 64 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/HASH + i64.reinterpret_f64 + call $~lib/util/hash/hash64 call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 67 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 65 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5304,14 +5291,15 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 68 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 66 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/HASH + i64.reinterpret_f64 + call $~lib/util/hash/hash64 local.tee $4 call $~lib/set/Set#find i32.eqz @@ -5387,7 +5375,7 @@ i32.store end ) - (func $~lib/set/Set#delete (; 69 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#delete (; 67 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) local.get $0 @@ -5449,7 +5437,7 @@ call $~lib/set/Set#rehash end ) - (func $std/set/test (; 70 ;) (type $FUNCSIG$v) + (func $std/set/test (; 68 ;) (type $FUNCSIG$v) (local $0 f64) (local $1 i32) call $~lib/set/Set#constructor @@ -5694,7 +5682,7 @@ unreachable end ) - (func $start (; 71 ;) (type $FUNCSIG$v) + (func $start (; 69 ;) (type $FUNCSIG$v) i32.const 128 global.set $~lib/allocator/arena/startOffset global.get $~lib/allocator/arena/startOffset @@ -5710,7 +5698,7 @@ call $std/set/test call $std/set/test ) - (func $null (; 72 ;) (type $FUNCSIG$v) + (func $null (; 70 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 48697734..73a1c56c 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -12,11 +12,9 @@ (type $FUNCSIG$iiji (func (param i32 i64 i32) (result i32))) (type $FUNCSIG$vij (func (param i32 i64))) (type $FUNCSIG$iif (func (param i32 f32) (result i32))) - (type $FUNCSIG$if (func (param f32) (result i32))) (type $FUNCSIG$iifi (func (param i32 f32 i32) (result i32))) (type $FUNCSIG$vif (func (param i32 f32))) (type $FUNCSIG$iid (func (param i32 f64) (result i32))) - (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$iidi (func (param i32 f64 i32) (result i32))) (type $FUNCSIG$vid (func (param i32 f64))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -162,7 +160,7 @@ if i32.const 0 i32.const 16 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -177,7 +175,7 @@ if i32.const 0 i32.const 16 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -554,16 +552,7 @@ i32.const 16777619 i32.mul ) - (func $~lib/util/hash/HASH (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - return - ) - (func $~lib/set/Set#find (; 13 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -618,16 +607,26 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + call $~lib/util/hash/hash8 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -698,13 +697,13 @@ local.get $9 i32.load8_s i32.store8 - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i32.load8_s local.set $11 local.get $11 call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -757,20 +756,29 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + call $~lib/util/hash/hash8 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -804,8 +812,8 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $2 + local.get $2 block (result i32) local.get $0 local.get $0 @@ -821,8 +829,8 @@ end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i32.store8 local.get $0 @@ -833,7 +841,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -841,27 +849,27 @@ i32.mul i32.add local.set $5 - local.get $3 + local.get $4 local.get $5 i32.load i32.store offset=4 local.get $5 - local.get $3 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 17 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 @@ -870,7 +878,7 @@ i32.const 24 i32.shr_s call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -931,7 +939,7 @@ end i32.const 1 ) - (func $std/set/test (; 19 ;) (type $FUNCSIG$v) + (func $std/set/test (; 18 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) i32.const 0 @@ -1214,7 +1222,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -1240,7 +1248,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -1279,14 +1287,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - return - ) - (func $~lib/set/Set#find (; 23 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 21 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -1339,16 +1340,24 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 22 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 255 + i32.and + call $~lib/util/hash/hash8 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 25 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 23 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1419,13 +1428,13 @@ local.get $9 i32.load8_u i32.store8 - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i32.load8_u local.set $11 local.get $11 call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -1478,20 +1487,27 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 26 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 24 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 255 + i32.and + call $~lib/util/hash/hash8 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -1525,8 +1541,8 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $2 + local.get $2 block (result i32) local.get $0 local.get $0 @@ -1542,8 +1558,8 @@ end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i32.store8 local.get $0 @@ -1554,7 +1570,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -1562,34 +1578,34 @@ i32.mul i32.add local.set $5 - local.get $3 + local.get $4 local.get $5 i32.load i32.store offset=4 local.get $5 - local.get $3 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 28 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 i32.const 255 i32.and call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -1650,7 +1666,7 @@ end i32.const 1 ) - (func $std/set/test (; 29 ;) (type $FUNCSIG$v) + (func $std/set/test (; 27 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) i32.const 0 @@ -1933,7 +1949,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -1959,7 +1975,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 31 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 29 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -1998,7 +2014,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/hash16 (; 32 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/hash/hash16 (; 30 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) i32.const -2128831035 local.set $1 @@ -2020,16 +2036,7 @@ local.set $1 local.get $1 ) - (func $~lib/util/hash/HASH (; 33 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - return - ) - (func $~lib/set/Set#find (; 34 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 31 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -2084,16 +2091,26 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 32 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + call $~lib/util/hash/hash16 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 36 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 33 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2164,13 +2181,13 @@ local.get $9 i32.load16_s i32.store16 - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i32.load16_s local.set $11 local.get $11 call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -2223,20 +2240,29 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 37 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 34 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + call $~lib/util/hash/hash16 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -2270,8 +2296,8 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $2 + local.get $2 block (result i32) local.get $0 local.get $0 @@ -2287,8 +2313,8 @@ end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i32.store16 local.get $0 @@ -2299,7 +2325,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -2307,27 +2333,27 @@ i32.mul i32.add local.set $5 - local.get $3 + local.get $4 local.get $5 i32.load i32.store offset=4 local.get $5 - local.get $3 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 38 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 35 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 39 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 36 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 @@ -2336,7 +2362,7 @@ i32.const 16 i32.shr_s call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -2397,7 +2423,7 @@ end i32.const 1 ) - (func $std/set/test (; 40 ;) (type $FUNCSIG$v) + (func $std/set/test (; 37 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) i32.const 0 @@ -2680,7 +2706,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 41 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 38 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -2706,7 +2732,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 42 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 39 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -2745,14 +2771,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 43 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - return - ) - (func $~lib/set/Set#find (; 44 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 40 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -2805,16 +2824,24 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 45 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 41 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 65535 + i32.and + call $~lib/util/hash/hash16 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 46 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 42 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2885,13 +2912,13 @@ local.get $9 i32.load16_u i32.store16 - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i32.load16_u local.set $11 local.get $11 call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -2944,20 +2971,27 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 47 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 43 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.const 65535 + i32.and + call $~lib/util/hash/hash16 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -2991,8 +3025,8 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $2 + local.get $2 block (result i32) local.get $0 local.get $0 @@ -3008,8 +3042,8 @@ end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i32.store16 local.get $0 @@ -3020,7 +3054,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -3028,34 +3062,34 @@ i32.mul i32.add local.set $5 - local.get $3 + local.get $4 local.get $5 i32.load i32.store offset=4 local.get $5 - local.get $3 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 48 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 44 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 49 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 45 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 i32.const 65535 i32.and call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -3116,7 +3150,7 @@ end i32.const 1 ) - (func $std/set/test (; 50 ;) (type $FUNCSIG$v) + (func $std/set/test (; 46 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) i32.const 0 @@ -3399,7 +3433,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 51 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 47 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -3425,7 +3459,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 52 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 48 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -3464,7 +3498,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/hash32 (; 53 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/hash/hash32 (; 49 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) i32.const -2128831035 local.set $1 @@ -3506,12 +3540,7 @@ local.set $1 local.get $1 ) - (func $~lib/util/hash/HASH (; 54 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - call $~lib/util/hash/hash32 - return - ) - (func $~lib/set/Set#find (; 55 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 50 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -3562,16 +3591,22 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 56 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 51 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 57 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 52 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3642,13 +3677,13 @@ local.get $9 i32.load i32.store - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i32.load local.set $11 local.get $11 call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -3701,20 +3736,25 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 58 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 53 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -3748,8 +3788,8 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $2 + local.get $2 block (result i32) local.get $0 local.get $0 @@ -3765,8 +3805,8 @@ end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i32.store local.get $0 @@ -3777,7 +3817,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -3785,32 +3825,32 @@ i32.mul i32.add local.set $5 - local.get $3 + local.get $4 local.get $5 i32.load i32.store offset=4 local.get $5 - local.get $3 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 59 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 54 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 60 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 55 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -3871,7 +3911,7 @@ end i32.const 1 ) - (func $std/set/test (; 61 ;) (type $FUNCSIG$v) + (func $std/set/test (; 56 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) i32.const 0 @@ -4154,7 +4194,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 62 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 57 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -4180,7 +4220,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 63 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 58 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -4219,12 +4259,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 64 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - call $~lib/util/hash/hash32 - return - ) - (func $~lib/set/Set#find (; 65 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 59 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -4275,16 +4310,22 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 66 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 60 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 67 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 61 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4355,13 +4396,13 @@ local.get $9 i32.load i32.store - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i32.load local.set $11 local.get $11 call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -4414,20 +4455,25 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 68 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 62 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -4461,8 +4507,8 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $2 + local.get $2 block (result i32) local.get $0 local.get $0 @@ -4478,8 +4524,8 @@ end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i32.store local.get $0 @@ -4490,7 +4536,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -4498,32 +4544,32 @@ i32.mul i32.add local.set $5 - local.get $3 + local.get $4 local.get $5 i32.load i32.store offset=4 local.get $5 - local.get $3 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 69 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 63 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 70 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 64 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -4584,7 +4630,7 @@ end i32.const 1 ) - (func $std/set/test (; 71 ;) (type $FUNCSIG$v) + (func $std/set/test (; 65 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) i32.const 0 @@ -4867,7 +4913,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 72 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 66 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -4893,7 +4939,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 73 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 67 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -4932,7 +4978,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/hash64 (; 74 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/hash/hash64 (; 68 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5020,12 +5066,7 @@ local.set $3 local.get $3 ) - (func $~lib/util/hash/HASH (; 75 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) - local.get $0 - call $~lib/util/hash/hash64 - return - ) - (func $~lib/set/Set#find (; 76 ;) (type $FUNCSIG$iiji) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 69 ;) (type $FUNCSIG$iiji) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -5076,16 +5117,22 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 77 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 70 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) + (local $2 i64) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash64 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 78 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 71 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5157,13 +5204,13 @@ local.get $9 i64.load i64.store - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i64.load local.set $11 local.get $11 call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -5216,20 +5263,26 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 79 ;) (type $FUNCSIG$vij) (param $0 i32) (param $1 i64) - (local $2 i32) + (func $~lib/set/Set#add (; 72 ;) (type $FUNCSIG$vij) (param $0 i32) (param $1 i64) + (local $2 i64) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + (local $6 i32) + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash64 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -5263,25 +5316,25 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $5 + local.get $5 block (result i32) local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $6 end block $~lib/set/ENTRY_SIZE|inlined.5 (result i32) i32.const 16 end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i64.store local.get $0 @@ -5292,28 +5345,28 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 - local.get $3 - local.get $5 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=8 - local.get $5 - local.get $3 + local.get $6 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 80 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 73 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 81 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 74 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) (local $2 i64) (local $3 i32) (local $4 i32) @@ -5321,12 +5374,12 @@ (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -5387,7 +5440,7 @@ end i32.const 1 ) - (func $std/set/test (; 82 ;) (type $FUNCSIG$v) + (func $std/set/test (; 75 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i64) i32.const 0 @@ -5670,7 +5723,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 83 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 76 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -5696,7 +5749,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 84 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 77 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -5735,12 +5788,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 85 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) - local.get $0 - call $~lib/util/hash/hash64 - return - ) - (func $~lib/set/Set#find (; 86 ;) (type $FUNCSIG$iiji) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 78 ;) (type $FUNCSIG$iiji) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -5791,16 +5839,22 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 87 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 79 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) + (local $2 i64) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash64 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 88 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 80 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5872,13 +5926,13 @@ local.get $9 i64.load i64.store - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 i64.load local.set $11 local.get $11 call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -5931,20 +5985,26 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 89 ;) (type $FUNCSIG$vij) (param $0 i32) (param $1 i64) - (local $2 i32) + (func $~lib/set/Set#add (; 81 ;) (type $FUNCSIG$vij) (param $0 i32) (param $1 i64) + (local $2 i64) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + (local $6 i32) + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + call $~lib/util/hash/hash64 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -5978,25 +6038,25 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $5 + local.get $5 block (result i32) local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $6 end block $~lib/set/ENTRY_SIZE|inlined.5 (result i32) i32.const 16 end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 i64.store local.get $0 @@ -6007,28 +6067,28 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 - local.get $3 - local.get $5 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=8 - local.get $5 - local.get $3 + local.get $6 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 90 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 82 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 91 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 83 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32) (local $2 i64) (local $3 i32) (local $4 i32) @@ -6036,12 +6096,12 @@ (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -6102,7 +6162,7 @@ end i32.const 1 ) - (func $std/set/test (; 92 ;) (type $FUNCSIG$v) + (func $std/set/test (; 84 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i64) i32.const 0 @@ -6385,7 +6445,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 93 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 85 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -6411,7 +6471,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 94 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 86 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -6450,13 +6510,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 95 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) - local.get $0 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - return - ) - (func $~lib/set/Set#find (; 96 ;) (type $FUNCSIG$iifi) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 87 ;) (type $FUNCSIG$iifi) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -6507,16 +6561,23 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 97 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#has (; 88 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32) + (local $2 f32) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.reinterpret_f32 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 98 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 89 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6588,14 +6649,14 @@ local.get $9 f32.load f32.store - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 f32.load local.set $11 local.get $11 i32.reinterpret_f32 call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -6648,20 +6709,27 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 99 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) - (local $2 i32) + (func $~lib/set/Set#add (; 90 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) + (local $2 f32) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + (local $6 i32) + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + i32.reinterpret_f32 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -6695,25 +6763,25 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $5 + local.get $5 block (result i32) local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $6 end block $~lib/set/ENTRY_SIZE|inlined.5 (result i32) i32.const 8 end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 f32.store local.get $0 @@ -6724,28 +6792,28 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 - local.get $3 - local.get $5 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=4 - local.get $5 - local.get $3 + local.get $6 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 100 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 91 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 101 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#delete (; 92 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32) (local $2 f32) (local $3 i32) (local $4 i32) @@ -6753,13 +6821,13 @@ (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 i32.reinterpret_f32 call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -6820,7 +6888,7 @@ end i32.const 1 ) - (func $std/set/test (; 102 ;) (type $FUNCSIG$v) + (func $std/set/test (; 93 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 f32) i32.const 0 @@ -7103,7 +7171,7 @@ unreachable end ) - (func $~lib/set/Set#clear (; 103 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/set/Set#clear (; 94 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 @@ -7129,7 +7197,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/set/Set#constructor (; 104 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 95 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) block (result i32) local.get $0 @@ -7168,13 +7236,7 @@ call $~lib/set/Set#clear local.get $0 ) - (func $~lib/util/hash/HASH (; 105 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) - local.get $0 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - return - ) - (func $~lib/set/Set#find (; 106 ;) (type $FUNCSIG$iidi) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 96 ;) (type $FUNCSIG$iidi) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -7225,16 +7287,23 @@ end i32.const 0 ) - (func $~lib/set/Set#has (; 107 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#has (; 97 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) + (local $2 f64) local.get $0 local.get $1 - local.get $1 - call $~lib/util/hash/HASH + block $~lib/util/hash/HASH|inlined.0 (result i32) + local.get $1 + local.set $2 + local.get $2 + i64.reinterpret_f64 + call $~lib/util/hash/hash64 + br $~lib/util/hash/HASH|inlined.0 + end call $~lib/set/Set#find i32.const 0 i32.ne ) - (func $~lib/set/Set#rehash (; 108 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 98 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7306,14 +7375,14 @@ local.get $9 f64.load f64.store - block $~lib/util/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $9 f64.load local.set $11 local.get $11 i64.reinterpret_f64 call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 + br $~lib/util/hash/HASH|inlined.2 end local.get $1 i32.and @@ -7366,20 +7435,27 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/set/Set#add (; 109 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) - (local $2 i32) + (func $~lib/set/Set#add (; 99 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) + (local $2 f64) (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - call $~lib/util/hash/HASH - local.set $2 + (local $6 i32) + block $~lib/util/hash/HASH|inlined.1 (result i32) + local.get $1 + local.set $2 + local.get $2 + i64.reinterpret_f64 + call $~lib/util/hash/hash64 + br $~lib/util/hash/HASH|inlined.1 + end + local.set $3 local.get $0 local.get $1 - local.get $2 - call $~lib/set/Set#find - local.set $3 local.get $3 + call $~lib/set/Set#find + local.set $4 + local.get $4 i32.eqz if local.get $0 @@ -7413,25 +7489,25 @@ end local.get $0 i32.load offset=8 - local.set $4 - local.get $4 + local.set $5 + local.get $5 block (result i32) local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $6 end block $~lib/set/ENTRY_SIZE|inlined.5 (result i32) i32.const 16 end i32.mul i32.add - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $1 f64.store local.get $0 @@ -7442,28 +7518,28 @@ i32.store offset=20 local.get $0 i32.load - local.get $2 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 - local.get $3 - local.get $5 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=8 - local.get $5 - local.get $3 + local.get $6 + local.get $4 i32.store end ) - (func $~lib/set/Set#get:size (; 110 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 100 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=20 ) - (func $~lib/set/Set#delete (; 111 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#delete (; 101 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) (local $2 f64) (local $3 i32) (local $4 i32) @@ -7471,13 +7547,13 @@ (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 i64.reinterpret_f64 call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/set/Set#find local.set $3 @@ -7538,7 +7614,7 @@ end i32.const 1 ) - (func $std/set/test (; 112 ;) (type $FUNCSIG$v) + (func $std/set/test (; 102 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 f64) i32.const 0 @@ -7821,7 +7897,7 @@ unreachable end ) - (func $start:std/set (; 113 ;) (type $FUNCSIG$v) + (func $start:std/set (; 103 ;) (type $FUNCSIG$v) global.get $~lib/memory/HEAP_BASE i32.const 7 i32.add @@ -7843,9 +7919,9 @@ call $std/set/test call $std/set/test ) - (func $start (; 114 ;) (type $FUNCSIG$v) + (func $start (; 104 ;) (type $FUNCSIG$v) call $start:std/set ) - (func $null (; 115 ;) (type $FUNCSIG$v) + (func $null (; 105 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/std/string-utf8.optimized.wat b/tests/compiler/std/string-utf8.optimized.wat index c19c6db4..a13199bf 100644 --- a/tests/compiler/std/string-utf8.optimized.wat +++ b/tests/compiler/std/string-utf8.optimized.wat @@ -1514,7 +1514,7 @@ if i32.const 0 i32.const 136 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -1528,7 +1528,7 @@ if i32.const 0 i32.const 136 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -1596,7 +1596,7 @@ if i32.const 0 i32.const 96 - i32.const 443 + i32.const 447 i32.const 8 call $~lib/env/abort unreachable @@ -1643,7 +1643,7 @@ if i32.const 0 i32.const 96 - i32.const 447 + i32.const 451 i32.const 8 call $~lib/env/abort unreachable @@ -1716,7 +1716,7 @@ if i32.const 0 i32.const 96 - i32.const 459 + i32.const 463 i32.const 8 call $~lib/env/abort unreachable @@ -1769,7 +1769,7 @@ if i32.const 0 i32.const 96 - i32.const 468 + i32.const 472 i32.const 4 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index eda61e0e..505a71eb 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -1926,7 +1926,7 @@ if i32.const 0 i32.const 136 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -1941,7 +1941,7 @@ if i32.const 0 i32.const 136 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -2034,7 +2034,7 @@ if i32.const 0 i32.const 96 - i32.const 443 + i32.const 447 i32.const 8 call $~lib/env/abort unreachable @@ -2088,7 +2088,7 @@ if i32.const 0 i32.const 96 - i32.const 447 + i32.const 451 i32.const 8 call $~lib/env/abort unreachable @@ -2183,7 +2183,7 @@ if i32.const 0 i32.const 96 - i32.const 459 + i32.const 463 i32.const 8 call $~lib/env/abort unreachable @@ -2246,7 +2246,7 @@ if i32.const 0 i32.const 96 - i32.const 468 + i32.const 472 i32.const 4 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 8d22b14d..4e3860b9 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -283,7 +283,7 @@ if i32.const 0 i32.const 96 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -297,7 +297,7 @@ if i32.const 0 i32.const 96 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -2387,7 +2387,7 @@ if i32.const 0 i32.const 168 - i32.const 565 + i32.const 569 i32.const 10 call $~lib/env/abort unreachable @@ -3052,7 +3052,7 @@ if i32.const 0 i32.const 96 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -3247,25 +3247,7 @@ i32.store offset=8 end ) - (func $~lib/array/Array#__set (; 35 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - local.get $0 - i32.const 1 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.store - i32.const 0 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - i32.const 1 - i32.store offset=12 - end - ) - (func $~lib/array/Array#push (; 36 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#push (; 35 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) local.get $0 local.get $0 @@ -3288,23 +3270,7 @@ local.get $1 i32.store ) - (func $~lib/runtime/assertRegistered (; 37 ;) (type $FUNCSIG$vi) (param $0 i32) - local.get $0 - i32.const 8 - i32.sub - i32.load - i32.const -1520547049 - i32.eq - if - i32.const 0 - i32.const 96 - i32.const 199 - i32.const 2 - call $~lib/env/abort - unreachable - end - ) - (func $~lib/string/String#split (; 38 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#split (; 36 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3330,217 +3296,205 @@ call $~lib/array/Array#constructor return end - local.get $1 - i32.eqz - if - i32.const 1 - call $~lib/array/Array#constructor - local.tee $3 + block $folding-inner0 + local.get $1 + i32.eqz + br_if $folding-inner0 local.get $0 - call $~lib/array/Array#__set - local.get $3 - return - end - local.get $0 - i32.const 8 - i32.sub - i32.load offset=4 - i32.const 1 - i32.shr_u - local.set $6 - i32.const 2147483647 - local.get $2 - local.get $2 - i32.const 0 - i32.lt_s - select - local.set $2 - local.get $1 - i32.const 8 - i32.sub - i32.load offset=4 - i32.const 1 - i32.shr_u - local.tee $3 - local.set $9 - local.get $3 - if - local.get $6 - i32.eqz - if - i32.const 1 - call $~lib/array/Array#constructor - local.tee $5 - i32.load offset=4 - i32.const 312 - i32.store - local.get $5 - return - end - else - local.get $6 - i32.eqz - if - i32.const 0 - call $~lib/array/Array#constructor - return - end - local.get $6 - local.tee $3 + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u + local.set $4 + i32.const 2147483647 local.get $2 - local.get $3 local.get $2 + i32.const 0 i32.lt_s select - local.tee $6 - call $~lib/array/Array#constructor - local.tee $3 - i32.load offset=4 - local.set $5 - loop $repeat|0 - local.get $4 - local.get $6 - i32.lt_s - if - i32.const 2 - call $~lib/runtime/doAllocate - local.tee $1 - local.get $4 - i32.const 1 - i32.shl - local.get $0 - i32.add - i32.load16_u - i32.store16 - local.get $4 - i32.const 2 - i32.shl - local.get $5 - i32.add - local.get $1 - i32.const 1 - call $~lib/runtime/doRegister - i32.store - local.get $4 - i32.const 1 - i32.add - local.set $4 - br $repeat|0 - end - end - local.get $3 - return - end - i32.const 0 - call $~lib/array/Array#constructor - local.set $7 - loop $continue|1 - local.get $0 + local.set $2 local.get $1 - local.get $4 - call $~lib/string/String#indexOf - local.tee $8 - i32.const -1 - i32.ne + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u + local.tee $3 + local.set $9 + local.get $3 if - local.get $8 local.get $4 - i32.sub - local.tee $5 - i32.const 0 - i32.gt_s + i32.eqz if - local.get $5 i32.const 1 - i32.shl - local.tee $5 - call $~lib/runtime/doAllocate + call $~lib/array/Array#constructor local.tee $3 - local.get $4 - i32.const 1 - i32.shl - local.get $0 - i32.add - local.get $5 - call $~lib/memory/memory.copy - local.get $7 - local.get $3 - i32.const 1 - call $~lib/runtime/doRegister - call $~lib/array/Array#push - else - local.get $7 + i32.load offset=4 i32.const 312 - call $~lib/array/Array#push - end - local.get $10 - i32.const 1 - i32.add - local.tee $10 - local.get $2 - i32.eq - if - local.get $7 + i32.store + local.get $3 return end - local.get $8 - local.get $9 - i32.add - local.set $4 - br $continue|1 + else + local.get $4 + i32.eqz + if + i32.const 0 + call $~lib/array/Array#constructor + return + end + local.get $4 + local.get $2 + local.get $4 + local.get $2 + i32.lt_s + select + local.tee $4 + call $~lib/array/Array#constructor + local.tee $7 + i32.load offset=4 + local.set $3 + i32.const 0 + local.set $1 + loop $repeat|0 + local.get $1 + local.get $4 + i32.lt_s + if + i32.const 2 + call $~lib/runtime/doAllocate + local.tee $2 + local.get $1 + i32.const 1 + i32.shl + local.get $0 + i32.add + i32.load16_u + i32.store16 + local.get $1 + i32.const 2 + i32.shl + local.get $3 + i32.add + local.get $2 + i32.const 1 + call $~lib/runtime/doRegister + i32.store + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $repeat|0 + end + end + local.get $7 + return end - end - local.get $4 - i32.eqz - if - i32.const 1 + i32.const 0 call $~lib/array/Array#constructor - local.tee $3 - i32.load offset=4 - local.set $1 - local.get $0 - call $~lib/runtime/assertRegistered - local.get $3 - call $~lib/runtime/assertRegistered - local.get $1 - local.get $0 - i32.store - local.get $3 + local.set $5 + loop $continue|1 + local.get $0 + local.get $1 + local.get $6 + call $~lib/string/String#indexOf + local.tee $8 + i32.const -1 + i32.ne + if + local.get $8 + local.get $6 + i32.sub + local.tee $3 + i32.const 0 + i32.gt_s + if + local.get $3 + i32.const 1 + i32.shl + local.tee $3 + call $~lib/runtime/doAllocate + local.tee $7 + local.get $6 + i32.const 1 + i32.shl + local.get $0 + i32.add + local.get $3 + call $~lib/memory/memory.copy + local.get $5 + local.get $7 + i32.const 1 + call $~lib/runtime/doRegister + call $~lib/array/Array#push + else + local.get $5 + i32.const 312 + call $~lib/array/Array#push + end + local.get $10 + i32.const 1 + i32.add + local.tee $10 + local.get $2 + i32.eq + if + local.get $5 + return + end + local.get $8 + local.get $9 + i32.add + local.set $6 + br $continue|1 + end + end + local.get $6 + i32.eqz + br_if $folding-inner0 + local.get $4 + local.get $6 + i32.sub + local.tee $1 + i32.const 0 + i32.gt_s + if + local.get $1 + i32.const 1 + i32.shl + local.tee $1 + call $~lib/runtime/doAllocate + local.tee $3 + local.get $6 + i32.const 1 + i32.shl + local.get $0 + i32.add + local.get $1 + call $~lib/memory/memory.copy + local.get $5 + local.get $3 + i32.const 1 + call $~lib/runtime/doRegister + call $~lib/array/Array#push + else + local.get $5 + i32.const 312 + call $~lib/array/Array#push + end + local.get $5 return end - local.get $6 - local.get $4 - i32.sub - local.tee $1 - i32.const 0 - i32.gt_s - if - local.get $1 - i32.const 1 - i32.shl - local.tee $1 - call $~lib/runtime/doAllocate - local.tee $5 - local.get $4 - i32.const 1 - i32.shl - local.get $0 - i32.add - local.get $1 - call $~lib/memory/memory.copy - local.get $7 - local.get $5 - i32.const 1 - call $~lib/runtime/doRegister - call $~lib/array/Array#push - else - local.get $7 - i32.const 312 - call $~lib/array/Array#push - end - local.get $7 + i32.const 1 + call $~lib/array/Array#constructor + local.tee $3 + i32.load offset=4 + local.get $0 + i32.store + local.get $3 ) - (func $~lib/array/Array#__get (; 39 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 37 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $1 local.get $0 i32.load offset=8 @@ -3563,7 +3517,7 @@ i32.add i32.load ) - (func $~lib/util/number/decimalCount32 (; 40 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/decimalCount32 (; 38 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 100000 i32.lt_u @@ -3617,7 +3571,7 @@ end end ) - (func $~lib/util/number/utoa32_lut (; 41 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/number/utoa32_lut (; 39 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) i32.const 2060 @@ -3727,7 +3681,7 @@ i32.store16 end ) - (func $~lib/util/number/itoa32 (; 42 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/itoa32 (; 40 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3769,7 +3723,7 @@ i32.const 1 call $~lib/runtime/doRegister ) - (func $~lib/util/number/utoa32 (; 43 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/utoa32 (; 41 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) local.get $0 @@ -3792,7 +3746,7 @@ i32.const 1 call $~lib/runtime/doRegister ) - (func $~lib/util/number/decimalCount64 (; 44 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/decimalCount64 (; 42 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) local.get $0 i64.const 1000000000000000 i64.lt_u @@ -3846,7 +3800,7 @@ end end ) - (func $~lib/util/number/utoa64_lut (; 45 ;) (type $FUNCSIG$viji) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/util/number/utoa64_lut (; 43 ;) (type $FUNCSIG$viji) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3943,7 +3897,7 @@ local.get $2 call $~lib/util/number/utoa32_lut ) - (func $~lib/util/number/utoa64 (; 46 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/utoa64 (; 44 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3985,7 +3939,7 @@ i32.const 1 call $~lib/runtime/doRegister ) - (func $~lib/util/number/itoa64 (; 47 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/itoa64 (; 45 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4050,7 +4004,7 @@ i32.const 1 call $~lib/runtime/doRegister ) - (func $~lib/util/number/genDigits (; 48 ;) (type $FUNCSIG$iijijiji) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) + (func $~lib/util/number/genDigits (; 46 ;) (type $FUNCSIG$iijijiji) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) (local $7 i32) (local $8 i32) (local $9 i64) @@ -4468,7 +4422,7 @@ local.get $7 end ) - (func $~lib/util/number/prettify (; 49 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/prettify (; 47 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $2 @@ -4729,7 +4683,7 @@ end end ) - (func $~lib/util/number/dtoa_core (; 50 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/util/number/dtoa_core (; 48 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i64) (local $4 i64) @@ -5041,7 +4995,7 @@ local.get $12 i32.add ) - (func $~lib/string/String#substring (; 51 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#substring (; 49 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5139,7 +5093,7 @@ i32.const 1 call $~lib/runtime/doRegister ) - (func $~lib/util/number/dtoa (; 52 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + (func $~lib/util/number/dtoa (; 50 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) (local $1 i32) (local $2 i32) local.get $0 @@ -5184,7 +5138,7 @@ call $~lib/runtime/assertUnregistered local.get $1 ) - (func $start:std/string (; 53 ;) (type $FUNCSIG$v) + (func $start:std/string (; 51 ;) (type $FUNCSIG$v) (local $0 i32) global.get $std/string/str i32.const 16 @@ -8511,13 +8465,13 @@ unreachable end ) - (func $std/string/getString (; 54 ;) (type $FUNCSIG$i) (result i32) + (func $std/string/getString (; 52 ;) (type $FUNCSIG$i) (result i32) global.get $std/string/str ) - (func $start (; 55 ;) (type $FUNCSIG$v) + (func $start (; 53 ;) (type $FUNCSIG$v) call $start:std/string ) - (func $null (; 56 ;) (type $FUNCSIG$v) + (func $null (; 54 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index d67287ed..828f2f2b 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -8,7 +8,6 @@ (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$dii (func (param i32 i32) (result f64))) (type $FUNCSIG$di (func (param i32) (result f64))) - (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$ij (func (param i64) (result i32))) (type $FUNCSIG$viji (func (param i32 i64 i32))) (type $FUNCSIG$id (func (param f64) (result i32))) @@ -354,7 +353,7 @@ if i32.const 0 i32.const 96 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -369,7 +368,7 @@ if i32.const 0 i32.const 96 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -3010,7 +3009,7 @@ if i32.const 0 i32.const 168 - i32.const 565 + i32.const 569 i32.const 10 call $~lib/env/abort unreachable @@ -3782,7 +3781,7 @@ if i32.const 0 i32.const 96 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -4014,34 +4013,7 @@ i32.store offset=8 end ) - (func $~lib/array/Array#__set (; 41 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.const 2 - call $~lib/array/ensureCapacity - local.get $0 - i32.load offset=4 - local.get $1 - i32.const 2 - i32.shl - i32.add - local.get $2 - i32.store - local.get $1 - local.get $0 - i32.load offset=12 - i32.ge_s - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=12 - end - ) - (func $~lib/array/Array#push (; 42 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#push (; 41 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 i32.load offset=12 @@ -4067,30 +4039,7 @@ i32.store local.get $2 ) - (func $~lib/runtime/assertRegistered (; 43 ;) (type $FUNCSIG$vi) (param $0 i32) - local.get $0 - global.get $~lib/runtime/HEADER_SIZE - i32.sub - i32.load - global.get $~lib/runtime/HEADER_MAGIC - i32.ne - i32.eqz - if - i32.const 0 - i32.const 96 - i32.const 199 - i32.const 2 - call $~lib/env/abort - unreachable - end - ) - (func $~lib/runtime/doLink (; 44 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - local.get $0 - call $~lib/runtime/assertRegistered - local.get $1 - call $~lib/runtime/assertRegistered - ) - (func $~lib/string/String#split (; 45 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#split (; 42 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4133,19 +4082,21 @@ call $~lib/array/Array#constructor local.set $3 local.get $3 - i32.const 0 + i32.load offset=4 + local.set $4 + local.get $4 local.get $0 - call $~lib/array/Array#__set + i32.store local.get $3 end return end local.get $0 call $~lib/string/String#get:length - local.set $4 + local.set $5 local.get $1 call $~lib/string/String#get:length - local.set $5 + local.set $6 local.get $2 i32.const 0 i32.lt_s @@ -4153,10 +4104,10 @@ global.get $~lib/builtins/i32.MAX_VALUE local.set $2 end - local.get $5 + local.get $6 i32.eqz if - local.get $4 + local.get $5 i32.eqz if i32.const 0 @@ -4164,28 +4115,28 @@ call $~lib/array/Array#constructor return end - local.get $4 - local.tee $3 + local.get $5 + local.tee $4 local.get $2 - local.tee $6 + local.tee $3 + local.get $4 local.get $3 - local.get $6 i32.lt_s select - local.set $4 + local.set $5 i32.const 0 - local.get $4 + local.get $5 call $~lib/array/Array#constructor - local.set $3 - local.get $3 + local.set $4 + local.get $4 i32.load offset=4 - local.set $6 + local.set $3 block $break|0 i32.const 0 local.set $7 loop $repeat|0 local.get $7 - local.get $4 + local.get $5 i32.lt_s i32.eqz br_if $break|0 @@ -4205,7 +4156,7 @@ i32.add i32.load16_u i32.store16 - local.get $6 + local.get $3 local.get $7 i32.const 2 i32.shl @@ -4228,21 +4179,21 @@ end unreachable end - local.get $3 + local.get $4 return else - local.get $4 + local.get $5 i32.eqz if i32.const 0 i32.const 1 call $~lib/array/Array#constructor - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.load offset=4 i32.const 312 i32.store - local.get $6 + local.get $3 return end end @@ -4270,33 +4221,33 @@ local.get $11 local.get $12 i32.sub - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 0 i32.gt_s if block $~lib/runtime/ALLOCATE|inlined.9 (result i32) - local.get $6 + local.get $3 i32.const 1 i32.shl - local.set $3 - local.get $3 + local.set $4 + local.get $4 call $~lib/runtime/doAllocate end - local.set $3 - local.get $3 + local.set $4 + local.get $4 local.get $0 local.get $12 i32.const 1 i32.shl i32.add - local.get $6 + local.get $3 i32.const 1 i32.shl call $~lib/memory/memory.copy local.get $10 block $~lib/runtime/REGISTER|inlined.8 (result i32) - local.get $3 + local.get $4 local.set $7 local.get $7 i32.const 1 @@ -4321,7 +4272,7 @@ return end local.get $11 - local.get $5 + local.get $6 i32.add local.set $12 end @@ -4335,23 +4286,15 @@ i32.const 0 i32.const 1 call $~lib/array/Array#constructor - local.set $6 - local.get $6 - local.tee $3 + local.set $3 + local.get $3 i32.load offset=4 - block $~lib/runtime/LINK>|inlined.0 (result i32) - local.get $0 - local.set $7 - local.get $7 - local.get $3 - call $~lib/runtime/doLink - local.get $7 - end + local.get $0 i32.store - local.get $6 + local.get $3 return end - local.get $4 + local.get $5 local.get $12 i32.sub local.set $14 @@ -4363,12 +4306,12 @@ local.get $14 i32.const 1 i32.shl - local.set $6 - local.get $6 + local.set $3 + local.get $3 call $~lib/runtime/doAllocate end - local.set $6 - local.get $6 + local.set $3 + local.get $3 local.get $0 local.get $12 i32.const 1 @@ -4380,9 +4323,9 @@ call $~lib/memory/memory.copy local.get $10 block $~lib/runtime/REGISTER|inlined.9 (result i32) - local.get $6 - local.set $3 local.get $3 + local.set $4 + local.get $4 i32.const 1 call $~lib/runtime/doRegister end @@ -4396,11 +4339,11 @@ end local.get $10 ) - (func $~lib/array/Array#get:length (; 46 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 43 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=12 ) - (func $~lib/array/Array#__get (; 47 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 44 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $1 local.get $0 i32.load offset=8 @@ -4423,7 +4366,7 @@ i32.add i32.load ) - (func $~lib/util/number/decimalCount32 (; 48 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/decimalCount32 (; 45 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 i32.const 100000 @@ -4492,7 +4435,7 @@ unreachable unreachable ) - (func $~lib/util/number/utoa32_lut (; 49 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/number/utoa32_lut (; 46 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4635,7 +4578,7 @@ i32.store16 end ) - (func $~lib/util/number/itoa32 (; 50 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/itoa32 (; 47 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4699,7 +4642,7 @@ call $~lib/runtime/doRegister end ) - (func $~lib/util/number/utoa32 (; 51 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/number/utoa32 (; 48 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4743,7 +4686,7 @@ call $~lib/runtime/doRegister end ) - (func $~lib/util/number/decimalCount64 (; 52 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/decimalCount64 (; 49 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) local.get $0 i64.const 1000000000000000 @@ -4812,7 +4755,7 @@ unreachable unreachable ) - (func $~lib/util/number/utoa64_lut (; 53 ;) (type $FUNCSIG$viji) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/util/number/utoa64_lut (; 50 ;) (type $FUNCSIG$viji) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i32) @@ -4940,7 +4883,7 @@ local.get $2 call $~lib/util/number/utoa32_lut ) - (func $~lib/util/number/utoa64 (; 54 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/utoa64 (; 51 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5020,7 +4963,7 @@ call $~lib/runtime/doRegister end ) - (func $~lib/util/number/itoa64 (; 55 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) + (func $~lib/util/number/itoa64 (; 52 ;) (type $FUNCSIG$ij) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5122,19 +5065,19 @@ call $~lib/runtime/doRegister end ) - (func $~lib/builtins/isFinite (; 56 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 53 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) local.get $0 local.get $0 f64.sub f64.const 0 f64.eq ) - (func $~lib/builtins/isNaN (; 57 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 54 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) local.get $0 local.get $0 f64.ne ) - (func $~lib/util/number/genDigits (; 58 ;) (type $FUNCSIG$iijijiji) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) + (func $~lib/util/number/genDigits (; 55 ;) (type $FUNCSIG$iijijiji) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) (local $7 i32) (local $8 i64) (local $9 i64) @@ -5705,7 +5648,7 @@ end local.get $15 ) - (func $~lib/util/number/prettify (; 59 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/prettify (; 56 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6038,7 +5981,7 @@ unreachable unreachable ) - (func $~lib/util/number/dtoa_core (; 60 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/util/number/dtoa_core (; 57 ;) (type $FUNCSIG$iid) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 f64) (local $4 i32) @@ -6484,7 +6427,7 @@ local.get $2 i32.add ) - (func $~lib/string/String#substring (; 61 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#substring (; 58 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6610,7 +6553,7 @@ call $~lib/runtime/doRegister end ) - (func $~lib/runtime/doDiscard (; 62 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/runtime/doDiscard (; 59 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 call $~lib/runtime/assertUnregistered local.get $0 @@ -6618,7 +6561,7 @@ i32.sub call $~lib/memory/memory.free ) - (func $~lib/util/number/dtoa (; 63 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + (func $~lib/util/number/dtoa (; 60 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6674,7 +6617,7 @@ end local.get $4 ) - (func $start:std/string (; 64 ;) (type $FUNCSIG$v) + (func $start:std/string (; 61 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -10066,12 +10009,12 @@ unreachable end ) - (func $std/string/getString (; 65 ;) (type $FUNCSIG$i) (result i32) + (func $std/string/getString (; 62 ;) (type $FUNCSIG$i) (result i32) global.get $std/string/str ) - (func $start (; 66 ;) (type $FUNCSIG$v) + (func $start (; 63 ;) (type $FUNCSIG$v) call $start:std/string ) - (func $null (; 67 ;) (type $FUNCSIG$v) + (func $null (; 64 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 2113f214..759ef8a4 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -143,7 +143,7 @@ if i32.const 0 i32.const 72 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -157,7 +157,7 @@ if i32.const 0 i32.const 72 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 50b9392d..3dd3e95e 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -205,7 +205,7 @@ if i32.const 0 i32.const 72 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -220,7 +220,7 @@ if i32.const 0 i32.const 72 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 6e9cc653..d82c5665 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -403,7 +403,7 @@ if i32.const 0 i32.const 64 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -417,7 +417,7 @@ if i32.const 0 i32.const 64 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -465,7 +465,7 @@ if i32.const 0 i32.const 64 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -8606,24 +8606,24 @@ local.get $0 i32.reinterpret_f32 local.tee $1 + i32.const -2147483648 + i32.and + local.set $4 + local.get $1 i32.const 23 i32.shr_u i32.const 255 i32.and - local.set $2 - local.get $1 - i32.const -2147483648 - i32.and - local.set $4 - local.get $2 + local.tee $2 i32.const 255 i32.eq local.tee $3 - if (result i32) - local.get $3 - else + i32.eqz + if i32.const 0 + local.set $3 end + local.get $3 if local.get $0 f32.const 2 @@ -8677,7 +8677,7 @@ local.get $1 i32.const 8388608 i32.ge_u - if + if (result i32) local.get $1 i32.const 8388608 i32.eq @@ -8685,9 +8685,9 @@ local.get $1 i32.const 8388608 i32.sub - local.set $1 + else + local.get $1 end - local.get $1 i32.const 1 i32.shl local.set $1 @@ -8843,29 +8843,29 @@ (local $1 i64) (local $2 i64) (local $3 i64) - (local $4 i64) - (local $5 i32) + (local $4 i32) + (local $5 i64) local.get $0 i64.reinterpret_f64 local.tee $1 + i64.const 63 + i64.shr_u + local.set $5 + local.get $1 i64.const 52 i64.shr_u i64.const 2047 i64.and - local.set $2 - local.get $1 - i64.const 63 - i64.shr_u - local.set $4 - local.get $2 + local.tee $2 i64.const 2047 i64.eq - local.tee $5 - if (result i32) - local.get $5 - else + local.tee $4 + i32.eqz + if i32.const 0 + local.set $4 end + local.get $4 if local.get $0 f64.const 2 @@ -8922,7 +8922,7 @@ local.get $1 i64.const 4503599627370496 i64.ge_u - if + if (result i64) local.get $1 i64.const 4503599627370496 i64.eq @@ -8930,9 +8930,9 @@ local.get $1 i64.const 4503599627370496 i64.sub - local.set $1 + else + local.get $1 end - local.get $1 i64.const 1 i64.shl local.set $1 @@ -8987,7 +8987,7 @@ i64.add i64.shr_u end - local.get $4 + local.get $5 i64.const 63 i64.shl i64.or diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index e34ee878..18a8381d 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -27,7 +27,9 @@ (type $FUNCSIG$ifii (func (param f32 i32 i32) (result i32))) (type $FUNCSIG$idii (func (param f64 i32 i32) (result i32))) (type $FUNCSIG$fff (func (param f32 f32) (result f32))) + (type $FUNCSIG$if (func (param f32) (result i32))) (type $FUNCSIG$ddd (func (param f64 f64) (result f64))) + (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$vjii (func (param i64 i32 i32))) (type $FUNCSIG$vfii (func (param f32 i32 i32))) @@ -484,7 +486,7 @@ if i32.const 0 i32.const 64 - i32.const 191 + i32.const 192 i32.const 2 call $~lib/env/abort unreachable @@ -499,7 +501,7 @@ if i32.const 0 i32.const 64 - i32.const 192 + i32.const 193 i32.const 2 call $~lib/env/abort unreachable @@ -563,7 +565,7 @@ if i32.const 0 i32.const 64 - i32.const 226 + i32.const 227 i32.const 57 call $~lib/env/abort unreachable @@ -12258,7 +12260,12 @@ unreachable end ) - (func $~lib/math/NativeMathf.mod (; 301 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/builtins/isNaN (; 301 ;) (type $FUNCSIG$if) (param $0 f32) (result i32) + local.get $0 + local.get $0 + f32.ne + ) + (func $~lib/math/NativeMathf.mod (; 302 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12311,13 +12318,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f32.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -12514,14 +12516,14 @@ local.get $2 f32.reinterpret_i32 ) - (func $std/typedarray/testArrayEvery~anonymous|0 (; 302 ;) (type $FUNCSIG$ifii) (param $0 f32) (param $1 i32) (param $2 i32) (result i32) + (func $std/typedarray/testArrayEvery~anonymous|0 (; 303 ;) (type $FUNCSIG$ifii) (param $0 f32) (param $1 i32) (param $2 i32) (result i32) local.get $0 f32.const 2 call $~lib/math/NativeMathf.mod f32.const 0 f32.eq ) - (func $~lib/typedarray/Float32Array#every (; 303 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Float32Array#every (; 304 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12588,12 +12590,12 @@ i32.const 1 end ) - (func $std/typedarray/testArrayEvery~anonymous|1 (; 304 ;) (type $FUNCSIG$ifii) (param $0 f32) (param $1 i32) (param $2 i32) (result i32) + (func $std/typedarray/testArrayEvery~anonymous|1 (; 305 ;) (type $FUNCSIG$ifii) (param $0 f32) (param $1 i32) (param $2 i32) (result i32) local.get $0 f32.const 2 f32.eq ) - (func $std/typedarray/testArrayEvery (; 305 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayEvery (; 306 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -12647,7 +12649,12 @@ unreachable end ) - (func $~lib/math/NativeMath.mod (; 306 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/builtins/isNaN (; 307 ;) (type $FUNCSIG$id) (param $0 f64) (result i32) + local.get $0 + local.get $0 + f64.ne + ) + (func $~lib/math/NativeMath.mod (; 308 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i64) @@ -12700,13 +12707,8 @@ local.get $8 else local.get $1 - local.set $9 - local.get $9 - local.get $9 - f64.ne + call $~lib/builtins/isNaN end - i32.const 0 - i32.ne if local.get $0 local.get $1 @@ -12905,14 +12907,14 @@ local.get $2 f64.reinterpret_i64 ) - (func $std/typedarray/testArrayEvery~anonymous|0 (; 307 ;) (type $FUNCSIG$idii) (param $0 f64) (param $1 i32) (param $2 i32) (result i32) + (func $std/typedarray/testArrayEvery~anonymous|0 (; 309 ;) (type $FUNCSIG$idii) (param $0 f64) (param $1 i32) (param $2 i32) (result i32) local.get $0 f64.const 2 call $~lib/math/NativeMath.mod f64.const 0 f64.eq ) - (func $~lib/typedarray/Float64Array#every (; 308 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Float64Array#every (; 310 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12979,12 +12981,12 @@ i32.const 1 end ) - (func $std/typedarray/testArrayEvery~anonymous|1 (; 309 ;) (type $FUNCSIG$idii) (param $0 f64) (param $1 i32) (param $2 i32) (result i32) + (func $std/typedarray/testArrayEvery~anonymous|1 (; 311 ;) (type $FUNCSIG$idii) (param $0 f64) (param $1 i32) (param $2 i32) (result i32) local.get $0 f64.const 2 f64.eq ) - (func $std/typedarray/testArrayEvery (; 310 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayEvery (; 312 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -13038,7 +13040,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 311 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 313 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13093,7 +13095,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Int8Array#forEach (; 312 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Int8Array#forEach (; 314 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13138,7 +13140,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 313 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 315 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -13194,7 +13196,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 314 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 316 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13245,7 +13247,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Uint8Array#forEach (; 315 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Uint8Array#forEach (; 317 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13290,7 +13292,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 316 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 318 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -13340,7 +13342,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 317 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 319 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13391,7 +13393,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Uint8ClampedArray#forEach (; 318 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Uint8ClampedArray#forEach (; 320 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13436,7 +13438,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 319 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 321 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -13486,7 +13488,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 320 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 322 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13541,7 +13543,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Int16Array#forEach (; 321 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Int16Array#forEach (; 323 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13586,7 +13588,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 322 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 324 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -13642,7 +13644,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 323 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 325 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13693,7 +13695,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Uint16Array#forEach (; 324 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Uint16Array#forEach (; 326 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13738,7 +13740,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 325 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 327 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -13788,7 +13790,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 326 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 328 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13835,7 +13837,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Int32Array#forEach (; 327 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Int32Array#forEach (; 329 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13880,7 +13882,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 328 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 330 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -13924,7 +13926,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 329 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 331 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -13971,7 +13973,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Uint32Array#forEach (; 330 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Uint32Array#forEach (; 332 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14016,7 +14018,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 331 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 333 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -14060,7 +14062,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 332 ;) (type $FUNCSIG$vjii) (param $0 i64) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 334 ;) (type $FUNCSIG$vjii) (param $0 i64) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -14108,7 +14110,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Int64Array#forEach (; 333 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Int64Array#forEach (; 335 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14153,7 +14155,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 334 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 336 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -14200,7 +14202,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 335 ;) (type $FUNCSIG$vjii) (param $0 i64) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 337 ;) (type $FUNCSIG$vjii) (param $0 i64) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -14248,7 +14250,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Uint64Array#forEach (; 336 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Uint64Array#forEach (; 338 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14293,7 +14295,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 337 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 339 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -14340,7 +14342,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 338 ;) (type $FUNCSIG$vfii) (param $0 f32) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 340 ;) (type $FUNCSIG$vfii) (param $0 f32) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -14388,7 +14390,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Float32Array#forEach (; 339 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Float32Array#forEach (; 341 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14433,7 +14435,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 340 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 342 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -14480,7 +14482,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach~anonymous|0 (; 341 ;) (type $FUNCSIG$vdii) (param $0 f64) (param $1 i32) (param $2 i32) + (func $std/typedarray/testArrayForEach~anonymous|0 (; 343 ;) (type $FUNCSIG$vdii) (param $0 f64) (param $1 i32) (param $2 i32) (local $3 i32) global.get $std/typedarray/forEachValues local.get $1 @@ -14528,7 +14530,7 @@ i32.add global.set $std/typedarray/forEachCallCount ) - (func $~lib/typedarray/Float64Array#forEach (; 342 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/typedarray/Float64Array#forEach (; 344 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14573,7 +14575,7 @@ unreachable end ) - (func $std/typedarray/testArrayForEach (; 343 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayForEach (; 345 ;) (type $FUNCSIG$v) (local $0 i32) i32.const 0 global.set $std/typedarray/forEachCallCount @@ -14620,7 +14622,7 @@ unreachable end ) - (func $~lib/typedarray/Int8Array#reverse (; 344 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Int8Array#reverse (; 346 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -14690,7 +14692,7 @@ end local.get $1 ) - (func $std/typedarray/testArrayReverse (; 345 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 347 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -14854,7 +14856,7 @@ unreachable end ) - (func $~lib/typedarray/Uint8Array#reverse (; 346 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Uint8Array#reverse (; 348 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -14924,7 +14926,7 @@ end local.get $1 ) - (func $~lib/typedarray/Uint8Array#subarray (; 347 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint8Array#subarray (; 349 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -15038,7 +15040,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 348 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 350 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -15196,7 +15198,7 @@ unreachable end ) - (func $~lib/typedarray/Uint8ClampedArray#reverse (; 349 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Uint8ClampedArray#reverse (; 351 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -15266,7 +15268,7 @@ end local.get $1 ) - (func $~lib/typedarray/Uint8ClampedArray#subarray (; 350 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint8ClampedArray#subarray (; 352 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -15380,7 +15382,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 351 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 353 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -15538,7 +15540,7 @@ unreachable end ) - (func $~lib/typedarray/Int16Array#reverse (; 352 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Int16Array#reverse (; 354 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -15608,7 +15610,7 @@ end local.get $1 ) - (func $~lib/typedarray/Int16Array#subarray (; 353 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int16Array#subarray (; 355 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -15722,7 +15724,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 354 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 356 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -15886,7 +15888,7 @@ unreachable end ) - (func $~lib/typedarray/Uint16Array#reverse (; 355 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Uint16Array#reverse (; 357 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -15956,7 +15958,7 @@ end local.get $1 ) - (func $~lib/typedarray/Uint16Array#subarray (; 356 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint16Array#subarray (; 358 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -16070,7 +16072,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 357 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 359 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -16228,7 +16230,7 @@ unreachable end ) - (func $~lib/typedarray/Int32Array#reverse (; 358 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Int32Array#reverse (; 360 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -16298,7 +16300,7 @@ end local.get $1 ) - (func $std/typedarray/testArrayReverse (; 359 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 361 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -16450,7 +16452,7 @@ unreachable end ) - (func $~lib/typedarray/Uint32Array#reverse (; 360 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Uint32Array#reverse (; 362 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -16520,7 +16522,7 @@ end local.get $1 ) - (func $~lib/typedarray/Uint32Array#subarray (; 361 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint32Array#subarray (; 363 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -16634,7 +16636,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 362 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 364 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -16786,7 +16788,7 @@ unreachable end ) - (func $~lib/typedarray/Int64Array#reverse (; 363 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Int64Array#reverse (; 365 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -16856,7 +16858,7 @@ end local.get $1 ) - (func $~lib/typedarray/Int64Array#subarray (; 364 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int64Array#subarray (; 366 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -16970,7 +16972,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 365 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 367 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -17125,7 +17127,7 @@ unreachable end ) - (func $~lib/typedarray/Uint64Array#reverse (; 366 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Uint64Array#reverse (; 368 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -17195,7 +17197,7 @@ end local.get $1 ) - (func $~lib/typedarray/Uint64Array#subarray (; 367 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint64Array#subarray (; 369 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -17309,7 +17311,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 368 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 370 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -17464,7 +17466,7 @@ unreachable end ) - (func $~lib/typedarray/Float32Array#reverse (; 369 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Float32Array#reverse (; 371 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -17534,7 +17536,7 @@ end local.get $1 ) - (func $~lib/typedarray/Float32Array#subarray (; 370 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Float32Array#subarray (; 372 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -17648,7 +17650,7 @@ i32.store offset=8 local.get $7 ) - (func $std/typedarray/testArrayReverse (; 371 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 373 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -17803,7 +17805,7 @@ unreachable end ) - (func $~lib/typedarray/Float64Array#reverse (; 372 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/typedarray/Float64Array#reverse (; 374 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -17873,7 +17875,7 @@ end local.get $1 ) - (func $std/typedarray/testArrayReverse (; 373 ;) (type $FUNCSIG$v) + (func $std/typedarray/testArrayReverse (; 375 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -18028,7 +18030,7 @@ unreachable end ) - (func $start:std/typedarray (; 374 ;) (type $FUNCSIG$v) + (func $start:std/typedarray (; 376 ;) (type $FUNCSIG$v) (local $0 i32) global.get $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT i32.const 1 @@ -19304,9 +19306,9 @@ call $std/typedarray/testArrayReverse call $std/typedarray/testArrayReverse ) - (func $start (; 375 ;) (type $FUNCSIG$v) + (func $start (; 377 ;) (type $FUNCSIG$v) call $start:std/typedarray ) - (func $null (; 376 ;) (type $FUNCSIG$v) + (func $null (; 378 ;) (type $FUNCSIG$v) ) )