implement __runtime_flags

This commit is contained in:
dcode
2019-04-05 01:59:01 +02:00
parent ed32a4c8ba
commit a9e4813798
90 changed files with 14549 additions and 7499 deletions

View File

@ -14,8 +14,8 @@
(data (i32.const 24) "c\00l\00a\00s\00s\00.\00t\00s")
(data (i32.const 40) "\01\00\00\00,")
(data (i32.const 56) "~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s")
(data (i32.const 104) "\01\00\00\00\1e")
(data (i32.const 120) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 104) "\01\00\00\00(")
(data (i32.const 120) "~\00l\00i\00b\00/\00u\00t\00i\00l\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0))
@ -30,18 +30,17 @@
(export "memory" (memory $0))
(export "table" (table $0))
(export "test" (func $class/test))
(export "runtime.instanceof" (func $~lib/runtime/runtime.instanceof))
(export "runtime.allocate" (func $~lib/runtime/runtime.allocate))
(export "runtime.discard" (func $~lib/runtime/runtime.discard))
(export "runtime.register" (func $~lib/runtime/runtime.register))
(export "runtime.newString" (func $~lib/runtime/runtime.newString))
(export "runtime.newArrayBuffer" (func $~lib/runtime/runtime.newArrayBuffer))
(export ".setargc" (func $~lib/setargc))
(export "runtime.newArray" (func $~lib/runtime/runtime.newArray|trampoline))
(export "runtime.retain" (func $~lib/runtime/runtime.retain))
(export "runtime.release" (func $~lib/runtime/runtime.release))
(export "runtime.collect" (func $~lib/runtime/runtime.collect))
(export ".capabilities" (global $~lib/capabilities))
(export "$.instanceof" (func $~lib/runtime/runtime.instanceof))
(export "$.flags" (func $~lib/runtime/runtime.flags))
(export "$.newObject" (func $~lib/runtime/runtime.newObject))
(export "$.newString" (func $~lib/runtime/runtime.newString))
(export "$.newArrayBuffer" (func $~lib/runtime/runtime.newArrayBuffer))
(export "$.setArgc" (func $~lib/setargc))
(export "$.newArray" (func $~lib/runtime/runtime.newArray|trampoline))
(export "$.retain" (func $~lib/runtime/runtime.retain))
(export "$.release" (func $~lib/runtime/runtime.release))
(export "$.collect" (func $~lib/runtime/runtime.collect))
(export "$.capabilities" (global $~lib/capabilities))
(start $start)
(func $class/test (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
@ -77,7 +76,19 @@
i32.const 0
end
)
(func $~lib/allocator/tlsf/Root#setSLMap (; 3 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/runtime/runtime.flags (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
block $__inlined_func$~lib/runtime/__runtime_flags
block $invalid
local.get $0
i32.const 1
i32.sub
br_table $__inlined_func$~lib/runtime/__runtime_flags $__inlined_func$~lib/runtime/__runtime_flags $__inlined_func$~lib/runtime/__runtime_flags $invalid
end
unreachable
end
i32.const 0
)
(func $~lib/allocator/tlsf/Root#setSLMap (; 4 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
local.get $1
i32.const 22
i32.ge_u
@ -97,7 +108,7 @@
local.get $2
i32.store offset=4
)
(func $~lib/allocator/tlsf/Root#setHead (; 4 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $~lib/allocator/tlsf/Root#setHead (; 5 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
local.get $1
i32.const 22
i32.ge_u
@ -132,7 +143,7 @@
local.get $3
i32.store offset=96
)
(func $~lib/allocator/tlsf/Block#get:right (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/tlsf/Block#get:right (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
i32.const -4
@ -166,7 +177,7 @@
end
local.get $0
)
(func $~lib/allocator/tlsf/fls<usize> (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/tlsf/fls<usize> (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -182,7 +193,7 @@
i32.clz
i32.sub
)
(func $~lib/allocator/tlsf/Root#getHead (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/allocator/tlsf/Root#getHead (; 8 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
local.get $1
i32.const 22
i32.ge_u
@ -216,7 +227,7 @@
i32.add
i32.load offset=96
)
(func $~lib/allocator/tlsf/Root#getSLMap (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/allocator/tlsf/Root#getSLMap (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $1
i32.const 22
i32.ge_u
@ -235,7 +246,7 @@
i32.add
i32.load offset=4
)
(func $~lib/allocator/tlsf/Root#remove (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(func $~lib/allocator/tlsf/Root#remove (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -364,7 +375,7 @@
end
end
)
(func $~lib/allocator/tlsf/Block#get:left (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/tlsf/Block#get:left (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
i32.const 2
@ -394,7 +405,7 @@
end
local.get $0
)
(func $~lib/allocator/tlsf/Root#setJump (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(func $~lib/allocator/tlsf/Root#setJump (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
i32.load
i32.const 1
@ -439,7 +450,7 @@
local.get $0
i32.store
)
(func $~lib/allocator/tlsf/Root#insert (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(func $~lib/allocator/tlsf/Root#insert (; 13 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -669,7 +680,7 @@
i32.or
call $~lib/allocator/tlsf/Root#setSLMap
)
(func $~lib/allocator/tlsf/Root#addMemory (; 13 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/allocator/tlsf/Root#addMemory (; 14 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
local.get $1
@ -792,7 +803,7 @@
local.get $1
call $~lib/allocator/tlsf/Root#insert
)
(func $~lib/allocator/tlsf/ffs<usize> (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/tlsf/ffs<usize> (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -806,7 +817,7 @@
local.get $0
i32.ctz
)
(func $~lib/allocator/tlsf/Root#search (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/allocator/tlsf/Root#search (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
local.get $1
@ -918,7 +929,7 @@
end
end
)
(func $~lib/allocator/tlsf/Root#use (; 16 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/allocator/tlsf/Root#use (; 17 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
local.get $1
@ -1029,7 +1040,7 @@
i32.const 8
i32.add
)
(func $~lib/allocator/tlsf/__mem_allocate (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/tlsf/__mem_allocate (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -1055,14 +1066,14 @@
if
unreachable
end
i32.const 152
i32.const 160
local.set $2
i32.const 152
i32.const 160
global.set $~lib/allocator/tlsf/ROOT
i32.const 2912
i32.const 0
i32.store
i32.const 152
i32.const 160
i32.const 0
i32.store
i32.const 0
@ -1072,7 +1083,7 @@
i32.const 22
i32.lt_u
if
i32.const 152
i32.const 160
local.get $1
i32.const 0
call $~lib/allocator/tlsf/Root#setSLMap
@ -1083,7 +1094,7 @@
i32.const 32
i32.lt_u
if
i32.const 152
i32.const 160
local.get $1
local.get $3
i32.const 0
@ -1102,8 +1113,8 @@
br $repeat|0
end
end
i32.const 152
i32.const 3072
i32.const 160
i32.const 3080
current_memory
i32.const 16
i32.shl
@ -1199,7 +1210,7 @@
local.get $1
call $~lib/allocator/tlsf/Root#use
)
(func $~lib/runtime/runtime.allocate (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/util/runtime/allocate (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
i32.const 1
i32.const 32
@ -1226,75 +1237,7 @@
i32.const 16
i32.add
)
(func $~lib/allocator/tlsf/__mem_free (; 19 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
if
global.get $~lib/allocator/tlsf/ROOT
local.tee $1
if
local.get $0
i32.const 8
i32.sub
local.tee $2
i32.load
local.tee $3
i32.const 1
i32.and
if
i32.const 0
i32.const 56
i32.const 518
i32.const 6
call $~lib/env/abort
unreachable
end
local.get $2
local.get $3
i32.const 1
i32.or
i32.store
local.get $1
local.get $0
i32.const 8
i32.sub
call $~lib/allocator/tlsf/Root#insert
end
end
)
(func $~lib/runtime/runtime.discard (; 20 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.const 152
i32.le_u
if
i32.const 0
i32.const 120
i32.const 68
i32.const 6
call $~lib/env/abort
unreachable
end
local.get $0
i32.const 16
i32.sub
local.tee $0
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 120
i32.const 70
i32.const 6
call $~lib/env/abort
unreachable
end
local.get $0
call $~lib/allocator/tlsf/__mem_free
)
(func $~lib/collector/itcm/maybeInit (; 21 ;) (type $FUNCSIG$v)
(func $~lib/collector/itcm/maybeInit (; 20 ;) (type $FUNCSIG$v)
(local $0 i32)
global.get $~lib/collector/itcm/state
i32.eqz
@ -1337,7 +1280,7 @@
global.set $~lib/collector/itcm/state
end
)
(func $~lib/collector/itcm/ManagedObjectList#push (; 22 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(func $~lib/collector/itcm/ManagedObjectList#push (; 21 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
local.get $0
i32.load offset=12
@ -1365,7 +1308,7 @@
local.get $1
i32.store offset=12
)
(func $~lib/collector/itcm/__ref_register (; 23 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $~lib/collector/itcm/__ref_register (; 22 ;) (type $FUNCSIG$vi) (param $0 i32)
call $~lib/collector/itcm/maybeInit
local.get $0
i32.const 16
@ -1382,16 +1325,16 @@
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
)
(func $~lib/runtime/runtime.register (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/util/runtime/register (; 23 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
i32.const 152
i32.const 160
i32.le_u
if
i32.const 0
i32.const 120
i32.const 82
i32.const 6
i32.const 128
i32.const 4
call $~lib/env/abort
unreachable
end
@ -1405,8 +1348,8 @@
if
i32.const 0
i32.const 120
i32.const 84
i32.const 6
i32.const 130
i32.const 4
call $~lib/env/abort
unreachable
end
@ -1419,19 +1362,23 @@
end
local.get $0
)
(func $~lib/runtime/runtime.newObject (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
call $~lib/util/runtime/allocate
local.get $1
call $~lib/util/runtime/register
)
(func $~lib/runtime/runtime.newString (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.const 1
i32.shl
call $~lib/runtime/runtime.allocate
i32.const 1
call $~lib/runtime/runtime.register
call $~lib/runtime/runtime.newObject
)
(func $~lib/runtime/runtime.newArrayBuffer (; 26 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
call $~lib/runtime/runtime.allocate
i32.const 2
call $~lib/runtime/runtime.register
call $~lib/runtime/runtime.newObject
)
(func $~lib/collector/itcm/ManagedObject#makeGray (; 27 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
@ -1680,18 +1627,18 @@
(local $5 i32)
(local $6 i32)
i32.const 16
call $~lib/runtime/runtime.allocate
call $~lib/util/runtime/allocate
local.get $2
call $~lib/runtime/runtime.register
call $~lib/util/runtime/register
local.tee $2
local.set $6
local.get $0
local.get $1
i32.shl
local.tee $4
call $~lib/runtime/runtime.allocate
call $~lib/util/runtime/allocate
i32.const 2
call $~lib/runtime/runtime.register
call $~lib/util/runtime/register
local.tee $5
local.tee $1
local.get $2
@ -1731,7 +1678,45 @@
(func $~lib/runtime/runtime.release (; 32 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/collector/itcm/step (; 33 ;) (type $FUNCSIG$v)
(func $~lib/allocator/tlsf/__mem_free (; 33 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
if
global.get $~lib/allocator/tlsf/ROOT
local.tee $1
if
local.get $0
i32.const 8
i32.sub
local.tee $2
i32.load
local.tee $3
i32.const 1
i32.and
if
i32.const 0
i32.const 56
i32.const 518
i32.const 6
call $~lib/env/abort
unreachable
end
local.get $2
local.get $3
i32.const 1
i32.or
i32.store
local.get $1
local.get $0
i32.const 8
i32.sub
call $~lib/allocator/tlsf/Root#insert
end
end
)
(func $~lib/collector/itcm/step (; 34 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case3|0
@ -1821,7 +1806,7 @@
i32.and
global.set $~lib/collector/itcm/iter
local.get $0
i32.const 152
i32.const 160
i32.ge_u
if
local.get $0
@ -1840,7 +1825,7 @@
end
end
)
(func $~lib/collector/itcm/__ref_collect (; 34 ;) (type $FUNCSIG$v)
(func $~lib/collector/itcm/__ref_collect (; 35 ;) (type $FUNCSIG$v)
call $~lib/collector/itcm/maybeInit
loop $continue|0
global.get $~lib/collector/itcm/state
@ -1859,17 +1844,17 @@
br_if $continue|1
end
)
(func $~lib/runtime/runtime.collect (; 35 ;) (type $FUNCSIG$v)
(func $~lib/runtime/runtime.collect (; 36 ;) (type $FUNCSIG$v)
call $~lib/collector/itcm/__ref_collect
)
(func $start (; 36 ;) (type $FUNCSIG$v)
(func $start (; 37 ;) (type $FUNCSIG$v)
i32.const 0
call $~lib/runtime/runtime.allocate
call $~lib/util/runtime/allocate
i32.const 3
call $~lib/runtime/runtime.register
call $~lib/util/runtime/register
global.set $~lib/runtime/ROOT
)
(func $~lib/runtime/__gc_mark_roots (; 37 ;) (type $FUNCSIG$v)
(func $~lib/runtime/__gc_mark_roots (; 38 ;) (type $FUNCSIG$v)
(local $0 i32)
global.get $~lib/runtime/ROOT
local.tee $0
@ -1890,7 +1875,7 @@
end
end
)
(func $~lib/runtime/__runtime_instanceof (; 38 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/runtime/__runtime_instanceof (; 39 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
block $nope
block $~lib/runtime/Root
block $~lib/arraybuffer/ArrayBuffer
@ -1917,10 +1902,10 @@
end
i32.const 0
)
(func $null (; 39 ;) (type $FUNCSIG$v)
(func $null (; 40 ;) (type $FUNCSIG$v)
nop
)
(func $~lib/runtime/runtime.newArray|trampoline (; 40 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(func $~lib/runtime/runtime.newArray|trampoline (; 41 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
block $1of1
block $0of1
block $outOfRange
@ -1940,7 +1925,7 @@
local.get $3
call $~lib/runtime/runtime.newArray
)
(func $~lib/setargc (; 41 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $~lib/setargc (; 42 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.set $~lib/argc
)