diff --git a/cli/asc.js b/cli/asc.js index 28d06d2075..a38a183b7f 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -375,7 +375,10 @@ exports.main = function main(argv, options, callback) { let transform = transforms[i]; if (typeof transform[name] === "function") { try { - transform[name](...args); + stats.transformCount++; + stats.transfromTime += measure(() => { + transform[name](...args); + }); } catch (e) { return e; } @@ -605,29 +608,11 @@ exports.main = function main(argv, options, callback) { return callback(null); } - // Set up optimization levels - var optimizeLevel = 0; - var shrinkLevel = 0; - if (args.optimize) { - optimizeLevel = exports.defaultOptimizeLevel; - shrinkLevel = exports.defaultShrinkLevel; - } - if (typeof args.optimizeLevel === "number") { - optimizeLevel = args.optimizeLevel; - } - if (typeof args.shrinkLevel === "number") { - shrinkLevel = args.shrinkLevel; - } - optimizeLevel = Math.min(Math.max(optimizeLevel, 0), 3); - shrinkLevel = Math.min(Math.max(shrinkLevel, 0), 2); - - try { - stats.compileTime += measure(() => { - assemblyscript.initializeProgram(program, compilerOptions); - }); - } catch(e) { - return callback(e); - } + // Pre-emptively initialize the program + stats.initializeCount++; + stats.initializeTime += measure(() => { + assemblyscript.initializeProgram(program); + }); // Call afterInitialize transform hook { @@ -637,13 +622,9 @@ exports.main = function main(argv, options, callback) { var module; stats.compileCount++; - try { - stats.compileTime += measure(() => { - module = assemblyscript.compile(program); - }); - } catch (e) { - return callback(e); - } + stats.compileTime += measure(() => { + module = assemblyscript.compile(program); + }); var numErrors = checkDiagnostics(program, stderr); if (numErrors) { if (module) module.dispose(); @@ -907,6 +888,7 @@ exports.main = function main(argv, options, callback) { function listFilesNode(dirname, baseDir) { var files; try { + stats.readCount++; stats.readTime += measure(() => { files = fs.readdirSync(path.join(baseDir, dirname)).filter(file => extension.re_except_d.test(file)) }); @@ -958,6 +940,8 @@ function createStats() { writeCount: 0, parseTime: 0, parseCount: 0, + initializeTime: 0, + initializeCount: 0, compileTime: 0, compileCount: 0, emitTime: 0, @@ -965,7 +949,9 @@ function createStats() { validateTime: 0, validateCount: 0, optimizeTime: 0, - optimizeCount: 0 + optimizeCount: 0, + transformTime: 0, + transformCount: 0 }; } @@ -983,9 +969,14 @@ function measure(fn) { exports.measure = measure; +function pad(str, len) { + while (str.length < len) str = " " + str; + return str; +} + /** Formats a high resolution time to a human readable string. */ function formatTime(time) { - return time ? (time / 1e6).toFixed(3) + " ms" : "N/A"; + return time ? (time / 1e6).toFixed(3) + " ms" : "n/a"; } exports.formatTime = formatTime; @@ -993,16 +984,18 @@ exports.formatTime = formatTime; /** Formats and prints out the contents of a set of stats. */ function printStats(stats, output) { function format(time, count) { - return formatTime(time); + return pad(formatTime(time), 12) + " n=" + count; } (output || process.stdout).write([ - "I/O Read : " + format(stats.readTime, stats.readCount), - "I/O Write : " + format(stats.writeTime, stats.writeCount), - "Parse : " + format(stats.parseTime, stats.parseCount), - "Compile : " + format(stats.compileTime, stats.compileCount), - "Emit : " + format(stats.emitTime, stats.emitCount), - "Validate : " + format(stats.validateTime, stats.validateCount), - "Optimize : " + format(stats.optimizeTime, stats.optimizeCount) + "I/O Read : " + format(stats.readTime, stats.readCount), + "I/O Write : " + format(stats.writeTime, stats.writeCount), + "Parse : " + format(stats.parseTime, stats.parseCount), + "Initialize : " + format(stats.initializeTime, stats.initializeCount), + "Compile : " + format(stats.compileTime, stats.compileCount), + "Emit : " + format(stats.emitTime, stats.emitCount), + "Validate : " + format(stats.validateTime, stats.validateCount), + "Optimize : " + format(stats.optimizeTime, stats.optimizeCount), + "Transform : " + format(stats.transformTime, stats.transformCount) ].join(EOL) + EOL); } diff --git a/lib/loader/index.d.ts b/lib/loader/index.d.ts index 812f1443b1..59abe7d3d2 100644 --- a/lib/loader/index.d.ts +++ b/lib/loader/index.d.ts @@ -5,18 +5,17 @@ export interface ResultObject { instance: WebAssembly.Instance; } -type ImportValue = Function | WebAssembly.Global | WebAssembly.Memory | WebAssembly.Table | number; - /** WebAssembly imports with two levels of nesting. */ export type Imports = { + [key: string]: object, env?: { memory?: WebAssembly.Memory; table?: WebAssembly.Table; seed?(): number; abort?(msg: number, file: number, line: number, column: number): void; trace?(msg: number, numArgs?: number, ...args: number[]): void; - } & Record; -} & Record>; + }; +}; /** Utility mixed in by the loader. */ export interface ASUtil { diff --git a/package.json b/package.json index bcccdcd079..a35829d565 100644 --- a/package.json +++ b/package.json @@ -66,8 +66,8 @@ "prepublishOnly": "node scripts/prepublish", "postpublish": "node scripts/postpublish", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", - "asbuild:untouched": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.untouched.wat -b out/assemblyscript.untouched.wasm -d out/assemblyscript.d.ts --validate --debug --measure", - "asbuild:optimized": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.optimized.wat -b out/assemblyscript.optimized.wasm -O3 --validate --measure", + "asbuild:untouched": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.untouched.wat -b out/assemblyscript.untouched.wasm -d out/assemblyscript.d.ts --validate --debug --measure --runtime stub", + "asbuild:optimized": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.optimized.wat -b out/assemblyscript.optimized.wasm -O3 --validate --measure --runtime stub", "astest": "ts-node tests/bootstrap" }, "releaseFiles": [ diff --git a/src/ast.ts b/src/ast.ts index 79a7ecf918..8af1d303f2 100644 --- a/src/ast.ts +++ b/src/ast.ts @@ -1166,6 +1166,16 @@ export abstract class Node { } return false; } + + /** Checks if this is a call calling a method on super. */ + get isCallOnSuper(): bool { + if (this.kind != NodeKind.CALL) return false; + var expression = changetype(this).expression; + if (expression.kind != NodeKind.PROPERTYACCESS) return false; + var target = (expression).expression; + if (target.kind == NodeKind.SUPER) return true; + return false; + } } // types diff --git a/src/common.ts b/src/common.ts index b8594fead5..dc0a90daf5 100644 --- a/src/common.ts +++ b/src/common.ts @@ -66,8 +66,8 @@ export enum CommonFlags { INLINED = 1 << 23, /** Is scoped. */ SCOPED = 1 << 24, - /** Is a trampoline. */ - TRAMPOLINE = 1 << 25, + /** Is a stub. */ + STUB = 1 << 25, /** Is a virtual method. */ VIRTUAL = 1 << 26, /** Is (part of) a closure. */ @@ -99,6 +99,8 @@ export const LIBRARY_SUBST = "~lib"; export const LIBRARY_PREFIX = LIBRARY_SUBST + PATH_DELIMITER; /** Path index suffix. */ export const INDEX_SUFFIX = PATH_DELIMITER + "index"; +/** Stub function delimiter. */ +export const STUB_DELIMITER = "@"; /** Common names. */ export namespace CommonNames { diff --git a/src/compiler.ts b/src/compiler.ts index ebffd92242..d58380c8a8 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -48,6 +48,9 @@ import { getGlobalGetName, isGlobalMutable, createType, + getSideEffects, + SideEffects, + SwitchBuilder, ExpressionRunnerFlags } from "./module"; @@ -57,8 +60,8 @@ import { STATIC_DELIMITER, GETTER_PREFIX, SETTER_PREFIX, - CommonNames, INDEX_SUFFIX, + CommonNames, Feature, Target, featureToString @@ -335,7 +338,7 @@ export class Compiler extends DiagnosticEmitter { /** Map of already compiled static string segments. */ stringSegments: Map = new Map(); /** Function table being compiled. First elem is blank. */ - functionTable: string[] = []; + functionTable: Function[] = []; /** Arguments length helper global. */ builtinArgumentsLength: GlobalRef = 0; /** Requires runtime features. */ @@ -389,19 +392,14 @@ export class Compiler extends DiagnosticEmitter { module.setFeatures(featureFlags); } - initializeProgram(): void { - // initialize lookup maps, built-ins, imports, exports, etc. - this.program.initialize(this.options); - } - /** Performs compilation of the underlying {@link Program} to a {@link Module}. */ compile(): Module { var options = this.options; var module = this.module; var program = this.program; - // check and perform this program initialization if it hasn't been done - this.initializeProgram(); + // initialize lookup maps, built-ins, imports, exports, etc. + this.program.initialize(); // set up the main start function var startFunctionInstance = program.makeNativeFunction(BuiltinNames.start, new Signature(program, [], Type.void)); @@ -497,7 +495,22 @@ export class Compiler extends DiagnosticEmitter { } // set up virtual lookup tables - this.setupVirtualLookupTables(); + var functionTable = this.functionTable; + for (let i = 0, k = functionTable.length; i < k; ++i) { + let instance = functionTable[i]; + if (instance.is(CommonFlags.VIRTUAL)) { + assert(instance.is(CommonFlags.INSTANCE)); + functionTable[i] = this.ensureVirtualStub(instance); // incl. varargs + this.finalizeVirtualStub(instance); + } else if (instance.signature.requiredParameters < instance.signature.parameterTypes.length) { + functionTable[i] = this.ensureVarargsStub(instance); + } + } + var virtualCalls = this.virtualCalls; + for (let _values = Set_values(virtualCalls), i = 0, k = _values.length; i < k; ++i) { + let instance = unchecked(_values[i]); + this.finalizeVirtualStub(instance); + } // finalize runtime features module.removeGlobal(BuiltinNames.rtti_base); @@ -555,10 +568,13 @@ export class Compiler extends DiagnosticEmitter { if (options.importMemory) module.addMemoryImport("0", "env", "memory", isSharedMemory); // set up function table (first elem is blank) - var functionTable = this.functionTable; var tableBase = this.options.tableBase; if (!tableBase) tableBase = 1; // leave first elem blank - module.setFunctionTable(tableBase + functionTable.length, Module.UNLIMITED_TABLE, functionTable, module.i32(tableBase)); + var functionTableNames = new Array(functionTable.length); + for (let i = 0, k = functionTable.length; i < k; ++i) { + functionTableNames[i] = functionTable[i].internalName; + } + module.setFunctionTable(tableBase + functionTable.length, Module.UNLIMITED_TABLE, functionTableNames, module.i32(tableBase)); // import and/or export table if requested (default table is named '0' by Binaryen) if (options.importTable) { @@ -589,36 +605,6 @@ export class Compiler extends DiagnosticEmitter { return module; } - private setupVirtualLookupTables(): void { - // TODO: :-) - var program = this.program; - var virtualCalls = this.virtualCalls; - - // Virtual instance methods in the function table are potentially called virtually - var functionTable = this.functionTable; - var elementsByName = program.elementsByName; - for (let i = 0, k = functionTable.length; i < k; ++i) { - let instanceName = unchecked(functionTable[i]); - if (elementsByName.has(instanceName)) { // otherwise ~anonymous - let instance = assert(elementsByName.get(instanceName)); - if (instance.is(CommonFlags.INSTANCE | CommonFlags.VIRTUAL)) { - assert(instance.kind == ElementKind.FUNCTION); - virtualCalls.add(instance); - } - } - } - - // Inject a virtual lookup table into each function potentially called virtually - // TODO: for (let instance of virtualCalls.values()) { - for (let _values = Set_values(virtualCalls), i = 0, k = _values.length; i < k; ++i) { - let instance = unchecked(_values[i]); - this.warning( - DiagnosticCode.Function_0_is_possibly_called_virtually_which_is_not_yet_supported, - instance.identifierNode.range, instance.internalName - ); - } - } - // === Exports ================================================================================== /** Applies the respective module exports for the specified file. */ @@ -717,9 +703,9 @@ export class Compiler extends DiagnosticEmitter { if (!functionInstance.hasDecorator(DecoratorFlags.BUILTIN)) { let signature = functionInstance.signature; if (signature.requiredParameters < signature.parameterTypes.length) { - // utilize trampoline to fill in omitted arguments - functionInstance = this.ensureTrampoline(functionInstance); - this.ensureBuiltinArgumentsLength(); + // utilize varargs stub to fill in omitted arguments + functionInstance = this.ensureVarargsStub(functionInstance); + this.ensureArgumentsLength(); } if (functionInstance.is(CommonFlags.COMPILED)) this.module.addFunctionExport(functionInstance.internalName, prefix + name); } @@ -1339,24 +1325,25 @@ export class Compiler extends DiagnosticEmitter { } } - this.compileFunctionBody(instance, stmts); - if (!flow.is(FlowFlags.TERMINATES)) { - this.performAutoreleases(flow, stmts); - this.finishAutoreleases(flow, stmts); + let body: ExpressionRef; + if (this.compileFunctionBody(instance, stmts)) { + if (!flow.is(FlowFlags.TERMINATES)) { + this.performAutoreleases(flow, stmts); + this.finishAutoreleases(flow, stmts); + } + body = module.flatten(stmts, instance.signature.returnType.toNativeType()); + } else { + body = module.unreachable(); } this.currentFlow = previousFlow; // create the function - let body = module.flatten(stmts, instance.signature.returnType.toNativeType()); - if (instance.is(CommonFlags.VIRTUAL)) { - body = module.block("vtable", [ body ], getExpressionType(body)); - } funcRef = module.addFunction( instance.internalName, signature.nativeParams, signature.nativeResults, typesToNativeTypes(instance.additionalLocals), - body + module.flatten(stmts, instance.signature.returnType.toNativeType()) ); // imported function @@ -1372,8 +1359,8 @@ export class Compiler extends DiagnosticEmitter { ); funcRef = module.getFunction(instance.internalName); - // abstract function - } else if (instance.is(CommonFlags.ABSTRACT)) { + // abstract or interface function + } else if (instance.is(CommonFlags.ABSTRACT) || instance.parent.kind == ElementKind.INTERFACE) { funcRef = module.addFunction( instance.internalName, signature.nativeParams, @@ -1381,7 +1368,6 @@ export class Compiler extends DiagnosticEmitter { null, module.unreachable() ); - this.virtualCalls.add(instance); } else { this.error( DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration, @@ -1400,8 +1386,8 @@ export class Compiler extends DiagnosticEmitter { /** Function to compile. */ instance: Function, /** Target array of statements also being returned. Creates a new array if omitted. */ - stmts: ExpressionRef[] | null = null - ): ExpressionRef[] { + stmts: ExpressionRef[] + ): bool { var module = this.module; var bodyNode = assert(instance.prototype.bodyNode); var returnType = instance.signature.returnType; @@ -1498,9 +1484,10 @@ export class Compiler extends DiagnosticEmitter { DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value, instance.prototype.functionTypeNode.returnType.range ); + return false; // not recoverable } - return stmts; + return true; } // === Classes ================================================================================== @@ -1850,18 +1837,14 @@ export class Compiler extends DiagnosticEmitter { /** Ensures that a table entry exists for the specified function and returns its index. */ ensureFunctionTableEntry(instance: Function): i32 { - assert(instance.is(CommonFlags.COMPILED)); + assert(instance.is(CommonFlags.COMPILED) && !instance.is(CommonFlags.STUB)); var index = instance.functionTableIndex; if (index >= 0) return index; var functionTable = this.functionTable; var tableBase = this.options.tableBase; if (!tableBase) tableBase = 1; // leave first elem blank index = tableBase + functionTable.length; - if (!instance.is(CommonFlags.TRAMPOLINE) && instance.signature.requiredParameters < instance.signature.parameterTypes.length) { - // insert the trampoline if the function has optional parameters - instance = this.ensureTrampoline(instance); - } - functionTable.push(instance.internalName); + functionTable.push(instance); instance.functionTableIndex = index; return index; } @@ -6000,9 +5983,9 @@ export class Compiler extends DiagnosticEmitter { } case ElementKind.PROPERTY: { // instance property let propertyInstance = target; - assert(propertyInstance.parent.kind == ElementKind.CLASS); - let classInstance = propertyInstance.parent; - assert(classInstance.kind == ElementKind.CLASS); + let propertyInstanceParent = propertyInstance.parent; + assert(propertyInstanceParent.kind == ElementKind.CLASS || propertyInstanceParent.kind == ElementKind.INTERFACE); + let classInstance = propertyInstanceParent; let setterInstance = propertyInstance.setterInstance; if (!setterInstance) { this.error( @@ -6681,7 +6664,7 @@ export class Compiler extends DiagnosticEmitter { // Inline if explicitly requested if (instance.hasDecorator(DecoratorFlags.INLINE)) { - assert(!instance.is(CommonFlags.TRAMPOLINE)); // doesn't make sense + assert(!instance.is(CommonFlags.STUB)); // doesn't make sense let inlineStack = this.inlineStack; if (inlineStack.includes(instance)) { this.warning( @@ -6752,9 +6735,8 @@ export class Compiler extends DiagnosticEmitter { thisArg: ExpressionRef = 0, immediatelyDropped: bool = false ): ExpressionRef { - if (instance.is(CommonFlags.VIRTUAL)) { - this.virtualCalls.add(instance); - } + assert(!instance.is(CommonFlags.VIRTUAL)); + var module = this.module; var numArguments = operands ? operands.length : 0; var signature = instance.signature; @@ -6852,24 +6834,37 @@ export class Compiler extends DiagnosticEmitter { return expr; } - /** Gets the trampoline for the specified function. */ - ensureTrampoline(original: Function): Function { - // A trampoline is a function that takes a fixed amount of operands with some of them possibly - // being zeroed. It takes one additional argument denoting the number of actual operands - // provided to the call, and takes appropriate steps to initialize zeroed operands to their - // default values using the optional parameter initializers of the original function. Doing so - // allows calls to functions with optional parameters to circumvent the trampoline when all - // parameters are provided as a fast route, respectively setting up omitted operands in a proper - // context otherwise. - var trampoline = original.trampoline; - if (trampoline) return trampoline; + /** Makes sure that the arguments length helper global is present. */ + ensureArgumentsLength(): void { + if (!this.builtinArgumentsLength) { + let module = this.module; + this.builtinArgumentsLength = module.addGlobal(BuiltinNames.argumentsLength, NativeType.I32, true, module.i32(0)); + // TODO: Enable this once mutable globals are the default nearly everywhere. + // if (this.options.hasFeature(Feature.MUTABLE_GLOBALS)) { + // module.addGlobalExport(BuiltinNames.argumentsLength, ExportNames.argumentsLength); + // } else { + module.addFunction(BuiltinNames.setArgumentsLength, NativeType.I32, NativeType.None, null, + module.global_set(BuiltinNames.argumentsLength, module.local_get(0, NativeType.I32)) + ); + module.addFunctionExport(BuiltinNames.setArgumentsLength, ExportNames.setArgumentsLength); + // } + } + } + + /** Ensures compilation of the varargs stub for the specified function. */ + ensureVarargsStub(original: Function): Function { + // A varargs stub is a function called with omitted arguments being zeroed, + // reading the `argumentsLength` helper global to decide which initializers + // to inject before calling the original function. It is typically attempted + // to circumvent the varargs stub where possible, for example where omitted + // arguments are constants and can be inlined into the original call. + var stub = original.varargsStub; + if (stub) return stub; var originalSignature = original.signature; - var originalName = original.internalName; var originalParameterTypes = originalSignature.parameterTypes; var originalParameterDeclarations = original.prototype.functionTypeNode.parameters; var returnType = originalSignature.returnType; - var thisType = originalSignature.thisType; var isInstance = original.is(CommonFlags.INSTANCE); // arguments excl. `this`, operands incl. `this` @@ -6899,23 +6894,15 @@ export class Compiler extends DiagnosticEmitter { } assert(operandIndex == minOperands); - // create the trampoline element - var trampolineSignature = new Signature(this.program, originalParameterTypes, returnType, thisType); - trampolineSignature.requiredParameters = maxArguments; - trampolineSignature.parameterNames = originalSignature.parameterNames; - trampoline = new Function( - original.name + "|trampoline", - original.prototype, - trampolineSignature, - original.contextualTypeArguments - ); - trampoline.set(original.flags | CommonFlags.TRAMPOLINE | CommonFlags.COMPILED); - original.trampoline = trampoline; + // create the varargs stub + stub = original.newStub("varargs"); + stub.signature.requiredParameters = maxArguments; + original.varargsStub = stub; - // compile initializers of omitted arguments in scope of the trampoline function - // this is necessary because initializers might need additional locals and a proper this context + // compile initializers of omitted arguments in the scope of the stub, + // accounting for additional locals and a proper `this` context. var previousFlow = this.currentFlow; - var flow = trampoline.flow; + var flow = stub.flow; this.currentFlow = flow; // create a br_table switching over the number of optional parameters provided @@ -6970,7 +6957,7 @@ export class Compiler extends DiagnosticEmitter { assert(operandIndex == maxOperands); var stmts: ExpressionRef[] = [ body ]; - var theCall = module.call(originalName, forwardedOperands, returnType.toNativeType()); + var theCall = module.call(original.internalName, forwardedOperands, returnType.toNativeType()); if (returnType != Type.void) { this.performAutoreleasesWithValue(flow, theCall, returnType, stmts); } else { @@ -6981,31 +6968,204 @@ export class Compiler extends DiagnosticEmitter { this.currentFlow = previousFlow; var funcRef = module.addFunction( - trampoline.internalName, - trampolineSignature.nativeParams, - trampolineSignature.nativeResults, - typesToNativeTypes(trampoline.additionalLocals), + stub.internalName, + stub.signature.nativeParams, + stub.signature.nativeResults, + typesToNativeTypes(stub.additionalLocals), module.flatten(stmts, returnType.toNativeType()) ); - trampoline.finalize(module, funcRef); - return trampoline; + stub.set(CommonFlags.COMPILED); + stub.finalize(module, funcRef); + return stub; } - /** Makes sure that the arguments length helper global is present. */ - ensureBuiltinArgumentsLength(): void { - if (!this.builtinArgumentsLength) { - let module = this.module; - this.builtinArgumentsLength = module.addGlobal(BuiltinNames.argumentsLength, NativeType.I32, true, module.i32(0)); - // TODO: Enable this once mutable globals are the default nearly everywhere. - // if (this.options.hasFeature(Feature.MUTABLE_GLOBALS)) { - // module.addGlobalExport(BuiltinNames.argumentsLength, ExportNames.argumentsLength); - // } else { - module.addFunction(BuiltinNames.setArgumentsLength, NativeType.I32, NativeType.None, null, - module.global_set(BuiltinNames.argumentsLength, module.local_get(0, NativeType.I32)) - ); - module.addFunctionExport(BuiltinNames.setArgumentsLength, ExportNames.setArgumentsLength); - // } + /** Ensures compilation of the virtual stub for the specified function. */ + ensureVirtualStub(original: Function): Function { + // A virtual stub is a function redirecting virtual calls to the actual + // overload targeted by the call. It utilizes varargs stubs where necessary + // and as such has the same semantics as one. Here, we only make sure that + // a placeholder exist, with actual code being generated as a finalization + // step once module compilation is otherwise complete. + var stub = original.virtualStub; + if (stub) return stub; + stub = original.newStub("virtual"); + original.virtualStub = stub; + var module = this.module; + stub.ref = module.addFunction( + stub.internalName, + stub.signature.nativeParams, + stub.signature.nativeResults, + null, + module.unreachable() + ); + this.virtualCalls.add(original); + return stub; + } + + /** Finalizes the virtual stub of the specified function. */ + private finalizeVirtualStub(instance: Function): void { + var stub = this.ensureVirtualStub(instance); + if (stub.is(CommonFlags.COMPILED)) return; + + // Wouldn't be here if there wasn't at least one overload + var overloadPrototypes = assert(instance.prototype.overloads); + + var module = this.module; + var usizeType = this.options.usizeType; + var nativeSizeType = usizeType.toNativeType(); + var parameterTypes = instance.signature.parameterTypes; + var returnType = instance.signature.returnType; + var numParameters = parameterTypes.length; + var tempIndex = 1 + parameterTypes.length; // incl. `this` + + // Switch over this's rtId and map it to the respective overload + var builder = new SwitchBuilder(this.module, + module.load(4, false, + module.binary( + nativeSizeType == NativeType.I64 + ? BinaryOp.SubI64 + : BinaryOp.SubI32, + module.local_get(0, nativeSizeType), + nativeSizeType == NativeType.I64 + ? module.i64(8) // rtId offset = -8 + : module.i32(8) + ), + NativeType.I32 + ) + ); + + // A method's `overloads` property contains its unbound overload prototypes + // so we first have to find the concrete classes it became bound to, obtain + // their bound prototypes and make sure these are resolved and compiled as + // we are going to call them conditionally based on this's class id. + for (let _values = Set_values(overloadPrototypes), i = 0, k = _values.length; i < k; ++i) { + let unboundOverloadPrototype = _values[i]; + assert(!unboundOverloadPrototype.isBound); + let unboundOverloadParent = unboundOverloadPrototype.parent; + let isProperty = unboundOverloadParent.kind == ElementKind.PROPERTY_PROTOTYPE; + let classInstances: Map | null; + if (isProperty) { + let propertyParent = (unboundOverloadParent).parent; + assert(propertyParent.kind == ElementKind.CLASS_PROTOTYPE); + classInstances = (propertyParent).instances; + } else { + assert(unboundOverloadParent.kind == ElementKind.CLASS_PROTOTYPE); + classInstances = (unboundOverloadParent).instances; + } + if (classInstances) { + for (let _values = Map_values(classInstances), j = 0, l = _values.length; j < l; ++j) { + let classInstance = _values[j]; + let overloadInstance: Function | null; + if (isProperty) { + let boundProperty = assert(classInstance.members!.get(unboundOverloadParent.name)); + assert(boundProperty.kind == ElementKind.PROPERTY); + if (instance.is(CommonFlags.GET)) { + overloadInstance = (boundProperty).getterInstance; + } else { + assert(instance.is(CommonFlags.SET)); + overloadInstance = (boundProperty).setterInstance; + } + } else { + let boundPrototype = assert(classInstance.members!.get(unboundOverloadPrototype.name)); + assert(boundPrototype.kind == ElementKind.FUNCTION_PROTOTYPE); + overloadInstance = this.resolver.resolveFunction(boundPrototype, instance.typeArguments); + } + if (!overloadInstance || !this.compileFunction(overloadInstance)) continue; + let overloadType = overloadInstance.type; + let originalType = instance.type; + if (!overloadType.isAssignableTo(originalType)) { + this.error( + DiagnosticCode.Type_0_is_not_assignable_to_type_1, + overloadInstance.identifierNode.range, overloadType.toString(), originalType.toString() + ); + continue; + } + // TODO: additional optional parameters are not permitted by `isAssignableTo` yet + let overloadSignature = overloadInstance.signature; + let overloadParameterTypes = overloadSignature.parameterTypes; + let overloadNumParameters = overloadParameterTypes.length; + let paramExprs = new Array(1 + overloadNumParameters); + paramExprs[0] = module.local_get(0, nativeSizeType); // this + for (let n = 0; n < numParameters; ++n) { + paramExprs[1 + n] = module.local_get(1 + n, parameterTypes[n].toNativeType()); + } + let needsVarargsStub = false; + for (let n = numParameters; n < overloadNumParameters; ++n) { + // TODO: inline constant initializers and skip varargs stub + paramExprs[1 + n] = this.makeZero(overloadParameterTypes[n]); + needsVarargsStub = true; + } + let calledName = needsVarargsStub + ? this.ensureVarargsStub(overloadInstance).internalName + : overloadInstance.internalName; + let nativeReturnType = overloadSignature.returnType.toNativeType(); + let stmts = new Array(); + if (needsVarargsStub) { + this.ensureArgumentsLength(); + // Safe to prepend since paramExprs are local.get's + stmts.push(module.global_set(BuiltinNames.argumentsLength, module.i32(numParameters))); + } + if (returnType == Type.void) { + stmts.push( + module.call(calledName, paramExprs, nativeReturnType) + ); + stmts.push( + module.return() + ); + } else { + stmts.push( + module.return( + module.call(calledName, paramExprs, nativeReturnType) + ) + ); + } + builder.addCase(classInstance.id, stmts); + // Also alias each extendee inheriting this exact overload + let extendees = classInstance.getAllExtendees( + isProperty + ? unboundOverloadParent.name + : instance.prototype.name + ); + for (let _values = Set_values(extendees), a = 0, b = _values.length; a < b; ++a) { + let extendee = _values[a]; + builder.addCase(extendee.id, stmts); + } + } + } } + + // Call the original function if no other id matches and the method is not + // abstract or part of an interface. Note that doing so will not catch an + // invalid id, but can reduce code size significantly since we also don't + // have to add branches for extendees inheriting the original function. + var body: ExpressionRef; + if (instance.prototype.bodyNode) { + let paramExprs = new Array(numParameters); + paramExprs[0] = module.local_get(0, nativeSizeType); // this + for (let i = 0, k = parameterTypes.length; i < k; ++i) { + paramExprs[1 + i] = module.local_get(1 + i, parameterTypes[i].toNativeType()); + } + body = module.call(instance.internalName, paramExprs, returnType.toNativeType()); + + // Otherwise trap + } else { + body = module.unreachable(); + } + + // Create the virtual stub function + var ref = stub.ref; + if (ref) module.removeFunction(stub.internalName); + stub.ref = module.addFunction( + stub.internalName, + stub.signature.nativeParams, + stub.signature.nativeResults, + [ NativeType.I32 ], + module.block(null, [ + builder.render(tempIndex), + body + ], returnType.toNativeType()) + ); + stub.set(CommonFlags.COMPILED); } // @@ -7314,44 +7474,50 @@ export class Compiler extends DiagnosticEmitter { /** Skip the usual autorelease and manage this at the callsite instead. */ skipAutorelease: bool = false ): ExpressionRef { - if (instance.is(CommonFlags.VIRTUAL)) { - this.virtualCalls.add(instance); - } if (instance.hasDecorator(DecoratorFlags.INLINE)) { - assert(!instance.is(CommonFlags.TRAMPOLINE)); // doesn't make sense - let inlineStack = this.inlineStack; - if (inlineStack.includes(instance)) { - this.warning( - DiagnosticCode.Function_0_cannot_be_inlined_into_itself, - reportNode.range, instance.internalName - ); - } else { - inlineStack.push(instance); - let expr: ExpressionRef; - if (instance.is(CommonFlags.INSTANCE)) { - let theOperands = assert(operands); - assert(theOperands.length); - expr = this.makeCallInline(instance, theOperands.slice(1), theOperands[0], immediatelyDropped); + if (!instance.is(CommonFlags.VIRTUAL)) { + assert(!instance.is(CommonFlags.STUB)); // doesn't make sense + let inlineStack = this.inlineStack; + if (inlineStack.includes(instance)) { + this.warning( + DiagnosticCode.Function_0_cannot_be_inlined_into_itself, + reportNode.range, instance.internalName + ); } else { - expr = this.makeCallInline(instance, operands, 0, immediatelyDropped); - } - let returnType = this.currentType; - if (returnType.isManaged) { - if (!skipAutorelease) { - expr = this.makeAutorelease(expr, returnType); + inlineStack.push(instance); + let expr: ExpressionRef; + if (instance.is(CommonFlags.INSTANCE)) { + let theOperands = assert(operands); + assert(theOperands.length); + expr = this.makeCallInline(instance, theOperands.slice(1), theOperands[0], immediatelyDropped); } else { - this.skippedAutoreleases.add(expr); + expr = this.makeCallInline(instance, operands, 0, immediatelyDropped); } + let returnType = this.currentType; + if (returnType.isManaged) { + if (!skipAutorelease) { + expr = this.makeAutorelease(expr, returnType); + } else { + this.skippedAutoreleases.add(expr); + } + } + inlineStack.pop(); + return expr; } - inlineStack.pop(); - return expr; + } else { + this.warning( + DiagnosticCode.Function_0_is_virtual_and_will_not_be_inlined, + reportNode.range, instance.internalName + ); } } + var module = this.module; var numOperands = operands ? operands.length : 0; var numArguments = numOperands; var minArguments = instance.signature.requiredParameters; var minOperands = minArguments; - var maxArguments = instance.signature.parameterTypes.length; + var parameterTypes = instance.signature.parameterTypes; + var maxArguments = parameterTypes.length; var maxOperands = maxArguments; if (instance.is(CommonFlags.INSTANCE)) { ++minOperands; @@ -7360,10 +7526,8 @@ export class Compiler extends DiagnosticEmitter { } assert(numOperands >= minOperands); - var module = this.module; if (!this.compileFunction(instance)) return module.unreachable(); var returnType = instance.signature.returnType; - var isCallImport = instance.is(CommonFlags.MODULE_IMPORT); // fill up omitted arguments with their initializers, if constant, otherwise with zeroes. if (numOperands < maxOperands) { @@ -7371,7 +7535,6 @@ export class Compiler extends DiagnosticEmitter { operands = new Array(maxOperands); operands.length = 0; } - let parameterTypes = instance.signature.parameterTypes; let parameterNodes = instance.prototype.functionTypeNode.parameters; assert(parameterNodes.length == parameterTypes.length); let allOptionalsAreConstant = true; @@ -7412,12 +7575,21 @@ export class Compiler extends DiagnosticEmitter { allOptionalsAreConstant = false; } if (!allOptionalsAreConstant) { - if (!isCallImport) { + if (!instance.is(CommonFlags.MODULE_IMPORT)) { let original = instance; - instance = this.ensureTrampoline(instance); + instance = this.ensureVarargsStub(instance); if (!this.compileFunction(instance)) return module.unreachable(); instance.flow.flags = original.flow.flags; let nativeReturnType = returnType.toNativeType(); + // We know the last operand is optional and omitted, so inject setting + // ~argumentsLength into that operand, which is always safe. + let lastOperand = operands[maxOperands - 1]; + assert(!(getSideEffects(lastOperand) & SideEffects.WritesGlobal)); + let lastOperandType = parameterTypes[maxArguments - 1]; + operands[maxOperands - 1] = module.block(null, [ + module.global_set(BuiltinNames.argumentsLength, module.i32(numArguments)), + lastOperand + ], lastOperandType.toNativeType()); let expr = module.call(instance.internalName, operands, nativeReturnType); this.currentType = returnType; if (returnType.isManaged) { @@ -7430,15 +7602,17 @@ export class Compiler extends DiagnosticEmitter { this.skippedAutoreleases.add(expr); } } - this.ensureBuiltinArgumentsLength(); - return module.block(null, [ - module.global_set(BuiltinNames.argumentsLength, module.i32(numArguments)), - expr - ], this.currentType.toNativeType()); + this.ensureArgumentsLength(); + return expr; } } } + // Call the virtual stub with the vtable if the function has overloads + if (instance.is(CommonFlags.VIRTUAL) && !reportNode.isCallOnSuper) { + instance = this.ensureVirtualStub(instance); + } + // If the return value is of a reference type it has not yet been released but is in flight // which is equivalent to a skipped autorelease. Hence, insert either a release if it is // dropped anyway, preserve the skipped autorelease if explicitly requested or autorelease now. @@ -7499,11 +7673,14 @@ export class Compiler extends DiagnosticEmitter { operands: ExpressionRef[] | null = null, immediatelyDropped: bool = false ): ExpressionRef { + var module = this.module; var numOperands = operands ? operands.length : 0; var numArguments = numOperands; var minArguments = signature.requiredParameters; var minOperands = minArguments; - var maxArguments = signature.parameterTypes.length; + var parameterTypes = signature.parameterTypes; + var returnType = signature.returnType; + var maxArguments = parameterTypes.length; var maxOperands = maxArguments; if (signature.thisType) { ++minOperands; @@ -7512,8 +7689,6 @@ export class Compiler extends DiagnosticEmitter { } assert(numOperands >= minOperands); - var module = this.module; - // fill up omitted arguments with zeroes if (numOperands < maxOperands) { if (!operands) { @@ -7526,21 +7701,35 @@ export class Compiler extends DiagnosticEmitter { } } - var returnType = signature.returnType; - this.ensureBuiltinArgumentsLength(); - var expr = module.block(null, [ - module.global_set(BuiltinNames.argumentsLength, // might be calling a trampoline - module.i32(numArguments) - ), - module.call_indirect( - this.options.isWasm64 - ? module.unary(UnaryOp.WrapI64, indexArg) - : indexArg, - operands, - signature.nativeParams, - signature.nativeResults - ) - ], returnType.toNativeType()); + if (this.options.isWasm64) { + indexArg = module.unary(UnaryOp.WrapI64, indexArg); + } + + // We might be calling a varargs stub here, even if all operands have been + // provided, so we must set `argumentsLength` in any case. Inject setting it + // into the index argument, which becomes executed last after any operands. + this.ensureArgumentsLength(); + if (getSideEffects(indexArg) & SideEffects.WritesGlobal) { + let flow = this.currentFlow; + let temp = flow.getTempLocal(Type.i32, findUsedLocals(indexArg)); + indexArg = module.block(null, [ + module.local_set(temp.index, indexArg), + module.global_set(BuiltinNames.argumentsLength, module.i32(numArguments)), + module.local_get(temp.index, NativeType.I32) + ], NativeType.I32); + flow.freeTempLocal(temp); + } else { // simplify + indexArg = module.block(null, [ + module.global_set(BuiltinNames.argumentsLength, module.i32(numArguments)), + indexArg + ], NativeType.I32); + } + var expr = module.call_indirect( + indexArg, + operands, + signature.nativeParams, + signature.nativeResults + ); this.currentType = returnType; if (returnType.isManaged) { if (immediatelyDropped) { @@ -7723,6 +7912,7 @@ export class Compiler extends DiagnosticEmitter { instance = new Function( prototype.name, prototype, + null, signature, contextualTypeArguments ); @@ -8806,6 +8996,13 @@ export class Compiler extends DiagnosticEmitter { ); return this.module.unreachable(); } + if (target.is(CommonFlags.ABSTRACT)) { + this.error( + DiagnosticCode.Cannot_create_an_instance_of_an_abstract_class, + expression.typeName.range + ); + return this.module.unreachable(); + } var classPrototype = target; var classInstance: Class | null = null; var typeArguments = expression.typeArguments; @@ -8856,6 +9053,7 @@ export class Compiler extends DiagnosticEmitter { // declaration is important, i.e. to access optional parameter initializers (baseCtor.declaration).clone() ), + null, baseCtor.signature, contextualTypeArguments ); @@ -8871,6 +9069,7 @@ export class Compiler extends DiagnosticEmitter { CommonFlags.INSTANCE | CommonFlags.CONSTRUCTOR ) ), + null, new Signature(this.program, null, classInstance.type, classInstance.type), contextualTypeArguments ); diff --git a/src/diagnosticMessages.generated.ts b/src/diagnosticMessages.generated.ts index f200aa87ab..c8dbb17972 100644 --- a/src/diagnosticMessages.generated.ts +++ b/src/diagnosticMessages.generated.ts @@ -41,6 +41,9 @@ export enum DiagnosticCode { Expression_cannot_be_represented_by_a_type = 225, Expression_resolves_to_unusual_type_0 = 226, Array_literal_expected = 227, + Function_0_is_virtual_and_will_not_be_inlined = 228, + Property_0_only_has_a_setter_and_is_missing_a_getter = 229, + _0_keyword_cannot_be_used_here = 230, Type_0_is_cyclic_Module_will_include_deferred_garbage_collection = 900, Importing_the_table_disables_some_indirect_call_optimizations = 901, Exporting_the_table_disables_some_indirect_call_optimizations = 902, @@ -108,6 +111,7 @@ export enum DiagnosticCode { Duplicate_identifier_0 = 2300, Cannot_find_name_0 = 2304, Module_0_has_no_exported_member_1 = 2305, + An_interface_can_only_extend_an_interface = 2312, Generic_type_0_requires_1_type_argument_s = 2314, Type_0_is_not_generic = 2315, Type_0_is_not_assignable_to_type_1 = 2322, @@ -125,12 +129,16 @@ export enum DiagnosticCode { Operator_0_cannot_be_applied_to_types_1_and_2 = 2365, A_super_call_must_be_the_first_statement_in_the_constructor = 2376, Constructors_for_derived_classes_must_contain_a_super_call = 2377, + Getter_and_setter_accessors_do_not_agree_in_visibility = 2379, _get_and_set_accessor_must_have_the_same_type = 2380, + Overload_signatures_must_all_be_public_private_or_protected = 2385, Constructor_implementation_is_missing = 2390, Function_implementation_is_missing_or_not_immediately_following_the_declaration = 2391, Multiple_constructor_implementations_are_not_allowed = 2392, Duplicate_function_implementation = 2393, + This_overload_signature_is_not_compatible_with_its_implementation_signature = 2394, Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = 2395, + A_class_can_only_implement_an_interface = 2422, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged = 2434, Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses = 2445, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly = 2453, @@ -140,6 +148,7 @@ export enum DiagnosticCode { Export_declaration_conflicts_with_exported_declaration_of_0 = 2484, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression = 2506, Cannot_create_an_instance_of_an_abstract_class = 2511, + Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_2 = 2515, Object_is_possibly_null = 2531, Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property = 2540, The_target_of_an_assignment_must_be_a_variable_or_a_property_access = 2541, @@ -200,6 +209,9 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 225: return "Expression cannot be represented by a type."; case 226: return "Expression resolves to unusual type '{0}'."; case 227: return "Array literal expected."; + case 228: return "Function '{0}' is virtual and will not be inlined."; + case 229: return "Property '{0}' only has a setter and is missing a getter."; + case 230: return "'{0}' keyword cannot be used here."; case 900: return "Type '{0}' is cyclic. Module will include deferred garbage collection."; case 901: return "Importing the table disables some indirect call optimizations."; case 902: return "Exporting the table disables some indirect call optimizations."; @@ -267,6 +279,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2300: return "Duplicate identifier '{0}'."; case 2304: return "Cannot find name '{0}'."; case 2305: return "Module '{0}' has no exported member '{1}'."; + case 2312: return "An interface can only extend an interface."; case 2314: return "Generic type '{0}' requires {1} type argument(s)."; case 2315: return "Type '{0}' is not generic."; case 2322: return "Type '{0}' is not assignable to type '{1}'."; @@ -284,12 +297,16 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2365: return "Operator '{0}' cannot be applied to types '{1}' and '{2}'."; case 2376: return "A 'super' call must be the first statement in the constructor."; case 2377: return "Constructors for derived classes must contain a 'super' call."; + case 2379: return "Getter and setter accessors do not agree in visibility."; case 2380: return "'get' and 'set' accessor must have the same type."; + case 2385: return "Overload signatures must all be public, private or protected."; case 2390: return "Constructor implementation is missing."; case 2391: return "Function implementation is missing or not immediately following the declaration."; case 2392: return "Multiple constructor implementations are not allowed."; case 2393: return "Duplicate function implementation."; + case 2394: return "This overload signature is not compatible with its implementation signature."; case 2395: return "Individual declarations in merged declaration '{0}' must be all exported or all local."; + case 2422: return "A class can only implement an interface."; case 2434: return "A namespace declaration cannot be located prior to a class or function with which it is merged."; case 2445: return "Property '{0}' is protected and only accessible within class '{1}' and its subclasses."; case 2453: return "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly."; @@ -299,6 +316,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2484: return "Export declaration conflicts with exported declaration of '{0}'."; case 2506: return "'{0}' is referenced directly or indirectly in its own base expression."; case 2511: return "Cannot create an instance of an abstract class."; + case 2515: return "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from '{2}'."; case 2531: return "Object is possibly 'null'."; case 2540: return "Cannot assign to '{0}' because it is a constant or a read-only property."; case 2541: return "The target of an assignment must be a variable or a property access."; diff --git a/src/diagnosticMessages.json b/src/diagnosticMessages.json index 9d78c62032..1034236f10 100644 --- a/src/diagnosticMessages.json +++ b/src/diagnosticMessages.json @@ -34,6 +34,9 @@ "Expression cannot be represented by a type.": 225, "Expression resolves to unusual type '{0}'.": 226, "Array literal expected.": 227, + "Function '{0}' is virtual and will not be inlined.": 228, + "Property '{0}' only has a setter and is missing a getter.": 229, + "'{0}' keyword cannot be used here.": 230, "Type '{0}' is cyclic. Module will include deferred garbage collection.": 900, "Importing the table disables some indirect call optimizations.": 901, @@ -104,6 +107,7 @@ "Duplicate identifier '{0}'.": 2300, "Cannot find name '{0}'.": 2304, "Module '{0}' has no exported member '{1}'.": 2305, + "An interface can only extend an interface.": 2312, "Generic type '{0}' requires {1} type argument(s).": 2314, "Type '{0}' is not generic.": 2315, "Type '{0}' is not assignable to type '{1}'.": 2322, @@ -121,12 +125,16 @@ "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": 2365, "A 'super' call must be the first statement in the constructor.": 2376, "Constructors for derived classes must contain a 'super' call.": 2377, + "Getter and setter accessors do not agree in visibility.": 2379, "'get' and 'set' accessor must have the same type.": 2380, + "Overload signatures must all be public, private or protected.": 2385, "Constructor implementation is missing.": 2390, "Function implementation is missing or not immediately following the declaration.": 2391, "Multiple constructor implementations are not allowed.": 2392, "Duplicate function implementation.": 2393, + "This overload signature is not compatible with its implementation signature.": 2394, "Individual declarations in merged declaration '{0}' must be all exported or all local.": 2395, + "A class can only implement an interface.": 2422, "A namespace declaration cannot be located prior to a class or function with which it is merged.": 2434, "Property '{0}' is protected and only accessible within class '{1}' and its subclasses.": 2445, "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.": 2453, @@ -136,6 +144,7 @@ "Export declaration conflicts with exported declaration of '{0}'.": 2484, "'{0}' is referenced directly or indirectly in its own base expression.": 2506, "Cannot create an instance of an abstract class.": 2511, + "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from '{2}'.": 2515, "Object is possibly 'null'.": 2531, "Cannot assign to '{0}' because it is a constant or a read-only property.": 2540, "The target of an assignment must be a variable or a property access.": 2541, diff --git a/src/diagnostics.ts b/src/diagnostics.ts index 9b0a393971..f32723fba3 100644 --- a/src/diagnostics.ts +++ b/src/diagnostics.ts @@ -88,7 +88,7 @@ export class DiagnosticMessage { /** Respective source range, if any. */ range: Range | null = null; /** Related range, if any. */ - relatedRange: Range | null = null; + relatedRange: Range | null = null; // TODO: Make this a related message for chains? /** Constructs a new diagnostic message. */ private constructor(code: i32, category: DiagnosticCategory, message: string) { @@ -112,6 +112,26 @@ export class DiagnosticMessage { return new DiagnosticMessage(code, category, message); } + /** Tests if this message equals the specified. */ + equals(other: DiagnosticMessage): bool { + if (this.code != other.code) return false; + var thisRange = this.range; + var otherRange = other.range; + if (thisRange) { + if (!otherRange || !thisRange.equals(otherRange)) return false; + } else if (otherRange) { + return false; + } + var thisRelatedRange = this.relatedRange; + var otherRelatedRange = other.relatedRange; + if (thisRelatedRange) { + if (!otherRelatedRange || !thisRelatedRange.equals(otherRelatedRange)) return false; + } else if (otherRange) { + return false; + } + return this.message == other.message; + } + /** Adds a source range to this message. */ withRange(range: Range): this { this.range = range; @@ -137,10 +157,13 @@ export class DiagnosticMessage { this.message + "\" in " + source.normalizedPath + - ":" + + "(" + source.lineAt(range.start).toString() + - ":" + - source.columnAt().toString() + "," + + source.columnAt().toString() + + "+" + + (range.end - range.start).toString() + + ")" ); } return ( @@ -248,7 +271,7 @@ export abstract class DiagnosticEmitter { /** Diagnostic messages emitted so far. */ diagnostics: DiagnosticMessage[]; /** Diagnostic messages already seen, by range. */ - private seen: Map> = new Map(); + private seen: Map> = new Map(); /** Initializes this diagnostic emitter. */ protected constructor(diagnostics: DiagnosticMessage[] | null = null) { @@ -265,6 +288,9 @@ export abstract class DiagnosticEmitter { arg1: string | null = null, arg2: string | null = null ): void { + var message = DiagnosticMessage.create(code, category, arg0, arg1, arg2); + if (range) message = message.withRange(range); + if (relatedRange) message.relatedRange = relatedRange; // It is possible that the same diagnostic is emitted twice, for example // when compiling generics with different types or when recompiling a loop // because our initial assumptions didn't hold. It is even possible to get @@ -274,21 +300,20 @@ export abstract class DiagnosticEmitter { if (seen.has(range.source)) { let seenInSource = assert(seen.get(range.source)); if (seenInSource.has(range.start)) { - let seenCodesAtPos = assert(seenInSource.get(range.start)); - if (seenCodesAtPos.includes(code)) return; - seenCodesAtPos.push(code); + let seenMessagesAtPos = assert(seenInSource.get(range.start)); + for (let i = 0, k = seenMessagesAtPos.length; i < k; ++i) { + if (seenMessagesAtPos[i].equals(message)) return; + } + seenMessagesAtPos.push(message); } else { - seenInSource.set(range.start, [ code ]); + seenInSource.set(range.start, [ message ]); } } else { - let seenInSource = new Map(); - seenInSource.set(range.start, [ code ]); + let seenInSource = new Map(); + seenInSource.set(range.start, [ message ]); seen.set(range.source, seenInSource); } } - var message = DiagnosticMessage.create(code, category, arg0, arg1, arg2); - if (range) message = message.withRange(range); - if (relatedRange) message.relatedRange = relatedRange; this.diagnostics.push(message); // console.log(formatDiagnosticMessage(message, true, true) + "\n"); // temporary // console.log(new Error("stack").stack); diff --git a/src/index.ts b/src/index.ts index cb191ae928..4fe1195880 100644 --- a/src/index.ts +++ b/src/index.ts @@ -222,8 +222,8 @@ export function getDependee(program: Program, file: string): string | null { // Compiler /** Initializes the program pre-emptively for transform hooks. */ -export function initializeProgram(program: Program, options: Options): void { - program.initialize(options); +export function initializeProgram(program: Program): void { + program.initialize(); } /** Compiles the parsed sources to a module. */ diff --git a/src/module.ts b/src/module.ts index aa63cb31e6..911a4a0d6e 100644 --- a/src/module.ts +++ b/src/module.ts @@ -2046,14 +2046,13 @@ export function getFunctionResults(func: FunctionRef): NativeType { return binaryen._BinaryenFunctionGetResults(func); } -export function getFunctionVars(func: FunctionRef): NativeType { - // TODO: unify this on Binaryen's side? +export function getFunctionVars(func: FunctionRef): NativeType[] { var count = binaryen._BinaryenFunctionGetNumVars(func); var types = new Array(count); for (let i: Index = 0; i < count; ++i) { types[i] = binaryen._BinaryenFunctionGetVar(func, i); } - return createType(types); + return types; } // globals @@ -2139,6 +2138,96 @@ export class Relooper { } } +/** Builds a switch using a sequence of `br_if`s. */ +export class SwitchBuilder { + // This is useful because Binaryen understands sequences of `br_if`s and + // knows how to make a `br_table` from such a sequence if switched over + // values are considered dense enough, respectively a size-efficient sequence + // of `if`s if not, depending on optimization levels. + + private module: Module; + private condition: ExpressionRef; + private values: i32[] = new Array(); + private indexes: i32[] = new Array(); + private cases: ExpressionRef[][] = new Array(); + private defaultIndex: i32 = -1; + + /** Creates a new builder using the specified i32 condition. */ + constructor(module: Module, condition: ExpressionRef) { + this.module = module; + this.condition = condition; + } + + /** Links a case to the specified branch. */ + addCase(value: i32, code: ExpressionRef[]): void { + var cases = this.cases; + var index = cases.indexOf(code); + if (index < 0) { + index = cases.length; + cases.push(code); + } + this.values.push(value); + this.indexes.push(index); + } + + /** Links the default branch. */ + addDefault(code: ExpressionRef[]): void { + assert(this.defaultIndex == -1); + var cases = this.cases; + this.defaultIndex = cases.length; + cases.push(code); + } + + /** Renders the switch to a block. */ + render(localIndex: i32, labelPostfix: string = ""): ExpressionRef { + var module = this.module; + var cases = this.cases; + var numCases = cases.length; + if (!numCases) { + return module.drop(this.condition); + } + var values = this.values; + var numValues = values.length; + var indexes = this.indexes; + var entry = new Array(1 + numValues + 1); + var labels = new Array(numCases); + for (let i = 0; i < numCases; ++i) { + labels[i] = "case" + i.toString() + labelPostfix; + } + entry[0] = module.local_set(localIndex, this.condition); + for (let i = 0; i < numValues; ++i) { + let index = indexes[i]; + entry[1 + i] = module.br(labels[index], + module.binary(BinaryOp.EqI32, + module.local_get(localIndex, NativeType.I32), + module.i32(values[i]) + ) + ); + } + var defaultIndex = this.defaultIndex; + var defaultLabel = "default" + labelPostfix; + entry[1 + numValues] = module.br( + ~defaultIndex + ? labels[defaultIndex] + : defaultLabel + ); + var current = module.block(labels[0], entry); + for (let i = 1; i < numCases; ++i) { + let block = cases[i - 1]; + block.unshift(current); + current = module.block(labels[i], block); + } + var lastCase = cases[numCases - 1]; + lastCase.unshift(current); + return module.block( + ~defaultIndex + ? null + : defaultLabel, + lastCase + ); + } +} + export enum SideEffects { None = 0 /* _BinaryenSideEffectNone */, Branches = 1 /* _BinaryenSideEffectBranches */, diff --git a/src/parser.ts b/src/parser.ts index 182435df0d..a22f41dbc3 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -256,7 +256,21 @@ export class Parser extends DiagnosticEmitter { case Token.ABSTRACT: { let state = tn.mark(); tn.next(); - if (!tn.skip(Token.CLASS)) { + let abstractStart = tn.tokenPos; + let abstractEnd = tn.pos; + let next = tn.peek(true); + if (tn.nextTokenOnNewLine) { + tn.reset(state); + statement = this.parseStatement(tn, true); + break; + } + if (next != Token.CLASS) { + if (next == Token.INTERFACE) { + this.error( + DiagnosticCode._abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration, + tn.range(abstractStart, abstractEnd) + ); + } tn.reset(state); statement = this.parseStatement(tn, true); break; @@ -1809,33 +1823,36 @@ export class Parser extends DiagnosticEmitter { DiagnosticCode._0_modifier_cannot_be_used_here, tn.range(), "public" ); + } else { + flags |= CommonFlags.PUBLIC; + accessStart = tn.tokenPos; + accessEnd = tn.pos; } - flags |= CommonFlags.PUBLIC; - accessStart = tn.tokenPos; - accessEnd = tn.pos; - if (!startPos) startPos = accessStart; + if (!startPos) startPos = tn.tokenPos; } else if (tn.skip(Token.PRIVATE)) { if (isInterface) { this.error( DiagnosticCode._0_modifier_cannot_be_used_here, tn.range(), "private" ); + } else { + flags |= CommonFlags.PRIVATE; + accessStart = tn.tokenPos; + accessEnd = tn.pos; } - flags |= CommonFlags.PRIVATE; - accessStart = tn.tokenPos; - accessEnd = tn.pos; - if (!startPos) startPos = accessStart; + if (!startPos) startPos = tn.tokenPos; } else if (tn.skip(Token.PROTECTED)) { if (isInterface) { this.error( DiagnosticCode._0_modifier_cannot_be_used_here, tn.range(), "protected" ); + } else { + flags |= CommonFlags.PROTECTED; + accessStart = tn.tokenPos; + accessEnd = tn.pos; } - flags |= CommonFlags.PROTECTED; - accessStart = tn.tokenPos; - accessEnd = tn.pos; - if (!startPos) startPos = accessStart; + if (!startPos) startPos = tn.tokenPos; } var staticStart = 0; @@ -1848,24 +1865,26 @@ export class Parser extends DiagnosticEmitter { DiagnosticCode._0_modifier_cannot_be_used_here, tn.range(), "static" ); + } else { + flags |= CommonFlags.STATIC; + staticStart = tn.tokenPos; + staticEnd = tn.pos; } - flags |= CommonFlags.STATIC; - staticStart = tn.tokenPos; - staticEnd = tn.pos; - if (!startPos) startPos = staticStart; + if (!startPos) startPos = tn.tokenPos; } else { flags |= CommonFlags.INSTANCE; if (tn.skip(Token.ABSTRACT)) { - if (isInterface) { + if (isInterface || !parent.is(CommonFlags.ABSTRACT)) { this.error( DiagnosticCode._0_modifier_cannot_be_used_here, tn.range(), "abstract" ); + } else { + flags |= CommonFlags.ABSTRACT; + abstractStart = tn.tokenPos; + abstractEnd = tn.pos; } - flags |= CommonFlags.ABSTRACT; - abstractStart = tn.tokenPos; - abstractEnd = tn.pos; - if (!startPos) startPos = abstractStart; + if (!startPos) startPos = tn.tokenPos; } if (parent.flags & CommonFlags.GENERIC) flags |= CommonFlags.GENERIC_CONTEXT; } @@ -2079,6 +2098,11 @@ export class Parser extends DiagnosticEmitter { name.range ); } + } else if (name.text == "constructor") { + this.error( + DiagnosticCode._0_keyword_cannot_be_used_here, + name.range, "constructor" + ); } let returnType: TypeNode | null = null; @@ -2126,6 +2150,11 @@ export class Parser extends DiagnosticEmitter { DiagnosticCode.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, tn.range(), name.text ); // recoverable + } else if (isInterface) { + this.error( + DiagnosticCode._0_expected, + tn.range(), ";" + ); // recoverable } body = this.parseBlockStatement(tn, false); if (!body) return null; diff --git a/src/program.ts b/src/program.ts index 810b3614dc..648384e01c 100644 --- a/src/program.ts +++ b/src/program.ts @@ -47,6 +47,7 @@ import { INNER_DELIMITER, LIBRARY_SUBST, INDEX_SUFFIX, + STUB_DELIMITER, CommonNames, Feature, Target @@ -110,7 +111,8 @@ import { TypeDeclaration, VariableDeclaration, VariableLikeDeclarationStatement, - VariableStatement + VariableStatement, + ParameterKind } from "./ast"; import { @@ -664,6 +666,7 @@ export class Program extends DiagnosticEmitter { this.makeNativeFunctionDeclaration(name, flags), decoratorFlags ), + null, signature ); } @@ -677,12 +680,11 @@ export class Program extends DiagnosticEmitter { } /** Initializes the program and its elements prior to compilation. */ - initialize(options: Options): void { - // Initialize only once + initialize(): void { if (this.initialized) return; - this.initialized = true; - this.options = options; + + var options = this.options; // register native types this.registerNativeType(CommonNames.i8, Type.i8); @@ -815,7 +817,7 @@ export class Program extends DiagnosticEmitter { break; } case NodeKind.INTERFACEDECLARATION: { - this.initializeInterface(statement, file); + this.initializeInterface(statement, file, queuedExtends); break; } case NodeKind.NAMESPACEDECLARATION: { @@ -980,36 +982,93 @@ export class Program extends DiagnosticEmitter { this.f32ArrayPrototype = this.require(CommonNames.Float32Array, ElementKind.CLASS_PROTOTYPE); this.f64ArrayPrototype = this.require(CommonNames.Float64Array, ElementKind.CLASS_PROTOTYPE); - // resolve base prototypes of derived classes + // resolve prototypes of extended classes or interfaces var resolver = this.resolver; for (let i = 0, k = queuedExtends.length; i < k; ++i) { let thisPrototype = queuedExtends[i]; let extendsNode = assert(thisPrototype.extendsNode); // must be present if in queuedExtends - let baseElement = resolver.resolveTypeName(extendsNode.name, thisPrototype.parent); // reports + let baseElement = resolver.resolveTypeName(extendsNode.name, thisPrototype.parent); if (!baseElement) continue; - if (baseElement.kind == ElementKind.CLASS_PROTOTYPE) { - let basePrototype = baseElement; - if (basePrototype.hasDecorator(DecoratorFlags.SEALED)) { + if (thisPrototype.kind == ElementKind.CLASS_PROTOTYPE) { + if (baseElement.kind == ElementKind.CLASS_PROTOTYPE) { + let basePrototype = baseElement; + if (basePrototype.hasDecorator(DecoratorFlags.SEALED)) { + this.error( + DiagnosticCode.Class_0_is_sealed_and_cannot_be_extended, + extendsNode.range, basePrototype.identifierNode.text + ); + } + if ( + basePrototype.hasDecorator(DecoratorFlags.UNMANAGED) != + thisPrototype.hasDecorator(DecoratorFlags.UNMANAGED) + ) { + this.error( + DiagnosticCode.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa, + Range.join(thisPrototype.identifierNode.range, extendsNode.range) + ); + } + thisPrototype.basePrototype = basePrototype; + } else { this.error( - DiagnosticCode.Class_0_is_sealed_and_cannot_be_extended, - extendsNode.range, basePrototype.identifierNode.text + DiagnosticCode.A_class_may_only_extend_another_class, + extendsNode.range ); } - if ( - basePrototype.hasDecorator(DecoratorFlags.UNMANAGED) != - thisPrototype.hasDecorator(DecoratorFlags.UNMANAGED) - ) { + } else if (thisPrototype.kind == ElementKind.INTERFACE_PROTOTYPE) { + if (baseElement.kind == ElementKind.INTERFACE_PROTOTYPE) { + thisPrototype.basePrototype = baseElement; + } else { this.error( - DiagnosticCode.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa, - Range.join(thisPrototype.identifierNode.range, extendsNode.range) + DiagnosticCode.An_interface_can_only_extend_an_interface, + extendsNode.range ); } - thisPrototype.basePrototype = basePrototype; - } else { - this.error( - DiagnosticCode.A_class_may_only_extend_another_class, - extendsNode.range - ); + } + } + + // resolve prototypes of implemented interfaces + for (let i = 0, k = queuedImplements.length; i < k; ++i) { + let thisPrototype = queuedImplements[i]; + let implementsNodes = assert(thisPrototype.implementsNodes); // must be present if in queuedImplements + for (let j = 0, l = implementsNodes.length; j < l; ++j) { + let implementsNode = implementsNodes[j]; + let interfaceElement = resolver.resolveTypeName(implementsNode.name, thisPrototype.parent); + if (!interfaceElement) continue; + if (interfaceElement.kind == ElementKind.INTERFACE_PROTOTYPE) { + let interfacePrototype = interfaceElement; + let interfacePrototypes = thisPrototype.interfacePrototypes; + if (!interfacePrototypes) thisPrototype.interfacePrototypes = interfacePrototypes = new Array(); + interfacePrototypes.push(interfacePrototype); + } else { + this.error( + DiagnosticCode.A_class_can_only_implement_an_interface, + implementsNode.range + ); + } + } + } + + // check for virtual overloads in extended classes and implemented interfaces + for (let i = 0, k = queuedExtends.length; i < k; ++i) { + let thisPrototype = queuedExtends[i]; + let basePrototype = thisPrototype.basePrototype; + if (basePrototype) { + this.markVirtuals(thisPrototype, basePrototype); + } + } + for (let i = 0, k = queuedImplements.length; i < k; ++i) { + let thisPrototype = queuedImplements[i]; + let basePrototype = thisPrototype.basePrototype; + let interfacePrototypes = thisPrototype.interfacePrototypes; + if (basePrototype) { + assert(!interfacePrototypes); + this.markVirtuals(thisPrototype, basePrototype); + } + if (interfacePrototypes) { + assert(!basePrototype); + for (let j = 0, l = interfacePrototypes.length; j < l; ++j) { + this.markVirtuals(thisPrototype, interfacePrototypes[j]); + } } } @@ -1093,6 +1152,108 @@ export class Program extends DiagnosticEmitter { } } + /** Marks virtual members in a base class overloaded in this class. */ + private markVirtuals(thisPrototype: ClassPrototype, basePrototype: ClassPrototype): void { + // TODO: make this work with interfaaces as well + var thisInstanceMembers = thisPrototype.instanceMembers; + if (thisInstanceMembers) { + do { + let baseInstanceMembers = basePrototype.instanceMembers; + if (baseInstanceMembers) { + for (let _values = Map_values(thisInstanceMembers), j = 0, l = _values.length; j < l; ++j) { + let thisMember = _values[j]; + if ( + !thisMember.isAny(CommonFlags.CONSTRUCTOR | CommonFlags.PRIVATE) && + baseInstanceMembers.has(thisMember.name) + ) { + let baseMember = assert(baseInstanceMembers.get(thisMember.name)); + if ( + thisMember.kind == ElementKind.FUNCTION_PROTOTYPE && + baseMember.kind == ElementKind.FUNCTION_PROTOTYPE + ) { + let thisMethod = thisMember; + let baseMethod = baseMember; + if (!thisMethod.visibilityEquals(baseMethod)) { + this.errorRelated( + DiagnosticCode.Overload_signatures_must_all_be_public_private_or_protected, + thisMethod.identifierNode.range, baseMethod.identifierNode.range + ); + } + baseMember.set(CommonFlags.VIRTUAL); + let overloads = baseMethod.overloads; + if (!overloads) baseMethod.overloads = overloads = new Set(); + overloads.add(thisMember); + let baseMethodInstances = baseMethod.instances; + if (baseMethodInstances) { + for (let _values = Map_values(baseMethodInstances), a = 0, b = _values.length; a < b; ++a) { + let baseMethodInstance = _values[a]; + baseMethodInstance.set(CommonFlags.VIRTUAL); + } + } + } else if ( + thisMember.kind == ElementKind.PROPERTY_PROTOTYPE && + baseMember.kind == ElementKind.PROPERTY_PROTOTYPE + ) { + let thisProperty = thisMember; + let baseProperty = baseMember; + if (!thisProperty.visibilityEquals(baseProperty)) { + this.errorRelated( + DiagnosticCode.Overload_signatures_must_all_be_public_private_or_protected, + thisProperty.identifierNode.range, baseProperty.identifierNode.range + ); + } + baseProperty.set(CommonFlags.VIRTUAL); + let baseGetter = baseProperty.getterPrototype; + if (baseGetter) { + baseGetter.set(CommonFlags.VIRTUAL); + let thisGetter = thisProperty.getterPrototype; + if (thisGetter) { + let overloads = baseGetter.overloads; + if (!overloads) baseGetter.overloads = overloads = new Set(); + overloads.add(thisGetter); + } + let baseGetterInstances = baseGetter.instances; + if (baseGetterInstances) { + for (let _values = Map_values(baseGetterInstances), a = 0, b = _values.length; a < b; ++a) { + let baseGetterInstance = _values[a]; + baseGetterInstance.set(CommonFlags.VIRTUAL); + } + } + } + let baseSetter = baseProperty.setterPrototype; + if (baseSetter !== null && thisProperty.setterPrototype !== null) { + baseSetter.set(CommonFlags.VIRTUAL); + let thisSetter = thisProperty.setterPrototype; + if (thisSetter) { + let overloads = baseSetter.overloads; + if (!overloads) baseSetter.overloads = overloads = new Set(); + overloads.add(thisSetter); + } + let baseSetterInstances = baseSetter.instances; + if (baseSetterInstances) { + for (let _values = Map_values(baseSetterInstances), a = 0, b = _values.length; a < b; ++a) { + let baseSetterInstance = _values[a]; + baseSetterInstance.set(CommonFlags.VIRTUAL); + } + } + } + } else { + this.errorRelated( + DiagnosticCode.Duplicate_identifier_0, + thisMember.identifierNode.range, + baseMember.identifierNode.range + ); + } + } + } + } + let nextPrototype = basePrototype.basePrototype; + if (!nextPrototype) break; + basePrototype = nextPrototype; + } while (true); + } + } + /** Requires that a global library element of the specified kind is present and returns it. */ private require(name: string, kind: ElementKind): Element { var element = this.lookupGlobal(name); @@ -1402,12 +1563,13 @@ export class Program extends DiagnosticEmitter { ); if (!parent.add(name, element)) return null; + // remember classes that implement interfaces var implementsTypes = declaration.implementsTypes; if (implementsTypes) { let numImplementsTypes = implementsTypes.length; - // cannot implement interfaces when unmanaged - if (element.hasDecorator(DecoratorFlags.UNMANAGED)) { - if (numImplementsTypes) { + if (numImplementsTypes) { + // cannot implement interfaces when unmanaged + if (element.hasDecorator(DecoratorFlags.UNMANAGED)) { this.error( DiagnosticCode.Unmanaged_classes_cannot_implement_interfaces, Range.join( @@ -1415,18 +1577,12 @@ export class Program extends DiagnosticEmitter { implementsTypes[numImplementsTypes - 1].range ) ); + } else { + queuedImplements.push(element); } - } else if (numImplementsTypes) { - // remember classes that implement interfaces - for (let i = 0; i < numImplementsTypes; ++i) { - this.warning( - DiagnosticCode.Not_implemented, - implementsTypes[i].range - ); - } - queuedImplements.push(element); } } + // remember classes that extend another class if (declaration.extendsType) queuedExtends.push(element); @@ -1829,7 +1985,7 @@ export class Program extends DiagnosticEmitter { break; } case NodeKind.INTERFACEDECLARATION: { - element = this.initializeInterface(declaration, parent); + element = this.initializeInterface(declaration, parent, queuedExtends); break; } case NodeKind.NAMESPACEDECLARATION: { @@ -1966,7 +2122,9 @@ export class Program extends DiagnosticEmitter { /** The declaration to initialize. */ declaration: InterfaceDeclaration, /** Parent element, usually a file or namespace. */ - parent: Element + parent: Element, + /** So far queued `extends` clauses. */ + queuedExtends: ClassPrototype[], ): InterfacePrototype | null { var name = declaration.name.text; var element = new InterfacePrototype( @@ -1978,12 +2136,16 @@ export class Program extends DiagnosticEmitter { ) ); if (!parent.add(name, element)) return null; + + // remember interfaces that extend another interface + if (declaration.extendsType) queuedExtends.push(element); + var memberDeclarations = declaration.members; for (let i = 0, k = memberDeclarations.length; i < k; ++i) { let memberDeclaration = memberDeclarations[i]; switch (memberDeclaration.kind) { case NodeKind.FIELDDECLARATION: { - this.initializeField(memberDeclaration, element); + this.initializeFieldAsProperty(memberDeclaration, element); break; } case NodeKind.METHODDECLARATION: { @@ -2001,6 +2163,63 @@ export class Program extends DiagnosticEmitter { return element; } + /** Initializes a field of an interface, as a property. */ + private initializeFieldAsProperty( + /** Field declaration. */ + declaration: FieldDeclaration, + /** Parent interface. */ + parent: InterfacePrototype + ): void { + var typeNode = declaration.type; + if (!typeNode) typeNode = Node.createOmittedType(declaration.name.range.atEnd); + this.initializeProperty( + Node.createMethodDeclaration( + declaration.name, + null, + Node.createFunctionType( + [], + typeNode, + null, + false, + declaration.range + ), + null, + declaration.decorators, + declaration.flags | CommonFlags.GET, + declaration.range + ), + parent + ); + if (!declaration.is(CommonFlags.READONLY)) { + this.initializeProperty( + Node.createMethodDeclaration( + declaration.name, + null, + Node.createFunctionType( + [ + Node.createParameter( + declaration.name, + typeNode, + null, + ParameterKind.DEFAULT, + declaration.name.range + ) + ], + Node.createOmittedType(declaration.name.range.atEnd), + null, + false, + declaration.range + ), + null, + declaration.decorators, + declaration.flags | CommonFlags.SET, + declaration.range + ), + parent + ); + } + } + /** Initializes a namespace. */ private initializeNamespace( /** The declaration to initialize. */ @@ -2038,7 +2257,7 @@ export class Program extends DiagnosticEmitter { break; } case NodeKind.INTERFACEDECLARATION: { - this.initializeInterface(member, original); + this.initializeInterface(member, original, queuedExtends); break; } case NodeKind.NAMESPACEDECLARATION: { @@ -2348,6 +2567,23 @@ export abstract class Element { return true; } + /** Checks if this element is public, explicitly or implicitly. */ + get isPublic(): bool { + return !this.isAny(CommonFlags.PRIVATE | CommonFlags.PROTECTED); + } + + /** Checks if this element is implicitly public, i.e. not explicitly declared to be. */ + get isImplicitlyPublic(): bool { + return this.isPublic && !this.is(CommonFlags.PUBLIC); + } + + /** Checks if the visibility of this element equals the specified. */ + visibilityEquals(other: Element): bool { + if (this.isPublic == other.isPublic) return true; + const vis = CommonFlags.PRIVATE | CommonFlags.PROTECTED; + return (this.flags & vis) == (other.flags & vis); + } + /** Returns a string representation of this element. */ toString(): string { return this.internalName + ", kind=" + this.kind.toString(); @@ -2402,10 +2638,58 @@ export abstract class DeclaredElement extends Element { return this.declaration.name; } + /** Gets the signature node, if applicable, along the identifier node. */ + get identifierAndSignatureRange(): Range { + var declaration = this.declaration; + var identifierNode = declaration.name; + if (declaration.kind == NodeKind.FUNCTIONDECLARATION || declaration.kind == NodeKind.METHODDECLARATION) { + let signatureNode = (declaration).signature; + return Range.join(identifierNode.range, signatureNode.range); + } + return identifierNode.range; + } + /** Gets the assiciated decorator nodes. */ get decoratorNodes(): DecoratorNode[] | null { return this.declaration.decorators; } + + /** Checks if this element is a compatible override of the specified. */ + isCompatibleOverride(base: DeclaredElement): bool { + var self: DeclaredElement = this; // TS + var kind = self.kind; + if (kind == base.kind) { + switch (kind) { + case ElementKind.FUNCTION: { + return (self).signature.isAssignableTo((base).signature, /* sameSize */ true); + } + case ElementKind.PROPERTY: { + let selfProperty = self; + let baseProperty = base; + let selfGetter = selfProperty.getterInstance; + let baseGetter = baseProperty.getterInstance; + if (selfGetter) { + if (!baseGetter || !selfGetter.signature.isAssignableTo(baseGetter.signature, true)) { + return false; + } + } else if (baseGetter) { + return false; + } + let selfSetter = selfProperty.setterInstance; + let baseSetter = baseProperty.setterInstance; + if (selfSetter) { + if (!baseSetter || !selfSetter.signature.isAssignableTo(baseSetter.signature, true)) { + return false; + } + } else if (baseSetter) { + return false; + } + return true; + } + } + } + return false; + } } // Kinds of all typed elements @@ -2874,6 +3158,8 @@ export class FunctionPrototype extends DeclaredElement { operatorKind: OperatorKind = OperatorKind.INVALID; /** Already resolved instances. */ instances: Map | null = null; + /** Methods overloading this one, if any. These are unbound. */ + overloads: Set | null = null; /** Clones of this prototype that are bounds to specific classes. */ private boundPrototypes: Map | null = null; @@ -2944,6 +3230,7 @@ export class FunctionPrototype extends DeclaredElement { ); bound.flags = this.flags; bound.operatorKind = this.operatorKind; + bound.overloads = this.overloads; // NOTE: this.instances holds instances per bound class / unbound boundPrototypes.set(classInstance, bound); return bound; @@ -2983,6 +3270,8 @@ export class Function extends TypedElement { localsByIndex: Local[] = []; /** List of additional non-parameter locals. */ additionalLocals: Type[] = []; + /** Concrete type arguments. */ + typeArguments: Type[] | null; /** Contextual type arguments. */ contextualTypeArguments: Map | null; /** Default control flow. */ @@ -2993,8 +3282,10 @@ export class Function extends TypedElement { ref: FunctionRef = 0; /** Function table index, if any. */ functionTableIndex: i32 = -1; - /** Trampoline function for calling with omitted arguments. */ - trampoline: Function | null = null; + /** Varargs stub for calling with omitted arguments. */ + varargsStub: Function | null = null; + /** Virtual stub for calling overloads. */ + virtualStub: Function | null = null; /** Counting id of inline operations involving this function. */ nextInlineId: i32 = 0; @@ -3009,6 +3300,8 @@ export class Function extends TypedElement { nameInclTypeParameters: string, /** Respective function prototype. */ prototype: FunctionPrototype, + /** Concrete type arguments. */ + typeArguments: Type[] | null, /** Concrete signature. */ signature: Signature, // pre-resolved /** Contextual type arguments inherited from its parent class, if any. */ @@ -3023,6 +3316,7 @@ export class Function extends TypedElement { prototype.declaration ); this.prototype = prototype; + this.typeArguments = typeArguments; this.signature = signature; this.flags = prototype.flags | CommonFlags.RESOLVED; this.decoratorFlags = prototype.decoratorFlags; @@ -3059,6 +3353,19 @@ export class Function extends TypedElement { registerConcreteElement(program, this); } + /** Creates a stub for use with this function, i.e. for varargs or virtual calls. */ + newStub(postfix: string): Function { + var stub = new Function( + this.name + STUB_DELIMITER + postfix, + this.prototype, + this.typeArguments, + this.signature.clone(), + this.contextualTypeArguments + ); + stub.set(this.flags & ~CommonFlags.COMPILED | CommonFlags.STUB); + return stub; + } + /** Adds a local of the specified type, with an optional name. */ addLocal(type: Type, name: string | null = null, declaration: VariableDeclaration | null = null): Local { // if it has a name, check previously as this method will throw otherwise @@ -3312,11 +3619,13 @@ export class Property extends VariableLikeElement { ElementKind.PROPERTY, prototype.name, parent, - prototype.program.makeNativeVariableDeclaration( - prototype.name, + Node.createVariableDeclaration( + prototype.identifierNode, + null, null, null, prototype.is(CommonFlags.INSTANCE) ? CommonFlags.INSTANCE - : CommonFlags.NONE + : CommonFlags.NONE, + prototype.identifierNode.range ) ); this.prototype = prototype; @@ -3369,9 +3678,11 @@ export class IndexSignature extends TypedElement { export class ClassPrototype extends DeclaredElement { /** Instance member prototypes. */ - instanceMembers: Map | null = null; + instanceMembers: Map | null = null; /** Base class prototype, if applicable. */ - basePrototype: ClassPrototype | null = null; // set in Program#initialize + basePrototype: ClassPrototype | null = null; + /** Interface prototypes, if applicable. */ + interfacePrototypes: InterfacePrototype[] | null = null; /** Constructor prototype. */ constructorPrototype: FunctionPrototype | null = null; /** Operator overload prototypes. */ @@ -3507,6 +3818,8 @@ export class Class extends TypedElement { typeArguments: Type[] | null; /** Base class, if applicable. */ base: Class | null = null; + /** Implemented interfaces, if applicable. */ + interfaces: Set | null = null; /** Contextual type arguments for fields and methods. */ contextualTypeArguments: Map | null = null; /** Current member memory offset. */ @@ -3525,6 +3838,10 @@ export class Class extends TypedElement { rttiFlags: u32 = 0; /** Wrapped type, if a wrapper for a basic type. */ wrappedType: Type | null = null; + /** Classes directly extending this class. */ + extendees: Set | null = null; + /** Classes implementing this interface. */ + implementers: Set | null = null; /** Gets the unique runtime id of this class. */ get id(): u32 { @@ -3606,30 +3923,9 @@ export class Class extends TypedElement { setBase(base: Class): void { assert(!this.base); this.base = base; - - // Remember extendees and mark overloaded methods virtual - var basePrototype: ClassPrototype = base.prototype; - var thisPrototype = this.prototype; - assert(basePrototype != thisPrototype); - basePrototype.extendees.add(thisPrototype); - var thisInstanceMembers = thisPrototype.instanceMembers; - if (thisInstanceMembers) { - do { - let baseInstanceMembers = basePrototype.instanceMembers; - if (baseInstanceMembers) { - for (let _keys = Map_keys(baseInstanceMembers), i = 0, k = _keys.length; i < k; ++i) { - let memberName = _keys[i]; - let member = assert(baseInstanceMembers.get(memberName)); - if (thisInstanceMembers.has(memberName)) { - member.set(CommonFlags.VIRTUAL); - } - } - } - let nextPrototype = basePrototype.basePrototype; - if (!nextPrototype) break; - basePrototype = nextPrototype; - } while (true); - } + var extendees = base.extendees; + if (!extendees) base.extendees = extendees = new Set(); + extendees.add(this); // Inherit contextual type arguments from base class var inheritedTypeArguments = base.contextualTypeArguments; @@ -3649,11 +3945,30 @@ export class Class extends TypedElement { } } + /** Adds an interface. */ + addInterface(iface: Interface): void { + var interfaces = this.interfaces; + if (!interfaces) this.interfaces = interfaces = new Set(); + interfaces.add(iface); + var implementers = iface.implementers; + if (!implementers) iface.implementers = implementers = new Set(); + implementers.add(this); + } + /** Tests if a value of this class type is assignable to a target of the specified class type. */ isAssignableTo(target: Class): bool { var current: Class | null = this; do { if (current == target) return true; + if (target.kind == ElementKind.INTERFACE) { + let interfaces = current.interfaces; + if (interfaces) { + for (let _values = Set_values(interfaces), i = 0, k = _values.length; i < k; ++i) { + let iface = _values[i]; + if (iface.isAssignableTo(target)) return true; + } + } + } current = current.base; } while (current); return false; @@ -3895,10 +4210,27 @@ export class Class extends TypedElement { } return false; } + + /** Gets all extendees of this class (that do not have the specified instance member). */ + getAllExtendees(exceptIfMember: string | null = null, out: Set = new Set()): Set { + var extendees = this.extendees; + if (extendees) { + for (let _values = Set_values(extendees), i = 0, k = _values.length; i < k; ++i) { + let extendee = _values[i]; + if (exceptIfMember) { + let instanceMembers = extendee.prototype.instanceMembers; + if (instanceMembers !== null && instanceMembers.has(exceptIfMember)) continue; + } + out.add(extendee); + extendee.getAllExtendees(exceptIfMember, out); + } + } + return out; + } } /** A yet unresolved interface. */ -export class InterfacePrototype extends ClassPrototype { // FIXME +export class InterfacePrototype extends ClassPrototype { /** Constructs a new interface prototype. */ constructor( @@ -3922,9 +4254,12 @@ export class Interface extends Class { // FIXME /** Constructs a new interface. */ constructor( + /** Name incl. type parameters, i.e. `Foo`. */ nameInclTypeParameters: string, + /** The respective class prototype. */ prototype: InterfacePrototype, - typeArguments: Type[] = [] + /** Concrete type arguments, if any. */ + typeArguments: Type[] | null = null, ) { super( nameInclTypeParameters, @@ -4067,6 +4402,11 @@ export function mangleInternalName(name: string, parent: Element, isInstance: bo assert(!isInstance); return parent.internalName + INNER_DELIMITER + name; } + case ElementKind.PROPERTY_PROTOTYPE: + case ElementKind.PROPERTY: { + parent = parent.parent; + // fall-through + } default: { return mangleInternalName(parent.name, parent.parent, parent.is(CommonFlags.INSTANCE), asGlobal) + (isInstance ? INSTANCE_DELIMITER : STATIC_DELIMITER) + name; diff --git a/src/resolver.ts b/src/resolver.ts index f7868164e5..f6b374280f 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -23,6 +23,7 @@ import { Element, Class, ClassPrototype, + Interface, Function, FunctionPrototype, VariableLikeElement, @@ -35,7 +36,9 @@ import { TypedElement, FunctionTarget, IndexSignature, - isTypedElement + isTypedElement, + InterfacePrototype, + DeclaredElement } from "./program"; import { @@ -243,8 +246,11 @@ export class Resolver extends DiagnosticEmitter { return Type.i32; } - // Handle classes - if (element.kind == ElementKind.CLASS_PROTOTYPE) { + // Handle classes and interfaces + if ( + element.kind == ElementKind.CLASS_PROTOTYPE || + element.kind == ElementKind.INTERFACE_PROTOTYPE + ) { let instance = this.resolveClassInclTypeArguments( element, typeArgumentNodes, @@ -1408,7 +1414,9 @@ export class Resolver extends DiagnosticEmitter { // Look up the member within switch (target.kind) { case ElementKind.CLASS_PROTOTYPE: - case ElementKind.CLASS: { + case ElementKind.INTERFACE_PROTOTYPE: + case ElementKind.CLASS: + case ElementKind.INTERFACE: { do { let members = target.members; if (members !== null && members.has(propertyName)) { @@ -1417,7 +1425,10 @@ export class Resolver extends DiagnosticEmitter { return assert(members.get(propertyName)); // instance FIELD, static GLOBAL, FUNCTION_PROTOTYPE... } // traverse inherited static members on the base prototype if target is a class prototype - if (target.kind == ElementKind.CLASS_PROTOTYPE) { + if ( + target.kind == ElementKind.CLASS_PROTOTYPE || + target.kind == ElementKind.INTERFACE_PROTOTYPE + ) { let classPrototype = target; let basePrototype = classPrototype.basePrototype; if (basePrototype) { @@ -1426,7 +1437,10 @@ export class Resolver extends DiagnosticEmitter { break; } // traverse inherited instance members on the base class if target is a class instance - } else if (target.kind == ElementKind.CLASS) { + } else if ( + target.kind == ElementKind.CLASS || + target.kind == ElementKind.INTERFACE + ) { let classInstance = target; let baseInstance = classInstance.base; if (baseInstance) { @@ -2646,7 +2660,7 @@ export class Resolver extends DiagnosticEmitter { // Instance method prototypes are pre-bound to their concrete class as their parent if (prototype.is(CommonFlags.INSTANCE)) { - assert(actualParent.kind == ElementKind.CLASS); + assert(actualParent.kind == ElementKind.CLASS || actualParent.kind == ElementKind.INTERFACE); classInstance = actualParent; // check if this exact concrete class and function combination is known already @@ -2776,6 +2790,7 @@ export class Resolver extends DiagnosticEmitter { var instance = new Function( nameInclTypeParameters, prototype, + typeArguments, signature, ctxTypes ); @@ -2857,7 +2872,7 @@ export class Resolver extends DiagnosticEmitter { } /** Currently resolving classes. */ - private resolveClassPending: Class[] = []; + private resolveClassPending: Set = new Set(); /** Resolves a class prototype using the specified concrete type arguments. */ resolveClass( @@ -2880,10 +2895,14 @@ export class Resolver extends DiagnosticEmitter { // Otherwise create var nameInclTypeParamters = prototype.name; if (instanceKey.length) nameInclTypeParamters += "<" + instanceKey + ">"; - instance = new Class(nameInclTypeParamters, prototype, typeArguments); + if (prototype.kind == ElementKind.INTERFACE_PROTOTYPE) { + instance = new Interface(nameInclTypeParamters, prototype, typeArguments); + } else { + instance = new Class(nameInclTypeParamters, prototype, typeArguments); + } prototype.setResolvedInstance(instanceKey, instance); var pendingClasses = this.resolveClassPending; - pendingClasses.push(instance); + pendingClasses.add(instance); // Insert contextual type arguments for this operation. Internally, this method is always // called with matching type parameter / argument counts. @@ -2901,6 +2920,8 @@ export class Resolver extends DiagnosticEmitter { } instance.contextualTypeArguments = ctxTypes; + var anyPending = false; + // Resolve base class if applicable var basePrototype = prototype.basePrototype; if (basePrototype) { @@ -2932,9 +2953,45 @@ export class Resolver extends DiagnosticEmitter { // derived classes once the base class's `finishResolveClass` is done. // This is guaranteed to never happen at the entry of the recursion, i.e. // where `resolveClass` is called from other code. - if (pendingClasses.includes(base)) return instance; + if (pendingClasses.has(base)) anyPending = true; } + // Resolve interfaces if applicable + var interfacePrototypes = prototype.interfacePrototypes; + if (interfacePrototypes) { + for (let i = 0, k = interfacePrototypes.length; i < k; ++i) { + let interfacePrototype = interfacePrototypes[i]; + let current: ClassPrototype | null = interfacePrototype; + do { + if (current == prototype) { + this.error( + DiagnosticCode._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, + prototype.identifierNode.range, + prototype.internalName + ); + return null; + } + current = current.basePrototype; + } while (current); + let implementsNode = assert(prototype.implementsNodes![i]); + let iface = this.resolveClassInclTypeArguments( + interfacePrototype, + implementsNode.typeArguments, + prototype.parent, + makeMap(ctxTypes), + implementsNode, + reportMode + ); + if (!iface) return null; + assert(iface.kind == ElementKind.INTERFACE); + instance.addInterface(iface); + + // Like above, if any implemented interface is still pending, yield + if (pendingClasses.has(iface)) anyPending = true; + } + } + if (anyPending) return instance; + // We only get here if the base class has been fully resolved already. this.finishResolveClass(instance, reportMode); return instance; @@ -2947,22 +3004,67 @@ export class Resolver extends DiagnosticEmitter { /** How to proceed with eventual diagnostics. */ reportMode: ReportMode ): void { - var instanceMembers = instance.members; - if (!instanceMembers) instance.members = instanceMembers = new Map(); + var members = instance.members; + if (!members) instance.members = members = new Map(); - // Alias base members var pendingClasses = this.resolveClassPending; + var unimplemented = new Map(); + + // Alias interface members + var interfaces = instance.interfaces; + if (interfaces) { + for (let _values = Set_values(interfaces), i = 0, k = _values.length; i < k; ++i) { + let iface = _values[i]; + assert(!pendingClasses.has(iface)); + let ifaceMembers = iface.members; + if (ifaceMembers) { + for (let _keys = Map_keys(ifaceMembers), i = 0, k = _keys.length; i < k; ++i) { + let memberName = unchecked(_keys[i]); + let member = assert(ifaceMembers.get(memberName)); + if (members.has(memberName)) { + let existing = assert(members.get(memberName)); + if (!member.isCompatibleOverride(existing)) { + this.errorRelated( + DiagnosticCode.This_overload_signature_is_not_compatible_with_its_implementation_signature, + member.identifierAndSignatureRange, existing.identifierAndSignatureRange + ); + continue; + } + } + members.set(memberName, member); + unimplemented.set(memberName, member); + } + } + } + } + + // Alias base members var memoryOffset: u32 = 0; var base = instance.base; if (base) { - assert(!pendingClasses.includes(base)); + assert(!pendingClasses.has(base)); let baseMembers = base.members; if (baseMembers) { // TODO: for (let [baseMemberName, baseMember] of baseMembers) { for (let _keys = Map_keys(baseMembers), i = 0, k = _keys.length; i < k; ++i) { - let baseMemberName = unchecked(_keys[i]); - let baseMember = assert(baseMembers.get(baseMemberName)); - instanceMembers.set(baseMemberName, baseMember); + let memberName = unchecked(_keys[i]); + let member = assert(baseMembers.get(memberName)); + if (members.has(memberName)) { + let existing = assert(members.get(memberName)); + if (!member.isCompatibleOverride(existing)) { + this.errorRelated( + DiagnosticCode.This_overload_signature_is_not_compatible_with_its_implementation_signature, + member.identifierAndSignatureRange, existing.identifierAndSignatureRange + ); + continue; + } + } + members.set(memberName, member); + if (member.is(CommonFlags.ABSTRACT)) { + unimplemented.set(memberName, member); + } else { + unimplemented.delete(memberName); + } } } memoryOffset = base.nextMemoryOffset; @@ -2971,10 +3073,12 @@ export class Resolver extends DiagnosticEmitter { // Resolve instance members var prototype = instance.prototype; var instanceMemberPrototypes = prototype.instanceMembers; + var properties = new Array(); if (instanceMemberPrototypes) { // TODO: for (let member of instanceMemberPrototypes.values()) { for (let _values = Map_values(instanceMemberPrototypes), i = 0, k = _values.length; i < k; ++i) { let member = unchecked(_values[i]); + let memberName = member.name; switch (member.kind) { case ElementKind.FIELD_PROTOTYPE: { @@ -3016,7 +3120,7 @@ export class Resolver extends DiagnosticEmitter { if (memoryOffset & mask) memoryOffset = (memoryOffset | mask) + 1; fieldInstance.memoryOffset = memoryOffset; memoryOffset += fieldType.byteSize; - instance.add(member.name, fieldInstance); // reports + instance.add(memberName, fieldInstance); // reports break; } case ElementKind.FUNCTION_PROTOTYPE: { @@ -3027,6 +3131,7 @@ export class Resolver extends DiagnosticEmitter { case ElementKind.PROPERTY_PROTOTYPE: { let propertyPrototype = member; let propertyInstance = new Property(propertyPrototype, instance); + properties.push(propertyInstance); let getterPrototype = propertyPrototype.getterPrototype; if (getterPrototype) { let getterInstance = this.resolveFunction( @@ -3061,24 +3166,63 @@ export class Resolver extends DiagnosticEmitter { } default: assert(false); } + if (!member.is(CommonFlags.ABSTRACT)) { + unimplemented.delete(memberName); + } } } - // Finalize memory offset - instance.nextMemoryOffset = memoryOffset; - - // Link _own_ constructor if present - { - let ctorPrototype = instance.lookupInSelf(CommonNames.constructor); - if (ctorPrototype !== null && ctorPrototype.parent === instance) { - assert(ctorPrototype.kind == ElementKind.FUNCTION_PROTOTYPE); - let ctorInstance = this.resolveFunction( - ctorPrototype, - null, - assert(instance.contextualTypeArguments), - reportMode + // Check that property getters and setters match + for (let i = 0, k = properties.length; i < k; ++i) { + let property = properties[i]; + let propertyGetter = property.getterInstance; + if (!propertyGetter) { + this.error( + DiagnosticCode.Property_0_only_has_a_setter_and_is_missing_a_getter, + property.identifierNode.range, property.name ); - if (ctorInstance) instance.constructorInstance = ctorInstance; + } else { + let propertySetter = property.setterInstance; + if (propertySetter !== null && !propertyGetter.visibilityEquals(propertySetter)) { + this.errorRelated( + DiagnosticCode.Getter_and_setter_accessors_do_not_agree_in_visibility, + propertyGetter.identifierNode.range, propertySetter.identifierNode.range + ); + } + } + } + + if (instance.kind != ElementKind.INTERFACE) { + + // Check that all required members are implemented + if (!instance.is(CommonFlags.ABSTRACT) && unimplemented.size > 0) { + for (let _keys = Map_keys(unimplemented), i = 0, k = _keys.length; i < k; ++i) { + let memberName = _keys[i]; + let member = assert(unimplemented.get(memberName)); + this.errorRelated( + DiagnosticCode.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_2, + instance.identifierNode.range, member.identifierNode.range, + instance.internalName, memberName, member.parent.internalName + ); + } + } + + // Finalize memory offset + instance.nextMemoryOffset = memoryOffset; + + // Link _own_ constructor if present + { + let ctorPrototype = instance.lookupInSelf(CommonNames.constructor); + if (ctorPrototype !== null && ctorPrototype.parent === instance) { + assert(ctorPrototype.kind == ElementKind.FUNCTION_PROTOTYPE); + let ctorInstance = this.resolveFunction( + ctorPrototype, + null, + assert(instance.contextualTypeArguments), + reportMode + ); + if (ctorInstance) instance.constructorInstance = ctorInstance; + } } } @@ -3150,21 +3294,27 @@ export class Resolver extends DiagnosticEmitter { } // Remove this class from pending - var pendingIndex = pendingClasses.indexOf(instance); - assert(~pendingIndex); // must be pending - pendingClasses.splice(pendingIndex, 1); + assert(pendingClasses.has(instance)); // must be pending + pendingClasses.delete(instance); // Finish derived classes that we postponed in `resolveClass` due to the // base class still being pending, again triggering `finishResolveClass` // of any classes derived from those classes, ultimately leading to all // pending classes being resolved. - var derivedPendingClasses = new Array(); - for (let i = 0, k = pendingClasses.length; i < k; ++i) { - let pending = pendingClasses[i]; - if (instance == pending.base) derivedPendingClasses.push(pending); - } - for (let i = 0, k = derivedPendingClasses.length; i < k; ++i) { - this.finishResolveClass(derivedPendingClasses[i], reportMode); + for (let _values = Set_values(pendingClasses), i = 0, k = _values.length; i < k; ++i) { + let pending = _values[i]; + let dependsOnInstance = pending.base === instance; + let interfaces = pending.interfaces; + if (interfaces) { + let anyPending = false; + for (let _values2 = Set_values(interfaces), j = 0, l = _values2.length; j < l; ++j) { + let iface = _values2[j]; + if (iface === instance) dependsOnInstance = true; + else if (pendingClasses.has(iface)) anyPending = true; + } + if (anyPending) continue; + } + if (dependsOnInstance) this.finishResolveClass(pending, reportMode); } } diff --git a/src/tokenizer.ts b/src/tokenizer.ts index c0235bd9cb..c0565c1f86 100644 --- a/src/tokenizer.ts +++ b/src/tokenizer.ts @@ -418,6 +418,10 @@ export class Range { ); } + equals(other: Range): bool { + return this.source == other.source && this.start == other.start && this.end == other.end; + } + get atStart(): Range { return new Range(this.source, this.start, this.start); } diff --git a/src/types.ts b/src/types.ts index 113bf04b9e..88598358a0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -223,6 +223,19 @@ export class Type { return cachedNullableType; } + /** Tests if this type equals the specified. */ + equals(other: Type): bool { + if (this.kind != other.kind) return false; + if (this.is(TypeFlags.REFERENCE)) { + return ( + this.classReference == other.classReference && + this.signatureReference == other.signatureReference && + this.is(TypeFlags.NULLABLE) == other.is(TypeFlags.NULLABLE) + ); + } + return true; + } + /** Tests if a value of this type is assignable to the target type incl. implicit conversion. */ isAssignableTo(target: Type, signednessIsRelevant: bool = false): bool { var currentClass: Class | null; @@ -613,18 +626,40 @@ export class Signature { : getDefaultParameterName(index); } - /** Tests if a value of this function type is assignable to a target of the specified function type. */ - isAssignableTo(target: Signature): bool { - return this.equals(target); + /** Tests if this signature equals the specified. */ + equals(other: Signature): bool { + + // check `this` type + var thisThisType = this.thisType; + var otherThisType = other.thisType; + if (thisThisType !== null) { + if (otherThisType === null || !thisThisType.equals(otherThisType)) return false; + } else if (otherThisType) { + return false; + } + + // check rest parameter + if (this.hasRest != other.hasRest) return false; + + // check parameter types + var thisParameterTypes = this.parameterTypes; + var otherParameterTypes = other.parameterTypes; + var numParameters = thisParameterTypes.length; + if (numParameters != otherParameterTypes.length) return false; + for (let i = 0; i < numParameters; ++i) { + if (!thisParameterTypes[i].equals(otherParameterTypes[i])) return false; + } + + // check return type + return this.returnType.equals(other.returnType); } - /** Tests to see if a signature equals another signature. */ - equals(value: Signature): bool { - // TODO: maybe cache results? + /** Tests if a value of this function type is assignable to a target of the specified function type. */ + isAssignableTo(target: Signature, requireSameSize: bool = false): bool { // check `this` type var thisThisType = this.thisType; - var targetThisType = value.thisType; + var targetThisType = target.thisType; if (thisThisType !== null) { if (targetThisType === null || !thisThisType.isAssignableTo(targetThisType)) return false; } else if (targetThisType) { @@ -632,13 +667,13 @@ export class Signature { } // check rest parameter - if (this.hasRest != value.hasRest) return false; // TODO + if (this.hasRest != target.hasRest) return false; // TODO // check parameter types var thisParameterTypes = this.parameterTypes; - var targetParameterTypes = value.parameterTypes; + var targetParameterTypes = target.parameterTypes; var numParameters = thisParameterTypes.length; - if (numParameters != targetParameterTypes.length) return false; + if (numParameters != targetParameterTypes.length) return false; // TODO for (let i = 0; i < numParameters; ++i) { let thisParameterType = thisParameterTypes[i]; let targetParameterType = targetParameterTypes[i]; @@ -647,7 +682,7 @@ export class Signature { // check return type var thisReturnType = this.returnType; - var targetReturnType = value.returnType; + var targetReturnType = target.returnType; return thisReturnType == targetReturnType || thisReturnType.isAssignableTo(targetReturnType); } @@ -684,6 +719,27 @@ export class Signature { sb.push(this.returnType.toString()); return sb.join(""); } + + /** Creates a clone of this signature that is safe to modify. */ + clone(): Signature { + var parameterTypes = this.parameterTypes; + var numParameterTypes = parameterTypes.length; + var cloneParameterTypes = new Array(numParameterTypes); + for (let i = 0; i < numParameterTypes; ++i) { + cloneParameterTypes[i] = parameterTypes[i]; + } + var clone = new Signature(this.program, cloneParameterTypes, this.returnType, this.thisType); + var parameterNames = this.parameterNames; + if (parameterNames) { + let numParameterNames = parameterNames.length; + let cloneParameterNames = new Array(numParameterNames); + for (let i = 0; i < numParameterNames; ++i) { + cloneParameterNames[i] = parameterNames[i]; + } + clone.parameterNames = cloneParameterNames; + } + return clone; + } } // helpers diff --git a/std/assembly/arraybuffer.ts b/std/assembly/arraybuffer.ts index 5e948c9bfe..754d986531 100644 --- a/std/assembly/arraybuffer.ts +++ b/std/assembly/arraybuffer.ts @@ -14,11 +14,6 @@ export abstract class ArrayBufferView { return (this.dataStart - changetype(this.buffer)); } - get length(): i32 { - ERROR("missing implementation: subclasses must implement ArrayBufferView#length"); - return unreachable(); - } - protected constructor(length: i32, alignLog2: i32) { if (length > BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH); var buffer = __alloc(length = length << alignLog2, idof()); diff --git a/std/assembly/set.ts b/std/assembly/set.ts index ca2a1ca299..17925f702b 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -191,6 +191,7 @@ export class Set { values[length++] = entry.key; } } + values.length = length; return values; } diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index df78e5ac25..938fb4a728 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -300,3 +300,6 @@ declare interface StringConstructor { /** Annotates a class as being unmanaged with limited capabilities. */ declare function unmanaged(constructor: Function): void; + +/** Environmental tracing function. */ +declare function trace(msg: string, n?: i32, a0?: f64, a1?: f64, a2?: f64, a3?: f64, a4?: f64): void; diff --git a/std/portable/index.js b/std/portable/index.js index 481b48a09d..95e528eae3 100644 --- a/std/portable/index.js +++ b/std/portable/index.js @@ -299,3 +299,8 @@ Object.defineProperties(globalScope["JSMath"], { }); globalScope["unmanaged"] = function() {}; + +globalScope["trace"] = function(message, n) { + if (n) message += Array.prototype.slice.call(arguments, 2, 2 + n); + console.error("trace: " + message); +}; diff --git a/tests/binaryen/reloop.js b/tests/binaryen/reloop.js new file mode 100644 index 0000000000..c133002653 --- /dev/null +++ b/tests/binaryen/reloop.js @@ -0,0 +1,71 @@ +var binaryen = require("binaryen"); +binaryen.setOptimizeLevel(3); +binaryen.setShrinkLevel(0); + +function usingBranches() { + var module = new binaryen.Module(); + var rl = new binaryen.Relooper(module); + var entry = rl.addBlock(module.nop()); + + for (let i = 0; i < 10; ++i) { + rl.addBranch(entry, + rl.addBlock( + module.return( + module.call("other", [ module.i32.const(i) ], binaryen.none, binaryen.i32) + ) + ), + module.i32.eq( + module.local.get(0, binaryen.i32), + module.i32.const(i) + ) + ); + } + rl.addBranch(entry, + rl.addBlock( + module.unreachable() + ) + ); + + module.addFunction("test", binaryen.i32, binaryen.i32, [ binaryen.i32 ], rl.renderAndDispose(entry, 1)); + module.addFunctionImport("other", "env", "other", binaryen.i32, binaryen.i32); + module.addFunctionExport("test", "test"); + + console.log("=== unoptimized ==="); + console.log(module.emitText()); + module.optimize(); + console.log("=== optimized ==="); + console.log(module.emitText()); +} +usingBranches(); + +function usingSwitch() { + var module = new binaryen.Module(); + var rl = new binaryen.Relooper(module); + var entry = rl.addBlockWithSwitch(module.nop(), module.local.get(0, binaryen.i32)); + + for (let i = 0; i < 10; ++i) { + rl.addBranchForSwitch(entry, + rl.addBlock( + module.return( + module.call("other", [ module.i32.const(i) ], binaryen.none, binaryen.i32) + ) + ), + [ i ] + ); + } + rl.addBranchForSwitch(entry, + rl.addBlock( + module.unreachable() + ), + [] + ); + + module.addFunction("test", binaryen.i32, binaryen.i32, [ binaryen.i32 ], rl.renderAndDispose(entry, 1)); + module.addFunctionImport("other", "env", "other", binaryen.none, binaryen.i32); + module.addFunctionExport("test", "test"); + + console.log(module.emitText()); + module.optimize(); + console.log(module.emitText()); +} +// usingSwitch(); diff --git a/tests/bootstrap/index.ts b/tests/bootstrap/index.ts index bafb9ff1b7..098b8c0dd6 100644 --- a/tests/bootstrap/index.ts +++ b/tests/bootstrap/index.ts @@ -1,28 +1,97 @@ import * as fs from "fs"; +import * as path from "path"; import * as binaryen from "binaryen"; import * as util from "util"; import * as loader from "../../lib/loader"; +import * as find from "../../cli/util/find"; import AssemblyScript from "../../out/assemblyscript"; +Error.stackTraceLimit = Infinity; + +// Load stdlib +const libDir = path.join(__dirname, "..", "..", "std", "assembly"); +const libraryFiles = {}; +find.files(libDir, /^(?!.*\.d\.ts$).*\.ts$/).forEach((file: string) => { + libraryFiles[file.replace(/\.ts$/, "")] = fs.readFileSync(path.join(libDir, file), "utf8" ); +}); + async function test(build: string): Promise { await binaryen.ready; + const { exports: asc } = await loader.instantiate( fs.promises.readFile(`${ __dirname }/../../out/assemblyscript.${ build }.wasm`), { binaryen } ); console.log(util.inspect(asc, true)); - const optionsPtr = asc.newOptions(); - const programPtr = asc.newProgram(optionsPtr); - const textPtr = asc.__allocString("export function add(a: i32, b: i32): i32 { return a + b; }\n"); - const pathPtr = asc.__allocString("index.ts"); - asc.parse(programPtr, textPtr, pathPtr, true); + + const cachedStrings = new Map(); + function cachedString(text: string): number { + if (cachedStrings.has(text)) return cachedStrings.get(text); + var ptr = asc.__retain(asc.__allocString(text)); + cachedStrings.set(text, ptr); + return ptr; + } + + const programPtr = ((): number => { + const optionsPtr = asc.newOptions(); + const ptr = asc.newProgram(optionsPtr); + asc.__release(optionsPtr); + return ptr; + })(); + + console.log("\nParsing standard library ..."); + Object.keys(libraryFiles).forEach((libPath: string) => { + if (libPath.indexOf("/") >= 0) return; + const textPtr = cachedString(libraryFiles[libPath]); + const pathPtr = cachedString("~lib/" + libPath + ".ts"); + console.log(" " + asc.__getString(pathPtr)); + asc.parse(programPtr, textPtr, pathPtr, false); + }); + + console.log("\nParsing runtime ..."); + { + const textPtr = cachedString(libraryFiles["rt/index-stub"]); + const pathPtr = cachedString("~lib/rt/index-stub.ts"); + console.log(" " + asc.__getString(pathPtr)); + asc.parse(programPtr, textPtr, pathPtr, true); + } + + console.log("\nParsing backlog ..."); var nextFilePtr = asc.nextFile(programPtr); while (nextFilePtr) { - console.log("nextFile: " + asc.__getString(nextFilePtr)); + const nextFile = asc.__getString(nextFilePtr); + if (!nextFile.startsWith("~lib/")) throw Error("unexpected file: " + nextFile); + const text = libraryFiles[nextFile.substring(5)]; + if (text == null) throw Error("missing file: " + nextFile); + const textPtr = cachedString(libraryFiles[nextFile.substring(5)]); + const pathPtr = cachedString(nextFile + ".ts"); + console.log(" " + asc.__getString(pathPtr)); + asc.parse(programPtr, textPtr, pathPtr, false); + asc.__release(nextFilePtr); nextFilePtr = asc.nextFile(programPtr); } - // assemblyscript.compile(programPtr); - // ^ abort: missing ArrayBuffer at src/program.ts:1015:18 - console.log("So far, so good."); + + console.log("\nParsing entry file ..."); + { + const textPtr = cachedString("export function add(a: i32, b: i32): i32 { return a + b; }\n"); + const pathPtr = cachedString("index.ts"); + console.log(" " + asc.__getString(pathPtr)); + asc.parse(programPtr, textPtr, pathPtr, true); + } + + console.log("\nInitializing program ..."); + { + asc.initializeProgram(programPtr); + console.log("\nCompiling program ..."); + const modulePtr = asc.compile(programPtr); + const moduleRef = new Uint32Array(asc.memory.buffer, modulePtr)[0]; + console.log(binaryen.wrapModule(moduleRef).emitText()); + asc.__release(modulePtr); + } + + asc.__release(programPtr); + cachedStrings.forEach(asc.__release); + + console.log("\nSo far, so good."); } test("untouched"); diff --git a/tests/compiler/builtins.optimized.wat b/tests/compiler/builtins.optimized.wat index 74821aee7a..5d9fd01018 100644 --- a/tests/compiler/builtins.optimized.wat +++ b/tests/compiler/builtins.optimized.wat @@ -592,9 +592,9 @@ i32.const 5 f64.const 0 f64.const 0 - f64.const 12 - f64.const 25 - f64.const 25 + f64.const 29 + f64.const 30 + f64.const 30 call $~lib/builtins/trace i32.const 1216 i32.const 1216 diff --git a/tests/compiler/builtins.untouched.wat b/tests/compiler/builtins.untouched.wat index 08f3bf7d0a..12af226ef1 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -1727,11 +1727,11 @@ local.set $0 i32.const 0 local.set $1 - i32.const 12 + i32.const 29 local.set $6 - i32.const 25 + i32.const 30 local.set $7 - i32.const 25 + i32.const 30 local.set $8 i32.const 128 i32.const 5 @@ -1771,7 +1771,7 @@ unreachable end local.get $6 - i32.const 12 + i32.const 29 i32.eq i32.eqz if diff --git a/tests/compiler/call-inferred.untouched.wat b/tests/compiler/call-inferred.untouched.wat index 2a9e74fe9a..63567615f7 100644 --- a/tests/compiler/call-inferred.untouched.wat +++ b/tests/compiler/call-inferred.untouched.wat @@ -25,7 +25,7 @@ (func $call-inferred/bar (param $0 f32) (result f32) local.get $0 ) - (func $call-inferred/bar|trampoline (param $0 f32) (result f32) + (func $call-inferred/bar@varargs (param $0 f32) (result f32) block $1of1 block $0of1 block $outOfRange @@ -87,7 +87,7 @@ i32.const 0 global.set $~argumentsLength f32.const 0 - call $call-inferred/bar|trampoline + call $call-inferred/bar@varargs f32.const 42 f32.eq i32.eqz diff --git a/tests/compiler/call-optional.optimized.wat b/tests/compiler/call-optional.optimized.wat index eb1d84cfa9..a552c118cc 100644 --- a/tests/compiler/call-optional.optimized.wat +++ b/tests/compiler/call-optional.optimized.wat @@ -17,7 +17,7 @@ i32.add i32.add ) - (func $call-optional/opt|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $call-optional/opt@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -50,7 +50,7 @@ i32.const 3 i32.const 0 i32.const 0 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs if i32.const 0 i32.const 1040 @@ -64,7 +64,7 @@ i32.const 3 i32.const 4 i32.const 0 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs i32.const 5 i32.ne if @@ -94,7 +94,7 @@ i32.const 3 i32.const 0 i32.const 0 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs if i32.const 0 i32.const 1040 @@ -108,7 +108,7 @@ i32.const 3 i32.const 4 i32.const 0 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs i32.const 5 i32.ne if @@ -124,7 +124,7 @@ i32.const 3 i32.const 4 i32.const 5 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs i32.const 12 i32.ne if diff --git a/tests/compiler/call-optional.untouched.wat b/tests/compiler/call-optional.untouched.wat index 22c6486b57..ab1629daf4 100644 --- a/tests/compiler/call-optional.untouched.wat +++ b/tests/compiler/call-optional.untouched.wat @@ -7,7 +7,7 @@ (memory $0 1) (data (i32.const 16) " \00\00\00\01\00\00\00\01\00\00\00 \00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s\00") (table $0 2 funcref) - (elem (i32.const 1) $call-optional/opt|trampoline) + (elem (i32.const 1) $call-optional/opt@varargs) (global $~argumentsLength (mut i32) (i32.const 0)) (global $call-optional/optIndirect (mut i32) (i32.const 1)) (export "__setArgumentsLength" (func $~setArgumentsLength)) @@ -20,7 +20,7 @@ local.get $2 i32.add ) - (func $call-optional/opt|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $call-optional/opt@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -48,12 +48,12 @@ global.set $~argumentsLength ) (func $start:call-optional - i32.const 1 - global.set $~argumentsLength i32.const 3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs i32.const 0 i32.eq i32.eqz @@ -65,12 +65,12 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength i32.const 3 i32.const 4 + i32.const 2 + global.set $~argumentsLength i32.const 0 - call $call-optional/opt|trampoline + call $call-optional/opt@varargs i32.const 5 i32.eq i32.eqz @@ -97,11 +97,11 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength i32.const 3 i32.const 0 i32.const 0 + i32.const 1 + global.set $~argumentsLength global.get $call-optional/optIndirect call_indirect (type $i32_i32_i32_=>_i32) i32.const 0 @@ -115,11 +115,11 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength i32.const 3 i32.const 4 i32.const 0 + i32.const 2 + global.set $~argumentsLength global.get $call-optional/optIndirect call_indirect (type $i32_i32_i32_=>_i32) i32.const 5 @@ -134,10 +134,10 @@ unreachable end i32.const 3 - global.set $~argumentsLength - i32.const 3 i32.const 4 i32.const 5 + i32.const 3 + global.set $~argumentsLength global.get $call-optional/optIndirect call_indirect (type $i32_i32_i32_=>_i32) i32.const 12 diff --git a/tests/compiler/class-abstract-errors.json b/tests/compiler/class-abstract-errors.json new file mode 100644 index 0000000000..348da60657 --- /dev/null +++ b/tests/compiler/class-abstract-errors.json @@ -0,0 +1,11 @@ +{ + "asc_flags": [ + "--runtime none" + ], + "stderr": [ + "TS2511: Cannot create an instance of an abstract class.", + "TS2515: Non-abstract class 'class-abstract-errors/Baz' does not implement inherited abstract member 'bar'", + "TS2515: Non-abstract class 'class-abstract-errors/Baz' does not implement inherited abstract member 'a'", + "EOF" + ] +} \ No newline at end of file diff --git a/tests/compiler/class-abstract-errors.ts b/tests/compiler/class-abstract-errors.ts new file mode 100644 index 0000000000..76441f9e6e --- /dev/null +++ b/tests/compiler/class-abstract-errors.ts @@ -0,0 +1,29 @@ +abstract class Foo { + abstract bar(): void; + abstract get a(): i32; + abstract set a(a: i32); +} + +new Foo(); // TS2511: Cannot create an instance of an abstract class. + +class Baz extends Foo { + // TS2515: Non-abstract class 'Baz' does not implement inherited abstract member 'bar' from 'Foo' + // TS2515: Non-abstract class 'Baz' does not implement inherited abstract member 'a' from 'Foo' +} + +new Baz(); + +class Qux extends Foo { + bar(): i32 { + return 1; + } + get a(): i32 { return 0; } + set a(a: i32) {} +} + +// TODO: This does not check .bar overload +var qux = new Qux(); +// But this does: var qux: Foo = new Qux(); +qux.bar(); + +ERROR("EOF"); diff --git a/tests/compiler/class-overloading.json b/tests/compiler/class-overloading.json index b1da366ff4..bf222c4d2d 100644 --- a/tests/compiler/class-overloading.json +++ b/tests/compiler/class-overloading.json @@ -1,5 +1,6 @@ { "asc_flags": [ - "--runtime none" + "--runtime none", + "--explicitStart" ] } \ No newline at end of file diff --git a/tests/compiler/class-overloading.optimized.wat b/tests/compiler/class-overloading.optimized.wat index fb06ae9732..68a6b7efce 100644 --- a/tests/compiler/class-overloading.optimized.wat +++ b/tests/compiler/class-overloading.optimized.wat @@ -1,9 +1,749 @@ (module + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (memory $0 0) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 1028) "\01\00\00\00\01") + (data (i32.const 1040) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00A") + (data (i32.const 1072) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00B") + (data (i32.const 1104) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00c\00l\00a\00s\00s\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s") + (data (i32.const 1168) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00C") + (data (i32.const 1200) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00F") + (data (i32.const 1232) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00I\00B") + (data (i32.const 1264) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00I\00C") + (global $class-overloading/which (mut i32) (i32.const 1040)) + (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (global $class-overloading/a (mut i32) (i32.const 0)) + (global $class-overloading/ia (mut i32) (i32.const 0)) + (global $class-overloading/ic (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (export "_start" (func $~start)) (export "memory" (memory $0)) - (export "test" (func $class-overloading/test)) - (func $class-overloading/test (param $0 i32) - nop + (func $~lib/rt/stub/__alloc (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + global.get $~lib/rt/stub/offset + i32.const 16 + i32.add + local.tee $3 + i32.const 16 + i32.add + local.tee $1 + memory.size + local.tee $4 + i32.const 16 + i32.shl + local.tee $2 + i32.gt_u + if + local.get $4 + local.get $1 + local.get $2 + i32.sub + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.tee $2 + local.get $4 + local.get $2 + i32.gt_s + select + memory.grow + i32.const 0 + i32.lt_s + if + local.get $2 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + end + local.get $1 + global.set $~lib/rt/stub/offset + local.get $3 + i32.const 16 + i32.sub + local.tee $1 + i32.const 16 + i32.store + local.get $1 + i32.const 1 + i32.store offset=4 + local.get $1 + local.get $0 + i32.store offset=8 + local.get $1 + i32.const 0 + i32.store offset=12 + local.get $3 + ) + (func $class-overloading/B#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 4 + call $~lib/rt/stub/__alloc + local.set $0 + end + local.get $0 + i32.eqz + if (result i32) + i32.const 3 + call $~lib/rt/stub/__alloc + else + local.get $0 + end + ) + (func $~lib/string/String#get:length (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 1 + i32.shr_u + ) + (func $~lib/util/string/compareImpl (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + local.get $0 + i32.const 7 + i32.and + local.get $1 + i32.const 7 + i32.and + i32.or + i32.eqz + i32.const 0 + local.get $2 + i32.const 4 + i32.ge_u + select + if + loop $do-continue|0 + local.get $0 + i64.load + local.get $1 + i64.load + i64.eq + if + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + local.get $2 + i32.const 4 + i32.sub + local.tee $2 + i32.const 4 + i32.ge_u + br_if $do-continue|0 + end + end + end + loop $while-continue|1 + local.get $2 + local.tee $3 + i32.const 1 + i32.sub + local.set $2 + local.get $3 + if + local.get $0 + i32.load16_u + local.tee $3 + local.get $1 + i32.load16_u + local.tee $4 + i32.ne + if + local.get $3 + local.get $4 + i32.sub + return + end + local.get $0 + i32.const 2 + i32.add + local.set $0 + local.get $1 + i32.const 2 + i32.add + local.set $1 + br $while-continue|1 + end + end + i32.const 0 + ) + (func $~lib/string/String.__eq (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $0 + local.get $1 + i32.eq + if + i32.const 1 + return + end + block $folding-inner0 + local.get $1 + i32.eqz + i32.const 1 + local.get $0 + select + br_if $folding-inner0 + local.get $0 + call $~lib/string/String#get:length + local.tee $2 + local.get $1 + call $~lib/string/String#get:length + i32.ne + br_if $folding-inner0 + local.get $0 + local.get $1 + local.get $2 + call $~lib/util/string/compareImpl + i32.eqz + return + end + i32.const 0 + ) + (func $class-overloading/C#a + i32.const 1088 + global.set $class-overloading/which + i32.const 1088 + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 52 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + i32.const 1184 + global.set $class-overloading/which + ) + (func $class-overloading/D#constructor (param $0 i32) (result i32) + local.get $0 + if (result i32) + local.get $0 + else + i32.const 6 + call $~lib/rt/stub/__alloc + end + call $class-overloading/B#constructor + ) + (func $class-overloading/E#constructor (param $0 i32) (result i32) + local.get $0 + if (result i32) + local.get $0 + else + i32.const 7 + call $~lib/rt/stub/__alloc + end + call $class-overloading/D#constructor + ) + (func $start:class-overloading + i32.const 1296 + global.set $~lib/rt/stub/offset + i32.const 0 + call $class-overloading/B#constructor + global.set $class-overloading/a + global.get $class-overloading/a + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 38 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 41 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 44 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 47 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 5 + call $~lib/rt/stub/__alloc + call $class-overloading/B#constructor + drop + i32.const 1040 + global.set $class-overloading/which + call $class-overloading/C#a + global.get $class-overloading/which + i32.const 1184 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 71 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + i32.const 1184 + global.set $class-overloading/which + i32.const 1184 + i32.const 1184 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 74 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + i32.const 1184 + global.set $class-overloading/which + i32.const 1184 + i32.const 1184 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 77 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1184 + global.set $class-overloading/which + i32.const 1184 + i32.const 1184 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 79 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/D#constructor + global.set $class-overloading/a + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 89 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 92 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 95 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 97 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/E#constructor + global.set $class-overloading/a + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 107 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 110 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 113 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1088 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 115 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 8 + call $~lib/rt/stub/__alloc + call $class-overloading/E#constructor + global.set $class-overloading/a + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 1216 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 137 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1216 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 140 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1216 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 143 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 1216 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 146 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 10 + call $~lib/rt/stub/__alloc + global.set $class-overloading/ia + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/ia + call $class-overloading/IA#foo@virtual + global.get $class-overloading/which + i32.const 1248 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 162 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 12 + call $~lib/rt/stub/__alloc + global.set $class-overloading/ic + i32.const 1040 + global.set $class-overloading/which + global.get $class-overloading/ic + call $class-overloading/IA#foo@virtual + global.get $class-overloading/which + i32.const 1280 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 1120 + i32.const 177 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ) + (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end + call $start:class-overloading + ) + (func $class-overloading/A#a@virtual (param $0 i32) + block $default + block $case2 + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.tee $0 + i32.const 4 + i32.eq + local.get $0 + i32.const 6 + i32.eq + i32.or + br_if $case0 + block $tablify|0 + local.get $0 + i32.const 5 + i32.sub + br_table $case1 $tablify|0 $case0 $case2 $tablify|0 + end + br $default + end + i32.const 1088 + global.set $class-overloading/which + return + end + call $class-overloading/C#a + return + end + i32.const 1216 + global.set $class-overloading/which + return + end + i32.const 1056 + global.set $class-overloading/which + ) + (func $class-overloading/A#b@virtual (param $0 i32) + block $default + block $case2 + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.tee $0 + i32.const 4 + i32.eq + local.get $0 + i32.const 6 + i32.eq + i32.or + br_if $case0 + block $tablify|0 + local.get $0 + i32.const 5 + i32.sub + br_table $case1 $tablify|0 $case0 $case2 $tablify|0 + end + br $default + end + i32.const 1088 + global.set $class-overloading/which + return + end + i32.const 1184 + global.set $class-overloading/which + return + end + i32.const 1216 + global.set $class-overloading/which + return + end + i32.const 1056 + global.set $class-overloading/which + ) + (func $class-overloading/IA#foo@virtual (param $0 i32) + block $default + block $case1 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.tee $0 + i32.const 10 + i32.ne + if + local.get $0 + i32.const 12 + i32.eq + br_if $case1 + br $default + end + i32.const 1248 + global.set $class-overloading/which + return + end + i32.const 1280 + global.set $class-overloading/which + return + end + unreachable ) ) diff --git a/tests/compiler/class-overloading.ts b/tests/compiler/class-overloading.ts index bbd64ac5c6..d8f9cf1241 100644 --- a/tests/compiler/class-overloading.ts +++ b/tests/compiler/class-overloading.ts @@ -1,12 +1,177 @@ -class Foo { - baz(): void {} +var which: string = ""; + +class A { + a(a: T): void { // virtual + which = "A"; + } + b(b: i32): void { // virtual + which = "A"; + } + get c(): i32 { // virtual + which = "A"; + return 0; + } + set c(c: i32) { // virtual + which = "A"; + } } -class Bar extends Foo { - baz(): void {} + +class B extends A { + a(a: T): void { // virtual + overload + which = "B"; + } + b(b: i32): void { // virtual + overload + which = "B"; + } + get c(): i32 { // virtual + overload + which = "B"; + return 0; + } + set c(c: i32) { // virtual + overload + which = "B"; + } } -export function test(foo: Foo): void { - foo.baz(); + +// Should call the overload +var a: A = new B(); +a.a(1); +assert(which == "B"); +which = ""; +a.b(1); +assert(which == "B"); +which = ""; +a.c; +assert(which == "B"); +which = ""; +a.c = 1; +assert(which == "B"); + +class C extends B { + a(a: T): void { // overload + super.a(a); + assert(which == "B"); + which = "C"; + } + b(b: i32): void { // overload + which = "C"; + } + get c(): i32 { // overload + which = "C"; + return 0; + } + set c(c: i32) { // overload + which = "C"; + } } -// FIXME: this results in a call to Foo.baz instead of Bar.baz above. -// ultimately, overloaded functions should implicitly become virtual. -test(changetype(0)); + +// Should call non-virtual super +var c = new C(); +which = ""; +c.a(1); +assert(which == "C"); +which = ""; +c.b(1); +assert(which == "C"); +which = ""; +c.c; +assert(which == "C"); +c.c = 1; +assert(which == "C"); + +class D extends B { + // inherits B's +} + +// Should call inherited overload +a = new D(); +which = ""; +a.a(1); +assert(which == "B"); +which = ""; +a.b(1); +assert(which == "B"); +which = ""; +a.c; +assert(which == "B"); +a.c = 1; +assert(which == "B"); + +class E extends D { + // inherits B's +} + +// Should still call inherited overload +a = new E(); +which = ""; +a.a(1); +assert(which == "B"); +which = ""; +a.b(1); +assert(which == "B"); +which = ""; +a.c; +assert(which == "B"); +a.c = 1; +assert(which == "B"); + +class F extends E { + a(a: T): void { // overload + which = "F"; + } + b(b: i32): void { // overload + which = "F"; + } + get c(): i32 { // overload + which = "F"; + return 0; + } + set c(c: i32) { // overload + which = "F"; + } +} + +// Should no longer call inherited overload +a = new F(); +which = ""; +a.a(1); +assert(which == "F"); +which = ""; +a.b(1); +assert(which == "F"); +which = ""; +a.c; +assert(which == "F"); +which = ""; +a.c = 1; +assert(which == "F"); + +// Should work with interfaces +interface IA { + foo(): void; +} + +class CA implements IA { + foo(): void { + which = "IB"; + } +} + +var ia: IA = new CA(); +which = ""; +ia.foo(); +assert(which == "IB"); + +// Should work with extended interfaces +interface IC extends IA { +} + +class CC implements IC { + foo(): void { + which = "IC"; + } +} + +var ic: IC = new CC(); +which = ""; +ic.foo(); +assert(which == "IC"); diff --git a/tests/compiler/class-overloading.untouched.wat b/tests/compiler/class-overloading.untouched.wat index 8fc4f2ba84..ff606fff0b 100644 --- a/tests/compiler/class-overloading.untouched.wat +++ b/tests/compiler/class-overloading.untouched.wat @@ -1,35 +1,1375 @@ (module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (memory $0 0) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") + (data (i32.const 32) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00A\00") + (data (i32.const 64) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00B\00") + (data (i32.const 96) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00c\00l\00a\00s\00s\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 160) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00C\00") + (data (i32.const 192) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00F\00") + (data (i32.const 224) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00I\00B\00") + (data (i32.const 256) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00I\00C\00") (table $0 1 funcref) + (global $class-overloading/which (mut i32) (i32.const 32)) + (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) + (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (global $class-overloading/a (mut i32) (i32.const 0)) + (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $class-overloading/c (mut i32) (i32.const 0)) + (global $class-overloading/ia (mut i32) (i32.const 0)) + (global $class-overloading/ic (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/heap/__heap_base i32 (i32.const 276)) + (export "_start" (func $~start)) (export "memory" (memory $0)) - (export "test" (func $class-overloading/test)) - (start $~start) + (func $~lib/rt/stub/maybeGrowMemory (param $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + memory.size + local.set $1 + local.get $1 + i32.const 16 + i32.shl + local.set $2 + local.get $0 + local.get $2 + i32.gt_u + if + local.get $0 + local.get $2 + i32.sub + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $1 + local.tee $4 + local.get $3 + local.tee $5 + local.get $4 + local.get $5 + i32.gt_s + select + local.set $4 + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $3 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + end + local.get $0 + global.set $~lib/rt/stub/offset + ) + (func $~lib/rt/stub/__alloc (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 + i32.const 1073741808 + i32.gt_u + if + unreachable + end + global.get $~lib/rt/stub/offset + i32.const 16 + i32.add + local.set $2 + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $3 + i32.const 16 + local.tee $4 + local.get $3 + local.get $4 + i32.gt_u + select + local.set $5 + local.get $2 + local.get $5 + i32.add + call $~lib/rt/stub/maybeGrowMemory + local.get $2 + i32.const 16 + i32.sub + local.set $6 + local.get $6 + local.get $5 + i32.store + i32.const 1 + drop + local.get $6 + i32.const 1 + i32.store offset=4 + local.get $6 + local.get $1 + i32.store offset=8 + local.get $6 + local.get $0 + i32.store offset=12 + local.get $2 + ) (func $~lib/rt/stub/__retain (param $0 i32) (result i32) local.get $0 ) - (func $class-overloading/Foo#baz (param $0 i32) - nop + (func $class-overloading/A#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 3 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + ) + (func $class-overloading/B#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 4 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + call $class-overloading/A#constructor + local.set $0 + local.get $0 ) (func $~lib/rt/stub/__release (param $0 i32) nop ) - (func $class-overloading/test (param $0 i32) + (func $class-overloading/A#a (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 48 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $~lib/string/String#get:length (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 1 + i32.shr_u + ) + (func $~lib/util/string/compareImpl (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + local.get $0 + call $~lib/rt/stub/__retain + local.set $0 + local.get $2 + call $~lib/rt/stub/__retain + local.set $2 + local.get $0 + local.get $1 + i32.const 1 + i32.shl + i32.add + local.set $5 + local.get $2 + local.get $3 + i32.const 1 + i32.shl + i32.add + local.set $6 + i32.const 0 + i32.const 2 + i32.lt_s + drop + local.get $4 + i32.const 4 + i32.ge_u + if (result i32) + local.get $5 + i32.const 7 + i32.and + local.get $6 + i32.const 7 + i32.and + i32.or + i32.eqz + else + i32.const 0 + end + if + block $do-break|0 + loop $do-continue|0 + local.get $5 + i64.load + local.get $6 + i64.load + i64.ne + if + br $do-break|0 + end + local.get $5 + i32.const 8 + i32.add + local.set $5 + local.get $6 + i32.const 8 + i32.add + local.set $6 + local.get $4 + i32.const 4 + i32.sub + local.set $4 + local.get $4 + i32.const 4 + i32.ge_u + local.set $7 + local.get $7 + br_if $do-continue|0 + end + end + end + loop $while-continue|1 + local.get $4 + local.tee $7 + i32.const 1 + i32.sub + local.set $4 + local.get $7 + local.set $7 + local.get $7 + if + local.get $5 + i32.load16_u + local.set $8 + local.get $6 + i32.load16_u + local.set $9 + local.get $8 + local.get $9 + i32.ne + if + local.get $8 + local.get $9 + i32.sub + local.set $10 + local.get $0 + call $~lib/rt/stub/__release + local.get $2 + call $~lib/rt/stub/__release + local.get $10 + return + end + local.get $5 + i32.const 2 + i32.add + local.set $5 + local.get $6 + i32.const 2 + i32.add + local.set $6 + br $while-continue|1 + end + end + i32.const 0 + local.set $7 + local.get $0 + call $~lib/rt/stub/__release + local.get $2 + call $~lib/rt/stub/__release + local.get $7 + ) + (func $~lib/string/String.__eq (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) local.get $0 call $~lib/rt/stub/__retain local.set $0 + local.get $1 + call $~lib/rt/stub/__retain + local.set $1 + local.get $0 + local.get $1 + i32.eq + if + i32.const 1 + local.set $2 + local.get $0 + call $~lib/rt/stub/__release + local.get $1 + call $~lib/rt/stub/__release + local.get $2 + return + end + local.get $0 + i32.const 0 + i32.eq + if (result i32) + i32.const 1 + else + local.get $1 + i32.const 0 + i32.eq + end + if + i32.const 0 + local.set $2 + local.get $0 + call $~lib/rt/stub/__release + local.get $1 + call $~lib/rt/stub/__release + local.get $2 + return + end + local.get $0 + call $~lib/string/String#get:length + local.set $3 + local.get $3 + local.get $1 + call $~lib/string/String#get:length + i32.ne + if + i32.const 0 + local.set $2 + local.get $0 + call $~lib/rt/stub/__release + local.get $1 + call $~lib/rt/stub/__release + local.get $2 + return + end + local.get $0 + i32.const 0 + local.get $1 + i32.const 0 + local.get $3 + call $~lib/util/string/compareImpl + i32.eqz + local.set $2 + local.get $0 + call $~lib/rt/stub/__release + local.get $1 + call $~lib/rt/stub/__release + local.get $2 + ) + (func $class-overloading/A#b (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 48 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/A#get:c (param $0 i32) (result i32) + (local $1 i32) + i32.const 48 + local.set $1 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $1 + global.set $class-overloading/which + i32.const 0 + ) + (func $class-overloading/A#set:c (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 48 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/C#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 5 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + call $class-overloading/B#constructor + local.set $0 local.get $0 - call $class-overloading/Foo#baz + ) + (func $class-overloading/B#a (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 80 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/C#a (param $0 i32) (param $1 i32) + (local $2 i32) local.get $0 + local.get $1 + call $class-overloading/B#a + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 52 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + i32.const 176 + local.set $2 + global.get $class-overloading/which call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/C#b (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 176 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/C#get:c (param $0 i32) (result i32) + (local $1 i32) + i32.const 176 + local.set $1 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $1 + global.set $class-overloading/which + i32.const 0 + ) + (func $class-overloading/C#set:c (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 176 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/D#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 6 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + call $class-overloading/B#constructor + local.set $0 + local.get $0 + ) + (func $class-overloading/E#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 7 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + call $class-overloading/D#constructor + local.set $0 + local.get $0 + ) + (func $class-overloading/F#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 8 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + call $class-overloading/E#constructor + local.set $0 + local.get $0 + ) + (func $class-overloading/CA#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 10 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + ) + (func $class-overloading/IA#foo (param $0 i32) + unreachable + ) + (func $class-overloading/CC#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 12 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 ) (func $start:class-overloading + (local $0 i32) + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + global.set $~lib/rt/stub/startOffset + global.get $~lib/rt/stub/startOffset + global.set $~lib/rt/stub/offset + i32.const 0 + call $class-overloading/B#constructor + global.set $class-overloading/a + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 38 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 41 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#get:c@virtual + drop + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 44 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#set:c@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 47 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/C#constructor + global.set $class-overloading/c + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/c + i32.const 1 + call $class-overloading/C#a + global.get $class-overloading/which + i32.const 176 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 71 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/c + i32.const 1 + call $class-overloading/C#b + global.get $class-overloading/which + i32.const 176 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 74 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/c + call $class-overloading/C#get:c + drop + global.get $class-overloading/which + i32.const 176 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 77 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $class-overloading/c + i32.const 1 + call $class-overloading/C#set:c + global.get $class-overloading/which + i32.const 176 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 79 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/D#constructor + local.set $0 + global.get $class-overloading/a + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/a + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 89 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 92 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#get:c@virtual + drop + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 95 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#set:c@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 97 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/E#constructor + local.set $0 + global.get $class-overloading/a + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/a + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 107 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 110 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#get:c@virtual + drop + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 113 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#set:c@virtual + global.get $class-overloading/which + i32.const 80 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 115 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/F#constructor + local.set $0 + global.get $class-overloading/a + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/a + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#a@virtual + global.get $class-overloading/which + i32.const 208 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 137 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#b@virtual + global.get $class-overloading/which + i32.const 208 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 140 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + call $class-overloading/A#get:c@virtual + drop + global.get $class-overloading/which + i32.const 208 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 143 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/a + i32.const 1 + call $class-overloading/A#set:c@virtual + global.get $class-overloading/which + i32.const 208 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 146 + i32.const 1 + call $~lib/builtins/abort + unreachable + end i32.const 0 - call $class-overloading/test + call $class-overloading/CA#constructor + global.set $class-overloading/ia + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/ia + call $class-overloading/IA#foo@virtual + global.get $class-overloading/which + i32.const 240 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 162 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $class-overloading/CC#constructor + global.set $class-overloading/ic + i32.const 32 + local.set $0 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $0 + global.set $class-overloading/which + global.get $class-overloading/ic + call $class-overloading/IA#foo@virtual + global.get $class-overloading/which + i32.const 272 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 177 + i32.const 1 + call $~lib/builtins/abort + unreachable + end ) (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end call $start:class-overloading ) + (func $class-overloading/F#a (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 208 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/A#a@virtual (param $0 i32) (param $1 i32) + (local $2 i32) + block $default + block $case2 + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.set $2 + local.get $2 + i32.const 4 + i32.eq + br_if $case0 + local.get $2 + i32.const 6 + i32.eq + br_if $case0 + local.get $2 + i32.const 7 + i32.eq + br_if $case0 + local.get $2 + i32.const 5 + i32.eq + br_if $case1 + local.get $2 + i32.const 8 + i32.eq + br_if $case2 + br $default + end + local.get $0 + local.get $1 + call $class-overloading/B#a + return + end + local.get $0 + local.get $1 + call $class-overloading/C#a + return + end + local.get $0 + local.get $1 + call $class-overloading/F#a + return + end + local.get $0 + local.get $1 + call $class-overloading/A#a + ) + (func $class-overloading/B#b (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 80 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/F#b (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 208 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/A#b@virtual (param $0 i32) (param $1 i32) + (local $2 i32) + block $default + block $case2 + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.set $2 + local.get $2 + i32.const 4 + i32.eq + br_if $case0 + local.get $2 + i32.const 6 + i32.eq + br_if $case0 + local.get $2 + i32.const 7 + i32.eq + br_if $case0 + local.get $2 + i32.const 5 + i32.eq + br_if $case1 + local.get $2 + i32.const 8 + i32.eq + br_if $case2 + br $default + end + local.get $0 + local.get $1 + call $class-overloading/B#b + return + end + local.get $0 + local.get $1 + call $class-overloading/C#b + return + end + local.get $0 + local.get $1 + call $class-overloading/F#b + return + end + local.get $0 + local.get $1 + call $class-overloading/A#b + ) + (func $class-overloading/B#get:c (param $0 i32) (result i32) + (local $1 i32) + i32.const 80 + local.set $1 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $1 + global.set $class-overloading/which + i32.const 0 + ) + (func $class-overloading/F#get:c (param $0 i32) (result i32) + (local $1 i32) + i32.const 208 + local.set $1 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $1 + global.set $class-overloading/which + i32.const 0 + ) + (func $class-overloading/A#get:c@virtual (param $0 i32) (result i32) + (local $1 i32) + block $default + block $case2 + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.set $1 + local.get $1 + i32.const 4 + i32.eq + br_if $case0 + local.get $1 + i32.const 6 + i32.eq + br_if $case0 + local.get $1 + i32.const 7 + i32.eq + br_if $case0 + local.get $1 + i32.const 5 + i32.eq + br_if $case1 + local.get $1 + i32.const 8 + i32.eq + br_if $case2 + br $default + end + local.get $0 + call $class-overloading/B#get:c + return + end + local.get $0 + call $class-overloading/C#get:c + return + end + local.get $0 + call $class-overloading/F#get:c + return + end + local.get $0 + call $class-overloading/A#get:c + ) + (func $class-overloading/B#set:c (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 80 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/F#set:c (param $0 i32) (param $1 i32) + (local $2 i32) + i32.const 208 + local.set $2 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $2 + global.set $class-overloading/which + ) + (func $class-overloading/A#set:c@virtual (param $0 i32) (param $1 i32) + (local $2 i32) + block $default + block $case2 + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.set $2 + local.get $2 + i32.const 4 + i32.eq + br_if $case0 + local.get $2 + i32.const 6 + i32.eq + br_if $case0 + local.get $2 + i32.const 7 + i32.eq + br_if $case0 + local.get $2 + i32.const 5 + i32.eq + br_if $case1 + local.get $2 + i32.const 8 + i32.eq + br_if $case2 + br $default + end + local.get $0 + local.get $1 + call $class-overloading/B#set:c + return + end + local.get $0 + local.get $1 + call $class-overloading/C#set:c + return + end + local.get $0 + local.get $1 + call $class-overloading/F#set:c + return + end + local.get $0 + local.get $1 + call $class-overloading/A#set:c + ) + (func $class-overloading/CA#foo (param $0 i32) + (local $1 i32) + i32.const 240 + local.set $1 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $1 + global.set $class-overloading/which + ) + (func $class-overloading/CC#foo (param $0 i32) + (local $1 i32) + i32.const 272 + local.set $1 + global.get $class-overloading/which + call $~lib/rt/stub/__release + local.get $1 + global.set $class-overloading/which + ) + (func $class-overloading/IA#foo@virtual (param $0 i32) + (local $1 i32) + block $default + block $case1 + block $case0 + local.get $0 + i32.const 8 + i32.sub + i32.load + local.set $1 + local.get $1 + i32.const 10 + i32.eq + br_if $case0 + local.get $1 + i32.const 12 + i32.eq + br_if $case1 + br $default + end + local.get $0 + call $class-overloading/CA#foo + return + end + local.get $0 + call $class-overloading/CC#foo + return + end + unreachable + ) ) diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index dd9f0d2a4d..f9d5a4c462 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -20,7 +20,7 @@ (export "memory" (memory $0)) (export "add" (func $exports/add)) (export "__setArgumentsLength" (func $~setArgumentsLength)) - (export "subOpt" (func $exports/subOpt|trampoline)) + (export "subOpt" (func $exports/subOpt@varargs)) (export "math.sub" (func $exports/subOpt)) (export "Animal.CAT" (global $exports/Animal.CAT)) (export "Animal.DOG" (global $exports/Animal.DOG)) @@ -29,7 +29,7 @@ (export "Car" (global $exports/Car)) (export "Car#get:doors" (func $exports/Car#get:doors)) (export "Car#set:doors" (func $exports/Car#set:doors)) - (export "Car#constructor" (func $exports/Car#constructor|trampoline)) + (export "Car#constructor" (func $exports/Car#constructor@varargs)) (export "Car#get:numDoors" (func $exports/Car#get:doors)) (export "Car#set:numDoors" (func $exports/Car#set:doors)) (export "Car#openDoors" (func $exports/Car#openDoors)) @@ -38,7 +38,7 @@ (export "vehicles.Car" (global $exports/vehicles.Car)) (export "vehicles.Car#get:doors" (func $exports/Car#get:doors)) (export "vehicles.Car#set:doors" (func $exports/Car#set:doors)) - (export "vehicles.Car#constructor" (func $exports/vehicles.Car#constructor|trampoline)) + (export "vehicles.Car#constructor" (func $exports/vehicles.Car#constructor@varargs)) (export "vehicles.Car#get:numDoors" (func $exports/Car#get:doors)) (export "vehicles.Car#set:numDoors" (func $exports/Car#set:doors)) (export "vehicles.Car#openDoors" (func $exports/Car#openDoors)) @@ -141,7 +141,7 @@ i32.const 1024 global.set $~lib/rt/stub/offset ) - (func $exports/subOpt|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $exports/subOpt@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -163,7 +163,7 @@ local.get $0 global.set $~argumentsLength ) - (func $exports/Car#constructor|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $exports/Car#constructor@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -190,7 +190,7 @@ i32.store local.get $0 ) - (func $exports/vehicles.Car#constructor|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $exports/vehicles.Car#constructor@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange diff --git a/tests/compiler/exports.untouched.wat b/tests/compiler/exports.untouched.wat index 413f87254b..693bf3d61d 100644 --- a/tests/compiler/exports.untouched.wat +++ b/tests/compiler/exports.untouched.wat @@ -23,7 +23,7 @@ (export "memory" (memory $0)) (export "add" (func $exports/add)) (export "__setArgumentsLength" (func $~setArgumentsLength)) - (export "subOpt" (func $exports/subOpt|trampoline)) + (export "subOpt" (func $exports/subOpt@varargs)) (export "math.sub" (func $exports/math.sub)) (export "Animal.CAT" (global $exports/Animal.CAT)) (export "Animal.DOG" (global $exports/Animal.DOG)) @@ -32,7 +32,7 @@ (export "Car" (global $exports/Car)) (export "Car#get:doors" (func $exports/Car#get:doors)) (export "Car#set:doors" (func $exports/Car#set:doors)) - (export "Car#constructor" (func $exports/Car#constructor|trampoline)) + (export "Car#constructor" (func $exports/Car#constructor@varargs)) (export "Car#get:numDoors" (func $exports/Car#get:numDoors)) (export "Car#set:numDoors" (func $exports/Car#set:numDoors)) (export "Car#openDoors" (func $exports/Car#openDoors)) @@ -41,7 +41,7 @@ (export "vehicles.Car" (global $exports/vehicles.Car)) (export "vehicles.Car#get:doors" (func $exports/vehicles.Car#get:doors)) (export "vehicles.Car#set:doors" (func $exports/vehicles.Car#set:doors)) - (export "vehicles.Car#constructor" (func $exports/vehicles.Car#constructor|trampoline)) + (export "vehicles.Car#constructor" (func $exports/vehicles.Car#constructor@varargs)) (export "vehicles.Car#get:numDoors" (func $exports/vehicles.Car#get:numDoors)) (export "vehicles.Car#set:numDoors" (func $exports/vehicles.Car#set:numDoors)) (export "vehicles.Car#openDoors" (func $exports/vehicles.Car#openDoors)) @@ -272,7 +272,7 @@ global.get $~lib/rt/stub/startOffset global.set $~lib/rt/stub/offset ) - (func $exports/subOpt|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $exports/subOpt@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -294,7 +294,7 @@ local.get $0 global.set $~argumentsLength ) - (func $exports/Car#constructor|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $exports/Car#constructor@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -310,7 +310,7 @@ local.get $1 call $exports/Car#constructor ) - (func $exports/vehicles.Car#constructor|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $exports/vehicles.Car#constructor@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange diff --git a/tests/compiler/function-expression.untouched.wat b/tests/compiler/function-expression.untouched.wat index 55612b5c88..312ae9604f 100644 --- a/tests/compiler/function-expression.untouched.wat +++ b/tests/compiler/function-expression.untouched.wat @@ -40,10 +40,10 @@ i32.add ) (func $function-expression/testOmitted (param $0 i32) (result i32) - i32.const 2 - global.set $~argumentsLength i32.const 1 i32.const 2 + i32.const 2 + global.set $~argumentsLength local.get $0 call_indirect (type $i32_i32_=>_i32) ) @@ -89,8 +89,8 @@ ) (func $start:function-expression i32.const 1 - global.set $~argumentsLength i32.const 1 + global.set $~argumentsLength global.get $function-expression/f1 call_indirect (type $i32_=>_i32) i32.const 1 @@ -104,9 +104,9 @@ call $~lib/builtins/abort unreachable end + i32.const 2 i32.const 1 global.set $~argumentsLength - i32.const 2 global.get $function-expression/f2 call_indirect (type $i32_=>_i32) i32.const 2 @@ -178,10 +178,10 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength i32.const 1 i32.const 2 + i32.const 2 + global.set $~argumentsLength call $function-expression/testOmittedReturn1 call_indirect (type $i32_i32_=>_i32) i32.const 3 @@ -195,10 +195,10 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength i32.const 1 i32.const 2 + i32.const 2 + global.set $~argumentsLength call $function-expression/testOmittedReturn2 call_indirect (type $i32_i32_=>_i32) i32.const 1 @@ -212,10 +212,10 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength i32.const 1 i32.const 2 + i32.const 2 + global.set $~argumentsLength call $function-expression/testOmittedReturn3 call_indirect (type $i32_i32_=>_i32) i32.const 42 diff --git a/tests/compiler/function-types.untouched.wat b/tests/compiler/function-types.untouched.wat index cedbc530d8..152d0540ce 100644 --- a/tests/compiler/function-types.untouched.wat +++ b/tests/compiler/function-types.untouched.wat @@ -47,18 +47,18 @@ i32.const 3 ) (func $function-types/doAddWithFn (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $1 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) ) (func $function-types/doAdd (param $0 i32) (param $1 i32) (result i32) - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $1 + i32.const 2 + global.set $~argumentsLength call $function-types/makeAdder call_indirect (type $i32_i32_=>_i32) ) @@ -68,14 +68,14 @@ i32.add ) (func $function-types/makeAndAdd (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $1 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) ) - (func $function-types/makeAndAdd|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $function-types/makeAndAdd@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -97,10 +97,10 @@ (func $start:function-types call $function-types/makeAdder global.set $function-types/i32Adder - i32.const 2 - global.set $~argumentsLength i32.const 1 i32.const 2 + i32.const 2 + global.set $~argumentsLength global.get $function-types/i32Adder call_indirect (type $i32_i32_=>_i32) i32.const 3 @@ -116,10 +116,10 @@ end call $function-types/makeAdder global.set $function-types/i64Adder - i32.const 2 - global.set $~argumentsLength i64.const 10 i64.const 20 + i32.const 2 + global.set $~argumentsLength global.get $function-types/i64Adder call_indirect (type $i64_i64_=>_i64) i64.const 30 @@ -133,10 +133,10 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength f64.const 1.5 f64.const 2.5 + i32.const 2 + global.set $~argumentsLength call $function-types/makeAdder call_indirect (type $f64_f64_=>_f64) f64.const 4 @@ -194,12 +194,12 @@ call $~lib/builtins/abort unreachable end - i32.const 2 - global.set $~argumentsLength i32.const 1 i32.const 2 + i32.const 2 + global.set $~argumentsLength i32.const 0 - call $function-types/makeAndAdd|trampoline + call $function-types/makeAndAdd@varargs i32.const 3 i32.eq i32.eqz diff --git a/tests/compiler/getter-setter.untouched.wat b/tests/compiler/getter-setter.untouched.wat index be6c6a5130..5c91033b3e 100644 --- a/tests/compiler/getter-setter.untouched.wat +++ b/tests/compiler/getter-setter.untouched.wat @@ -10,15 +10,15 @@ (global $getter-setter/Foo._bar (mut i32) (i32.const 0)) (export "memory" (memory $0)) (start $~start) - (func $getter-setter/Foo.bar.get:bar (result i32) + (func $getter-setter/Foo.get:bar (result i32) global.get $getter-setter/Foo._bar ) - (func $getter-setter/Foo.bar.set:bar (param $0 i32) + (func $getter-setter/Foo.set:bar (param $0 i32) local.get $0 global.set $getter-setter/Foo._bar ) (func $start:getter-setter - call $getter-setter/Foo.bar.get:bar + call $getter-setter/Foo.get:bar i32.const 0 i32.eq i32.eqz @@ -31,8 +31,8 @@ unreachable end i32.const 1 - call $getter-setter/Foo.bar.set:bar - call $getter-setter/Foo.bar.get:bar + call $getter-setter/Foo.set:bar + call $getter-setter/Foo.get:bar i32.const 1 i32.eq i32.eqz @@ -45,8 +45,8 @@ unreachable end i32.const 2 - call $getter-setter/Foo.bar.set:bar - call $getter-setter/Foo.bar.get:bar + call $getter-setter/Foo.set:bar + call $getter-setter/Foo.get:bar i32.const 2 i32.eq i32.eqz diff --git a/tests/compiler/infer-generic.untouched.wat b/tests/compiler/infer-generic.untouched.wat index a47b7995d3..bcd554ce9b 100644 --- a/tests/compiler/infer-generic.untouched.wat +++ b/tests/compiler/infer-generic.untouched.wat @@ -84,8 +84,6 @@ local.set $6 local.get $6 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $0 i32.load offset=4 @@ -96,6 +94,8 @@ f32.load local.get $4 local.get $0 + i32.const 4 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_f32_i32_i32_=>_i32) local.set $3 diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index be17ca72c0..4430c685bd 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -166,9 +166,9 @@ drop i32.const 0 local.set $2 + i32.const 2 i32.const 1 global.set $~argumentsLength - i32.const 2 i32.const 1 call_indirect (type $i32_=>_i32) i32.const 2 diff --git a/tests/compiler/resolve-elementaccess.optimized.wat b/tests/compiler/resolve-elementaccess.optimized.wat index 120f673d1e..e3812e440d 100644 --- a/tests/compiler/resolve-elementaccess.optimized.wat +++ b/tests/compiler/resolve-elementaccess.optimized.wat @@ -297,7 +297,7 @@ if i32.const 1040 i32.const 1088 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.untouched.wat b/tests/compiler/resolve-elementaccess.untouched.wat index 9cde3779ed..34ec5fba67 100644 --- a/tests/compiler/resolve-elementaccess.untouched.wat +++ b/tests/compiler/resolve-elementaccess.untouched.wat @@ -393,7 +393,7 @@ if i32.const 32 i32.const 80 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-function-expression.untouched.wat b/tests/compiler/resolve-function-expression.untouched.wat index a2ed82ad7f..3e35a909ed 100644 --- a/tests/compiler/resolve-function-expression.untouched.wat +++ b/tests/compiler/resolve-function-expression.untouched.wat @@ -636,9 +636,9 @@ ) (func $start:resolve-function-expression (local $0 i32) + i32.const 2 i32.const 1 global.set $~argumentsLength - i32.const 2 i32.const 1 call_indirect (type $i32_=>_i32) i32.const 42 @@ -653,8 +653,8 @@ unreachable end i32.const 1 - global.set $~argumentsLength i32.const 1 + global.set $~argumentsLength i32.const 2 call_indirect (type $i32_=>_i32) i32.const 42 @@ -678,9 +678,9 @@ global.set $~lib/rt/stub/startOffset global.get $~lib/rt/stub/startOffset global.set $~lib/rt/stub/offset + i32.const 0 i32.const 1 global.set $~argumentsLength - i32.const 0 i32.const 3 call_indirect (type $i32_=>_i32) call $~lib/number/I32#toString diff --git a/tests/compiler/resolve-ternary.untouched.wat b/tests/compiler/resolve-ternary.untouched.wat index 58b3a26172..4cc9ba29ab 100644 --- a/tests/compiler/resolve-ternary.untouched.wat +++ b/tests/compiler/resolve-ternary.untouched.wat @@ -4857,8 +4857,8 @@ unreachable end i32.const 1 - global.set $~argumentsLength i32.const 1 + global.set $~argumentsLength global.get $resolve-ternary/b if (result i32) global.get $resolve-ternary/f1 @@ -4878,8 +4878,8 @@ unreachable end i32.const 1 - global.set $~argumentsLength i32.const 1 + global.set $~argumentsLength global.get $resolve-ternary/b if (result i32) i32.const 3 @@ -4899,8 +4899,8 @@ unreachable end i32.const 1 - global.set $~argumentsLength i32.const 1 + global.set $~argumentsLength global.get $resolve-ternary/b if (result i32) global.get $resolve-ternary/f2 diff --git a/tests/compiler/retain-release.untouched.wat b/tests/compiler/retain-release.untouched.wat index 522180fd90..fe6edfb276 100644 --- a/tests/compiler/retain-release.untouched.wat +++ b/tests/compiler/retain-release.untouched.wat @@ -780,9 +780,9 @@ global.set $~argumentsLength ) (func $retain-release/provideRefIndirect (param $0 i32) + global.get $retain-release/REF i32.const 1 global.set $~argumentsLength - global.get $retain-release/REF local.get $0 call_indirect (type $i32_=>_none) ) diff --git a/tests/compiler/retain-return.untouched.wat b/tests/compiler/retain-return.untouched.wat index f5aa0900ed..b4dcef0dd6 100644 --- a/tests/compiler/retain-return.untouched.wat +++ b/tests/compiler/retain-return.untouched.wat @@ -1620,15 +1620,15 @@ global.get $retain-return/returnNewFnExpr call_indirect (type $none_=>_i32) call $~lib/rt/pure/__release + global.get $retain-return/ref i32.const 1 global.set $~argumentsLength - global.get $retain-return/ref global.get $retain-return/returnLocalFnExpr call_indirect (type $i32_=>_i32) call $~lib/rt/pure/__release + global.get $retain-return/ref i32.const 1 global.set $~argumentsLength - global.get $retain-return/ref global.get $retain-return/returnLocalFnExpr call_indirect (type $i32_=>_i32) call $~lib/rt/pure/__release diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 37d2f8ff27..d1cec40ab1 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -2970,15 +2970,15 @@ (local $4 i32) local.get $0 i32.load offset=12 - local.set $3 + local.set $4 loop $for-loop|0 local.get $2 - local.get $3 + local.get $4 local.get $0 i32.load offset=12 - local.tee $4 - local.get $3 + local.tee $3 local.get $4 + local.get $3 i32.lt_s select i32.lt_s @@ -2990,6 +2990,7 @@ i32.shl i32.add i32.load + local.tee $3 local.get $2 local.get $0 local.get $1 @@ -3044,15 +3045,15 @@ (local $4 i32) local.get $0 i32.load offset=12 - local.set $3 + local.set $4 loop $for-loop|0 local.get $2 - local.get $3 + local.get $4 local.get $0 i32.load offset=12 - local.tee $4 - local.get $3 + local.tee $3 local.get $4 + local.get $3 i32.lt_s select i32.lt_s @@ -3064,6 +3065,7 @@ i32.shl i32.add i32.load + local.tee $3 local.get $2 local.get $0 local.get $1 @@ -3119,15 +3121,15 @@ (local $4 i32) local.get $0 i32.load offset=12 - local.set $3 + local.set $4 loop $for-loop|0 local.get $2 - local.get $3 + local.get $4 local.get $0 i32.load offset=12 - local.tee $4 - local.get $3 + local.tee $3 local.get $4 + local.get $3 i32.lt_s select i32.lt_s @@ -3139,6 +3141,7 @@ i32.shl i32.add i32.load + local.tee $3 local.get $2 local.get $0 local.get $1 @@ -3194,15 +3197,15 @@ (local $4 i32) local.get $0 i32.load offset=12 - local.set $3 + local.set $4 loop $for-loop|0 local.get $2 - local.get $3 + local.get $4 local.get $0 i32.load offset=12 - local.tee $4 - local.get $3 + local.tee $3 local.get $4 + local.get $3 i32.lt_s select i32.lt_s @@ -3214,6 +3217,7 @@ i32.shl i32.add i32.load + local.tee $3 local.get $2 local.get $0 local.get $1 @@ -3378,6 +3382,7 @@ (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $0 i32.load offset=12 local.tee $4 @@ -3405,13 +3410,15 @@ i32.const 2 i32.shl local.tee $3 - local.get $6 - i32.add - local.get $3 local.get $0 i32.load offset=4 i32.add i32.load + local.set $7 + local.get $3 + local.get $6 + i32.add + local.get $7 local.get $2 local.get $0 local.get $1 @@ -3545,15 +3552,15 @@ (local $5 i32) local.get $0 i32.load offset=12 - local.set $4 + local.set $5 loop $for-loop|0 local.get $3 - local.get $4 + local.get $5 local.get $0 i32.load offset=12 - local.tee $5 - local.get $4 + local.tee $4 local.get $5 + local.get $4 i32.lt_s select i32.lt_s @@ -3566,6 +3573,7 @@ i32.shl i32.add i32.load + local.tee $4 local.get $3 local.get $0 local.get $1 @@ -3614,6 +3622,7 @@ ) (func $~lib/array/Array#reduceRight (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) + (local $4 i32) local.get $0 i32.load offset=12 i32.const 1 @@ -4825,6 +4834,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) + (local $6 i32) block $__inlined_func$std/array/isSorted (result i32) i32.const 1 local.set $2 @@ -5157,7 +5168,7 @@ local.get $1 call $~lib/array/Array<~lib/array/Array>#sort local.tee $5 - local.tee $0 + local.tee $4 i32.load offset=12 local.set $6 loop $for-loop|0 @@ -5165,31 +5176,31 @@ local.get $6 i32.lt_s if - local.get $0 + local.get $4 local.get $2 i32.const 1 i32.sub call $~lib/array/Array#__get - local.tee $3 - local.get $0 + local.tee $0 + local.get $4 local.get $2 call $~lib/array/Array#__get - local.tee $4 + local.tee $3 local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 i32.gt_s if - local.get $3 + local.get $0 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release i32.const 0 br $__inlined_func$std/array/isSorted<~lib/array/Array> end - local.get $3 + local.get $0 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $2 i32.const 1 @@ -9532,13 +9543,13 @@ (local $8 i32) (local $9 i32) (local $10 i32) - (local $11 f32) + (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 i32) - (local $15 i32) + (local $14 f32) + (local $15 f64) (local $16 i32) - (local $17 f64) + (local $17 i32) (local $18 i32) (local $19 i32) (local $20 i32) @@ -9622,13 +9633,13 @@ local.tee $0 local.get $1 i32.load - local.tee $3 + local.tee $4 i32.ne if local.get $0 call $~lib/rt/pure/__retain local.set $0 - local.get $3 + local.get $4 call $~lib/rt/pure/__release end local.get $1 @@ -9672,7 +9683,7 @@ i32.const 1472 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $1 call $std/array/isArraysEqual i32.eqz if @@ -9696,7 +9707,7 @@ i32.const 1568 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $1 + local.tee $2 call $std/array/isArraysEqual i32.eqz if @@ -9720,7 +9731,7 @@ i32.const 1600 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 call $std/array/isArraysEqual i32.eqz if @@ -9744,7 +9755,7 @@ i32.const 1632 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $4 call $std/array/isArraysEqual i32.eqz if @@ -9768,7 +9779,7 @@ i32.const 1664 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $9 + local.tee $5 call $std/array/isArraysEqual i32.eqz if @@ -9781,15 +9792,15 @@ end local.get $0 call $~lib/rt/pure/__release - local.get $2 - call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $4 + local.get $2 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $9 + local.get $4 + call $~lib/rt/pure/__release + local.get $5 call $~lib/rt/pure/__release i32.const 5 i32.const 2 @@ -9810,7 +9821,7 @@ i32.const 1744 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $1 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -9835,7 +9846,7 @@ i32.const 1792 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $1 + local.tee $2 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -9860,7 +9871,7 @@ i32.const 1840 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -9885,7 +9896,7 @@ i32.const 1888 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $4 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -9910,7 +9921,7 @@ i32.const 1936 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $9 + local.tee $5 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -9924,15 +9935,15 @@ end local.get $0 call $~lib/rt/pure/__release - local.get $2 - call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $4 + local.get $2 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $9 + local.get $4 + call $~lib/rt/pure/__release + local.get $5 call $~lib/rt/pure/__release global.get $std/array/arr i32.load offset=12 @@ -10195,11 +10206,11 @@ call $~lib/rt/pure/__retain local.tee $0 i32.load offset=4 - local.tee $2 + local.tee $1 i32.const 0 call $std/array/Ref#constructor i32.store - local.get $2 + local.get $1 i32.const 0 call $std/array/Ref#constructor i32.store offset=4 @@ -10251,11 +10262,11 @@ call $~lib/rt/pure/__release i32.const 0 call $~lib/array/Array#constructor - local.set $2 + local.set $1 global.get $std/array/arr - local.get $2 + local.get $1 call $~lib/array/Array#concat - local.set $1 + local.set $2 global.get $std/array/arr call $std/array/internalCapacity i32.const 3 @@ -10280,7 +10291,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.load offset=12 i32.const 3 i32.ne @@ -10292,14 +10303,14 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.const 0 i32.const 2 i32.const 3 i32.const 2032 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $4 call $~lib/array/Array#concat call $~lib/rt/pure/__release global.get $std/array/arr @@ -10314,7 +10325,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.const 0 call $~lib/array/Array#__get i32.const 43 @@ -10327,7 +10338,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.const 1 call $~lib/array/Array#__get i32.const 44 @@ -10340,7 +10351,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.const 2 call $~lib/array/Array#__get i32.const 45 @@ -10353,17 +10364,17 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.const 46 call $~lib/array/Array#push - local.get $2 + local.get $1 i32.const 47 call $~lib/array/Array#push global.get $std/array/arr - local.get $2 + local.get $1 call $~lib/array/Array#concat local.set $0 - local.get $1 + local.get $2 call $~lib/rt/pure/__release global.get $std/array/arr call $std/array/internalCapacity @@ -10377,7 +10388,7 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.load offset=12 i32.const 2 i32.ne @@ -10487,7 +10498,7 @@ i32.const 2048 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $1 + local.tee $2 i32.load offset=12 if i32.const 0 @@ -10497,13 +10508,13 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 global.get $std/array/arr call $~lib/array/Array#concat - local.set $4 + local.set $3 local.get $0 call $~lib/rt/pure/__release - local.get $4 + local.get $3 i32.load offset=12 i32.const 3 i32.ne @@ -10515,7 +10526,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.load offset=12 if i32.const 0 @@ -10525,13 +10536,13 @@ call $~lib/builtins/abort unreachable end - local.get $2 - call $~lib/rt/pure/__release - local.get $4 + local.get $1 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $1 + local.get $4 + call $~lib/rt/pure/__release + local.get $2 call $~lib/rt/pure/__release i32.const 5 i32.const 2 @@ -10539,19 +10550,19 @@ i32.const 2064 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $1 i32.const 0 i32.const 3 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $1 + local.tee $2 i32.const 5 i32.const 2 i32.const 3 i32.const 2112 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10570,21 +10581,21 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $0 - local.get $2 + local.get $1 call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.const 3 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $3 + local.tee $4 i32.const 5 i32.const 2 i32.const 3 i32.const 2208 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $9 + local.tee $5 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10602,22 +10613,22 @@ i32.const 2256 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $2 + local.set $1 local.get $0 call $~lib/rt/pure/__release - local.get $2 + local.get $1 i32.const 1 i32.const 2 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $15 + local.tee $16 i32.const 5 i32.const 2 i32.const 3 i32.const 2304 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $7 + local.tee $20 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10635,9 +10646,9 @@ i32.const 2352 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.tee $2 + local.tee $1 i32.const 2 i32.const 2 i32.const 2147483647 @@ -10667,9 +10678,9 @@ i32.const 2448 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.tee $2 + local.tee $1 i32.const 0 i32.const 3 i32.const 4 @@ -10681,7 +10692,7 @@ i32.const 2496 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $10 + local.tee $9 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10699,21 +10710,21 @@ i32.const 2544 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.tee $2 + local.tee $1 i32.const 1 i32.const 3 i32.const 4 call $~lib/array/Array#copyWithin - local.tee $13 + local.tee $11 i32.const 5 i32.const 2 i32.const 3 i32.const 2592 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $16 + local.tee $13 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10731,9 +10742,9 @@ i32.const 2640 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.tee $2 + local.tee $1 i32.const 1 i32.const 2 i32.const 4 @@ -10745,7 +10756,7 @@ i32.const 2688 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $18 + local.tee $17 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10763,21 +10774,21 @@ i32.const 2736 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.tee $2 + local.tee $1 i32.const 0 i32.const -2 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $19 + local.tee $18 i32.const 5 i32.const 2 i32.const 3 i32.const 2784 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $20 + local.tee $19 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10795,14 +10806,14 @@ i32.const 2832 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.tee $2 + local.tee $1 i32.const 0 i32.const -2 i32.const -1 call $~lib/array/Array#copyWithin - local.tee $14 + local.tee $12 i32.const 5 i32.const 2 i32.const 3 @@ -10828,7 +10839,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $0 - local.get $2 + local.get $1 call $~lib/rt/pure/__release local.get $0 i32.const -4 @@ -10860,10 +10871,10 @@ i32.const 3024 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $2 + local.set $1 local.get $0 call $~lib/rt/pure/__release - local.get $2 + local.get $1 i32.const -4 i32.const -3 i32.const -1 @@ -10894,14 +10905,14 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $0 - local.get $2 + local.get $1 call $~lib/rt/pure/__release local.get $0 i32.const -4 i32.const -3 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $2 + local.tee $1 i32.const 5 i32.const 2 i32.const 3 @@ -10922,17 +10933,17 @@ end local.get $0 call $~lib/rt/pure/__release - local.get $1 - call $~lib/rt/pure/__release - local.get $4 + local.get $2 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $9 + local.get $4 + call $~lib/rt/pure/__release + local.get $5 call $~lib/rt/pure/__release - local.get $15 + local.get $16 call $~lib/rt/pure/__release - local.get $7 + local.get $20 call $~lib/rt/pure/__release local.get $25 call $~lib/rt/pure/__release @@ -10940,21 +10951,21 @@ call $~lib/rt/pure/__release local.get $8 call $~lib/rt/pure/__release - local.get $10 + local.get $9 call $~lib/rt/pure/__release - local.get $13 + local.get $11 call $~lib/rt/pure/__release - local.get $16 + local.get $13 call $~lib/rt/pure/__release local.get $30 call $~lib/rt/pure/__release + local.get $17 + call $~lib/rt/pure/__release local.get $18 call $~lib/rt/pure/__release local.get $19 call $~lib/rt/pure/__release - local.get $20 - call $~lib/rt/pure/__release - local.get $14 + local.get $12 call $~lib/rt/pure/__release local.get $21 call $~lib/rt/pure/__release @@ -10966,7 +10977,7 @@ call $~lib/rt/pure/__release local.get $26 call $~lib/rt/pure/__release - local.get $2 + local.get $1 call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release @@ -11142,9 +11153,9 @@ unreachable end global.get $std/array/arr - local.tee $2 - i32.load offset=12 local.tee $1 + i32.load offset=12 + local.tee $2 i32.const 1 i32.lt_s if @@ -11155,7 +11166,7 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.load offset=4 local.tee $0 i32.load @@ -11163,21 +11174,21 @@ local.get $0 i32.const 4 i32.add - local.get $1 + local.get $2 i32.const 1 i32.sub - local.tee $1 + local.tee $2 i32.const 2 i32.shl - local.tee $3 + local.tee $4 call $~lib/memory/memory.copy local.get $0 - local.get $3 + local.get $4 i32.add i32.const 0 i32.store - local.get $2 local.get $1 + local.get $2 i32.store offset=12 global.set $std/array/i global.get $std/array/i @@ -11345,16 +11356,16 @@ unreachable end global.get $std/array/arr - local.tee $2 - i32.load offset=12 local.tee $1 + i32.load offset=12 + local.tee $2 if - local.get $2 + local.get $1 i32.load offset=4 local.set $0 - local.get $2 - i32.load offset=4 local.get $1 + i32.load offset=4 + local.get $2 i32.const 1 i32.sub i32.const 2 @@ -11621,17 +11632,17 @@ i32.const 3216 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 - local.set $3 + local.tee $1 + local.set $4 i32.const 0 local.set $0 block $__inlined_func$~lib/array/Array#indexOf - local.get $2 + local.get $1 i32.load offset=12 - local.tee $1 + local.tee $2 if (result i32) i32.const 0 - local.get $1 + local.get $2 i32.ge_s else i32.const 1 @@ -11641,15 +11652,15 @@ local.set $0 br $__inlined_func$~lib/array/Array#indexOf end - local.get $3 + local.get $4 i32.load offset=4 - local.set $4 + local.set $3 loop $while-continue|022 local.get $0 - local.get $1 + local.get $2 i32.lt_s if - local.get $4 + local.get $3 local.get $0 i32.const 2 i32.shl @@ -11685,17 +11696,17 @@ i32.const 3248 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $1 - local.set $9 + local.tee $2 + local.set $5 i32.const 0 local.set $0 block $__inlined_func$~lib/array/Array#indexOf - local.get $1 + local.get $2 i32.load offset=12 - local.tee $4 + local.tee $3 if (result i32) i32.const 0 - local.get $4 + local.get $3 i32.ge_s else i32.const 1 @@ -11705,15 +11716,15 @@ local.set $0 br $__inlined_func$~lib/array/Array#indexOf end - local.get $9 + local.get $5 i32.load offset=4 - local.set $3 + local.set $4 loop $while-continue|023 local.get $0 - local.get $4 + local.get $3 i32.lt_s if - local.get $3 + local.get $4 local.get $0 i32.const 3 i32.shl @@ -11743,10 +11754,10 @@ call $~lib/builtins/abort unreachable end - local.get $2 - call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release + local.get $2 + call $~lib/rt/pure/__release global.get $std/array/arr i32.const 44 i32.const 0 @@ -11893,41 +11904,41 @@ i32.const 3280 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $2 i32.load offset=12 - local.tee $1 + local.tee $3 if (result i32) i32.const 0 - local.get $1 + local.get $3 i32.ge_s else i32.const 1 end br_if $__inlined_func$~lib/array/Array#includes drop - local.get $4 + local.get $2 i32.load offset=4 - local.set $9 + local.set $5 loop $while-continue|024 local.get $0 - local.get $1 + local.get $3 i32.lt_s if i32.const 1 - local.get $9 + local.get $5 local.get $0 i32.const 2 i32.shl i32.add f32.load - local.tee $11 + local.tee $14 f32.const nan:0x400000 f32.eq if (result i32) i32.const 1 else - local.get $11 - local.get $11 + local.get $14 + local.get $14 f32.ne end br_if $__inlined_func$~lib/array/Array#includes @@ -11960,41 +11971,41 @@ i32.const 3312 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 - i32.load offset=12 local.tee $3 + i32.load offset=12 + local.tee $4 if (result i32) i32.const 0 - local.get $3 + local.get $4 i32.ge_s else i32.const 1 end br_if $__inlined_func$~lib/array/Array#includes drop - local.get $2 + local.get $3 i32.load offset=4 - local.set $15 + local.set $16 loop $while-continue|025 local.get $1 - local.get $3 + local.get $4 i32.lt_s if i32.const 1 - local.get $15 + local.get $16 local.get $1 i32.const 3 i32.shl i32.add f64.load - local.tee $17 + local.tee $15 f64.const nan:0x8000000000000 f64.eq if (result i32) i32.const 1 else - local.get $17 - local.get $17 + local.get $15 + local.get $15 f64.ne end br_if $__inlined_func$~lib/array/Array#includes @@ -12072,28 +12083,28 @@ call $~lib/builtins/abort unreachable end - local.get $4 - call $~lib/rt/pure/__release local.get $2 call $~lib/rt/pure/__release + local.get $3 + call $~lib/rt/pure/__release i32.const 5 i32.const 2 i32.const 3 i32.const 3344 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $1 i32.const 0 i32.const 2147483647 call $~lib/array/Array#splice - local.tee $4 + local.tee $3 i32.const 5 i32.const 2 i32.const 3 i32.const 3392 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $4 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12105,14 +12116,14 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.const 0 i32.const 2 i32.const 3 i32.const 3440 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $7 + local.tee $5 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12131,7 +12142,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $0 - local.get $2 + local.get $1 call $~lib/rt/pure/__release local.get $0 i32.const 0 @@ -12163,7 +12174,7 @@ i32.const 3520 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $10 + local.tee $9 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12181,21 +12192,21 @@ i32.const 3568 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $2 + local.set $1 local.get $0 call $~lib/rt/pure/__release - local.get $2 + local.get $1 i32.const 2 i32.const 2147483647 call $~lib/array/Array#splice - local.tee $13 + local.tee $11 i32.const 3 i32.const 2 i32.const 3 i32.const 3616 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $16 + local.tee $13 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12207,14 +12218,14 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.const 2 i32.const 2 i32.const 3 i32.const 3648 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $18 + local.tee $17 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12232,21 +12243,21 @@ i32.const 3680 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $1 - local.get $2 - call $~lib/rt/pure/__release + local.set $2 local.get $1 + call $~lib/rt/pure/__release + local.get $2 i32.const 2 i32.const 2 call $~lib/array/Array#splice - local.tee $19 + local.tee $18 i32.const 2 i32.const 2 i32.const 3 i32.const 3728 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $20 + local.tee $19 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12258,14 +12269,14 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.const 3 i32.const 2 i32.const 3 i32.const 3760 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $14 + local.tee $12 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12284,7 +12295,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $0 - local.get $1 + local.get $2 call $~lib/rt/pure/__release local.get $0 i32.const 0 @@ -12634,10 +12645,10 @@ i32.const 4576 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $2 + local.set $1 local.get $0 call $~lib/rt/pure/__release - local.get $2 + local.get $1 i32.const 4 i32.const 0 call $~lib/array/Array#splice @@ -12660,7 +12671,7 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.const 5 i32.const 2 i32.const 3 @@ -12686,7 +12697,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $0 - local.get $2 + local.get $1 call $~lib/rt/pure/__release local.get $0 i32.const 7 @@ -12736,10 +12747,10 @@ i32.const 4800 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $2 + local.set $1 local.get $0 call $~lib/rt/pure/__release - local.get $2 + local.get $1 i32.const 7 i32.const 5 call $~lib/array/Array#splice @@ -12762,7 +12773,7 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $1 i32.const 5 i32.const 2 i32.const 3 @@ -12787,10 +12798,10 @@ i32.const 4912 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $1 + local.tee $2 i32.const 1 call $~lib/array/Array#splice - local.tee $15 + local.tee $20 i32.load offset=12 if i32.const 0 @@ -12800,7 +12811,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $2 i32.load offset=12 if i32.const 0 @@ -12816,7 +12827,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $9 + local.tee $16 i32.load offset=4 local.tee $0 i32.const 1 @@ -12838,13 +12849,13 @@ i32.const 5 call $std/array/Ref#constructor i32.store offset=16 - local.get $1 + local.get $2 call $~lib/rt/pure/__release - local.get $9 + local.get $16 i32.const 2 call $~lib/array/Array#splice local.set $25 - local.get $15 + local.get $20 call $~lib/rt/pure/__release local.get $25 i32.load offset=12 @@ -12888,7 +12899,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $16 i32.load offset=12 i32.const 3 i32.ne @@ -12900,7 +12911,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $16 i32.const 0 call $~lib/array/Array#__get local.tee $57 @@ -12915,7 +12926,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $16 i32.const 1 call $~lib/array/Array#__get local.tee $58 @@ -12930,7 +12941,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $16 i32.const 2 call $~lib/array/Array#__get local.tee $59 @@ -12951,7 +12962,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $15 + local.tee $20 i32.load offset=4 local.tee $0 i32.const 1 @@ -12964,7 +12975,7 @@ i32.const 2 call $std/array/Ref#constructor i32.store offset=8 - local.get $15 + local.get $20 call $~lib/array/Array#splice local.tee $30 i32.load offset=12 @@ -13003,7 +13014,7 @@ call $~lib/builtins/abort unreachable end - local.get $15 + local.get $20 i32.load offset=12 i32.const 2 i32.ne @@ -13015,7 +13026,7 @@ call $~lib/builtins/abort unreachable end - local.get $15 + local.get $20 i32.const 0 call $~lib/array/Array#__get local.tee $60 @@ -13027,11 +13038,11 @@ call $~lib/builtins/abort unreachable end - local.get $15 + local.get $20 i32.const 1 call $~lib/array/Array#__get - local.tee $1 - local.get $1 + local.tee $2 + local.get $2 i32.eqz if i32.const 0 @@ -13052,31 +13063,31 @@ call $~lib/builtins/abort unreachable end - local.get $2 - call $~lib/rt/pure/__release - local.get $4 + local.get $1 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $7 + local.get $4 + call $~lib/rt/pure/__release + local.get $5 call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release local.get $8 call $~lib/rt/pure/__release - local.get $10 + local.get $9 + call $~lib/rt/pure/__release + local.get $11 call $~lib/rt/pure/__release local.get $13 call $~lib/rt/pure/__release - local.get $16 + local.get $17 call $~lib/rt/pure/__release local.get $18 call $~lib/rt/pure/__release local.get $19 call $~lib/rt/pure/__release - local.get $20 - call $~lib/rt/pure/__release - local.get $14 + local.get $12 call $~lib/rt/pure/__release local.get $21 call $~lib/rt/pure/__release @@ -13152,7 +13163,7 @@ call $~lib/rt/pure/__release local.get $60 call $~lib/rt/pure/__release - local.get $1 + local.get $2 call $~lib/rt/pure/__release global.get $std/array/arr i32.const 0 @@ -13626,17 +13637,17 @@ unreachable end loop $for-loop|0 - local.get $5 + local.get $7 i32.const 100 i32.lt_s if global.get $std/array/arr call $~lib/array/Array#pop drop - local.get $5 + local.get $7 i32.const 1 i32.add - local.set $5 + local.set $7 br $for-loop|0 end end @@ -13657,7 +13668,7 @@ global.get $std/array/arr local.tee $2 i32.load offset=12 - local.tee $5 + local.tee $3 i32.const 2 i32.const 9 i32.const 0 @@ -13668,12 +13679,12 @@ local.set $4 loop $for-loop|043 local.get $1 - local.get $5 + local.get $3 local.get $2 i32.load offset=12 - local.tee $3 - local.get $5 + local.tee $5 local.get $3 + local.get $5 i32.lt_s select i32.lt_s @@ -13681,17 +13692,17 @@ local.get $1 i32.const 2 i32.shl - local.tee $3 + local.tee $5 local.get $2 i32.load offset=4 i32.add i32.load - f32.convert_i32_s - local.set $11 - local.get $3 + local.set $7 local.get $4 + local.get $5 i32.add - local.get $11 + local.get $7 + f32.convert_i32_s f32.store local.get $1 i32.const 1 @@ -14247,63 +14258,63 @@ i32.const 5280 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 - i32.load offset=12 local.tee $3 + i32.load offset=12 + local.tee $5 i32.const 1 i32.le_s if - local.get $4 + local.get $3 call $~lib/rt/pure/__retain br $__inlined_func$~lib/array/Array#sort end - local.get $4 - i32.load offset=4 - local.set $1 local.get $3 + i32.load offset=4 + local.set $4 + local.get $5 i32.const 2 i32.eq if - local.get $1 + local.get $4 f32.load offset=4 - local.tee $11 - local.get $1 + local.tee $14 + local.get $4 f32.load local.tee $34 call $~lib/util/sort/COMPARATOR~anonymous|0 i32.const 0 i32.lt_s if - local.get $1 + local.get $4 local.get $34 f32.store offset=4 - local.get $1 - local.get $11 + local.get $4 + local.get $14 f32.store end - local.get $4 + local.get $3 call $~lib/rt/pure/__retain br $__inlined_func$~lib/array/Array#sort end - local.get $3 + local.get $5 i32.const 256 i32.lt_s if i32.const 0 - local.set $5 + local.set $2 loop $for-loop|00 + local.get $2 local.get $5 - local.get $3 i32.lt_s if - local.get $1 - local.get $5 + local.get $4 + local.get $2 i32.const 2 i32.shl i32.add f32.load - local.set $11 - local.get $5 + local.set $14 + local.get $2 i32.const 1 i32.sub local.set $0 @@ -14312,8 +14323,8 @@ i32.const 0 i32.ge_s if - local.get $11 - local.get $1 + local.get $14 + local.get $4 local.get $0 i32.const 2 i32.shl @@ -14325,12 +14336,12 @@ i32.lt_s if local.get $0 - local.tee $2 + local.tee $1 i32.const 1 i32.sub local.set $0 + local.get $4 local.get $1 - local.get $2 i32.const 1 i32.add i32.const 2 @@ -14342,28 +14353,28 @@ end end end - local.get $1 + local.get $4 local.get $0 i32.const 1 i32.add i32.const 2 i32.shl i32.add - local.get $11 + local.get $14 f32.store - local.get $5 + local.get $2 i32.const 1 i32.add - local.set $5 + local.set $2 br $for-loop|00 end end else - local.get $1 - local.get $3 + local.get $4 + local.get $5 call $~lib/util/sort/weakHeapSort end - local.get $4 + local.get $3 call $~lib/rt/pure/__retain end call $~lib/rt/pure/__release @@ -14378,7 +14389,7 @@ i32.const 0 local.set $1 block $folding-inner0 - local.get $4 + local.get $3 i32.load offset=12 local.tee $2 local.get $7 @@ -14386,7 +14397,7 @@ i32.ne br_if $folding-inner0 i32.const 1 - local.get $4 + local.get $3 local.get $7 i32.eq br_if $__inlined_func$std/array/isArraysEqual @@ -14396,25 +14407,25 @@ local.get $2 i32.lt_s if - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get - local.tee $11 - local.get $11 + local.tee $14 + local.get $14 f32.ne if (result i32) local.get $7 local.get $1 call $~lib/array/Array#__get - local.tee $11 - local.get $11 + local.tee $14 + local.get $14 f32.ne else i32.const 0 end i32.eqz if - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get local.get $7 @@ -14451,41 +14462,41 @@ i32.const 5376 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $4 i32.load offset=12 local.tee $6 i32.const 1 i32.le_s if - local.get $3 + local.get $4 call $~lib/rt/pure/__retain br $__inlined_func$~lib/array/Array#sort end - local.get $3 + local.get $4 i32.load offset=4 - local.set $1 + local.set $5 local.get $6 i32.const 2 i32.eq if - local.get $1 + local.get $5 f64.load offset=8 - local.tee $17 - local.get $1 + local.tee $15 + local.get $5 f64.load local.tee $35 call $~lib/util/sort/COMPARATOR~anonymous|0 i32.const 0 i32.lt_s if - local.get $1 + local.get $5 local.get $35 f64.store offset=8 - local.get $1 - local.get $17 + local.get $5 + local.get $15 f64.store end - local.get $3 + local.get $4 call $~lib/rt/pure/__retain br $__inlined_func$~lib/array/Array#sort end @@ -14494,20 +14505,20 @@ i32.lt_s if i32.const 0 - local.set $5 + local.set $2 loop $for-loop|02 - local.get $5 + local.get $2 local.get $6 i32.lt_s if - local.get $1 local.get $5 + local.get $2 i32.const 3 i32.shl i32.add f64.load - local.set $17 - local.get $5 + local.set $15 + local.get $2 i32.const 1 i32.sub local.set $0 @@ -14516,8 +14527,8 @@ i32.const 0 i32.ge_s if - local.get $17 - local.get $1 + local.get $15 + local.get $5 local.get $0 i32.const 3 i32.shl @@ -14529,12 +14540,12 @@ i32.lt_s if local.get $0 - local.tee $2 + local.tee $1 i32.const 1 i32.sub local.set $0 + local.get $5 local.get $1 - local.get $2 i32.const 1 i32.add i32.const 3 @@ -14546,28 +14557,28 @@ end end end - local.get $1 + local.get $5 local.get $0 i32.const 1 i32.add i32.const 3 i32.shl i32.add - local.get $17 + local.get $15 f64.store - local.get $5 + local.get $2 i32.const 1 i32.add - local.set $5 + local.set $2 br $for-loop|02 end end else - local.get $1 + local.get $5 local.get $6 call $~lib/util/sort/weakHeapSort end - local.get $3 + local.get $4 call $~lib/rt/pure/__retain end call $~lib/rt/pure/__release @@ -14582,7 +14593,7 @@ i32.const 0 local.set $1 block $folding-inner01 - local.get $3 + local.get $4 i32.load offset=12 local.tee $5 local.get $2 @@ -14591,7 +14602,7 @@ br_if $folding-inner01 i32.const 1 local.get $2 - local.get $3 + local.get $4 i32.eq br_if $__inlined_func$std/array/isArraysEqual drop @@ -14600,25 +14611,25 @@ local.get $5 i32.lt_s if - local.get $3 + local.get $4 local.get $1 call $~lib/array/Array#__get - local.tee $17 - local.get $17 + local.tee $15 + local.get $15 f64.ne if (result i32) local.get $2 local.get $1 call $~lib/array/Array#__get - local.tee $17 - local.get $17 + local.tee $15 + local.get $15 f64.ne else i32.const 0 end i32.eqz if - local.get $3 + local.get $4 local.get $1 call $~lib/array/Array#__get local.get $2 @@ -14654,11 +14665,11 @@ i32.const 5536 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $18 + local.tee $17 i32.const 46 call $~lib/array/Array#sort call $~lib/rt/pure/__release - local.get $18 + local.get $17 i32.const 5 i32.const 2 i32.const 3 @@ -14683,11 +14694,11 @@ i32.const 5632 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $19 + local.tee $18 i32.const 47 call $~lib/array/Array#sort call $~lib/rt/pure/__release - local.get $19 + local.get $18 i32.const 5 i32.const 2 i32.const 7 @@ -14712,21 +14723,21 @@ i32.const 5728 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $20 + local.set $19 i32.const 1 i32.const 2 i32.const 3 i32.const 5744 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $5 + local.set $1 i32.const 2 i32.const 2 i32.const 3 i32.const 5776 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $1 + local.set $5 i32.const 4 i32.const 2 i32.const 3 @@ -14746,23 +14757,23 @@ local.set $8 i32.const 128 call $std/array/createReverseOrderedArray - local.set $10 + local.set $9 i32.const 1024 call $std/array/createReverseOrderedArray - local.set $13 + local.set $11 i32.const 10000 call $std/array/createReverseOrderedArray - local.set $16 + local.set $13 i32.const 512 call $std/array/createRandomOrderedArray - local.set $14 - local.get $20 + local.set $12 + local.get $19 i32.const 48 call $std/array/assertSorted - local.get $5 + local.get $1 i32.const 48 call $std/array/assertSorted - local.get $5 + local.get $1 i32.const 1 i32.const 2 i32.const 3 @@ -14781,10 +14792,10 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $5 i32.const 48 call $std/array/assertSorted - local.get $1 + local.get $5 i32.const 2 i32.const 2 i32.const 3 @@ -14835,10 +14846,10 @@ call $~lib/builtins/abort unreachable end - local.get $10 + local.get $9 i32.const 48 call $std/array/assertSorted - local.get $10 + local.get $9 local.get $0 i32.const 4 call $std/array/isArraysEqual @@ -14851,10 +14862,10 @@ call $~lib/builtins/abort unreachable end - local.get $13 + local.get $11 i32.const 48 call $std/array/assertSorted - local.get $13 + local.get $11 local.get $0 i32.const 4 call $std/array/isArraysEqual @@ -14867,10 +14878,10 @@ call $~lib/builtins/abort unreachable end - local.get $16 + local.get $13 i32.const 48 call $std/array/assertSorted - local.get $16 + local.get $13 local.get $0 i32.const 4 call $std/array/isArraysEqual @@ -14883,44 +14894,44 @@ call $~lib/builtins/abort unreachable end - local.get $14 + local.get $12 i32.const 48 call $std/array/assertSorted - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $3 + local.get $4 call $~lib/rt/pure/__release local.get $2 call $~lib/rt/pure/__release - local.get $18 + local.get $17 call $~lib/rt/pure/__release local.get $21 call $~lib/rt/pure/__release - local.get $19 + local.get $18 call $~lib/rt/pure/__release local.get $22 call $~lib/rt/pure/__release - local.get $20 - call $~lib/rt/pure/__release - local.get $5 + local.get $19 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release + local.get $5 + call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $8 call $~lib/rt/pure/__release - local.get $10 + local.get $9 call $~lib/rt/pure/__release - local.get $13 + local.get $11 call $~lib/rt/pure/__release - local.get $16 + local.get $13 call $~lib/rt/pure/__release - local.get $14 + local.get $12 call $~lib/rt/pure/__release local.get $23 call $~lib/rt/pure/__release @@ -14931,22 +14942,22 @@ local.set $0 i32.const 257 call $std/array/createRandomOrderedArray - local.set $2 + local.set $1 local.get $0 i32.const 49 call $std/array/assertSorted local.get $0 i32.const 50 call $std/array/assertSorted - local.get $2 + local.get $1 i32.const 51 call $std/array/assertSorted - local.get $2 + local.get $1 i32.const 52 call $std/array/assertSorted local.get $0 call $~lib/rt/pure/__release - local.get $2 + local.get $1 call $~lib/rt/pure/__release call $std/array/createReverseOrderedNestedArray local.tee $0 @@ -14966,7 +14977,7 @@ i32.const 6080 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $3 + local.set $5 i32.const 7 i32.const 2 i32.const 15 @@ -14977,7 +14988,7 @@ block $__inlined_func$std/array/isSorted<~lib/string/String | null> (result i32) i32.const 1 local.set $1 - local.get $3 + local.get $5 i32.const 55 call $~lib/array/Array<~lib/array/Array>#sort local.tee $0 @@ -14995,7 +15006,7 @@ i32.const 1 i32.sub call $~lib/array/Array#__get - local.tee $5 + local.tee $3 local.get $2 local.get $1 call $~lib/array/Array#__get @@ -15004,14 +15015,14 @@ i32.const 0 i32.gt_s if - local.get $5 + local.get $3 call $~lib/rt/pure/__release local.get $4 call $~lib/rt/pure/__release i32.const 0 br $__inlined_func$std/array/isSorted<~lib/string/String | null> end - local.get $5 + local.get $3 call $~lib/rt/pure/__release local.get $4 call $~lib/rt/pure/__release @@ -15039,26 +15050,26 @@ i32.const 0 local.set $1 i32.const 0 - local.get $3 + local.get $5 i32.load offset=12 - local.tee $5 + local.tee $3 local.get $7 i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> drop i32.const 1 - local.get $3 + local.get $5 local.get $7 i32.eq br_if $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> drop loop $for-loop|04 local.get $1 - local.get $5 + local.get $3 i32.lt_s if - local.get $3 + local.get $5 local.get $1 call $~lib/array/Array#__get local.tee $0 @@ -15099,7 +15110,7 @@ unreachable end i32.const 0 - local.set $5 + local.set $1 i32.const 1600 i32.const 0 call $~lib/rt/tlsf/__alloc @@ -15124,21 +15135,21 @@ i32.const 0 i32.store offset=12 local.get $0 - local.set $1 + local.set $3 local.get $0 local.get $2 i32.load local.tee $4 i32.ne if - local.get $1 + local.get $3 call $~lib/rt/pure/__retain - local.set $1 + local.set $3 local.get $4 call $~lib/rt/pure/__release end local.get $2 - local.get $1 + local.get $3 i32.store local.get $2 local.get $0 @@ -15150,12 +15161,12 @@ i32.const 400 i32.store offset=12 loop $for-loop|09 - local.get $5 + local.get $1 i32.const 400 i32.lt_s if - local.get $5 - local.set $1 + local.get $1 + local.set $3 call $~lib/math/NativeMath.random f64.const 32 f64.mul @@ -15179,7 +15190,7 @@ f64.mul f64.floor i32.trunc_f64_s - local.tee $5 + local.tee $1 i32.const 5088 call $~lib/string/String#get:length i32.ge_u @@ -15189,7 +15200,7 @@ i32.const 1 call $~lib/rt/tlsf/__alloc local.tee $4 - local.get $5 + local.get $1 i32.const 1 i32.shl i32.const 5088 @@ -15199,13 +15210,13 @@ local.get $4 call $~lib/rt/pure/__retain end - local.set $5 + local.set $1 local.get $0 local.tee $4 local.get $0 - local.get $5 + local.get $1 call $~lib/string/String.__concat - local.tee $10 + local.tee $9 local.tee $0 i32.ne if @@ -15215,9 +15226,9 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $5 + local.get $1 call $~lib/rt/pure/__release - local.get $10 + local.get $9 call $~lib/rt/pure/__release local.get $6 i32.const 1 @@ -15227,22 +15238,22 @@ end end local.get $2 - local.get $1 + local.get $3 local.get $0 call $~lib/array/Array<~lib/array/Array>#__set local.get $0 call $~lib/rt/pure/__release - local.get $1 + local.get $3 i32.const 1 i32.add - local.set $5 + local.set $1 br $for-loop|09 end end local.get $2 i32.const 56 call $std/array/assertSorted<~lib/array/Array> - local.get $3 + local.get $5 call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release @@ -15277,7 +15288,7 @@ i32.const 6384 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $5 i32.const 6064 call $~lib/array/Array#join local.tee $7 @@ -15319,10 +15330,10 @@ i32.const 6544 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $10 + local.tee $9 i32.const 6576 call $~lib/array/Array#join - local.tee $13 + local.tee $11 i32.const 6608 call $~lib/string/String.__eq i32.eqz @@ -15340,12 +15351,12 @@ i32.const 6672 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $1 i32.load offset=4 - local.get $2 + local.get $1 i32.load offset=12 call $~lib/util/string/joinFloatArray - local.tee $16 + local.tee $13 i32.const 7824 call $~lib/string/String.__eq i32.eqz @@ -15363,10 +15374,10 @@ i32.const 7952 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $18 + local.tee $17 i32.const 6064 call $~lib/array/Array<~lib/string/String | null>#join - local.tee $19 + local.tee $18 i32.const 7920 call $~lib/string/String.__eq i32.eqz @@ -15384,22 +15395,22 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $2 i32.load offset=4 - local.tee $1 + local.tee $3 i32.const 0 call $std/array/Ref#constructor i32.store - local.get $1 + local.get $3 i32.const 0 i32.store offset=4 - local.get $1 + local.get $3 i32.const 0 call $std/array/Ref#constructor i32.store offset=8 - local.get $5 + local.get $2 call $~lib/array/Array#join - local.tee $20 + local.tee $19 i32.const 8032 call $~lib/string/String.__eq i32.eqz @@ -15417,19 +15428,19 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $1 + local.tee $3 i32.load offset=4 - local.tee $14 + local.tee $12 i32.const 0 call $std/array/Ref#constructor i32.store - local.get $14 + local.get $12 i32.const 0 call $std/array/Ref#constructor i32.store offset=4 - local.get $1 + local.get $3 call $~lib/array/Array#join - local.tee $14 + local.tee $12 i32.const 8112 call $~lib/string/String.__eq i32.eqz @@ -15445,7 +15456,7 @@ call $~lib/rt/pure/__release local.get $4 call $~lib/rt/pure/__release - local.get $3 + local.get $5 call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release @@ -15453,25 +15464,25 @@ call $~lib/rt/pure/__release local.get $8 call $~lib/rt/pure/__release - local.get $10 + local.get $9 call $~lib/rt/pure/__release - local.get $13 + local.get $11 call $~lib/rt/pure/__release - local.get $2 + local.get $1 call $~lib/rt/pure/__release - local.get $16 + local.get $13 call $~lib/rt/pure/__release - local.get $18 + local.get $17 call $~lib/rt/pure/__release - local.get $19 + local.get $18 call $~lib/rt/pure/__release - local.get $5 + local.get $2 call $~lib/rt/pure/__release - local.get $20 + local.get $19 call $~lib/rt/pure/__release - local.get $1 + local.get $3 call $~lib/rt/pure/__release - local.get $14 + local.get $12 call $~lib/rt/pure/__release i32.const 0 i32.const 2 @@ -15479,7 +15490,7 @@ i32.const 8192 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $1 + local.set $3 i32.const 1 i32.const 2 i32.const 3 @@ -15493,7 +15504,7 @@ i32.const 8240 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $3 + local.set $5 i32.const 4 i32.const 2 i32.const 3 @@ -15501,7 +15512,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $7 - local.get $1 + local.get $3 i32.const 6304 call $~lib/array/Array#join local.tee $0 @@ -15521,7 +15532,7 @@ i32.const 6304 call $~lib/array/Array#join local.tee $0 - local.set $18 + local.set $17 local.get $0 i32.const 7920 call $~lib/string/String.__eq @@ -15534,11 +15545,11 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $5 i32.const 6304 call $~lib/array/Array#join local.tee $0 - local.set $19 + local.set $18 local.get $0 i32.const 8304 call $~lib/string/String.__eq @@ -15555,7 +15566,7 @@ i32.const 6304 call $~lib/array/Array#join local.tee $0 - local.set $20 + local.set $19 local.get $0 i32.const 8336 call $~lib/string/String.__eq @@ -15580,7 +15591,7 @@ i32.load offset=12 call $~lib/util/string/joinIntegerArray local.tee $0 - local.set $14 + local.set $12 local.get $0 i32.const 8400 call $~lib/string/String.__eq @@ -15624,9 +15635,9 @@ i32.const 8512 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $10 + local.tee $9 i32.load offset=4 - local.get $10 + local.get $9 i32.load offset=12 call $~lib/util/string/joinIntegerArray local.tee $0 @@ -15649,9 +15660,9 @@ i32.const 8624 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $13 + local.tee $11 i32.load offset=4 - local.get $13 + local.get $11 i32.load offset=12 call $~lib/util/string/joinIntegerArray local.tee $0 @@ -15722,7 +15733,7 @@ call $~lib/rt/pure/__retain local.tee $0 i32.load offset=4 - local.tee $2 + local.tee $1 i32.const 2 i32.const 2 i32.const 3 @@ -15730,7 +15741,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $2 + local.get $1 i32.const 2 i32.const 2 i32.const 3 @@ -15743,9 +15754,9 @@ local.get $0 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> - local.tee $2 + local.tee $1 local.set $32 - local.get $2 + local.get $1 i32.const 9072 call $~lib/string/String.__eq i32.eqz @@ -15763,9 +15774,9 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $1 i32.load offset=4 - local.tee $5 + local.tee $2 i32.const 2 i32.const 0 i32.const 6 @@ -15773,7 +15784,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $5 + local.get $2 i32.const 2 i32.const 0 i32.const 6 @@ -15781,14 +15792,14 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=4 - local.get $2 + local.get $1 i32.load offset=4 - local.get $2 + local.get $1 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> - local.tee $5 + local.tee $2 local.set $33 - local.get $5 + local.get $2 i32.const 9072 call $~lib/string/String.__eq i32.eqz @@ -15806,7 +15817,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $2 i32.load offset=4 i32.const 1 i32.const 2 @@ -15825,9 +15836,9 @@ i32.store local.get $29 i32.store - local.get $5 + local.get $2 i32.load offset=4 - local.get $5 + local.get $2 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> local.tee $28 @@ -15844,34 +15855,34 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $3 call $~lib/rt/pure/__release local.get $4 call $~lib/rt/pure/__release - local.get $3 + local.get $5 call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release call $~lib/rt/pure/__release + local.get $17 + call $~lib/rt/pure/__release local.get $18 call $~lib/rt/pure/__release local.get $19 call $~lib/rt/pure/__release - local.get $20 - call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $14 + local.get $12 call $~lib/rt/pure/__release local.get $8 call $~lib/rt/pure/__release local.get $21 call $~lib/rt/pure/__release - local.get $10 + local.get $9 call $~lib/rt/pure/__release local.get $22 call $~lib/rt/pure/__release - local.get $13 + local.get $11 call $~lib/rt/pure/__release local.get $23 call $~lib/rt/pure/__release @@ -15897,9 +15908,9 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $5 i32.load offset=4 - local.tee $1 + local.tee $3 i32.const 1 i32.const 2 i32.const 3 @@ -15907,7 +15918,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $1 + local.get $3 i32.const 3 i32.const 2 i32.const 3 @@ -15915,7 +15926,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=4 - local.get $1 + local.get $3 i32.const 3 i32.const 2 i32.const 3 @@ -15923,7 +15934,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=8 - local.get $1 + local.get $3 i32.const 3 i32.const 2 i32.const 3 @@ -15931,7 +15942,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=12 - local.get $3 + local.get $5 call $~lib/array/Array<~lib/array/Array>#flat local.tee $7 i32.load offset=12 @@ -15946,14 +15957,14 @@ unreachable end loop $for-loop|1 - local.get $12 + local.get $10 i32.const 10 i32.lt_s if local.get $7 - local.get $12 + local.get $10 call $~lib/array/Array#__get - local.get $12 + local.get $10 i32.ne if i32.const 0 @@ -15963,10 +15974,10 @@ call $~lib/builtins/abort unreachable end - local.get $12 + local.get $10 i32.const 1 i32.add - local.set $12 + local.set $10 br $for-loop|1 end end @@ -15978,7 +15989,7 @@ call $~lib/rt/pure/__retain local.tee $6 i32.load offset=4 - local.tee $1 + local.tee $3 i32.const 1 i32.const 2 i32.const 15 @@ -15986,7 +15997,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $1 + local.get $3 i32.const 3 i32.const 2 i32.const 15 @@ -15994,7 +16005,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=4 - local.get $1 + local.get $3 i32.const 3 i32.const 2 i32.const 15 @@ -16002,7 +16013,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=8 - local.get $1 + local.get $3 i32.const 1 i32.const 2 i32.const 15 @@ -16012,7 +16023,7 @@ i32.store offset=12 local.get $6 call $~lib/array/Array<~lib/array/Array<~lib/string/String | null>>#flat - local.set $1 + local.set $3 i32.const 8 i32.const 2 i32.const 15 @@ -16020,7 +16031,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $4 - local.get $1 + local.get $3 i32.load offset=12 i32.const 8 i32.ne @@ -16033,21 +16044,21 @@ unreachable end i32.const 0 - local.set $12 + local.set $10 loop $for-loop|2 - local.get $12 + local.get $10 local.get $4 i32.load offset=12 i32.lt_s if - local.get $1 - local.get $12 + local.get $3 + local.get $10 call $~lib/array/Array#__get local.tee $8 local.get $4 - local.get $12 + local.get $10 call $~lib/array/Array#__get - local.tee $10 + local.tee $9 call $~lib/string/String.__eq i32.eqz if @@ -16060,12 +16071,12 @@ end local.get $8 call $~lib/rt/pure/__release - local.get $10 + local.get $9 call $~lib/rt/pure/__release - local.get $12 + local.get $10 i32.const 1 i32.add - local.set $12 + local.set $10 br $for-loop|2 end end @@ -16075,7 +16086,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $12 + local.tee $10 i32.load offset=4 local.tee $8 i32.const 0 @@ -16093,7 +16104,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=4 - local.get $12 + local.get $10 call $~lib/array/Array<~lib/array/Array>#flat local.tee $8 i32.load offset=12 @@ -16105,31 +16116,31 @@ call $~lib/builtins/abort unreachable end - local.get $12 + local.get $10 call $~lib/rt/pure/__release local.get $8 call $~lib/rt/pure/__release - local.get $9 + local.get $16 call $~lib/rt/pure/__release local.get $25 call $~lib/rt/pure/__release - local.get $15 + local.get $20 call $~lib/rt/pure/__release local.get $30 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release local.get $2 call $~lib/rt/pure/__release local.get $5 call $~lib/rt/pure/__release - local.get $3 - call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $1 + local.get $3 call $~lib/rt/pure/__release local.get $4 call $~lib/rt/pure/__release diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index ba396f0fb3..4c07bd984a 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -2122,7 +2122,7 @@ if i32.const 32 i32.const 336 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable @@ -5737,8 +5737,6 @@ local.set $4 local.get $4 if - i32.const 3 - global.set $~argumentsLength local.get $0 i32.load offset=4 local.get $2 @@ -5748,6 +5746,8 @@ i32.load local.get $2 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if @@ -5873,8 +5873,6 @@ local.set $4 local.get $4 if - i32.const 3 - global.set $~argumentsLength local.get $0 i32.load offset=4 local.get $2 @@ -5884,6 +5882,8 @@ i32.load local.get $2 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_i32) i32.eqz @@ -5997,8 +5997,6 @@ local.set $4 local.get $4 if - i32.const 3 - global.set $~argumentsLength local.get $0 i32.load offset=4 local.get $2 @@ -6008,6 +6006,8 @@ i32.load local.get $2 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if @@ -6118,8 +6118,6 @@ local.set $4 local.get $4 if - i32.const 3 - global.set $~argumentsLength local.get $0 i32.load offset=4 local.get $2 @@ -6129,6 +6127,8 @@ i32.load local.get $2 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_none) local.get $2 @@ -6342,8 +6342,6 @@ local.set $6 local.get $6 if - i32.const 3 - global.set $~argumentsLength local.get $0 i32.load offset=4 local.get $5 @@ -6353,6 +6351,8 @@ i32.load local.get $5 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_f32) local.set $8 @@ -6465,8 +6465,6 @@ local.set $6 local.get $6 if - i32.const 3 - global.set $~argumentsLength local.get $0 i32.load offset=4 local.get $5 @@ -6476,6 +6474,8 @@ i32.load local.get $5 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_i32) local.set $7 @@ -6584,11 +6584,11 @@ i32.add i32.load local.set $6 - i32.const 3 - global.set $~argumentsLength local.get $6 local.get $3 local.get $0 + i32.const 3 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if @@ -6705,8 +6705,6 @@ local.set $6 local.get $6 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $0 i32.load offset=4 @@ -6717,6 +6715,8 @@ i32.load local.get $4 local.get $0 + i32.const 4 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6788,8 +6788,6 @@ local.set $6 local.get $6 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $0 i32.load offset=4 @@ -6800,6 +6798,8 @@ i32.load local.get $4 local.get $0 + i32.const 4 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6907,8 +6907,6 @@ local.set $5 local.get $5 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $0 i32.load offset=4 @@ -6919,6 +6917,8 @@ i32.load local.get $4 local.get $0 + i32.const 4 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6980,8 +6980,6 @@ local.set $5 local.get $5 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $0 i32.load offset=4 @@ -6992,6 +6990,8 @@ i32.load local.get $4 local.get $0 + i32.const 4 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -7227,10 +7227,10 @@ i32.add f32.load local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_f32_=>_i32) i32.const 0 @@ -7369,10 +7369,10 @@ i32.add f32.load local.set $10 - i32.const 2 - global.set $~argumentsLength local.get $9 local.get $10 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_f32_=>_i32) i32.const 0 @@ -7500,10 +7500,10 @@ i32.add f32.load local.set $9 - i32.const 2 - global.set $~argumentsLength local.get $10 local.get $9 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_f32_=>_i32) i32.const 0 @@ -7601,10 +7601,10 @@ local.get $3 f32.load local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $f32_f32_=>_i32) i32.const 0 @@ -7679,7 +7679,7 @@ i32.lt_s i32.sub ) - (func $~lib/array/Array#sort|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -7858,10 +7858,10 @@ i32.add f64.load local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -7994,10 +7994,10 @@ i32.add f64.load local.set $10 - i32.const 2 - global.set $~argumentsLength local.get $9 local.get $10 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -8125,10 +8125,10 @@ i32.add f64.load local.set $9 - i32.const 2 - global.set $~argumentsLength local.get $10 local.get $9 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -8226,10 +8226,10 @@ local.get $3 f64.load local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -8304,7 +8304,7 @@ i64.lt_s i32.sub ) - (func $~lib/array/Array#sort|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -8518,10 +8518,10 @@ i32.add i32.load local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -8654,10 +8654,10 @@ i32.add i32.load local.set $10 - i32.const 2 - global.set $~argumentsLength local.get $9 local.get $10 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -8785,10 +8785,10 @@ i32.add i32.load local.set $11 - i32.const 2 - global.set $~argumentsLength local.get $10 local.get $11 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -8884,10 +8884,10 @@ local.get $3 i32.load local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -8934,7 +8934,7 @@ local.get $1 i32.sub ) - (func $~lib/array/Array#sort|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -9007,10 +9007,10 @@ i32.add i32.load local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -9143,10 +9143,10 @@ i32.add i32.load local.set $10 - i32.const 2 - global.set $~argumentsLength local.get $9 local.get $10 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -9274,10 +9274,10 @@ i32.add i32.load local.set $11 - i32.const 2 - global.set $~argumentsLength local.get $10 local.get $11 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -9373,10 +9373,10 @@ local.get $3 i32.load local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -9427,7 +9427,7 @@ i32.lt_u i32.sub ) - (func $~lib/array/Array#sort|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -9602,8 +9602,6 @@ local.set $4 local.get $4 if - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $2 i32.const 1 @@ -9612,6 +9610,8 @@ local.get $0 local.get $2 call $~lib/array/Array#__get + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -9971,10 +9971,10 @@ i32.load call $~lib/rt/pure/__retain local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10056,10 +10056,10 @@ i32.load call $~lib/rt/pure/__retain local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10170,8 +10170,6 @@ local.set $4 local.get $4 if - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $2 i32.const 1 @@ -10182,6 +10180,8 @@ local.get $2 call $~lib/array/Array<~lib/array/Array>#__get local.tee $6 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10513,10 +10513,10 @@ i32.load call $~lib/rt/pure/__retain local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10598,10 +10598,10 @@ i32.load call $~lib/rt/pure/__retain local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10712,8 +10712,6 @@ local.set $4 local.get $4 if - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $2 i32.const 1 @@ -10724,6 +10722,8 @@ local.get $2 call $~lib/array/Array>#__get local.tee $6 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10827,10 +10827,10 @@ i32.load call $~lib/rt/pure/__retain local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -10912,10 +10912,10 @@ i32.load call $~lib/rt/pure/__retain local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -11014,8 +11014,6 @@ local.set $4 local.get $4 if - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $2 i32.const 1 @@ -11026,6 +11024,8 @@ local.get $2 call $~lib/array/Array<~lib/string/String | null>#__get local.tee $6 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -11324,7 +11324,7 @@ call $~lib/rt/pure/__release local.get $2 ) - (func $std/array/assertSorted<~lib/string/String | null>|trampoline (param $0 i32) (param $1 i32) + (func $std/array/assertSorted<~lib/string/String | null>@varargs (param $0 i32) (param $1 i32) block $1of1 block $0of1 block $outOfRange @@ -11964,10 +11964,10 @@ i32.load call $~lib/rt/pure/__retain local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -12049,10 +12049,10 @@ i32.load call $~lib/rt/pure/__retain local.set $5 - i32.const 2 - global.set $~argumentsLength local.get $4 local.get $5 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -12163,8 +12163,6 @@ local.set $4 local.get $4 if - i32.const 2 - global.set $~argumentsLength local.get $0 local.get $2 i32.const 1 @@ -12175,6 +12173,8 @@ local.get $2 call $~lib/array/Array<~lib/string/String>#__get local.tee $6 + i32.const 2 + global.set $~argumentsLength local.get $1 call_indirect (type $i32_i32_=>_i32) i32.const 0 @@ -12339,7 +12339,7 @@ call $~lib/rt/pure/__release local.get $2 ) - (func $std/array/assertSorted<~lib/string/String>|trampoline (param $0 i32) (param $1 i32) + (func $std/array/assertSorted<~lib/string/String>@varargs (param $0 i32) (param $1 i32) block $1of1 block $0of1 block $outOfRange @@ -23720,11 +23720,11 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $50 + local.get $50 i32.const 0 global.set $~argumentsLength - local.get $50 i32.const 0 - call $~lib/array/Array#sort|trampoline + call $~lib/array/Array#sort@varargs call $~lib/rt/pure/__release local.get $50 i32.const 8 @@ -23752,11 +23752,11 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $49 + local.get $49 i32.const 0 global.set $~argumentsLength - local.get $49 i32.const 0 - call $~lib/array/Array#sort|trampoline + call $~lib/array/Array#sort@varargs call $~lib/rt/pure/__release local.get $49 i32.const 8 @@ -23784,11 +23784,11 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $47 + local.get $47 i32.const 0 global.set $~argumentsLength - local.get $47 i32.const 0 - call $~lib/array/Array#sort|trampoline + call $~lib/array/Array#sort@varargs call $~lib/rt/pure/__release local.get $47 i32.const 5 @@ -23816,11 +23816,11 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $41 + local.get $41 i32.const 0 global.set $~argumentsLength - local.get $41 i32.const 0 - call $~lib/array/Array#sort|trampoline + call $~lib/array/Array#sort@varargs call $~lib/rt/pure/__release local.get $41 i32.const 5 @@ -24104,11 +24104,11 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $34 + local.get $31 i32.const 1 global.set $~argumentsLength - local.get $31 i32.const 0 - call $std/array/assertSorted<~lib/string/String | null>|trampoline + call $std/array/assertSorted<~lib/string/String | null>@varargs local.get $31 local.get $34 i32.const 0 @@ -24125,11 +24125,11 @@ i32.const 400 call $std/array/createRandomStringArray local.set $29 + local.get $29 i32.const 1 global.set $~argumentsLength - local.get $29 i32.const 0 - call $std/array/assertSorted<~lib/string/String>|trampoline + call $std/array/assertSorted<~lib/string/String>@varargs local.get $31 call $~lib/rt/pure/__release local.get $34 diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index e7ad203e1f..ac4432de51 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -1516,7 +1516,7 @@ if i32.const 1040 i32.const 1088 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index c0cca6a6ba..c71239ab12 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -1748,7 +1748,7 @@ if i32.const 32 i32.const 80 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable @@ -3325,7 +3325,7 @@ if i32.const 32 i32.const 80 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable @@ -3621,7 +3621,7 @@ call $~lib/rt/pure/__release local.get $0 ) - (func $~lib/dataview/DataView#constructor|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $~lib/dataview/DataView#constructor@varargs (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -4027,14 +4027,14 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength i32.const 0 local.get $2 i32.load i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/dataview/DataView#constructor|trampoline + call $~lib/dataview/DataView#constructor@varargs local.tee $5 call $~lib/arraybuffer/ArrayBuffer.isView<~lib/dataview/DataView> i32.eqz diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 0510a6e0c2..e579146b4f 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -1772,7 +1772,7 @@ if i32.const 32 i32.const 80 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable @@ -2775,7 +2775,7 @@ end i64.store ) - (func $~lib/dataview/DataView#constructor|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $~lib/dataview/DataView#constructor@varargs (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -4496,14 +4496,14 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength i32.const 0 local.get $0 i32.load i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/dataview/DataView#constructor|trampoline + call $~lib/dataview/DataView#constructor@varargs local.set $2 local.get $1 call $~lib/rt/pure/__release diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index cf89502f7c..45fa556b7b 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -1279,7 +1279,7 @@ if i32.const 1200 i32.const 1248 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 8c1e5d210c..cb8759d371 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -1764,7 +1764,7 @@ if i32.const 192 i32.const 240 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index e895d0b7da..ec63d08717 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -1276,7 +1276,7 @@ if i32.const 1200 i32.const 1248 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable @@ -2067,6 +2067,18 @@ local.get $2 i32.store8 ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + local.get $0 + i32.load offset=12 + drop + local.get $0 + local.get $1 + i32.const 0 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -2142,12 +2154,12 @@ local.get $8 i32.store offset=12 loop $for-loop|0 - local.get $7 + local.get $6 local.get $4 i32.lt_s if local.get $5 - local.get $7 + local.get $6 i32.const 3 i32.shl i32.add @@ -2158,23 +2170,26 @@ i32.eqz if local.get $0 - local.get $6 + local.get $7 local.get $2 i32.load8_s call $~lib/array/Array#__set - local.get $6 + local.get $7 i32.const 1 i32.add - local.set $6 + local.set $7 end - local.get $7 + local.get $6 i32.const 1 i32.add - local.set $7 + local.set $6 br $for-loop|0 end end local.get $0 + local.get $7 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result i32) local.get $1 @@ -2905,12 +2920,12 @@ local.get $8 i32.store offset=12 loop $for-loop|0 - local.get $7 + local.get $6 local.get $4 i32.lt_s if local.get $5 - local.get $7 + local.get $6 i32.const 3 i32.shl i32.add @@ -2921,23 +2936,26 @@ i32.eqz if local.get $0 - local.get $6 + local.get $7 local.get $2 i32.load8_u call $~lib/array/Array#__set - local.get $6 + local.get $7 i32.const 1 i32.add - local.set $6 + local.set $7 end - local.get $7 + local.get $6 i32.const 1 i32.add - local.set $7 + local.set $6 br $for-loop|0 end end local.get $0 + local.get $7 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result i32) local.get $1 @@ -3683,6 +3701,18 @@ local.get $2 i32.store16 ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + local.get $0 + i32.load offset=12 + drop + local.get $0 + local.get $1 + i32.const 1 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -3763,12 +3793,12 @@ local.get $6 i32.store offset=12 loop $for-loop|0 - local.get $9 + local.get $8 local.get $7 i32.lt_s if local.get $4 - local.get $9 + local.get $8 i32.const 3 i32.shl i32.add @@ -3779,23 +3809,26 @@ i32.eqz if local.get $0 - local.get $8 + local.get $9 local.get $2 i32.load16_s call $~lib/array/Array#__set - local.get $8 + local.get $9 i32.const 1 i32.add - local.set $8 + local.set $9 end - local.get $9 + local.get $8 i32.const 1 i32.add - local.set $9 + local.set $8 br $for-loop|0 end end local.get $0 + local.get $9 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result i32) local.get $1 @@ -4533,12 +4566,12 @@ local.get $6 i32.store offset=12 loop $for-loop|0 - local.get $9 + local.get $8 local.get $7 i32.lt_s if local.get $4 - local.get $9 + local.get $8 i32.const 3 i32.shl i32.add @@ -4549,23 +4582,26 @@ i32.eqz if local.get $0 - local.get $8 + local.get $9 local.get $2 i32.load16_u call $~lib/array/Array#__set - local.get $8 + local.get $9 i32.const 1 i32.add - local.set $8 + local.set $9 end - local.get $9 + local.get $8 i32.const 1 i32.add - local.set $9 + local.set $8 br $for-loop|0 end end local.get $0 + local.get $9 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result i32) local.get $1 @@ -5319,6 +5355,18 @@ local.get $2 i32.store ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + local.get $0 + i32.load offset=12 + drop + local.get $0 + local.get $1 + i32.const 2 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -5399,12 +5447,12 @@ local.get $6 i32.store offset=12 loop $for-loop|0 - local.get $9 + local.get $8 local.get $7 i32.lt_s if local.get $4 - local.get $9 + local.get $8 i32.const 3 i32.shl i32.add @@ -5415,23 +5463,26 @@ i32.eqz if local.get $0 - local.get $8 + local.get $9 local.get $2 i32.load call $~lib/array/Array#__set - local.get $8 + local.get $9 i32.const 1 i32.add - local.set $8 + local.set $9 end - local.get $9 + local.get $8 i32.const 1 i32.add - local.set $9 + local.set $8 br $for-loop|0 end end local.get $0 + local.get $9 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result i32) local.get $1 @@ -5922,12 +5973,12 @@ local.get $6 i32.store offset=12 loop $for-loop|0 - local.get $9 + local.get $8 local.get $7 i32.lt_s if local.get $4 - local.get $9 + local.get $8 i32.const 3 i32.shl i32.add @@ -5938,23 +5989,26 @@ i32.eqz if local.get $0 - local.get $8 + local.get $9 local.get $2 i32.load call $~lib/array/Array#__set - local.get $8 + local.get $9 i32.const 1 i32.add - local.set $8 + local.set $9 end - local.get $9 + local.get $8 i32.const 1 i32.add - local.set $9 + local.set $8 br $for-loop|0 end end local.get $0 + local.get $9 + call $~lib/array/Array#set:length + local.get $0 ) (func $std/set/testNumeric (local $0 i32) @@ -6686,6 +6740,18 @@ local.get $2 i64.store ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + local.get $0 + i32.load offset=12 + drop + local.get $0 + local.get $1 + i32.const 3 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -6766,12 +6832,12 @@ local.get $6 i32.store offset=12 loop $for-loop|0 - local.get $9 + local.get $8 local.get $7 i32.lt_s if local.get $4 - local.get $9 + local.get $8 i32.const 4 i32.shl i32.add @@ -6782,23 +6848,26 @@ i32.eqz if local.get $0 - local.get $8 + local.get $9 local.get $2 i64.load call $~lib/array/Array#__set - local.get $8 + local.get $9 i32.const 1 i32.add - local.set $8 + local.set $9 end - local.get $9 + local.get $8 i32.const 1 i32.add - local.set $9 + local.set $8 br $for-loop|0 end end local.get $0 + local.get $9 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result i64) local.get $1 @@ -7291,12 +7360,12 @@ local.get $6 i32.store offset=12 loop $for-loop|0 - local.get $9 + local.get $8 local.get $7 i32.lt_s if local.get $4 - local.get $9 + local.get $8 i32.const 4 i32.shl i32.add @@ -7307,23 +7376,26 @@ i32.eqz if local.get $0 - local.get $8 + local.get $9 local.get $2 i64.load call $~lib/array/Array#__set - local.get $8 + local.get $9 i32.const 1 i32.add - local.set $8 + local.set $9 end - local.get $9 + local.get $8 i32.const 1 i32.add - local.set $9 + local.set $8 br $for-loop|0 end end local.get $0 + local.get $9 + call $~lib/array/Array#set:length + local.get $0 ) (func $std/set/testNumeric (local $0 i64) @@ -7925,22 +7997,22 @@ (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - (local $3 i32) + (local $3 f32) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) (local $8 i32) (local $9 i32) - (local $10 f32) + (local $10 i32) local.get $0 i32.load offset=8 - local.set $8 + local.set $5 local.get $0 i32.load offset=16 - local.tee $5 - local.set $6 - local.get $5 + local.tee $8 + local.set $7 + local.get $8 i32.const 268435452 i32.gt_u if @@ -7951,14 +8023,14 @@ call $~lib/builtins/abort unreachable end - local.get $6 + local.get $7 i32.const 2 i32.shl - local.tee $7 + local.tee $6 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $1 - local.get $7 + local.tee $2 + local.get $6 call $~lib/memory/memory.fill i32.const 16 i32.const 20 @@ -7976,58 +8048,57 @@ local.get $0 i32.const 0 i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 + local.get $2 + local.set $1 + local.get $2 local.get $0 i32.load - local.tee $9 + local.tee $4 i32.ne if - local.get $2 + local.get $1 call $~lib/rt/pure/__retain - local.set $2 - local.get $9 + local.set $1 + local.get $4 call $~lib/rt/pure/__release end local.get $0 - local.get $2 + local.get $1 i32.store local.get $0 - local.get $1 + local.get $2 i32.store offset=4 local.get $0 - local.get $7 + local.get $6 i32.store offset=8 local.get $0 - local.get $6 + local.get $7 i32.store offset=12 loop $for-loop|0 - local.get $4 - local.get $5 + local.get $9 + local.get $8 i32.lt_s if - local.get $8 - local.get $4 + local.get $5 + local.get $9 i32.const 3 i32.shl i32.add - local.tee $1 + local.tee $2 i32.load offset=4 i32.const 1 i32.and i32.eqz if - local.get $1 + local.get $2 f32.load - local.set $10 - local.get $3 - local.tee $1 + local.set $3 + local.get $10 local.get $0 i32.load offset=12 i32.ge_u if - local.get $1 + local.get $10 i32.const 0 i32.lt_s if @@ -8039,7 +8110,7 @@ unreachable end local.get $0 - local.get $1 + local.get $10 i32.const 1 i32.add local.tee $2 @@ -8051,25 +8122,28 @@ end local.get $0 i32.load offset=4 - local.get $1 + local.get $10 i32.const 2 i32.shl i32.add - local.get $10 + local.get $3 f32.store - local.get $1 + local.get $10 i32.const 1 i32.add - local.set $3 + local.set $10 end - local.get $4 + local.get $9 i32.const 1 i32.add - local.set $4 + local.set $9 br $for-loop|0 end end local.get $0 + local.get $10 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result f32) local.get $1 @@ -8753,22 +8827,22 @@ (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - (local $3 i32) + (local $3 f64) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) (local $8 i32) (local $9 i32) - (local $10 f64) + (local $10 i32) local.get $0 i32.load offset=8 - local.set $8 + local.set $5 local.get $0 i32.load offset=16 - local.tee $5 - local.set $6 - local.get $5 + local.tee $8 + local.set $7 + local.get $8 i32.const 134217726 i32.gt_u if @@ -8779,14 +8853,14 @@ call $~lib/builtins/abort unreachable end - local.get $6 + local.get $7 i32.const 3 i32.shl - local.tee $7 + local.tee $6 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $1 - local.get $7 + local.tee $2 + local.get $6 call $~lib/memory/memory.fill i32.const 16 i32.const 22 @@ -8804,58 +8878,57 @@ local.get $0 i32.const 0 i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 + local.get $2 + local.set $1 + local.get $2 local.get $0 i32.load - local.tee $9 + local.tee $4 i32.ne if - local.get $2 + local.get $1 call $~lib/rt/pure/__retain - local.set $2 - local.get $9 + local.set $1 + local.get $4 call $~lib/rt/pure/__release end local.get $0 - local.get $2 + local.get $1 i32.store local.get $0 - local.get $1 + local.get $2 i32.store offset=4 local.get $0 - local.get $7 + local.get $6 i32.store offset=8 local.get $0 - local.get $6 + local.get $7 i32.store offset=12 loop $for-loop|0 - local.get $4 - local.get $5 + local.get $9 + local.get $8 i32.lt_s if - local.get $8 - local.get $4 + local.get $5 + local.get $9 i32.const 4 i32.shl i32.add - local.tee $1 + local.tee $2 i32.load offset=8 i32.const 1 i32.and i32.eqz if - local.get $1 + local.get $2 f64.load - local.set $10 - local.get $3 - local.tee $1 + local.set $3 + local.get $10 local.get $0 i32.load offset=12 i32.ge_u if - local.get $1 + local.get $10 i32.const 0 i32.lt_s if @@ -8867,7 +8940,7 @@ unreachable end local.get $0 - local.get $1 + local.get $10 i32.const 1 i32.add local.tee $2 @@ -8879,25 +8952,28 @@ end local.get $0 i32.load offset=4 - local.get $1 + local.get $10 i32.const 3 i32.shl i32.add - local.get $10 + local.get $3 f64.store - local.get $1 + local.get $10 i32.const 1 i32.add - local.set $3 + local.set $10 end - local.get $4 + local.get $9 i32.const 1 i32.add - local.set $4 + local.set $9 br $for-loop|0 end end local.get $0 + local.get $10 + call $~lib/array/Array#set:length + local.get $0 ) (func $~lib/array/Array#__get (param $0 i32) (param $1 i32) (result f64) local.get $1 diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 64dc49fd23..d25308241e 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -1,7 +1,7 @@ (module + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) @@ -1759,7 +1759,7 @@ if i32.const 192 i32.const 240 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable @@ -3862,6 +3862,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 0 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -3923,6 +3938,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -4950,6 +4968,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 0 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -5011,6 +5044,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -6068,6 +6104,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 1 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -6129,6 +6180,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -7172,6 +7226,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 1 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -7233,6 +7302,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -8314,6 +8386,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 2 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -8375,6 +8462,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -9404,6 +9494,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 2 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -9465,6 +9570,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -10596,6 +10704,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 3 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -10657,6 +10780,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -11706,6 +11832,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 3 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -11767,6 +11908,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -12783,6 +12927,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 2 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -12844,6 +13003,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -13861,6 +14023,21 @@ local.get $2 call $~lib/array/Array#__unchecked_set ) + (func $~lib/array/Array#set:length (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=12 + local.set $2 + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 3 + call $~lib/array/ensureSize + local.get $0 + local.get $1 + i32.store offset=12 + ) (func $~lib/set/Set#values (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -13922,6 +14099,9 @@ end end local.get $3 + local.get $4 + call $~lib/array/Array#set:length + local.get $3 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 5cc59379de..0644843b30 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -1619,7 +1619,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/string/String.fromCharCode|trampoline (param $0 i32) (result i32) + (func $~lib/string/String.fromCharCode@varargs (param $0 i32) (result i32) (local $1 i32) block $1of1 block $0of1 @@ -7079,7 +7079,7 @@ i32.const 1 global.set $~argumentsLength i32.const 0 - call $~lib/string/String.fromCharCode|trampoline + call $~lib/string/String.fromCharCode@varargs local.tee $41 i32.const 1296 call $~lib/string/String.__eq @@ -7095,7 +7095,7 @@ i32.const 1 global.set $~argumentsLength i32.const 54 - call $~lib/string/String.fromCharCode|trampoline + call $~lib/string/String.fromCharCode@varargs local.tee $42 i32.const 1472 call $~lib/string/String.__eq @@ -7111,7 +7111,7 @@ i32.const 1 global.set $~argumentsLength i32.const 65590 - call $~lib/string/String.fromCharCode|trampoline + call $~lib/string/String.fromCharCode@varargs local.tee $43 i32.const 1472 call $~lib/string/String.__eq diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 872cdae736..c409be3275 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -2179,7 +2179,7 @@ local.get $3 call $~lib/rt/pure/__retain ) - (func $~lib/string/String.fromCharCode|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.fromCharCode@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -11066,11 +11066,11 @@ call $~lib/builtins/abort unreachable end + i32.const 0 i32.const 1 global.set $~argumentsLength i32.const 0 - i32.const 0 - call $~lib/string/String.fromCharCode|trampoline + call $~lib/string/String.fromCharCode@varargs local.tee $0 i32.const 288 call $~lib/string/String.__eq @@ -11083,11 +11083,11 @@ call $~lib/builtins/abort unreachable end + i32.const 54 i32.const 1 global.set $~argumentsLength - i32.const 54 i32.const 0 - call $~lib/string/String.fromCharCode|trampoline + call $~lib/string/String.fromCharCode@varargs local.tee $1 i32.const 464 call $~lib/string/String.__eq @@ -11100,13 +11100,13 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength i32.const 65536 i32.const 54 i32.add + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/string/String.fromCharCode|trampoline + call $~lib/string/String.fromCharCode@varargs local.tee $2 i32.const 464 call $~lib/string/String.__eq diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 7698cecf1d..d52f3c51f4 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -314,7 +314,7 @@ if i32.const 1120 i32.const 1168 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 12b3d7081f..c042d623fb 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -417,7 +417,7 @@ if i32.const 112 i32.const 160 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 355a194694..2e7da3d719 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1471,7 +1471,7 @@ if i32.const 1040 i32.const 1088 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable @@ -3659,6 +3659,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $4 @@ -3670,13 +3671,15 @@ local.get $5 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $3 local.get $2 local.get $4 i32.add i32.load8_u + local.set $6 + i32.const 4 + global.set $~argumentsLength + local.get $3 + local.get $6 local.get $2 local.get $0 local.get $1 @@ -3744,6 +3747,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $4 @@ -3757,15 +3761,17 @@ local.get $5 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $3 local.get $4 local.get $2 i32.const 2 i32.shl i32.add i32.load + local.set $6 + i32.const 4 + global.set $~argumentsLength + local.get $3 + local.get $6 local.get $2 local.get $0 local.get $1 @@ -3838,6 +3844,7 @@ (local $3 i64) (local $4 i32) (local $5 i32) + (local $6 i64) local.get $0 i32.load offset=4 local.set $4 @@ -3851,15 +3858,17 @@ local.get $5 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $3 local.get $4 local.get $2 i32.const 3 i32.shl i32.add i64.load + local.set $6 + i32.const 4 + global.set $~argumentsLength + local.get $3 + local.get $6 local.get $2 local.get $0 local.get $1 @@ -3936,6 +3945,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $4 @@ -3949,13 +3959,15 @@ i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $3 local.get $2 local.get $4 i32.add i32.load8_u + local.set $5 + i32.const 4 + global.set $~argumentsLength + local.get $3 + local.get $5 local.get $2 local.get $0 local.get $1 @@ -3974,6 +3986,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $4 @@ -3989,15 +4002,17 @@ i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $3 local.get $4 local.get $2 i32.const 2 i32.shl i32.add i32.load + local.set $5 + i32.const 4 + global.set $~argumentsLength + local.get $3 + local.get $5 local.get $2 local.get $0 local.get $1 @@ -4016,6 +4031,7 @@ (local $2 i32) (local $3 i64) (local $4 i32) + (local $5 i64) local.get $0 i32.load offset=4 local.set $4 @@ -4031,15 +4047,17 @@ i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $3 local.get $4 local.get $2 i32.const 3 i32.shl i32.add i64.load + local.set $5 + i32.const 4 + global.set $~argumentsLength + local.get $3 + local.get $5 local.get $2 local.get $0 local.get $1 @@ -6309,6 +6327,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6321,19 +6340,19 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Int8Array,i8>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_s + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Int8Array,i8>|inlined.0 end local.get $2 @@ -6344,7 +6363,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6357,6 +6376,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6369,19 +6389,19 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Uint8Array,u8>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Uint8Array,u8>|inlined.0 end local.get $2 @@ -6392,7 +6412,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6406,6 +6426,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6420,21 +6441,21 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Int16Array,i16>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 1 i32.shl i32.add i32.load16_s + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Int16Array,i16>|inlined.0 end local.get $2 @@ -6445,7 +6466,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6458,6 +6479,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6472,21 +6494,21 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Uint16Array,u16>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 1 i32.shl i32.add i32.load16_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Uint16Array,u16>|inlined.0 end local.get $2 @@ -6497,7 +6519,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6509,6 +6531,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6523,21 +6546,21 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Int32Array,i32>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add i32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $i32_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Int32Array,i32>|inlined.0 end local.get $2 @@ -6548,7 +6571,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6563,7 +6586,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) + (local $5 i64) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6578,21 +6602,21 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Int64Array,i64>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add i64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $i64_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Int64Array,i64>|inlined.0 end local.get $2 @@ -6603,7 +6627,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 (param $0 i64) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6618,7 +6642,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) + (local $5 f32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6633,21 +6658,21 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Float32Array,f32>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add f32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $f32_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Float32Array,f32>|inlined.0 end local.get $2 @@ -6658,7 +6683,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 (param $0 f32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6674,7 +6699,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) + (local $5 f64) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6689,21 +6715,21 @@ i32.lt_s if block $~lib/typedarray/SOME<~lib/typedarray/Float64Array,f64>|inlined.0 - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add f64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 call_indirect (type $f64_i32_i32_=>_i32) if i32.const 1 - local.set $5 + local.set $6 br $~lib/typedarray/SOME<~lib/typedarray/Float64Array,f64>|inlined.0 end local.get $2 @@ -6714,7 +6740,7 @@ end end end - local.get $5 + local.get $6 ) (func $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 (param $0 f64) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -6725,6 +6751,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6737,12 +6764,12 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_s + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -6771,6 +6798,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6783,12 +6811,12 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -6810,6 +6838,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6824,14 +6853,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 1 i32.shl i32.add i32.load16_s + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -6860,6 +6889,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6874,14 +6904,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 1 i32.shl i32.add i32.load16_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -6903,6 +6933,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -6917,14 +6948,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add i32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -6951,6 +6982,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i64) local.get $0 i32.load offset=4 local.set $3 @@ -6965,14 +6997,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add i64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -6999,6 +7031,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 f32) local.get $0 i32.load offset=4 local.set $3 @@ -7013,14 +7046,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add f32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7047,6 +7080,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 f64) local.get $0 i32.load offset=4 local.set $3 @@ -7061,14 +7095,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add f64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7106,6 +7140,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7118,12 +7153,12 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_s + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7138,9 +7173,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -7153,6 +7188,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7165,12 +7201,12 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7185,9 +7221,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -7204,6 +7240,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7218,14 +7255,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 1 i32.shl i32.add i32.load16_s + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7240,15 +7277,16 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $~lib/typedarray/Uint16Array#every (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 i32.load offset=4 local.set $3 @@ -7263,14 +7301,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 1 i32.shl i32.add i32.load16_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7285,9 +7323,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -7300,6 +7338,7 @@ (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7314,14 +7353,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add i32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7336,9 +7375,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 (param $0 i64) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -7350,7 +7389,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) + (local $5 i64) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7365,14 +7405,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add i64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7387,9 +7427,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 (param $0 i64) (param $1 i32) (param $2 i32) (result i32) local.get $0 @@ -7554,7 +7594,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) + (local $5 f32) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7569,14 +7610,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add f32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7591,9 +7632,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $~lib/math/NativeMath.mod (param $0 f64) (result f64) (local $1 i64) @@ -7759,7 +7800,8 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) + (local $5 f64) + (local $6 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7774,14 +7816,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add f64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7796,9 +7838,9 @@ end end i32.const 1 - local.set $5 + local.set $6 end - local.get $5 + local.get $6 ) (func $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) local.get $0 @@ -7849,6 +7891,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7860,12 +7903,12 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $2 local.get $3 i32.add i32.load8_u + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -7968,6 +8011,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 local.set $3 @@ -7981,14 +8025,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 2 i32.shl i32.add i32.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -8047,6 +8091,7 @@ (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i64) local.get $0 i32.load offset=4 local.set $3 @@ -8060,14 +8105,14 @@ local.get $4 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $3 local.get $2 i32.const 3 i32.shl i32.add i64.load + i32.const 3 + global.set $~argumentsLength local.get $2 local.get $0 local.get $1 @@ -10873,7 +10918,7 @@ end local.get $2 ) - (func $~lib/typedarray/Int8Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Int8Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i32) block $1of1 block $0of1 @@ -11057,7 +11102,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -11070,7 +11115,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -11085,7 +11130,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -11100,7 +11145,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -11475,7 +11520,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -11488,7 +11533,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -11503,7 +11548,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -11518,7 +11563,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -11892,7 +11937,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -11905,7 +11950,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -11920,7 +11965,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -11935,7 +11980,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -12275,7 +12320,7 @@ end local.get $2 ) - (func $~lib/typedarray/Int16Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Int16Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i32) block $1of1 block $0of1 @@ -12461,7 +12506,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -12474,7 +12519,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -12489,7 +12534,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -12504,7 +12549,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -12878,7 +12923,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -12891,7 +12936,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -12906,7 +12951,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -12921,7 +12966,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -13257,7 +13302,7 @@ end local.get $2 ) - (func $~lib/typedarray/Int32Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Int32Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i32) block $1of1 block $0of1 @@ -13439,7 +13484,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -13452,7 +13497,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -13467,7 +13512,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -13482,7 +13527,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -13855,7 +13900,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -13868,7 +13913,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -13883,7 +13928,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -13898,7 +13943,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -14234,7 +14279,7 @@ end local.get $2 ) - (func $~lib/typedarray/Int64Array#lastIndexOf|trampoline (param $0 i32) (param $1 i64) (result i32) + (func $~lib/typedarray/Int64Array#lastIndexOf@varargs (param $0 i32) (param $1 i64) (result i32) (local $2 i32) block $1of1 block $0of1 @@ -14417,7 +14462,7 @@ global.set $~argumentsLength local.get $0 i64.const 0 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -14430,7 +14475,7 @@ global.set $~argumentsLength local.get $0 i64.const 11 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14445,7 +14490,7 @@ global.set $~argumentsLength local.get $0 i64.const -1 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14460,7 +14505,7 @@ global.set $~argumentsLength local.get $0 i64.const 3 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -14833,7 +14878,7 @@ global.set $~argumentsLength local.get $0 i64.const 0 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -14846,7 +14891,7 @@ global.set $~argumentsLength local.get $0 i64.const 11 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14861,7 +14906,7 @@ global.set $~argumentsLength local.get $0 i64.const -1 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14876,7 +14921,7 @@ global.set $~argumentsLength local.get $0 i64.const 3 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -15212,7 +15257,7 @@ end local.get $2 ) - (func $~lib/typedarray/Float32Array#lastIndexOf|trampoline (param $0 i32) (param $1 f32) (result i32) + (func $~lib/typedarray/Float32Array#lastIndexOf@varargs (param $0 i32) (param $1 f32) (result i32) (local $2 i32) block $1of1 block $0of1 @@ -15395,7 +15440,7 @@ global.set $~argumentsLength local.get $0 f32.const 0 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -15408,7 +15453,7 @@ global.set $~argumentsLength local.get $0 f32.const 11 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15423,7 +15468,7 @@ global.set $~argumentsLength local.get $0 f32.const -1 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15438,7 +15483,7 @@ global.set $~argumentsLength local.get $0 f32.const 3 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -15774,7 +15819,7 @@ end local.get $2 ) - (func $~lib/typedarray/Float64Array#lastIndexOf|trampoline (param $0 i32) (param $1 f64) (result i32) + (func $~lib/typedarray/Float64Array#lastIndexOf@varargs (param $0 i32) (param $1 f64) (result i32) (local $2 i32) block $1of1 block $0of1 @@ -15957,7 +16002,7 @@ global.set $~argumentsLength local.get $0 f64.const 0 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -15970,7 +16015,7 @@ global.set $~argumentsLength local.get $0 f64.const 11 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15985,7 +16030,7 @@ global.set $~argumentsLength local.get $0 f64.const -1 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -16000,7 +16045,7 @@ global.set $~argumentsLength local.get $0 f64.const 3 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -19294,7 +19339,7 @@ if i32.const 1040 i32.const 1088 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable @@ -19309,7 +19354,7 @@ local.get $1 call $~lib/rt/pure/__retain ) - (func $~lib/typedarray/Uint8Array.wrap|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Uint8Array.wrap@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) block $2of2 @@ -19631,7 +19676,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Uint8Array.wrap|trampoline + call $~lib/typedarray/Uint8Array.wrap@varargs local.set $4 loop $for-loop|1 local.get $2 @@ -25838,20 +25883,21 @@ (local $13 i32) (local $14 i32) (local $15 i32) - (local $16 f64) + (local $16 f32) (local $17 i32) (local $18 i32) (local $19 i32) (local $20 i64) - (local $21 f32) - (local $22 f64) - (local $23 i32) + (local $21 f64) + (local $22 f32) + (local $23 f64) (local $24 i32) (local $25 i32) (local $26 i32) (local $27 i32) (local $28 i32) (local $29 i32) + (local $30 i32) i32.const 0 call $std/typedarray/testInstantiate i32.const 5 @@ -26089,58 +26135,58 @@ block $~lib/typedarray/SORT<~lib/typedarray/Float64Array,f64>|inlined.0 local.get $0 call $~lib/rt/pure/__retain - local.tee $28 + local.tee $29 i32.load offset=8 i32.const 3 i32.shr_u - local.tee $29 + local.tee $30 i32.const 1 i32.le_s br_if $~lib/typedarray/SORT<~lib/typedarray/Float64Array,f64>|inlined.0 - local.get $28 + local.get $29 i32.load offset=4 local.set $1 - local.get $29 + local.get $30 i32.const 2 i32.eq if local.get $1 f64.load offset=8 - local.set $22 + local.set $23 local.get $1 f64.load - local.set $16 + local.set $21 i32.const 2 global.set $~argumentsLength - local.get $22 - local.get $16 + local.get $23 + local.get $21 call $~lib/util/sort/COMPARATOR~anonymous|0 i32.const 0 i32.lt_s if local.get $1 - local.get $16 + local.get $21 f64.store offset=8 local.get $1 - local.get $22 + local.get $23 f64.store end br $~lib/typedarray/SORT<~lib/typedarray/Float64Array,f64>|inlined.0 end - local.get $29 + local.get $30 i32.const 256 i32.lt_s if local.get $1 - local.get $29 + local.get $30 call $~lib/util/sort/insertionSort else local.get $1 - local.get $29 + local.get $30 call $~lib/util/sort/weakHeapSort end end - local.get $28 + local.get $29 call $~lib/rt/pure/__release local.get $0 i32.const 0 @@ -26273,7 +26319,7 @@ i32.const 1504 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $29 + local.tee $30 call $std/typedarray/isInt8ArrayEqual i32.eqz if @@ -26297,7 +26343,7 @@ i32.const 1584 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $28 + local.tee $29 call $std/typedarray/isInt8ArrayEqual i32.eqz if @@ -26321,7 +26367,7 @@ i32.const 1616 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $27 + local.tee $28 call $std/typedarray/isInt8ArrayEqual i32.eqz if @@ -26345,7 +26391,7 @@ i32.const 1648 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $25 + local.tee $27 call $std/typedarray/isInt8ArrayEqual i32.eqz if @@ -26433,7 +26479,7 @@ i32.const 1712 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $24 + local.tee $25 call $std/typedarray/isInt8ArrayEqual i32.eqz if @@ -26451,7 +26497,7 @@ i32.const 1744 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $23 + local.tee $24 call $std/typedarray/isInt8ArrayEqual i32.eqz if @@ -26464,21 +26510,21 @@ end local.get $1 call $~lib/rt/pure/__release + local.get $30 + call $~lib/rt/pure/__release local.get $29 call $~lib/rt/pure/__release local.get $28 call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release - local.get $25 - call $~lib/rt/pure/__release local.get $26 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release - local.get $24 + local.get $25 call $~lib/rt/pure/__release - local.get $23 + local.get $24 call $~lib/rt/pure/__release i32.const 5 call $~lib/typedarray/Int32Array#constructor @@ -26515,7 +26561,7 @@ i32.const 1776 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $29 + local.tee $30 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26539,7 +26585,7 @@ i32.const 1824 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $28 + local.tee $29 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26563,7 +26609,7 @@ i32.const 1872 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $27 + local.tee $28 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26587,7 +26633,7 @@ i32.const 1920 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $25 + local.tee $27 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26677,7 +26723,7 @@ i32.const 2016 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $24 + local.tee $25 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26695,7 +26741,7 @@ i32.const 2048 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $23 + local.tee $24 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26708,21 +26754,21 @@ end local.get $1 call $~lib/rt/pure/__release + local.get $30 + call $~lib/rt/pure/__release local.get $29 call $~lib/rt/pure/__release local.get $28 call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release - local.get $25 - call $~lib/rt/pure/__release local.get $26 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release - local.get $24 + local.get $25 call $~lib/rt/pure/__release - local.get $23 + local.get $24 call $~lib/rt/pure/__release i32.const 6 call $~lib/typedarray/Int8Array#constructor @@ -26807,7 +26853,7 @@ i32.const 1 i32.const 5 call $~lib/typedarray/Int8Array#subarray - local.tee $29 + local.tee $30 i32.const 0 call $~lib/typedarray/Int8Array#__get i32.const 3 @@ -26820,7 +26866,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.load offset=8 i32.const 4 i32.ne @@ -26832,7 +26878,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset i32.const 2 i32.ne @@ -26844,7 +26890,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.load offset=8 i32.const 4 i32.ne @@ -26856,11 +26902,11 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 1 i32.const 4 call $~lib/typedarray/Int8Array#subarray - local.tee $28 + local.tee $29 i32.const 0 call $~lib/typedarray/Int8Array#__get i32.const 4 @@ -26873,7 +26919,7 @@ call $~lib/builtins/abort unreachable end - local.get $28 + local.get $29 i32.load offset=8 i32.const 3 i32.ne @@ -26885,7 +26931,7 @@ call $~lib/builtins/abort unreachable end - local.get $28 + local.get $29 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset i32.const 3 i32.ne @@ -26897,7 +26943,7 @@ call $~lib/builtins/abort unreachable end - local.get $28 + local.get $29 i32.load offset=8 i32.const 3 i32.ne @@ -26913,9 +26959,9 @@ call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release - local.get $28 + local.get $29 call $~lib/rt/pure/__release i32.const 5 call $~lib/typedarray/Int32Array#constructor @@ -26943,20 +26989,20 @@ i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice - local.set $29 + local.set $30 local.get $1 i32.const 0 i32.const 3 i32.const 2147483647 call $~lib/typedarray/Int32Array#copyWithin - local.tee $27 + local.tee $28 i32.const 5 i32.const 2 i32.const 15 i32.const 2096 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $25 + local.tee $27 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26967,7 +27013,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -26986,7 +27032,7 @@ i32.const 2144 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $24 + local.tee $25 call $std/typedarray/isInt32ArrayEqual i32.eqz if @@ -26997,19 +27043,19 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice - local.set $28 + local.set $29 local.get $0 call $~lib/rt/pure/__release - local.get $28 + local.get $29 i32.const 1 i32.const 2 i32.const 2147483647 call $~lib/typedarray/Int32Array#copyWithin - local.tee $23 + local.tee $24 i32.const 5 i32.const 2 i32.const 15 @@ -27027,18 +27073,18 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice - local.get $28 + local.get $29 call $~lib/rt/pure/__release local.tee $0 i32.const 2 i32.const 2 i32.const 2147483647 call $~lib/typedarray/Int32Array#copyWithin - local.tee $28 + local.tee $29 i32.const 5 i32.const 2 i32.const 15 @@ -27056,7 +27102,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27085,7 +27131,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27114,7 +27160,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27143,7 +27189,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27172,7 +27218,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27201,7 +27247,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27230,7 +27276,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27259,7 +27305,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice @@ -27291,21 +27337,21 @@ end local.get $1 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release - local.get $27 + local.get $28 call $~lib/rt/pure/__release - local.get $25 + local.get $27 call $~lib/rt/pure/__release local.get $26 call $~lib/rt/pure/__release - local.get $24 + local.get $25 call $~lib/rt/pure/__release - local.get $23 + local.get $24 call $~lib/rt/pure/__release local.get $19 call $~lib/rt/pure/__release - local.get $28 + local.get $29 call $~lib/rt/pure/__release local.get $18 call $~lib/rt/pure/__release @@ -27367,7 +27413,7 @@ i32.const 1 i32.const 4 call $~lib/typedarray/Int32Array#subarray - local.tee $29 + local.tee $30 i32.load offset=8 i32.const 2 i32.shr_u @@ -27381,7 +27427,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset i32.const 4 i32.ne @@ -27393,7 +27439,7 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.load offset=8 i32.const 12 i32.ne @@ -27471,11 +27517,11 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Int32Array#slice - local.tee $28 + local.tee $29 i32.const 0 call $~lib/typedarray/Int32Array#__get i32.const 3 @@ -27488,7 +27534,7 @@ call $~lib/builtins/abort unreachable end - local.get $28 + local.get $29 i32.load offset=8 i32.const 2 i32.shr_u @@ -27502,7 +27548,7 @@ call $~lib/builtins/abort unreachable end - local.get $28 + local.get $29 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset if i32.const 0 @@ -27512,7 +27558,7 @@ call $~lib/builtins/abort unreachable end - local.get $28 + local.get $29 i32.load offset=8 i32.const 4 i32.ne @@ -27529,7 +27575,7 @@ i32.const 0 i32.const 2147483647 call $~lib/typedarray/Int32Array#slice - local.tee $27 + local.tee $28 i32.eq if i32.const 0 @@ -27539,7 +27585,7 @@ call $~lib/builtins/abort unreachable end - local.get $27 + local.get $28 i32.load offset=8 i32.const 2 i32.shr_u @@ -27556,7 +27602,7 @@ call $~lib/builtins/abort unreachable end - local.get $27 + local.get $28 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset local.get $1 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset @@ -27569,7 +27615,7 @@ call $~lib/builtins/abort unreachable end - local.get $27 + local.get $28 i32.load offset=8 local.get $1 i32.load offset=8 @@ -27584,25 +27630,25 @@ end local.get $1 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release - local.get $28 + local.get $29 call $~lib/rt/pure/__release - local.get $27 + local.get $28 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int8Array#constructor - local.tee $29 + local.tee $30 i32.const 0 i32.const 1 call $~lib/typedarray/Int8Array#__set - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Int8Array#__set - local.get $29 + local.get $30 i32.const 2 i32.const 3 call $~lib/typedarray/Int8Array#__set @@ -27610,24 +27656,26 @@ local.set $0 i32.const 0 local.set $1 - local.get $29 + local.get $30 i32.load offset=4 - local.set $28 - local.get $29 + local.set $29 + local.get $30 i32.load offset=8 - local.set $27 + local.set $28 loop $for-loop|0 local.get $0 - local.get $27 + local.get $28 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $1 local.get $0 - local.get $28 + local.get $29 i32.add i32.load8_s + local.set $27 + i32.const 4 + global.set $~argumentsLength + local.get $1 + local.get $27 i32.add local.set $1 local.get $0 @@ -27660,7 +27708,7 @@ i32.const 6 i32.ne br_if $folding-inner2 - local.get $29 + local.get $30 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Uint8Array#constructor @@ -27712,15 +27760,15 @@ call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int16Array#constructor - local.tee $29 + local.tee $30 i32.const 0 i32.const 1 call $~lib/typedarray/Int16Array#__set - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Int16Array#__set - local.get $29 + local.get $30 i32.const 2 i32.const 3 call $~lib/typedarray/Int16Array#__set @@ -27728,28 +27776,30 @@ local.set $0 i32.const 0 local.set $1 - local.get $29 + local.get $30 i32.load offset=4 - local.set $28 - local.get $29 + local.set $29 + local.get $30 i32.load offset=8 i32.const 1 i32.shr_u - local.set $27 + local.set $28 loop $for-loop|00 local.get $0 - local.get $27 + local.get $28 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $1 - local.get $28 + local.get $29 local.get $0 i32.const 1 i32.shl i32.add i32.load16_s + local.set $27 + i32.const 4 + global.set $~argumentsLength + local.get $1 + local.get $27 i32.add local.set $1 local.get $0 @@ -27765,19 +27815,19 @@ i32.const 6 i32.ne br_if $folding-inner2 - local.get $29 + local.get $30 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Uint16Array#constructor - local.tee $29 + local.tee $30 i32.const 0 i32.const 1 call $~lib/typedarray/Uint16Array#__set - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Uint16Array#__set - local.get $29 + local.get $30 i32.const 2 i32.const 3 call $~lib/typedarray/Uint16Array#__set @@ -27785,28 +27835,30 @@ local.set $0 i32.const 0 local.set $1 - local.get $29 + local.get $30 i32.load offset=4 - local.set $28 - local.get $29 + local.set $29 + local.get $30 i32.load offset=8 i32.const 1 i32.shr_u - local.set $27 + local.set $28 loop $for-loop|01 local.get $0 - local.get $27 + local.get $28 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $1 - local.get $28 + local.get $29 local.get $0 i32.const 1 i32.shl i32.add i32.load16_u + local.set $27 + i32.const 4 + global.set $~argumentsLength + local.get $1 + local.get $27 i32.add local.set $1 local.get $0 @@ -27822,7 +27874,7 @@ i32.const 6 i32.ne br_if $folding-inner2 - local.get $29 + local.get $30 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int32Array#constructor @@ -27914,132 +27966,136 @@ call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Float32Array#constructor - local.tee $0 + local.tee $1 i32.const 0 f32.const 1 call $~lib/typedarray/Float32Array#__set - local.get $0 + local.get $1 i32.const 1 f32.const 2 call $~lib/typedarray/Float32Array#__set - local.get $0 + local.get $1 i32.const 2 f32.const 3 call $~lib/typedarray/Float32Array#__set i32.const 0 - local.set $1 - local.get $0 + local.set $0 + local.get $1 i32.load offset=4 - local.set $29 - local.get $0 + local.set $30 + local.get $1 i32.load offset=8 i32.const 2 i32.shr_u - local.set $28 + local.set $29 loop $for-loop|02 - local.get $1 - local.get $28 + local.get $0 + local.get $29 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $21 - local.get $29 - local.get $1 + local.get $30 + local.get $0 i32.const 2 i32.shl i32.add f32.load + local.set $16 + i32.const 4 + global.set $~argumentsLength + local.get $22 + local.get $16 f32.add - local.set $21 - local.get $1 + local.set $22 + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $for-loop|02 end end - local.get $21 + local.get $22 f32.const 6 f32.ne br_if $folding-inner2 - local.get $0 + local.get $1 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Float64Array#constructor - local.tee $0 + local.tee $1 i32.const 0 f64.const 1 call $~lib/typedarray/Float64Array#__set - local.get $0 + local.get $1 i32.const 1 f64.const 2 call $~lib/typedarray/Float64Array#__set - local.get $0 + local.get $1 i32.const 2 f64.const 3 call $~lib/typedarray/Float64Array#__set i32.const 0 - local.set $1 + local.set $0 f64.const 0 - local.set $22 - local.get $0 + local.set $23 + local.get $1 i32.load offset=4 - local.set $29 - local.get $0 + local.set $30 + local.get $1 i32.load offset=8 i32.const 3 i32.shr_u - local.set $28 + local.set $29 loop $for-loop|03 - local.get $1 - local.get $28 + local.get $0 + local.get $29 i32.lt_s if - i32.const 4 - global.set $~argumentsLength - local.get $22 - local.get $29 - local.get $1 + local.get $30 + local.get $0 i32.const 3 i32.shl i32.add f64.load + local.set $21 + i32.const 4 + global.set $~argumentsLength + local.get $23 + local.get $21 f64.add - local.set $22 - local.get $1 + local.set $23 + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $for-loop|03 end end - local.get $22 + local.get $23 f64.const 6 f64.ne br_if $folding-inner2 - local.get $0 + local.get $1 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int8Array#constructor - local.tee $29 + local.tee $30 i32.const 0 i32.const 1 call $~lib/typedarray/Int8Array#__set - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Int8Array#__set - local.get $29 + local.get $30 i32.const 2 i32.const 3 call $~lib/typedarray/Int8Array#__set i32.const 0 local.set $0 - local.get $29 + local.get $30 i32.load offset=4 - local.set $28 - local.get $29 + local.set $29 + local.get $30 i32.load offset=8 i32.const 1 i32.sub @@ -28049,14 +28105,16 @@ i32.const 0 i32.ge_s if + local.get $1 + local.get $29 + i32.add + i32.load8_s + local.set $28 i32.const 4 global.set $~argumentsLength local.get $0 - local.get $1 local.get $28 i32.add - i32.load8_s - i32.add local.set $0 local.get $1 i32.const 1 @@ -28071,7 +28129,7 @@ i32.const 6 i32.ne br_if $folding-inner3 - local.get $29 + local.get $30 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Uint8Array#constructor @@ -28123,24 +28181,24 @@ call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int16Array#constructor - local.tee $29 + local.tee $30 i32.const 0 i32.const 1 call $~lib/typedarray/Int16Array#__set - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Int16Array#__set - local.get $29 + local.get $30 i32.const 2 i32.const 3 call $~lib/typedarray/Int16Array#__set i32.const 0 local.set $0 - local.get $29 + local.get $30 i32.load offset=4 - local.set $28 - local.get $29 + local.set $29 + local.get $30 i32.load offset=8 i32.const 1 i32.shr_u @@ -28152,15 +28210,17 @@ i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $0 - local.get $28 + local.get $29 local.get $1 i32.const 1 i32.shl i32.add i32.load16_s + local.set $28 + i32.const 4 + global.set $~argumentsLength + local.get $0 + local.get $28 i32.add local.set $0 local.get $1 @@ -28176,28 +28236,28 @@ i32.const 6 i32.ne br_if $folding-inner3 - local.get $29 + local.get $30 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Uint16Array#constructor - local.tee $29 + local.tee $30 i32.const 0 i32.const 1 call $~lib/typedarray/Uint16Array#__set - local.get $29 + local.get $30 i32.const 1 i32.const 2 call $~lib/typedarray/Uint16Array#__set - local.get $29 + local.get $30 i32.const 2 i32.const 3 call $~lib/typedarray/Uint16Array#__set i32.const 0 local.set $0 - local.get $29 + local.get $30 i32.load offset=4 - local.set $28 - local.get $29 + local.set $29 + local.get $30 i32.load offset=8 i32.const 1 i32.shr_u @@ -28209,15 +28269,17 @@ i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $0 - local.get $28 + local.get $29 local.get $1 i32.const 1 i32.shl i32.add i32.load16_u + local.set $28 + i32.const 4 + global.set $~argumentsLength + local.get $0 + local.get $28 i32.add local.set $0 local.get $1 @@ -28233,7 +28295,7 @@ i32.const 6 i32.ne br_if $folding-inner3 - local.get $29 + local.get $30 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int32Array#constructor @@ -28326,113 +28388,117 @@ call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Float32Array#constructor - local.tee $1 + local.tee $0 i32.const 0 f32.const 1 call $~lib/typedarray/Float32Array#__set - local.get $1 + local.get $0 i32.const 1 f32.const 2 call $~lib/typedarray/Float32Array#__set - local.get $1 + local.get $0 i32.const 2 f32.const 3 call $~lib/typedarray/Float32Array#__set f32.const 0 - local.set $21 - local.get $1 + local.set $22 + local.get $0 i32.load offset=4 - local.set $29 - local.get $1 + local.set $30 + local.get $0 i32.load offset=8 i32.const 2 i32.shr_u i32.const 1 i32.sub - local.set $0 + local.set $1 loop $for-loop|07 - local.get $0 + local.get $1 i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $21 - local.get $29 - local.get $0 + local.get $30 + local.get $1 i32.const 2 i32.shl i32.add f32.load + local.set $16 + i32.const 4 + global.set $~argumentsLength + local.get $22 + local.get $16 f32.add - local.set $21 - local.get $0 + local.set $22 + local.get $1 i32.const 1 i32.sub - local.set $0 + local.set $1 br $for-loop|07 end end - local.get $21 + local.get $22 f32.const 6 f32.ne br_if $folding-inner1 - local.get $1 + local.get $0 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Float64Array#constructor - local.tee $1 + local.tee $0 i32.const 0 f64.const 1 call $~lib/typedarray/Float64Array#__set - local.get $1 + local.get $0 i32.const 1 f64.const 2 call $~lib/typedarray/Float64Array#__set - local.get $1 + local.get $0 i32.const 2 f64.const 3 call $~lib/typedarray/Float64Array#__set f64.const 0 - local.set $22 - local.get $1 + local.set $23 + local.get $0 i32.load offset=4 - local.set $29 - local.get $1 + local.set $30 + local.get $0 i32.load offset=8 i32.const 3 i32.shr_u i32.const 1 i32.sub - local.set $0 + local.set $1 loop $for-loop|08 - local.get $0 + local.get $1 i32.const 0 i32.ge_s if - i32.const 4 - global.set $~argumentsLength - local.get $22 - local.get $29 - local.get $0 + local.get $30 + local.get $1 i32.const 3 i32.shl i32.add f64.load + local.set $21 + i32.const 4 + global.set $~argumentsLength + local.get $23 + local.get $21 f64.add - local.set $22 - local.get $0 + local.set $23 + local.get $1 i32.const 1 i32.sub - local.set $0 + local.set $1 br $for-loop|08 end end - local.get $22 + local.get $23 f64.const 6 f64.ne br_if $folding-inner1 - local.get $1 + local.get $0 call $~lib/rt/pure/__release i32.const 3 call $~lib/typedarray/Int8Array#constructor @@ -28452,34 +28518,35 @@ local.set $1 local.get $0 i32.load offset=8 - local.set $28 + local.set $29 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 3 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $28 + local.set $30 + local.get $29 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $27 + local.set $28 loop $for-loop|09 local.get $1 - local.get $28 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $1 - local.get $27 + local.get $26 i32.add + i32.load8_s + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $1 - local.get $25 + local.get $28 i32.add - i32.load8_s - local.tee $26 - local.get $26 + local.get $27 + local.get $27 i32.mul i32.store8 local.get $1 @@ -28489,17 +28556,17 @@ br $for-loop|09 end end - local.get $29 - local.get $27 + local.get $30 + local.get $28 call $~lib/rt/pure/__retain i32.store - local.get $29 - local.get $27 + local.get $30 + local.get $28 i32.store offset=4 + local.get $30 local.get $29 - local.get $28 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -28541,34 +28608,35 @@ local.set $1 local.get $0 i32.load offset=8 - local.set $28 + local.set $29 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 4 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $28 + local.set $30 + local.get $29 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $27 + local.set $28 loop $for-loop|010 local.get $1 - local.get $28 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $1 - local.get $27 + local.get $26 i32.add + i32.load8_u + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $1 - local.get $25 + local.get $28 i32.add - i32.load8_u - local.tee $26 - local.get $26 + local.get $27 + local.get $27 i32.mul i32.store8 local.get $1 @@ -28578,17 +28646,17 @@ br $for-loop|010 end end - local.get $29 - local.get $27 + local.get $30 + local.get $28 call $~lib/rt/pure/__retain i32.store - local.get $29 - local.get $27 + local.get $30 + local.get $28 i32.store offset=4 + local.get $30 local.get $29 - local.get $28 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -28630,34 +28698,35 @@ local.set $1 local.get $0 i32.load offset=8 - local.set $28 + local.set $29 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 5 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $28 + local.set $30 + local.get $29 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $27 + local.set $28 loop $for-loop|011 local.get $1 - local.get $28 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $1 - local.get $27 + local.get $26 i32.add + i32.load8_u + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $1 - local.get $25 + local.get $28 i32.add - i32.load8_u - local.tee $26 - local.get $26 + local.get $27 + local.get $27 i32.mul i32.store8 local.get $1 @@ -28667,17 +28736,17 @@ br $for-loop|011 end end - local.get $29 - local.get $27 + local.get $30 + local.get $28 call $~lib/rt/pure/__retain i32.store - local.get $29 - local.get $27 + local.get $30 + local.get $28 i32.store offset=4 + local.get $30 local.get $29 - local.get $28 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -28721,43 +28790,42 @@ i32.load offset=8 i32.const 1 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 6 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 1 i32.shl - local.tee $26 + local.tee $25 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|012 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $26 local.get $1 i32.const 1 i32.shl local.tee $24 i32.add i32.load16_s - local.tee $23 - local.get $23 - i32.mul - local.set $23 + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $24 - local.get $28 + local.get $29 i32.add - local.get $23 + local.get $27 + local.get $27 + i32.mul i32.store16 local.get $1 i32.const 1 @@ -28766,17 +28834,17 @@ br $for-loop|012 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 - local.get $26 + local.get $30 + local.get $25 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -28820,43 +28888,42 @@ i32.load offset=8 i32.const 1 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 7 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 1 i32.shl - local.tee $26 + local.tee $25 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|013 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $26 local.get $1 i32.const 1 i32.shl local.tee $24 i32.add i32.load16_u - local.tee $23 - local.get $23 - i32.mul - local.set $23 + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $24 - local.get $28 + local.get $29 i32.add - local.get $23 + local.get $27 + local.get $27 + i32.mul i32.store16 local.get $1 i32.const 1 @@ -28865,17 +28932,17 @@ br $for-loop|013 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 - local.get $26 + local.get $30 + local.get $25 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -28919,43 +28986,42 @@ i32.load offset=8 i32.const 2 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 8 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 2 i32.shl - local.tee $26 + local.tee $25 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|014 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $26 local.get $1 i32.const 2 i32.shl local.tee $24 i32.add i32.load - local.tee $23 - local.get $23 - i32.mul - local.set $23 + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $24 - local.get $28 + local.get $29 i32.add - local.get $23 + local.get $27 + local.get $27 + i32.mul i32.store local.get $1 i32.const 1 @@ -28964,17 +29030,17 @@ br $for-loop|014 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 - local.get $26 + local.get $30 + local.get $25 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -29018,43 +29084,42 @@ i32.load offset=8 i32.const 2 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $26 i32.const 12 i32.const 9 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 2 i32.shl - local.tee $26 + local.tee $25 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|015 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $26 local.get $1 i32.const 2 i32.shl local.tee $24 i32.add i32.load - local.tee $23 - local.get $23 - i32.mul - local.set $23 + local.set $27 + i32.const 3 + global.set $~argumentsLength local.get $24 - local.get $28 + local.get $29 i32.add - local.get $23 + local.get $27 + local.get $27 + i32.mul i32.store local.get $1 i32.const 1 @@ -29063,17 +29128,17 @@ br $for-loop|015 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 - local.get $26 + local.get $30 + local.get $25 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -29117,43 +29182,42 @@ i32.load offset=8 i32.const 3 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $27 i32.const 12 i32.const 10 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 3 i32.shl local.tee $26 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|016 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $27 local.get $1 i32.const 3 i32.shl - local.tee $24 + local.tee $25 i32.add i64.load - local.tee $20 - local.get $20 - i64.mul local.set $20 - local.get $24 - local.get $28 + i32.const 3 + global.set $~argumentsLength + local.get $25 + local.get $29 i32.add local.get $20 + local.get $20 + i64.mul i64.store local.get $1 i32.const 1 @@ -29162,17 +29226,17 @@ br $for-loop|016 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 + local.get $30 local.get $26 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -29216,43 +29280,42 @@ i32.load offset=8 i32.const 3 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $27 i32.const 12 i32.const 11 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 3 i32.shl local.tee $26 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|017 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $27 local.get $1 i32.const 3 i32.shl - local.tee $24 + local.tee $25 i32.add i64.load - local.tee $20 - local.get $20 - i64.mul local.set $20 - local.get $24 - local.get $28 + i32.const 3 + global.set $~argumentsLength + local.get $25 + local.get $29 i32.add local.get $20 + local.get $20 + i64.mul i64.store local.get $1 i32.const 1 @@ -29261,17 +29324,17 @@ br $for-loop|017 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 + local.get $30 local.get $26 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -29315,43 +29378,42 @@ i32.load offset=8 i32.const 2 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $27 i32.const 12 i32.const 12 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 2 i32.shl local.tee $26 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|018 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $27 local.get $1 i32.const 2 i32.shl - local.tee $24 + local.tee $25 i32.add f32.load - local.tee $21 - local.get $21 - f32.mul - local.set $21 - local.get $24 - local.get $28 + local.set $22 + i32.const 3 + global.set $~argumentsLength + local.get $25 + local.get $29 i32.add - local.get $21 + local.get $22 + local.get $22 + f32.mul f32.store local.get $1 i32.const 1 @@ -29360,17 +29422,17 @@ br $for-loop|018 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 + local.get $30 local.get $26 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -29414,43 +29476,42 @@ i32.load offset=8 i32.const 3 i32.shr_u - local.set $27 + local.set $28 local.get $0 i32.load offset=4 - local.set $25 + local.set $27 i32.const 12 i32.const 13 call $~lib/rt/tlsf/__alloc - local.set $29 - local.get $27 + local.set $30 + local.get $28 i32.const 3 i32.shl local.tee $26 i32.const 0 call $~lib/rt/tlsf/__alloc - local.set $28 + local.set $29 loop $for-loop|019 local.get $1 - local.get $27 + local.get $28 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $25 + local.get $27 local.get $1 i32.const 3 i32.shl - local.tee $24 + local.tee $25 i32.add f64.load - local.tee $22 - local.get $22 - f64.mul - local.set $22 - local.get $24 - local.get $28 + local.set $23 + i32.const 3 + global.set $~argumentsLength + local.get $25 + local.get $29 i32.add - local.get $22 + local.get $23 + local.get $23 + f64.mul f64.store local.get $1 i32.const 1 @@ -29459,17 +29520,17 @@ br $for-loop|019 end end + local.get $30 local.get $29 - local.get $28 call $~lib/rt/pure/__retain i32.store + local.get $30 local.get $29 - local.get $28 i32.store offset=4 - local.get $29 + local.get $30 local.get $26 i32.store offset=8 - local.get $29 + local.get $30 call $~lib/rt/pure/__retain local.tee $1 i32.const 0 @@ -30402,21 +30463,21 @@ local.set $1 local.get $0 i32.load offset=4 - local.set $29 + local.set $30 local.get $0 i32.load offset=8 - local.set $28 + local.set $29 loop $for-loop|020 local.get $1 - local.get $28 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength local.get $1 - local.get $29 + local.get $30 i32.add i32.load8_s + i32.const 3 + global.set $~argumentsLength local.get $1 local.get $0 call $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 @@ -30551,25 +30612,25 @@ local.set $1 local.get $0 i32.load offset=4 - local.set $29 + local.set $30 local.get $0 i32.load offset=8 i32.const 1 i32.shr_u - local.set $28 + local.set $29 loop $for-loop|021 local.get $1 - local.get $28 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $29 + local.get $30 local.get $1 i32.const 1 i32.shl i32.add i32.load16_s + i32.const 3 + global.set $~argumentsLength local.get $1 local.get $0 call $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 @@ -30620,25 +30681,25 @@ local.set $1 local.get $0 i32.load offset=4 - local.set $29 + local.set $30 local.get $0 i32.load offset=8 i32.const 1 i32.shr_u - local.set $28 + local.set $29 loop $for-loop|022 local.get $1 - local.get $28 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $29 + local.get $30 local.get $1 i32.const 1 i32.shl i32.add i32.load16_u + i32.const 3 + global.set $~argumentsLength local.get $1 local.get $0 call $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 @@ -30797,23 +30858,23 @@ global.set $std/typedarray/forEachCallCount i32.const 3 call $~lib/typedarray/Float32Array#constructor - local.tee $0 + local.tee $1 global.set $std/typedarray/forEachSelf - local.get $0 + local.get $1 i32.const 0 i32.const 2704 i32.const 0 call $~lib/array/Array#__get f32.convert_i32_s call $~lib/typedarray/Float32Array#__set - local.get $0 + local.get $1 i32.const 1 i32.const 2704 i32.const 1 call $~lib/array/Array#__get f32.convert_i32_s call $~lib/typedarray/Float32Array#__set - local.get $0 + local.get $1 i32.const 2 i32.const 2704 i32.const 2 @@ -30821,35 +30882,35 @@ f32.convert_i32_s call $~lib/typedarray/Float32Array#__set i32.const 0 - local.set $1 - local.get $0 + local.set $0 + local.get $1 i32.load offset=4 - local.set $29 - local.get $0 + local.set $30 + local.get $1 i32.load offset=8 i32.const 2 i32.shr_u - local.set $28 + local.set $29 loop $for-loop|023 - local.get $1 - local.get $28 + local.get $0 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $29 - local.get $1 + local.get $30 + local.get $0 i32.const 2 i32.shl i32.add f32.load - local.get $1 + i32.const 3 + global.set $~argumentsLength local.get $0 - call $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 local.get $1 + call $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $for-loop|023 end end @@ -30857,29 +30918,29 @@ i32.const 3 i32.ne br_if $folding-inner13 - local.get $0 + local.get $1 call $~lib/rt/pure/__release i32.const 0 global.set $std/typedarray/forEachCallCount i32.const 3 call $~lib/typedarray/Float64Array#constructor - local.tee $0 + local.tee $1 global.set $std/typedarray/forEachSelf - local.get $0 + local.get $1 i32.const 0 i32.const 2704 i32.const 0 call $~lib/array/Array#__get f64.convert_i32_s call $~lib/typedarray/Float64Array#__set - local.get $0 + local.get $1 i32.const 1 i32.const 2704 i32.const 1 call $~lib/array/Array#__get f64.convert_i32_s call $~lib/typedarray/Float64Array#__set - local.get $0 + local.get $1 i32.const 2 i32.const 2704 i32.const 2 @@ -30887,35 +30948,35 @@ f64.convert_i32_s call $~lib/typedarray/Float64Array#__set i32.const 0 - local.set $1 - local.get $0 + local.set $0 + local.get $1 i32.load offset=4 - local.set $29 - local.get $0 + local.set $30 + local.get $1 i32.load offset=8 i32.const 3 i32.shr_u - local.set $28 + local.set $29 loop $for-loop|024 - local.get $1 - local.get $28 + local.get $0 + local.get $29 i32.lt_s if - i32.const 3 - global.set $~argumentsLength - local.get $29 - local.get $1 + local.get $30 + local.get $0 i32.const 3 i32.shl i32.add f64.load - local.get $1 + i32.const 3 + global.set $~argumentsLength local.get $0 - call $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0 local.get $1 + call $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0 + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $for-loop|024 end end @@ -30923,7 +30984,7 @@ i32.const 3 i32.ne br_if $folding-inner13 - local.get $0 + local.get $1 call $~lib/rt/pure/__release call $std/typedarray/testArrayReverse<~lib/typedarray/Int8Array,i8> call $std/typedarray/testArrayReverse<~lib/typedarray/Uint8Array,u8> @@ -30949,11 +31010,11 @@ call $std/typedarray/testArrayIndexOfAndLastIndexOf<~lib/typedarray/Float64Array,f64> i32.const 1 call $~lib/typedarray/Float64Array#constructor - local.tee $29 + local.tee $30 i32.const 0 f64.const nan:0x8000000000000 call $~lib/typedarray/Float64Array#__set - local.get $29 + local.get $30 f64.const nan:0x8000000000000 i32.const 0 call $~lib/typedarray/Float64Array#indexOf @@ -30968,61 +31029,61 @@ unreachable end i32.const 0 - local.set $1 - i32.const 0 local.set $0 + i32.const 0 + local.set $1 block $~lib/typedarray/INCLUDES<~lib/typedarray/Float64Array,f64>|inlined.0 - local.get $29 + local.get $30 i32.load offset=8 i32.const 3 i32.shr_u - local.tee $28 + local.tee $29 if (result i32) i32.const 0 - local.get $28 + local.get $29 i32.ge_s else i32.const 1 end br_if $~lib/typedarray/INCLUDES<~lib/typedarray/Float64Array,f64>|inlined.0 - local.get $29 + local.get $30 i32.load offset=4 - local.set $25 + local.set $27 loop $while-continue|0 - local.get $1 - local.get $28 + local.get $0 + local.get $29 i32.lt_s if - local.get $25 - local.get $1 + local.get $27 + local.get $0 i32.const 3 i32.shl i32.add f64.load - local.tee $22 + local.tee $23 f64.const nan:0x8000000000000 f64.eq if (result i32) i32.const 1 else - local.get $22 - local.get $22 + local.get $23 + local.get $23 f64.ne end if i32.const 1 - local.set $0 + local.set $1 br $~lib/typedarray/INCLUDES<~lib/typedarray/Float64Array,f64>|inlined.0 end - local.get $1 + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $while-continue|0 end end end - local.get $0 + local.get $1 i32.const 0 i32.ne i32.const 1 @@ -31037,11 +31098,11 @@ end i32.const 1 call $~lib/typedarray/Float32Array#constructor - local.tee $0 + local.tee $29 i32.const 0 f32.const nan:0x400000 call $~lib/typedarray/Float32Array#__set - local.get $0 + local.get $29 f32.const nan:0x400000 i32.const 0 call $~lib/typedarray/Float32Array#indexOf @@ -31056,61 +31117,61 @@ unreachable end i32.const 0 - local.set $28 - i32.const 0 local.set $1 + i32.const 0 + local.set $0 block $~lib/typedarray/INCLUDES<~lib/typedarray/Float32Array,f32>|inlined.0 - local.get $0 + local.get $29 i32.load offset=8 i32.const 2 i32.shr_u - local.tee $27 + local.tee $28 if (result i32) i32.const 0 - local.get $27 + local.get $28 i32.ge_s else i32.const 1 end br_if $~lib/typedarray/INCLUDES<~lib/typedarray/Float32Array,f32>|inlined.0 - local.get $0 + local.get $29 i32.load offset=4 local.set $26 loop $while-continue|025 + local.get $1 local.get $28 - local.get $27 i32.lt_s if local.get $26 - local.get $28 + local.get $1 i32.const 2 i32.shl i32.add f32.load - local.tee $21 + local.tee $22 f32.const nan:0x400000 f32.eq if (result i32) i32.const 1 else - local.get $21 - local.get $21 + local.get $22 + local.get $22 f32.ne end if i32.const 1 - local.set $1 + local.set $0 br $~lib/typedarray/INCLUDES<~lib/typedarray/Float32Array,f32>|inlined.0 end - local.get $28 + local.get $1 i32.const 1 i32.add - local.set $28 + local.set $1 br $while-continue|025 end end end - local.get $1 + local.get $0 i32.const 0 i32.ne i32.const 1 @@ -31123,9 +31184,9 @@ call $~lib/builtins/abort unreachable end - local.get $29 + local.get $30 call $~lib/rt/pure/__release - local.get $0 + local.get $29 call $~lib/rt/pure/__release i32.const 5 call $~lib/typedarray/Int8Array#constructor @@ -31158,14 +31219,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Int8Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31194,7 +31255,7 @@ call $~lib/typedarray/Uint8Array#__set local.get $1 call $~lib/typedarray/Uint8Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz @@ -31206,7 +31267,7 @@ call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 - local.get $29 + local.get $30 call $~lib/rt/pure/__release call $~lib/rt/pure/__release local.get $1 @@ -31236,7 +31297,7 @@ call $~lib/typedarray/Uint8ClampedArray#__set local.get $1 call $~lib/typedarray/Uint8Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz @@ -31248,7 +31309,7 @@ call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 - local.get $29 + local.get $30 call $~lib/rt/pure/__release call $~lib/rt/pure/__release local.get $1 @@ -31284,14 +31345,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Int16Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31326,14 +31387,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Uint16Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31368,14 +31429,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Int32Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31410,14 +31471,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Uint32Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31452,14 +31513,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Int64Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31494,14 +31555,14 @@ br_if $folding-inner0 local.get $1 call $~lib/typedarray/Uint64Array#join - local.tee $29 + local.tee $30 i32.const 3008 call $~lib/string/String.__eq i32.eqz br_if $folding-inner18 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31536,14 +31597,14 @@ br_if $folding-inner16 local.get $1 call $~lib/typedarray/Float32Array#join - local.tee $29 + local.tee $30 i32.const 4112 call $~lib/string/String.__eq i32.eqz br_if $folding-inner17 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31578,14 +31639,14 @@ br_if $folding-inner16 local.get $1 call $~lib/typedarray/Float64Array#join - local.tee $29 + local.tee $30 i32.const 4112 call $~lib/string/String.__eq i32.eqz br_if $folding-inner17 local.get $0 call $~lib/rt/pure/__release - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -31596,8 +31657,8 @@ global.set $~argumentsLength local.get $1 i32.const 0 - call $~lib/typedarray/Uint8Array.wrap|trampoline - local.tee $29 + call $~lib/typedarray/Uint8Array.wrap@varargs + local.tee $30 i32.load offset=8 if i32.const 0 @@ -31616,9 +31677,9 @@ global.set $~argumentsLength local.get $0 i32.const 2 - call $~lib/typedarray/Uint8Array.wrap|trampoline + call $~lib/typedarray/Uint8Array.wrap@varargs local.set $1 - local.get $29 + local.get $30 call $~lib/rt/pure/__release local.get $1 i32.load offset=8 @@ -31661,49 +31722,49 @@ local.set $0 i32.const 3 call $~lib/typedarray/Float32Array#constructor - local.tee $29 + local.tee $30 i32.const 0 f32.const 400 call $~lib/typedarray/Float32Array#__set - local.get $29 + local.get $30 i32.const 1 f32.const nan:0x400000 call $~lib/typedarray/Float32Array#__set - local.get $29 + local.get $30 i32.const 2 f32.const inf call $~lib/typedarray/Float32Array#__set i32.const 4 call $~lib/typedarray/Int64Array#constructor - local.tee $28 + local.tee $29 i32.const 0 i64.const -10 call $~lib/typedarray/Int64Array#__set - local.get $28 + local.get $29 i32.const 1 i64.const 100 call $~lib/typedarray/Int64Array#__set - local.get $28 + local.get $29 i32.const 2 i64.const 10 call $~lib/typedarray/Int64Array#__set - local.get $28 + local.get $29 i32.const 3 i64.const 300 call $~lib/typedarray/Int64Array#__set i32.const 2 call $~lib/typedarray/Int32Array#constructor - local.tee $27 + local.tee $28 i32.const 0 i32.const 300 call $~lib/typedarray/Int32Array#__set - local.get $27 + local.get $28 i32.const 1 i32.const -1 call $~lib/typedarray/Int32Array#__set i32.const 0 local.set $1 - local.get $29 + local.get $30 i32.load offset=8 i32.const 2 i32.shr_u @@ -31718,37 +31779,37 @@ i32.const 1 i32.add local.set $26 - local.get $29 + local.get $30 i32.load offset=4 - local.set $24 - local.get $29 + local.set $25 + local.get $30 i32.load offset=8 i32.const 2 i32.shr_u - local.set $23 + local.set $24 loop $for-loop|026 local.get $1 - local.get $23 + local.get $24 i32.lt_s if local.get $1 local.get $26 i32.add - local.get $24 + local.get $25 local.get $1 i32.const 2 i32.shl i32.add f32.load - local.tee $21 - local.get $21 + local.tee $22 + local.get $22 f32.sub f32.const 0 f32.eq if (result i32) f32.const 0 f32.const 255 - local.get $21 + local.get $22 f32.min f32.max i32.trunc_f32_u @@ -31764,12 +31825,12 @@ end end local.get $0 - local.get $28 + local.get $29 i32.const 4 call $~lib/typedarray/Uint8ClampedArray#set<~lib/typedarray/Int64Array> i32.const 0 local.set $1 - local.get $27 + local.get $28 i32.load offset=8 i32.const 2 i32.shr_u @@ -31784,36 +31845,36 @@ i32.const 8 i32.add local.set $26 - local.get $27 + local.get $28 i32.load offset=4 - local.set $24 - local.get $27 + local.set $25 + local.get $28 i32.load offset=8 i32.const 2 i32.shr_u - local.set $23 + local.set $24 loop $for-loop|027 local.get $1 - local.get $23 + local.get $24 i32.lt_s if local.get $1 local.get $26 i32.add - local.get $24 + local.get $25 local.get $1 i32.const 2 i32.shl i32.add i32.load - local.tee $25 + local.tee $27 i32.const 31 i32.shr_s i32.const -1 i32.xor - local.get $25 + local.get $27 i32.const 255 - local.get $25 + local.get $27 i32.sub i32.const 31 i32.shr_s @@ -31834,7 +31895,7 @@ i32.const 8288 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $24 + local.tee $25 call $std/typedarray/valuesEqual<~lib/typedarray/Uint8ClampedArray> i32.const 4 call $~lib/typedarray/Uint32Array#constructor @@ -31856,19 +31917,19 @@ call $~lib/typedarray/Uint32Array#__set i32.const 4 call $~lib/typedarray/Int16Array#constructor - local.tee $25 + local.tee $27 i32.const 0 i32.const -10 call $~lib/typedarray/Int16Array#__set - local.get $25 + local.get $27 i32.const 1 i32.const 100 call $~lib/typedarray/Int16Array#__set - local.get $25 + local.get $27 i32.const 2 i32.const 10 call $~lib/typedarray/Int16Array#__set - local.get $25 + local.get $27 i32.const 3 i32.const 300 call $~lib/typedarray/Int16Array#__set @@ -31884,7 +31945,7 @@ br_if $folding-inner19 local.get $0 i32.load offset=4 - local.set $23 + local.set $24 local.get $1 i32.load offset=4 local.set $19 @@ -31898,7 +31959,7 @@ local.get $18 i32.lt_s if - local.get $23 + local.get $24 local.get $26 i32.add i32.const 255 @@ -31922,7 +31983,7 @@ end end local.get $0 - local.get $25 + local.get $27 i32.const 5 call $~lib/typedarray/Uint8ClampedArray#set<~lib/typedarray/Int16Array> local.get $0 @@ -31936,17 +31997,17 @@ call $std/typedarray/valuesEqual<~lib/typedarray/Uint8ClampedArray> local.get $0 call $~lib/rt/pure/__release + local.get $30 + call $~lib/rt/pure/__release local.get $29 call $~lib/rt/pure/__release local.get $28 call $~lib/rt/pure/__release - local.get $27 - call $~lib/rt/pure/__release - local.get $24 + local.get $25 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $25 + local.get $27 call $~lib/rt/pure/__release local.get $26 call $~lib/rt/pure/__release diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 56a04d6cac..6100b1c993 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -1955,7 +1955,7 @@ if i32.const 32 i32.const 80 - i32.const 23 + i32.const 18 i32.const 57 call $~lib/builtins/abort unreachable @@ -3119,10 +3119,10 @@ i32.add f64.load local.set $8 - i32.const 2 - global.set $~argumentsLength local.get $5 local.get $8 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -3327,10 +3327,10 @@ i32.add f64.load local.set $10 - i32.const 2 - global.set $~argumentsLength local.get $9 local.get $10 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -3458,10 +3458,10 @@ i32.add f64.load local.set $9 - i32.const 2 - global.set $~argumentsLength local.get $10 local.get $9 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -3566,10 +3566,10 @@ local.get $5 f64.load local.set $7 - i32.const 2 - global.set $~argumentsLength local.get $6 local.get $7 + i32.const 2 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_f64_=>_i32) i32.const 0 @@ -3643,7 +3643,7 @@ i64.lt_s i32.sub ) - (func $~lib/typedarray/Float64Array#sort|trampoline (param $0 i32) (param $1 i32) (result i32) + (func $~lib/typedarray/Float64Array#sort@varargs (param $0 i32) (param $1 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -5885,8 +5885,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -5896,6 +5894,8 @@ i32.load8_s local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6023,8 +6023,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6034,6 +6032,8 @@ i32.load8_u local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6139,8 +6139,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6150,6 +6148,8 @@ i32.load8_u local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6279,8 +6279,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6290,6 +6288,8 @@ i32.load16_s local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6421,8 +6421,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6432,6 +6430,8 @@ i32.load16_u local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6537,8 +6537,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6548,6 +6546,8 @@ i32.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6675,8 +6675,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6686,6 +6684,8 @@ i32.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -6814,8 +6814,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6825,6 +6823,8 @@ i64.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i64_i64_i32_i32_=>_i64) local.set $3 @@ -6953,8 +6953,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -6964,6 +6962,8 @@ i64.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i64_i64_i32_i32_=>_i64) local.set $3 @@ -7092,8 +7092,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7103,6 +7101,8 @@ f32.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $f32_f32_i32_i32_=>_f32) local.set $3 @@ -7207,8 +7207,6 @@ local.set $9 local.get $9 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7218,6 +7216,8 @@ f64.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $f64_f64_i32_i32_=>_f64) local.set $3 @@ -7320,8 +7320,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7331,6 +7329,8 @@ i32.load8_s local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -7437,8 +7437,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7448,6 +7446,8 @@ i32.load8_u local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -7552,8 +7552,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7563,6 +7561,8 @@ i32.load8_u local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -7667,8 +7667,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7678,6 +7676,8 @@ i32.load16_s local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -7784,8 +7784,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7795,6 +7793,8 @@ i32.load16_u local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -7899,8 +7899,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -7910,6 +7908,8 @@ i32.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -8012,8 +8012,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -8023,6 +8021,8 @@ i32.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i32_i32_i32_i32_=>_i32) local.set $3 @@ -8126,8 +8126,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -8137,6 +8135,8 @@ i64.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i64_i64_i32_i32_=>_i64) local.set $3 @@ -8240,8 +8240,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -8251,6 +8249,8 @@ i64.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $i64_i64_i32_i32_=>_i64) local.set $3 @@ -8354,8 +8354,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -8365,6 +8363,8 @@ f32.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $f32_f32_i32_i32_=>_f32) local.set $3 @@ -8468,8 +8468,6 @@ local.set $8 local.get $8 if - i32.const 4 - global.set $~argumentsLength local.get $3 local.get $6 local.get $7 @@ -8479,6 +8477,8 @@ f64.load local.get $7 local.get $5 + i32.const 4 + global.set $~argumentsLength local.get $4 call_indirect (type $f64_f64_i32_i32_=>_f64) local.set $3 @@ -8599,8 +8599,6 @@ i32.const 0 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 0 @@ -8609,6 +8607,8 @@ i32.load8_s local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store8 @@ -8771,8 +8771,6 @@ i32.const 0 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 0 @@ -8781,6 +8779,8 @@ i32.load8_u local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store8 @@ -8962,8 +8962,6 @@ i32.const 0 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 0 @@ -8972,6 +8970,8 @@ i32.load8_u local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store8 @@ -9134,8 +9134,6 @@ i32.const 1 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 1 @@ -9144,6 +9142,8 @@ i32.load16_s local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store16 @@ -9329,8 +9329,6 @@ i32.const 1 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 1 @@ -9339,6 +9337,8 @@ i32.load16_u local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store16 @@ -9524,8 +9524,6 @@ i32.const 2 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 2 @@ -9534,6 +9532,8 @@ i32.load local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store @@ -9696,8 +9696,6 @@ i32.const 2 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 2 @@ -9706,6 +9704,8 @@ i32.load local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) i32.store @@ -9891,8 +9891,6 @@ i32.const 3 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 3 @@ -9901,6 +9899,8 @@ i64.load local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i64) i64.store @@ -10086,8 +10086,6 @@ i32.const 3 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 3 @@ -10096,6 +10094,8 @@ i64.load local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i64) i64.store @@ -10281,8 +10281,6 @@ i32.const 2 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 2 @@ -10291,6 +10289,8 @@ f32.load local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_i32_i32_=>_f32) f32.store @@ -10476,8 +10476,6 @@ i32.const 3 i32.shl i32.add - i32.const 3 - global.set $~argumentsLength local.get $5 local.get $9 i32.const 3 @@ -10486,6 +10484,8 @@ f64.load local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_i32_i32_=>_f64) f64.store @@ -10788,11 +10788,11 @@ i32.add i32.load8_s local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -11016,11 +11016,11 @@ i32.add i32.load8_u local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -11244,11 +11244,11 @@ i32.add i32.load8_u local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -11474,11 +11474,11 @@ i32.add i32.load16_s local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -11702,11 +11702,11 @@ i32.add i32.load16_u local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -11928,11 +11928,11 @@ i32.add i32.load local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -12154,11 +12154,11 @@ i32.add i32.load local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -12380,11 +12380,11 @@ i32.add i64.load local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -12606,11 +12606,11 @@ i32.add i64.load local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -12832,11 +12832,11 @@ i32.add f32.load local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_i32_i32_=>_i32) if @@ -13058,11 +13058,11 @@ i32.add f64.load local.set $11 - i32.const 3 - global.set $~argumentsLength local.get $11 local.get $9 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_i32_i32_=>_i32) if @@ -13266,8 +13266,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -13276,6 +13274,8 @@ i32.load8_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -13420,8 +13420,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -13430,6 +13428,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -13572,8 +13572,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -13582,6 +13580,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -13726,8 +13726,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -13736,6 +13734,8 @@ i32.load16_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -13880,8 +13880,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -13890,6 +13888,8 @@ i32.load16_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -14030,8 +14030,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -14040,6 +14038,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -14178,8 +14178,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -14188,6 +14186,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -14326,8 +14326,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -14336,6 +14334,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -14474,8 +14474,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -14484,6 +14482,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -14622,8 +14622,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -14632,6 +14630,8 @@ f32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_i32_i32_=>_i32) if @@ -14770,8 +14770,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -14780,6 +14778,8 @@ f64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_i32_i32_=>_i32) if @@ -14922,8 +14922,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -14932,6 +14930,8 @@ i32.load8_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15077,8 +15077,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -15087,6 +15085,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15230,8 +15230,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -15240,6 +15238,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15385,8 +15385,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -15395,6 +15393,8 @@ i32.load16_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15540,8 +15540,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -15550,6 +15548,8 @@ i32.load16_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15691,8 +15691,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -15701,6 +15699,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15840,8 +15840,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -15850,6 +15848,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -15989,8 +15989,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -15999,6 +15997,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -16138,8 +16138,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -16148,6 +16146,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -16287,8 +16287,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -16297,6 +16295,8 @@ f32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_i32_i32_=>_i32) if @@ -16436,8 +16436,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -16446,6 +16444,8 @@ f64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_i32_i32_=>_i32) if @@ -16592,8 +16592,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -16602,6 +16600,8 @@ i32.load8_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -16751,8 +16751,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -16761,6 +16759,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -16908,8 +16908,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -16918,6 +16916,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -17067,8 +17067,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -17077,6 +17075,8 @@ i32.load16_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -17226,8 +17226,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -17236,6 +17234,8 @@ i32.load16_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -17381,8 +17381,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -17391,6 +17389,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -17534,8 +17534,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -17544,6 +17542,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_i32) if @@ -17687,8 +17687,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -17697,6 +17695,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -17840,8 +17840,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -17850,6 +17848,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_i32) if @@ -18241,8 +18241,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -18251,6 +18249,8 @@ f32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_i32_i32_=>_i32) if @@ -18648,8 +18648,6 @@ local.get $7 if block $for-continue|0 - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -18658,6 +18656,8 @@ f64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_i32_i32_=>_i32) if @@ -18843,8 +18843,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -18853,6 +18851,8 @@ i32.load8_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19011,8 +19011,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -19021,6 +19019,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19173,8 +19173,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 0 @@ -19183,6 +19181,8 @@ i32.load8_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19339,8 +19339,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -19349,6 +19347,8 @@ i32.load16_s local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19507,8 +19507,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 1 @@ -19517,6 +19515,8 @@ i32.load16_u local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19665,8 +19665,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -19675,6 +19673,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19817,8 +19817,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -19827,6 +19825,8 @@ i32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i32_i32_i32_=>_none) local.get $5 @@ -19970,8 +19970,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -19980,6 +19978,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_none) local.get $5 @@ -20126,8 +20126,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -20136,6 +20134,8 @@ i64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $i64_i32_i32_=>_none) local.get $5 @@ -20282,8 +20282,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 2 @@ -20292,6 +20290,8 @@ f32.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f32_i32_i32_=>_none) local.get $5 @@ -20438,8 +20438,6 @@ local.set $7 local.get $7 if - i32.const 3 - global.set $~argumentsLength local.get $4 local.get $5 i32.const 3 @@ -20448,6 +20446,8 @@ f64.load local.get $5 local.get $3 + i32.const 3 + global.set $~argumentsLength local.get $2 call_indirect (type $f64_i32_i32_=>_none) local.get $5 @@ -24227,7 +24227,7 @@ local.get $9 end ) - (func $~lib/typedarray/Int8Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int8Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -24428,12 +24428,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -24445,12 +24445,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -24462,12 +24462,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -24479,12 +24479,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf|trampoline + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -24918,7 +24918,7 @@ local.get $9 end ) - (func $~lib/typedarray/Uint8Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint8Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -25117,12 +25117,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -25134,12 +25134,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -25151,12 +25151,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -25168,12 +25168,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -25607,7 +25607,7 @@ local.get $9 end ) - (func $~lib/typedarray/Uint8ClampedArray#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint8ClampedArray#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -25806,12 +25806,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8ClampedArray#lastIndexOf|trampoline + call $~lib/typedarray/Uint8ClampedArray#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -25823,12 +25823,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8ClampedArray#lastIndexOf|trampoline + call $~lib/typedarray/Uint8ClampedArray#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -25840,12 +25840,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8ClampedArray#lastIndexOf|trampoline + call $~lib/typedarray/Uint8ClampedArray#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -25857,12 +25857,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8ClampedArray#lastIndexOf|trampoline + call $~lib/typedarray/Uint8ClampedArray#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -26300,7 +26300,7 @@ local.get $9 end ) - (func $~lib/typedarray/Int16Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int16Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -26501,12 +26501,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -26518,12 +26518,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -26535,12 +26535,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -26552,12 +26552,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf|trampoline + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -26991,7 +26991,7 @@ local.get $9 end ) - (func $~lib/typedarray/Uint16Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint16Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -27190,12 +27190,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint16Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -27207,12 +27207,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint16Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -27224,12 +27224,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint16Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -27241,12 +27241,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint16Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -27676,7 +27676,7 @@ local.get $9 end ) - (func $~lib/typedarray/Int32Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int32Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -27873,12 +27873,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -27890,12 +27890,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -27907,12 +27907,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -27924,12 +27924,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int32Array#lastIndexOf|trampoline + call $~lib/typedarray/Int32Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -28359,7 +28359,7 @@ local.get $9 end ) - (func $~lib/typedarray/Uint32Array#lastIndexOf|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint32Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -28556,12 +28556,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint32Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint32Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -28573,12 +28573,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint32Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint32Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -28590,12 +28590,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint32Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint32Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -28607,12 +28607,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint32Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint32Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -29042,7 +29042,7 @@ local.get $9 end ) - (func $~lib/typedarray/Int64Array#lastIndexOf|trampoline (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/typedarray/Int64Array#lastIndexOf@varargs (param $0 i32) (param $1 i64) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -29240,12 +29240,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -29257,12 +29257,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -29274,12 +29274,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -29291,12 +29291,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int64Array#lastIndexOf|trampoline + call $~lib/typedarray/Int64Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -29726,7 +29726,7 @@ local.get $9 end ) - (func $~lib/typedarray/Uint64Array#lastIndexOf|trampoline (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint64Array#lastIndexOf@varargs (param $0 i32) (param $1 i64) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -29924,12 +29924,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint64Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint64Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -29941,12 +29941,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint64Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint64Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -29958,12 +29958,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint64Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint64Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -29975,12 +29975,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 i64.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint64Array#lastIndexOf|trampoline + call $~lib/typedarray/Uint64Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -30410,7 +30410,7 @@ local.get $9 end ) - (func $~lib/typedarray/Float32Array#lastIndexOf|trampoline (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/typedarray/Float32Array#lastIndexOf@varargs (param $0 i32) (param $1 f32) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -30608,12 +30608,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -30625,12 +30625,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f32.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -30642,12 +30642,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f32.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -30659,12 +30659,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f32.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float32Array#lastIndexOf|trampoline + call $~lib/typedarray/Float32Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -31094,7 +31094,7 @@ local.get $9 end ) - (func $~lib/typedarray/Float64Array#lastIndexOf|trampoline (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/typedarray/Float64Array#lastIndexOf@varargs (param $0 i32) (param $1 f64) (param $2 i32) (result i32) block $1of1 block $0of1 block $outOfRange @@ -31292,12 +31292,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f64.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const 0 i32.eq i32.eqz @@ -31309,12 +31309,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f64.const 11 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -31326,12 +31326,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f64.const -1 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const -1 i32.eq i32.eqz @@ -31343,12 +31343,12 @@ call $~lib/builtins/abort unreachable end - i32.const 1 - global.set $~argumentsLength local.get $3 f64.const 3 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float64Array#lastIndexOf|trampoline + call $~lib/typedarray/Float64Array#lastIndexOf@varargs i32.const 3 i32.eq i32.eqz @@ -37448,7 +37448,7 @@ if i32.const 32 i32.const 80 - i32.const 54 + i32.const 49 i32.const 43 call $~lib/builtins/abort unreachable @@ -37591,7 +37591,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Uint8Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint8Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -37818,7 +37818,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Int8Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int8Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -37903,12 +37903,12 @@ local.set $7 i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int8Array.wrap|trampoline + call $~lib/typedarray/Int8Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -38019,12 +38019,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array.wrap|trampoline + call $~lib/typedarray/Uint8Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -38194,7 +38194,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Uint8ClampedArray.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint8ClampedArray.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -38281,12 +38281,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8ClampedArray.wrap|trampoline + call $~lib/typedarray/Uint8ClampedArray.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -38456,7 +38456,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Int16Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int16Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -38547,12 +38547,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int16Array.wrap|trampoline + call $~lib/typedarray/Int16Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -38722,7 +38722,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Uint16Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint16Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -38813,12 +38813,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint16Array.wrap|trampoline + call $~lib/typedarray/Uint16Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -38988,7 +38988,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Int32Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int32Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -39079,12 +39079,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int32Array.wrap|trampoline + call $~lib/typedarray/Int32Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -39254,7 +39254,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Uint32Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint32Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -39347,12 +39347,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint32Array.wrap|trampoline + call $~lib/typedarray/Uint32Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -39522,7 +39522,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Int64Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int64Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -39618,12 +39618,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Int64Array.wrap|trampoline + call $~lib/typedarray/Int64Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -39793,7 +39793,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Uint64Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Uint64Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -39891,12 +39891,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint64Array.wrap|trampoline + call $~lib/typedarray/Uint64Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -40066,7 +40066,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Float32Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Float32Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -40166,12 +40166,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float32Array.wrap|trampoline + call $~lib/typedarray/Float32Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -40341,7 +40341,7 @@ call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/typedarray/Float64Array.wrap|trampoline (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Float64Array.wrap@varargs (param $0 i32) (param $1 i32) (param $2 i32) (result i32) block $2of2 block $1of2 block $0of2 @@ -40443,12 +40443,12 @@ drop i32.const 1 drop - i32.const 1 - global.set $~argumentsLength local.get $6 i32.const 0 + i32.const 1 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Float64Array.wrap|trampoline + call $~lib/typedarray/Float64Array.wrap@varargs local.set $5 local.get $7 call $~lib/rt/pure/__release @@ -54391,11 +54391,11 @@ call $~lib/builtins/abort unreachable end + local.get $0 i32.const 0 global.set $~argumentsLength - local.get $0 i32.const 0 - call $~lib/typedarray/Float64Array#sort|trampoline + call $~lib/typedarray/Float64Array#sort@varargs call $~lib/rt/pure/__release local.get $0 i32.const 0 @@ -56142,12 +56142,12 @@ i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor local.set $21 - i32.const 2 - global.set $~argumentsLength local.get $21 i32.const 0 + i32.const 2 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array.wrap|trampoline + call $~lib/typedarray/Uint8Array.wrap@varargs local.set $22 local.get $22 call $~lib/typedarray/Uint8Array#get:length @@ -56170,12 +56170,12 @@ call $~lib/rt/pure/__release local.get $25 local.set $21 - i32.const 2 - global.set $~argumentsLength local.get $21 i32.const 2 + i32.const 2 + global.set $~argumentsLength i32.const 0 - call $~lib/typedarray/Uint8Array.wrap|trampoline + call $~lib/typedarray/Uint8Array.wrap@varargs local.set $3 local.get $22 call $~lib/rt/pure/__release diff --git a/tests/parser/class-abstract.ts b/tests/parser/class-abstract.ts new file mode 100644 index 0000000000..1de205573b --- /dev/null +++ b/tests/parser/class-abstract.ts @@ -0,0 +1,3 @@ +class Foo { + abstract bar(): void; +} diff --git a/tests/parser/class-abstract.ts.fixture.ts b/tests/parser/class-abstract.ts.fixture.ts new file mode 100644 index 0000000000..d7c6bea0a7 --- /dev/null +++ b/tests/parser/class-abstract.ts.fixture.ts @@ -0,0 +1,5 @@ +class Foo { + bar(): void; +} +// ERROR 1042: "'abstract' modifier cannot be used here." in class-abstract.ts(2,3+8) +// ERROR 2391: "Function implementation is missing or not immediately following the declaration." in class-abstract.ts(2,19+4) diff --git a/tests/parser/class.ts.fixture.ts b/tests/parser/class.ts.fixture.ts index a76ddb7202..dfdd064c5b 100644 --- a/tests/parser/class.ts.fixture.ts +++ b/tests/parser/class.ts.fixture.ts @@ -15,11 +15,11 @@ export class Invalid { get instanceGetter(a: i32) {} set instanceSetter() {} } -// ERROR 1092: "Type parameters cannot appear on a constructor declaration." in class.ts:15:14 -// ERROR 1110: "Type expected." in class.ts:18:21 -// ERROR 1094: "An accessor cannot have type parameters." in class.ts:23:21 -// ERROR 1054: "A 'get' accessor cannot have parameters." in class.ts:23:7 -// ERROR 1110: "Type expected." in class.ts:23:32 -// ERROR 1094: "An accessor cannot have type parameters." in class.ts:28:21 -// ERROR 1049: "A 'set' accessor must have exactly one parameter." in class.ts:28:7 -// ERROR 1095: "A 'set' accessor cannot have a return type annotation." in class.ts:28:26 +// ERROR 1092: "Type parameters cannot appear on a constructor declaration." in class.ts(15,14+3) +// ERROR 1110: "Type expected." in class.ts(18,21+0) +// ERROR 1094: "An accessor cannot have type parameters." in class.ts(23,21+3) +// ERROR 1054: "A 'get' accessor cannot have parameters." in class.ts(23,7+14) +// ERROR 1110: "Type expected." in class.ts(23,32+0) +// ERROR 1094: "An accessor cannot have type parameters." in class.ts(28,21+3) +// ERROR 1049: "A 'set' accessor must have exactly one parameter." in class.ts(28,7+14) +// ERROR 1095: "A 'set' accessor cannot have a return type annotation." in class.ts(28,26+1) diff --git a/tests/parser/continue-on-error.ts.fixture.ts b/tests/parser/continue-on-error.ts.fixture.ts index c33b319a21..a10d400f0f 100644 --- a/tests/parser/continue-on-error.ts.fixture.ts +++ b/tests/parser/continue-on-error.ts.fixture.ts @@ -5,5 +5,5 @@ from; do { ; } while (false); -// ERROR 1003: "Identifier expected." in continue-on-error.ts:2:1 -// ERROR 1005: "'(' expected." in continue-on-error.ts:4:1 +// ERROR 1003: "Identifier expected." in continue-on-error.ts(2,1+3) +// ERROR 1005: "'(' expected." in continue-on-error.ts(4,1+5) diff --git a/tests/parser/definite-assignment-assertion.ts.fixture.ts b/tests/parser/definite-assignment-assertion.ts.fixture.ts index 996e11f598..0d4b0e0405 100644 --- a/tests/parser/definite-assignment-assertion.ts.fixture.ts +++ b/tests/parser/definite-assignment-assertion.ts.fixture.ts @@ -7,6 +7,6 @@ function f(): void { let x!: i32; let x!: i32 = 0; } -// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts:3:3 -// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts:4:3 -// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts:8:7 +// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts(3,3+11) +// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts(4,3+14) +// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts(8,7+11) diff --git a/tests/parser/function-type.ts.fixture.ts b/tests/parser/function-type.ts.fixture.ts index f048a24713..da4cc376b9 100644 --- a/tests/parser/function-type.ts.fixture.ts +++ b/tests/parser/function-type.ts.fixture.ts @@ -2,4 +2,4 @@ var a: () => void; var b: (a: i32, b: i32) => void; var c: (a: i32, b: i32) => (a: i32, b: i32) => void; var d: (a) => void; -// ERROR 1110: "Type expected." in function-type.ts:4:10 +// ERROR 1110: "Type expected." in function-type.ts(4,10+0) diff --git a/tests/parser/interface-errors.ts b/tests/parser/interface-errors.ts new file mode 100644 index 0000000000..902a3822b8 --- /dev/null +++ b/tests/parser/interface-errors.ts @@ -0,0 +1,22 @@ +abstract interface Foo { // ERROR 1242: "'abstract' modifier can only appear on a class, method, or property declaration +} + +abstract +interface Foo { // no error +} + +interface Foo implements Bar { // ERROR 1176: "Interface declaration cannot have 'implements' clause." +} + +interface Foo extends Bar { // no error +} + +interface Foo { + abstract a: i32; // ERROR 1042: "'abstract' modifier cannot be used here." (TS1070) + private b: i32; // ERROR 1042: "'private' modifier cannot be used here." (TS1070) + protected c: i32; // ERROR 1042: "'protected' modifier cannot be used here." + public c: i32; // ERROR 1042: "'public' modifier cannot be used here." + static d: i32; // ERROR 1042: "'static' modifier cannot be used here." + constructor(): i32; // ERROR 229: "'constructor' keyword cannot be used here." (TS: none?) + constructor(); // ^ + ERROR 1110: "Type expected." +} diff --git a/tests/parser/interface-errors.ts.fixture.ts b/tests/parser/interface-errors.ts.fixture.ts new file mode 100644 index 0000000000..bc1285e3d3 --- /dev/null +++ b/tests/parser/interface-errors.ts.fixture.ts @@ -0,0 +1,29 @@ +abstract; +interface Foo { +} +abstract; +interface Foo { +} +interface Foo { +} +interface Foo extends Bar { +} +interface Foo { + a: i32; + b: i32; + c: i32; + c: i32; + d: i32; + constructor(): i32; + constructor(); +} +// ERROR 1242: "'abstract' modifier can only appear on a class, method, or property declaration." in interface-errors.ts(1,1+8) +// ERROR 1176: "Interface declaration cannot have 'implements' clause." in interface-errors.ts(8,15+10) +// ERROR 1042: "'abstract' modifier cannot be used here." in interface-errors.ts(15,3+8) +// ERROR 1042: "'private' modifier cannot be used here." in interface-errors.ts(16,3+7) +// ERROR 1042: "'protected' modifier cannot be used here." in interface-errors.ts(17,3+9) +// ERROR 1042: "'public' modifier cannot be used here." in interface-errors.ts(18,3+6) +// ERROR 1042: "'static' modifier cannot be used here." in interface-errors.ts(19,3+6) +// ERROR 230: "'constructor' keyword cannot be used here." in interface-errors.ts(20,3+11) +// ERROR 230: "'constructor' keyword cannot be used here." in interface-errors.ts(21,3+11) +// ERROR 1110: "Type expected." in interface-errors.ts(21,16+0) diff --git a/tests/parser/namespace.ts.fixture.ts b/tests/parser/namespace.ts.fixture.ts index d755fa9edd..8ef853742f 100644 --- a/tests/parser/namespace.ts.fixture.ts +++ b/tests/parser/namespace.ts.fixture.ts @@ -14,5 +14,5 @@ declare namespace A { } } } -// ERROR 1039: "Initializers are not allowed in ambient contexts." in namespace.ts:6:32 -// ERROR 1183: "An implementation cannot be declared in ambient contexts." in namespace.ts:8:37 +// ERROR 1039: "Initializers are not allowed in ambient contexts." in namespace.ts(6,32+1) +// ERROR 1183: "An implementation cannot be declared in ambient contexts." in namespace.ts(8,37+1) diff --git a/tests/parser/numeric-separators.ts.fixture.ts b/tests/parser/numeric-separators.ts.fixture.ts index 9834231900..57af00bb90 100644 --- a/tests/parser/numeric-separators.ts.fixture.ts +++ b/tests/parser/numeric-separators.ts.fixture.ts @@ -10,11 +10,11 @@ 41610; 2302755; 2302755; -// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts:8:9 -// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts:9:4 -// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts:11:11 -// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts:12:6 -// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts:14:11 -// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts:15:6 -// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts:17:11 -// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts:18:6 +// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts(8,9+0) +// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts(9,4+0) +// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts(11,11+0) +// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts(12,6+0) +// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts(14,11+0) +// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts(15,6+0) +// ERROR 6188: "Numeric separators are not allowed here." in numeric-separators.ts(17,11+0) +// ERROR 6189: "Multiple consecutive numeric separators are not permitted." in numeric-separators.ts(18,6+0) diff --git a/tests/parser/optional-property.ts.fixture.ts b/tests/parser/optional-property.ts.fixture.ts index efb508774a..dc81ce8c07 100644 --- a/tests/parser/optional-property.ts.fixture.ts +++ b/tests/parser/optional-property.ts.fixture.ts @@ -1,4 +1,4 @@ class C { x: i32; } -// ERROR 219: "Optional properties are not supported." in optional-property.ts:2:3 +// ERROR 219: "Optional properties are not supported." in optional-property.ts(2,3+2) diff --git a/tests/parser/optional-typeparameters.ts.fixture.ts b/tests/parser/optional-typeparameters.ts.fixture.ts index 9a6935aafd..05cf48a0d0 100644 --- a/tests/parser/optional-typeparameters.ts.fixture.ts +++ b/tests/parser/optional-typeparameters.ts.fixture.ts @@ -7,4 +7,4 @@ function a(): T { function a(): T { return 0; } -// ERROR 2706: "Required type parameters may not follow optional type parameters." in optional-typeparameters.ts:3:20 +// ERROR 2706: "Required type parameters may not follow optional type parameters." in optional-typeparameters.ts(3,20+1) diff --git a/tests/parser/parameter-order.ts.fixture.ts b/tests/parser/parameter-order.ts.fixture.ts index 587b2069da..5398bfffe2 100644 --- a/tests/parser/parameter-order.ts.fixture.ts +++ b/tests/parser/parameter-order.ts.fixture.ts @@ -3,6 +3,6 @@ function optionalValid(a: i32, b?: i32): void {} function restParameterMustBeLast(...a: Array, b: i32): void {} function optionalCannotPrecedeRequired(a?: i32, b: i32): void {} function optionalWithInitializerCannotPrecedeRequired(a?: i32 = 1, b: i32): void {} -// ERROR 1014: "A rest parameter must be last in a parameter list." in parameter-order.ts:5:37 -// ERROR 1016: "A required parameter cannot follow an optional parameter." in parameter-order.ts:8:49 -// ERROR 1016: "A required parameter cannot follow an optional parameter." in parameter-order.ts:11:67 +// ERROR 1014: "A rest parameter must be last in a parameter list." in parameter-order.ts(5,37+1) +// ERROR 1016: "A required parameter cannot follow an optional parameter." in parameter-order.ts(8,49+1) +// ERROR 1016: "A required parameter cannot follow an optional parameter." in parameter-order.ts(11,67+1) diff --git a/tests/parser/regexp.ts.fixture.ts b/tests/parser/regexp.ts.fixture.ts index edd623ef5a..43cf5d3225 100644 --- a/tests/parser/regexp.ts.fixture.ts +++ b/tests/parser/regexp.ts.fixture.ts @@ -6,8 +6,8 @@ b / ig; /(abc)\//iig; /(abc)\//iX; false && /abc/gX.test(someString) || true; -// ERROR 1161: "Unterminated regular expression literal." in regexp.ts:5:2 -// ERROR 1005: "'/' expected." in regexp.ts:5:1 -// ERROR 209: "Invalid regular expression flags." in regexp.ts:8:10 -// ERROR 209: "Invalid regular expression flags." in regexp.ts:9:10 -// ERROR 209: "Invalid regular expression flags." in regexp.ts:10:15 +// ERROR 1161: "Unterminated regular expression literal." in regexp.ts(5,2+1) +// ERROR 1005: "'/' expected." in regexp.ts(5,1+2) +// ERROR 209: "Invalid regular expression flags." in regexp.ts(8,10+3) +// ERROR 209: "Invalid regular expression flags." in regexp.ts(9,10+2) +// ERROR 209: "Invalid regular expression flags." in regexp.ts(10,15+2) diff --git a/tests/parser/var.ts.fixture.ts b/tests/parser/var.ts.fixture.ts index d4b0a1148a..500482186d 100644 --- a/tests/parser/var.ts.fixture.ts +++ b/tests/parser/var.ts.fixture.ts @@ -5,5 +5,5 @@ var d = 2; var e; const f: i32; const t = 0 < (c / 10); -// ERROR 1110: "Type expected." in var.ts:7:6 -// ERROR 1155: "'const' declarations must be initialized." in var.ts:10:7 +// ERROR 1110: "Type expected." in var.ts(7,6+0) +// ERROR 1155: "'const' declarations must be initialized." in var.ts(10,7+1)