diff --git a/src/compiler.ts b/src/compiler.ts index 1c27c991e0..4cf331166e 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -8682,12 +8682,26 @@ export class Compiler extends DiagnosticEmitter { var values = expression.values; var members = classReference.members; var hasErrors = false; - var exprs = new Array(numNames + 2); + var exprs = new Array(); var flow = this.currentFlow; var tempLocal = isManaged ? flow.getAutoreleaseLocal(classReference.type) : flow.getTempLocal(classReference.type); assert(numNames == values.length); + + // Assume all class fields will be omitted, and add them to our omitted list + let omittedClassFieldMembers = new Set(); + if (members) { + for (let _keys = Map_keys(members), i = 0, k = _keys.length; i < k; ++i) { + let memberKey = _keys[i]; + let member = assert(members.get(memberKey)); + if (member !== null && member.kind == ElementKind.FIELD) { + omittedClassFieldMembers.add(member.name); + } + } + } + + // Iterate through the members defined in our expression for (let i = 0, k = numNames; i < k; ++i) { let member = members ? members.get(names[i].text) : null; if (!member || member.kind != ElementKind.FIELD) { @@ -8700,27 +8714,93 @@ export class Compiler extends DiagnosticEmitter { } let fieldInstance = member; let fieldType = fieldInstance.type; - exprs[i + 1] = this.module.store( // TODO: handle setters as well + + let expr = this.compileExpression(values[i], fieldType, Constraints.CONV_IMPLICIT | Constraints.WILL_RETAIN); + if (isManaged && fieldType.isManaged && !this.skippedAutoreleases.has(expr)) { + expr = this.makeRetain(expr); + } + exprs.push(this.module.store( // TODO: handle setters as well fieldType.byteSize, this.module.local_get(tempLocal.index, this.options.nativeSizeType), - this.compileExpression(values[i], fieldInstance.type, Constraints.CONV_IMPLICIT), + expr, fieldType.toNativeType(), fieldInstance.memoryOffset - ); + )); + + // This member is no longer omitted, so delete from our omitted fields + omittedClassFieldMembers.delete(member.name); } this.currentType = classReference.type.nonNullableType; if (hasErrors) return module.unreachable(); + // Iterate through the remaining omittedClassFieldMembers. + if (members) { + + for (let _values = Set_values(omittedClassFieldMembers), j = 0, l = _values.length; j < l; ++j) { + let omittedMemberKey = _values[j]; + let member = assert(members.get(omittedMemberKey)); + + let fieldInstance = member; + let fieldType = fieldInstance.type; + + if (fieldType.is(TypeFlags.REFERENCE) && fieldType.classReference !== null) { + // TODO: Check if it is a class, with a default value (constructor with no params). + if (!fieldType.is(TypeFlags.NULLABLE)) { + this.error( + DiagnosticCode.Property_0_is_missing_in_type_1_but_required_in_type_2, + expression.range, "", classReference.toString() + ); + hasErrors = true; + continue; + } + } + + switch(fieldType.kind) { + // Number Types (and Number alias types) + case TypeKind.I8: + case TypeKind.I16: + case TypeKind.I32: + case TypeKind.U8: + case TypeKind.U16: + case TypeKind.U32: + case TypeKind.USIZE: + case TypeKind.ISIZE: + case TypeKind.BOOL: + case TypeKind.I64: + case TypeKind.U64: + case TypeKind.F32: + case TypeKind.F64: { + exprs.push(this.module.store( // TODO: handle setters as well + fieldType.byteSize, + this.module.local_get(tempLocal.index, this.options.nativeSizeType), + this.makeZero(fieldType), + fieldType.toNativeType(), + fieldInstance.memoryOffset + )); + continue; + } + } + + // Otherwise, error + this.error( + DiagnosticCode.Property_0_is_missing_in_type_1_but_required_in_type_2, + expression.range, "", classReference.toString() + ); + hasErrors = true; + } + } + if (hasErrors) return module.unreachable(); + // allocate a new instance first and assign 'this' to the temp. local - exprs[0] = module.local_set( + exprs.unshift(module.local_set( tempLocal.index, isManaged ? this.makeRetain(this.makeAllocation(classReference)) : this.makeAllocation(classReference) - ); + )); // once all field values have been set, return 'this' - exprs[exprs.length - 1] = module.local_get(tempLocal.index, this.options.nativeSizeType); + exprs.push(module.local_get(tempLocal.index, this.options.nativeSizeType)); if (!isManaged) flow.freeTempLocal(tempLocal); this.currentType = classReference.type; diff --git a/src/diagnosticMessages.generated.ts b/src/diagnosticMessages.generated.ts index 45988f1d65..464c749203 100644 --- a/src/diagnosticMessages.generated.ts +++ b/src/diagnosticMessages.generated.ts @@ -150,6 +150,7 @@ export enum DiagnosticCode { Namespace_0_has_no_exported_member_1 = 2694, Required_type_parameters_may_not_follow_optional_type_parameters = 2706, Duplicate_property_0 = 2718, + Property_0_is_missing_in_type_1_but_required_in_type_2 = 2741, Type_0_has_no_call_signatures = 2757, File_0_not_found = 6054, Numeric_separators_are_not_allowed_here = 6188, @@ -304,6 +305,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2694: return "Namespace '{0}' has no exported member '{1}'."; case 2706: return "Required type parameters may not follow optional type parameters."; case 2718: return "Duplicate property '{0}'."; + case 2741: return "Property '{0}' is missing in type '{1}' but required in type '{2}'."; case 2757: return "Type '{0}' has no call signatures."; case 6054: return "File '{0}' not found."; case 6188: return "Numeric separators are not allowed here."; diff --git a/src/diagnosticMessages.json b/src/diagnosticMessages.json index 94ef96a447..eb7a2771cb 100644 --- a/src/diagnosticMessages.json +++ b/src/diagnosticMessages.json @@ -146,6 +146,7 @@ "Namespace '{0}' has no exported member '{1}'.": 2694, "Required type parameters may not follow optional type parameters.": 2706, "Duplicate property '{0}'.": 2718, + "Property '{0}' is missing in type '{1}' but required in type '{2}'.": 2741, "Type '{0}' has no call signatures.": 2757, "File '{0}' not found.": 6054, diff --git a/tests/compiler/std/object-literal-omitted.json b/tests/compiler/std/object-literal-omitted.json new file mode 100644 index 0000000000..a499d3adfc --- /dev/null +++ b/tests/compiler/std/object-literal-omitted.json @@ -0,0 +1,5 @@ +{ + "asc_flags": [ + "--runtime full" + ] +} diff --git a/tests/compiler/std/object-literal-omitted.optimized.wat b/tests/compiler/std/object-literal-omitted.optimized.wat new file mode 100644 index 0000000000..a70a39a38b --- /dev/null +++ b/tests/compiler/std/object-literal-omitted.optimized.wat @@ -0,0 +1,1587 @@ +(module + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") + (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") + (data (i32.const 1136) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") + (data (i32.const 1184) ":\00\00\00\01\00\00\00\01\00\00\00:\00\00\00s\00t\00d\00/\00o\00b\00j\00e\00c\00t\00-\00l\00i\00t\00e\00r\00a\00l\00-\00o\00m\00i\00t\00t\00e\00d\00.\00t\00s") + (data (i32.const 1264) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00t\00e\00s\00t") + (data (i32.const 1296) "\05\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 ") + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 1296)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (start $~start) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.tee $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 256 + i32.lt_u + if + local.get $2 + i32.const 4 + i32.shr_u + local.set $2 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $2 + local.get $4 + i32.const 7 + i32.sub + local.set $4 + end + local.get $2 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=20 + local.set $3 + local.get $1 + i32.load offset=16 + local.tee $5 + if + local.get $5 + local.get $3 + i32.store offset=20 + end + local.get $3 + if + local.get $3 + local.get $5 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.get $2 + local.get $4 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.get $2 + local.get $4 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + local.get $3 + i32.store offset=96 + local.get $3 + i32.eqz + if + local.get $0 + local.get $4 + i32.const 2 + i32.shl + i32.add + local.tee $3 + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.const -1 + i32.xor + i32.and + local.set $1 + local.get $3 + local.get $1 + i32.store offset=4 + local.get $1 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.tee $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.tee $5 + i32.const 1 + i32.and + if + local.get $3 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const -4 + i32.and + i32.add + local.tee $2 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + local.get $3 + i32.const 3 + i32.and + i32.or + local.tee $3 + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $5 + end + end + local.get $3 + i32.const 2 + i32.and + if + local.get $1 + i32.const 4 + i32.sub + i32.load + local.tee $2 + i32.load + local.tee $7 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $7 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $3 + i32.const -4 + i32.and + i32.add + local.tee $8 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $2 + call $~lib/rt/tlsf/removeBlock + local.get $2 + local.get $8 + local.get $7 + i32.const 3 + i32.and + i32.or + local.tee $3 + i32.store + local.get $2 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $3 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $1 + i32.const 16 + i32.add + i32.add + local.get $4 + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $2 + i32.const 256 + i32.lt_u + if + local.get $2 + i32.const 4 + i32.shr_u + local.set $2 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $3 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $2 + local.get $3 + i32.const 7 + i32.sub + local.set $6 + end + local.get $2 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $6 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + local.get $6 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $3 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $3 + i32.store offset=20 + local.get $3 + if + local.get $3 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.get $2 + local.get $6 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + local.get $1 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $6 + i32.shl + i32.or + i32.store + local.get $0 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.tee $0 + local.get $0 + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.or + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + local.get $2 + i32.le_u + select + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=1568 + local.tee $3 + if + local.get $1 + local.get $3 + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 1040 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + local.get $1 + i32.const 16 + i32.sub + i32.eq + if + local.get $3 + i32.load + local.set $4 + local.get $1 + i32.const 16 + i32.sub + local.set $1 + end + else + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 1040 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.tee $2 + i32.const 48 + i32.lt_u + if + return + end + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $2 + i32.const 32 + i32.sub + i32.const 1 + i32.or + i32.or + i32.store + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.tee $2 + i32.const 2 + i32.store + local.get $0 + local.get $2 + i32.store offset=1568 + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + global.get $~lib/rt/tlsf/ROOT + local.tee $0 + i32.eqz + if + i32.const 1 + memory.size + local.tee $0 + i32.gt_s + if (result i32) + i32.const 1 + local.get $0 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + i32.const 1344 + local.tee $0 + i32.const 0 + i32.store + i32.const 2912 + i32.const 0 + i32.store + loop $for-loop|0 + local.get $1 + i32.const 23 + i32.lt_u + if + local.get $1 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + i32.const 0 + i32.store offset=4 + i32.const 0 + local.set $2 + loop $for-loop|1 + local.get $2 + i32.const 16 + i32.lt_u + if + local.get $2 + local.get $1 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.const 1344 + i32.add + i32.const 0 + i32.store offset=96 + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $for-loop|1 + end + end + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $for-loop|0 + end + end + i32.const 1344 + i32.const 2928 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + i32.const 1344 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + local.get $1 + i32.const 4 + i32.shr_u + local.set $1 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.set $1 + end + local.get $1 + i32.const 31 + local.get $1 + i32.clz + i32.sub + local.tee $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $1 + local.get $2 + i32.const 7 + i32.sub + local.set $2 + end + local.get $1 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $2 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const -1 + local.get $1 + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.get $2 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.tee $1 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + i32.ctz + local.get $1 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + i32.const 0 + end + end + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.load + local.set $3 + local.get $2 + i32.const 15 + i32.and + if + i32.const 0 + i32.const 1040 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const -4 + i32.and + local.get $2 + i32.sub + local.tee $4 + i32.const 32 + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $2 + local.get $1 + i32.const 16 + i32.add + i32.add + local.tee $1 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const -2 + i32.and + i32.store + local.get $1 + i32.const 16 + i32.add + local.tee $0 + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.get $0 + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + i32.load + i32.const -3 + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/tlsf/collectLock + if + i32.const 0 + i32.const 1040 + i32.const 501 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1073741808 + i32.ge_u + if + i32.const 1088 + i32.const 1040 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 15 + i32.add + i32.const -16 + i32.and + local.tee $3 + i32.const 16 + local.get $3 + i32.const 16 + i32.gt_u + select + local.tee $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 16 + memory.size + local.tee $3 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + i32.load offset=1568 + i32.ne + i32.shl + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.get $4 + local.get $4 + i32.const 536870904 + i32.lt_u + select + i32.add + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.set $5 + local.get $3 + local.get $5 + local.get $3 + local.get $5 + i32.gt_s + select + memory.grow + i32.const 0 + i32.lt_s + if + local.get $5 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + local.get $0 + local.get $3 + i32.const 16 + i32.shl + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + local.get $0 + local.get $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 513 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + end + local.get $3 + i32.load + i32.const -4 + i32.and + local.get $4 + i32.lt_u + if + i32.const 0 + i32.const 1040 + i32.const 521 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + local.get $2 + i32.store offset=8 + local.get $3 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $3 + local.get $4 + call $~lib/rt/tlsf/prepareBlock + local.get $3 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1340 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + local.tee $1 + i32.load offset=4 + local.tee $2 + i32.const -268435456 + i32.and + local.get $2 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.ne + if + i32.const 0 + i32.const 1152 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.get $2 + i32.const 1 + i32.add + i32.store offset=4 + local.get $1 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + i32.const 1340 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $std/object-literal-omitted/testOmittedTypes (param $0 i32) + local.get $0 + i32.load + if + i32.const 0 + i32.const 1200 + i32.const 19 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=4 + if + i32.const 0 + i32.const 1200 + i32.const 20 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i64.load offset=8 + i64.eqz + i32.eqz + if + i32.const 0 + i32.const 1200 + i32.const 21 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i64.load offset=16 + i64.eqz + i32.eqz + if + i32.const 0 + i32.const 1200 + i32.const 22 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f32.load offset=24 + f32.const 0 + f32.ne + if + i32.const 0 + i32.const 1200 + i32.const 23 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f64.load offset=32 + f64.const 0 + f64.ne + if + i32.const 0 + i32.const 1200 + i32.const 24 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_s offset=40 + if + i32.const 0 + i32.const 1200 + i32.const 25 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=41 + if + i32.const 0 + i32.const 1200 + i32.const 26 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load16_s offset=42 + if + i32.const 0 + i32.const 1200 + i32.const 27 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load16_u offset=44 + if + i32.const 0 + i32.const 1200 + i32.const 28 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=48 + if + i32.const 0 + i32.const 1200 + i32.const 29 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=52 + if + i32.const 0 + i32.const 1200 + i32.const 30 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f64.load offset=56 + f64.const 0 + f64.ne + if + i32.const 0 + i32.const 1200 + i32.const 31 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=64 + if + i32.const 0 + i32.const 1200 + i32.const 32 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/string/String#get:length (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 1 + i32.shr_u + ) + (func $~lib/util/string/compareImpl (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + i32.const 1280 + local.set $3 + local.get $0 + i32.const 7 + i32.and + i32.eqz + i32.const 0 + local.get $1 + i32.const 4 + i32.ge_u + select + if + loop $do-continue|0 + local.get $0 + i64.load + local.get $3 + i64.load + i64.eq + if + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $3 + i32.const 8 + i32.add + local.set $3 + local.get $1 + i32.const 4 + i32.sub + local.tee $1 + i32.const 4 + i32.ge_u + br_if $do-continue|0 + end + end + end + loop $while-continue|1 + local.get $1 + local.tee $2 + i32.const 1 + i32.sub + local.set $1 + local.get $2 + if + local.get $3 + i32.load16_u + local.tee $2 + local.get $0 + i32.load16_u + local.tee $4 + i32.ne + if + local.get $4 + local.get $2 + i32.sub + return + end + local.get $0 + i32.const 2 + i32.add + local.set $0 + local.get $3 + i32.const 2 + i32.add + local.set $3 + br $while-continue|1 + end + end + i32.const 0 + ) + (func $start:std/object-literal-omitted + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 65 + i32.const 3 + 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 + i64.const 0 + i64.store offset=8 + local.get $0 + i64.const 0 + i64.store offset=16 + local.get $0 + f32.const 0 + f32.store offset=24 + local.get $0 + f64.const 0 + f64.store offset=32 + local.get $0 + i32.const 0 + i32.store8 offset=40 + local.get $0 + i32.const 0 + i32.store8 offset=41 + local.get $0 + i32.const 0 + i32.store16 offset=42 + local.get $0 + i32.const 0 + i32.store16 offset=44 + local.get $0 + i32.const 0 + i32.store offset=48 + local.get $0 + i32.const 0 + i32.store offset=52 + local.get $0 + f64.const 0 + f64.store offset=56 + local.get $0 + i32.const 0 + i32.store8 offset=64 + local.get $0 + call $std/object-literal-omitted/testOmittedTypes + i32.const 16 + i32.const 4 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $1 + i32.const 0 + i32.store + local.get $1 + i32.const 1280 + i32.store offset=4 + local.get $1 + f64.const 0 + f64.store offset=8 + local.get $1 + i32.load + if + i32.const 0 + i32.const 1200 + i32.const 44 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + block $__inlined_func$~lib/string/String.__eq (result i32) + i32.const 1 + local.get $1 + i32.load offset=4 + local.tee $2 + i32.const 1280 + i32.eq + br_if $__inlined_func$~lib/string/String.__eq + drop + i32.const 0 + i32.const 0 + i32.const 1 + local.get $2 + select + br_if $__inlined_func$~lib/string/String.__eq + drop + i32.const 0 + local.get $2 + call $~lib/string/String#get:length + local.tee $3 + i32.const 1280 + call $~lib/string/String#get:length + i32.ne + br_if $__inlined_func$~lib/string/String.__eq + drop + local.get $2 + local.get $3 + call $~lib/util/string/compareImpl + i32.eqz + end + i32.eqz + if + i32.const 0 + i32.const 1200 + i32.const 45 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $1 + f64.load offset=8 + f64.const 0 + f64.ne + if + i32.const 0 + i32.const 1200 + i32.const 46 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + ) + (func $~start + call $start:std/object-literal-omitted + ) + (func $~lib/rt/pure/__collect + nop + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.tee $2 + i32.const 268435455 + i32.and + local.set $1 + local.get $0 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1 + i32.eq + if + block $__inlined_func$~lib/rt/__visit_members + block $switch$1$default + block $switch$1$case$6 + block $switch$1$case$4 + local.get $0 + i32.const 16 + i32.add + local.tee $1 + i32.const 8 + i32.sub + i32.load + br_table $__inlined_func$~lib/rt/__visit_members $__inlined_func$~lib/rt/__visit_members $switch$1$case$4 $__inlined_func$~lib/rt/__visit_members $switch$1$case$6 $switch$1$default + end + local.get $1 + i32.load + local.tee $1 + if + local.get $1 + call $~lib/rt/pure/__visit + end + br $__inlined_func$~lib/rt/__visit_members + end + local.get $1 + i32.load offset=4 + local.tee $1 + if + local.get $1 + call $~lib/rt/pure/__visit + end + br $__inlined_func$~lib/rt/__visit_members + end + unreachable + end + local.get $2 + i32.const -2147483648 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $0 + i32.load + i32.const 1 + i32.or + i32.store + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + i32.const 0 + i32.le_u + if + i32.const 0 + i32.const 1152 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.sub + local.get $2 + i32.const -268435456 + i32.and + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) + local.get $0 + i32.const 1340 + i32.lt_u + if + return + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) +) diff --git a/tests/compiler/std/object-literal-omitted.ts b/tests/compiler/std/object-literal-omitted.ts new file mode 100644 index 0000000000..ae4bf3f714 --- /dev/null +++ b/tests/compiler/std/object-literal-omitted.ts @@ -0,0 +1,84 @@ +class OmittedTypes { + int32: i32; + uint32: u32; + int64: i64; + uint64: u64; + float32: f32; + float64: f64; + int8: i8; + uint8: u8; + int16: i16; + uint16: u16; + intsize: isize; + uintsize: usize; + alias: number; + isTrue: boolean +} + +function testOmittedTypes(omitted: OmittedTypes): void { + assert(omitted.int32 == 0); + assert(omitted.uint32 == 0); + assert(omitted.int64 == 0); + assert(omitted.uint64 == 0); + assert(omitted.float32 == 0); + assert(omitted.float64 == 0); + assert(omitted.int8 == 0); + assert(omitted.uint8 == 0); + assert(omitted.int16 == 0); + assert(omitted.uint16 == 0); + assert(omitted.intsize == 0); + assert(omitted.uintsize == 0); + assert(omitted.alias == 0); + assert(omitted.isTrue == false); +} + +testOmittedTypes({}); + +class MixedOmitted { + simpleType: i32; + complexType: string; + anotherSimpleType: f64; +} + +function testMixedOmitted(omitted: MixedOmitted): void { + assert(omitted.simpleType == 0); + assert(omitted.complexType == 'test'); + assert(omitted.anotherSimpleType == 0); +} + +testMixedOmitted({ + simpleType: 0, + complexType: 'test' +}); + +// Test omitted fields +class OmittedFoo { + bar: string = 'bar'; + baz: string | null = 'baz'; + quux: string | null; + quuz: string | null; + corge: string | null; + grault: string | null; + garply: string | null; + waldo: string | null; + fred: i32; + qux: i32 = -1; +} + +function testOmittedFoo(foo: OmittedFoo): void { + assert(foo.bar == 'bar'); + assert(foo.baz == 'baz'); + assert(changetype(foo.baz) == 0); + assert(changetype(foo.quux) == 0); + assert(changetype(foo.quuz) == 0); + assert(changetype(foo.corge) == 0); + assert(changetype(foo.grault) == 0); + assert(changetype(foo.garply) == 0); + assert(changetype(foo.waldo) == 0); + assert(foo.fred == 0); + assert(foo.qux == -1); +} + +// TODO: Test this one omitted implementation is complete +// testOmittedFoo({}); + diff --git a/tests/compiler/std/object-literal-omitted.untouched.wat b/tests/compiler/std/object-literal-omitted.untouched.wat new file mode 100644 index 0000000000..d1b9c65891 --- /dev/null +++ b/tests/compiler/std/object-literal-omitted.untouched.wat @@ -0,0 +1,2139 @@ +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 176) ":\00\00\00\01\00\00\00\01\00\00\00:\00\00\00s\00t\00d\00/\00o\00b\00j\00e\00c\00t\00-\00l\00i\00t\00e\00r\00a\00l\00-\00o\00m\00i\00t\00t\00e\00d\00.\00t\00s\00") + (data (i32.const 256) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00t\00e\00s\00t\00") + (data (i32.const 288) "\05\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 288)) + (global $~lib/heap/__heap_base i32 (i32.const 332)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (start $~start) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $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) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $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) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 48 + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (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) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + 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 $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 80 + i32.const 32 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result 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) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 32 + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 501 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 513 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 518 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + local.get $4 + i32.load + i32.const -4 + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 521 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const -268435456 + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $std/object-literal-omitted/testOmittedTypes (param $0 i32) + local.get $0 + call $~lib/rt/pure/__retain + local.set $0 + local.get $0 + i32.load + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 19 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=4 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 20 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i64.load offset=8 + i64.const 0 + i64.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 21 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i64.load offset=16 + i64.const 0 + i64.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 22 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f32.load offset=24 + f32.const 0 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 23 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f64.load offset=32 + f64.const 0 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 24 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_s offset=40 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 25 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=41 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 26 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load16_s offset=42 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 27 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load16_u offset=44 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 28 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=48 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 29 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=52 + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 30 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f64.load offset=56 + f64.const 0 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 31 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=64 + i32.const 0 + i32.ne + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 32 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/__release + ) + (func $~lib/string/String#get:length (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 1 + i32.shr_u + ) + (func $~lib/util/string/compareImpl (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + local.get $0 + call $~lib/rt/pure/__retain + local.set $0 + local.get $2 + call $~lib/rt/pure/__retain + local.set $2 + local.get $0 + local.get $1 + i32.const 1 + i32.shl + i32.add + local.set $5 + local.get $2 + local.get $3 + i32.const 1 + i32.shl + i32.add + local.set $6 + local.get $4 + i32.const 4 + i32.ge_u + if (result i32) + local.get $5 + i32.const 7 + i32.and + local.get $6 + i32.const 7 + i32.and + i32.or + i32.eqz + else + i32.const 0 + end + if + block $do-break|0 + loop $do-continue|0 + local.get $5 + i64.load + local.get $6 + i64.load + i64.ne + if + br $do-break|0 + end + local.get $5 + i32.const 8 + i32.add + local.set $5 + local.get $6 + i32.const 8 + i32.add + local.set $6 + local.get $4 + i32.const 4 + i32.sub + local.set $4 + local.get $4 + i32.const 4 + i32.ge_u + local.set $7 + local.get $7 + br_if $do-continue|0 + end + end + end + loop $while-continue|1 + local.get $4 + local.tee $7 + i32.const 1 + i32.sub + local.set $4 + local.get $7 + local.set $7 + local.get $7 + if + local.get $5 + i32.load16_u + local.set $8 + local.get $6 + i32.load16_u + local.set $9 + local.get $8 + local.get $9 + i32.ne + if + local.get $8 + local.get $9 + i32.sub + local.set $10 + local.get $0 + call $~lib/rt/pure/__release + local.get $2 + call $~lib/rt/pure/__release + local.get $10 + return + end + local.get $5 + i32.const 2 + i32.add + local.set $5 + local.get $6 + i32.const 2 + i32.add + local.set $6 + br $while-continue|1 + end + end + i32.const 0 + local.set $7 + local.get $0 + call $~lib/rt/pure/__release + local.get $2 + call $~lib/rt/pure/__release + local.get $7 + ) + (func $~lib/string/String.__eq (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + local.get $0 + call $~lib/rt/pure/__retain + local.set $0 + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $0 + local.get $1 + i32.eq + if + i32.const 1 + local.set $2 + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $2 + return + end + local.get $0 + i32.const 0 + i32.eq + if (result i32) + i32.const 1 + else + local.get $1 + i32.const 0 + i32.eq + end + if + i32.const 0 + local.set $2 + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $2 + return + end + local.get $0 + call $~lib/string/String#get:length + local.set $3 + local.get $3 + local.get $1 + call $~lib/string/String#get:length + i32.ne + if + i32.const 0 + local.set $2 + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $2 + return + end + local.get $0 + i32.const 0 + local.get $1 + i32.const 0 + local.get $3 + call $~lib/util/string/compareImpl + i32.eqz + local.set $2 + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $2 + ) + (func $std/object-literal-omitted/testMixedOmitted (param $0 i32) + local.get $0 + call $~lib/rt/pure/__retain + local.set $0 + local.get $0 + i32.load + i32.const 0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 44 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=4 + i32.const 272 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 45 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + f64.load offset=8 + f64.const 0 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 192 + i32.const 46 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/__release + ) + (func $start:std/object-literal-omitted + (local $0 i32) + (local $1 i32) + i32.const 65 + i32.const 3 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i64.const 0 + i64.store offset=8 + local.get $0 + i64.const 0 + i64.store offset=16 + local.get $0 + f32.const 0 + f32.store offset=24 + local.get $0 + f64.const 0 + f64.store offset=32 + local.get $0 + i32.const 0 + i32.store8 offset=40 + local.get $0 + i32.const 0 + i32.store8 offset=41 + local.get $0 + i32.const 0 + i32.store16 offset=42 + local.get $0 + i32.const 0 + i32.store16 offset=44 + local.get $0 + i32.const 0 + i32.store offset=48 + local.get $0 + i32.const 0 + i32.store offset=52 + local.get $0 + f64.const 0 + f64.store offset=56 + local.get $0 + i32.const 0 + i32.store8 offset=64 + local.get $0 + call $std/object-literal-omitted/testOmittedTypes + i32.const 16 + i32.const 4 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.set $1 + local.get $1 + i32.const 0 + i32.store + local.get $1 + i32.const 272 + i32.store offset=4 + local.get $1 + f64.const 0 + f64.store offset=8 + local.get $1 + call $std/object-literal-omitted/testMixedOmitted + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + ) + (func $~start + call $start:std/object-literal-omitted + ) + (func $~lib/rt/pure/__collect + return + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + else + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + local.get $1 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 69 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$6 + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$case$2 $switch$1$case$6 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + local.get $0 + i32.load offset=4 + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) +) diff --git a/tests/compiler/std/object-literal.ts b/tests/compiler/std/object-literal.ts index d5625db01c..72593ef552 100644 --- a/tests/compiler/std/object-literal.ts +++ b/tests/compiler/std/object-literal.ts @@ -27,3 +27,4 @@ function bar2(foo: Foo2): void { bar2({ bar: 2 }); ({ bar: 3 }).test(); +