mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 15:12:12 +00:00
1367 lines
23 KiB
Plaintext
1367 lines
23 KiB
Plaintext
(module
|
|
(type $FUNCSIG$v (func))
|
|
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
|
|
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
|
|
(type $FUNCSIG$vii (func (param i32 i32)))
|
|
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
|
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
|
|
(type $FUNCSIG$viii (func (param i32 i32 i32)))
|
|
(type $FUNCSIG$vi (func (param i32)))
|
|
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
|
|
(memory $0 1)
|
|
(data (i32.const 8) "\10\00\00\00\1e")
|
|
(data (i32.const 24) "~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s")
|
|
(data (i32.const 56) "\10\00\00\00\1c")
|
|
(data (i32.const 72) "~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s")
|
|
(data (i32.const 104) "\10\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
|
|
(global $~lib/started (mut i32) (i32.const 0))
|
|
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
|
|
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
|
|
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
|
|
(export "memory" (memory $0))
|
|
(export "main" (func $assembly/index/main))
|
|
(export "__rt_allocate" (func $~lib/rt/index/__rt_allocate))
|
|
(export "__rt_reallocate" (func $~lib/rt/index/__rt_reallocate))
|
|
(export "__rt_free" (func $~lib/rt/index/__rt_free))
|
|
(export "__rt_retain" (func $~lib/rt/index/__rt_retain))
|
|
(export "__rt_release" (func $~lib/rt/index/__rt_release))
|
|
(export "__rt_collect" (func $~lib/rt/index/__rt_collect))
|
|
(export "__rt_typeinfo" (func $~lib/rt/common/__rt_typeinfo))
|
|
(func $assembly/index/main (; 1 ;) (type $FUNCSIG$v)
|
|
global.get $~lib/started
|
|
i32.eqz
|
|
if
|
|
i32.const 1
|
|
global.set $~lib/started
|
|
end
|
|
)
|
|
(func $~lib/rt/tlsf/removeBlock (; 2 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
|
(local $2 i32)
|
|
(local $3 i32)
|
|
(local $4 i32)
|
|
(local $5 i32)
|
|
local.get $1
|
|
i32.load
|
|
i32.const -4
|
|
i32.and
|
|
local.tee $2
|
|
i32.const 256
|
|
i32.lt_u
|
|
if (result i32)
|
|
local.get $2
|
|
i32.const 4
|
|
i32.shr_u
|
|
local.set $4
|
|
i32.const 0
|
|
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 $4
|
|
local.get $3
|
|
i32.const 7
|
|
i32.sub
|
|
end
|
|
local.set $3
|
|
local.get $1
|
|
i32.load offset=20
|
|
local.set $2
|
|
local.get $1
|
|
i32.load offset=16
|
|
local.tee $5
|
|
if
|
|
local.get $5
|
|
local.get $2
|
|
i32.store offset=20
|
|
end
|
|
local.get $2
|
|
if
|
|
local.get $2
|
|
local.get $5
|
|
i32.store offset=16
|
|
end
|
|
local.get $1
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 4
|
|
i32.shl
|
|
local.get $4
|
|
i32.add
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.load offset=96
|
|
i32.eq
|
|
if
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 4
|
|
i32.shl
|
|
local.get $4
|
|
i32.add
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
local.get $2
|
|
i32.store offset=96
|
|
local.get $2
|
|
i32.eqz
|
|
if
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.load offset=4
|
|
i32.const 1
|
|
local.get $4
|
|
i32.shl
|
|
i32.const -1
|
|
i32.xor
|
|
i32.and
|
|
local.tee $1
|
|
i32.store offset=4
|
|
local.get $1
|
|
i32.eqz
|
|
if
|
|
local.get $0
|
|
local.get $0
|
|
i32.load
|
|
i32.const 1
|
|
local.get $3
|
|
i32.shl
|
|
i32.const -1
|
|
i32.xor
|
|
i32.and
|
|
i32.store
|
|
end
|
|
end
|
|
end
|
|
)
|
|
(func $~lib/rt/tlsf/insertBlock (; 3 ;) (type $FUNCSIG$vii) (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.load
|
|
local.set $2
|
|
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 $2
|
|
i32.const -4
|
|
i32.and
|
|
i32.const 16
|
|
i32.add
|
|
local.get $5
|
|
i32.const -4
|
|
i32.and
|
|
i32.add
|
|
local.tee $3
|
|
i32.const 1073741824
|
|
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
|
|
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 $2
|
|
i32.const 2
|
|
i32.and
|
|
if
|
|
local.get $1
|
|
i32.const 4
|
|
i32.sub
|
|
i32.load
|
|
local.tee $3
|
|
i32.load
|
|
local.tee $6
|
|
i32.const -4
|
|
i32.and
|
|
i32.const 16
|
|
i32.add
|
|
local.get $2
|
|
i32.const -4
|
|
i32.and
|
|
i32.add
|
|
local.tee $7
|
|
i32.const 1073741824
|
|
i32.lt_u
|
|
if
|
|
local.get $0
|
|
local.get $3
|
|
call $~lib/rt/tlsf/removeBlock
|
|
local.get $3
|
|
local.get $6
|
|
i32.const 3
|
|
i32.and
|
|
local.get $7
|
|
i32.or
|
|
local.tee $2
|
|
i32.store
|
|
local.get $3
|
|
local.set $1
|
|
end
|
|
end
|
|
local.get $4
|
|
local.get $5
|
|
i32.const 2
|
|
i32.or
|
|
i32.store
|
|
local.get $4
|
|
i32.const 4
|
|
i32.sub
|
|
local.get $1
|
|
i32.store
|
|
local.get $2
|
|
i32.const -4
|
|
i32.and
|
|
local.tee $2
|
|
i32.const 256
|
|
i32.lt_u
|
|
if (result i32)
|
|
local.get $2
|
|
i32.const 4
|
|
i32.shr_u
|
|
local.set $2
|
|
i32.const 0
|
|
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
|
|
end
|
|
local.set $3
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 4
|
|
i32.shl
|
|
local.get $2
|
|
i32.add
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.load offset=96
|
|
local.set $4
|
|
local.get $1
|
|
i32.const 0
|
|
i32.store offset=16
|
|
local.get $1
|
|
local.get $4
|
|
i32.store offset=20
|
|
local.get $4
|
|
if
|
|
local.get $4
|
|
local.get $1
|
|
i32.store offset=16
|
|
end
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 4
|
|
i32.shl
|
|
local.get $2
|
|
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 $3
|
|
i32.shl
|
|
i32.or
|
|
i32.store
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.load offset=4
|
|
i32.const 1
|
|
local.get $2
|
|
i32.shl
|
|
i32.or
|
|
i32.store offset=4
|
|
)
|
|
(func $~lib/rt/tlsf/addMemory (; 4 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
|
(local $3 i32)
|
|
local.get $2
|
|
block (result i32)
|
|
local.get $0
|
|
i32.load offset=1568
|
|
local.tee $2
|
|
if
|
|
local.get $1
|
|
i32.const 16
|
|
i32.sub
|
|
local.get $2
|
|
i32.eq
|
|
if
|
|
local.get $2
|
|
i32.load
|
|
local.set $3
|
|
local.get $1
|
|
i32.const 16
|
|
i32.sub
|
|
local.set $1
|
|
end
|
|
end
|
|
local.get $1
|
|
end
|
|
i32.sub
|
|
local.tee $2
|
|
i32.const 48
|
|
i32.lt_u
|
|
if
|
|
return
|
|
end
|
|
local.get $1
|
|
local.get $3
|
|
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/initializeRoot (; 5 ;) (type $FUNCSIG$v)
|
|
(local $0 i32)
|
|
(local $1 i32)
|
|
(local $2 i32)
|
|
(local $3 i32)
|
|
i32.const 240
|
|
local.tee $3
|
|
i32.const 67107
|
|
i32.add
|
|
i32.const -65536
|
|
i32.and
|
|
i32.const 16
|
|
i32.shr_u
|
|
local.tee $1
|
|
current_memory
|
|
local.tee $0
|
|
i32.gt_s
|
|
if (result i32)
|
|
local.get $1
|
|
local.get $0
|
|
i32.sub
|
|
grow_memory
|
|
i32.const 0
|
|
i32.lt_s
|
|
else
|
|
i32.const 0
|
|
end
|
|
if
|
|
unreachable
|
|
end
|
|
local.get $3
|
|
local.tee $0
|
|
i32.const 0
|
|
i32.store
|
|
local.get $0
|
|
i32.const 0
|
|
i32.store offset=1568
|
|
loop $repeat|0
|
|
block $break|0
|
|
local.get $2
|
|
i32.const 23
|
|
i32.ge_u
|
|
br_if $break|0
|
|
local.get $0
|
|
local.get $2
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.const 0
|
|
i32.store offset=4
|
|
i32.const 0
|
|
local.set $1
|
|
loop $repeat|1
|
|
block $break|1
|
|
local.get $1
|
|
i32.const 16
|
|
i32.ge_u
|
|
br_if $break|1
|
|
local.get $0
|
|
local.get $2
|
|
i32.const 4
|
|
i32.shl
|
|
local.get $1
|
|
i32.add
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.const 0
|
|
i32.store offset=96
|
|
local.get $1
|
|
i32.const 1
|
|
i32.add
|
|
local.set $1
|
|
br $repeat|1
|
|
end
|
|
end
|
|
local.get $2
|
|
i32.const 1
|
|
i32.add
|
|
local.set $2
|
|
br $repeat|0
|
|
end
|
|
end
|
|
local.get $0
|
|
local.get $3
|
|
i32.const 1587
|
|
i32.add
|
|
i32.const -16
|
|
i32.and
|
|
current_memory
|
|
i32.const 16
|
|
i32.shl
|
|
call $~lib/rt/tlsf/addMemory
|
|
local.get $0
|
|
global.set $~lib/rt/tlsf/ROOT
|
|
)
|
|
(func $~lib/rt/tlsf/prepareSize (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
|
(local $1 i32)
|
|
local.get $0
|
|
i32.const 1073741824
|
|
i32.ge_u
|
|
if
|
|
i32.const 0
|
|
i32.const 24
|
|
i32.const 448
|
|
i32.const 29
|
|
call $~lib/builtins/abort
|
|
unreachable
|
|
end
|
|
local.get $0
|
|
i32.const 15
|
|
i32.add
|
|
i32.const -16
|
|
i32.and
|
|
local.tee $0
|
|
i32.const 16
|
|
local.tee $1
|
|
local.get $0
|
|
local.get $1
|
|
i32.gt_u
|
|
select
|
|
)
|
|
(func $~lib/rt/tlsf/searchBlock (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
|
(local $2 i32)
|
|
local.get $0
|
|
local.get $1
|
|
i32.const 256
|
|
i32.lt_u
|
|
if (result i32)
|
|
local.get $1
|
|
i32.const 4
|
|
i32.shr_u
|
|
local.set $1
|
|
i32.const 0
|
|
else
|
|
i32.const 31
|
|
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.get $1
|
|
local.get $1
|
|
i32.const 536870912
|
|
i32.lt_u
|
|
select
|
|
local.tee $1
|
|
i32.clz
|
|
i32.sub
|
|
local.set $2
|
|
local.get $1
|
|
local.get $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
|
|
end
|
|
local.tee $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 $0
|
|
local.get $1
|
|
i32.ctz
|
|
local.tee $1
|
|
i32.const 2
|
|
i32.shl
|
|
i32.add
|
|
i32.load offset=4
|
|
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/growMemory (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
|
(local $2 i32)
|
|
(local $3 i32)
|
|
(local $4 i32)
|
|
current_memory
|
|
local.tee $2
|
|
local.tee $3
|
|
local.get $1
|
|
i32.const 65535
|
|
i32.add
|
|
i32.const -65536
|
|
i32.and
|
|
i32.const 16
|
|
i32.shr_u
|
|
local.tee $1
|
|
local.tee $4
|
|
local.get $3
|
|
local.get $4
|
|
i32.gt_s
|
|
select
|
|
grow_memory
|
|
i32.const 0
|
|
i32.lt_s
|
|
if
|
|
local.get $1
|
|
grow_memory
|
|
i32.const 0
|
|
i32.lt_s
|
|
if
|
|
unreachable
|
|
end
|
|
end
|
|
local.get $0
|
|
local.get $2
|
|
i32.const 16
|
|
i32.shl
|
|
current_memory
|
|
i32.const 16
|
|
i32.shl
|
|
call $~lib/rt/tlsf/addMemory
|
|
)
|
|
(func $~lib/rt/tlsf/prepareBlock (; 9 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
|
(local $3 i32)
|
|
(local $4 i32)
|
|
local.get $1
|
|
i32.load
|
|
local.tee $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 $1
|
|
i32.const 16
|
|
i32.add
|
|
local.get $2
|
|
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.get $1
|
|
i32.load
|
|
i32.const -4
|
|
i32.and
|
|
i32.add
|
|
local.get $1
|
|
i32.const 16
|
|
i32.add
|
|
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 (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
|
(local $2 i32)
|
|
(local $3 i32)
|
|
local.get $0
|
|
local.get $1
|
|
call $~lib/rt/tlsf/prepareSize
|
|
local.tee $3
|
|
call $~lib/rt/tlsf/searchBlock
|
|
local.tee $2
|
|
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 $2
|
|
end
|
|
local.get $2
|
|
i32.const 0
|
|
i32.store offset=4
|
|
local.get $2
|
|
i32.const 0
|
|
i32.store offset=8
|
|
local.get $2
|
|
local.get $1
|
|
i32.store offset=12
|
|
local.get $0
|
|
local.get $2
|
|
call $~lib/rt/tlsf/removeBlock
|
|
local.get $0
|
|
local.get $2
|
|
local.get $3
|
|
call $~lib/rt/tlsf/prepareBlock
|
|
local.get $2
|
|
)
|
|
(func $~lib/rt/index/__rt_allocate (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
|
(local $2 i32)
|
|
global.get $~lib/rt/tlsf/ROOT
|
|
local.tee $2
|
|
if (result i32)
|
|
local.get $2
|
|
else
|
|
call $~lib/rt/tlsf/initializeRoot
|
|
global.get $~lib/rt/tlsf/ROOT
|
|
end
|
|
local.get $0
|
|
call $~lib/rt/tlsf/allocateBlock
|
|
local.tee $0
|
|
local.get $1
|
|
i32.store offset=8
|
|
local.get $0
|
|
i32.const 16
|
|
i32.add
|
|
)
|
|
(func $~lib/memory/memory.copy (; 12 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
|
(local $3 i32)
|
|
block $~lib/util/memory/memmove|inlined.0
|
|
local.get $0
|
|
local.get $1
|
|
i32.eq
|
|
br_if $~lib/util/memory/memmove|inlined.0
|
|
local.get $0
|
|
local.get $1
|
|
i32.lt_u
|
|
if
|
|
local.get $1
|
|
i32.const 7
|
|
i32.and
|
|
local.get $0
|
|
i32.const 7
|
|
i32.and
|
|
i32.eq
|
|
if
|
|
loop $continue|0
|
|
local.get $0
|
|
i32.const 7
|
|
i32.and
|
|
if
|
|
local.get $2
|
|
i32.eqz
|
|
br_if $~lib/util/memory/memmove|inlined.0
|
|
local.get $2
|
|
i32.const 1
|
|
i32.sub
|
|
local.set $2
|
|
local.get $0
|
|
local.tee $3
|
|
i32.const 1
|
|
i32.add
|
|
local.set $0
|
|
local.get $3
|
|
block (result i32)
|
|
local.get $1
|
|
local.tee $3
|
|
i32.const 1
|
|
i32.add
|
|
local.set $1
|
|
local.get $3
|
|
i32.load8_u
|
|
end
|
|
i32.store8
|
|
br $continue|0
|
|
end
|
|
end
|
|
loop $continue|1
|
|
local.get $2
|
|
i32.const 8
|
|
i32.ge_u
|
|
if
|
|
local.get $0
|
|
local.get $1
|
|
i64.load
|
|
i64.store
|
|
local.get $2
|
|
i32.const 8
|
|
i32.sub
|
|
local.set $2
|
|
local.get $0
|
|
i32.const 8
|
|
i32.add
|
|
local.set $0
|
|
local.get $1
|
|
i32.const 8
|
|
i32.add
|
|
local.set $1
|
|
br $continue|1
|
|
end
|
|
end
|
|
end
|
|
loop $continue|2
|
|
local.get $2
|
|
if
|
|
local.get $0
|
|
local.tee $3
|
|
i32.const 1
|
|
i32.add
|
|
local.set $0
|
|
local.get $3
|
|
block (result i32)
|
|
local.get $1
|
|
local.tee $3
|
|
i32.const 1
|
|
i32.add
|
|
local.set $1
|
|
local.get $3
|
|
i32.load8_u
|
|
end
|
|
i32.store8
|
|
local.get $2
|
|
i32.const 1
|
|
i32.sub
|
|
local.set $2
|
|
br $continue|2
|
|
end
|
|
end
|
|
else
|
|
local.get $1
|
|
i32.const 7
|
|
i32.and
|
|
local.get $0
|
|
i32.const 7
|
|
i32.and
|
|
i32.eq
|
|
if
|
|
loop $continue|3
|
|
local.get $0
|
|
local.get $2
|
|
i32.add
|
|
i32.const 7
|
|
i32.and
|
|
if
|
|
local.get $2
|
|
i32.eqz
|
|
br_if $~lib/util/memory/memmove|inlined.0
|
|
local.get $0
|
|
local.get $2
|
|
i32.const 1
|
|
i32.sub
|
|
local.tee $2
|
|
i32.add
|
|
local.get $1
|
|
local.get $2
|
|
i32.add
|
|
i32.load8_u
|
|
i32.store8
|
|
br $continue|3
|
|
end
|
|
end
|
|
loop $continue|4
|
|
local.get $2
|
|
i32.const 8
|
|
i32.ge_u
|
|
if
|
|
local.get $2
|
|
i32.const 8
|
|
i32.sub
|
|
local.tee $2
|
|
local.get $0
|
|
i32.add
|
|
local.get $1
|
|
local.get $2
|
|
i32.add
|
|
i64.load
|
|
i64.store
|
|
br $continue|4
|
|
end
|
|
end
|
|
end
|
|
loop $continue|5
|
|
local.get $2
|
|
if
|
|
local.get $0
|
|
local.get $2
|
|
i32.const 1
|
|
i32.sub
|
|
local.tee $2
|
|
i32.add
|
|
local.get $1
|
|
local.get $2
|
|
i32.add
|
|
i32.load8_u
|
|
i32.store8
|
|
br $continue|5
|
|
end
|
|
end
|
|
end
|
|
end
|
|
)
|
|
(func $~lib/rt/tlsf/reallocateBlock (; 13 ;) (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.get $2
|
|
call $~lib/rt/tlsf/prepareSize
|
|
local.tee $3
|
|
local.get $1
|
|
i32.load
|
|
local.tee $4
|
|
i32.const -4
|
|
i32.and
|
|
i32.le_u
|
|
if
|
|
local.get $0
|
|
local.get $1
|
|
local.get $3
|
|
call $~lib/rt/tlsf/prepareBlock
|
|
local.get $1
|
|
local.get $2
|
|
i32.store offset=12
|
|
local.get $1
|
|
return
|
|
end
|
|
local.get $1
|
|
i32.const 16
|
|
i32.add
|
|
local.get $1
|
|
i32.load
|
|
i32.const -4
|
|
i32.and
|
|
i32.add
|
|
local.tee $6
|
|
i32.load
|
|
local.tee $5
|
|
i32.const 1
|
|
i32.and
|
|
if
|
|
local.get $4
|
|
i32.const -4
|
|
i32.and
|
|
i32.const 16
|
|
i32.add
|
|
local.get $5
|
|
i32.const -4
|
|
i32.and
|
|
i32.add
|
|
local.tee $5
|
|
local.get $3
|
|
i32.ge_u
|
|
if
|
|
local.get $0
|
|
local.get $6
|
|
call $~lib/rt/tlsf/removeBlock
|
|
local.get $1
|
|
local.get $4
|
|
i32.const 3
|
|
i32.and
|
|
local.get $5
|
|
i32.or
|
|
i32.store
|
|
local.get $1
|
|
local.get $2
|
|
i32.store offset=12
|
|
local.get $0
|
|
local.get $1
|
|
local.get $3
|
|
call $~lib/rt/tlsf/prepareBlock
|
|
local.get $1
|
|
return
|
|
end
|
|
end
|
|
local.get $0
|
|
local.get $2
|
|
call $~lib/rt/tlsf/allocateBlock
|
|
local.tee $3
|
|
local.get $1
|
|
i32.load offset=4
|
|
i32.store offset=4
|
|
local.get $3
|
|
local.get $1
|
|
i32.load offset=8
|
|
i32.store offset=8
|
|
local.get $3
|
|
i32.const 16
|
|
i32.add
|
|
local.get $1
|
|
i32.const 16
|
|
i32.add
|
|
local.get $2
|
|
call $~lib/memory/memory.copy
|
|
local.get $1
|
|
local.get $4
|
|
i32.const 1
|
|
i32.or
|
|
i32.store
|
|
local.get $0
|
|
local.get $1
|
|
call $~lib/rt/tlsf/insertBlock
|
|
local.get $3
|
|
)
|
|
(func $~lib/rt/index/__rt_reallocate (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
|
global.get $~lib/rt/tlsf/ROOT
|
|
local.get $0
|
|
i32.const 16
|
|
i32.sub
|
|
local.get $1
|
|
call $~lib/rt/tlsf/reallocateBlock
|
|
i32.const 16
|
|
i32.add
|
|
)
|
|
(func $~lib/rt/tlsf/freeBlock (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
|
local.get $1
|
|
local.get $1
|
|
i32.load
|
|
i32.const 1
|
|
i32.or
|
|
i32.store
|
|
local.get $0
|
|
local.get $1
|
|
call $~lib/rt/tlsf/insertBlock
|
|
)
|
|
(func $~lib/rt/index/__rt_free (; 16 ;) (type $FUNCSIG$vi) (param $0 i32)
|
|
global.get $~lib/rt/tlsf/ROOT
|
|
local.get $0
|
|
i32.const 16
|
|
i32.sub
|
|
call $~lib/rt/tlsf/freeBlock
|
|
)
|
|
(func $~lib/rt/index/__rt_retain (; 17 ;) (type $FUNCSIG$vi) (param $0 i32)
|
|
local.get $0
|
|
if
|
|
local.get $0
|
|
i32.const 16
|
|
i32.sub
|
|
local.tee $0
|
|
local.get $0
|
|
i32.load offset=4
|
|
i32.const 1
|
|
i32.add
|
|
i32.store offset=4
|
|
end
|
|
)
|
|
(func $~lib/rt/index/__rt_release (; 18 ;) (type $FUNCSIG$vi) (param $0 i32)
|
|
local.get $0
|
|
if
|
|
local.get $0
|
|
i32.const 16
|
|
i32.sub
|
|
local.tee $0
|
|
i32.load offset=4
|
|
i32.const 268435455
|
|
i32.and
|
|
i32.const 1
|
|
i32.ne
|
|
if
|
|
local.get $0
|
|
i32.load offset=8
|
|
drop
|
|
end
|
|
unreachable
|
|
end
|
|
)
|
|
(func $~lib/rt/pure/markGray (; 19 ;) (type $FUNCSIG$vi) (param $0 i32)
|
|
(local $1 i32)
|
|
local.get $0
|
|
i32.load offset=4
|
|
local.tee $1
|
|
i32.const 1879048192
|
|
i32.and
|
|
i32.const 268435456
|
|
i32.ne
|
|
if
|
|
local.get $0
|
|
local.get $1
|
|
i32.const -1879048193
|
|
i32.and
|
|
i32.const 268435456
|
|
i32.or
|
|
i32.store offset=4
|
|
unreachable
|
|
end
|
|
)
|
|
(func $~lib/rt/pure/scan (; 20 ;) (type $FUNCSIG$vi) (param $0 i32)
|
|
(local $1 i32)
|
|
local.get $0
|
|
i32.load offset=4
|
|
local.tee $1
|
|
i32.const 1879048192
|
|
i32.and
|
|
i32.const 268435456
|
|
i32.eq
|
|
if
|
|
local.get $1
|
|
i32.const 268435455
|
|
i32.and
|
|
i32.const 0
|
|
i32.gt_u
|
|
if
|
|
local.get $0
|
|
local.get $0
|
|
i32.load offset=4
|
|
i32.const -1879048193
|
|
i32.and
|
|
i32.store offset=4
|
|
else
|
|
local.get $0
|
|
local.get $1
|
|
i32.const -1879048193
|
|
i32.and
|
|
i32.const 536870912
|
|
i32.or
|
|
i32.store offset=4
|
|
end
|
|
unreachable
|
|
end
|
|
)
|
|
(func $~lib/rt/pure/collectWhite (; 21 ;) (type $FUNCSIG$vi) (param $0 i32)
|
|
(local $1 i32)
|
|
local.get $0
|
|
i32.load offset=4
|
|
local.tee $1
|
|
i32.const -2147483648
|
|
i32.and
|
|
i32.eqz
|
|
i32.const 0
|
|
local.get $1
|
|
i32.const 1879048192
|
|
i32.and
|
|
i32.const 536870912
|
|
i32.eq
|
|
select
|
|
if
|
|
unreachable
|
|
end
|
|
global.get $~lib/rt/tlsf/ROOT
|
|
local.get $0
|
|
call $~lib/rt/tlsf/freeBlock
|
|
)
|
|
(func $~lib/rt/pure/collectCycles (; 22 ;) (type $FUNCSIG$v)
|
|
(local $0 i32)
|
|
(local $1 i32)
|
|
(local $2 i32)
|
|
(local $3 i32)
|
|
(local $4 i32)
|
|
(local $5 i32)
|
|
global.get $~lib/rt/pure/ROOTS
|
|
local.tee $5
|
|
local.tee $2
|
|
local.set $3
|
|
global.get $~lib/rt/pure/CUR
|
|
local.set $0
|
|
loop $repeat|0
|
|
block $break|0
|
|
local.get $3
|
|
local.get $0
|
|
i32.ge_u
|
|
br_if $break|0
|
|
local.get $3
|
|
i32.load
|
|
local.tee $4
|
|
i32.load offset=4
|
|
local.tee $1
|
|
i32.const 268435455
|
|
i32.and
|
|
i32.const 0
|
|
i32.gt_u
|
|
i32.const 0
|
|
local.get $1
|
|
i32.const 1879048192
|
|
i32.and
|
|
i32.const 805306368
|
|
i32.eq
|
|
select
|
|
if
|
|
local.get $4
|
|
call $~lib/rt/pure/markGray
|
|
local.get $2
|
|
local.get $4
|
|
i32.store
|
|
local.get $2
|
|
i32.const 4
|
|
i32.add
|
|
local.set $2
|
|
else
|
|
i32.const 0
|
|
local.get $1
|
|
i32.const 268435455
|
|
i32.and
|
|
i32.eqz
|
|
local.get $1
|
|
i32.const 1879048192
|
|
i32.and
|
|
select
|
|
if
|
|
global.get $~lib/rt/tlsf/ROOT
|
|
local.get $4
|
|
call $~lib/rt/tlsf/freeBlock
|
|
else
|
|
local.get $4
|
|
local.get $1
|
|
i32.const 2147483647
|
|
i32.and
|
|
i32.store offset=4
|
|
end
|
|
end
|
|
local.get $3
|
|
i32.const 4
|
|
i32.add
|
|
local.set $3
|
|
br $repeat|0
|
|
end
|
|
end
|
|
local.get $2
|
|
global.set $~lib/rt/pure/CUR
|
|
local.get $5
|
|
local.set $0
|
|
loop $repeat|1
|
|
block $break|1
|
|
local.get $0
|
|
local.get $2
|
|
i32.ge_u
|
|
br_if $break|1
|
|
local.get $0
|
|
i32.load
|
|
call $~lib/rt/pure/scan
|
|
local.get $0
|
|
i32.const 4
|
|
i32.add
|
|
local.set $0
|
|
br $repeat|1
|
|
end
|
|
end
|
|
local.get $5
|
|
local.set $0
|
|
loop $repeat|2
|
|
block $break|2
|
|
local.get $0
|
|
local.get $2
|
|
i32.ge_u
|
|
br_if $break|2
|
|
local.get $0
|
|
i32.load
|
|
local.tee $1
|
|
local.get $1
|
|
i32.load offset=4
|
|
i32.const 2147483647
|
|
i32.and
|
|
i32.store offset=4
|
|
local.get $1
|
|
call $~lib/rt/pure/collectWhite
|
|
local.get $0
|
|
i32.const 4
|
|
i32.add
|
|
local.set $0
|
|
br $repeat|2
|
|
end
|
|
end
|
|
local.get $5
|
|
global.set $~lib/rt/pure/CUR
|
|
)
|
|
(func $~lib/rt/index/__rt_collect (; 23 ;) (type $FUNCSIG$v)
|
|
call $~lib/rt/pure/collectCycles
|
|
)
|
|
(func $~lib/rt/common/__rt_typeinfo (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
|
(local $1 i32)
|
|
i32.const 104
|
|
local.set $1
|
|
local.get $0
|
|
if (result i32)
|
|
local.get $0
|
|
local.get $1
|
|
i32.load
|
|
i32.gt_u
|
|
else
|
|
i32.const 1
|
|
end
|
|
if (result i32)
|
|
unreachable
|
|
else
|
|
local.get $1
|
|
local.get $0
|
|
i32.const 3
|
|
i32.shl
|
|
i32.add
|
|
i32.load
|
|
end
|
|
)
|
|
(func $start (; 25 ;) (type $FUNCSIG$v)
|
|
nop
|
|
)
|
|
)
|