From 7d79038f26760898b70e5adeecf5b11bd18c0b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Mon, 9 Mar 2020 21:14:21 -0400 Subject: [PATCH 01/14] Ignore idea files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cb7d0b9ef8..68c09d2201 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ out/ raw/ .history *.backup +.idea/ From 8681b3ebb96152e2b0409aa841f16be235c2a3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Mon, 9 Mar 2020 21:19:37 -0400 Subject: [PATCH 02/14] Introduce strict field initialization This commit introduces strict field initialization. All fields must be definitely assigned through an initializer or within the constructor else, a compilation error will be reported. If the field is intended to be initialized later through dependency injection or a custom initialiazer, the field must be post-fixed with ! --- NOTICE | 1 + src/common.ts | 5 +- src/compiler.ts | 58 ++++++-- src/diagnosticMessages.generated.ts | 2 + src/diagnosticMessages.json | 2 + tests/compiler/strict-init.json | 8 + tests/compiler/strict-init.optimized.wat | 108 ++++++++++++++ tests/compiler/strict-init.ts | 31 ++++ tests/compiler/strict-init.untouched.wat | 177 +++++++++++++++++++++++ 9 files changed, 379 insertions(+), 13 deletions(-) create mode 100644 tests/compiler/strict-init.json create mode 100644 tests/compiler/strict-init.optimized.wat create mode 100644 tests/compiler/strict-init.ts create mode 100644 tests/compiler/strict-init.untouched.wat diff --git a/NOTICE b/NOTICE index 3cbcecc156..fda564229f 100644 --- a/NOTICE +++ b/NOTICE @@ -20,6 +20,7 @@ under the licensing terms detailed in LICENSE: * Jeffrey Charles * Vladimir Tikhonov * Duncan Uszkay +* Saúl Cabrera Portions of this software are derived from third-party works licensed under the following terms: diff --git a/src/common.ts b/src/common.ts index 48b1ddc2fe..f69603f5fa 100644 --- a/src/common.ts +++ b/src/common.ts @@ -76,7 +76,10 @@ export enum CommonFlags { // Other /** Is quoted. */ - QUOTED = 1 << 28 + QUOTED = 1 << 28, + + /** Track explicit field init */ + INITIALIZED = 1<< 29, } /** Path delimiter inserted between file system levels. */ diff --git a/src/compiler.ts b/src/compiler.ts index 33c51601c6..0ab6f5019c 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -1534,6 +1534,14 @@ export class Compiler extends DiagnosticEmitter { compileField(instance: Field): bool { this.compileFieldGetter(instance); this.compileFieldSetter(instance); + if (!instance.is(CommonFlags.INITIALIZED)) { + this.error( + DiagnosticCode.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_constructor, + instance.declaration.name.range, + instance.declaration.name.text + ); + } + return instance.is(CommonFlags.COMPILED); } @@ -5925,6 +5933,11 @@ export class Compiler extends DiagnosticEmitter { ); return module.unreachable(); } + + if (flow.actualFunction.is(CommonFlags.CONSTRUCTOR) && !(target).is(CommonFlags.INITIALIZED)) { + (target).set(CommonFlags.INITIALIZED); + } + return this.makeFieldAssignment(target, valueExpr, // FIXME: explicit type (currently fails due to missing null checking) @@ -8799,6 +8812,24 @@ export class Compiler extends DiagnosticEmitter { if (getExpressionType(expr) != NativeType.None) { // possibly IMM_DROPPED this.currentType = classInstance.type; // important because a super ctor could be called } + + let members = classInstance.members; + if (members) { + for (let _values = Map_values(members), i = 0, k = _values.length; i < k; ++i) { + const field = unchecked(_values[i]); + if ( + field.kind === ElementKind.FIELD && + !field.is(CommonFlags.INITIALIZED) + ) { + this.error( + DiagnosticCode.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_constructor, + field.declaration.name.range, + field.declaration.name.text + ); + } + } + } + return expr; } @@ -9968,7 +9999,8 @@ export class Compiler extends DiagnosticEmitter { let fieldPrototype = field.prototype; let initializerNode = fieldPrototype.initializerNode; let parameterIndex = fieldPrototype.parameterIndex; - let initExpr: ExpressionRef; + let initExpr: ExpressionRef | null = null; + const isDefiniteAssigment = field.is(CommonFlags.DEFINITE_ASSIGNMENT); // if declared as a constructor parameter, use its value if (parameterIndex >= 0) { @@ -9988,20 +10020,22 @@ export class Compiler extends DiagnosticEmitter { if (fieldType.isManaged && !this.skippedAutoreleases.has(initExpr)) { initExpr = this.makeRetain(initExpr); } - - // otherwise initialize with zero - } else { + } else if (isDefiniteAssigment) { + // otherwise initialize with default if marked as definite assigment initExpr = this.makeZero(fieldType); } - stmts.push( - module.store(fieldType.byteSize, - module.local_get(thisLocalIndex, nativeSizeType), - initExpr, - nativeFieldType, - field.memoryOffset - ) - ); + if (initExpr) { + stmts.push( + module.store(fieldType.byteSize, + module.local_get(thisLocalIndex, nativeSizeType), + initExpr, + nativeFieldType, + field.memoryOffset + ) + ); + field.set(CommonFlags.INITIALIZED); + } } return stmts; } diff --git a/src/diagnosticMessages.generated.ts b/src/diagnosticMessages.generated.ts index d674d316c6..deeb2a9766 100644 --- a/src/diagnosticMessages.generated.ts +++ b/src/diagnosticMessages.generated.ts @@ -142,6 +142,7 @@ export enum DiagnosticCode { Expected_0_arguments_but_got_1 = 2554, Expected_at_least_0_arguments_but_got_1 = 2555, Expected_0_type_arguments_but_got_1 = 2558, + Property_0_has_no_initializer_and_is_not_definitely_assigned_in_constructor = 2564, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums = 2651, Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration = 2673, Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration = 2674, @@ -295,6 +296,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2554: return "Expected {0} arguments, but got {1}."; case 2555: return "Expected at least {0} arguments, but got {1}."; case 2558: return "Expected {0} type arguments, but got {1}."; + case 2564: return "Property {0} has no initializer and is not definitely assigned in constructor"; case 2651: return "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."; case 2673: return "Constructor of class '{0}' is private and only accessible within the class declaration."; case 2674: return "Constructor of class '{0}' is protected and only accessible within the class declaration."; diff --git a/src/diagnosticMessages.json b/src/diagnosticMessages.json index 049e89ceb4..00c7ef097f 100644 --- a/src/diagnosticMessages.json +++ b/src/diagnosticMessages.json @@ -138,6 +138,8 @@ "Expected {0} arguments, but got {1}.": 2554, "Expected at least {0} arguments, but got {1}.": 2555, "Expected {0} type arguments, but got {1}.": 2558, + "Property {0} has no initializer and is not definitely assigned in constructor": 2564, + "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.": 2651, "Constructor of class '{0}' is private and only accessible within the class declaration.": 2673, "Constructor of class '{0}' is protected and only accessible within the class declaration.": 2674, diff --git a/tests/compiler/strict-init.json b/tests/compiler/strict-init.json new file mode 100644 index 0000000000..64e1532a5d --- /dev/null +++ b/tests/compiler/strict-init.json @@ -0,0 +1,8 @@ +{ + "asc_flags": [ + "--runtime none" + ], + "stderr": [ + "TS2564: Property b has no initializer and is not definitely assigned in constructor" + ] +} diff --git a/tests/compiler/strict-init.optimized.wat b/tests/compiler/strict-init.optimized.wat new file mode 100644 index 0000000000..be666c43cd --- /dev/null +++ b/tests/compiler/strict-init.optimized.wat @@ -0,0 +1,108 @@ +(module + (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00s\00t\00r\00i\00c\00t\00-\00i\00n\00i\00t\00.\00t\00s") + (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) + (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (export "memory" (memory $0)) + (start $~start) + (func $~lib/rt/stub/maybeGrowMemory (; 1 ;) (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + memory.size + local.tee $2 + i32.const 16 + i32.shl + local.tee $1 + i32.gt_u + if + local.get $2 + local.get $0 + local.get $1 + i32.sub + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.tee $1 + local.get $2 + local.get $1 + i32.gt_s + select + memory.grow + i32.const 0 + i32.lt_s + if + local.get $1 + 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 (; 2 ;) (result i32) + (local $0 i32) + (local $1 i32) + global.get $~lib/rt/stub/offset + i32.const 16 + i32.add + local.tee $1 + i32.const 16 + i32.add + call $~lib/rt/stub/maybeGrowMemory + local.get $1 + i32.const 16 + i32.sub + local.tee $0 + i32.const 16 + i32.store + local.get $0 + i32.const 1 + i32.store offset=4 + local.get $0 + i32.const 3 + i32.store offset=8 + local.get $0 + i32.const 4 + i32.store offset=12 + local.get $1 + ) + (func $start:strict-init (; 3 ;) + (local $0 i32) + i32.const 64 + global.set $~lib/rt/stub/startOffset + i32.const 64 + global.set $~lib/rt/stub/offset + call $~lib/rt/stub/__alloc + local.tee $0 + i32.const 1 + i32.store + local.get $0 + i32.load + i32.const 1 + i32.ne + if + i32.const 0 + i32.const 32 + i32.const 5 + i32.const 0 + call $~lib/builtins/abort + unreachable + end + ) + (func $~start (; 4 ;) + call $start:strict-init + ) +) diff --git a/tests/compiler/strict-init.ts b/tests/compiler/strict-init.ts new file mode 100644 index 0000000000..64bcf5a7ff --- /dev/null +++ b/tests/compiler/strict-init.ts @@ -0,0 +1,31 @@ +// OK - Field with explicit initializer +export class WithInitializer { + public a: i32 = 1; + constructor() {} +} + +// ERR - Field b not initialized +export class WithoutInitializer { + b: f64; + constructor() {} +} + +// OK - Field as constructor param +class Param {} +export class FieldAsConstructorParam { + constructor(public val: Param) {} +} + +// OK - Field initialized in constructor +export class ExplicitConstructorInit { + p: Param; + constructor(a: Param) { + this.p = a; + } +} + +export class SupressExplicitInit { + p!: f64; + constructor() {} +} + diff --git a/tests/compiler/strict-init.untouched.wat b/tests/compiler/strict-init.untouched.wat new file mode 100644 index 0000000000..b75c2cf028 --- /dev/null +++ b/tests/compiler/strict-init.untouched.wat @@ -0,0 +1,177 @@ +(module + (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00s\00t\00r\00i\00c\00t\00-\00i\00n\00i\00t\00.\00t\00s\00") + (table $0 1 funcref) + (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) + (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (global $~lib/heap/__heap_base i32 (i32.const 60)) + (export "memory" (memory $0)) + (start $~start) + (func $~lib/rt/stub/maybeGrowMemory (; 1 ;) (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 (; 2 ;) (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 + 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 (; 3 ;) (param $0 i32) (result i32) + local.get $0 + ) + (func $strict-init/WithInitializer#constructor (; 4 ;) (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 4 + i32.const 3 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain + local.set $0 + end + local.get $0 + i32.const 1 + i32.store + local.get $0 + ) + (func $~lib/rt/stub/__release (; 5 ;) (param $0 i32) + nop + ) + (func $start:strict-init (; 6 ;) + (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 $strict-init/WithInitializer#constructor + local.tee $0 + i32.load + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 5 + i32.const 0 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/stub/__release + ) + (func $~start (; 7 ;) + call $start:strict-init + ) +) From ac1939e42c522908885e818338a84962b184eb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Sun, 15 Mar 2020 19:56:15 -0400 Subject: [PATCH 03/14] Don't track field initialization at the field instance level --- src/common.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/common.ts b/src/common.ts index b2b6345772..b4e288d3c7 100644 --- a/src/common.ts +++ b/src/common.ts @@ -77,9 +77,6 @@ export enum CommonFlags { /** Is quoted. */ QUOTED = 1 << 28, - - /** Track explicit field init */ - INITIALIZED = 1<< 29, } /** Path delimiter inserted between file system levels. */ From 125f1466219ffad7f64f818fa8a44f36e197c8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Sun, 15 Mar 2020 19:59:59 -0400 Subject: [PATCH 04/14] Move field initialization tracking at the flow level This commit add field initialization at the flow level. It also refactors the error reporting for uninitialized properties. --- src/common.ts | 2 +- src/compiler.ts | 56 ++++++++++++++++----------------- src/flow.ts | 38 ++++++++++++++++++++++ tests/compiler/strict-init.json | 4 ++- tests/compiler/strict-init.ts | 34 ++++++++++++++++++-- 5 files changed, 101 insertions(+), 33 deletions(-) diff --git a/src/common.ts b/src/common.ts index b4e288d3c7..4966af5751 100644 --- a/src/common.ts +++ b/src/common.ts @@ -76,7 +76,7 @@ export enum CommonFlags { // Other /** Is quoted. */ - QUOTED = 1 << 28, + QUOTED = 1 << 28 } /** Path delimiter inserted between file system levels. */ diff --git a/src/compiler.ts b/src/compiler.ts index 08e6f69c29..a0f6c4d448 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -90,6 +90,7 @@ import { import { FlowFlags, + FieldFlags, Flow, LocalFlags, ConditionKind, @@ -1509,6 +1510,7 @@ export class Compiler extends DiagnosticEmitter { } } this.ensureConstructor(instance, instance.identifierNode); + this.checkFieldInitialization(instance); var instanceMembers = instance.members; if (instanceMembers) { // TODO: for (let element of instanceMembers.values()) { @@ -1536,18 +1538,30 @@ export class Compiler extends DiagnosticEmitter { return true; } + checkFieldInitialization(instance: Class): void { + const flow = instance.constructorInstance!.flow; + const instanceMembers = instance.members; + if (instanceMembers) { + for (let _values = Map_values(instanceMembers), i = 0, k = _values.length; i < k; ++i) { + const element = unchecked(_values[i]); + if (element.kind == ElementKind.FIELD) { + const field = element; + if (!flow.isFieldFlag(field.internalName, FieldFlags.INITIALIZED)) { + this.error( + DiagnosticCode.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_constructor, + field.declaration.name.range, + field.declaration.name.text + ); + } + } + } + } + } + /** Compiles an instance field to a getter and a setter. */ compileField(instance: Field): bool { this.compileFieldGetter(instance); this.compileFieldSetter(instance); - if (!instance.is(CommonFlags.INITIALIZED)) { - this.error( - DiagnosticCode.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_constructor, - instance.declaration.name.range, - instance.declaration.name.text - ); - } - return instance.is(CommonFlags.COMPILED); } @@ -5945,8 +5959,8 @@ export class Compiler extends DiagnosticEmitter { return module.unreachable(); } - if (flow.actualFunction.is(CommonFlags.CONSTRUCTOR) && !fieldInstance.is(CommonFlags.INITIALIZED)) { - fieldInstance.set(CommonFlags.INITIALIZED); + if (flow.actualFunction.is(CommonFlags.CONSTRUCTOR)) { + flow.setFieldFlag(fieldInstance.internalName, FieldFlags.INITIALIZED); } return this.makeFieldAssignment(fieldInstance, @@ -8838,6 +8852,7 @@ export class Compiler extends DiagnosticEmitter { reportNode: Node ): ExpressionRef { var ctor = this.ensureConstructor(classInstance, reportNode); + this.checkFieldInitialization(classInstance); if (ctor.hasDecorator(DecoratorFlags.UNSAFE)) this.checkUnsafe(reportNode); var expr = this.compileCallDirect( // no need for another autoreleased local ctor, @@ -8850,23 +8865,6 @@ export class Compiler extends DiagnosticEmitter { this.currentType = classInstance.type; // important because a super ctor could be called } - let members = classInstance.members; - if (members) { - for (let _values = Map_values(members), i = 0, k = _values.length; i < k; ++i) { - const field = unchecked(_values[i]); - if ( - field.kind === ElementKind.FIELD && - !field.is(CommonFlags.INITIALIZED) - ) { - this.error( - DiagnosticCode.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_constructor, - field.declaration.name.range, - field.declaration.name.text - ); - } - } - } - return expr; } @@ -10075,7 +10073,9 @@ export class Compiler extends DiagnosticEmitter { field.memoryOffset ) ); - field.set(CommonFlags.INITIALIZED); + flow.setFieldFlag(field.internalName, FieldFlags.INITIALIZED) + } else { + flow.setFieldFlag(field.internalName, FieldFlags.NONE); } } return stmts; diff --git a/src/flow.ts b/src/flow.ts index 6296c8078f..c3b1707f04 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -169,6 +169,12 @@ export enum LocalFlags { | CONDITIONALLY_RETAINED } +/** Flags indicating the current state of an instance field. */ +export enum FieldFlags { + NONE = 0, + INITIALIZED = 1 << 0, +} + /** Condition kinds. */ export const enum ConditionKind { /** Outcome of the condition is unknown */ @@ -200,6 +206,8 @@ export class Flow { scopedLocals: Map | null = null; /** Local flags. */ localFlags: LocalFlags[]; + /** Field flags. */ + fieldFlags: Map; /** Function being inlined, when inlining. */ inlineFunction: Function | null; /** The label we break to when encountering a return statement, when inlining. */ @@ -216,6 +224,7 @@ export class Flow { flow.returnType = parentFunction.signature.returnType; flow.contextualTypeArguments = parentFunction.contextualTypeArguments; flow.localFlags = []; + flow.fieldFlags = new Map(); flow.inlineFunction = null; flow.inlineReturnLabel = null; return flow; @@ -276,6 +285,7 @@ export class Flow { branch.localFlags = this.localFlags.slice(); branch.inlineFunction = this.inlineFunction; branch.inlineReturnLabel = this.inlineReturnLabel; + branch.fieldFlags = new Map(this.fieldFlags); return branch; } @@ -519,6 +529,20 @@ export class Flow { localFlags[index] = flags & ~flag; } + setFieldFlag(name: string, flag: FieldFlags): void { + let fieldFlags = this.fieldFlags; + const flags = fieldFlags.get(name) || 0; + fieldFlags.set(name, flags | flag); + } + + isFieldFlag(name: string, flag: FieldFlags): bool { + const flags = this.fieldFlags.get(name); + if (flags) { + return (flags & flag) == flag; + } + return false; + } + /** Pushes a new break label to the stack, for example when entering a loop that one can `break` from. */ pushBreakLabel(): string { var parentFunction = this.parentFunction; @@ -806,6 +830,20 @@ export class Flow { thisLocalFlags[i] = newFlags; } } + + // Only the most right flow will have an effect + // on the resulting flow. + const rightFieldFlags = right.fieldFlags; + const rightKeys = Map_keys(rightFieldFlags); + + for (let _values = Map_values(rightFieldFlags), i = 0, k = _values.length; i < k; ++i) { + const rightValue = unchecked(_values[i]); + const currentKey = unchecked(rightKeys[i]); + + if (rightValue & FieldFlags.INITIALIZED) { + this.setFieldFlag(currentKey, FieldFlags.INITIALIZED); + } + } } /** Tests if the specified flows have differing local states. */ diff --git a/tests/compiler/strict-init.json b/tests/compiler/strict-init.json index 64e1532a5d..92425367ff 100644 --- a/tests/compiler/strict-init.json +++ b/tests/compiler/strict-init.json @@ -3,6 +3,8 @@ "--runtime none" ], "stderr": [ - "TS2564: Property b has no initializer and is not definitely assigned in constructor" + "TS2564: Property inlinedProp has no initializer and is not definitely assigned in constructor", + "TS2564: Property b has no initializer and is not definitely assigned in constructor", + "TS2564: Property p has no initializer and is not definitely assigned in constructor" ] } diff --git a/tests/compiler/strict-init.ts b/tests/compiler/strict-init.ts index 64bcf5a7ff..f2ca997304 100644 --- a/tests/compiler/strict-init.ts +++ b/tests/compiler/strict-init.ts @@ -1,7 +1,6 @@ // OK - Field with explicit initializer export class WithInitializer { public a: i32 = 1; - constructor() {} } // ERR - Field b not initialized @@ -24,8 +23,37 @@ export class ExplicitConstructorInit { } } -export class SupressExplicitInit { - p!: f64; +export class NonDefiniteIf { + p: f64; + constructor(a: i32) { + if ((a % 2) == 0) { + this.p = 1.0; + } else if ((a * 2) == 10) { + this.p = 0.0; + } + } +} + +export class DefiniteIf { + definite: i32; + + constructor(a: i32) { + if ((a % 2) == 0) { + this.definite = 1; + } else if ((a * 2) == 10) { + this.definite = 0; + } else if ((a / 2) == 1) { + this.definite = 8; + } else { + this.definite = 0; + } + } +} + + +class Inlined { + inlinedProp: i32; constructor() {} } +new Inlined(); From 63cb6142fbf33976d6fc1082ff5736459fb74e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Sun, 15 Mar 2020 20:43:38 -0400 Subject: [PATCH 05/14] Add test for empty left block --- tests/compiler/strict-init.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/compiler/strict-init.ts b/tests/compiler/strict-init.ts index f2ca997304..d4120d3385 100644 --- a/tests/compiler/strict-init.ts +++ b/tests/compiler/strict-init.ts @@ -23,6 +23,17 @@ export class ExplicitConstructorInit { } } +export class EmptyIfBlock { + field: i32; + + constructor(x: i32) { + if ((x + 5) == 6) { + } else { + this.field = 7; + } + } +} + export class NonDefiniteIf { p: f64; constructor(a: i32) { From 96ce41f65fb59b44a9aff59194c33585b8201046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Mon, 16 Mar 2020 10:43:35 -0400 Subject: [PATCH 06/14] Ensure left and right flows, use assert for maps, initialize field flags in constructor only --- src/flow.ts | 49 +++++++++++++++++++++------------ tests/compiler/strict-init.json | 2 ++ tests/compiler/strict-init.ts | 17 ++++++++++-- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/flow.ts b/src/flow.ts index c3b1707f04..83b5fc3627 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -171,8 +171,8 @@ export enum LocalFlags { /** Flags indicating the current state of an instance field. */ export enum FieldFlags { - NONE = 0, - INITIALIZED = 1 << 0, + NONE = 1, + INITIALIZED = 1 << 1, } /** Condition kinds. */ @@ -207,7 +207,7 @@ export class Flow { /** Local flags. */ localFlags: LocalFlags[]; /** Field flags. */ - fieldFlags: Map; + fieldFlags: Map | null = null; /** Function being inlined, when inlining. */ inlineFunction: Function | null; /** The label we break to when encountering a return statement, when inlining. */ @@ -224,7 +224,9 @@ export class Flow { flow.returnType = parentFunction.signature.returnType; flow.contextualTypeArguments = parentFunction.contextualTypeArguments; flow.localFlags = []; - flow.fieldFlags = new Map(); + if (parentFunction.is(CommonFlags.CONSTRUCTOR)) { + flow.fieldFlags = new Map(); + } flow.inlineFunction = null; flow.inlineReturnLabel = null; return flow; @@ -285,7 +287,9 @@ export class Flow { branch.localFlags = this.localFlags.slice(); branch.inlineFunction = this.inlineFunction; branch.inlineReturnLabel = this.inlineReturnLabel; - branch.fieldFlags = new Map(this.fieldFlags); + if (branch.parentFunction.is(CommonFlags.CONSTRUCTOR)) { + branch.fieldFlags = new Map(this.fieldFlags!); + } return branch; } @@ -531,13 +535,17 @@ export class Flow { setFieldFlag(name: string, flag: FieldFlags): void { let fieldFlags = this.fieldFlags; - const flags = fieldFlags.get(name) || 0; - fieldFlags.set(name, flags | flag); + if (fieldFlags) { + const flags = fieldFlags.has(name) ? assert(fieldFlags.get(name)) : FieldFlags.NONE; + fieldFlags.set(name, flags | flag); + } } isFieldFlag(name: string, flag: FieldFlags): bool { - const flags = this.fieldFlags.get(name); - if (flags) { + const fieldFlags = this.fieldFlags; + + if (fieldFlags && fieldFlags.has(name)) { + const flags = assert(fieldFlags.get(name)); return (flags & flag) == flag; } return false; @@ -831,17 +839,22 @@ export class Flow { } } - // Only the most right flow will have an effect - // on the resulting flow. - const rightFieldFlags = right.fieldFlags; - const rightKeys = Map_keys(rightFieldFlags); - for (let _values = Map_values(rightFieldFlags), i = 0, k = _values.length; i < k; ++i) { - const rightValue = unchecked(_values[i]); - const currentKey = unchecked(rightKeys[i]); + if (left.fieldFlags && right.fieldFlags && right.fieldFlags.size > 0) { + const rightFieldFlags = right.fieldFlags; + const rightKeys = Map_keys(rightFieldFlags); + const rightValues = Map_values(rightFieldFlags); + + const leftFieldFlags = left.fieldFlags; - if (rightValue & FieldFlags.INITIALIZED) { - this.setFieldFlag(currentKey, FieldFlags.INITIALIZED); + for (let i = 0, k = rightValues.length; i < k; ++i) { + const rightValue = unchecked(rightValues[i]); + const rightKey = unchecked(rightKeys[i]); + const leftValue = leftFieldFlags.has(rightKey) ? assert(leftFieldFlags.get(rightKey)) : FieldFlags.NONE; + + if ((rightValue & FieldFlags.INITIALIZED) && (leftValue & FieldFlags.INITIALIZED)) { + this.setFieldFlag(rightKey, FieldFlags.INITIALIZED); + } } } } diff --git a/tests/compiler/strict-init.json b/tests/compiler/strict-init.json index 92425367ff..ec05ea0de2 100644 --- a/tests/compiler/strict-init.json +++ b/tests/compiler/strict-init.json @@ -5,6 +5,8 @@ "stderr": [ "TS2564: Property inlinedProp has no initializer and is not definitely assigned in constructor", "TS2564: Property b has no initializer and is not definitely assigned in constructor", + "TS2564: Property fieldLeft has no initializer and is not definitely assigned in constructor", + "TS2564: Property fieldRight has no initializer and is not definitely assigned in constructor", "TS2564: Property p has no initializer and is not definitely assigned in constructor" ] } diff --git a/tests/compiler/strict-init.ts b/tests/compiler/strict-init.ts index d4120d3385..164eb39267 100644 --- a/tests/compiler/strict-init.ts +++ b/tests/compiler/strict-init.ts @@ -23,13 +23,24 @@ export class ExplicitConstructorInit { } } -export class EmptyIfBlock { - field: i32; +export class EmptyLeftBlock { + fieldLeft: i32; constructor(x: i32) { if ((x + 5) == 6) { } else { - this.field = 7; + this.fieldLeft = 7; + } + } +} + +export class EmptyRightBlock { + fieldRight: i32; + + constructor(x: i32) { + if ((x + 5) == 6) { + this.fieldRight = 7; + } else { } } } From ba39da96d9cb8b7ecab81bd8df0a4a8ed7172521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Wed, 18 Mar 2020 19:44:48 -0400 Subject: [PATCH 07/14] Several improvements to field flags flows: - Use `actualFunction` to check for constructor flows - Fix compilation errors regarding boolean comparisons --- src/flow.ts | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/flow.ts b/src/flow.ts index 83b5fc3627..0902321023 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -224,11 +224,12 @@ export class Flow { flow.returnType = parentFunction.signature.returnType; flow.contextualTypeArguments = parentFunction.contextualTypeArguments; flow.localFlags = []; - if (parentFunction.is(CommonFlags.CONSTRUCTOR)) { - flow.fieldFlags = new Map(); - } flow.inlineFunction = null; flow.inlineReturnLabel = null; + + if (flow.actualFunction.is(CommonFlags.CONSTRUCTOR)) { + flow.fieldFlags = new Map(); + } return flow; } @@ -287,9 +288,11 @@ export class Flow { branch.localFlags = this.localFlags.slice(); branch.inlineFunction = this.inlineFunction; branch.inlineReturnLabel = this.inlineReturnLabel; - if (branch.parentFunction.is(CommonFlags.CONSTRUCTOR)) { - branch.fieldFlags = new Map(this.fieldFlags!); + + if (branch.actualFunction.is(CommonFlags.CONSTRUCTOR)) { + branch.fieldFlags = new Map(); } + return branch; } @@ -544,12 +547,12 @@ export class Flow { isFieldFlag(name: string, flag: FieldFlags): bool { const fieldFlags = this.fieldFlags; - if (fieldFlags && fieldFlags.has(name)) { - const flags = assert(fieldFlags.get(name)); - return (flags & flag) == flag; + if ((fieldFlags !== null) && fieldFlags.has(name)) { + const flags = assert(fieldFlags.get(name)); + return (flags & flag) == flag; + } + return false; } - return false; - } /** Pushes a new break label to the stack, for example when entering a loop that one can `break` from. */ pushBreakLabel(): string { @@ -840,20 +843,25 @@ export class Flow { } - if (left.fieldFlags && right.fieldFlags && right.fieldFlags.size > 0) { + if ((left.fieldFlags !== null) && + (right.fieldFlags !== null) && + right.fieldFlags.size > 0 + ) { const rightFieldFlags = right.fieldFlags; - const rightKeys = Map_keys(rightFieldFlags); - const rightValues = Map_values(rightFieldFlags); + const rightKeys = Map_keys(rightFieldFlags!); + const rightValues = Map_values(rightFieldFlags!); const leftFieldFlags = left.fieldFlags; for (let i = 0, k = rightValues.length; i < k; ++i) { const rightValue = unchecked(rightValues[i]); const rightKey = unchecked(rightKeys[i]); - const leftValue = leftFieldFlags.has(rightKey) ? assert(leftFieldFlags.get(rightKey)) : FieldFlags.NONE; + const leftValue = leftFieldFlags!.has(rightKey) ? assert(leftFieldFlags!.get(rightKey)) : FieldFlags.NONE; - if ((rightValue & FieldFlags.INITIALIZED) && (leftValue & FieldFlags.INITIALIZED)) { - this.setFieldFlag(rightKey, FieldFlags.INITIALIZED); + if (rightValue & FieldFlags.INITIALIZED) { + if (leftValue & FieldFlags.INITIALIZED) { + this.setFieldFlag(rightKey, FieldFlags.INITIALIZED); + } } } } From 7497862c74e3f1210221635e54c7c802cb0394b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Wed, 18 Mar 2020 19:46:22 -0400 Subject: [PATCH 08/14] Exclude inherited fields for error reporting --- src/compiler.ts | 6 +++--- tests/compiler/strict-init.ts | 31 ++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index a0f6c4d448..685f584670 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -1544,7 +1544,7 @@ export class Compiler extends DiagnosticEmitter { if (instanceMembers) { for (let _values = Map_values(instanceMembers), i = 0, k = _values.length; i < k; ++i) { const element = unchecked(_values[i]); - if (element.kind == ElementKind.FIELD) { + if (element.kind == ElementKind.FIELD && element.parent == instance) { const field = element; if (!flow.isFieldFlag(field.internalName, FieldFlags.INITIALIZED)) { this.error( @@ -10038,7 +10038,7 @@ export class Compiler extends DiagnosticEmitter { let fieldPrototype = field.prototype; let initializerNode = fieldPrototype.initializerNode; let parameterIndex = fieldPrototype.parameterIndex; - let initExpr: ExpressionRef | null = null; + let initExpr: ExpressionRef = -1; const isDefiniteAssigment = field.is(CommonFlags.DEFINITE_ASSIGNMENT); // if declared as a constructor parameter, use its value @@ -10064,7 +10064,7 @@ export class Compiler extends DiagnosticEmitter { initExpr = this.makeZero(fieldType); } - if (initExpr) { + if (initExpr >= 0) { stmts.push( module.store(fieldType.byteSize, module.local_get(thisLocalIndex, nativeSizeType), diff --git a/tests/compiler/strict-init.ts b/tests/compiler/strict-init.ts index 164eb39267..0b5f2cc213 100644 --- a/tests/compiler/strict-init.ts +++ b/tests/compiler/strict-init.ts @@ -1,6 +1,7 @@ // OK - Field with explicit initializer export class WithInitializer { public a: i32 = 1; + some: string | null = null; } // ERR - Field b not initialized @@ -23,6 +24,7 @@ export class ExplicitConstructorInit { } } +// ERR - Left block empty export class EmptyLeftBlock { fieldLeft: i32; @@ -34,6 +36,7 @@ export class EmptyLeftBlock { } } +// ERR - Right block empty export class EmptyRightBlock { fieldRight: i32; @@ -45,6 +48,7 @@ export class EmptyRightBlock { } } +// ERR - Indefinite export class NonDefiniteIf { p: f64; constructor(a: i32) { @@ -56,6 +60,7 @@ export class NonDefiniteIf { } } +// OK - All branches covered export class DefiniteIf { definite: i32; @@ -73,9 +78,29 @@ export class DefiniteIf { } -class Inlined { - inlinedProp: i32; - constructor() {} +// ERR +export class Inlined { + inlinedProp: string | null; } new Inlined(); + +// OK - inherited fields +class ElementKind {} + +export abstract class Y { + inherited: string | null = "the inherited string"; +} + +export abstract class X extends Y { + ax: string[] | null; + protected constructor(public kind: ElementKind, other: ElementKind | null) { + super(); + + if (other) { + this.ax = ["string"]; + } else { + this.ax = ["string", "string"]; + } + } +} From 0bcc64c0ec8ce37c573ce0352265c05c45925e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Mon, 23 Mar 2020 19:58:07 -0400 Subject: [PATCH 09/14] Handle switch statement --- src/compiler.ts | 36 ++++++++++++++- src/flow.ts | 27 +++++++++++- tests/compiler/strict-init.json | 4 +- tests/compiler/strict-init.ts | 77 +++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 5 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 685f584670..8e489a61e3 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -2673,13 +2673,17 @@ export class Compiler extends DiagnosticEmitter { // stmts.push(module.createUnreachable()); return module.flatten(stmts); } - // Otherwise emit a normal return if (!stmts.length) return module.return(expr); stmts.push(module.return(expr)); return module.flatten(stmts); } + // For strict field init: + // Need to sequentially check for each of the branches + // if no default assume not init + // if default try and check all statements + private compileSwitchStatement( statement: SwitchStatement ): ExpressionRef { @@ -2742,6 +2746,9 @@ export class Compiler extends DiagnosticEmitter { var currentBlock = module.block("case0|" + context, breaks, NativeType.None); var commonCategorical = FlowFlags.ANY_CATEGORICAL; var commonConditional = 0; + // Track qualifying flows for field flag analysis + // A qualifying flow is a breaking flow or the last flow + var flows: Flow[] = []; for (let i = 0; i < numCases; ++i) { let case_ = cases[i]; let statements = case_.statements; @@ -2775,6 +2782,10 @@ export class Compiler extends DiagnosticEmitter { } commonConditional |= innerFlow.flags & FlowFlags.ANY_CONDITIONAL; + if (innerFlow.isAny(FlowFlags.BREAKS | FlowFlags.RETURNS) || isLast) { + flows.push(innerFlow); + } + // Switch back to the parent flow if (!terminates) this.performAutoreleases(innerFlow, stmts); innerFlow.unset( @@ -2788,7 +2799,28 @@ export class Compiler extends DiagnosticEmitter { outerFlow.popBreakLabel(); // If the switch has a default (guaranteed to handle any value), propagate common flags - if (defaultIndex >= 0) outerFlow.flags |= commonCategorical & ~FlowFlags.BREAKS; + if (defaultIndex >= 0){ + outerFlow.flags |= commonCategorical & ~FlowFlags.BREAKS; + + // If the switch: + // - has a default label + // - is located in the constructor + // - and has one or more qualifying flows + // analyze field flags + if (flows.length > 0 && this.currentFlow.actualFunction.is(CommonFlags.CONSTRUCTOR)) { + if (flows.length == 1) { + this.currentFlow.inheritFieldFlags(flows[0]); + } else { + for(let i = 0; i < flows.length; ++i) { + if (i < (flows.length - 1)) { + const left = flows[i]; + const right = flows[i + 1]; + this.currentFlow.mergeFieldFlags(left, right); + } + } + } + } + } outerFlow.flags |= commonConditional & ~FlowFlags.CONDITIONALLY_BREAKS; // TODO: what about local states? return currentBlock; diff --git a/src/flow.ts b/src/flow.ts index 0902321023..4bae705916 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -842,9 +842,12 @@ export class Flow { } } + this.mergeFieldFlags(left, right); + } - if ((left.fieldFlags !== null) && - (right.fieldFlags !== null) && + mergeFieldFlags(left: Flow, right: Flow): void { + if (left.fieldFlags !== null && + right.fieldFlags !== null && right.fieldFlags.size > 0 ) { const rightFieldFlags = right.fieldFlags; @@ -867,6 +870,26 @@ export class Flow { } } + inheritFieldFlags(other: Flow): void { + if ( + this.fieldFlags !== null && + other.fieldFlags !== null + ) { + const otherFieldFlags = other.fieldFlags; + const otherKeys = Map_keys(otherFieldFlags!); + const otherValues = Map_values(otherFieldFlags!); + const currentFieldFlags = this.fieldFlags; + + for (let i = 0, k = otherValues.length; i < k; ++i) { + const key = otherKeys[i]; + const otherValue = otherValues[i]; + if (otherValue & FieldFlags.INITIALIZED) { + currentFieldFlags.set(key, FieldFlags.INITIALIZED) + } + } + } + } + /** Tests if the specified flows have differing local states. */ static hasIncompatibleLocalStates(before: Flow, after: Flow): bool { var numThisLocalFlags = before.localFlags.length; diff --git a/tests/compiler/strict-init.json b/tests/compiler/strict-init.json index ec05ea0de2..f20de54bf1 100644 --- a/tests/compiler/strict-init.json +++ b/tests/compiler/strict-init.json @@ -7,6 +7,8 @@ "TS2564: Property b has no initializer and is not definitely assigned in constructor", "TS2564: Property fieldLeft has no initializer and is not definitely assigned in constructor", "TS2564: Property fieldRight has no initializer and is not definitely assigned in constructor", - "TS2564: Property p has no initializer and is not definitely assigned in constructor" + "TS2564: Property p has no initializer and is not definitely assigned in constructor", + "TS2564: Property switchNotInitInDefault has no initializer and is not definitely assigned in constructor", + "TS2564: Property switchNoDefault has no initializer and is not definitely assigned in constructor" ] } diff --git a/tests/compiler/strict-init.ts b/tests/compiler/strict-init.ts index 0b5f2cc213..e1772f6ed2 100644 --- a/tests/compiler/strict-init.ts +++ b/tests/compiler/strict-init.ts @@ -104,3 +104,80 @@ export abstract class X extends Y { } } } + +// OK +export class SwitchFallback { + switchFallback: i32; + constructor(some: i32) { + switch (some) { + case 1: + case 2: + case 3: + default: + this.switchFallback = 6; + break; + } + } +} + +// ERR +export class SwitchWithNonInitInDefault { + switchNotInitInDefault: i32; + + constructor(some: i32) { + switch (some) { + case 0: + case 1: + this.switchNotInitInDefault = 1; + break; + case 3: + this.switchNotInitInDefault = 5; + default: + const x = 6; + break; + } + } +} + +// OK +export class SwitchDefinitelyInit { + switchDefinitelyInit: i32; + constructor(some: i32) { + switch(some) { + case 0: + this.switchDefinitelyInit = 0; + break; + case 1: + this.switchDefinitelyInit = 1; + break; + case 3: + this.switchDefinitelyInit = 5; + default: + this.switchDefinitelyInit = 10; + break; + } + } +} + +// ERR +export class SwitchNoDefault { + switchNoDefault: i32; + + constructor(some: i32) { + switch(some) { + case 1: + this.switchNoDefault = 4; + } + } +} + +export class SwitchOnlyDefault { + switchOnlyDefault: i32; + + constructor(some: i32) { + switch (some) { + default: + this.switchOnlyDefault = 0; + } + } +} From 743ef7e89a8999e5f1636607b71a502512af71c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Sun, 29 Mar 2020 19:44:19 -0400 Subject: [PATCH 10/14] Polishing - Fix self compilation - Add strict property initialization flags for TS - Handle constructor inlining --- src/ast.ts | 246 +++--- src/builtins.ts | 14 +- src/compiler.ts | 13 +- src/definitions.ts | 2 +- src/flow.ts | 40 +- src/module.ts | 16 +- src/parser.ts | 2 +- src/program.ts | 64 +- src/tokenizer.ts | 6 +- std/assembly/map.ts | 12 +- std/assembly/set.ts | 12 +- std/assembly/shared/typeinfo.ts | 4 +- tests/compiler/class.optimized.wat | 12 - tests/compiler/class.untouched.wat | 12 - tests/compiler/constructor.ts | 4 +- tests/compiler/extends-baseaggregate.ts | 10 +- tests/compiler/inlining.optimized.wat | 6 - tests/compiler/inlining.untouched.wat | 6 - tests/compiler/resolve-access.ts | 2 +- .../resolve-elementaccess.optimized.wat | 9 - .../resolve-elementaccess.untouched.wat | 9 - .../retain-release-sanity.optimized.wat | 152 ++-- tests/compiler/retain-release-sanity.ts | 4 +- .../retain-release-sanity.untouched.wat | 36 - tests/compiler/retain-release.ts | 2 +- tests/compiler/std/array.optimized.wat | 791 ++++++++---------- tests/compiler/std/array.untouched.wat | 57 -- tests/compiler/std/arraybuffer.optimized.wat | 233 +++--- tests/compiler/std/arraybuffer.untouched.wat | 18 - tests/compiler/std/dataview.optimized.wat | 492 ++++++----- tests/compiler/std/dataview.untouched.wat | 18 - tests/compiler/std/date.optimized.wat | 3 - tests/compiler/std/date.untouched.wat | 3 - tests/compiler/std/map.optimized.wat | 284 ++----- tests/compiler/std/map.untouched.wat | 120 --- tests/compiler/std/set.optimized.wat | 212 ++--- tests/compiler/std/set.untouched.wat | 120 --- tests/compiler/std/typedarray.optimized.wat | 24 +- tests/compiler/std/typedarray.untouched.wat | 9 - tsconfig-base.json | 1 + 40 files changed, 1120 insertions(+), 1960 deletions(-) diff --git a/src/ast.ts b/src/ast.ts index 155b1603fc..bb82e21bf9 100644 --- a/src/ast.ts +++ b/src/ast.ts @@ -114,9 +114,9 @@ export enum NodeKind { /** Base class of all nodes. */ export abstract class Node { /** Node kind indicator. */ - kind: NodeKind; + kind!: NodeKind; /** Source range. */ - range: Range; + range!: Range; // types @@ -1173,7 +1173,7 @@ export abstract class TypeNode extends Node { // kind varies /** Whether nullable or not. */ - isNullable: bool; + isNullable!: bool; /** Tests if this type has a generic component matching one of the given type parameters. */ hasGenericComponent(typeParameterNodes: TypeParameterNode[]): bool { @@ -1211,17 +1211,17 @@ export abstract class TypeNode extends Node { /** Represents a type name. */ export class TypeName extends Node { /** Identifier of this part. */ - identifier: IdentifierExpression; + identifier!: IdentifierExpression; /** Next part of the type name or `null` if this is the last part. */ - next: TypeName | null; + next: TypeName | null = null; } /** Represents a named type. */ export class NamedTypeNode extends TypeNode { /** Type name. */ - name: TypeName; + name!: TypeName; /** Type argument references. */ - typeArguments: TypeNode[] | null; + typeArguments: TypeNode[] | null = null; get hasTypeArguments(): bool { var typeArguments = this.typeArguments; @@ -1232,21 +1232,21 @@ export class NamedTypeNode extends TypeNode { /** Represents a function type. */ export class FunctionTypeNode extends TypeNode { /** Accepted parameters. */ - parameters: ParameterNode[]; + parameters!: ParameterNode[]; /** Return type. */ - returnType: TypeNode; + returnType!: TypeNode; /** Explicitly provided this type, if any. */ - explicitThisType: NamedTypeNode | null; // can't be a function + explicitThisType: NamedTypeNode | null = null; // can't be a function } /** Represents a type parameter. */ export class TypeParameterNode extends Node { /** Identifier reference. */ - name: IdentifierExpression; + name!: IdentifierExpression; /** Extended type reference, if any. */ - extendsType: NamedTypeNode | null; // can't be a function + extendsType: NamedTypeNode | null = null; // can't be a function /** Default type if omitted, if any. */ - defaultType: NamedTypeNode | null; // can't be a function + defaultType: NamedTypeNode | null = null; // can't be a function } /** Represents the kind of a parameter. */ @@ -1262,13 +1262,13 @@ export enum ParameterKind { /** Represents a function parameter. */ export class ParameterNode extends Node { /** Parameter kind. */ - parameterKind: ParameterKind; + parameterKind!: ParameterKind; /** Parameter name. */ - name: IdentifierExpression; + name!: IdentifierExpression; /** Parameter type. */ - type: TypeNode; + type!: TypeNode; /** Initializer expression, if present. */ - initializer: Expression | null; + initializer: Expression | null = null; /** Implicit field declaration, if applicable. */ implicitFieldDeclaration: FieldDeclaration | null = null; /** Common flags indicating specific traits. */ @@ -1375,11 +1375,11 @@ export namespace DecoratorKind { /** Represents a decorator. */ export class DecoratorNode extends Node { /** Built-in kind, if applicable. */ - decoratorKind: DecoratorKind; + decoratorKind!: DecoratorKind; /** Name expression. */ - name: Expression; + name!: Expression; /** Argument expressions. */ - arguments: Expression[] | null; + arguments: Expression[] | null = null; } /** Comment kinds. */ @@ -1395,9 +1395,9 @@ export enum CommentKind { /** Represents a comment. */ export class CommentNode extends Node { /** Comment kind. */ - commentKind: CommentKind; + commentKind!: CommentKind; /** Comment text. */ - text: string; + text!: string; } // expressions @@ -1408,9 +1408,9 @@ export abstract class Expression extends Node { } /** Represents an identifier expression. */ export class IdentifierExpression extends Expression { /** Textual name. */ - text: string; + text!: string; /** Whether quoted or not. */ - isQuoted: bool; + isQuoted!: bool; } /** Indicates the kind of a literal. */ @@ -1426,13 +1426,13 @@ export enum LiteralKind { /** Base class of all literal expressions. */ export abstract class LiteralExpression extends Expression { /** Specific literal kind. */ - literalKind: LiteralKind; + literalKind!: LiteralKind; } /** Represents an `[]` literal expression. */ export class ArrayLiteralExpression extends LiteralExpression { /** Nested element expressions. */ - elementExpressions: (Expression | null)[]; + elementExpressions!: (Expression | null)[]; } /** Indicates the kind of an assertion. */ @@ -1446,31 +1446,31 @@ export enum AssertionKind { /** Represents an assertion expression. */ export class AssertionExpression extends Expression { /** Specific kind of this assertion. */ - assertionKind: AssertionKind; + assertionKind!: AssertionKind; /** Expression being asserted. */ - expression: Expression; + expression!: Expression; /** Target type. */ - toType: TypeNode | null; + toType: TypeNode | null = null; } /** Represents a binary expression. */ export class BinaryExpression extends Expression { /** Operator token. */ - operator: Token; + operator!: Token; /** Left-hand side expression */ - left: Expression; + left!: Expression; /** Right-hand side expression. */ - right: Expression; + right!: Expression; } /** Represents a call expression. */ export class CallExpression extends Expression { /** Called expression. Usually an identifier or property access expression. */ - expression: Expression; + expression!: Expression; /** Provided type arguments. */ - typeArguments: TypeNode[] | null; + typeArguments: TypeNode[] | null = null; /** Provided arguments. */ - arguments: Expression[]; + arguments!: Expression[]; /** Gets the type arguments range for reporting. */ get typeArgumentsRange(): Range { @@ -1498,13 +1498,13 @@ export class CallExpression extends Expression { /** Represents a class expression using the 'class' keyword. */ export class ClassExpression extends Expression { /** Inline class declaration. */ - declaration: ClassDeclaration; + declaration!: ClassDeclaration; } /** Represents a comma expression composed of multiple expressions. */ export class CommaExpression extends Expression { /** Sequential expressions. */ - expressions: Expression[]; + expressions!: Expression[]; } /** Represents a `constructor` expression. */ @@ -1514,45 +1514,45 @@ export class ConstructorExpression extends IdentifierExpression { /** Represents an element access expression, e.g., array access. */ export class ElementAccessExpression extends Expression { /** Expression being accessed. */ - expression: Expression; + expression!: Expression; /** Element of the expression being accessed. */ - elementExpression: Expression; + elementExpression!: Expression; } /** Represents a float literal expression. */ export class FloatLiteralExpression extends LiteralExpression { /** Float value. */ - value: f64; + value!: f64; } /** Represents a function expression using the 'function' keyword. */ export class FunctionExpression extends Expression { /** Inline function declaration. */ - declaration: FunctionDeclaration; + declaration!: FunctionDeclaration; } /** Represents an `instanceof` expression. */ export class InstanceOfExpression extends Expression { /** Expression being asserted. */ - expression: Expression; + expression!: Expression; /** Type to test for. */ - isType: TypeNode; + isType!: TypeNode; } /** Represents an integer literal expression. */ export class IntegerLiteralExpression extends LiteralExpression { /** Integer value. */ - value: i64; + value!: i64; } /** Represents a `new` expression. Like a call but with its own kind. */ export class NewExpression extends Expression { /** Type being constructed. */ - typeName: TypeName; + typeName!: TypeName; /** Provided type arguments. */ - typeArguments: TypeNode[] | null; + typeArguments: TypeNode[] | null = null; /** Provided arguments. */ - arguments: Expression[]; + arguments!: Expression[]; /** Gets the type arguments range for reporting. */ get typeArgumentsRange(): Range { @@ -1582,47 +1582,47 @@ export class NullExpression extends IdentifierExpression { /** Represents an object literal expression. */ export class ObjectLiteralExpression extends LiteralExpression { /** Field names. */ - names: IdentifierExpression[]; + names!: IdentifierExpression[]; /** Field values. */ - values: Expression[]; + values!: Expression[]; } /** Represents a parenthesized expression. */ export class ParenthesizedExpression extends Expression { /** Expression in parenthesis. */ - expression: Expression; + expression!: Expression; } /** Represents a property access expression. */ export class PropertyAccessExpression extends Expression { /** Expression being accessed. */ - expression: Expression; + expression!: Expression; /** Property of the expression being accessed. */ - property: IdentifierExpression; + property!: IdentifierExpression; } /** Represents a regular expression literal expression. */ export class RegexpLiteralExpression extends LiteralExpression { /** Regular expression pattern. */ - pattern: string; + pattern!: string; /** Regular expression flags. */ - patternFlags: string; + patternFlags!: string; } /** Represents a ternary expression, i.e., short if notation. */ export class TernaryExpression extends Expression { /** Condition expression. */ - condition: Expression; + condition!: Expression; /** Expression executed when condition is `true`. */ - ifThen: Expression; + ifThen!: Expression; /** Expression executed when condition is `false`. */ - ifElse: Expression; + ifElse!: Expression; } /** Represents a string literal expression. */ export class StringLiteralExpression extends LiteralExpression { /** String value without quotes. */ - value: string; + value!: string; } /** Represents a `super` expression. */ @@ -1644,9 +1644,9 @@ export class FalseExpression extends IdentifierExpression { /** Base class of all unary expressions. */ export abstract class UnaryExpression extends Expression { /** Operator token. */ - operator: Token; + operator!: Token; /** Operand expression. */ - operand: Expression; + operand!: Expression; } /** Represents a unary postfix expression, e.g. a postfix increment. */ @@ -1763,7 +1763,7 @@ export class Source extends Node { /** Base class of all declaration statements. */ export abstract class DeclarationStatement extends Statement { /** Simple name being declared. */ - name: IdentifierExpression; + name!: IdentifierExpression; /** Array of decorators. */ decorators: DecoratorNode[] | null = null; /** Common flags indicating specific traits. */ @@ -1780,41 +1780,41 @@ export abstract class DeclarationStatement extends Statement { /** Represents an index signature declaration. */ export class IndexSignatureDeclaration extends DeclarationStatement { /** Key type. */ - keyType: NamedTypeNode; + keyType!: NamedTypeNode; /** Value type. */ - valueType: TypeNode; + valueType!: TypeNode; } /** Base class of all variable-like declaration statements. */ export abstract class VariableLikeDeclarationStatement extends DeclarationStatement { /** Variable type. */ - type: TypeNode | null; + type: TypeNode | null = null; /** Variable initializer. */ - initializer: Expression | null; + initializer: Expression | null = null; } /** Represents a block statement. */ export class BlockStatement extends Statement { /** Contained statements. */ - statements: Statement[]; + statements!: Statement[]; } /** Represents a `break` statement. */ export class BreakStatement extends Statement { /** Target label, if applicable. */ - label: IdentifierExpression | null; + label: IdentifierExpression | null = null; } /** Represents a `class` declaration. */ export class ClassDeclaration extends DeclarationStatement { /** Accepted type parameters. */ - typeParameters: TypeParameterNode[] | null; + typeParameters: TypeParameterNode[] | null = null; /** Base class type being extended, if any. */ - extendsType: NamedTypeNode | null; // can't be a function + extendsType: NamedTypeNode | null = null; // can't be a function /** Interface types being implemented, if any. */ - implementsTypes: NamedTypeNode[] | null; // can't be functions + implementsTypes: NamedTypeNode[] | null = null; // can't be functions /** Class member declarations. */ - members: DeclarationStatement[]; + members!: DeclarationStatement[]; get isGeneric(): bool { var typeParameters = this.typeParameters; @@ -1825,15 +1825,15 @@ export class ClassDeclaration extends DeclarationStatement { /** Represents a `continue` statement. */ export class ContinueStatement extends Statement { /** Target label, if applicable. */ - label: IdentifierExpression | null; + label: IdentifierExpression | null = null; } /** Represents a `do` statement. */ export class DoStatement extends Statement { /** Statement being looped over. */ - statement: Statement; + statement!: Statement; /** Condition when to repeat. */ - condition: Expression; + condition!: Expression; } /** Represents an empty statement, i.e., a semicolon terminating nothing. */ @@ -1843,53 +1843,53 @@ export class EmptyStatement extends Statement { /** Represents an `enum` declaration. */ export class EnumDeclaration extends DeclarationStatement { /** Enum value declarations. */ - values: EnumValueDeclaration[]; + values!: EnumValueDeclaration[]; } /** Represents a value of an `enum` declaration. */ export class EnumValueDeclaration extends VariableLikeDeclarationStatement { /** Value expression. */ - value: Expression | null; + value: Expression | null = null; } /** Represents an `export import` statement of an interface. */ export class ExportImportStatement extends Statement { /** Identifier being imported. */ - name: IdentifierExpression; + name!: IdentifierExpression; /** Identifier being exported. */ - externalName: IdentifierExpression; + externalName!: IdentifierExpression; } /** Represents a member of an `export` statement. */ export class ExportMember extends Node { /** Local identifier. */ - localName: IdentifierExpression; + localName!: IdentifierExpression; /** Exported identifier. */ - exportedName: IdentifierExpression; + exportedName!: IdentifierExpression; } /** Represents an `export` statement. */ export class ExportStatement extends Statement { /** Array of members if a set of named exports, or `null` if a file export. */ - members: ExportMember[] | null; + members: ExportMember[] | null = null; /** Path being exported from, if applicable. */ - path: StringLiteralExpression | null; + path: StringLiteralExpression | null = null; /** Internal path being referenced, if `path` is set. */ - internalPath: string | null; + internalPath: string | null = null; /** Whether this is a declared export. */ - isDeclare: bool; + isDeclare!: bool; } /** Represents an `export default` statement. */ export class ExportDefaultStatement extends Statement { /** Declaration being exported as default. */ - declaration: DeclarationStatement; + declaration!: DeclarationStatement; } /** Represents an expression that is used as a statement. */ export class ExpressionStatement extends Statement { /** Expression being used as a statement.*/ - expression: Expression; + expression!: Expression; } /** Represents a field declaration within a `class`. */ @@ -1901,23 +1901,23 @@ export class FieldDeclaration extends VariableLikeDeclarationStatement { /** Represents a `for` statement. */ export class ForStatement extends Statement { /** Initializer statement, if present. Either a `VariableStatement` or `ExpressionStatement`. */ - initializer: Statement | null; + initializer: Statement | null = null; /** Condition expression, if present. */ - condition: Expression | null; + condition: Expression | null = null; /** Incrementor expression, if present. */ - incrementor: Expression | null; + incrementor: Expression | null = null; /** Statement being looped over. */ - statement: Statement; + statement!: Statement; } /** Represents a `for..of` statement. */ export class ForOfStatement extends Statement { /** Variable statement. Either a `VariableStatement` or `ExpressionStatement` of `IdentifierExpression`. */ - variable: Statement; + variable!: Statement; /** Iterable expression being iterated. */ - iterable: Expression; + iterable!: Expression; /** Statement being looped over. */ - statement: Statement; + statement!: Statement; } /** Indicates the kind of an array function. */ @@ -1933,13 +1933,13 @@ export const enum ArrowKind { /** Represents a `function` declaration. */ export class FunctionDeclaration extends DeclarationStatement { /** Type parameters, if any. */ - typeParameters: TypeParameterNode[] | null; + typeParameters: TypeParameterNode[] | null = null; /** Function signature. */ - signature: FunctionTypeNode; + signature!: FunctionTypeNode; /** Body statement. Usually a block. */ - body: Statement | null; + body: Statement | null = null; /** Arrow function kind, if applicable. */ - arrowKind: ArrowKind; + arrowKind!: ArrowKind; get isGeneric(): bool { var typeParameters = this.typeParameters; @@ -1964,29 +1964,29 @@ export class FunctionDeclaration extends DeclarationStatement { /** Represents an `if` statement. */ export class IfStatement extends Statement { /** Condition. */ - condition: Expression; + condition!: Expression; /** Statement executed when condition is `true`. */ - ifTrue: Statement; + ifTrue!: Statement; /** Statement executed when condition is `false`. */ - ifFalse: Statement | null; + ifFalse: Statement | null = null; } /** Represents an `import` declaration part of an {@link ImportStatement}. */ export class ImportDeclaration extends DeclarationStatement { /** Identifier being imported. */ - foreignName: IdentifierExpression; + foreignName!: IdentifierExpression; } /** Represents an `import` statement. */ export class ImportStatement extends Statement { /** Array of member declarations or `null` if an asterisk import. */ - declarations: ImportDeclaration[] | null; + declarations: ImportDeclaration[] | null = null; /** Name of the local namespace, if an asterisk import. */ - namespaceName: IdentifierExpression | null; + namespaceName: IdentifierExpression | null = null; /** Path being imported from. */ - path: StringLiteralExpression; + path!: StringLiteralExpression; /** Internal path being referenced. */ - internalPath: string; + internalPath!: string; } /** Represents an `interfarce` declaration. */ @@ -2000,55 +2000,55 @@ export class MethodDeclaration extends FunctionDeclaration { /** Represents a `namespace` declaration. */ export class NamespaceDeclaration extends DeclarationStatement { /** Array of namespace members. */ - members: Statement[]; + members!: Statement[]; } /** Represents a `return` statement. */ export class ReturnStatement extends Statement { /** Value expression being returned, if present. */ - value: Expression | null; + value: Expression | null = null; } /** Represents a single `case` within a `switch` statement. */ export class SwitchCase extends Node { /** Label expression. `null` indicates the default case. */ - label: Expression | null; + label: Expression | null = null; /** Contained statements. */ - statements: Statement[]; + statements!: Statement[]; } /** Represents a `switch` statement. */ export class SwitchStatement extends Statement { /** Condition expression. */ - condition: Expression; + condition!: Expression; /** Contained cases. */ - cases: SwitchCase[]; + cases!: SwitchCase[]; } /** Represents a `throw` statement. */ export class ThrowStatement extends Statement { /** Value expression being thrown. */ - value: Expression; + value!: Expression; } /** Represents a `try` statement. */ export class TryStatement extends Statement { /** Contained statements. */ - statements: Statement[]; + statements!: Statement[]; /** Exception variable name, if a `catch` clause is present. */ - catchVariable: IdentifierExpression | null; + catchVariable: IdentifierExpression | null = null; /** Statements being executed on catch, if a `catch` clause is present. */ - catchStatements: Statement[] | null; + catchStatements: Statement[] | null = null; /** Statements being executed afterwards, if a `finally` clause is present. */ - finallyStatements: Statement[] | null; + finallyStatements: Statement[] | null = null; } /** Represents a `type` declaration. */ export class TypeDeclaration extends DeclarationStatement { /** Type parameters, if any. */ - typeParameters: TypeParameterNode[] | null; + typeParameters: TypeParameterNode[] | null = null; /** Type being aliased. */ - type: TypeNode; + type!: TypeNode; } /** Represents a variable declaration part of a {@link VariableStatement}. */ @@ -2058,23 +2058,23 @@ export class VariableDeclaration extends VariableLikeDeclarationStatement { /** Represents a variable statement wrapping {@link VariableDeclaration}s. */ export class VariableStatement extends Statement { /** Array of decorators. */ - decorators: DecoratorNode[] | null; + decorators: DecoratorNode[] | null = null; /** Array of member declarations. */ - declarations: VariableDeclaration[]; + declarations!: VariableDeclaration[]; } /** Represents a void statement dropping an expression's value. */ export class VoidStatement extends Statement { /** Expression being dropped. */ - expression: Expression; + expression!: Expression; } /** Represents a `while` statement. */ export class WhileStatement extends Statement { /** Condition expression. */ - condition: Expression; + condition!: Expression; /** Statement being looped over. */ - statement: Statement; + statement!: Statement; } /** Finds the first decorator matching the specified kind. */ diff --git a/src/builtins.ts b/src/builtins.ts index 8800a8c4c9..3a14b9959d 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -597,19 +597,19 @@ export namespace BuiltinNames { /** Builtin compilation context. */ export class BuiltinContext { /** Compiler reference. */ - compiler: Compiler; + compiler!: Compiler; /** Prototype being called. */ - prototype: FunctionPrototype; + prototype!: FunctionPrototype; /** Provided type arguments. */ - typeArguments: Type[] | null; + typeArguments: Type[] | null = null; /** Provided operands. */ - operands: Expression[]; + operands!: Expression[]; /** Contextual type. */ - contextualType: Type; + contextualType!: Type; /** Respective call expression. */ - reportNode: CallExpression; + reportNode!: CallExpression; /** Whether originating from inline assembly. */ - contextIsExact: bool; + contextIsExact!: bool; } /** Global builtins map. */ diff --git a/src/compiler.ts b/src/compiler.ts index f81d2ee61a..b9bdafe1a9 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -318,13 +318,13 @@ export class Compiler extends DiagnosticEmitter { module: Module; /** Current control flow. */ - currentFlow: Flow; + currentFlow!: Flow; /** Current parent element if not a function, i.e. an enum or namespace. */ currentParent: Element | null = null; /** Current type in compilation. */ currentType: Type = Type.void; /** Start function statements. */ - currentBody: ExpressionRef[]; + currentBody!: ExpressionRef[]; /** Counting memory offset. */ memoryOffset: i64; /** Memory segments being compiled. */ @@ -2814,7 +2814,7 @@ export class Compiler extends DiagnosticEmitter { outerFlow.popBreakLabel(); // If the switch has a default (guaranteed to handle any value), propagate common flags - if (defaultIndex >= 0){ + if (defaultIndex >= 0) { outerFlow.flags |= commonCategorical & ~FlowFlags.BREAKS; // If the switch: @@ -2826,7 +2826,7 @@ export class Compiler extends DiagnosticEmitter { if (flows.length == 1) { this.currentFlow.inheritFieldFlags(flows[0]); } else { - for(let i = 0; i < flows.length; ++i) { + for (let i = 0; i < flows.length; ++i) { if (i < (flows.length - 1)) { const left = flows[i]; const right = flows[i + 1]; @@ -8900,7 +8900,6 @@ export class Compiler extends DiagnosticEmitter { ): ExpressionRef { var ctor = this.ensureConstructor(classInstance, reportNode); if (classInstance.type.isUnmanaged || ctor.hasDecorator(DecoratorFlags.UNSAFE)) this.checkUnsafe(reportNode); - this.checkFieldInitialization(classInstance); var expr = this.compileCallDirect( // no need for another autoreleased local ctor, argumentExpressions, @@ -8911,6 +8910,8 @@ export class Compiler extends DiagnosticEmitter { if (getExpressionType(expr) != NativeType.None) { // possibly IMM_DROPPED this.currentType = classInstance.type; // important because a super ctor could be called } + + this.checkFieldInitialization(classInstance); return expr; } @@ -10119,7 +10120,7 @@ export class Compiler extends DiagnosticEmitter { field.memoryOffset ) ); - flow.setFieldFlag(field.internalName, FieldFlags.INITIALIZED) + flow.setFieldFlag(field.internalName, FieldFlags.INITIALIZED); } else { flow.setFieldFlag(field.internalName, FieldFlags.NONE); } diff --git a/src/definitions.ts b/src/definitions.ts index c9834c174d..6595a7b0a1 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -57,7 +57,7 @@ export abstract class ExportsWalker { /** Constructs a new Element walker. */ constructor(program: Program, includePrivate: bool = false) { this.program = program; - this.includePrivate; + this.includePrivate = includePrivate; } /** Walks all elements and calls the respective handlers. */ diff --git a/src/flow.ts b/src/flow.ts index 4bae705916..b5473bbe4c 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -189,43 +189,36 @@ export const enum ConditionKind { export class Flow { /** Parent flow. */ - parent: Flow | null; + parent: Flow | null = null; /** Flow flags indicating specific conditions. */ - flags: FlowFlags; + flags: FlowFlags = FlowFlags.NONE; /** Function this flow belongs to. */ - parentFunction: Function; + parentFunction!: Function; /** The label we break to when encountering a continue statement. */ - continueLabel: string | null; + continueLabel: string | null = null; /** The label we break to when encountering a break statement. */ - breakLabel: string | null; + breakLabel: string | null = null; /** The current return type. */ - returnType: Type; + returnType!: Type; /** The current contextual type arguments. */ - contextualTypeArguments: Map | null; + contextualTypeArguments: Map | null = null; /** Scoped local variables. */ scopedLocals: Map | null = null; /** Local flags. */ - localFlags: LocalFlags[]; + localFlags: LocalFlags[] = []; /** Field flags. */ fieldFlags: Map | null = null; /** Function being inlined, when inlining. */ - inlineFunction: Function | null; + inlineFunction: Function | null = null; /** The label we break to when encountering a return statement, when inlining. */ - inlineReturnLabel: string | null; + inlineReturnLabel: string | null = null; /** Creates the parent flow of the specified function. */ static create(parentFunction: Function): Flow { var flow = new Flow(); - flow.parent = null; - flow.flags = FlowFlags.NONE; flow.parentFunction = parentFunction; - flow.continueLabel = null; - flow.breakLabel = null; flow.returnType = parentFunction.signature.returnType; flow.contextualTypeArguments = parentFunction.contextualTypeArguments; - flow.localFlags = []; - flow.inlineFunction = null; - flow.inlineReturnLabel = null; if (flow.actualFunction.is(CommonFlags.CONSTRUCTOR)) { flow.fieldFlags = new Map(); @@ -240,6 +233,7 @@ export class Flow { flow.inlineReturnLabel = inlineFunction.internalName + "|inlined." + (inlineFunction.nextInlineId++).toString(); flow.returnType = inlineFunction.signature.returnType; flow.contextualTypeArguments = inlineFunction.contextualTypeArguments; + flow.fieldFlags = inlineFunction.flow.fieldFlags; return flow; } @@ -536,14 +530,16 @@ export class Flow { localFlags[index] = flags & ~flag; } + /** Associates the given flag with the given field name */ setFieldFlag(name: string, flag: FieldFlags): void { - let fieldFlags = this.fieldFlags; + var fieldFlags = this.fieldFlags; if (fieldFlags) { const flags = fieldFlags.has(name) ? assert(fieldFlags.get(name)) : FieldFlags.NONE; fieldFlags.set(name, flags | flag); } } + /** Tests if the given field name and flag exist */ isFieldFlag(name: string, flag: FieldFlags): bool { const fieldFlags = this.fieldFlags; @@ -845,6 +841,11 @@ export class Flow { this.mergeFieldFlags(left, right); } + /** + * Merges the fields flags of the given flows + * into the current flow. Flags will only be merged + * if both flows definitely define the flags. + */ mergeFieldFlags(left: Flow, right: Flow): void { if (left.fieldFlags !== null && right.fieldFlags !== null && @@ -870,6 +871,7 @@ export class Flow { } } + /** Inherits the fields flags of the given flow into the current flow */ inheritFieldFlags(other: Flow): void { if ( this.fieldFlags !== null && @@ -884,7 +886,7 @@ export class Flow { const key = otherKeys[i]; const otherValue = otherValues[i]; if (otherValue & FieldFlags.INITIALIZED) { - currentFieldFlags.set(key, FieldFlags.INITIALIZED) + currentFieldFlags.set(key, FieldFlags.INITIALIZED); } } } diff --git a/src/module.ts b/src/module.ts index 58c40425b6..7eefb9ca7e 100644 --- a/src/module.ts +++ b/src/module.ts @@ -468,8 +468,8 @@ export enum SIMDLoadOp { export class MemorySegment { - buffer: Uint8Array; - offset: i64; + buffer!: Uint8Array; + offset!: i64; static create(buffer: Uint8Array, offset: i64): MemorySegment { var segment = new MemorySegment(); @@ -481,9 +481,9 @@ export class MemorySegment { export class Module { - ref: ModuleRef; + ref!: ModuleRef; - private lit: usize; + private lit!: usize; static create(): Module { var module = new Module(); @@ -1896,8 +1896,8 @@ export function getEventResults(event: EventRef): NativeType { export class Relooper { - module: Module; - ref: RelooperRef; + module!: Module; + ref!: RelooperRef; static create(module: Module): Relooper { var relooper = new Relooper(); @@ -2141,9 +2141,9 @@ export function readString(ptr: usize): string | null { /** Result structure of {@link Module#toBinary}. */ export class BinaryModule { /** WebAssembly binary. */ - output: Uint8Array; + output!: Uint8Array; /** Source map, if generated. */ - sourceMap: string | null; + sourceMap: string | null = null; } /** Tests if an expression needs an explicit 'unreachable' when it is the terminating statement. */ diff --git a/src/parser.ts b/src/parser.ts index 0c0ac7d9c0..51bbb23d07 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -106,7 +106,7 @@ export class Parser extends DiagnosticEmitter { /** Optional handler to intercept comments while tokenizing. */ onComment: CommentHandler | null = null; /** Current file being parsed. */ - currentSource: Source; + currentSource!: Source; /** Dependency map **/ dependees: Map = new Map(); diff --git a/src/program.ts b/src/program.ts index 6612ae778c..9ec68408ea 100644 --- a/src/program.ts +++ b/src/program.ts @@ -448,68 +448,68 @@ export class Program extends DiagnosticEmitter { // standard references /** ArrayBufferView reference. */ - arrayBufferViewInstance: Class; + arrayBufferViewInstance!: Class; /** ArrayBuffer instance reference. */ - arrayBufferInstance: Class; + arrayBufferInstance!: Class; /** Array prototype reference. */ - arrayPrototype: ClassPrototype; + arrayPrototype!: ClassPrototype; /** Static array prototype reference. */ - staticArrayPrototype: ClassPrototype; + staticArrayPrototype!: ClassPrototype; /** Set prototype reference. */ - setPrototype: ClassPrototype; + setPrototype!: ClassPrototype; /** Map prototype reference. */ - mapPrototype: ClassPrototype; + mapPrototype!: ClassPrototype; /** Int8Array prototype. */ - i8ArrayPrototype: ClassPrototype; + i8ArrayPrototype!: ClassPrototype; /** Int16Array prototype. */ - i16ArrayPrototype: ClassPrototype; + i16ArrayPrototype!: ClassPrototype; /** Int32Array prototype. */ - i32ArrayPrototype: ClassPrototype; + i32ArrayPrototype!: ClassPrototype; /** Int64Array prototype. */ - i64ArrayPrototype: ClassPrototype; + i64ArrayPrototype!: ClassPrototype; /** Uint8Array prototype. */ - u8ArrayPrototype: ClassPrototype; + u8ArrayPrototype!: ClassPrototype; /** Uint8ClampedArray prototype. */ - u8ClampedArrayPrototype: ClassPrototype; + u8ClampedArrayPrototype!: ClassPrototype; /** Uint16Array prototype. */ - u16ArrayPrototype: ClassPrototype; + u16ArrayPrototype!: ClassPrototype; /** Uint32Array prototype. */ - u32ArrayPrototype: ClassPrototype; + u32ArrayPrototype!: ClassPrototype; /** Uint64Array prototype. */ - u64ArrayPrototype: ClassPrototype; + u64ArrayPrototype!: ClassPrototype; /** Float32Array prototype. */ - f32ArrayPrototype: ClassPrototype; + f32ArrayPrototype!: ClassPrototype; /** Float64Array prototype. */ - f64ArrayPrototype: ClassPrototype; + f64ArrayPrototype!: ClassPrototype; /** String instance reference. */ - stringInstance: Class; + stringInstance!: Class; /** Abort function reference, if not explicitly disabled. */ - abortInstance: Function | null; + abortInstance: Function | null = null; // runtime references /** RT `__alloc(size: usize, id: u32): usize` */ - allocInstance: Function; + allocInstance!: Function; /** RT `__realloc(ptr: usize, newSize: usize): usize` */ - reallocInstance: Function; + reallocInstance!: Function; /** RT `__free(ptr: usize): void` */ - freeInstance: Function; + freeInstance!: Function; /** RT `__retain(ptr: usize): usize` */ - retainInstance: Function; + retainInstance!: Function; /** RT `__release(ptr: usize): void` */ - releaseInstance: Function; + releaseInstance!: Function; /** RT `__collect(): void` */ - collectInstance: Function; + collectInstance!: Function; /** RT `__visit(ptr: usize, cookie: u32): void` */ - visitInstance: Function; + visitInstance!: Function; /** RT `__typeinfo(id: u32): RTTIFlags` */ - typeinfoInstance: Function; + typeinfoInstance!: Function; /** RT `__instanceof(ptr: usize, superId: u32): bool` */ - instanceofInstance: Function; + instanceofInstance!: Function; /** RT `__allocBuffer(size: usize, id: u32, data: usize = 0): usize` */ - allocBufferInstance: Function; + allocBufferInstance!: Function; /** RT `__allocArray(length: i32, alignLog2: usize, id: u32, data: usize = 0): usize` */ - allocArrayInstance: Function; + allocArrayInstance!: Function; /** Next class id. */ nextClassId: u32 = 0; @@ -2695,9 +2695,9 @@ export abstract class VariableLikeElement extends TypedElement { /** Constant value kind. */ constantValueKind: ConstantValueKind = ConstantValueKind.NONE; /** Constant integer value, if applicable. */ - constantIntegerValue: i64; + constantIntegerValue!: i64; /** Constant float value, if applicable. */ - constantFloatValue: f64; + constantFloatValue!: f64; /** Constructs a new variable-like element. */ protected constructor( diff --git a/src/tokenizer.ts b/src/tokenizer.ts index c0235bd9cb..78ae4940ef 100644 --- a/src/tokenizer.ts +++ b/src/tokenizer.ts @@ -1567,11 +1567,11 @@ export class Tokenizer extends DiagnosticEmitter { /** Tokenizer state as returned by {@link Tokenizer#mark} and consumed by {@link Tokenizer#reset}. */ export class State { /** Current position. */ - pos: i32; + pos!: i32; /** Current token. */ - token: Token; + token!: Token; /** Current token's position. */ - tokenPos: i32; + tokenPos!: i32; } // Reusable state object to reduce allocations diff --git a/std/assembly/map.ts b/std/assembly/map.ts index 0e82f9f96c..edafc459f0 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -64,14 +64,14 @@ function ENTRY_SIZE(): usize { export class Map { // buckets holding references to the respective first entry within - private buckets: ArrayBuffer; // usize[bucketsMask + 1] - private bucketsMask: u32; + private buckets!: ArrayBuffer; // usize[bucketsMask + 1] + private bucketsMask!: u32; // entries in insertion order - private entries: ArrayBuffer; // MapEntry[entriesCapacity] - private entriesCapacity: i32; - private entriesOffset: i32; - private entriesCount: i32; + private entries!: ArrayBuffer; // MapEntry[entriesCapacity] + private entriesCapacity!: i32; + private entriesOffset!: i32; + private entriesCount!: i32; get size(): i32 { return this.entriesCount; } diff --git a/std/assembly/set.ts b/std/assembly/set.ts index ca2a1ca299..a5e0606fa4 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -61,14 +61,14 @@ function ENTRY_SIZE(): usize { export class Set { // buckets holding references to the respective first entry within - private buckets: ArrayBuffer; // usize[bucketsMask + 1] - private bucketsMask: u32; + private buckets!: ArrayBuffer; // usize[bucketsMask + 1] + private bucketsMask!: u32; // entries in insertion order - private entries: ArrayBuffer; // SetEntry[entriesCapacity] - private entriesCapacity: i32; - private entriesOffset: i32; - private entriesCount: i32; + private entries!: ArrayBuffer; // SetEntry[entriesCapacity] + private entriesCapacity!: i32; + private entriesOffset!: i32; + private entriesCount!: i32; get size(): i32 { return this.entriesCount; } diff --git a/std/assembly/shared/typeinfo.ts b/std/assembly/shared/typeinfo.ts index ef8b9feda0..820adbd626 100644 --- a/std/assembly/shared/typeinfo.ts +++ b/std/assembly/shared/typeinfo.ts @@ -16,9 +16,9 @@ @unmanaged export class Typeinfo { /** Flags describing the shape of this class type. */ - flags: TypeinfoFlags; + flags!: TypeinfoFlags; /** Base class id or `0` if none. */ - base: u32; + base!: u32; } /** Runtime type information flags. */ diff --git a/tests/compiler/class.optimized.wat b/tests/compiler/class.optimized.wat index 55e85d2f02..53aadc53e1 100644 --- a/tests/compiler/class.optimized.wat +++ b/tests/compiler/class.optimized.wat @@ -131,18 +131,6 @@ i32.const 5 call $~lib/rt/stub/__alloc local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 i32.load drop local.get $0 diff --git a/tests/compiler/class.untouched.wat b/tests/compiler/class.untouched.wat index 2fc08fc407..71d841d47a 100644 --- a/tests/compiler/class.untouched.wat +++ b/tests/compiler/class.untouched.wat @@ -479,18 +479,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/constructor.ts b/tests/compiler/constructor.ts index d24a43402f..02b3fa6fdf 100644 --- a/tests/compiler/constructor.ts +++ b/tests/compiler/constructor.ts @@ -15,7 +15,7 @@ var emptyCtorWithFieldInit = new EmptyCtorWithFieldInit(); // trailing conditional allocate with field initialized to zero class EmptyCtorWithFieldNoInit { - a: i32; + a!: i32; constructor() {} } @@ -36,7 +36,7 @@ var justFieldInit = new JustFieldInit(); // direct allocate with field initialized to zero class JustFieldNoInit { - a: i32; + a!: i32; } var justFieldNoInit = new JustFieldNoInit(); diff --git a/tests/compiler/extends-baseaggregate.ts b/tests/compiler/extends-baseaggregate.ts index dfc2522675..2fc89ffe17 100644 --- a/tests/compiler/extends-baseaggregate.ts +++ b/tests/compiler/extends-baseaggregate.ts @@ -1,17 +1,17 @@ class A1 { - private padding0: f64; - private padding1: f64; - private c1: C1; + private padding0!: f64; + private padding1!: f64; + private c1!: C1; } class A2 extends A1 { } class B1 { - private a1: A1; + private a1!: A1; } class C1 { - private a2: A2; + private a2!: A2; } const poolB: B1[] = []; diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index 5a8ce29c21..b61845e5e7 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -122,18 +122,12 @@ i32.const 1 i32.store local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 i32.const 2 i32.store offset=4 local.get $0 i32.const 3 i32.store offset=8 local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 i32.const 4 i32.store offset=12 local.get $0 diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 2c6eb457ca..cc8f21ce1f 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -422,9 +422,6 @@ i32.const 1 i32.store local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 local.get $2 i32.store offset=4 local.get $3 @@ -433,9 +430,6 @@ i32.const 3 i32.store offset=8 local.get $1 - i32.const 0 - i32.store offset=12 - local.get $1 local.get $0 i32.store offset=12 local.get $1 diff --git a/tests/compiler/resolve-access.ts b/tests/compiler/resolve-access.ts index 9519101fb2..cefbce29c3 100644 --- a/tests/compiler/resolve-access.ts +++ b/tests/compiler/resolve-access.ts @@ -4,7 +4,7 @@ export function arrayAccess(): string { } class Container { - foo: u64; + foo!: u64; toU32(): u32 { return this.foo as u32; diff --git a/tests/compiler/resolve-elementaccess.optimized.wat b/tests/compiler/resolve-elementaccess.optimized.wat index 0c6393c88e..628901a920 100644 --- a/tests/compiler/resolve-elementaccess.optimized.wat +++ b/tests/compiler/resolve-elementaccess.optimized.wat @@ -321,15 +321,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 i32.load drop local.get $0 diff --git a/tests/compiler/resolve-elementaccess.untouched.wat b/tests/compiler/resolve-elementaccess.untouched.wat index bae345c1c3..2814874240 100644 --- a/tests/compiler/resolve-elementaccess.untouched.wat +++ b/tests/compiler/resolve-elementaccess.untouched.wat @@ -413,15 +413,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index 21b3bae899..c811e369f4 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -1769,43 +1769,31 @@ i32.const 12 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $1 + local.tee $0 i32.const 12 call $~lib/memory/memory.fill + local.get $0 + local.tee $1 i32.const 16 i32.const 3 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $2 - i32.const 0 - i32.store - local.get $2 - i32.const 0 - i32.store offset=4 - local.get $2 - i32.const 0 - i32.store offset=8 - local.get $2 - i32.const 0 - i32.store offset=12 - local.get $1 - local.tee $0 - local.get $2 i32.load local.tee $4 i32.ne if - local.get $0 + local.get $1 call $~lib/rt/pure/__retain - local.set $0 + local.set $1 local.get $4 call $~lib/rt/pure/__release end local.get $2 - local.get $0 + local.get $1 i32.store local.get $2 - local.get $1 + local.get $0 i32.store offset=4 local.get $2 i32.const 12 @@ -1818,9 +1806,9 @@ local.get $2 call $~lib/array/Array#push local.get $2 - local.tee $1 - i32.load offset=12 local.tee $0 + i32.load offset=12 + local.tee $1 i32.const 1 i32.lt_s if @@ -1831,62 +1819,50 @@ call $~lib/builtins/abort unreachable end - local.get $1 - i32.load offset=4 local.get $0 + i32.load offset=4 + local.get $1 i32.const 1 i32.sub - local.tee $0 + local.tee $1 i32.const 2 i32.shl i32.add i32.load drop - local.get $1 local.get $0 - i32.store offset=12 local.get $1 + i32.store offset=12 + local.get $0 call $~lib/rt/pure/__release i32.const 0 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $1 + local.tee $0 i32.const 0 call $~lib/memory/memory.fill + local.get $0 + local.tee $1 i32.const 16 i32.const 5 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $2 - i32.const 0 - i32.store - local.get $2 - i32.const 0 - i32.store offset=4 - local.get $2 - i32.const 0 - i32.store offset=8 - local.get $2 - i32.const 0 - i32.store offset=12 - local.get $1 - local.tee $0 - local.get $2 i32.load local.tee $4 i32.ne if - local.get $0 + local.get $1 call $~lib/rt/pure/__retain - local.set $0 + local.set $1 local.get $4 call $~lib/rt/pure/__release end local.get $2 - local.get $0 + local.get $1 i32.store local.get $2 - local.get $1 + local.get $0 i32.store offset=4 local.get $2 i32.const 0 @@ -1903,43 +1879,31 @@ i32.const 0 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $1 + local.tee $0 i32.const 0 call $~lib/memory/memory.fill + local.get $0 + local.tee $1 i32.const 16 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $2 - i32.const 0 - i32.store - local.get $2 - i32.const 0 - i32.store offset=4 - local.get $2 - i32.const 0 - i32.store offset=8 - local.get $2 - i32.const 0 - i32.store offset=12 - local.get $1 - local.tee $0 - local.get $2 i32.load local.tee $5 i32.ne if - local.get $0 + local.get $1 call $~lib/rt/pure/__retain - local.set $0 + local.set $1 local.get $5 call $~lib/rt/pure/__release end local.get $2 - local.get $0 + local.get $1 i32.store local.get $2 - local.get $1 + local.get $0 i32.store offset=4 local.get $2 i32.const 0 @@ -1948,9 +1912,9 @@ i32.const 0 i32.store offset=12 i32.const 0 - local.set $0 + local.set $1 loop $for-loop|1 - local.get $0 + local.get $1 i32.const 10 i32.lt_s if @@ -1960,7 +1924,7 @@ local.tee $5 i32.const 1 i32.add - local.tee $1 + local.tee $0 call $~lib/array/ensureSize local.get $2 i32.load offset=4 @@ -1971,12 +1935,12 @@ i32.const 1344 i32.store local.get $2 - local.get $1 - i32.store offset=12 local.get $0 + i32.store offset=12 + local.get $1 i32.const 1 i32.add - local.set $0 + local.set $1 br $for-loop|1 end end @@ -2011,28 +1975,28 @@ i32.const 7 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain - local.tee $1 + local.tee $0 i32.const 0 i32.store - local.get $1 - local.tee $0 + local.get $0 + local.tee $1 local.get $2 i32.load local.tee $4 i32.ne if - local.get $0 + local.get $1 call $~lib/rt/pure/__retain - local.set $0 + local.set $1 local.get $4 call $~lib/rt/pure/__release end - local.get $0 - i32.store local.get $1 + i32.store + local.get $0 local.tee $3 local.get $2 - local.tee $0 + local.tee $1 i32.load local.tee $4 i32.ne @@ -2043,13 +2007,13 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $0 + local.get $1 local.get $3 i32.store - local.get $0 - local.tee $3 local.get $1 - local.tee $0 + local.tee $3 + local.get $0 + local.tee $1 i32.load local.tee $4 i32.ne @@ -2060,12 +2024,12 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $0 + local.get $1 local.get $3 i32.store local.get $2 local.tee $3 - local.get $0 + local.get $1 i32.load local.tee $4 i32.ne @@ -2076,43 +2040,43 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $0 + local.get $1 local.get $3 i32.store - local.get $0 + local.get $1 local.get $2 local.tee $3 i32.load local.tee $4 i32.ne if - local.get $0 + local.get $1 call $~lib/rt/pure/__retain - local.set $0 + local.set $1 local.get $4 call $~lib/rt/pure/__release end local.get $3 - local.get $0 + local.get $1 i32.store local.get $2 - local.get $1 + local.get $0 i32.load - local.tee $0 + local.tee $1 i32.ne if local.get $3 call $~lib/rt/pure/__retain local.set $3 - local.get $0 + local.get $1 call $~lib/rt/pure/__release end - local.get $1 + local.get $0 local.get $3 i32.store local.get $2 call $~lib/rt/pure/__release - local.get $1 + local.get $0 call $~lib/rt/pure/__release call $~lib/rt/pure/__collect ) diff --git a/tests/compiler/retain-release-sanity.ts b/tests/compiler/retain-release-sanity.ts index b46f26d95b..c5a53c7f90 100644 --- a/tests/compiler/retain-release-sanity.ts +++ b/tests/compiler/retain-release-sanity.ts @@ -21,10 +21,10 @@ } class A { - b: B; + b!: B; } class B { - a: A; + a!: A; } { diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index 32efaec640..a61b5a80e9 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -1730,18 +1730,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3364,18 +3352,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3442,18 +3418,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/retain-release.ts b/tests/compiler/retain-release.ts index bc4177571c..e7447e4019 100644 --- a/tests/compiler/retain-release.ts +++ b/tests/compiler/retain-release.ts @@ -115,7 +115,7 @@ export function assignGlobal(): void { glo = /* __retainRelease( */ REF /* , glo) */; } -class Target { fld: Ref; } +class Target { fld!: Ref; } var TARGET = new Target(); diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 53f5b53b95..d22e2e1232 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -8,9 +8,9 @@ (type $i32_=>_none (func (param i32))) (type $f32_f32_=>_i32 (func (param f32 f32) (result i32))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) - (type $none_=>_i32 (func (result i32))) (type $none_=>_f64 (func (result f64))) (type $none_=>_none (func)) + (type $none_=>_i32 (func (result i32))) (type $i32_i32_i64_=>_i32 (func (param i32 i32 i64) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i64_i32_=>_none (func (param i32 i64 i32))) @@ -1516,26 +1516,14 @@ i32.const 0 local.get $4 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 3 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 - i32.const 0 - i32.store - local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 - i32.const 0 - i32.store offset=8 - local.get $3 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $3 i32.load local.tee $5 i32.ne @@ -5297,90 +5285,7 @@ call $~lib/rt/pure/__release end ) - (func $std/array/createReverseOrderedNestedArray (; 114 ;) (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - i32.const 8 - i32.const 0 - call $~lib/rt/tlsf/__alloc - local.tee $0 - i32.const 0 - i32.const 8 - call $~lib/memory/memory.fill - i32.const 16 - i32.const 12 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $2 - i32.const 0 - i32.store - local.get $2 - i32.const 0 - i32.store offset=4 - local.get $2 - i32.const 0 - i32.store offset=8 - local.get $2 - i32.const 0 - i32.store offset=12 - local.get $0 - local.set $1 - local.get $0 - local.get $2 - i32.load - local.tee $4 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $4 - call $~lib/rt/pure/__release - end - local.get $2 - local.get $1 - i32.store - local.get $2 - local.get $0 - i32.store offset=4 - local.get $2 - i32.const 8 - i32.store offset=8 - local.get $2 - i32.const 2 - i32.store offset=12 - loop $for-loop|0 - local.get $3 - i32.const 2 - i32.lt_s - if - i32.const 1 - call $~lib/array/Array#constructor - local.tee $0 - i32.const 0 - i32.const 1 - local.get $3 - i32.sub - call $~lib/array/Array#__set - local.get $2 - local.get $3 - local.get $0 - call $~lib/array/Array<~lib/array/Array>#__set - local.get $0 - call $~lib/rt/pure/__release - local.get $3 - i32.const 1 - i32.add - local.set $3 - br $for-loop|0 - end - end - local.get $2 - ) - (func $start:std/array~anonymous|47 (; 115 ;) (param $0 i32) (param $1 i32) (result i32) + (func $start:std/array~anonymous|47 (; 114 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.const 0 call $~lib/array/Array#__get @@ -5389,7 +5294,7 @@ call $~lib/array/Array#__get i32.sub ) - (func $~lib/array/Array<~lib/array/Array>#sort (; 116 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array<~lib/array/Array>#sort (; 115 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5443,7 +5348,7 @@ local.get $0 call $~lib/rt/pure/__retain ) - (func $std/array/assertSorted<~lib/array/Array> (; 117 ;) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted<~lib/array/Array> (; 116 ;) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5513,98 +5418,14 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $std/array/createReverseOrderedElementsArray (; 118 ;) (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - i32.const 2048 - i32.const 0 - call $~lib/rt/tlsf/__alloc - local.tee $0 - i32.const 0 - i32.const 2048 - call $~lib/memory/memory.fill - i32.const 16 - i32.const 14 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $2 - i32.const 0 - i32.store - local.get $2 - i32.const 0 - i32.store offset=4 - local.get $2 - i32.const 0 - i32.store offset=8 - local.get $2 - i32.const 0 - i32.store offset=12 - local.get $0 - local.set $1 - local.get $0 - local.get $2 - i32.load - local.tee $4 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $4 - call $~lib/rt/pure/__release - end - local.get $2 - local.get $1 - i32.store - local.get $2 - local.get $0 - i32.store offset=4 - local.get $2 - i32.const 2048 - i32.store offset=8 - local.get $2 - i32.const 512 - i32.store offset=12 - loop $for-loop|0 - local.get $3 - i32.const 512 - i32.lt_s - if - i32.const 4 - i32.const 13 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $0 - i32.const 511 - local.get $3 - i32.sub - i32.store - local.get $2 - local.get $3 - local.get $0 - call $~lib/array/Array<~lib/array/Array>#__set - local.get $0 - call $~lib/rt/pure/__release - local.get $3 - i32.const 1 - i32.add - local.set $3 - br $for-loop|0 - end - end - local.get $2 - ) - (func $start:std/array~anonymous|48 (; 119 ;) (param $0 i32) (param $1 i32) (result i32) + (func $start:std/array~anonymous|48 (; 117 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load local.get $1 i32.load i32.sub ) - (func $~lib/string/String#get:length (; 120 ;) (param $0 i32) (result i32) + (func $~lib/string/String#get:length (; 118 ;) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.sub @@ -5612,7 +5433,7 @@ i32.const 1 i32.shr_u ) - (func $~lib/util/string/compareImpl (; 121 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/compareImpl (; 119 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -5688,7 +5509,7 @@ end i32.const 0 ) - (func $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0 (; 122 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0 (; 120 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) i32.const 1 @@ -5742,7 +5563,7 @@ select call $~lib/util/string/compareImpl ) - (func $std/array/assertSorted<~lib/string/String | null>|trampoline (; 123 ;) (param $0 i32) + (func $std/array/assertSorted<~lib/string/String | null>|trampoline (; 121 ;) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5826,7 +5647,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/string/String.__eq (; 124 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 122 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 local.get $1 @@ -5860,7 +5681,7 @@ call $~lib/util/string/compareImpl i32.eqz ) - (func $~lib/string/String.__concat (; 125 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 123 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5923,7 +5744,7 @@ local.get $1 end ) - (func $std/array/createRandomStringArray (; 126 ;) (result i32) + (func $std/array/createRandomStringArray (; 124 ;) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -5939,25 +5760,13 @@ i32.const 0 i32.const 1600 call $~lib/memory/memory.fill + local.get $0 + local.tee $1 i32.const 16 i32.const 16 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $7 - i32.const 0 - i32.store - local.get $7 - i32.const 0 - i32.store offset=4 - local.get $7 - i32.const 0 - i32.store offset=8 - local.get $7 - i32.const 0 - i32.store offset=12 - local.get $0 - local.tee $1 - local.get $7 i32.load local.tee $6 i32.ne @@ -6069,7 +5878,7 @@ end local.get $7 ) - (func $~lib/string/String#substring (; 127 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#substring (; 125 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6143,7 +5952,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/util/string/joinBooleanArray (; 128 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinBooleanArray (; 126 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6281,7 +6090,7 @@ end local.get $1 ) - (func $~lib/util/number/decimalCount32 (; 129 ;) (param $0 i32) (result i32) + (func $~lib/util/number/decimalCount32 (; 127 ;) (param $0 i32) (result i32) local.get $0 i32.const 10 i32.ge_u @@ -6323,7 +6132,7 @@ i32.lt_u select ) - (func $~lib/util/number/utoa_simple (; 130 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/number/utoa_simple (; 128 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) loop $do-continue|0 local.get $1 @@ -6350,7 +6159,7 @@ br_if $do-continue|0 end ) - (func $~lib/util/number/itoa32 (; 131 ;) (param $0 i32) (result i32) + (func $~lib/util/number/itoa32 (; 129 ;) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6392,7 +6201,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/util/number/itoa_stream (; 132 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 130 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -6440,7 +6249,7 @@ call $~lib/util/number/utoa_simple local.get $0 ) - (func $~lib/util/string/joinIntegerArray (; 133 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 131 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6545,7 +6354,7 @@ end local.get $1 ) - (func $~lib/array/Array#join (; 134 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 132 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 @@ -6553,7 +6362,7 @@ local.get $1 call $~lib/util/string/joinIntegerArray ) - (func $~lib/util/number/utoa32 (; 135 ;) (param $0 i32) (result i32) + (func $~lib/util/number/utoa32 (; 133 ;) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) local.get $0 @@ -6576,7 +6385,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/util/number/itoa_stream (; 136 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 134 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -6603,7 +6412,7 @@ call $~lib/util/number/utoa_simple local.get $0 ) - (func $~lib/util/string/joinIntegerArray (; 137 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 135 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6708,7 +6517,7 @@ end local.get $1 ) - (func $~lib/array/Array#join (; 138 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 136 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 @@ -6716,7 +6525,7 @@ local.get $1 call $~lib/util/string/joinIntegerArray ) - (func $~lib/util/number/genDigits (; 139 ;) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) + (func $~lib/util/number/genDigits (; 137 ;) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) (local $7 i32) (local $8 i64) (local $9 i64) @@ -7107,7 +6916,7 @@ local.get $6 end ) - (func $~lib/util/number/prettify (; 140 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/prettify (; 138 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) local.get $2 i32.eqz @@ -7352,7 +7161,7 @@ end end ) - (func $~lib/util/number/dtoa_core (; 141 ;) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/util/number/dtoa_core (; 139 ;) (param $0 i32) (param $1 f64) (result i32) (local $2 i64) (local $3 i64) (local $4 i32) @@ -7644,7 +7453,7 @@ local.get $7 i32.add ) - (func $~lib/util/number/dtoa_stream (; 142 ;) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) + (func $~lib/util/number/dtoa_stream (; 140 ;) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) local.get $0 local.get $1 i32.const 1 @@ -7719,7 +7528,7 @@ local.get $2 call $~lib/util/number/dtoa_core ) - (func $~lib/util/string/joinFloatArray (; 143 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinFloatArray (; 141 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 f64) (local $4 i32) @@ -7882,7 +7691,7 @@ end local.get $1 ) - (func $~lib/util/string/joinReferenceArray<~lib/string/String | null> (; 144 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/string/String | null> (; 142 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8048,7 +7857,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/array/Array<~lib/string/String | null>#join (; 145 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array<~lib/string/String | null>#join (; 143 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 @@ -8056,7 +7865,7 @@ local.get $1 call $~lib/util/string/joinReferenceArray<~lib/string/String | null> ) - (func $~lib/util/string/joinReferenceArray (; 146 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray (; 144 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8209,14 +8018,14 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/array/Array#join (; 147 ;) (param $0 i32) (result i32) + (func $~lib/array/Array#join (; 145 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load offset=12 call $~lib/util/string/joinReferenceArray ) - (func $~lib/util/number/itoa_stream (; 148 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 146 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -8282,7 +8091,7 @@ call $~lib/util/number/utoa_simple local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 149 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 147 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8383,7 +8192,7 @@ end local.get $1 ) - (func $~lib/util/number/itoa_stream (; 150 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 148 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -8418,7 +8227,7 @@ call $~lib/util/number/utoa_simple local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 151 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 149 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8523,7 +8332,7 @@ end local.get $1 ) - (func $~lib/util/number/decimalCount64High (; 152 ;) (param $0 i64) (result i32) + (func $~lib/util/number/decimalCount64High (; 150 ;) (param $0 i64) (result i32) local.get $0 i64.const 100000000000 i64.ge_u @@ -8569,7 +8378,7 @@ i64.lt_u select ) - (func $~lib/util/number/utoa_simple (; 153 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/util/number/utoa_simple (; 151 ;) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) loop $do-continue|0 local.get $1 @@ -8599,7 +8408,7 @@ br_if $do-continue|0 end ) - (func $~lib/util/number/itoa_stream (; 154 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/util/number/itoa_stream (; 152 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) local.get $0 local.get $1 @@ -8642,7 +8451,7 @@ end local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 155 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 153 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i64) @@ -8785,7 +8594,7 @@ end local.get $1 ) - (func $~lib/util/number/itoa_stream (; 156 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/util/number/itoa_stream (; 154 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) local.get $0 local.get $1 @@ -8851,7 +8660,7 @@ end local.get $0 ) - (func $~lib/util/string/joinIntegerArray (; 157 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 155 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i64) (local $4 i32) @@ -9015,7 +8824,7 @@ end local.get $1 ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 158 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 156 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9183,7 +8992,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/util/number/itoa_stream (; 159 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 157 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -9218,7 +9027,7 @@ call $~lib/util/number/utoa_simple local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 160 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 158 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9319,14 +9128,14 @@ end local.get $1 ) - (func $~lib/array/Array#toString (; 161 ;) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 159 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load offset=12 call $~lib/util/string/joinIntegerArray ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 162 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 160 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9491,7 +9300,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 163 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 161 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9659,14 +9468,14 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/array/Array<~lib/array/Array>#toString (; 164 ;) (param $0 i32) (result i32) + (func $~lib/array/Array<~lib/array/Array>#toString (; 162 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> (; 165 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> (; 163 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9831,7 +9640,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $start:std/array (; 166 ;) + (func $start:std/array (; 164 ;) (local $0 i32) (local $1 i32) (local $2 i32) @@ -9917,26 +9726,17 @@ call $~lib/rt/pure/__retain local.set $58 end - local.get $58 - i32.const 0 - i32.store - local.get $58 - i32.const 0 - i32.store offset=4 - local.get $58 - i32.const 0 - i32.store offset=8 local.get $0 local.tee $1 local.get $58 i32.load - local.tee $55 + local.tee $56 i32.ne if local.get $1 call $~lib/rt/pure/__retain local.set $1 - local.get $55 + local.get $56 call $~lib/rt/pure/__release end local.get $58 @@ -10052,7 +9852,7 @@ i32.const 1632 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $55 + local.tee $56 call $std/array/isArraysEqual i32.eqz if @@ -10076,7 +9876,7 @@ i32.const 1664 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $53 call $std/array/isArraysEqual i32.eqz if @@ -10095,10 +9895,10 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $55 - call $~lib/rt/pure/__release local.get $56 call $~lib/rt/pure/__release + local.get $53 + call $~lib/rt/pure/__release i32.const 5 i32.const 2 i32.const 7 @@ -10193,7 +9993,7 @@ i32.const 1888 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $55 + local.tee $56 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10218,7 +10018,7 @@ i32.const 1936 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $53 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10238,10 +10038,10 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $55 - call $~lib/rt/pure/__release local.get $56 call $~lib/rt/pure/__release + local.get $53 + call $~lib/rt/pure/__release global.get $std/array/arr i32.load offset=12 if @@ -10607,7 +10407,7 @@ i32.const 2032 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $55 + local.tee $56 call $~lib/array/Array#concat call $~lib/rt/pure/__release global.get $std/array/arr @@ -10837,7 +10637,7 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $55 + local.get $56 call $~lib/rt/pure/__release local.get $58 call $~lib/rt/pure/__release @@ -10885,14 +10685,14 @@ i32.const 3 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $55 + local.tee $56 i32.const 5 i32.const 2 i32.const 3 i32.const 2208 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $53 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10924,7 +10724,7 @@ i32.const 2304 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $54 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -11232,13 +11032,13 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $55 - call $~lib/rt/pure/__release local.get $56 call $~lib/rt/pure/__release + local.get $53 + call $~lib/rt/pure/__release local.get $42 call $~lib/rt/pure/__release - local.get $53 + local.get $54 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -11475,10 +11275,10 @@ local.tee $58 i32.const 2 i32.shl - local.tee $55 + local.tee $56 call $~lib/memory/memory.copy local.get $1 - local.get $55 + local.get $56 i32.add i32.const 0 i32.store @@ -11928,7 +11728,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.tee $0 - local.set $55 + local.set $56 i32.const 0 local.set $1 block $__inlined_func$~lib/array/Array#indexOf @@ -11947,7 +11747,7 @@ local.set $1 br $__inlined_func$~lib/array/Array#indexOf end - local.get $55 + local.get $56 i32.load offset=4 local.set $57 loop $while-continue|022 @@ -11992,7 +11792,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.tee $58 - local.set $56 + local.set $53 i32.const 0 local.set $1 block $__inlined_func$~lib/array/Array#indexOf @@ -12011,15 +11811,15 @@ local.set $1 br $__inlined_func$~lib/array/Array#indexOf end - local.get $56 + local.get $53 i32.load offset=4 - local.set $55 + local.set $56 loop $while-continue|023 local.get $1 local.get $57 i32.lt_s if - local.get $55 + local.get $56 local.get $1 i32.const 3 i32.shl @@ -12213,14 +12013,14 @@ drop local.get $0 i32.load offset=4 - local.set $56 + local.set $53 loop $while-continue|024 local.get $58 local.get $57 i32.lt_s if i32.const 1 - local.get $56 + local.get $53 local.get $58 i32.const 2 i32.shl @@ -12268,10 +12068,10 @@ call $~lib/rt/pure/__retain local.tee $57 i32.load offset=12 - local.tee $55 + local.tee $56 if (result i32) i32.const 0 - local.get $55 + local.get $56 i32.ge_s else i32.const 1 @@ -12283,7 +12083,7 @@ local.set $42 loop $while-continue|025 local.get $58 - local.get $55 + local.get $56 i32.lt_s if i32.const 1 @@ -12392,14 +12192,14 @@ i32.const 0 i32.const 2147483647 call $~lib/array/Array#splice - local.tee $56 + local.tee $57 i32.const 5 i32.const 2 i32.const 3 i32.const 3392 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $54 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -13091,10 +12891,10 @@ i32.const 4912 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $57 + local.tee $0 i32.const 1 call $~lib/array/Array#splice - local.tee $55 + local.tee $53 i32.load offset=12 if i32.const 0 @@ -13104,7 +12904,7 @@ call $~lib/builtins/abort unreachable end - local.get $57 + local.get $0 i32.load offset=12 if i32.const 0 @@ -13120,7 +12920,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $0 + local.tee $56 i32.load offset=4 local.tee $1 i32.const 1 @@ -13142,13 +12942,13 @@ i32.const 5 call $std/array/Ref#constructor i32.store offset=16 - local.get $57 - call $~lib/rt/pure/__release local.get $0 + call $~lib/rt/pure/__release + local.get $56 i32.const 2 call $~lib/array/Array#splice local.set $42 - local.get $55 + local.get $53 call $~lib/rt/pure/__release local.get $42 i32.load offset=12 @@ -13192,7 +12992,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $56 i32.load offset=12 i32.const 3 i32.ne @@ -13204,7 +13004,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $56 i32.const 0 call $~lib/array/Array#__get local.tee $6 @@ -13219,7 +13019,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $56 i32.const 1 call $~lib/array/Array#__get local.tee $5 @@ -13234,7 +13034,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $56 i32.const 2 call $~lib/array/Array#__get local.tee $4 @@ -13255,7 +13055,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $55 + local.tee $53 i32.load offset=4 local.tee $1 i32.const 1 @@ -13268,7 +13068,7 @@ i32.const 2 call $std/array/Ref#constructor i32.store offset=8 - local.get $55 + local.get $53 call $~lib/array/Array#splice local.tee $31 i32.load offset=12 @@ -13307,7 +13107,7 @@ call $~lib/builtins/abort unreachable end - local.get $55 + local.get $53 i32.load offset=12 i32.const 2 i32.ne @@ -13319,7 +13119,7 @@ call $~lib/builtins/abort unreachable end - local.get $55 + local.get $53 i32.const 0 call $~lib/array/Array#__get local.tee $3 @@ -13331,11 +13131,11 @@ call $~lib/builtins/abort unreachable end - local.get $55 + local.get $53 i32.const 1 call $~lib/array/Array#__get - local.tee $57 - local.get $57 + local.tee $0 + local.get $0 i32.eqz if i32.const 0 @@ -13358,9 +13158,9 @@ end local.get $58 call $~lib/rt/pure/__release - local.get $56 + local.get $57 call $~lib/rt/pure/__release - local.get $53 + local.get $54 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -13456,7 +13256,7 @@ call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $57 + local.get $0 call $~lib/rt/pure/__release global.get $std/array/arr i32.const 0 @@ -13930,17 +13730,17 @@ unreachable end loop $for-loop|0 - local.get $54 + local.get $55 i32.const 100 i32.lt_s if global.get $std/array/arr call $~lib/array/Array#pop drop - local.get $54 + local.get $55 i32.const 1 i32.add - local.set $54 + local.set $55 br $for-loop|0 end end @@ -13959,9 +13759,9 @@ i32.const 0 local.set $58 global.get $std/array/arr - local.tee $57 + local.tee $0 i32.load offset=12 - local.tee $56 + local.tee $57 i32.const 2 i32.const 9 i32.const 0 @@ -13969,15 +13769,15 @@ call $~lib/rt/pure/__retain local.tee $1 i32.load offset=4 - local.set $54 + local.set $55 loop $for-loop|043 local.get $58 - local.get $56 local.get $57 + local.get $0 i32.load offset=12 - local.tee $53 - local.get $56 - local.get $53 + local.tee $54 + local.get $57 + local.get $54 i32.lt_s select i32.lt_s @@ -13987,15 +13787,15 @@ local.get $58 i32.const 2 i32.shl - local.tee $53 - local.get $57 + local.tee $54 + local.get $0 i32.load offset=4 i32.add i32.load f32.convert_i32_s local.set $41 - local.get $53 local.get $54 + local.get $55 i32.add local.get $41 f32.store @@ -14552,10 +14352,10 @@ i32.const 5280 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $58 + local.set $0 i32.const 0 global.set $~argumentsLength - local.get $58 + local.get $0 call $~lib/array/Array#sort|trampoline call $~lib/rt/pure/__release block $__inlined_func$std/array/isArraysEqual (result i32) @@ -14565,37 +14365,37 @@ i32.const 5328 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $56 + local.set $57 i32.const 0 local.set $1 i32.const 0 - local.get $58 + local.get $0 i32.load offset=12 - local.tee $54 - local.get $56 + local.tee $55 + local.get $57 i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual drop i32.const 1 - local.get $56 - local.get $58 + local.get $0 + local.get $57 i32.eq br_if $__inlined_func$std/array/isArraysEqual drop loop $for-loop|00 local.get $1 - local.get $54 + local.get $55 i32.lt_s if - local.get $58 + local.get $0 local.get $1 call $~lib/array/Array#__get local.tee $41 local.get $41 f32.ne if (result i32) - local.get $56 + local.get $57 local.get $1 call $~lib/array/Array#__get local.tee $41 @@ -14607,10 +14407,10 @@ i32.eqz if i32.const 0 - local.get $58 + local.get $0 local.get $1 call $~lib/array/Array#__get - local.get $56 + local.get $57 local.get $1 call $~lib/array/Array#__get f32.ne @@ -14641,10 +14441,10 @@ i32.const 5376 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $57 + local.set $58 i32.const 0 global.set $~argumentsLength - local.get $57 + local.get $58 call $~lib/array/Array#sort|trampoline call $~lib/rt/pure/__release block $__inlined_func$std/array/isArraysEqual (result i32) @@ -14654,21 +14454,21 @@ i32.const 5456 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $54 + local.set $55 i32.const 0 local.set $1 i32.const 0 - local.get $57 + local.get $58 i32.load offset=12 local.tee $52 - local.get $54 + local.get $55 i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual drop i32.const 1 - local.get $54 - local.get $57 + local.get $55 + local.get $58 i32.eq br_if $__inlined_func$std/array/isArraysEqual drop @@ -14677,14 +14477,14 @@ local.get $52 i32.lt_s if - local.get $57 + local.get $58 local.get $1 call $~lib/array/Array#__get local.tee $36 local.get $36 f64.ne if (result i32) - local.get $54 + local.get $55 local.get $1 call $~lib/array/Array#__get local.tee $36 @@ -14696,10 +14496,10 @@ i32.eqz if i32.const 0 - local.get $57 + local.get $58 local.get $1 call $~lib/array/Array#__get - local.get $54 + local.get $55 local.get $1 call $~lib/array/Array#__get f64.ne @@ -14730,14 +14530,14 @@ i32.const 5536 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $53 + local.set $54 i32.const 0 global.set $~argumentsLength - local.get $53 + local.get $54 i32.const 46 call $~lib/array/Array#sort call $~lib/rt/pure/__release - local.get $53 + local.get $54 i32.const 5 i32.const 2 i32.const 3 @@ -14968,15 +14768,15 @@ local.get $47 i32.const 48 call $std/array/assertSorted - local.get $58 - call $~lib/rt/pure/__release - local.get $56 + local.get $0 call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $54 + local.get $58 call $~lib/rt/pure/__release - local.get $53 + local.get $55 + call $~lib/rt/pure/__release + local.get $54 call $~lib/rt/pure/__release local.get $40 call $~lib/rt/pure/__release @@ -15013,34 +14813,161 @@ local.set $1 i32.const 257 call $std/array/createRandomOrderedArray - local.set $58 + local.set $0 local.get $1 i32.const 49 call $std/array/assertSorted local.get $1 i32.const 50 call $std/array/assertSorted - local.get $58 + local.get $0 i32.const 51 call $std/array/assertSorted - local.get $58 + local.get $0 i32.const 52 call $std/array/assertSorted local.get $1 call $~lib/rt/pure/__release - local.get $58 + local.get $0 call $~lib/rt/pure/__release - call $std/array/createReverseOrderedNestedArray + i32.const 0 + local.set $58 + i32.const 8 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 0 + i32.const 8 + call $~lib/memory/memory.fill + local.get $0 local.tee $1 + i32.const 16 + i32.const 12 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $57 + i32.load + local.tee $55 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $55 + call $~lib/rt/pure/__release + end + local.get $57 + local.get $1 + i32.store + local.get $57 + local.get $0 + i32.store offset=4 + local.get $57 + i32.const 8 + i32.store offset=8 + local.get $57 + i32.const 2 + i32.store offset=12 + loop $for-loop|02 + local.get $58 + i32.const 2 + i32.lt_s + if + i32.const 1 + call $~lib/array/Array#constructor + local.tee $1 + i32.const 0 + i32.const 1 + local.get $58 + i32.sub + call $~lib/array/Array#__set + local.get $57 + local.get $58 + local.get $1 + call $~lib/array/Array<~lib/array/Array>#__set + local.get $1 + call $~lib/rt/pure/__release + local.get $58 + i32.const 1 + i32.add + local.set $58 + br $for-loop|02 + end + end + local.get $57 i32.const 53 call $std/array/assertSorted<~lib/array/Array> - local.get $1 + local.get $57 call $~lib/rt/pure/__release - call $std/array/createReverseOrderedElementsArray + i32.const 0 + local.set $58 + i32.const 2048 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 0 + i32.const 2048 + call $~lib/memory/memory.fill + local.get $0 local.tee $1 + i32.const 16 + i32.const 14 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $57 + i32.load + local.tee $55 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $55 + call $~lib/rt/pure/__release + end + local.get $57 + local.get $1 + i32.store + local.get $57 + local.get $0 + i32.store offset=4 + local.get $57 + i32.const 2048 + i32.store offset=8 + local.get $57 + i32.const 512 + i32.store offset=12 + loop $for-loop|03 + local.get $58 + i32.const 512 + i32.lt_s + if + i32.const 4 + i32.const 13 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $1 + i32.const 511 + local.get $58 + i32.sub + i32.store + local.get $57 + local.get $58 + local.get $1 + call $~lib/array/Array<~lib/array/Array>#__set + local.get $1 + call $~lib/rt/pure/__release + local.get $58 + i32.const 1 + i32.add + local.set $58 + br $for-loop|03 + end + end + local.get $57 i32.const 54 call $std/array/assertSorted<~lib/array/Array> - local.get $1 + local.get $57 call $~lib/rt/pure/__release i32.const 7 i32.const 2 @@ -15048,68 +14975,68 @@ i32.const 6080 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $58 + local.set $0 i32.const 7 i32.const 2 i32.const 15 i32.const 6128 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $57 + local.set $58 i32.const 1 global.set $~argumentsLength - local.get $58 + local.get $0 call $std/array/assertSorted<~lib/string/String | null>|trampoline block $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> (result i32) i32.const 0 local.set $1 i32.const 0 - local.get $58 + local.get $0 i32.load offset=12 - local.tee $53 - local.get $57 + local.tee $54 + local.get $58 i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> drop i32.const 1 - local.get $57 + local.get $0 local.get $58 i32.eq br_if $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> drop - loop $for-loop|02 + loop $for-loop|04 local.get $1 - local.get $53 + local.get $54 i32.lt_s if - local.get $58 + local.get $0 local.get $1 call $~lib/array/Array#__get - local.tee $56 - local.get $57 + local.tee $57 + local.get $58 local.get $1 call $~lib/array/Array#__get - local.tee $54 + local.tee $55 call $~lib/string/String.__eq i32.eqz if - local.get $56 + local.get $57 call $~lib/rt/pure/__release - local.get $54 + local.get $55 call $~lib/rt/pure/__release i32.const 0 br $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> end - local.get $56 + local.get $57 call $~lib/rt/pure/__release - local.get $54 + local.get $55 call $~lib/rt/pure/__release local.get $1 i32.const 1 i32.add local.set $1 - br $for-loop|02 + br $for-loop|04 end end i32.const 1 @@ -15130,9 +15057,9 @@ local.get $1 i32.const 56 call $std/array/assertSorted<~lib/array/Array> - local.get $58 + local.get $0 call $~lib/rt/pure/__release - local.get $57 + local.get $58 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release @@ -15147,8 +15074,8 @@ local.get $1 i32.load offset=12 call $~lib/util/string/joinBooleanArray - local.tee $58 - local.get $58 + local.tee $0 + local.get $0 i32.const 6336 call $~lib/string/String.__eq i32.eqz @@ -15166,7 +15093,7 @@ i32.const 6384 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $54 i32.const 6064 call $~lib/array/Array#join local.tee $52 @@ -15229,14 +15156,14 @@ i32.const 6672 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $58 + local.tee $0 i32.load offset=4 - local.get $58 + local.get $0 i32.load offset=12 call $~lib/util/string/joinFloatArray - local.tee $57 + local.tee $58 local.set $46 - local.get $57 + local.get $58 i32.const 7888 call $~lib/string/String.__eq i32.eqz @@ -15275,20 +15202,20 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $57 + local.tee $58 i32.load offset=4 - local.tee $56 + local.tee $57 i32.const 0 call $std/array/Ref#constructor i32.store - local.get $56 + local.get $57 i32.const 0 i32.store offset=4 - local.get $56 + local.get $57 i32.const 0 call $std/array/Ref#constructor i32.store offset=8 - local.get $57 + local.get $58 call $~lib/array/Array#join local.tee $43 i32.const 8096 @@ -15308,7 +15235,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $57 i32.load offset=4 local.tee $47 i32.const 0 @@ -15318,7 +15245,7 @@ i32.const 0 call $std/array/Ref#constructor i32.store offset=4 - local.get $56 + local.get $57 call $~lib/array/Array#join local.tee $47 i32.const 8176 @@ -15335,7 +15262,7 @@ local.get $1 call $~lib/rt/pure/__release call $~lib/rt/pure/__release - local.get $53 + local.get $54 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -15347,7 +15274,7 @@ call $~lib/rt/pure/__release local.get $48 call $~lib/rt/pure/__release - local.get $58 + local.get $0 call $~lib/rt/pure/__release local.get $46 call $~lib/rt/pure/__release @@ -15355,11 +15282,11 @@ call $~lib/rt/pure/__release local.get $44 call $~lib/rt/pure/__release - local.get $57 + local.get $58 call $~lib/rt/pure/__release local.get $43 call $~lib/rt/pure/__release - local.get $56 + local.get $57 call $~lib/rt/pure/__release local.get $47 call $~lib/rt/pure/__release @@ -15369,21 +15296,21 @@ i32.const 8256 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $56 + local.set $57 i32.const 1 i32.const 2 i32.const 3 i32.const 8272 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $54 + local.set $55 i32.const 2 i32.const 2 i32.const 3 i32.const 8304 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $53 + local.set $54 i32.const 4 i32.const 2 i32.const 3 @@ -15391,7 +15318,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $52 - local.get $56 + local.get $57 i32.const 6304 call $~lib/array/Array#join local.tee $1 @@ -15407,7 +15334,7 @@ call $~lib/builtins/abort unreachable end - local.get $54 + local.get $55 i32.const 6304 call $~lib/array/Array#join local.tee $1 @@ -15424,7 +15351,7 @@ call $~lib/builtins/abort unreachable end - local.get $53 + local.get $54 i32.const 6304 call $~lib/array/Array#join local.tee $1 @@ -15612,7 +15539,7 @@ call $~lib/rt/pure/__retain local.tee $1 i32.load offset=4 - local.tee $58 + local.tee $0 i32.const 2 i32.const 2 i32.const 3 @@ -15620,7 +15547,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $58 + local.get $0 i32.const 2 i32.const 2 i32.const 3 @@ -15633,9 +15560,9 @@ local.get $1 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> - local.tee $58 + local.tee $0 local.set $29 - local.get $58 + local.get $0 i32.const 9136 call $~lib/string/String.__eq i32.eqz @@ -15653,9 +15580,9 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $58 + local.tee $0 i32.load offset=4 - local.tee $57 + local.tee $58 i32.const 2 i32.const 0 i32.const 6 @@ -15663,7 +15590,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $57 + local.get $58 i32.const 2 i32.const 0 i32.const 6 @@ -15671,14 +15598,14 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=4 - local.get $58 + local.get $0 i32.load offset=4 - local.get $58 + local.get $0 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> - local.tee $57 + local.tee $58 local.set $28 - local.get $57 + local.get $58 i32.const 9136 call $~lib/string/String.__eq i32.eqz @@ -15696,7 +15623,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $57 + local.tee $58 i32.load offset=4 i32.const 1 i32.const 2 @@ -15715,9 +15642,9 @@ i32.store local.get $32 i32.store - local.get $57 + local.get $58 i32.load offset=4 - local.get $57 + local.get $58 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> local.tee $33 @@ -15734,11 +15661,11 @@ call $~lib/builtins/abort unreachable end - local.get $56 + local.get $57 call $~lib/rt/pure/__release - local.get $54 + local.get $55 call $~lib/rt/pure/__release - local.get $53 + local.get $54 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -15781,22 +15708,22 @@ call $~lib/rt/pure/__release global.get $std/array/arr call $~lib/rt/pure/__release - local.get $0 + local.get $56 call $~lib/rt/pure/__release local.get $42 call $~lib/rt/pure/__release - local.get $55 + local.get $53 call $~lib/rt/pure/__release local.get $31 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $58 + local.get $0 call $~lib/rt/pure/__release - local.get $57 + local.get $58 call $~lib/rt/pure/__release ) - (func $~start (; 167 ;) + (func $~start (; 165 ;) global.get $~started if return @@ -15806,7 +15733,7 @@ end call $start:std/array ) - (func $~lib/rt/pure/decrement (; 168 ;) (param $0 i32) + (func $~lib/rt/pure/decrement (; 166 ;) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -15935,7 +15862,7 @@ i32.store offset=4 end ) - (func $~lib/rt/pure/__visit (; 169 ;) (param $0 i32) + (func $~lib/rt/pure/__visit (; 167 ;) (param $0 i32) local.get $0 i32.const 9236 i32.lt_u diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 3421557e23..c70d24622a 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -1931,18 +1931,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -2060,15 +2048,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -9514,18 +9493,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -10037,18 +10004,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -11309,18 +11264,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index 461e3be9be..11df6f4287 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -4,10 +4,10 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) @@ -1528,9 +1528,11 @@ local.tee $3 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $1 + local.tee $2 local.get $3 call $~lib/memory/memory.fill + local.get $2 + local.set $1 local.get $0 i32.eqz if @@ -1541,98 +1543,9 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $1 - local.set $2 - local.get $0 i32.load local.tee $4 - local.get $1 - i32.ne - if - local.get $2 - call $~lib/rt/pure/__retain - local.set $2 - local.get $4 - call $~lib/rt/pure/__release - end - local.get $0 local.get $2 - i32.store - local.get $0 - local.get $1 - i32.store offset=4 - local.get $0 - local.get $3 - i32.store offset=8 - local.get $0 - ) - (func $~lib/dataview/DataView#constructor|trampoline (; 19 ;) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - block $2of2 - block $1of2 - block $outOfRange - global.get $~argumentsLength - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - local.set $1 - end - local.get $1 - local.tee $2 - i32.const 1073741808 - i32.gt_u - local.get $1 - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - i32.gt_u - i32.or - if - i32.const 1040 - i32.const 1408 - i32.const 25 - i32.const 7 - call $~lib/builtins/abort - unreachable - end - i32.const 12 - i32.const 15 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $3 - i32.const 0 - i32.store - local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 - i32.const 0 - i32.store offset=8 - local.get $0 - local.set $1 - local.get $0 - local.get $3 - i32.load - local.tee $4 i32.ne if local.get $1 @@ -1641,28 +1554,32 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $3 + local.get $0 local.get $1 i32.store - local.get $3 local.get $0 + local.get $2 i32.store offset=4 + local.get $0 local.get $3 - local.get $2 i32.store offset=8 - local.get $3 + local.get $0 ) - (func $~setArgumentsLength (; 20 ;) (param $0 i32) + (func $~setArgumentsLength (; 19 ;) (param $0 i32) local.get $0 global.set $~argumentsLength ) - (func $start:std/arraybuffer (; 21 ;) + (func $start:std/arraybuffer (; 20 ;) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) i32.const 8 i32.const 0 call $~lib/rt/tlsf/__alloc @@ -1671,7 +1588,7 @@ call $~lib/memory/memory.fill local.get $1 call $~lib/rt/pure/__retain - local.tee $5 + local.tee $9 i32.const 16 i32.sub i32.load offset=12 @@ -1685,7 +1602,7 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const 0 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1704,7 +1621,7 @@ unreachable end local.get $0 - local.get $5 + local.get $9 i32.eq if i32.const 0 @@ -1714,7 +1631,7 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const 1 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1734,7 +1651,7 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const -1 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1754,7 +1671,7 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const 1 i32.const 3 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1774,13 +1691,14 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const 1 i32.const -1 call $~lib/arraybuffer/ArrayBuffer#slice + local.set $1 local.get $0 call $~lib/rt/pure/__release - local.tee $0 + local.get $1 i32.const 16 i32.sub i32.load offset=12 @@ -1794,14 +1712,14 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const -3 i32.const -1 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $1 - local.get $0 - call $~lib/rt/pure/__release + local.set $0 local.get $1 + call $~lib/rt/pure/__release + local.get $0 i32.const 16 i32.sub i32.load offset=12 @@ -1815,14 +1733,14 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const -4 i32.const 42 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $4 - local.get $1 + local.set $1 + local.get $0 call $~lib/rt/pure/__release - local.get $4 + local.get $1 i32.const 16 i32.sub i32.load offset=12 @@ -1836,14 +1754,14 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $9 i32.const 42 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $0 - local.get $4 + local.set $7 + local.get $1 call $~lib/rt/pure/__release - local.get $0 + local.get $7 i32.const 16 i32.sub i32.load offset=12 @@ -1855,7 +1773,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $7 i32.eqz if i32.const 0 @@ -1871,7 +1789,7 @@ call $~lib/rt/pure/__retain i32.const 0 call $~lib/arraybuffer/ArrayBufferView#constructor - local.set $4 + local.set $6 i32.const 16 i32.const 3 call $~lib/rt/tlsf/__alloc @@ -1879,16 +1797,16 @@ i32.const 8 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $3 + local.tee $0 i32.const 1376 i32.const 8 call $~lib/memory/memory.copy local.get $1 - local.get $3 + local.get $0 call $~lib/rt/pure/__retain i32.store local.get $1 - local.get $3 + local.get $0 i32.store offset=4 local.get $1 i32.const 8 @@ -1904,29 +1822,76 @@ call $~lib/rt/pure/__retain i32.const 2 call $~lib/arraybuffer/ArrayBufferView#constructor - local.set $3 + local.set $4 i32.const 1 global.set $~argumentsLength - local.get $4 + local.get $6 i32.load - call $~lib/dataview/DataView#constructor|trampoline - local.set $2 - local.get $5 - call $~lib/rt/pure/__release + local.tee $0 + i32.const 16 + i32.sub + i32.load offset=12 + local.tee $1 + local.tee $3 + i32.const 1073741808 + i32.gt_u + local.get $1 + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.gt_u + i32.or + if + i32.const 1040 + i32.const 1408 + i32.const 25 + i32.const 7 + call $~lib/builtins/abort + unreachable + end local.get $0 + local.tee $1 + i32.const 12 + i32.const 15 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $8 + i32.load + local.tee $2 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $2 + call $~lib/rt/pure/__release + end + local.get $8 + local.get $1 + i32.store + local.get $8 + local.get $0 + i32.store offset=4 + local.get $8 + local.get $3 + i32.store offset=8 + local.get $9 call $~lib/rt/pure/__release - local.get $4 + local.get $7 call $~lib/rt/pure/__release + local.get $6 call $~lib/rt/pure/__release - local.get $3 call $~lib/rt/pure/__release - local.get $2 + local.get $4 + call $~lib/rt/pure/__release + local.get $8 call $~lib/rt/pure/__release ) - (func $~start (; 22 ;) + (func $~start (; 21 ;) call $start:std/arraybuffer ) - (func $~lib/rt/pure/decrement (; 23 ;) (param $0 i32) + (func $~lib/rt/pure/decrement (; 22 ;) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -2027,7 +1992,7 @@ i32.store offset=4 end ) - (func $~lib/rt/pure/__visit (; 24 ;) (param $0 i32) + (func $~lib/rt/pure/__visit (; 23 ;) (param $0 i32) local.get $0 i32.const 1440 i32.lt_u diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 9545b0df7e..2598cbf72e 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -3173,15 +3173,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3358,15 +3349,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $1 local.tee $5 diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index 9969b73849..ff509ac091 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -1,8 +1,8 @@ (module (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) (type $i32_i32_=>_none (func (param i32 i32))) @@ -1112,84 +1112,7 @@ call $~lib/rt/pure/decrement end ) - (func $~lib/arraybuffer/ArrayBufferView#constructor (; 15 ;) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - i32.const 8 - i32.const 0 - call $~lib/rt/tlsf/__alloc - local.tee $2 - i32.const 0 - i32.store8 - local.get $2 - i32.const 4 - i32.add - local.tee $1 - i32.const 0 - i32.store8 offset=3 - local.get $2 - i32.const 0 - i32.store8 offset=1 - local.get $2 - i32.const 0 - i32.store8 offset=2 - local.get $1 - i32.const 0 - i32.store8 offset=2 - local.get $1 - i32.const 0 - i32.store8 offset=1 - local.get $2 - i32.const 0 - i32.store8 offset=3 - local.get $1 - i32.const 0 - i32.store8 - local.get $0 - i32.eqz - if - i32.const 12 - i32.const 2 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.set $0 - end - local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $2 - local.set $1 - local.get $2 - local.get $0 - i32.load - local.tee $3 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $3 - call $~lib/rt/pure/__release - end - local.get $0 - local.get $1 - i32.store - local.get $0 - local.get $2 - i32.store offset=4 - local.get $0 - i32.const 8 - i32.store offset=8 - local.get $0 - ) - (func $~lib/typedarray/Uint8Array#__set (; 16 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/typedarray/Uint8Array#__set (; 15 ;) (param $0 i32) (param $1 i32) (param $2 i32) local.get $1 local.get $0 i32.load offset=8 @@ -1209,7 +1132,7 @@ local.get $2 i32.store8 ) - (func $~lib/dataview/DataView#constructor (; 17 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#constructor (; 16 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1233,23 +1156,14 @@ call $~lib/builtins/abort unreachable end + local.get $0 + local.set $3 + local.get $0 i32.const 12 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $4 - i32.const 0 - i32.store - local.get $4 - i32.const 0 - i32.store offset=4 - local.get $4 - i32.const 0 - i32.store offset=8 - local.get $0 - local.set $3 - local.get $0 - local.get $4 i32.load local.tee $5 i32.ne @@ -1273,14 +1187,14 @@ i32.store offset=8 local.get $4 ) - (func $~lib/arraybuffer/ArrayBufferView#get:byteOffset (; 18 ;) (param $0 i32) (result i32) + (func $~lib/arraybuffer/ArrayBufferView#get:byteOffset (; 17 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load i32.sub ) - (func $~lib/polyfills/bswap (; 19 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 18 ;) (param $0 i32) (result i32) local.get $0 i32.const -16711936 i32.and @@ -1293,7 +1207,7 @@ i32.rotr i32.or ) - (func $~lib/dataview/DataView#getFloat32 (; 20 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $~lib/dataview/DataView#getFloat32 (; 19 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) local.get $1 i32.const 31 i32.shr_u @@ -1329,7 +1243,7 @@ f32.reinterpret_i32 end ) - (func $~lib/polyfills/bswap (; 21 ;) (param $0 i64) (result i64) + (func $~lib/polyfills/bswap (; 20 ;) (param $0 i64) (result i64) local.get $0 i64.const 8 i64.shr_u @@ -1355,7 +1269,7 @@ i64.const 32 i64.rotr ) - (func $~lib/dataview/DataView#getFloat64 (; 22 ;) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/dataview/DataView#getFloat64 (; 21 ;) (param $0 i32) (param $1 i32) (result f64) i32.const 8 local.get $0 i32.load offset=8 @@ -1381,7 +1295,7 @@ f64.reinterpret_i64 end ) - (func $~lib/dataview/DataView#getInt8 (; 23 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/dataview/DataView#getInt8 (; 22 ;) (param $0 i32) (param $1 i32) (result i32) local.get $1 local.get $0 i32.load offset=8 @@ -1400,7 +1314,7 @@ i32.add i32.load8_s ) - (func $~lib/polyfills/bswap (; 24 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 23 ;) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.shl @@ -1413,7 +1327,7 @@ i32.shl i32.or ) - (func $~lib/dataview/DataView#getInt16 (; 25 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getInt16 (; 24 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1447,7 +1361,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getInt32 (; 26 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getInt32 (; 25 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1481,7 +1395,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getInt64 (; 27 ;) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/dataview/DataView#getInt64 (; 26 ;) (param $0 i32) (param $1 i32) (result i64) (local $2 i64) i32.const 8 local.get $0 @@ -1507,7 +1421,7 @@ call $~lib/polyfills/bswap end ) - (func $~lib/dataview/DataView#getUint8 (; 28 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/dataview/DataView#getUint8 (; 27 ;) (param $0 i32) (param $1 i32) (result i32) local.get $1 local.get $0 i32.load offset=8 @@ -1526,7 +1440,7 @@ i32.add i32.load8_u ) - (func $~lib/polyfills/bswap (; 29 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 28 ;) (param $0 i32) (result i32) local.get $0 i32.const 8 i32.shl @@ -1537,7 +1451,7 @@ i32.shr_u i32.or ) - (func $~lib/dataview/DataView#getUint16 (; 30 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getUint16 (; 29 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1571,7 +1485,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getUint32 (; 31 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getUint32 (; 30 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1605,7 +1519,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getUint64 (; 32 ;) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/dataview/DataView#getUint64 (; 31 ;) (param $0 i32) (param $1 i32) (result i64) (local $2 i64) i32.const 8 local.get $0 @@ -1631,7 +1545,7 @@ call $~lib/polyfills/bswap end ) - (func $~lib/dataview/DataView#setFloat32 (; 33 ;) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/dataview/DataView#setFloat32 (; 32 ;) (param $0 i32) (param $1 f32) (param $2 i32) i32.const 4 local.get $0 i32.load offset=8 @@ -1659,7 +1573,7 @@ i32.store end ) - (func $~lib/dataview/DataView#setFloat64 (; 34 ;) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/dataview/DataView#setFloat64 (; 33 ;) (param $0 i32) (param $1 f64) (param $2 i32) i32.const 8 local.get $0 i32.load offset=8 @@ -1687,7 +1601,7 @@ i64.store end ) - (func $~lib/dataview/DataView#setInt16 (; 35 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setInt16 (; 34 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 2 local.get $0 i32.load offset=8 @@ -1711,7 +1625,7 @@ end i32.store16 ) - (func $~lib/dataview/DataView#setInt32 (; 36 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setInt32 (; 35 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 4 local.get $0 i32.load offset=8 @@ -1735,7 +1649,7 @@ end i32.store ) - (func $~lib/dataview/DataView#setInt64 (; 37 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/dataview/DataView#setInt64 (; 36 ;) (param $0 i32) (param $1 i64) (param $2 i32) i32.const 8 local.get $0 i32.load offset=8 @@ -1759,7 +1673,7 @@ end i64.store ) - (func $~lib/dataview/DataView#setUint16 (; 38 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setUint16 (; 37 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 2 local.get $0 i32.load offset=8 @@ -1783,7 +1697,7 @@ end i32.store16 ) - (func $~lib/dataview/DataView#setUint32 (; 39 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setUint32 (; 38 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 4 local.get $0 i32.load offset=8 @@ -1807,7 +1721,7 @@ end i32.store ) - (func $~lib/dataview/DataView#setUint64 (; 40 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/dataview/DataView#setUint64 (; 39 ;) (param $0 i32) (param $1 i64) (param $2 i32) i32.const 8 local.get $0 i32.load offset=8 @@ -1831,59 +1745,121 @@ end i64.store ) - (func $~setArgumentsLength (; 41 ;) (param $0 i32) + (func $~setArgumentsLength (; 40 ;) (param $0 i32) local.get $0 global.set $~argumentsLength ) - (func $start:std/dataview (; 42 ;) + (func $start:std/dataview (; 41 ;) (local $0 i32) (local $1 i32) (local $2 i32) + (local $3 i32) i32.const 12 i32.const 3 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain - call $~lib/arraybuffer/ArrayBufferView#constructor + local.set $3 + i32.const 8 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 0 + i32.store8 + local.get $0 + i32.const 4 + i32.add + local.tee $1 + i32.const 0 + i32.store8 offset=3 + local.get $0 + i32.const 0 + i32.store8 offset=1 + local.get $0 + i32.const 0 + i32.store8 offset=2 + local.get $1 + i32.const 0 + i32.store8 offset=2 + local.get $1 + i32.const 0 + i32.store8 offset=1 + local.get $0 + i32.const 0 + i32.store8 offset=3 + local.get $1 + i32.const 0 + i32.store8 + local.get $3 + i32.eqz + if + i32.const 12 + i32.const 2 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.set $3 + end + local.get $0 local.tee $1 + local.get $3 + i32.load + local.tee $2 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $2 + call $~lib/rt/pure/__release + end + local.get $3 + local.get $1 + i32.store + local.get $3 + local.get $0 + i32.store offset=4 + local.get $3 + i32.const 8 + i32.store offset=8 + local.get $3 i32.const 0 i32.const 246 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 1 i32.const 224 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 2 i32.const 88 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 3 i32.const 159 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 4 i32.const 130 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 5 i32.const 101 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 6 i32.const 67 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.const 7 i32.const 95 call $~lib/typedarray/Uint8Array#__set - local.get $1 + local.get $3 i32.load - local.get $1 + local.get $3 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset - local.get $1 + local.get $3 i32.load offset=8 call $~lib/dataview/DataView#constructor - local.tee $0 + local.tee $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1897,7 +1873,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1911,7 +1887,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1925,7 +1901,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1939,7 +1915,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1953,7 +1929,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1967,7 +1943,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1981,7 +1957,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1995,7 +1971,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -2009,7 +1985,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -2023,7 +1999,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getFloat64 f64.const 7936550095674706383278551e126 @@ -2036,7 +2012,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getFloat64 f64.const -411777475818852546741639e241 @@ -2049,7 +2025,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getInt8 i32.const -10 @@ -2062,7 +2038,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getInt8 i32.const -32 @@ -2075,7 +2051,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 call $~lib/dataview/DataView#getInt8 i32.const 88 @@ -2088,7 +2064,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 call $~lib/dataview/DataView#getInt8 i32.const -97 @@ -2101,7 +2077,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 call $~lib/dataview/DataView#getInt8 i32.const -126 @@ -2114,7 +2090,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 5 call $~lib/dataview/DataView#getInt8 i32.const 101 @@ -2127,7 +2103,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 6 call $~lib/dataview/DataView#getInt8 i32.const 67 @@ -2140,7 +2116,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 7 call $~lib/dataview/DataView#getInt8 i32.const 95 @@ -2153,7 +2129,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2169,7 +2145,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2185,7 +2161,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2201,7 +2177,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2217,7 +2193,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2233,7 +2209,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 5 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2249,7 +2225,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 6 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2265,7 +2241,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2281,7 +2257,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2297,7 +2273,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2313,7 +2289,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2329,7 +2305,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2345,7 +2321,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 5 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2361,7 +2337,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 6 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2377,7 +2353,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2391,7 +2367,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2405,7 +2381,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2419,7 +2395,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2433,7 +2409,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2447,7 +2423,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2461,7 +2437,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2475,7 +2451,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2489,7 +2465,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2503,7 +2479,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2517,7 +2493,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getInt64 i64.const 6864441868736323830 @@ -2530,7 +2506,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getInt64 i64.const -657428103485373601 @@ -2543,7 +2519,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getUint8 i32.const 246 @@ -2556,7 +2532,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getUint8 i32.const 224 @@ -2569,7 +2545,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 call $~lib/dataview/DataView#getUint8 i32.const 88 @@ -2582,7 +2558,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 call $~lib/dataview/DataView#getUint8 i32.const 159 @@ -2595,7 +2571,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 call $~lib/dataview/DataView#getUint8 i32.const 130 @@ -2608,7 +2584,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 5 call $~lib/dataview/DataView#getUint8 i32.const 101 @@ -2621,7 +2597,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 6 call $~lib/dataview/DataView#getUint8 i32.const 67 @@ -2634,7 +2610,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 7 call $~lib/dataview/DataView#getUint8 i32.const 95 @@ -2647,7 +2623,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2663,7 +2639,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2679,7 +2655,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2695,7 +2671,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2711,7 +2687,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2727,7 +2703,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 5 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2743,7 +2719,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 6 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2759,7 +2735,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2775,7 +2751,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2791,7 +2767,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2807,7 +2783,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2823,7 +2799,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2839,7 +2815,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 5 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2855,7 +2831,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 6 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2871,7 +2847,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2885,7 +2861,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2899,7 +2875,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2913,7 +2889,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2927,7 +2903,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2941,7 +2917,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2955,7 +2931,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2969,7 +2945,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2983,7 +2959,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2997,7 +2973,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -3011,7 +2987,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getUint64 i64.const 6864441868736323830 @@ -3024,7 +3000,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getUint64 i64.const -657428103485373601 @@ -3037,11 +3013,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 f32.const 1.5976661625240943e-18 i32.const 1 call $~lib/dataview/DataView#setFloat32 - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -3055,11 +3031,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 f32.const 1976281973381696323584 i32.const 0 call $~lib/dataview/DataView#setFloat32 - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -3073,11 +3049,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 f64.const -1094252199637739024055454e124 i32.const 1 call $~lib/dataview/DataView#setFloat64 - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getFloat64 f64.const -1094252199637739024055454e124 @@ -3090,11 +3066,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 f64.const 6.022586634778589e-103 i32.const 0 call $~lib/dataview/DataView#setFloat64 - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getFloat64 f64.const 6.022586634778589e-103 @@ -3108,7 +3084,7 @@ unreachable end i32.const 0 - local.get $0 + local.get $1 i32.load offset=8 i32.ge_u if @@ -3119,11 +3095,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.load offset=4 i32.const 108 i32.store8 - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getInt8 i32.const 108 @@ -3136,11 +3112,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const -13360 i32.const 1 call $~lib/dataview/DataView#setInt16 - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -3156,11 +3132,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 14689 i32.const 0 call $~lib/dataview/DataView#setInt16 - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -3176,11 +3152,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 1204680201 i32.const 1 call $~lib/dataview/DataView#setInt32 - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -3194,11 +3170,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 660673230 i32.const 0 call $~lib/dataview/DataView#setInt32 - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -3212,11 +3188,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i64.const -3290739641816099749 i32.const 1 call $~lib/dataview/DataView#setInt64 - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getInt64 i64.const -3290739641816099749 @@ -3229,11 +3205,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i64.const 8178932412950708047 i32.const 0 call $~lib/dataview/DataView#setInt64 - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getInt64 i64.const 8178932412950708047 @@ -3247,7 +3223,7 @@ unreachable end i32.const 0 - local.get $0 + local.get $1 i32.load offset=8 i32.ge_u if @@ -3258,11 +3234,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.load offset=4 i32.const 238 i32.store8 - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getUint8 i32.const 238 @@ -3275,11 +3251,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 58856 i32.const 1 call $~lib/dataview/DataView#setUint16 - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -3295,11 +3271,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const 60400 i32.const 0 call $~lib/dataview/DataView#setUint16 - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -3315,11 +3291,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const -846805744 i32.const 1 call $~lib/dataview/DataView#setUint32 - local.get $0 + local.get $1 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -3333,11 +3309,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i32.const -1510791631 i32.const 0 call $~lib/dataview/DataView#setUint32 - local.get $0 + local.get $1 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -3351,11 +3327,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i64.const 2334704782995986958 i32.const 1 call $~lib/dataview/DataView#setUint64 - local.get $0 + local.get $1 i32.const 1 call $~lib/dataview/DataView#getUint64 i64.const 2334704782995986958 @@ -3368,11 +3344,11 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 i64.const -7123186897289856329 i32.const 0 call $~lib/dataview/DataView#setUint64 - local.get $0 + local.get $1 i32.const 0 call $~lib/dataview/DataView#getUint64 i64.const -7123186897289856329 @@ -3387,19 +3363,21 @@ end i32.const 1 global.set $~argumentsLength - local.get $1 + local.get $3 i32.load - local.tee $2 - i32.const 0 - local.get $2 + local.tee $0 i32.const 16 i32.sub i32.load offset=12 - call $~lib/dataview/DataView#constructor local.set $2 local.get $0 - call $~lib/rt/pure/__release + i32.const 0 local.get $2 + call $~lib/dataview/DataView#constructor + local.set $0 + local.get $1 + call $~lib/rt/pure/__release + local.get $0 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset if i32.const 0 @@ -3409,7 +3387,7 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $0 i32.load offset=8 i32.const 8 i32.ne @@ -3421,15 +3399,15 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $3 call $~lib/rt/pure/__release - local.get $2 + local.get $0 call $~lib/rt/pure/__release ) - (func $~start (; 43 ;) + (func $~start (; 42 ;) call $start:std/dataview ) - (func $~lib/rt/pure/decrement (; 44 ;) (param $0 i32) + (func $~lib/rt/pure/decrement (; 43 ;) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index d1d8c93dd1..68f32c0301 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -1730,15 +1730,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -1843,15 +1834,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $1 local.tee $5 diff --git a/tests/compiler/std/date.optimized.wat b/tests/compiler/std/date.optimized.wat index 2ea348a961..21e021db7e 100644 --- a/tests/compiler/std/date.optimized.wat +++ b/tests/compiler/std/date.optimized.wat @@ -144,9 +144,6 @@ i32.const 8 i32.store i32.const 1088 - i64.const 0 - i64.store - i32.const 1088 local.get $2 i64.store i32.const 1088 diff --git a/tests/compiler/std/date.untouched.wat b/tests/compiler/std/date.untouched.wat index e3f946a94f..853d438755 100644 --- a/tests/compiler/std/date.untouched.wat +++ b/tests/compiler/std/date.untouched.wat @@ -143,9 +143,6 @@ local.set $0 end local.get $0 - i64.const 0 - i64.store - local.get $0 local.get $1 i64.store local.get $0 diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index c445e26c40..57ee770873 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -2101,11 +2101,11 @@ (local $8 i32) local.get $0 i32.load offset=8 - local.set $5 + local.set $6 local.get $0 i32.load offset=16 - local.tee $4 - local.tee $8 + local.tee $5 + local.tee $0 i32.const 1073741808 i32.gt_u if @@ -2116,89 +2116,79 @@ call $~lib/builtins/abort unreachable end - local.get $8 + local.get $0 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $2 - local.get $8 + local.tee $3 + local.get $0 call $~lib/memory/memory.fill + local.get $0 + local.set $1 + local.get $3 + local.set $2 + local.get $3 i32.const 16 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load - local.tee $3 + local.tee $4 i32.ne if - local.get $1 + local.get $2 call $~lib/rt/pure/__retain - local.set $1 - local.get $3 + local.set $2 + local.get $4 call $~lib/rt/pure/__release end local.get $0 - local.get $1 + local.get $2 i32.store local.get $0 - local.get $2 + local.get $3 i32.store offset=4 local.get $0 - local.get $8 + local.get $1 i32.store offset=8 local.get $0 - local.get $8 + local.get $1 i32.store offset=12 loop $for-loop|0 - local.get $6 - local.get $4 + local.get $7 + local.get $5 i32.lt_s if - local.get $5 local.get $6 + local.get $7 i32.const 12 i32.mul i32.add - local.tee $2 + local.tee $3 i32.load offset=8 i32.const 1 i32.and i32.eqz if local.get $0 - local.get $7 - local.get $2 + local.get $8 + local.get $3 i32.load8_s call $~lib/array/Array#__set - local.get $7 + local.get $8 i32.const 1 i32.add - local.set $7 + local.set $8 end - local.get $6 + local.get $7 i32.const 1 i32.add - local.set $6 + local.set $7 br $for-loop|0 end end local.get $0 - local.get $7 + local.get $8 call $~lib/array/Array#set:length local.get $0 ) @@ -2228,26 +2218,14 @@ local.tee $1 local.get $4 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 5 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 - i32.const 0 - i32.store - local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 - i32.const 0 - i32.store offset=8 - local.get $3 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $3 i32.load local.tee $5 i32.ne @@ -3877,11 +3855,11 @@ (local $8 i32) local.get $0 i32.load offset=8 - local.set $5 + local.set $6 local.get $0 i32.load offset=16 - local.tee $4 - local.tee $8 + local.tee $5 + local.tee $0 i32.const 1073741808 i32.gt_u if @@ -3892,89 +3870,79 @@ call $~lib/builtins/abort unreachable end - local.get $8 + local.get $0 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $2 - local.get $8 + local.tee $3 + local.get $0 call $~lib/memory/memory.fill + local.get $0 + local.set $1 + local.get $3 + local.set $2 + local.get $3 i32.const 16 i32.const 9 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load - local.tee $3 + local.tee $4 i32.ne if - local.get $1 + local.get $2 call $~lib/rt/pure/__retain - local.set $1 - local.get $3 + local.set $2 + local.get $4 call $~lib/rt/pure/__release end local.get $0 - local.get $1 + local.get $2 i32.store local.get $0 - local.get $2 + local.get $3 i32.store offset=4 local.get $0 - local.get $8 + local.get $1 i32.store offset=8 local.get $0 - local.get $8 + local.get $1 i32.store offset=12 loop $for-loop|0 - local.get $6 - local.get $4 + local.get $7 + local.get $5 i32.lt_s if - local.get $5 local.get $6 + local.get $7 i32.const 12 i32.mul i32.add - local.tee $2 + local.tee $3 i32.load offset=8 i32.const 1 i32.and i32.eqz if local.get $0 - local.get $7 - local.get $2 + local.get $8 + local.get $3 i32.load8_u call $~lib/array/Array#__set - local.get $7 + local.get $8 i32.const 1 i32.add - local.set $7 + local.set $8 end - local.get $6 + local.get $7 i32.const 1 i32.add - local.set $6 + local.set $7 br $for-loop|0 end end local.get $0 - local.get $7 + local.get $8 call $~lib/array/Array#set:length local.get $0 ) @@ -5216,26 +5184,14 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 12 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $3 i32.ne @@ -6448,26 +6404,14 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 15 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $3 i32.ne @@ -7944,26 +7888,14 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 18 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $3 i32.ne @@ -8969,26 +8901,14 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 21 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $3 i32.ne @@ -9986,26 +9906,14 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 24 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $3 i32.ne @@ -10875,26 +10783,14 @@ local.tee $2 local.get $6 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 27 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $4 i32.ne @@ -12101,26 +11997,14 @@ local.tee $2 local.get $6 call $~lib/memory/memory.fill + local.get $2 + local.set $1 + local.get $2 i32.const 16 i32.const 30 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $2 - local.set $1 - local.get $2 - local.get $0 i32.load local.tee $4 i32.ne diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index c166b63fde..b967777f40 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -2213,18 +2213,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3909,18 +3897,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -6014,18 +5990,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -7729,18 +7693,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -9442,18 +9394,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -11830,18 +11770,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -13567,18 +13495,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -15227,18 +15143,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -16891,18 +16795,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -18558,18 +18450,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 2d8da9dc2e..0a99303010 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -2084,7 +2084,7 @@ local.get $0 i32.load offset=16 local.tee $7 - local.tee $4 + local.tee $0 i32.const 1073741808 i32.gt_u if @@ -2095,32 +2095,22 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $0 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $1 - local.get $4 + local.get $0 call $~lib/memory/memory.fill + local.get $0 + local.set $3 + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $8 i32.ne @@ -2138,10 +2128,10 @@ local.get $1 i32.store offset=4 local.get $0 - local.get $4 + local.get $3 i32.store offset=8 local.get $0 - local.get $4 + local.get $3 i32.store offset=12 loop $for-loop|0 local.get $5 @@ -2159,11 +2149,11 @@ i32.and i32.eqz if - local.get $3 + local.get $4 local.tee $1 i32.const 1 i32.add - local.set $3 + local.set $4 local.get $0 local.get $1 local.get $2 @@ -2848,7 +2838,7 @@ local.get $0 i32.load offset=16 local.tee $7 - local.tee $4 + local.tee $0 i32.const 1073741808 i32.gt_u if @@ -2859,32 +2849,22 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $0 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $1 - local.get $4 + local.get $0 call $~lib/memory/memory.fill + local.get $0 + local.set $3 + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 6 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $8 i32.ne @@ -2902,10 +2882,10 @@ local.get $1 i32.store offset=4 local.get $0 - local.get $4 + local.get $3 i32.store offset=8 local.get $0 - local.get $4 + local.get $3 i32.store offset=12 loop $for-loop|0 local.get $5 @@ -2923,11 +2903,11 @@ i32.and i32.eqz if - local.get $3 + local.get $4 local.tee $1 i32.const 1 i32.add - local.set $3 + local.set $4 local.get $0 local.get $1 local.get $2 @@ -3724,26 +3704,14 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 8 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $9 i32.ne @@ -4495,26 +4463,14 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 10 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $9 i32.ne @@ -5362,26 +5318,14 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 12 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $9 i32.ne @@ -5886,26 +5830,14 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 14 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $9 i32.ne @@ -6731,26 +6663,14 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 16 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $9 i32.ne @@ -7257,26 +7177,14 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill + local.get $1 + local.set $2 + local.get $1 i32.const 16 i32.const 18 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $1 - local.set $2 - local.get $1 - local.get $0 i32.load local.tee $9 i32.ne @@ -7970,26 +7878,14 @@ local.tee $0 local.get $7 call $~lib/memory/memory.fill + local.get $0 + local.set $1 + local.get $0 i32.const 16 i32.const 20 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 - i32.const 0 - i32.store - local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 - i32.const 0 - i32.store offset=8 - local.get $3 - i32.const 0 - i32.store offset=12 - local.get $0 - local.set $1 - local.get $0 - local.get $3 i32.load local.tee $9 i32.ne @@ -8798,26 +8694,14 @@ local.tee $0 local.get $7 call $~lib/memory/memory.fill + local.get $0 + local.set $1 + local.get $0 i32.const 16 i32.const 22 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 - i32.const 0 - i32.store - local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 - i32.const 0 - i32.store offset=8 - local.get $3 - i32.const 0 - i32.store offset=12 - local.get $0 - local.set $1 - local.get $0 - local.get $3 i32.load local.tee $9 i32.ne diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index cd4f6ccebd..35e8a033d2 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -2161,18 +2161,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -4697,18 +4685,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -5755,18 +5731,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -6795,18 +6759,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -7861,18 +7813,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -8871,18 +8811,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -9971,18 +9899,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -10985,18 +10901,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -12002,18 +11906,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -13020,18 +12912,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - i32.const 0 - i32.store offset=12 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index d29c1b9471..951351a19c 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1479,12 +1479,12 @@ local.get $1 local.get $2 i32.shl - local.tee $3 + local.tee $4 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $2 i32.const 0 - local.get $3 + local.get $4 call $~lib/memory/memory.fill local.get $0 i32.eqz @@ -1495,38 +1495,30 @@ call $~lib/rt/pure/__retain local.set $0 end - local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 local.get $2 local.tee $1 local.get $0 i32.load - local.tee $4 + local.tee $3 i32.ne if local.get $1 call $~lib/rt/pure/__retain local.set $1 - local.get $4 + local.get $3 call $~lib/rt/pure/__release end local.get $0 + local.tee $3 local.get $1 i32.store - local.get $0 + local.get $3 local.get $2 i32.store offset=4 - local.get $0 local.get $3 + local.get $4 i32.store offset=8 - local.get $0 + local.get $3 ) (func $~lib/typedarray/Int8Array#constructor (; 20 ;) (param $0 i32) (result i32) i32.const 12 diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 199db6a10c..b4fc46cdf8 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -1913,15 +1913,6 @@ local.set $0 end local.get $0 - i32.const 0 - i32.store - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tsconfig-base.json b/tsconfig-base.json index 415a5fb820..49a6f9a839 100644 --- a/tsconfig-base.json +++ b/tsconfig-base.json @@ -6,6 +6,7 @@ "noImplicitThis": true, "noEmitOnError": true, "strictNullChecks": true, + "strictPropertyInitialization": true, "experimentalDecorators": true } } From 8c6a55440226d0d2364f12d7142a33c9c3965dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Tue, 31 Mar 2020 09:17:34 -0400 Subject: [PATCH 11/14] Don't skip property initialization Don not skip property initialization even if expected to be initialized at the constructor level --- src/compiler.ts | 29 +- tests/compiler/class.optimized.wat | 12 + tests/compiler/class.untouched.wat | 12 + tests/compiler/inlining.optimized.wat | 6 + tests/compiler/inlining.untouched.wat | 6 + .../resolve-elementaccess.optimized.wat | 9 + .../resolve-elementaccess.untouched.wat | 9 + .../retain-release-sanity.optimized.wat | 152 ++-- .../retain-release-sanity.untouched.wat | 36 + tests/compiler/std/array.optimized.wat | 791 ++++++++++-------- tests/compiler/std/array.untouched.wat | 57 ++ tests/compiler/std/arraybuffer.optimized.wat | 233 +++--- tests/compiler/std/arraybuffer.untouched.wat | 18 + tests/compiler/std/dataview.optimized.wat | 492 +++++------ tests/compiler/std/dataview.untouched.wat | 18 + tests/compiler/std/date.optimized.wat | 3 + tests/compiler/std/date.untouched.wat | 3 + tests/compiler/std/map.optimized.wat | 284 +++++-- tests/compiler/std/map.untouched.wat | 120 +++ tests/compiler/std/set.optimized.wat | 212 +++-- tests/compiler/std/set.untouched.wat | 120 +++ tests/compiler/std/typedarray.optimized.wat | 24 +- tests/compiler/std/typedarray.untouched.wat | 9 + 23 files changed, 1753 insertions(+), 902 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index c644816d6d..0a7b79205c 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -10181,8 +10181,9 @@ export class Compiler extends DiagnosticEmitter { let parameterIndex = fieldPrototype.parameterIndex; let typeNode = field.typeNode; if (typeNode) this.checkTypeSupported(fieldType, typeNode); - let initExpr: ExpressionRef = -1; + let initExpr: ExpressionRef = 0; const isDefiniteAssigment = field.is(CommonFlags.DEFINITE_ASSIGNMENT); + let definitelyInitialized = false; // if declared as a constructor parameter, use its value if (parameterIndex >= 0) { @@ -10193,6 +10194,7 @@ export class Compiler extends DiagnosticEmitter { nativeFieldType ); if (fieldType.isManaged) initExpr = this.makeRetain(initExpr); + definitelyInitialized = true; // fall back to use initializer if present } else if (initializerNode) { @@ -10202,20 +10204,25 @@ export class Compiler extends DiagnosticEmitter { if (fieldType.isManaged && !this.skippedAutoreleases.has(initExpr)) { initExpr = this.makeRetain(initExpr); } - } else if (isDefiniteAssigment) { + definitelyInitialized = true; + } else { // otherwise initialize with default if marked as definite assigment + if (isDefiniteAssigment) { + definitelyInitialized = true; + } initExpr = this.makeZero(fieldType); } - if (initExpr >= 0) { - stmts.push( - module.store(fieldType.byteSize, - module.local_get(thisLocalIndex, nativeSizeType), - initExpr, - nativeFieldType, - field.memoryOffset - ) - ); + stmts.push( + module.store(fieldType.byteSize, + module.local_get(thisLocalIndex, nativeSizeType), + initExpr, + nativeFieldType, + field.memoryOffset + ) + ); + + if (definitelyInitialized) { flow.setFieldFlag(field.internalName, FieldFlags.INITIALIZED); } else { flow.setFieldFlag(field.internalName, FieldFlags.NONE); diff --git a/tests/compiler/class.optimized.wat b/tests/compiler/class.optimized.wat index 53aadc53e1..55e85d2f02 100644 --- a/tests/compiler/class.optimized.wat +++ b/tests/compiler/class.optimized.wat @@ -131,6 +131,18 @@ i32.const 5 call $~lib/rt/stub/__alloc local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 i32.load drop local.get $0 diff --git a/tests/compiler/class.untouched.wat b/tests/compiler/class.untouched.wat index 71d841d47a..2fc08fc407 100644 --- a/tests/compiler/class.untouched.wat +++ b/tests/compiler/class.untouched.wat @@ -479,6 +479,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index b61845e5e7..5a8ce29c21 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -122,12 +122,18 @@ i32.const 1 i32.store local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 i32.const 2 i32.store offset=4 local.get $0 i32.const 3 i32.store offset=8 local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 i32.const 4 i32.store offset=12 local.get $0 diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index cc8f21ce1f..2c6eb457ca 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -422,6 +422,9 @@ i32.const 1 i32.store local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 local.get $2 i32.store offset=4 local.get $3 @@ -430,6 +433,9 @@ i32.const 3 i32.store offset=8 local.get $1 + i32.const 0 + i32.store offset=12 + local.get $1 local.get $0 i32.store offset=12 local.get $1 diff --git a/tests/compiler/resolve-elementaccess.optimized.wat b/tests/compiler/resolve-elementaccess.optimized.wat index 628901a920..0c6393c88e 100644 --- a/tests/compiler/resolve-elementaccess.optimized.wat +++ b/tests/compiler/resolve-elementaccess.optimized.wat @@ -321,6 +321,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 i32.load drop local.get $0 diff --git a/tests/compiler/resolve-elementaccess.untouched.wat b/tests/compiler/resolve-elementaccess.untouched.wat index 2814874240..bae345c1c3 100644 --- a/tests/compiler/resolve-elementaccess.untouched.wat +++ b/tests/compiler/resolve-elementaccess.untouched.wat @@ -413,6 +413,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index 74e25f2bf3..258951c272 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -1769,31 +1769,43 @@ i32.const 12 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $0 + local.tee $1 i32.const 12 call $~lib/memory/memory.fill - local.get $0 - local.tee $1 i32.const 16 i32.const 3 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $2 + i32.const 0 + i32.store + local.get $2 + i32.const 0 + i32.store offset=4 + local.get $2 + i32.const 0 + i32.store offset=8 + local.get $2 + i32.const 0 + i32.store offset=12 + local.get $1 + local.tee $0 + local.get $2 i32.load local.tee $4 i32.ne if - local.get $1 + local.get $0 call $~lib/rt/pure/__retain - local.set $1 + local.set $0 local.get $4 call $~lib/rt/pure/__release end local.get $2 - local.get $1 + local.get $0 i32.store local.get $2 - local.get $0 + local.get $1 i32.store offset=4 local.get $2 i32.const 12 @@ -1806,9 +1818,9 @@ local.get $2 call $~lib/array/Array#push local.get $2 - local.tee $0 - i32.load offset=12 local.tee $1 + i32.load offset=12 + local.tee $0 i32.const 1 i32.lt_s if @@ -1819,50 +1831,62 @@ call $~lib/builtins/abort unreachable end - local.get $0 - i32.load offset=4 local.get $1 + i32.load offset=4 + local.get $0 i32.const 1 i32.sub - local.tee $1 + local.tee $0 i32.const 2 i32.shl i32.add i32.load drop - local.get $0 local.get $1 - i32.store offset=12 local.get $0 + i32.store offset=12 + local.get $1 call $~lib/rt/pure/__release i32.const 0 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $0 + local.tee $1 i32.const 0 call $~lib/memory/memory.fill - local.get $0 - local.tee $1 i32.const 16 i32.const 5 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $2 + i32.const 0 + i32.store + local.get $2 + i32.const 0 + i32.store offset=4 + local.get $2 + i32.const 0 + i32.store offset=8 + local.get $2 + i32.const 0 + i32.store offset=12 + local.get $1 + local.tee $0 + local.get $2 i32.load local.tee $4 i32.ne if - local.get $1 + local.get $0 call $~lib/rt/pure/__retain - local.set $1 + local.set $0 local.get $4 call $~lib/rt/pure/__release end local.get $2 - local.get $1 + local.get $0 i32.store local.get $2 - local.get $0 + local.get $1 i32.store offset=4 local.get $2 i32.const 0 @@ -1879,31 +1903,43 @@ i32.const 0 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $0 + local.tee $1 i32.const 0 call $~lib/memory/memory.fill - local.get $0 - local.tee $1 i32.const 16 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $2 + i32.const 0 + i32.store + local.get $2 + i32.const 0 + i32.store offset=4 + local.get $2 + i32.const 0 + i32.store offset=8 + local.get $2 + i32.const 0 + i32.store offset=12 + local.get $1 + local.tee $0 + local.get $2 i32.load local.tee $5 i32.ne if - local.get $1 + local.get $0 call $~lib/rt/pure/__retain - local.set $1 + local.set $0 local.get $5 call $~lib/rt/pure/__release end local.get $2 - local.get $1 + local.get $0 i32.store local.get $2 - local.get $0 + local.get $1 i32.store offset=4 local.get $2 i32.const 0 @@ -1912,9 +1948,9 @@ i32.const 0 i32.store offset=12 i32.const 0 - local.set $1 + local.set $0 loop $for-loop|1 - local.get $1 + local.get $0 i32.const 10 i32.lt_s if @@ -1924,7 +1960,7 @@ local.tee $5 i32.const 1 i32.add - local.tee $0 + local.tee $1 call $~lib/array/ensureSize local.get $2 i32.load offset=4 @@ -1935,12 +1971,12 @@ i32.const 1344 i32.store local.get $2 - local.get $0 - i32.store offset=12 local.get $1 + i32.store offset=12 + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $for-loop|1 end end @@ -1975,28 +2011,28 @@ i32.const 7 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain - local.tee $0 + local.tee $1 i32.const 0 i32.store - local.get $0 - local.tee $1 + local.get $1 + local.tee $0 local.get $2 i32.load local.tee $4 i32.ne if - local.get $1 + local.get $0 call $~lib/rt/pure/__retain - local.set $1 + local.set $0 local.get $4 call $~lib/rt/pure/__release end - local.get $1 - i32.store local.get $0 + i32.store + local.get $1 local.tee $3 local.get $2 - local.tee $1 + local.tee $0 i32.load local.tee $4 i32.ne @@ -2007,13 +2043,13 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $1 + local.get $0 local.get $3 i32.store - local.get $1 - local.tee $3 local.get $0 - local.tee $1 + local.tee $3 + local.get $1 + local.tee $0 i32.load local.tee $4 i32.ne @@ -2024,12 +2060,12 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $1 + local.get $0 local.get $3 i32.store local.get $2 local.tee $3 - local.get $1 + local.get $0 i32.load local.tee $4 i32.ne @@ -2040,43 +2076,43 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $1 + local.get $0 local.get $3 i32.store - local.get $1 + local.get $0 local.get $2 local.tee $3 i32.load local.tee $4 i32.ne if - local.get $1 + local.get $0 call $~lib/rt/pure/__retain - local.set $1 + local.set $0 local.get $4 call $~lib/rt/pure/__release end local.get $3 - local.get $1 + local.get $0 i32.store local.get $2 - local.get $0 + local.get $1 i32.load - local.tee $1 + local.tee $0 i32.ne if local.get $3 call $~lib/rt/pure/__retain local.set $3 - local.get $1 + local.get $0 call $~lib/rt/pure/__release end - local.get $0 + local.get $1 local.get $3 i32.store local.get $2 call $~lib/rt/pure/__release - local.get $0 + local.get $1 call $~lib/rt/pure/__release call $~lib/rt/pure/__collect ) diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index 3b8956467e..5a830cace2 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -1730,6 +1730,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3352,6 +3364,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3418,6 +3442,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index d22e2e1232..53f5b53b95 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -8,9 +8,9 @@ (type $i32_=>_none (func (param i32))) (type $f32_f32_=>_i32 (func (param f32 f32) (result i32))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) + (type $none_=>_i32 (func (result i32))) (type $none_=>_f64 (func (result f64))) (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) (type $i32_i32_i64_=>_i32 (func (param i32 i32 i64) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i64_i32_=>_none (func (param i32 i64 i32))) @@ -1516,14 +1516,26 @@ i32.const 0 local.get $4 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 3 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 + i32.const 0 + i32.store + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $3 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $3 i32.load local.tee $5 i32.ne @@ -5285,7 +5297,90 @@ call $~lib/rt/pure/__release end ) - (func $start:std/array~anonymous|47 (; 114 ;) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 114 ;) (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + i32.const 8 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 0 + i32.const 8 + call $~lib/memory/memory.fill + i32.const 16 + i32.const 12 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $2 + i32.const 0 + i32.store + local.get $2 + i32.const 0 + i32.store offset=4 + local.get $2 + i32.const 0 + i32.store offset=8 + local.get $2 + i32.const 0 + i32.store offset=12 + local.get $0 + local.set $1 + local.get $0 + local.get $2 + i32.load + local.tee $4 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $4 + call $~lib/rt/pure/__release + end + local.get $2 + local.get $1 + i32.store + local.get $2 + local.get $0 + i32.store offset=4 + local.get $2 + i32.const 8 + i32.store offset=8 + local.get $2 + i32.const 2 + i32.store offset=12 + loop $for-loop|0 + local.get $3 + i32.const 2 + i32.lt_s + if + i32.const 1 + call $~lib/array/Array#constructor + local.tee $0 + i32.const 0 + i32.const 1 + local.get $3 + i32.sub + call $~lib/array/Array#__set + local.get $2 + local.get $3 + local.get $0 + call $~lib/array/Array<~lib/array/Array>#__set + local.get $0 + call $~lib/rt/pure/__release + local.get $3 + i32.const 1 + i32.add + local.set $3 + br $for-loop|0 + end + end + local.get $2 + ) + (func $start:std/array~anonymous|47 (; 115 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.const 0 call $~lib/array/Array#__get @@ -5294,7 +5389,7 @@ call $~lib/array/Array#__get i32.sub ) - (func $~lib/array/Array<~lib/array/Array>#sort (; 115 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array<~lib/array/Array>#sort (; 116 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5348,7 +5443,7 @@ local.get $0 call $~lib/rt/pure/__retain ) - (func $std/array/assertSorted<~lib/array/Array> (; 116 ;) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted<~lib/array/Array> (; 117 ;) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5418,14 +5513,98 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $start:std/array~anonymous|48 (; 117 ;) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 118 ;) (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + i32.const 2048 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 0 + i32.const 2048 + call $~lib/memory/memory.fill + i32.const 16 + i32.const 14 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $2 + i32.const 0 + i32.store + local.get $2 + i32.const 0 + i32.store offset=4 + local.get $2 + i32.const 0 + i32.store offset=8 + local.get $2 + i32.const 0 + i32.store offset=12 + local.get $0 + local.set $1 + local.get $0 + local.get $2 + i32.load + local.tee $4 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $4 + call $~lib/rt/pure/__release + end + local.get $2 + local.get $1 + i32.store + local.get $2 + local.get $0 + i32.store offset=4 + local.get $2 + i32.const 2048 + i32.store offset=8 + local.get $2 + i32.const 512 + i32.store offset=12 + loop $for-loop|0 + local.get $3 + i32.const 512 + i32.lt_s + if + i32.const 4 + i32.const 13 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $0 + i32.const 511 + local.get $3 + i32.sub + i32.store + local.get $2 + local.get $3 + local.get $0 + call $~lib/array/Array<~lib/array/Array>#__set + local.get $0 + call $~lib/rt/pure/__release + local.get $3 + i32.const 1 + i32.add + local.set $3 + br $for-loop|0 + end + end + local.get $2 + ) + (func $start:std/array~anonymous|48 (; 119 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load local.get $1 i32.load i32.sub ) - (func $~lib/string/String#get:length (; 118 ;) (param $0 i32) (result i32) + (func $~lib/string/String#get:length (; 120 ;) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.sub @@ -5433,7 +5612,7 @@ i32.const 1 i32.shr_u ) - (func $~lib/util/string/compareImpl (; 119 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/compareImpl (; 121 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -5509,7 +5688,7 @@ end i32.const 0 ) - (func $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0 (; 120 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0 (; 122 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) i32.const 1 @@ -5563,7 +5742,7 @@ select call $~lib/util/string/compareImpl ) - (func $std/array/assertSorted<~lib/string/String | null>|trampoline (; 121 ;) (param $0 i32) + (func $std/array/assertSorted<~lib/string/String | null>|trampoline (; 123 ;) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5647,7 +5826,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/string/String.__eq (; 122 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 124 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 local.get $1 @@ -5681,7 +5860,7 @@ call $~lib/util/string/compareImpl i32.eqz ) - (func $~lib/string/String.__concat (; 123 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 125 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5744,7 +5923,7 @@ local.get $1 end ) - (func $std/array/createRandomStringArray (; 124 ;) (result i32) + (func $std/array/createRandomStringArray (; 126 ;) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -5760,13 +5939,25 @@ i32.const 0 i32.const 1600 call $~lib/memory/memory.fill - local.get $0 - local.tee $1 i32.const 16 i32.const 16 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $7 + i32.const 0 + i32.store + local.get $7 + i32.const 0 + i32.store offset=4 + local.get $7 + i32.const 0 + i32.store offset=8 + local.get $7 + i32.const 0 + i32.store offset=12 + local.get $0 + local.tee $1 + local.get $7 i32.load local.tee $6 i32.ne @@ -5878,7 +6069,7 @@ end local.get $7 ) - (func $~lib/string/String#substring (; 125 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#substring (; 127 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5952,7 +6143,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/util/string/joinBooleanArray (; 126 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinBooleanArray (; 128 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6090,7 +6281,7 @@ end local.get $1 ) - (func $~lib/util/number/decimalCount32 (; 127 ;) (param $0 i32) (result i32) + (func $~lib/util/number/decimalCount32 (; 129 ;) (param $0 i32) (result i32) local.get $0 i32.const 10 i32.ge_u @@ -6132,7 +6323,7 @@ i32.lt_u select ) - (func $~lib/util/number/utoa_simple (; 128 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/number/utoa_simple (; 130 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) loop $do-continue|0 local.get $1 @@ -6159,7 +6350,7 @@ br_if $do-continue|0 end ) - (func $~lib/util/number/itoa32 (; 129 ;) (param $0 i32) (result i32) + (func $~lib/util/number/itoa32 (; 131 ;) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6201,7 +6392,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/util/number/itoa_stream (; 130 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 132 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -6249,7 +6440,7 @@ call $~lib/util/number/utoa_simple local.get $0 ) - (func $~lib/util/string/joinIntegerArray (; 131 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 133 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6354,7 +6545,7 @@ end local.get $1 ) - (func $~lib/array/Array#join (; 132 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 134 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 @@ -6362,7 +6553,7 @@ local.get $1 call $~lib/util/string/joinIntegerArray ) - (func $~lib/util/number/utoa32 (; 133 ;) (param $0 i32) (result i32) + (func $~lib/util/number/utoa32 (; 135 ;) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) local.get $0 @@ -6385,7 +6576,7 @@ local.get $2 call $~lib/rt/pure/__retain ) - (func $~lib/util/number/itoa_stream (; 134 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 136 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -6412,7 +6603,7 @@ call $~lib/util/number/utoa_simple local.get $0 ) - (func $~lib/util/string/joinIntegerArray (; 135 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 137 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6517,7 +6708,7 @@ end local.get $1 ) - (func $~lib/array/Array#join (; 136 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 138 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 @@ -6525,7 +6716,7 @@ local.get $1 call $~lib/util/string/joinIntegerArray ) - (func $~lib/util/number/genDigits (; 137 ;) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) + (func $~lib/util/number/genDigits (; 139 ;) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) (local $7 i32) (local $8 i64) (local $9 i64) @@ -6916,7 +7107,7 @@ local.get $6 end ) - (func $~lib/util/number/prettify (; 138 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/prettify (; 140 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) local.get $2 i32.eqz @@ -7161,7 +7352,7 @@ end end ) - (func $~lib/util/number/dtoa_core (; 139 ;) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/util/number/dtoa_core (; 141 ;) (param $0 i32) (param $1 f64) (result i32) (local $2 i64) (local $3 i64) (local $4 i32) @@ -7453,7 +7644,7 @@ local.get $7 i32.add ) - (func $~lib/util/number/dtoa_stream (; 140 ;) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) + (func $~lib/util/number/dtoa_stream (; 142 ;) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) local.get $0 local.get $1 i32.const 1 @@ -7528,7 +7719,7 @@ local.get $2 call $~lib/util/number/dtoa_core ) - (func $~lib/util/string/joinFloatArray (; 141 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinFloatArray (; 143 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 f64) (local $4 i32) @@ -7691,7 +7882,7 @@ end local.get $1 ) - (func $~lib/util/string/joinReferenceArray<~lib/string/String | null> (; 142 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/string/String | null> (; 144 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -7857,7 +8048,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/array/Array<~lib/string/String | null>#join (; 143 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array<~lib/string/String | null>#join (; 145 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 @@ -7865,7 +8056,7 @@ local.get $1 call $~lib/util/string/joinReferenceArray<~lib/string/String | null> ) - (func $~lib/util/string/joinReferenceArray (; 144 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray (; 146 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8018,14 +8209,14 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/array/Array#join (; 145 ;) (param $0 i32) (result i32) + (func $~lib/array/Array#join (; 147 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load offset=12 call $~lib/util/string/joinReferenceArray ) - (func $~lib/util/number/itoa_stream (; 146 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 148 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -8091,7 +8282,7 @@ call $~lib/util/number/utoa_simple local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 147 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 149 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8192,7 +8383,7 @@ end local.get $1 ) - (func $~lib/util/number/itoa_stream (; 148 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 150 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -8227,7 +8418,7 @@ call $~lib/util/number/utoa_simple local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 149 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 151 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8332,7 +8523,7 @@ end local.get $1 ) - (func $~lib/util/number/decimalCount64High (; 150 ;) (param $0 i64) (result i32) + (func $~lib/util/number/decimalCount64High (; 152 ;) (param $0 i64) (result i32) local.get $0 i64.const 100000000000 i64.ge_u @@ -8378,7 +8569,7 @@ i64.lt_u select ) - (func $~lib/util/number/utoa_simple (; 151 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/util/number/utoa_simple (; 153 ;) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) loop $do-continue|0 local.get $1 @@ -8408,7 +8599,7 @@ br_if $do-continue|0 end ) - (func $~lib/util/number/itoa_stream (; 152 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/util/number/itoa_stream (; 154 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) local.get $0 local.get $1 @@ -8451,7 +8642,7 @@ end local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 153 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 155 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i64) @@ -8594,7 +8785,7 @@ end local.get $1 ) - (func $~lib/util/number/itoa_stream (; 154 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/util/number/itoa_stream (; 156 ;) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) local.get $0 local.get $1 @@ -8660,7 +8851,7 @@ end local.get $0 ) - (func $~lib/util/string/joinIntegerArray (; 155 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 157 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i64) (local $4 i32) @@ -8824,7 +9015,7 @@ end local.get $1 ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 156 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 158 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8992,7 +9183,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/util/number/itoa_stream (; 157 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/number/itoa_stream (; 159 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 1 @@ -9027,7 +9218,7 @@ call $~lib/util/number/utoa_simple local.get $1 ) - (func $~lib/util/string/joinIntegerArray (; 158 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinIntegerArray (; 160 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9128,14 +9319,14 @@ end local.get $1 ) - (func $~lib/array/Array#toString (; 159 ;) (param $0 i32) (result i32) + (func $~lib/array/Array#toString (; 161 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load offset=12 call $~lib/util/string/joinIntegerArray ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 160 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 162 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9300,7 +9491,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 161 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array> (; 163 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9468,14 +9659,14 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/array/Array<~lib/array/Array>#toString (; 162 ;) (param $0 i32) (result i32) + (func $~lib/array/Array<~lib/array/Array>#toString (; 164 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> ) - (func $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> (; 163 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> (; 165 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9640,7 +9831,7 @@ call $~lib/rt/pure/__release local.get $1 ) - (func $start:std/array (; 164 ;) + (func $start:std/array (; 166 ;) (local $0 i32) (local $1 i32) (local $2 i32) @@ -9726,17 +9917,26 @@ call $~lib/rt/pure/__retain local.set $58 end + local.get $58 + i32.const 0 + i32.store + local.get $58 + i32.const 0 + i32.store offset=4 + local.get $58 + i32.const 0 + i32.store offset=8 local.get $0 local.tee $1 local.get $58 i32.load - local.tee $56 + local.tee $55 i32.ne if local.get $1 call $~lib/rt/pure/__retain local.set $1 - local.get $56 + local.get $55 call $~lib/rt/pure/__release end local.get $58 @@ -9852,7 +10052,7 @@ i32.const 1632 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $55 call $std/array/isArraysEqual i32.eqz if @@ -9876,7 +10076,7 @@ i32.const 1664 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $56 call $std/array/isArraysEqual i32.eqz if @@ -9895,9 +10095,9 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $56 + local.get $55 call $~lib/rt/pure/__release - local.get $53 + local.get $56 call $~lib/rt/pure/__release i32.const 5 i32.const 2 @@ -9993,7 +10193,7 @@ i32.const 1888 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $55 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10018,7 +10218,7 @@ i32.const 1936 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $56 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10038,9 +10238,9 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $56 + local.get $55 call $~lib/rt/pure/__release - local.get $53 + local.get $56 call $~lib/rt/pure/__release global.get $std/array/arr i32.load offset=12 @@ -10407,7 +10607,7 @@ i32.const 2032 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $55 call $~lib/array/Array#concat call $~lib/rt/pure/__release global.get $std/array/arr @@ -10637,7 +10837,7 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $56 + local.get $55 call $~lib/rt/pure/__release local.get $58 call $~lib/rt/pure/__release @@ -10685,14 +10885,14 @@ i32.const 3 i32.const 2147483647 call $~lib/array/Array#copyWithin - local.tee $56 + local.tee $55 i32.const 5 i32.const 2 i32.const 3 i32.const 2208 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $56 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -10724,7 +10924,7 @@ i32.const 2304 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $54 + local.tee $53 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -11032,13 +11232,13 @@ call $~lib/rt/pure/__release local.get $57 call $~lib/rt/pure/__release - local.get $56 + local.get $55 call $~lib/rt/pure/__release - local.get $53 + local.get $56 call $~lib/rt/pure/__release local.get $42 call $~lib/rt/pure/__release - local.get $54 + local.get $53 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -11275,10 +11475,10 @@ local.tee $58 i32.const 2 i32.shl - local.tee $56 + local.tee $55 call $~lib/memory/memory.copy local.get $1 - local.get $56 + local.get $55 i32.add i32.const 0 i32.store @@ -11728,7 +11928,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.tee $0 - local.set $56 + local.set $55 i32.const 0 local.set $1 block $__inlined_func$~lib/array/Array#indexOf @@ -11747,7 +11947,7 @@ local.set $1 br $__inlined_func$~lib/array/Array#indexOf end - local.get $56 + local.get $55 i32.load offset=4 local.set $57 loop $while-continue|022 @@ -11792,7 +11992,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.tee $58 - local.set $53 + local.set $56 i32.const 0 local.set $1 block $__inlined_func$~lib/array/Array#indexOf @@ -11811,15 +12011,15 @@ local.set $1 br $__inlined_func$~lib/array/Array#indexOf end - local.get $53 + local.get $56 i32.load offset=4 - local.set $56 + local.set $55 loop $while-continue|023 local.get $1 local.get $57 i32.lt_s if - local.get $56 + local.get $55 local.get $1 i32.const 3 i32.shl @@ -12013,14 +12213,14 @@ drop local.get $0 i32.load offset=4 - local.set $53 + local.set $56 loop $while-continue|024 local.get $58 local.get $57 i32.lt_s if i32.const 1 - local.get $53 + local.get $56 local.get $58 i32.const 2 i32.shl @@ -12068,10 +12268,10 @@ call $~lib/rt/pure/__retain local.tee $57 i32.load offset=12 - local.tee $56 + local.tee $55 if (result i32) i32.const 0 - local.get $56 + local.get $55 i32.ge_s else i32.const 1 @@ -12083,7 +12283,7 @@ local.set $42 loop $while-continue|025 local.get $58 - local.get $56 + local.get $55 i32.lt_s if i32.const 1 @@ -12192,14 +12392,14 @@ i32.const 0 i32.const 2147483647 call $~lib/array/Array#splice - local.tee $57 + local.tee $56 i32.const 5 i32.const 2 i32.const 3 i32.const 3392 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $54 + local.tee $53 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12891,10 +13091,10 @@ i32.const 4912 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $0 + local.tee $57 i32.const 1 call $~lib/array/Array#splice - local.tee $53 + local.tee $55 i32.load offset=12 if i32.const 0 @@ -12904,7 +13104,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $57 i32.load offset=12 if i32.const 0 @@ -12920,7 +13120,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $56 + local.tee $0 i32.load offset=4 local.tee $1 i32.const 1 @@ -12942,13 +13142,13 @@ i32.const 5 call $std/array/Ref#constructor i32.store offset=16 - local.get $0 + local.get $57 call $~lib/rt/pure/__release - local.get $56 + local.get $0 i32.const 2 call $~lib/array/Array#splice local.set $42 - local.get $53 + local.get $55 call $~lib/rt/pure/__release local.get $42 i32.load offset=12 @@ -12992,7 +13192,7 @@ call $~lib/builtins/abort unreachable end - local.get $56 + local.get $0 i32.load offset=12 i32.const 3 i32.ne @@ -13004,7 +13204,7 @@ call $~lib/builtins/abort unreachable end - local.get $56 + local.get $0 i32.const 0 call $~lib/array/Array#__get local.tee $6 @@ -13019,7 +13219,7 @@ call $~lib/builtins/abort unreachable end - local.get $56 + local.get $0 i32.const 1 call $~lib/array/Array#__get local.tee $5 @@ -13034,7 +13234,7 @@ call $~lib/builtins/abort unreachable end - local.get $56 + local.get $0 i32.const 2 call $~lib/array/Array#__get local.tee $4 @@ -13055,7 +13255,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $53 + local.tee $55 i32.load offset=4 local.tee $1 i32.const 1 @@ -13068,7 +13268,7 @@ i32.const 2 call $std/array/Ref#constructor i32.store offset=8 - local.get $53 + local.get $55 call $~lib/array/Array#splice local.tee $31 i32.load offset=12 @@ -13107,7 +13307,7 @@ call $~lib/builtins/abort unreachable end - local.get $53 + local.get $55 i32.load offset=12 i32.const 2 i32.ne @@ -13119,7 +13319,7 @@ call $~lib/builtins/abort unreachable end - local.get $53 + local.get $55 i32.const 0 call $~lib/array/Array#__get local.tee $3 @@ -13131,11 +13331,11 @@ call $~lib/builtins/abort unreachable end - local.get $53 + local.get $55 i32.const 1 call $~lib/array/Array#__get - local.tee $0 - local.get $0 + local.tee $57 + local.get $57 i32.eqz if i32.const 0 @@ -13158,9 +13358,9 @@ end local.get $58 call $~lib/rt/pure/__release - local.get $57 + local.get $56 call $~lib/rt/pure/__release - local.get $54 + local.get $53 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -13256,7 +13456,7 @@ call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release - local.get $0 + local.get $57 call $~lib/rt/pure/__release global.get $std/array/arr i32.const 0 @@ -13730,17 +13930,17 @@ unreachable end loop $for-loop|0 - local.get $55 + local.get $54 i32.const 100 i32.lt_s if global.get $std/array/arr call $~lib/array/Array#pop drop - local.get $55 + local.get $54 i32.const 1 i32.add - local.set $55 + local.set $54 br $for-loop|0 end end @@ -13759,9 +13959,9 @@ i32.const 0 local.set $58 global.get $std/array/arr - local.tee $0 - i32.load offset=12 local.tee $57 + i32.load offset=12 + local.tee $56 i32.const 2 i32.const 9 i32.const 0 @@ -13769,15 +13969,15 @@ call $~lib/rt/pure/__retain local.tee $1 i32.load offset=4 - local.set $55 + local.set $54 loop $for-loop|043 local.get $58 + local.get $56 local.get $57 - local.get $0 i32.load offset=12 - local.tee $54 - local.get $57 - local.get $54 + local.tee $53 + local.get $56 + local.get $53 i32.lt_s select i32.lt_s @@ -13787,15 +13987,15 @@ local.get $58 i32.const 2 i32.shl - local.tee $54 - local.get $0 + local.tee $53 + local.get $57 i32.load offset=4 i32.add i32.load f32.convert_i32_s local.set $41 + local.get $53 local.get $54 - local.get $55 i32.add local.get $41 f32.store @@ -14352,10 +14552,10 @@ i32.const 5280 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $0 + local.set $58 i32.const 0 global.set $~argumentsLength - local.get $0 + local.get $58 call $~lib/array/Array#sort|trampoline call $~lib/rt/pure/__release block $__inlined_func$std/array/isArraysEqual (result i32) @@ -14365,37 +14565,37 @@ i32.const 5328 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $57 + local.set $56 i32.const 0 local.set $1 i32.const 0 - local.get $0 + local.get $58 i32.load offset=12 - local.tee $55 - local.get $57 + local.tee $54 + local.get $56 i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual drop i32.const 1 - local.get $0 - local.get $57 + local.get $56 + local.get $58 i32.eq br_if $__inlined_func$std/array/isArraysEqual drop loop $for-loop|00 local.get $1 - local.get $55 + local.get $54 i32.lt_s if - local.get $0 + local.get $58 local.get $1 call $~lib/array/Array#__get local.tee $41 local.get $41 f32.ne if (result i32) - local.get $57 + local.get $56 local.get $1 call $~lib/array/Array#__get local.tee $41 @@ -14407,10 +14607,10 @@ i32.eqz if i32.const 0 - local.get $0 + local.get $58 local.get $1 call $~lib/array/Array#__get - local.get $57 + local.get $56 local.get $1 call $~lib/array/Array#__get f32.ne @@ -14441,10 +14641,10 @@ i32.const 5376 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $58 + local.set $57 i32.const 0 global.set $~argumentsLength - local.get $58 + local.get $57 call $~lib/array/Array#sort|trampoline call $~lib/rt/pure/__release block $__inlined_func$std/array/isArraysEqual (result i32) @@ -14454,21 +14654,21 @@ i32.const 5456 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $55 + local.set $54 i32.const 0 local.set $1 i32.const 0 - local.get $58 + local.get $57 i32.load offset=12 local.tee $52 - local.get $55 + local.get $54 i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual drop i32.const 1 - local.get $55 - local.get $58 + local.get $54 + local.get $57 i32.eq br_if $__inlined_func$std/array/isArraysEqual drop @@ -14477,14 +14677,14 @@ local.get $52 i32.lt_s if - local.get $58 + local.get $57 local.get $1 call $~lib/array/Array#__get local.tee $36 local.get $36 f64.ne if (result i32) - local.get $55 + local.get $54 local.get $1 call $~lib/array/Array#__get local.tee $36 @@ -14496,10 +14696,10 @@ i32.eqz if i32.const 0 - local.get $58 + local.get $57 local.get $1 call $~lib/array/Array#__get - local.get $55 + local.get $54 local.get $1 call $~lib/array/Array#__get f64.ne @@ -14530,14 +14730,14 @@ i32.const 5536 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $54 + local.set $53 i32.const 0 global.set $~argumentsLength - local.get $54 + local.get $53 i32.const 46 call $~lib/array/Array#sort call $~lib/rt/pure/__release - local.get $54 + local.get $53 i32.const 5 i32.const 2 i32.const 3 @@ -14768,16 +14968,16 @@ local.get $47 i32.const 48 call $std/array/assertSorted - local.get $0 - call $~lib/rt/pure/__release - local.get $57 - call $~lib/rt/pure/__release local.get $58 call $~lib/rt/pure/__release - local.get $55 + local.get $56 + call $~lib/rt/pure/__release + local.get $57 call $~lib/rt/pure/__release local.get $54 call $~lib/rt/pure/__release + local.get $53 + call $~lib/rt/pure/__release local.get $40 call $~lib/rt/pure/__release local.get $52 @@ -14813,161 +15013,34 @@ local.set $1 i32.const 257 call $std/array/createRandomOrderedArray - local.set $0 + local.set $58 local.get $1 i32.const 49 call $std/array/assertSorted local.get $1 i32.const 50 call $std/array/assertSorted - local.get $0 + local.get $58 i32.const 51 call $std/array/assertSorted - local.get $0 + local.get $58 i32.const 52 call $std/array/assertSorted local.get $1 call $~lib/rt/pure/__release - local.get $0 + local.get $58 call $~lib/rt/pure/__release - i32.const 0 - local.set $58 - i32.const 8 - i32.const 0 - call $~lib/rt/tlsf/__alloc - local.tee $0 - i32.const 0 - i32.const 8 - call $~lib/memory/memory.fill - local.get $0 + call $std/array/createReverseOrderedNestedArray local.tee $1 - i32.const 16 - i32.const 12 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $57 - i32.load - local.tee $55 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $55 - call $~lib/rt/pure/__release - end - local.get $57 - local.get $1 - i32.store - local.get $57 - local.get $0 - i32.store offset=4 - local.get $57 - i32.const 8 - i32.store offset=8 - local.get $57 - i32.const 2 - i32.store offset=12 - loop $for-loop|02 - local.get $58 - i32.const 2 - i32.lt_s - if - i32.const 1 - call $~lib/array/Array#constructor - local.tee $1 - i32.const 0 - i32.const 1 - local.get $58 - i32.sub - call $~lib/array/Array#__set - local.get $57 - local.get $58 - local.get $1 - call $~lib/array/Array<~lib/array/Array>#__set - local.get $1 - call $~lib/rt/pure/__release - local.get $58 - i32.const 1 - i32.add - local.set $58 - br $for-loop|02 - end - end - local.get $57 i32.const 53 call $std/array/assertSorted<~lib/array/Array> - local.get $57 + local.get $1 call $~lib/rt/pure/__release - i32.const 0 - local.set $58 - i32.const 2048 - i32.const 0 - call $~lib/rt/tlsf/__alloc - local.tee $0 - i32.const 0 - i32.const 2048 - call $~lib/memory/memory.fill - local.get $0 + call $std/array/createReverseOrderedElementsArray local.tee $1 - i32.const 16 - i32.const 14 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $57 - i32.load - local.tee $55 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $55 - call $~lib/rt/pure/__release - end - local.get $57 - local.get $1 - i32.store - local.get $57 - local.get $0 - i32.store offset=4 - local.get $57 - i32.const 2048 - i32.store offset=8 - local.get $57 - i32.const 512 - i32.store offset=12 - loop $for-loop|03 - local.get $58 - i32.const 512 - i32.lt_s - if - i32.const 4 - i32.const 13 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $1 - i32.const 511 - local.get $58 - i32.sub - i32.store - local.get $57 - local.get $58 - local.get $1 - call $~lib/array/Array<~lib/array/Array>#__set - local.get $1 - call $~lib/rt/pure/__release - local.get $58 - i32.const 1 - i32.add - local.set $58 - br $for-loop|03 - end - end - local.get $57 i32.const 54 call $std/array/assertSorted<~lib/array/Array> - local.get $57 + local.get $1 call $~lib/rt/pure/__release i32.const 7 i32.const 2 @@ -14975,68 +15048,68 @@ i32.const 6080 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $0 + local.set $58 i32.const 7 i32.const 2 i32.const 15 i32.const 6128 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $58 + local.set $57 i32.const 1 global.set $~argumentsLength - local.get $0 + local.get $58 call $std/array/assertSorted<~lib/string/String | null>|trampoline block $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> (result i32) i32.const 0 local.set $1 i32.const 0 - local.get $0 - i32.load offset=12 - local.tee $54 local.get $58 i32.load offset=12 + local.tee $53 + local.get $57 + i32.load offset=12 i32.ne br_if $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> drop i32.const 1 - local.get $0 + local.get $57 local.get $58 i32.eq br_if $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> drop - loop $for-loop|04 + loop $for-loop|02 local.get $1 - local.get $54 + local.get $53 i32.lt_s if - local.get $0 + local.get $58 local.get $1 call $~lib/array/Array#__get - local.tee $57 - local.get $58 + local.tee $56 + local.get $57 local.get $1 call $~lib/array/Array#__get - local.tee $55 + local.tee $54 call $~lib/string/String.__eq i32.eqz if - local.get $57 + local.get $56 call $~lib/rt/pure/__release - local.get $55 + local.get $54 call $~lib/rt/pure/__release i32.const 0 br $__inlined_func$std/array/isArraysEqual<~lib/string/String | null> end - local.get $57 + local.get $56 call $~lib/rt/pure/__release - local.get $55 + local.get $54 call $~lib/rt/pure/__release local.get $1 i32.const 1 i32.add local.set $1 - br $for-loop|04 + br $for-loop|02 end end i32.const 1 @@ -15057,10 +15130,10 @@ local.get $1 i32.const 56 call $std/array/assertSorted<~lib/array/Array> - local.get $0 - call $~lib/rt/pure/__release local.get $58 call $~lib/rt/pure/__release + local.get $57 + call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release i32.const 2 @@ -15074,8 +15147,8 @@ local.get $1 i32.load offset=12 call $~lib/util/string/joinBooleanArray - local.tee $0 - local.get $0 + local.tee $58 + local.get $58 i32.const 6336 call $~lib/string/String.__eq i32.eqz @@ -15093,7 +15166,7 @@ i32.const 6384 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $54 + local.tee $53 i32.const 6064 call $~lib/array/Array#join local.tee $52 @@ -15156,14 +15229,14 @@ i32.const 6672 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $0 + local.tee $58 i32.load offset=4 - local.get $0 + local.get $58 i32.load offset=12 call $~lib/util/string/joinFloatArray - local.tee $58 + local.tee $57 local.set $46 - local.get $58 + local.get $57 i32.const 7888 call $~lib/string/String.__eq i32.eqz @@ -15202,20 +15275,20 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $58 - i32.load offset=4 local.tee $57 + i32.load offset=4 + local.tee $56 i32.const 0 call $std/array/Ref#constructor i32.store - local.get $57 + local.get $56 i32.const 0 i32.store offset=4 - local.get $57 + local.get $56 i32.const 0 call $std/array/Ref#constructor i32.store offset=8 - local.get $58 + local.get $57 call $~lib/array/Array#join local.tee $43 i32.const 8096 @@ -15235,7 +15308,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $57 + local.tee $56 i32.load offset=4 local.tee $47 i32.const 0 @@ -15245,7 +15318,7 @@ i32.const 0 call $std/array/Ref#constructor i32.store offset=4 - local.get $57 + local.get $56 call $~lib/array/Array#join local.tee $47 i32.const 8176 @@ -15262,7 +15335,7 @@ local.get $1 call $~lib/rt/pure/__release call $~lib/rt/pure/__release - local.get $54 + local.get $53 call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release @@ -15274,7 +15347,7 @@ call $~lib/rt/pure/__release local.get $48 call $~lib/rt/pure/__release - local.get $0 + local.get $58 call $~lib/rt/pure/__release local.get $46 call $~lib/rt/pure/__release @@ -15282,11 +15355,11 @@ call $~lib/rt/pure/__release local.get $44 call $~lib/rt/pure/__release - local.get $58 + local.get $57 call $~lib/rt/pure/__release local.get $43 call $~lib/rt/pure/__release - local.get $57 + local.get $56 call $~lib/rt/pure/__release local.get $47 call $~lib/rt/pure/__release @@ -15296,21 +15369,21 @@ i32.const 8256 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $57 + local.set $56 i32.const 1 i32.const 2 i32.const 3 i32.const 8272 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $55 + local.set $54 i32.const 2 i32.const 2 i32.const 3 i32.const 8304 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.set $54 + local.set $53 i32.const 4 i32.const 2 i32.const 3 @@ -15318,7 +15391,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain local.set $52 - local.get $57 + local.get $56 i32.const 6304 call $~lib/array/Array#join local.tee $1 @@ -15334,7 +15407,7 @@ call $~lib/builtins/abort unreachable end - local.get $55 + local.get $54 i32.const 6304 call $~lib/array/Array#join local.tee $1 @@ -15351,7 +15424,7 @@ call $~lib/builtins/abort unreachable end - local.get $54 + local.get $53 i32.const 6304 call $~lib/array/Array#join local.tee $1 @@ -15539,7 +15612,7 @@ call $~lib/rt/pure/__retain local.tee $1 i32.load offset=4 - local.tee $0 + local.tee $58 i32.const 2 i32.const 2 i32.const 3 @@ -15547,7 +15620,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $0 + local.get $58 i32.const 2 i32.const 2 i32.const 3 @@ -15560,9 +15633,9 @@ local.get $1 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> - local.tee $0 + local.tee $58 local.set $29 - local.get $0 + local.get $58 i32.const 9136 call $~lib/string/String.__eq i32.eqz @@ -15580,9 +15653,9 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $0 - i32.load offset=4 local.tee $58 + i32.load offset=4 + local.tee $57 i32.const 2 i32.const 0 i32.const 6 @@ -15590,7 +15663,7 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store - local.get $58 + local.get $57 i32.const 2 i32.const 0 i32.const 6 @@ -15598,14 +15671,14 @@ call $~lib/rt/__allocArray call $~lib/rt/pure/__retain i32.store offset=4 - local.get $0 + local.get $58 i32.load offset=4 - local.get $0 + local.get $58 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array> - local.tee $58 + local.tee $57 local.set $28 - local.get $58 + local.get $57 i32.const 9136 call $~lib/string/String.__eq i32.eqz @@ -15623,7 +15696,7 @@ i32.const 0 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $58 + local.tee $57 i32.load offset=4 i32.const 1 i32.const 2 @@ -15642,9 +15715,9 @@ i32.store local.get $32 i32.store - local.get $58 + local.get $57 i32.load offset=4 - local.get $58 + local.get $57 i32.load offset=12 call $~lib/util/string/joinReferenceArray<~lib/array/Array<~lib/array/Array>> local.tee $33 @@ -15661,12 +15734,12 @@ call $~lib/builtins/abort unreachable end - local.get $57 - call $~lib/rt/pure/__release - local.get $55 + local.get $56 call $~lib/rt/pure/__release local.get $54 call $~lib/rt/pure/__release + local.get $53 + call $~lib/rt/pure/__release local.get $52 call $~lib/rt/pure/__release call $~lib/rt/pure/__release @@ -15708,22 +15781,22 @@ call $~lib/rt/pure/__release global.get $std/array/arr call $~lib/rt/pure/__release - local.get $56 + local.get $0 call $~lib/rt/pure/__release local.get $42 call $~lib/rt/pure/__release - local.get $53 + local.get $55 call $~lib/rt/pure/__release local.get $31 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $0 - call $~lib/rt/pure/__release local.get $58 call $~lib/rt/pure/__release + local.get $57 + call $~lib/rt/pure/__release ) - (func $~start (; 165 ;) + (func $~start (; 167 ;) global.get $~started if return @@ -15733,7 +15806,7 @@ end call $start:std/array ) - (func $~lib/rt/pure/decrement (; 166 ;) (param $0 i32) + (func $~lib/rt/pure/decrement (; 168 ;) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -15862,7 +15935,7 @@ i32.store offset=4 end ) - (func $~lib/rt/pure/__visit (; 167 ;) (param $0 i32) + (func $~lib/rt/pure/__visit (; 169 ;) (param $0 i32) local.get $0 i32.const 9236 i32.lt_u diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index c70d24622a..3421557e23 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -1931,6 +1931,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -2048,6 +2060,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -9493,6 +9514,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -10004,6 +10037,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -11264,6 +11309,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index 11df6f4287..461e3be9be 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -4,10 +4,10 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) @@ -1528,11 +1528,9 @@ local.tee $3 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $2 + local.tee $1 local.get $3 call $~lib/memory/memory.fill - local.get $2 - local.set $1 local.get $0 i32.eqz if @@ -1543,9 +1541,98 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $1 + local.set $2 + local.get $0 i32.load local.tee $4 + local.get $1 + i32.ne + if + local.get $2 + call $~lib/rt/pure/__retain + local.set $2 + local.get $4 + call $~lib/rt/pure/__release + end + local.get $0 local.get $2 + i32.store + local.get $0 + local.get $1 + i32.store offset=4 + local.get $0 + local.get $3 + i32.store offset=8 + local.get $0 + ) + (func $~lib/dataview/DataView#constructor|trampoline (; 19 ;) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + block $2of2 + block $1of2 + block $outOfRange + global.get $~argumentsLength + i32.const 1 + i32.sub + br_table $1of2 $1of2 $2of2 $outOfRange + end + unreachable + end + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + local.set $1 + end + local.get $1 + local.tee $2 + i32.const 1073741808 + i32.gt_u + local.get $1 + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.gt_u + i32.or + if + i32.const 1040 + i32.const 1408 + i32.const 25 + i32.const 7 + call $~lib/builtins/abort + unreachable + end + i32.const 12 + i32.const 15 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $3 + i32.const 0 + i32.store + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $0 + local.set $1 + local.get $0 + local.get $3 + i32.load + local.tee $4 i32.ne if local.get $1 @@ -1554,32 +1641,28 @@ local.get $4 call $~lib/rt/pure/__release end - local.get $0 + local.get $3 local.get $1 i32.store + local.get $3 local.get $0 - local.get $2 i32.store offset=4 - local.get $0 local.get $3 + local.get $2 i32.store offset=8 - local.get $0 + local.get $3 ) - (func $~setArgumentsLength (; 19 ;) (param $0 i32) + (func $~setArgumentsLength (; 20 ;) (param $0 i32) local.get $0 global.set $~argumentsLength ) - (func $start:std/arraybuffer (; 20 ;) + (func $start:std/arraybuffer (; 21 ;) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) i32.const 8 i32.const 0 call $~lib/rt/tlsf/__alloc @@ -1588,7 +1671,7 @@ call $~lib/memory/memory.fill local.get $1 call $~lib/rt/pure/__retain - local.tee $9 + local.tee $5 i32.const 16 i32.sub i32.load offset=12 @@ -1602,7 +1685,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const 0 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1621,7 +1704,7 @@ unreachable end local.get $0 - local.get $9 + local.get $5 i32.eq if i32.const 0 @@ -1631,7 +1714,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const 1 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1651,7 +1734,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const -1 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1671,7 +1754,7 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const 1 i32.const 3 call $~lib/arraybuffer/ArrayBuffer#slice @@ -1691,14 +1774,13 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const 1 i32.const -1 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $1 local.get $0 call $~lib/rt/pure/__release - local.get $1 + local.tee $0 i32.const 16 i32.sub i32.load offset=12 @@ -1712,14 +1794,14 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const -3 i32.const -1 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $0 - local.get $1 - call $~lib/rt/pure/__release + local.set $1 local.get $0 + call $~lib/rt/pure/__release + local.get $1 i32.const 16 i32.sub i32.load offset=12 @@ -1733,14 +1815,14 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const -4 i32.const 42 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $1 - local.get $0 - call $~lib/rt/pure/__release + local.set $4 local.get $1 + call $~lib/rt/pure/__release + local.get $4 i32.const 16 i32.sub i32.load offset=12 @@ -1754,14 +1836,14 @@ call $~lib/builtins/abort unreachable end - local.get $9 + local.get $5 i32.const 42 i32.const 1073741808 call $~lib/arraybuffer/ArrayBuffer#slice - local.set $7 - local.get $1 + local.set $0 + local.get $4 call $~lib/rt/pure/__release - local.get $7 + local.get $0 i32.const 16 i32.sub i32.load offset=12 @@ -1773,7 +1855,7 @@ call $~lib/builtins/abort unreachable end - local.get $7 + local.get $0 i32.eqz if i32.const 0 @@ -1789,7 +1871,7 @@ call $~lib/rt/pure/__retain i32.const 0 call $~lib/arraybuffer/ArrayBufferView#constructor - local.set $6 + local.set $4 i32.const 16 i32.const 3 call $~lib/rt/tlsf/__alloc @@ -1797,16 +1879,16 @@ i32.const 8 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $0 + local.tee $3 i32.const 1376 i32.const 8 call $~lib/memory/memory.copy local.get $1 - local.get $0 + local.get $3 call $~lib/rt/pure/__retain i32.store local.get $1 - local.get $0 + local.get $3 i32.store offset=4 local.get $1 i32.const 8 @@ -1822,76 +1904,29 @@ call $~lib/rt/pure/__retain i32.const 2 call $~lib/arraybuffer/ArrayBufferView#constructor - local.set $4 + local.set $3 i32.const 1 global.set $~argumentsLength - local.get $6 - i32.load - local.tee $0 - i32.const 16 - i32.sub - i32.load offset=12 - local.tee $1 - local.tee $3 - i32.const 1073741808 - i32.gt_u - local.get $1 - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - i32.gt_u - i32.or - if - i32.const 1040 - i32.const 1408 - i32.const 25 - i32.const 7 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.tee $1 - i32.const 12 - i32.const 15 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.tee $8 + local.get $4 i32.load - local.tee $2 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $2 - call $~lib/rt/pure/__release - end - local.get $8 - local.get $1 - i32.store - local.get $8 - local.get $0 - i32.store offset=4 - local.get $8 - local.get $3 - i32.store offset=8 - local.get $9 + call $~lib/dataview/DataView#constructor|trampoline + local.set $2 + local.get $5 call $~lib/rt/pure/__release - local.get $7 + local.get $0 call $~lib/rt/pure/__release - local.get $6 + local.get $4 call $~lib/rt/pure/__release call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release - local.get $8 + local.get $2 call $~lib/rt/pure/__release ) - (func $~start (; 21 ;) + (func $~start (; 22 ;) call $start:std/arraybuffer ) - (func $~lib/rt/pure/decrement (; 22 ;) (param $0 i32) + (func $~lib/rt/pure/decrement (; 23 ;) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -1992,7 +2027,7 @@ i32.store offset=4 end ) - (func $~lib/rt/pure/__visit (; 23 ;) (param $0 i32) + (func $~lib/rt/pure/__visit (; 24 ;) (param $0 i32) local.get $0 i32.const 1440 i32.lt_u diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 2598cbf72e..9545b0df7e 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -3173,6 +3173,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3349,6 +3358,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $1 local.tee $5 diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index ff509ac091..9969b73849 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -1,8 +1,8 @@ (module (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) (type $i32_i32_=>_none (func (param i32 i32))) @@ -1112,7 +1112,84 @@ call $~lib/rt/pure/decrement end ) - (func $~lib/typedarray/Uint8Array#__set (; 15 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/arraybuffer/ArrayBufferView#constructor (; 15 ;) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 8 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $2 + i32.const 0 + i32.store8 + local.get $2 + i32.const 4 + i32.add + local.tee $1 + i32.const 0 + i32.store8 offset=3 + local.get $2 + i32.const 0 + i32.store8 offset=1 + local.get $2 + i32.const 0 + i32.store8 offset=2 + local.get $1 + i32.const 0 + i32.store8 offset=2 + local.get $1 + i32.const 0 + i32.store8 offset=1 + local.get $2 + i32.const 0 + i32.store8 offset=3 + local.get $1 + i32.const 0 + i32.store8 + local.get $0 + i32.eqz + if + i32.const 12 + i32.const 2 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.set $0 + end + local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $2 + local.set $1 + local.get $2 + local.get $0 + i32.load + local.tee $3 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $3 + call $~lib/rt/pure/__release + end + local.get $0 + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.store offset=4 + local.get $0 + i32.const 8 + i32.store offset=8 + local.get $0 + ) + (func $~lib/typedarray/Uint8Array#__set (; 16 ;) (param $0 i32) (param $1 i32) (param $2 i32) local.get $1 local.get $0 i32.load offset=8 @@ -1132,7 +1209,7 @@ local.get $2 i32.store8 ) - (func $~lib/dataview/DataView#constructor (; 16 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#constructor (; 17 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1156,14 +1233,23 @@ call $~lib/builtins/abort unreachable end - local.get $0 - local.set $3 - local.get $0 i32.const 12 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $4 + i32.const 0 + i32.store + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + i32.const 0 + i32.store offset=8 + local.get $0 + local.set $3 + local.get $0 + local.get $4 i32.load local.tee $5 i32.ne @@ -1187,14 +1273,14 @@ i32.store offset=8 local.get $4 ) - (func $~lib/arraybuffer/ArrayBufferView#get:byteOffset (; 17 ;) (param $0 i32) (result i32) + (func $~lib/arraybuffer/ArrayBufferView#get:byteOffset (; 18 ;) (param $0 i32) (result i32) local.get $0 i32.load offset=4 local.get $0 i32.load i32.sub ) - (func $~lib/polyfills/bswap (; 18 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 19 ;) (param $0 i32) (result i32) local.get $0 i32.const -16711936 i32.and @@ -1207,7 +1293,7 @@ i32.rotr i32.or ) - (func $~lib/dataview/DataView#getFloat32 (; 19 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $~lib/dataview/DataView#getFloat32 (; 20 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) local.get $1 i32.const 31 i32.shr_u @@ -1243,7 +1329,7 @@ f32.reinterpret_i32 end ) - (func $~lib/polyfills/bswap (; 20 ;) (param $0 i64) (result i64) + (func $~lib/polyfills/bswap (; 21 ;) (param $0 i64) (result i64) local.get $0 i64.const 8 i64.shr_u @@ -1269,7 +1355,7 @@ i64.const 32 i64.rotr ) - (func $~lib/dataview/DataView#getFloat64 (; 21 ;) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/dataview/DataView#getFloat64 (; 22 ;) (param $0 i32) (param $1 i32) (result f64) i32.const 8 local.get $0 i32.load offset=8 @@ -1295,7 +1381,7 @@ f64.reinterpret_i64 end ) - (func $~lib/dataview/DataView#getInt8 (; 22 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/dataview/DataView#getInt8 (; 23 ;) (param $0 i32) (param $1 i32) (result i32) local.get $1 local.get $0 i32.load offset=8 @@ -1314,7 +1400,7 @@ i32.add i32.load8_s ) - (func $~lib/polyfills/bswap (; 23 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 24 ;) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.shl @@ -1327,7 +1413,7 @@ i32.shl i32.or ) - (func $~lib/dataview/DataView#getInt16 (; 24 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getInt16 (; 25 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1361,7 +1447,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getInt32 (; 25 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getInt32 (; 26 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1395,7 +1481,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getInt64 (; 26 ;) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/dataview/DataView#getInt64 (; 27 ;) (param $0 i32) (param $1 i32) (result i64) (local $2 i64) i32.const 8 local.get $0 @@ -1421,7 +1507,7 @@ call $~lib/polyfills/bswap end ) - (func $~lib/dataview/DataView#getUint8 (; 27 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/dataview/DataView#getUint8 (; 28 ;) (param $0 i32) (param $1 i32) (result i32) local.get $1 local.get $0 i32.load offset=8 @@ -1440,7 +1526,7 @@ i32.add i32.load8_u ) - (func $~lib/polyfills/bswap (; 28 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 29 ;) (param $0 i32) (result i32) local.get $0 i32.const 8 i32.shl @@ -1451,7 +1537,7 @@ i32.shr_u i32.or ) - (func $~lib/dataview/DataView#getUint16 (; 29 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getUint16 (; 30 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1485,7 +1571,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getUint32 (; 30 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/dataview/DataView#getUint32 (; 31 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 i32.const 31 i32.shr_u @@ -1519,7 +1605,7 @@ end local.get $0 ) - (func $~lib/dataview/DataView#getUint64 (; 31 ;) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/dataview/DataView#getUint64 (; 32 ;) (param $0 i32) (param $1 i32) (result i64) (local $2 i64) i32.const 8 local.get $0 @@ -1545,7 +1631,7 @@ call $~lib/polyfills/bswap end ) - (func $~lib/dataview/DataView#setFloat32 (; 32 ;) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/dataview/DataView#setFloat32 (; 33 ;) (param $0 i32) (param $1 f32) (param $2 i32) i32.const 4 local.get $0 i32.load offset=8 @@ -1573,7 +1659,7 @@ i32.store end ) - (func $~lib/dataview/DataView#setFloat64 (; 33 ;) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/dataview/DataView#setFloat64 (; 34 ;) (param $0 i32) (param $1 f64) (param $2 i32) i32.const 8 local.get $0 i32.load offset=8 @@ -1601,7 +1687,7 @@ i64.store end ) - (func $~lib/dataview/DataView#setInt16 (; 34 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setInt16 (; 35 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 2 local.get $0 i32.load offset=8 @@ -1625,7 +1711,7 @@ end i32.store16 ) - (func $~lib/dataview/DataView#setInt32 (; 35 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setInt32 (; 36 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 4 local.get $0 i32.load offset=8 @@ -1649,7 +1735,7 @@ end i32.store ) - (func $~lib/dataview/DataView#setInt64 (; 36 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/dataview/DataView#setInt64 (; 37 ;) (param $0 i32) (param $1 i64) (param $2 i32) i32.const 8 local.get $0 i32.load offset=8 @@ -1673,7 +1759,7 @@ end i64.store ) - (func $~lib/dataview/DataView#setUint16 (; 37 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setUint16 (; 38 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 2 local.get $0 i32.load offset=8 @@ -1697,7 +1783,7 @@ end i32.store16 ) - (func $~lib/dataview/DataView#setUint32 (; 38 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/dataview/DataView#setUint32 (; 39 ;) (param $0 i32) (param $1 i32) (param $2 i32) i32.const 4 local.get $0 i32.load offset=8 @@ -1721,7 +1807,7 @@ end i32.store ) - (func $~lib/dataview/DataView#setUint64 (; 39 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/dataview/DataView#setUint64 (; 40 ;) (param $0 i32) (param $1 i64) (param $2 i32) i32.const 8 local.get $0 i32.load offset=8 @@ -1745,121 +1831,59 @@ end i64.store ) - (func $~setArgumentsLength (; 40 ;) (param $0 i32) + (func $~setArgumentsLength (; 41 ;) (param $0 i32) local.get $0 global.set $~argumentsLength ) - (func $start:std/dataview (; 41 ;) + (func $start:std/dataview (; 42 ;) (local $0 i32) (local $1 i32) (local $2 i32) - (local $3 i32) i32.const 12 i32.const 3 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain - local.set $3 - i32.const 8 - i32.const 0 - call $~lib/rt/tlsf/__alloc - local.tee $0 - i32.const 0 - i32.store8 - local.get $0 - i32.const 4 - i32.add - local.tee $1 - i32.const 0 - i32.store8 offset=3 - local.get $0 - i32.const 0 - i32.store8 offset=1 - local.get $0 - i32.const 0 - i32.store8 offset=2 - local.get $1 - i32.const 0 - i32.store8 offset=2 - local.get $1 - i32.const 0 - i32.store8 offset=1 - local.get $0 - i32.const 0 - i32.store8 offset=3 - local.get $1 - i32.const 0 - i32.store8 - local.get $3 - i32.eqz - if - i32.const 12 - i32.const 2 - call $~lib/rt/tlsf/__alloc - call $~lib/rt/pure/__retain - local.set $3 - end - local.get $0 + call $~lib/arraybuffer/ArrayBufferView#constructor local.tee $1 - local.get $3 - i32.load - local.tee $2 - i32.ne - if - local.get $1 - call $~lib/rt/pure/__retain - local.set $1 - local.get $2 - call $~lib/rt/pure/__release - end - local.get $3 - local.get $1 - i32.store - local.get $3 - local.get $0 - i32.store offset=4 - local.get $3 - i32.const 8 - i32.store offset=8 - local.get $3 i32.const 0 i32.const 246 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 1 i32.const 224 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 2 i32.const 88 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 3 i32.const 159 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 4 i32.const 130 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 5 i32.const 101 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 6 i32.const 67 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.const 7 i32.const 95 call $~lib/typedarray/Uint8Array#__set - local.get $3 + local.get $1 i32.load - local.get $3 + local.get $1 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset - local.get $3 + local.get $1 i32.load offset=8 call $~lib/dataview/DataView#constructor - local.tee $1 + local.tee $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1873,7 +1897,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1887,7 +1911,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1901,7 +1925,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1915,7 +1939,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -1929,7 +1953,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1943,7 +1967,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1957,7 +1981,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1971,7 +1995,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1985,7 +2009,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -1999,7 +2023,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getFloat64 f64.const 7936550095674706383278551e126 @@ -2012,7 +2036,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getFloat64 f64.const -411777475818852546741639e241 @@ -2025,7 +2049,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getInt8 i32.const -10 @@ -2038,7 +2062,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getInt8 i32.const -32 @@ -2051,7 +2075,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 call $~lib/dataview/DataView#getInt8 i32.const 88 @@ -2064,7 +2088,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 call $~lib/dataview/DataView#getInt8 i32.const -97 @@ -2077,7 +2101,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 call $~lib/dataview/DataView#getInt8 i32.const -126 @@ -2090,7 +2114,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 5 call $~lib/dataview/DataView#getInt8 i32.const 101 @@ -2103,7 +2127,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 6 call $~lib/dataview/DataView#getInt8 i32.const 67 @@ -2116,7 +2140,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 7 call $~lib/dataview/DataView#getInt8 i32.const 95 @@ -2129,7 +2153,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2145,7 +2169,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2161,7 +2185,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2177,7 +2201,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2193,7 +2217,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2209,7 +2233,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 5 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2225,7 +2249,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 6 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -2241,7 +2265,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2257,7 +2281,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2273,7 +2297,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2289,7 +2313,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2305,7 +2329,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2321,7 +2345,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 5 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2337,7 +2361,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 6 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -2353,7 +2377,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2367,7 +2391,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2381,7 +2405,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2395,7 +2419,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2409,7 +2433,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -2423,7 +2447,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2437,7 +2461,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2451,7 +2475,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2465,7 +2489,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2479,7 +2503,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -2493,7 +2517,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getInt64 i64.const 6864441868736323830 @@ -2506,7 +2530,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getInt64 i64.const -657428103485373601 @@ -2519,7 +2543,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getUint8 i32.const 246 @@ -2532,7 +2556,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getUint8 i32.const 224 @@ -2545,7 +2569,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 call $~lib/dataview/DataView#getUint8 i32.const 88 @@ -2558,7 +2582,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 call $~lib/dataview/DataView#getUint8 i32.const 159 @@ -2571,7 +2595,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 call $~lib/dataview/DataView#getUint8 i32.const 130 @@ -2584,7 +2608,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 5 call $~lib/dataview/DataView#getUint8 i32.const 101 @@ -2597,7 +2621,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 6 call $~lib/dataview/DataView#getUint8 i32.const 67 @@ -2610,7 +2634,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 7 call $~lib/dataview/DataView#getUint8 i32.const 95 @@ -2623,7 +2647,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2639,7 +2663,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2655,7 +2679,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2671,7 +2695,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2687,7 +2711,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2703,7 +2727,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 5 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2719,7 +2743,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 6 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -2735,7 +2759,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2751,7 +2775,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2767,7 +2791,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2783,7 +2807,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2799,7 +2823,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2815,7 +2839,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 5 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2831,7 +2855,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 6 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -2847,7 +2871,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2861,7 +2885,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2875,7 +2899,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2889,7 +2913,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2903,7 +2927,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -2917,7 +2941,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2931,7 +2955,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2945,7 +2969,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 2 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2959,7 +2983,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 3 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2973,7 +2997,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 4 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -2987,7 +3011,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getUint64 i64.const 6864441868736323830 @@ -3000,7 +3024,7 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getUint64 i64.const -657428103485373601 @@ -3013,11 +3037,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 f32.const 1.5976661625240943e-18 i32.const 1 call $~lib/dataview/DataView#setFloat32 - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getFloat32 @@ -3031,11 +3055,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 f32.const 1976281973381696323584 i32.const 0 call $~lib/dataview/DataView#setFloat32 - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getFloat32 @@ -3049,11 +3073,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 f64.const -1094252199637739024055454e124 i32.const 1 call $~lib/dataview/DataView#setFloat64 - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getFloat64 f64.const -1094252199637739024055454e124 @@ -3066,11 +3090,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 f64.const 6.022586634778589e-103 i32.const 0 call $~lib/dataview/DataView#setFloat64 - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getFloat64 f64.const 6.022586634778589e-103 @@ -3084,7 +3108,7 @@ unreachable end i32.const 0 - local.get $1 + local.get $0 i32.load offset=8 i32.ge_u if @@ -3095,11 +3119,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.load offset=4 i32.const 108 i32.store8 - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getInt8 i32.const 108 @@ -3112,11 +3136,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const -13360 i32.const 1 call $~lib/dataview/DataView#setInt16 - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 @@ -3132,11 +3156,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 14689 i32.const 0 call $~lib/dataview/DataView#setInt16 - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 @@ -3152,11 +3176,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 1204680201 i32.const 1 call $~lib/dataview/DataView#setInt32 - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt32 @@ -3170,11 +3194,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 660673230 i32.const 0 call $~lib/dataview/DataView#setInt32 - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt32 @@ -3188,11 +3212,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i64.const -3290739641816099749 i32.const 1 call $~lib/dataview/DataView#setInt64 - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getInt64 i64.const -3290739641816099749 @@ -3205,11 +3229,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i64.const 8178932412950708047 i32.const 0 call $~lib/dataview/DataView#setInt64 - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getInt64 i64.const 8178932412950708047 @@ -3223,7 +3247,7 @@ unreachable end i32.const 0 - local.get $1 + local.get $0 i32.load offset=8 i32.ge_u if @@ -3234,11 +3258,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.load offset=4 i32.const 238 i32.store8 - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getUint8 i32.const 238 @@ -3251,11 +3275,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 58856 i32.const 1 call $~lib/dataview/DataView#setUint16 - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint16 @@ -3271,11 +3295,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const 60400 i32.const 0 call $~lib/dataview/DataView#setUint16 - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint16 @@ -3291,11 +3315,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const -846805744 i32.const 1 call $~lib/dataview/DataView#setUint32 - local.get $1 + local.get $0 i32.const 0 i32.const 1 call $~lib/dataview/DataView#getUint32 @@ -3309,11 +3333,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i32.const -1510791631 i32.const 0 call $~lib/dataview/DataView#setUint32 - local.get $1 + local.get $0 i32.const 0 i32.const 0 call $~lib/dataview/DataView#getUint32 @@ -3327,11 +3351,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i64.const 2334704782995986958 i32.const 1 call $~lib/dataview/DataView#setUint64 - local.get $1 + local.get $0 i32.const 1 call $~lib/dataview/DataView#getUint64 i64.const 2334704782995986958 @@ -3344,11 +3368,11 @@ call $~lib/builtins/abort unreachable end - local.get $1 + local.get $0 i64.const -7123186897289856329 i32.const 0 call $~lib/dataview/DataView#setUint64 - local.get $1 + local.get $0 i32.const 0 call $~lib/dataview/DataView#getUint64 i64.const -7123186897289856329 @@ -3363,21 +3387,19 @@ end i32.const 1 global.set $~argumentsLength - local.get $3 + local.get $1 i32.load - local.tee $0 + local.tee $2 + i32.const 0 + local.get $2 i32.const 16 i32.sub i32.load offset=12 + call $~lib/dataview/DataView#constructor local.set $2 local.get $0 - i32.const 0 - local.get $2 - call $~lib/dataview/DataView#constructor - local.set $0 - local.get $1 call $~lib/rt/pure/__release - local.get $0 + local.get $2 call $~lib/arraybuffer/ArrayBufferView#get:byteOffset if i32.const 0 @@ -3387,7 +3409,7 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $2 i32.load offset=8 i32.const 8 i32.ne @@ -3399,15 +3421,15 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $1 call $~lib/rt/pure/__release - local.get $0 + local.get $2 call $~lib/rt/pure/__release ) - (func $~start (; 42 ;) + (func $~start (; 43 ;) call $start:std/dataview ) - (func $~lib/rt/pure/decrement (; 43 ;) (param $0 i32) + (func $~lib/rt/pure/decrement (; 44 ;) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 68f32c0301..d1d8c93dd1 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -1730,6 +1730,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -1834,6 +1843,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $1 local.tee $5 diff --git a/tests/compiler/std/date.optimized.wat b/tests/compiler/std/date.optimized.wat index 21e021db7e..2ea348a961 100644 --- a/tests/compiler/std/date.optimized.wat +++ b/tests/compiler/std/date.optimized.wat @@ -144,6 +144,9 @@ i32.const 8 i32.store i32.const 1088 + i64.const 0 + i64.store + i32.const 1088 local.get $2 i64.store i32.const 1088 diff --git a/tests/compiler/std/date.untouched.wat b/tests/compiler/std/date.untouched.wat index 853d438755..e3f946a94f 100644 --- a/tests/compiler/std/date.untouched.wat +++ b/tests/compiler/std/date.untouched.wat @@ -143,6 +143,9 @@ local.set $0 end local.get $0 + i64.const 0 + i64.store + local.get $0 local.get $1 i64.store local.get $0 diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 57ee770873..c445e26c40 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -2101,11 +2101,11 @@ (local $8 i32) local.get $0 i32.load offset=8 - local.set $6 + local.set $5 local.get $0 i32.load offset=16 - local.tee $5 - local.tee $0 + local.tee $4 + local.tee $8 i32.const 1073741808 i32.gt_u if @@ -2116,79 +2116,89 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $8 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $3 - local.get $0 + local.tee $2 + local.get $8 call $~lib/memory/memory.fill - local.get $0 - local.set $1 - local.get $3 - local.set $2 - local.get $3 i32.const 16 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load - local.tee $4 + local.tee $3 i32.ne if - local.get $2 + local.get $1 call $~lib/rt/pure/__retain - local.set $2 - local.get $4 + local.set $1 + local.get $3 call $~lib/rt/pure/__release end local.get $0 - local.get $2 + local.get $1 i32.store local.get $0 - local.get $3 + local.get $2 i32.store offset=4 local.get $0 - local.get $1 + local.get $8 i32.store offset=8 local.get $0 - local.get $1 + local.get $8 i32.store offset=12 loop $for-loop|0 - local.get $7 - local.get $5 + local.get $6 + local.get $4 i32.lt_s if + local.get $5 local.get $6 - local.get $7 i32.const 12 i32.mul i32.add - local.tee $3 + local.tee $2 i32.load offset=8 i32.const 1 i32.and i32.eqz if local.get $0 - local.get $8 - local.get $3 + local.get $7 + local.get $2 i32.load8_s call $~lib/array/Array#__set - local.get $8 + local.get $7 i32.const 1 i32.add - local.set $8 + 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 $8 + local.get $7 call $~lib/array/Array#set:length local.get $0 ) @@ -2218,14 +2228,26 @@ local.tee $1 local.get $4 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 5 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 + i32.const 0 + i32.store + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $3 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $3 i32.load local.tee $5 i32.ne @@ -3855,11 +3877,11 @@ (local $8 i32) local.get $0 i32.load offset=8 - local.set $6 + local.set $5 local.get $0 i32.load offset=16 - local.tee $5 - local.tee $0 + local.tee $4 + local.tee $8 i32.const 1073741808 i32.gt_u if @@ -3870,79 +3892,89 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $8 i32.const 0 call $~lib/rt/tlsf/__alloc - local.tee $3 - local.get $0 + local.tee $2 + local.get $8 call $~lib/memory/memory.fill - local.get $0 - local.set $1 - local.get $3 - local.set $2 - local.get $3 i32.const 16 i32.const 9 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load - local.tee $4 + local.tee $3 i32.ne if - local.get $2 + local.get $1 call $~lib/rt/pure/__retain - local.set $2 - local.get $4 + local.set $1 + local.get $3 call $~lib/rt/pure/__release end local.get $0 - local.get $2 + local.get $1 i32.store local.get $0 - local.get $3 + local.get $2 i32.store offset=4 local.get $0 - local.get $1 + local.get $8 i32.store offset=8 local.get $0 - local.get $1 + local.get $8 i32.store offset=12 loop $for-loop|0 - local.get $7 - local.get $5 + local.get $6 + local.get $4 i32.lt_s if + local.get $5 local.get $6 - local.get $7 i32.const 12 i32.mul i32.add - local.tee $3 + local.tee $2 i32.load offset=8 i32.const 1 i32.and i32.eqz if local.get $0 - local.get $8 - local.get $3 + local.get $7 + local.get $2 i32.load8_u call $~lib/array/Array#__set - local.get $8 + local.get $7 i32.const 1 i32.add - local.set $8 + 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 $8 + local.get $7 call $~lib/array/Array#set:length local.get $0 ) @@ -5184,14 +5216,26 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 12 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $3 i32.ne @@ -6404,14 +6448,26 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 15 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $3 i32.ne @@ -7888,14 +7944,26 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 18 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $3 i32.ne @@ -8901,14 +8969,26 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 21 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $3 i32.ne @@ -9906,14 +9986,26 @@ local.tee $2 local.get $5 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 24 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $3 i32.ne @@ -10783,14 +10875,26 @@ local.tee $2 local.get $6 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 27 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $4 i32.ne @@ -11997,14 +12101,26 @@ local.tee $2 local.get $6 call $~lib/memory/memory.fill - local.get $2 - local.set $1 - local.get $2 i32.const 16 i32.const 30 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $2 + local.set $1 + local.get $2 + local.get $0 i32.load local.tee $4 i32.ne diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index b967777f40..c166b63fde 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -2213,6 +2213,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -3897,6 +3909,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -5990,6 +6014,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -7693,6 +7729,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -9394,6 +9442,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -11770,6 +11830,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -13495,6 +13567,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -15143,6 +15227,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -16795,6 +16891,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -18450,6 +18558,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 0a99303010..2d8da9dc2e 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -2084,7 +2084,7 @@ local.get $0 i32.load offset=16 local.tee $7 - local.tee $0 + local.tee $4 i32.const 1073741808 i32.gt_u if @@ -2095,22 +2095,32 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $4 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $1 - local.get $0 + local.get $4 call $~lib/memory/memory.fill - local.get $0 - local.set $3 - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 4 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $8 i32.ne @@ -2128,10 +2138,10 @@ local.get $1 i32.store offset=4 local.get $0 - local.get $3 + local.get $4 i32.store offset=8 local.get $0 - local.get $3 + local.get $4 i32.store offset=12 loop $for-loop|0 local.get $5 @@ -2149,11 +2159,11 @@ i32.and i32.eqz if - local.get $4 + local.get $3 local.tee $1 i32.const 1 i32.add - local.set $4 + local.set $3 local.get $0 local.get $1 local.get $2 @@ -2838,7 +2848,7 @@ local.get $0 i32.load offset=16 local.tee $7 - local.tee $0 + local.tee $4 i32.const 1073741808 i32.gt_u if @@ -2849,22 +2859,32 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $4 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $1 - local.get $0 + local.get $4 call $~lib/memory/memory.fill - local.get $0 - local.set $3 - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 6 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $8 i32.ne @@ -2882,10 +2902,10 @@ local.get $1 i32.store offset=4 local.get $0 - local.get $3 + local.get $4 i32.store offset=8 local.get $0 - local.get $3 + local.get $4 i32.store offset=12 loop $for-loop|0 local.get $5 @@ -2903,11 +2923,11 @@ i32.and i32.eqz if - local.get $4 + local.get $3 local.tee $1 i32.const 1 i32.add - local.set $4 + local.set $3 local.get $0 local.get $1 local.get $2 @@ -3704,14 +3724,26 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 8 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $9 i32.ne @@ -4463,14 +4495,26 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 10 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $9 i32.ne @@ -5318,14 +5362,26 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 12 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $9 i32.ne @@ -5830,14 +5886,26 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 14 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $9 i32.ne @@ -6663,14 +6731,26 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 16 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $9 i32.ne @@ -7177,14 +7257,26 @@ local.tee $1 local.get $7 call $~lib/memory/memory.fill - local.get $1 - local.set $2 - local.get $1 i32.const 16 i32.const 18 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + local.set $2 + local.get $1 + local.get $0 i32.load local.tee $9 i32.ne @@ -7878,14 +7970,26 @@ local.tee $0 local.get $7 call $~lib/memory/memory.fill - local.get $0 - local.set $1 - local.get $0 i32.const 16 i32.const 20 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 + i32.const 0 + i32.store + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $3 + i32.const 0 + i32.store offset=12 + local.get $0 + local.set $1 + local.get $0 + local.get $3 i32.load local.tee $9 i32.ne @@ -8694,14 +8798,26 @@ local.tee $0 local.get $7 call $~lib/memory/memory.fill - local.get $0 - local.set $1 - local.get $0 i32.const 16 i32.const 22 call $~lib/rt/tlsf/__alloc call $~lib/rt/pure/__retain local.tee $3 + i32.const 0 + i32.store + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $3 + i32.const 0 + i32.store offset=12 + local.get $0 + local.set $1 + local.get $0 + local.get $3 i32.load local.tee $9 i32.ne diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 35e8a033d2..cd4f6ccebd 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -2161,6 +2161,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -4685,6 +4697,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -5731,6 +5755,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -6759,6 +6795,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -7813,6 +7861,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -8811,6 +8871,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -9899,6 +9971,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -10901,6 +10985,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -11906,6 +12002,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 @@ -12912,6 +13020,18 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 local.tee $4 local.get $3 local.tee $5 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 951351a19c..d29c1b9471 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1479,12 +1479,12 @@ local.get $1 local.get $2 i32.shl - local.tee $4 + local.tee $3 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $2 i32.const 0 - local.get $4 + local.get $3 call $~lib/memory/memory.fill local.get $0 i32.eqz @@ -1495,30 +1495,38 @@ call $~lib/rt/pure/__retain local.set $0 end + local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 local.get $2 local.tee $1 local.get $0 i32.load - local.tee $3 + local.tee $4 i32.ne if local.get $1 call $~lib/rt/pure/__retain local.set $1 - local.get $3 + local.get $4 call $~lib/rt/pure/__release end local.get $0 - local.tee $3 local.get $1 i32.store - local.get $3 + local.get $0 local.get $2 i32.store offset=4 + local.get $0 local.get $3 - local.get $4 i32.store offset=8 - local.get $3 + local.get $0 ) (func $~lib/typedarray/Int8Array#constructor (; 20 ;) (param $0 i32) (result i32) i32.const 12 diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index b4fc46cdf8..199db6a10c 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -1913,6 +1913,15 @@ local.set $0 end local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 local.tee $4 local.get $3 local.tee $5 From dc4767273d563d3d44afb848387ce93281309216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Tue, 31 Mar 2020 11:39:17 -0400 Subject: [PATCH 12/14] Fix style in flow field flags Co-Authored-By: Max Graey --- src/flow.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flow.ts b/src/flow.ts index b5473bbe4c..9ed50d6784 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -543,12 +543,12 @@ export class Flow { isFieldFlag(name: string, flag: FieldFlags): bool { const fieldFlags = this.fieldFlags; - if ((fieldFlags !== null) && fieldFlags.has(name)) { - const flags = assert(fieldFlags.get(name)); - return (flags & flag) == flag; - } - return false; + if (fieldFlags !== null && fieldFlags.has(name)) { + const flags = assert(fieldFlags.get(name)); + return (flags & flag) == flag; } + return false; + } /** Pushes a new break label to the stack, for example when entering a loop that one can `break` from. */ pushBreakLabel(): string { From 97e38fc32321a189f153ae06eeb53fd1e14f0b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Tue, 31 Mar 2020 11:39:29 -0400 Subject: [PATCH 13/14] Fix style in flow field flags Co-Authored-By: Max Graey --- src/flow.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/flow.ts b/src/flow.ts index 9ed50d6784..8cea063fd1 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -847,9 +847,12 @@ export class Flow { * if both flows definitely define the flags. */ mergeFieldFlags(left: Flow, right: Flow): void { - if (left.fieldFlags !== null && - right.fieldFlags !== null && - right.fieldFlags.size > 0 + const leftFieldFlags = left.fieldFlags; + const rightFieldFlags = right.fieldFlags; + if ( + leftFieldFlags !== null && + rightFieldFlags !== null && + rightFieldFlags.size > 0 ) { const rightFieldFlags = right.fieldFlags; const rightKeys = Map_keys(rightFieldFlags!); From 4053e4c1cfbca2085b6ce5c3bc5f198c61197770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Tue, 31 Mar 2020 11:39:40 -0400 Subject: [PATCH 14/14] Fix style in flow field flags Co-Authored-By: Max Graey --- src/flow.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/flow.ts b/src/flow.ts index 8cea063fd1..860de10e6b 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -854,12 +854,9 @@ export class Flow { rightFieldFlags !== null && rightFieldFlags.size > 0 ) { - const rightFieldFlags = right.fieldFlags; const rightKeys = Map_keys(rightFieldFlags!); const rightValues = Map_values(rightFieldFlags!); - const leftFieldFlags = left.fieldFlags; - for (let i = 0, k = rightValues.length; i < k; ++i) { const rightValue = unchecked(rightValues[i]); const rightKey = unchecked(rightKeys[i]); @@ -876,14 +873,14 @@ export class Flow { /** Inherits the fields flags of the given flow into the current flow */ inheritFieldFlags(other: Flow): void { + const currentFieldFlags = this.fieldFlags; + const otherFieldFlags = other.fieldFlags; if ( - this.fieldFlags !== null && - other.fieldFlags !== null + currentFieldFlags !== null && + otherFieldFlags !== null ) { - const otherFieldFlags = other.fieldFlags; const otherKeys = Map_keys(otherFieldFlags!); const otherValues = Map_values(otherFieldFlags!); - const currentFieldFlags = this.fieldFlags; for (let i = 0, k = otherValues.length; i < k; ++i) { const key = otherKeys[i];