fix rogue releases

This commit is contained in:
dcode 2019-05-21 00:38:48 +02:00
parent 3e480d9423
commit 1cbf3fc885
27 changed files with 53330 additions and 54655 deletions

View File

@ -2201,9 +2201,10 @@ export class Compiler extends DiagnosticEmitter {
var stmts = new Array<ExpressionRef>();
this.performAutoreleases(flow, stmts);
this.finishAutoreleases(flow, stmts);
if (returnType.isManaged) {
// Make sure that the return value is retained for the caller
if (!this.skippedAutoreleases.has(expr)) expr = this.makeRetain(expr);
if (returnType.isManaged && !this.skippedAutoreleases.has(expr)) expr = this.makeRetain(expr);
if (stmts.length) {
let temp = flow.getAndFreeTempLocal(returnType, false);
stmts.unshift(
@ -2211,7 +2212,6 @@ export class Compiler extends DiagnosticEmitter {
);
expr = module.createGetLocal(temp.index, returnType.toNativeType());
}
}
flow.freeScopedLocals();
// If the last statement anyway, make it the block's return value
@ -6622,22 +6622,22 @@ export class Compiler extends DiagnosticEmitter {
clearFlags: bool = true
): ExpressionRef {
if (!stmts) stmts = new Array<ExpressionRef>();
stmts.push(
this.module.createNop()
);
var lengthBefore = stmts.length;
this.performAutoreleases(flow, stmts, clearFlags);
if (stmts.length) {
if (stmts.length > lengthBefore) {
let nativeType = valueType.toNativeType();
let temp = flow.getAndFreeTempLocal(valueType, !flow.canOverflow(valueExpr, valueType));
let module = this.module;
stmts.unshift(
module.createSetLocal(temp.index, valueExpr),
);
stmts[lengthBefore - 1] = module.createSetLocal(temp.index, valueExpr); // nop -> set
stmts.push(
module.createGetLocal(temp.index, nativeType)
module.createGetLocal(temp.index, nativeType) // append get
);
return module.createBlock(null, stmts, nativeType);
} else if (stmts.length) {
stmts.push(
valueExpr
);
} else if (stmts.length > 1) {
stmts[lengthBefore - 1] = valueExpr; // nop -> value
return this.module.createBlock(null, stmts, valueType.toNativeType());
}
return valueExpr;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1835,7 +1835,6 @@
)
(func $start:rc/logical-and-mismatch (; 23 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
i32.const 0
call $rc/logical-and-mismatch/Ref#constructor
global.set $rc/logical-and-mismatch/gloRef
@ -1843,12 +1842,10 @@
call $rc/logical-and-mismatch/getRef
local.tee $0
if (result i32)
global.get $rc/logical-and-mismatch/gloRef
call $~lib/rt/purerc/__retain
local.set $1
local.get $0
call $~lib/rt/purerc/__release
local.get $1
global.get $rc/logical-and-mismatch/gloRef
call $~lib/rt/purerc/__retain
else
local.get $0
end
@ -1873,11 +1870,9 @@
call $rc/logical-and-mismatch/getRef
local.tee $0
if (result i32)
call $rc/logical-and-mismatch/getRef
local.set $1
local.get $0
call $~lib/rt/purerc/__release
local.get $1
call $rc/logical-and-mismatch/getRef
else
local.get $0
end

View File

@ -1835,7 +1835,6 @@
)
(func $start:rc/logical-or-mismatch (; 23 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
i32.const 0
call $rc/logical-or-mismatch/Ref#constructor
global.set $rc/logical-or-mismatch/gloRef
@ -1845,12 +1844,10 @@
if (result i32)
local.get $0
else
global.get $rc/logical-or-mismatch/gloRef
call $~lib/rt/purerc/__retain
local.set $1
local.get $0
call $~lib/rt/purerc/__release
local.get $1
global.get $rc/logical-or-mismatch/gloRef
call $~lib/rt/purerc/__retain
end
local.set $0
local.get $0
@ -1875,11 +1872,9 @@
if (result i32)
local.get $0
else
call $rc/logical-or-mismatch/getRef
local.set $1
local.get $0
call $~lib/rt/purerc/__release
local.get $1
call $rc/logical-or-mismatch/getRef
end
local.set $0
local.get $0

View File

@ -1835,7 +1835,6 @@
)
(func $start:rc/logical-or-mismatch (; 23 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
i32.const 0
call $rc/logical-or-mismatch/Ref#constructor
global.set $rc/logical-or-mismatch/gloRef
@ -1845,12 +1844,10 @@
if (result i32)
local.get $0
else
global.get $rc/logical-or-mismatch/gloRef
call $~lib/rt/purerc/__retain
local.set $1
local.get $0
call $~lib/rt/purerc/__release
local.get $1
global.get $rc/logical-or-mismatch/gloRef
call $~lib/rt/purerc/__retain
end
local.set $0
local.get $0
@ -1875,11 +1872,9 @@
if (result i32)
local.get $0
else
call $rc/logical-or-mismatch/getRef
local.set $1
local.get $0
call $~lib/rt/purerc/__release
local.get $1
call $rc/logical-or-mismatch/getRef
end
local.set $0
local.get $0

View File

@ -2,32 +2,45 @@
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\10\00\00\00\1a")
(data (i32.const 24) "~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s")
(data (i32.const 56) "\10")
(data (i32.const 72) "\10\00\00\00\1c")
(data (i32.const 88) "~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
(data (i32.const 120) "\10\00\00\00\08")
(data (i32.const 136) "n\00u\00l\00l")
(data (i32.const 8) "^\00\00\00\01\00\00\00\10\00\00\00^\00\00\00E\00l\00e\00m\00e\00n\00t\00 \00t\00y\00p\00e\00 \00m\00u\00s\00t\00 \00b\00e\00 \00n\00u\00l\00l\00a\00b\00l\00e\00 \00i\00f\00 \00a\00r\00r\00a\00y\00 \00i\00s\00 \00h\00o\00l\00e\00y\00")
(data (i32.const 120) "\1a\00\00\00\01\00\00\00\10\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
(data (i32.const 168) "$\00\00\00\01\00\00\00\10\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 224) "\00\00\00\00\01\00\00\00\10\00\00\00\00\00\00\00")
(data (i32.const 240) "\1c\00\00\00\01\00\00\00\10\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
(data (i32.const 288) "\08\00\00\00\01\00\00\00\10\00\00\00\08\00\00\00n\00u\00l\00l\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(export "memory" (memory $0))
(export "i32ArrayArrayElementAccess" (func $std/array-access/i32ArrayArrayElementAccess))
(export "stringArrayPropertyAccess" (func $std/array-access/stringArrayPropertyAccess))
(export "stringArrayMethodCall" (func $std/array-access/stringArrayMethodCall))
(export "stringArrayArrayPropertyAccess" (func $std/array-access/stringArrayArrayPropertyAccess))
(export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall))
(func $~lib/array/Array<~lib/array/Array<i32>>#__get (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<~lib/array/Array<i32>>#__unchecked_get (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
i32.const 2
i32.shl
i32.add
i32.load
call $~lib/rt/stub/__retain
)
(func $~lib/array/Array<~lib/array/Array<i32>>#__get (; 2 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
local.get $0
i32.load offset=12
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 96
i32.const 136
i32.const 97
i32.const 45
call $~lib/builtins/abort
unreachable
@ -39,13 +52,18 @@
i32.shr_u
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 99
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/array/Array<i32>>#__unchecked_get
)
(func $~lib/array/Array<i32>#__unchecked_get (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
@ -54,158 +72,375 @@
i32.add
i32.load
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
(func $~lib/array/Array<i32>#__get (; 4 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
local.get $0
i32.load offset=8
i32.const 2
i32.shr_u
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 99
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
end
local.get $0
local.get $1
call $~lib/array/Array<i32>#__unchecked_get
)
(func $std/array-access/i32ArrayArrayElementAccess (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
local.tee $1
i32.const 1
call $~lib/array/Array<i32>#__get
local.set $2
local.get $1
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/array/Array<~lib/string/String>#__unchecked_get (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
i32.const 4
local.get $1
i32.const 2
i32.shl
i32.add
i32.load
call $~lib/rt/stub/__retain
)
(func $std/array-access/i32ArrayArrayElementAccess (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/array/Array<~lib/string/String>#__get (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
call $~lib/array/Array<i32>#__get
i32.load offset=12
i32.ge_u
if
i32.const 24
i32.const 136
i32.const 97
i32.const 45
call $~lib/builtins/abort
unreachable
end
local.get $1
local.get $0
i32.load offset=8
i32.const 2
i32.shr_u
i32.ge_u
if
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/string/String>#__unchecked_get
)
(func $std/array-access/stringArrayPropertyAccess (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/string/String#get:length (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
i32.const 16
i32.sub
i32.load offset=4
i32.load offset=12
i32.const 1
i32.shr_u
)
(func $~lib/util/string/compareImpl (; 5 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(func $std/array-access/stringArrayPropertyAccess (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/string/String>#__get
local.tee $1
call $~lib/string/String#get:length
local.set $2
local.get $1
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/util/string/compareImpl (; 10 ;) (type $FUNCSIG$iiiiii) (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.get $0
call $~lib/rt/stub/__retain
drop
local.get $2
call $~lib/rt/stub/__retain
drop
i32.const 0
local.set $5
local.get $0
local.get $1
i32.const 1
i32.shl
local.get $0
i32.add
local.set $0
i32.const 72
local.set $1
loop $continue|0
local.set $6
local.get $2
local.get $3
i32.const 1
i32.shl
i32.add
local.set $7
block $break|0
loop $continue|0
local.get $4
if (result i32)
local.get $0
local.get $6
i32.load16_u
local.get $1
local.get $7
i32.load16_u
i32.sub
local.tee $3
local.tee $5
i32.eqz
else
i32.const 0
end
if
local.get $2
local.get $4
i32.const 1
i32.sub
local.set $2
local.get $0
local.set $4
local.get $6
i32.const 2
i32.add
local.set $0
local.get $1
local.set $6
local.get $7
i32.const 2
i32.add
local.set $1
local.set $7
br $continue|0
end
end
local.get $3
)
(func $~lib/string/String#startsWith (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
end
local.get $5
local.set $8
local.get $0
call $~lib/rt/stub/__release
local.get $2
call $~lib/rt/stub/__release
local.get $8
)
(func $~lib/string/String#startsWith (; 11 ;) (type $FUNCSIG$iiii) (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.get $1
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
i32.ne
i32.eqz
if
i32.const 0
i32.const 88
i32.const 178
i32.const 256
i32.const 171
i32.const 4
call $~lib/builtins/abort
unreachable
end
i32.const 60
i32.load
i32.const 1
i32.shr_u
local.tee $1
local.set $2
local.get $1
i32.const 0
i32.eq
if
i32.const 304
local.get $1
call $~lib/rt/stub/__retainRelease
local.set $1
end
local.get $2
local.set $3
local.get $0
i32.const 16
i32.sub
i32.load offset=4
i32.const 1
i32.shr_u
local.tee $1
call $~lib/string/String#get:length
local.set $4
local.get $3
local.tee $5
i32.const 0
local.get $1
local.tee $6
local.get $5
local.get $6
i32.gt_s
select
local.tee $5
local.get $4
local.tee $6
local.get $5
local.get $6
i32.lt_s
select
local.tee $3
i32.add
local.set $7
local.get $1
call $~lib/string/String#get:length
local.set $8
local.get $8
local.get $7
i32.add
local.get $4
i32.gt_s
if
i32.const 0
local.set $5
local.get $1
call $~lib/rt/stub/__release
local.get $5
return
end
local.get $0
local.get $3
local.get $2
local.get $7
local.get $1
i32.const 0
local.get $8
call $~lib/util/string/compareImpl
i32.eqz
local.set $5
local.get $1
call $~lib/rt/stub/__release
local.get $5
)
(func $std/array-access/stringArrayMethodCall (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $std/array-access/stringArrayMethodCall (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
call $~lib/array/Array<~lib/string/String>#__get
local.tee $1
i32.const 240
i32.const 0
call $~lib/string/String#startsWith
)
(func $std/array-access/stringArrayArrayPropertyAccess (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.set $2
local.get $1
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__unchecked_get (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
i32.const 1
call $~lib/array/Array<~lib/array/Array<i32>>#__get
i32.const 16
i32.sub
i32.load offset=4
i32.const 1
i32.shr_u
local.get $1
i32.const 2
i32.shl
i32.add
i32.load
call $~lib/rt/stub/__retain
)
(func $std/array-access/stringArrayArrayMethodCall (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__get (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
local.get $0
i32.load offset=12
i32.ge_u
if
i32.const 24
i32.const 136
i32.const 97
i32.const 45
call $~lib/builtins/abort
unreachable
end
local.get $1
local.get $0
i32.load offset=8
i32.const 2
i32.shr_u
i32.ge_u
if
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__unchecked_get
)
(func $std/array-access/stringArrayArrayPropertyAccess (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__get
local.tee $1
i32.const 1
call $~lib/array/Array<~lib/array/Array<i32>>#__get
call $~lib/string/String#startsWith
call $~lib/array/Array<~lib/string/String>#__get
local.tee $2
call $~lib/string/String#get:length
local.set $3
local.get $1
call $~lib/rt/stub/__release
local.get $2
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $3
)
(func $null (; 10 ;) (type $FUNCSIG$v)
(func $std/array-access/stringArrayArrayMethodCall (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__get
local.tee $1
i32.const 1
call $~lib/array/Array<~lib/string/String>#__get
local.tee $2
i32.const 240
i32.const 0
call $~lib/string/String#startsWith
local.set $3
local.get $1
call $~lib/rt/stub/__release
local.get $2
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $3
)
(func $~lib/rt/stub/__retain (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
)
(func $~lib/rt/stub/__retainRelease (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
)
(func $~lib/rt/stub/__release (; 19 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $null (; 20 ;) (type $FUNCSIG$v)
)
)

View File

@ -4,16 +4,18 @@
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\10\00\00\00\1a\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
(data (i32.const 56) "\10\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
(data (i32.const 72) "\10\00\00\00\1c\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
(data (i32.const 120) "\10\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00n\00u\00l\00l\00")
(data (i32.const 8) "^\00\00\00\01\00\00\00\10\00\00\00^\00\00\00E\00l\00e\00m\00e\00n\00t\00 \00t\00y\00p\00e\00 \00m\00u\00s\00t\00 \00b\00e\00 \00n\00u\00l\00l\00a\00b\00l\00e\00 \00i\00f\00 \00a\00r\00r\00a\00y\00 \00i\00s\00 \00h\00o\00l\00e\00y\00")
(data (i32.const 120) "\1a\00\00\00\01\00\00\00\10\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
(data (i32.const 168) "$\00\00\00\01\00\00\00\10\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 224) "\00\00\00\00\01\00\00\00\10\00\00\00\00\00\00\00")
(data (i32.const 240) "\1c\00\00\00\01\00\00\00\10\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
(data (i32.const 288) "\08\00\00\00\01\00\00\00\10\00\00\00\08\00\00\00n\00u\00l\00l\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/util/runtime/HEADER_SIZE i32 (i32.const 16))
(export "memory" (memory $0))
(export "i32ArrayArrayElementAccess" (func $std/array-access/i32ArrayArrayElementAccess))
(export "stringArrayPropertyAccess" (func $std/array-access/stringArrayPropertyAccess))
@ -28,6 +30,7 @@
i32.shl
i32.add
i32.load
call $~lib/rt/stub/__retain
)
(func $~lib/array/Array<~lib/array/Array<i32>>#__get (; 2 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
@ -35,9 +38,9 @@
i32.load offset=12
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 96
i32.const 136
i32.const 97
i32.const 45
call $~lib/builtins/abort
unreachable
@ -49,9 +52,9 @@
i32.shr_u
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 99
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
@ -77,9 +80,9 @@
i32.shr_u
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 99
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
@ -89,11 +92,23 @@
call $~lib/array/Array<i32>#__unchecked_get
)
(func $std/array-access/i32ArrayArrayElementAccess (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<i32>>#__get
local.tee $1
i32.const 1
call $~lib/array/Array<i32>#__get
local.set $2
local.get $1
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/array/Array<~lib/string/String>#__unchecked_get (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
@ -103,6 +118,7 @@
i32.shl
i32.add
i32.load
call $~lib/rt/stub/__retain
)
(func $~lib/array/Array<~lib/string/String>#__get (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
@ -110,9 +126,9 @@
i32.load offset=12
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 96
i32.const 136
i32.const 97
i32.const 45
call $~lib/builtins/abort
unreachable
@ -124,9 +140,9 @@
i32.shr_u
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 99
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
@ -137,22 +153,41 @@
)
(func $~lib/string/String#get:length (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/util/runtime/HEADER_SIZE
i32.const 16
i32.sub
i32.load offset=4
i32.load offset=12
i32.const 1
i32.shr_u
)
(func $std/array-access/stringArrayPropertyAccess (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/string/String>#__get
local.tee $1
call $~lib/string/String#get:length
local.set $2
local.get $1
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/util/string/compareImpl (; 10 ;) (type $FUNCSIG$iiiiii) (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.get $0
call $~lib/rt/stub/__retain
drop
local.get $2
call $~lib/rt/stub/__retain
drop
i32.const 0
local.set $5
local.get $0
@ -182,7 +217,6 @@
i32.const 0
end
if
block
local.get $4
i32.const 1
i32.sub
@ -195,12 +229,17 @@
i32.const 2
i32.add
local.set $7
end
br $continue|0
end
end
end
local.get $5
local.set $8
local.get $0
call $~lib/rt/stub/__release
local.get $2
call $~lib/rt/stub/__release
local.get $8
)
(func $~lib/string/String#startsWith (; 11 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
@ -209,14 +248,17 @@
(local $6 i32)
(local $7 i32)
(local $8 i32)
local.get $1
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
i32.ne
i32.eqz
if
i32.const 0
i32.const 88
i32.const 178
i32.const 256
i32.const 171
i32.const 4
call $~lib/builtins/abort
unreachable
@ -225,7 +267,9 @@
i32.const 0
i32.eq
if
i32.const 136
i32.const 304
local.get $1
call $~lib/rt/stub/__retainRelease
local.set $1
end
local.get $2
@ -259,6 +303,10 @@
i32.gt_s
if
i32.const 0
local.set $5
local.get $1
call $~lib/rt/stub/__release
local.get $5
return
end
local.get $0
@ -268,14 +316,30 @@
local.get $8
call $~lib/util/string/compareImpl
i32.eqz
local.set $5
local.get $1
call $~lib/rt/stub/__release
local.get $5
)
(func $std/array-access/stringArrayMethodCall (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/string/String>#__get
i32.const 72
local.tee $1
i32.const 240
i32.const 0
call $~lib/string/String#startsWith
local.set $2
local.get $1
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__unchecked_get (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
@ -285,6 +349,7 @@
i32.shl
i32.add
i32.load
call $~lib/rt/stub/__retain
)
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__get (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
@ -292,9 +357,9 @@
i32.load offset=12
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 96
i32.const 136
i32.const 97
i32.const 45
call $~lib/builtins/abort
unreachable
@ -306,9 +371,9 @@
i32.shr_u
i32.ge_u
if
i32.const 0
i32.const 24
i32.const 99
i32.const 184
i32.const 136
i32.const 100
i32.const 61
call $~lib/builtins/abort
unreachable
@ -318,23 +383,64 @@
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__unchecked_get
)
(func $std/array-access/stringArrayArrayPropertyAccess (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__get
local.tee $1
i32.const 1
call $~lib/array/Array<~lib/string/String>#__get
local.tee $2
call $~lib/string/String#get:length
local.set $3
local.get $1
call $~lib/rt/stub/__release
local.get $2
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $3
)
(func $std/array-access/stringArrayArrayMethodCall (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
call $~lib/rt/stub/__retain
drop
local.get $0
i32.const 0
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__get
local.tee $1
i32.const 1
call $~lib/array/Array<~lib/string/String>#__get
i32.const 72
local.tee $2
i32.const 240
i32.const 0
call $~lib/string/String#startsWith
local.set $3
local.get $1
call $~lib/rt/stub/__release
local.get $2
call $~lib/rt/stub/__release
local.get $0
call $~lib/rt/stub/__release
local.get $3
)
(func $null (; 17 ;) (type $FUNCSIG$v)
(func $~lib/rt/stub/__retain (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
)
(func $~lib/rt/stub/__retainRelease (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
)
(func $~lib/rt/stub/__release (; 19 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $null (; 20 ;) (type $FUNCSIG$v)
)
)

View File

@ -1,5 +1,6 @@
{
"asc_flags": [
"--runtime none"
"--runtime half",
"--use ASC_RTRACE=1"
]
}

File diff suppressed because it is too large Load Diff

View File

@ -38,3 +38,10 @@ assert(dynamicArrayRef.length == 3);
class RefWithCtor { constructor() {} }
var dynamicArrayRefWithCtor: RefWithCtor[] = [new RefWithCtor(), new RefWithCtor(), new RefWithCtor()];
assert(dynamicArrayRefWithCtor.length == 3);
// Unleak globals
__release(changetype<usize>(emptyArrayI32));
__release(changetype<usize>(dynamicArrayI8));
__release(changetype<usize>(dynamicArrayI32));
__release(changetype<usize>(dynamicArrayRef));
__release(changetype<usize>(dynamicArrayRefWithCtor));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -980,6 +980,5 @@ class Ref { constructor() {} }
assert(subarrU32.toString() == "1");
}
// Unleak globals that'd otherwise retain a reference
arr = changetype<i32[]>(0);
// Unleak globals
__release(changetype<usize>(arr));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -302,6 +302,6 @@ export function getString(): string {
return str;
}
// Unleak
// Unleak globals
str = changetype<string>(0);
__release(changetype<usize>(str));

File diff suppressed because it is too large Load Diff

View File

@ -3,22 +3,16 @@
(type $FUNCSIG$v (func))
(import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\10\00\00\00\1a")
(data (i32.const 24) "z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t")
(data (i32.const 56) "\10\00\00\00\1a")
(data (i32.const 72) "z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t")
(data (i32.const 104) "\10\00\00\00\0e")
(data (i32.const 120) "o\00n\00e\00_\00i\00n\00t")
(data (i32.const 136) "\10\00\00\00\0e")
(data (i32.const 152) "t\00w\00o\00_\00i\00n\00t")
(data (i32.const 168) "\10\00\00\00\12")
(data (i32.const 184) "t\00h\00r\00e\00e\00_\00i\00n\00t")
(data (i32.const 208) "\10\00\00\00\10")
(data (i32.const 224) "f\00o\00u\00r\00_\00i\00n\00t")
(data (i32.const 240) "\10\00\00\00\10")
(data (i32.const 256) "f\00i\00v\00e\00_\00i\00n\00t")
(data (i32.const 272) "\10\00\00\00\10")
(data (i32.const 288) "f\00i\00v\00e\00_\00d\00b\00l")
(data (i32.const 8) "\1a\00\00\00\01\00\00\00\10\00\00\00\1a\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t\00")
(data (i32.const 56) "\1a\00\00\00\01\00\00\00\10\00\00\00\1a\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t\00")
(data (i32.const 104) "\0e\00\00\00\01\00\00\00\10\00\00\00\0e\00\00\00o\00n\00e\00_\00i\00n\00t\00")
(data (i32.const 136) "\0e\00\00\00\01\00\00\00\10\00\00\00\0e\00\00\00t\00w\00o\00_\00i\00n\00t\00")
(data (i32.const 168) "\12\00\00\00\01\00\00\00\10\00\00\00\12\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t\00")
(data (i32.const 208) "\10\00\00\00\01\00\00\00\10\00\00\00\10\00\00\00f\00o\00u\00r\00_\00i\00n\00t\00")
(data (i32.const 240) "\10\00\00\00\01\00\00\00\10\00\00\00\10\00\00\00f\00i\00v\00e\00_\00i\00n\00t\00")
(data (i32.const 272) "\10\00\00\00\01\00\00\00\10\00\00\00\10\00\00\00f\00i\00v\00e\00_\00d\00b\00l\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/started (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "main" (func $std/trace/main))
@ -92,12 +86,14 @@
global.get $~lib/started
i32.eqz
if
call $start:std/trace
call $start
i32.const 1
global.set $~lib/started
end
)
(func $null (; 3 ;) (type $FUNCSIG$v)
nop
(func $start (; 3 ;) (type $FUNCSIG$v)
call $start:std/trace
)
(func $null (; 4 ;) (type $FUNCSIG$v)
)
)

View File

@ -3,14 +3,14 @@
(type $FUNCSIG$v (func))
(import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\10\00\00\00\1a\00\00\00\00\00\00\00\00\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t\00")
(data (i32.const 56) "\10\00\00\00\1a\00\00\00\00\00\00\00\00\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t\00")
(data (i32.const 104) "\10\00\00\00\0e\00\00\00\00\00\00\00\00\00\00\00o\00n\00e\00_\00i\00n\00t\00")
(data (i32.const 136) "\10\00\00\00\0e\00\00\00\00\00\00\00\00\00\00\00t\00w\00o\00_\00i\00n\00t\00")
(data (i32.const 168) "\10\00\00\00\12\00\00\00\00\00\00\00\00\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t\00")
(data (i32.const 208) "\10\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00f\00o\00u\00r\00_\00i\00n\00t\00")
(data (i32.const 240) "\10\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00f\00i\00v\00e\00_\00i\00n\00t\00")
(data (i32.const 272) "\10\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00f\00i\00v\00e\00_\00d\00b\00l\00")
(data (i32.const 8) "\1a\00\00\00\01\00\00\00\10\00\00\00\1a\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t\00")
(data (i32.const 56) "\1a\00\00\00\01\00\00\00\10\00\00\00\1a\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t\00")
(data (i32.const 104) "\0e\00\00\00\01\00\00\00\10\00\00\00\0e\00\00\00o\00n\00e\00_\00i\00n\00t\00")
(data (i32.const 136) "\0e\00\00\00\01\00\00\00\10\00\00\00\0e\00\00\00t\00w\00o\00_\00i\00n\00t\00")
(data (i32.const 168) "\12\00\00\00\01\00\00\00\10\00\00\00\12\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t\00")
(data (i32.const 208) "\10\00\00\00\01\00\00\00\10\00\00\00\10\00\00\00f\00o\00u\00r\00_\00i\00n\00t\00")
(data (i32.const 240) "\10\00\00\00\01\00\00\00\10\00\00\00\10\00\00\00f\00i\00v\00e\00_\00i\00n\00t\00")
(data (i32.const 272) "\10\00\00\00\01\00\00\00\10\00\00\00\10\00\00\00f\00i\00v\00e\00_\00d\00b\00l\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/started (mut i32) (i32.const 0))

View File

@ -1,5 +1,6 @@
{
"asc_flags": [
"--runtime none"
"--runtime half",
"--use ASC_RTRACE=1"
]
}

File diff suppressed because one or more lines are too long

View File

@ -442,7 +442,6 @@ testArrayForEach<Uint64Array, u64>();
testArrayForEach<Float32Array, f32>();
testArrayForEach<Float64Array, f64>();
var testArrayReverseValues: i32[] = [1, 2, 3, 4, 5, 6, 7, 8, 9];
function testArrayReverse<TArray extends TypedArray<T>, T extends number>(): void {
var values = testArrayReverseValues;
@ -480,3 +479,5 @@ testArrayReverse<Int64Array, i64>();
testArrayReverse<Uint64Array, u64>();
testArrayReverse<Float32Array, f32>();
testArrayReverse<Float64Array, f64>();
@start export function main(): void {}

File diff suppressed because one or more lines are too long