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

@ -12,8 +12,8 @@
(memory $0 1)
(data (i32.const 8) "\01\00\00\00,")
(data (i32.const 24) "~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s")
(data (i32.const 72) "\01\00\00\00\1e")
(data (i32.const 88) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 72) "\01\00\00\00(")
(data (i32.const 88) "~\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))
@ -28,18 +28,17 @@
(export "memory" (memory $0))
(export "table" (table $0))
(export "test" (func $class-extends/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-extends/test (; 1 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
@ -68,7 +67,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
@ -88,7 +99,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
@ -123,7 +134,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
@ -157,7 +168,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
@ -173,7 +184,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
@ -207,7 +218,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
@ -226,7 +237,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)
@ -355,7 +366,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
@ -385,7 +396,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
@ -430,7 +441,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)
@ -660,7 +671,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
@ -783,7 +794,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
@ -797,7 +808,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
@ -909,7 +920,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
@ -1020,7 +1031,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)
@ -1046,14 +1057,14 @@
if
unreachable
end
i32.const 120
i32.const 128
local.set $2
i32.const 120
i32.const 128
global.set $~lib/allocator/tlsf/ROOT
i32.const 2912
i32.const 0
i32.store
i32.const 120
i32.const 128
i32.const 0
i32.store
i32.const 0
@ -1063,7 +1074,7 @@
i32.const 22
i32.lt_u
if
i32.const 120
i32.const 128
local.get $1
i32.const 0
call $~lib/allocator/tlsf/Root#setSLMap
@ -1074,7 +1085,7 @@
i32.const 32
i32.lt_u
if
i32.const 120
i32.const 128
local.get $1
local.get $3
i32.const 0
@ -1093,8 +1104,8 @@
br $repeat|0
end
end
i32.const 120
i32.const 3040
i32.const 128
i32.const 3048
current_memory
i32.const 16
i32.shl
@ -1190,7 +1201,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
@ -1217,75 +1228,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 24
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 120
i32.le_u
if
i32.const 0
i32.const 88
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 88
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
@ -1328,7 +1271,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
@ -1356,7 +1299,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
@ -1373,16 +1316,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 120
i32.const 128
i32.le_u
if
i32.const 0
i32.const 88
i32.const 82
i32.const 6
i32.const 128
i32.const 4
call $~lib/env/abort
unreachable
end
@ -1396,8 +1339,8 @@
if
i32.const 0
i32.const 88
i32.const 84
i32.const 6
i32.const 130
i32.const 4
call $~lib/env/abort
unreachable
end
@ -1410,19 +1353,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)
@ -1671,18 +1618,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
@ -1722,7 +1669,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 24
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
@ -1812,7 +1797,7 @@
i32.and
global.set $~lib/collector/itcm/iter
local.get $0
i32.const 120
i32.const 128
i32.ge_u
if
local.get $0
@ -1831,7 +1816,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
@ -1850,17 +1835,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
@ -1881,7 +1866,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
@ -1908,10 +1893,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
@ -1931,7 +1916,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
)