2018-02-12 19:17:50 +01:00
|
|
|
(module
|
2019-02-21 00:11:22 +01:00
|
|
|
(type $iiii_ (func (param i32 i32 i32 i32)))
|
|
|
|
(type $_ (func))
|
2018-02-12 19:17:50 +01:00
|
|
|
(type $iiii (func (param i32 i32 i32) (result i32)))
|
2018-07-19 02:10:04 +02:00
|
|
|
(type $ii (func (param i32) (result i32)))
|
2019-02-21 00:11:22 +01:00
|
|
|
(type $ii_ (func (param i32 i32)))
|
|
|
|
(type $iii_ (func (param i32 i32 i32)))
|
2018-02-12 19:17:50 +01:00
|
|
|
(type $iii (func (param i32 i32) (result i32)))
|
2019-02-21 00:11:22 +01:00
|
|
|
(type $i_ (func (param i32)))
|
2018-06-09 02:27:10 +02:00
|
|
|
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
2019-02-21 00:11:22 +01:00
|
|
|
(memory $0 1)
|
|
|
|
(data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00")
|
|
|
|
(table $0 1 funcref)
|
|
|
|
(elem (i32.const 0) $null)
|
2018-04-03 23:56:48 +02:00
|
|
|
(global $~lib/allocator/tlsf/SL_BITS i32 (i32.const 5))
|
|
|
|
(global $~lib/allocator/tlsf/SL_SIZE i32 (i32.const 32))
|
|
|
|
(global $~lib/allocator/tlsf/SB_BITS i32 (i32.const 8))
|
|
|
|
(global $~lib/allocator/tlsf/SB_SIZE i32 (i32.const 256))
|
|
|
|
(global $~lib/allocator/tlsf/FL_BITS i32 (i32.const 22))
|
|
|
|
(global $~lib/allocator/tlsf/FREE i32 (i32.const 1))
|
|
|
|
(global $~lib/allocator/tlsf/LEFT_FREE i32 (i32.const 2))
|
|
|
|
(global $~lib/allocator/tlsf/TAGS i32 (i32.const 3))
|
2019-02-21 00:11:22 +01:00
|
|
|
(global $~lib/allocator/tlsf/Block.INFO i32 (i32.const 8))
|
|
|
|
(global $~lib/allocator/tlsf/Block.MIN_SIZE i32 (i32.const 16))
|
|
|
|
(global $~lib/allocator/tlsf/Block.MAX_SIZE i32 (i32.const 1073741824))
|
2018-07-19 02:10:04 +02:00
|
|
|
(global $~lib/allocator/tlsf/Root.SL_START i32 (i32.const 4))
|
|
|
|
(global $~lib/allocator/tlsf/Root.SL_END i32 (i32.const 92))
|
|
|
|
(global $~lib/allocator/tlsf/Root.HL_START i32 (i32.const 96))
|
|
|
|
(global $~lib/allocator/tlsf/Root.HL_END i32 (i32.const 2912))
|
|
|
|
(global $~lib/allocator/tlsf/Root.SIZE i32 (i32.const 2916))
|
2019-02-21 00:11:22 +01:00
|
|
|
(global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0))
|
|
|
|
(global $~lib/memory/HEAP_BASE i32 (i32.const 56))
|
2018-07-19 02:10:04 +02:00
|
|
|
(export "memory" (memory $0))
|
2019-02-21 00:11:22 +01:00
|
|
|
(export "table" (table $0))
|
2018-07-18 23:49:32 +02:00
|
|
|
(export "memory.compare" (func $~lib/memory/memory.compare))
|
|
|
|
(export "memory.allocate" (func $~lib/memory/memory.allocate))
|
|
|
|
(export "memory.free" (func $~lib/memory/memory.free))
|
|
|
|
(export "memory.reset" (func $~lib/memory/memory.reset))
|
2018-02-12 19:17:50 +01:00
|
|
|
(start $start)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $start:~lib/allocator/tlsf (; 1 ;) (type $_)
|
|
|
|
i32.const 1
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.shl
|
|
|
|
i32.const 32
|
|
|
|
i32.le_s
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 122
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $start:assembly/index (; 2 ;) (type $_)
|
|
|
|
call $start:~lib/allocator/tlsf
|
2018-07-19 02:10:04 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/internal/memory/memcmp (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2018-07-18 23:49:32 +02:00
|
|
|
(local $3 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
i32.eq
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
return
|
|
|
|
end
|
|
|
|
block $break|0
|
|
|
|
loop $continue|0
|
|
|
|
local.get $2
|
|
|
|
i32.const 0
|
|
|
|
i32.ne
|
|
|
|
local.tee $3
|
|
|
|
if (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.load8_u
|
|
|
|
local.get $1
|
|
|
|
i32.load8_u
|
|
|
|
i32.eq
|
|
|
|
else
|
|
|
|
local.get $3
|
|
|
|
end
|
|
|
|
if
|
|
|
|
block
|
|
|
|
local.get $2
|
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
local.set $2
|
|
|
|
local.get $0
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $0
|
|
|
|
local.get $1
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $1
|
|
|
|
end
|
|
|
|
br $continue|0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
if (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.load8_u
|
|
|
|
local.get $1
|
|
|
|
i32.load8_u
|
|
|
|
i32.sub
|
|
|
|
else
|
|
|
|
i32.const 0
|
|
|
|
end
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/memory/memory.compare (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
local.get $2
|
|
|
|
call $~lib/internal/memory/memcmp
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#set:tailRef (; 5 ;) (type $ii_) (param $0 i32) (param $1 i32)
|
|
|
|
i32.const 0
|
|
|
|
local.get $1
|
|
|
|
i32.store offset=2912
|
2018-07-19 02:10:04 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#setSLMap (; 6 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/FL_BITS
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 144
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
i32.const 4
|
|
|
|
i32.mul
|
|
|
|
i32.add
|
|
|
|
local.get $2
|
|
|
|
i32.store offset=4
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#setHead (; 7 ;) (type $iiii_) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/FL_BITS
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 167
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/SL_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 168
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/SL_SIZE
|
|
|
|
i32.mul
|
|
|
|
local.get $2
|
|
|
|
i32.add
|
|
|
|
i32.const 4
|
|
|
|
i32.mul
|
|
|
|
i32.add
|
|
|
|
local.get $3
|
|
|
|
i32.store offset=96
|
2018-07-19 02:10:04 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#get:tailRef (; 8 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.load offset=2912
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Block#get:right (; 9 ;) (type $ii) (param $0 i32) (result i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $1 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $0
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 89
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.add
|
|
|
|
local.get $0
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.add
|
|
|
|
local.tee $1
|
|
|
|
i32.eqz
|
|
|
|
if (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 90
|
|
|
|
i32.const 11
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
else
|
|
|
|
local.get $1
|
|
|
|
end
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/fls<usize> (; 10 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.const 0
|
|
|
|
i32.ne
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 428
|
|
|
|
i32.const 2
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
i32.const 31
|
|
|
|
local.get $0
|
|
|
|
i32.clz
|
|
|
|
i32.sub
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#getHead (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/FL_BITS
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 158
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/SL_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 159
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/SL_SIZE
|
|
|
|
i32.mul
|
|
|
|
local.get $2
|
|
|
|
i32.add
|
|
|
|
i32.const 4
|
|
|
|
i32.mul
|
|
|
|
i32.add
|
|
|
|
i32.load offset=96
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#getSLMap (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/FL_BITS
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 138
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
i32.const 4
|
|
|
|
i32.mul
|
|
|
|
i32.add
|
|
|
|
i32.load offset=4
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#remove (; 13 ;) (type $ii_) (param $0 i32) (param $1 i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
|
|
|
(local $5 i32)
|
|
|
|
(local $6 i32)
|
|
|
|
(local $7 i32)
|
|
|
|
(local $8 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $1
|
|
|
|
i32.load
|
|
|
|
local.set $2
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 258
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.set $3
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.ge_u
|
|
|
|
local.tee $4
|
|
|
|
if (result i32)
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MAX_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
else
|
|
|
|
local.get $4
|
|
|
|
end
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 260
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/SB_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
local.set $5
|
|
|
|
local.get $3
|
|
|
|
i32.const 8
|
|
|
|
i32.div_u
|
|
|
|
local.set $6
|
|
|
|
else
|
|
|
|
local.get $3
|
|
|
|
call $~lib/allocator/tlsf/fls<usize>
|
|
|
|
local.set $5
|
|
|
|
local.get $3
|
|
|
|
local.get $5
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.sub
|
|
|
|
i32.shr_u
|
|
|
|
i32.const 1
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.shl
|
|
|
|
i32.xor
|
|
|
|
local.set $6
|
|
|
|
local.get $5
|
|
|
|
global.get $~lib/allocator/tlsf/SB_BITS
|
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
i32.sub
|
|
|
|
local.set $5
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
i32.load offset=4
|
|
|
|
local.set $7
|
|
|
|
local.get $1
|
|
|
|
i32.load offset=8
|
|
|
|
local.set $8
|
|
|
|
local.get $7
|
|
|
|
if
|
|
|
|
local.get $7
|
|
|
|
local.get $8
|
|
|
|
i32.store offset=8
|
|
|
|
end
|
|
|
|
local.get $8
|
|
|
|
if
|
|
|
|
local.get $8
|
|
|
|
local.get $7
|
|
|
|
i32.store offset=4
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
local.get $0
|
|
|
|
local.get $5
|
|
|
|
local.get $6
|
|
|
|
call $~lib/allocator/tlsf/Root#getHead
|
|
|
|
i32.eq
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
local.get $5
|
|
|
|
local.get $6
|
|
|
|
local.get $8
|
|
|
|
call $~lib/allocator/tlsf/Root#setHead
|
|
|
|
local.get $8
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
local.get $5
|
|
|
|
call $~lib/allocator/tlsf/Root#getSLMap
|
|
|
|
local.set $4
|
|
|
|
local.get $0
|
|
|
|
local.get $5
|
|
|
|
local.get $4
|
|
|
|
i32.const 1
|
|
|
|
local.get $6
|
|
|
|
i32.shl
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.tee $4
|
|
|
|
call $~lib/allocator/tlsf/Root#setSLMap
|
|
|
|
local.get $4
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
local.get $0
|
|
|
|
i32.load
|
|
|
|
i32.const 1
|
|
|
|
local.get $5
|
|
|
|
i32.shl
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.store
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Block#get:left (; 14 ;) (type $ii) (param $0 i32) (result i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $1 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $0
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 81
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
i32.const 4
|
|
|
|
i32.sub
|
|
|
|
i32.load
|
|
|
|
local.tee $1
|
|
|
|
i32.eqz
|
|
|
|
if (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 82
|
|
|
|
i32.const 11
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
else
|
|
|
|
local.get $1
|
|
|
|
end
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#setJump (; 15 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
|
|
|
local.get $1
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 334
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Block#get:right
|
|
|
|
local.get $2
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 335
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 336
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
i32.const 4
|
|
|
|
i32.sub
|
|
|
|
local.get $1
|
|
|
|
i32.store
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#insert (; 16 ;) (type $ii_) (param $0 i32) (param $1 i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(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)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $1
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 189
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
i32.load
|
|
|
|
local.set $2
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 191
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.tee $3
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.ge_u
|
|
|
|
local.tee $4
|
|
|
|
if (result i32)
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MAX_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
else
|
|
|
|
local.get $4
|
|
|
|
end
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 193
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Block#get:right
|
|
|
|
local.tee $4
|
|
|
|
i32.eqz
|
|
|
|
if (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 197
|
|
|
|
i32.const 23
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
else
|
|
|
|
local.get $4
|
|
|
|
end
|
|
|
|
local.set $5
|
|
|
|
local.get $5
|
|
|
|
i32.load
|
|
|
|
local.set $6
|
|
|
|
local.get $6
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
local.get $5
|
|
|
|
call $~lib/allocator/tlsf/Root#remove
|
|
|
|
local.get $1
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
local.get $6
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.add
|
|
|
|
i32.add
|
|
|
|
local.tee $2
|
|
|
|
i32.store
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Block#get:right
|
|
|
|
local.set $5
|
|
|
|
local.get $5
|
|
|
|
i32.load
|
|
|
|
local.set $6
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.and
|
|
|
|
if
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Block#get:left
|
|
|
|
local.tee $4
|
|
|
|
i32.eqz
|
|
|
|
if (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 211
|
|
|
|
i32.const 24
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
else
|
|
|
|
local.get $4
|
|
|
|
end
|
|
|
|
local.set $4
|
|
|
|
local.get $4
|
|
|
|
i32.load
|
|
|
|
local.set $7
|
|
|
|
local.get $7
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 213
|
|
|
|
i32.const 6
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $4
|
|
|
|
call $~lib/allocator/tlsf/Root#remove
|
|
|
|
local.get $4
|
|
|
|
local.get $7
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.add
|
|
|
|
i32.add
|
|
|
|
local.tee $7
|
|
|
|
i32.store
|
|
|
|
local.get $4
|
|
|
|
local.set $1
|
|
|
|
local.get $7
|
|
|
|
local.set $2
|
|
|
|
end
|
|
|
|
local.get $5
|
|
|
|
local.get $6
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
local.get $5
|
|
|
|
call $~lib/allocator/tlsf/Root#setJump
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.set $3
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.ge_u
|
|
|
|
local.tee $7
|
|
|
|
if (result i32)
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MAX_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
else
|
|
|
|
local.get $7
|
|
|
|
end
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 226
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/SB_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
local.set $8
|
|
|
|
local.get $3
|
|
|
|
i32.const 8
|
|
|
|
i32.div_u
|
|
|
|
local.set $9
|
|
|
|
else
|
|
|
|
local.get $3
|
|
|
|
call $~lib/allocator/tlsf/fls<usize>
|
|
|
|
local.set $8
|
|
|
|
local.get $3
|
|
|
|
local.get $8
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.sub
|
|
|
|
i32.shr_u
|
|
|
|
i32.const 1
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.shl
|
|
|
|
i32.xor
|
|
|
|
local.set $9
|
|
|
|
local.get $8
|
|
|
|
global.get $~lib/allocator/tlsf/SB_BITS
|
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
i32.sub
|
|
|
|
local.set $8
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $8
|
|
|
|
local.get $9
|
|
|
|
call $~lib/allocator/tlsf/Root#getHead
|
|
|
|
local.set $10
|
|
|
|
local.get $1
|
|
|
|
i32.const 0
|
|
|
|
i32.store offset=4
|
|
|
|
local.get $1
|
|
|
|
local.get $10
|
|
|
|
i32.store offset=8
|
|
|
|
local.get $10
|
|
|
|
if
|
|
|
|
local.get $10
|
|
|
|
local.get $1
|
|
|
|
i32.store offset=4
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $8
|
|
|
|
local.get $9
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Root#setHead
|
|
|
|
local.get $0
|
|
|
|
local.get $0
|
|
|
|
i32.load
|
|
|
|
i32.const 1
|
|
|
|
local.get $8
|
|
|
|
i32.shl
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $0
|
|
|
|
local.get $8
|
|
|
|
local.get $0
|
|
|
|
local.get $8
|
|
|
|
call $~lib/allocator/tlsf/Root#getSLMap
|
|
|
|
i32.const 1
|
|
|
|
local.get $9
|
|
|
|
i32.shl
|
|
|
|
i32.or
|
|
|
|
call $~lib/allocator/tlsf/Root#setSLMap
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#addMemory (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
|
|
|
(local $5 i32)
|
|
|
|
(local $6 i32)
|
|
|
|
(local $7 i32)
|
|
|
|
(local $8 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $1
|
|
|
|
local.get $2
|
|
|
|
i32.le_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 377
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
i32.const 7
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 378
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
i32.const 7
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 379
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/tlsf/Root#get:tailRef
|
|
|
|
local.set $3
|
|
|
|
i32.const 0
|
|
|
|
local.set $4
|
|
|
|
local.get $3
|
|
|
|
if
|
|
|
|
local.get $1
|
|
|
|
local.get $3
|
|
|
|
i32.const 4
|
|
|
|
i32.add
|
|
|
|
i32.ge_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 384
|
|
|
|
i32.const 6
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.sub
|
|
|
|
local.get $3
|
|
|
|
i32.eq
|
|
|
|
if
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.sub
|
|
|
|
local.set $1
|
|
|
|
local.get $3
|
|
|
|
i32.load
|
|
|
|
local.set $4
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local.get $1
|
|
|
|
local.get $0
|
|
|
|
global.get $~lib/allocator/tlsf/Root.SIZE
|
|
|
|
i32.add
|
|
|
|
i32.ge_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 393
|
|
|
|
i32.const 6
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
local.get $1
|
|
|
|
i32.sub
|
|
|
|
local.set $5
|
|
|
|
local.get $5
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.add
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.add
|
|
|
|
i32.lt_u
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local.get $5
|
|
|
|
i32.const 2
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.mul
|
|
|
|
i32.sub
|
|
|
|
local.set $6
|
|
|
|
local.get $1
|
|
|
|
local.set $7
|
|
|
|
local.get $7
|
|
|
|
local.get $6
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.or
|
|
|
|
local.get $4
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.and
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $7
|
|
|
|
i32.const 0
|
|
|
|
i32.store offset=4
|
|
|
|
local.get $7
|
|
|
|
i32.const 0
|
|
|
|
i32.store offset=8
|
|
|
|
local.get $1
|
|
|
|
local.get $5
|
|
|
|
i32.add
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.sub
|
|
|
|
local.set $8
|
|
|
|
local.get $8
|
|
|
|
i32.const 0
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $0
|
|
|
|
local.get $8
|
|
|
|
call $~lib/allocator/tlsf/Root#set:tailRef
|
|
|
|
local.get $0
|
|
|
|
local.get $7
|
|
|
|
call $~lib/allocator/tlsf/Root#insert
|
|
|
|
i32.const 1
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/ffs<usize> (; 18 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.const 0
|
|
|
|
i32.ne
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 422
|
|
|
|
i32.const 2
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
i32.ctz
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/ffs<u32> (; 19 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.const 0
|
|
|
|
i32.ne
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 422
|
|
|
|
i32.const 2
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
i32.ctz
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#search (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
|
|
|
(local $5 i32)
|
|
|
|
(local $6 i32)
|
|
|
|
(local $7 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.ge_u
|
|
|
|
local.tee $2
|
|
|
|
if (result i32)
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MAX_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
else
|
|
|
|
local.get $2
|
|
|
|
end
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 296
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/SB_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
local.set $3
|
|
|
|
local.get $1
|
|
|
|
i32.const 8
|
|
|
|
i32.div_u
|
|
|
|
local.set $4
|
|
|
|
else
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/fls<usize>
|
|
|
|
local.set $3
|
|
|
|
local.get $1
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.sub
|
|
|
|
i32.shr_u
|
|
|
|
i32.const 1
|
|
|
|
global.get $~lib/allocator/tlsf/SL_BITS
|
|
|
|
i32.shl
|
|
|
|
i32.xor
|
|
|
|
local.set $4
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/SB_BITS
|
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
i32.sub
|
|
|
|
local.set $3
|
|
|
|
local.get $4
|
|
|
|
global.get $~lib/allocator/tlsf/SL_SIZE
|
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
i32.lt_u
|
|
|
|
if
|
|
|
|
local.get $4
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $4
|
|
|
|
else
|
|
|
|
local.get $3
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $3
|
|
|
|
i32.const 0
|
|
|
|
local.set $4
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $3
|
|
|
|
call $~lib/allocator/tlsf/Root#getSLMap
|
|
|
|
i32.const 0
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
local.get $4
|
|
|
|
i32.shl
|
|
|
|
i32.and
|
|
|
|
local.set $5
|
|
|
|
local.get $5
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
i32.load
|
|
|
|
i32.const 0
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
local.get $3
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
i32.shl
|
|
|
|
i32.and
|
|
|
|
local.set $2
|
|
|
|
local.get $2
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
local.set $6
|
|
|
|
else
|
|
|
|
local.get $2
|
|
|
|
call $~lib/allocator/tlsf/ffs<usize>
|
|
|
|
local.set $3
|
|
|
|
local.get $0
|
|
|
|
local.get $3
|
|
|
|
call $~lib/allocator/tlsf/Root#getSLMap
|
|
|
|
local.tee $7
|
|
|
|
if (result i32)
|
|
|
|
local.get $7
|
|
|
|
else
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 323
|
|
|
|
i32.const 16
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.set $5
|
|
|
|
local.get $0
|
|
|
|
local.get $3
|
|
|
|
local.get $5
|
|
|
|
call $~lib/allocator/tlsf/ffs<u32>
|
|
|
|
call $~lib/allocator/tlsf/Root#getHead
|
|
|
|
local.set $6
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local.get $0
|
|
|
|
local.get $3
|
|
|
|
local.get $5
|
|
|
|
call $~lib/allocator/tlsf/ffs<u32>
|
|
|
|
call $~lib/allocator/tlsf/Root#getHead
|
|
|
|
local.set $6
|
|
|
|
end
|
|
|
|
local.get $6
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/Root#use (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
|
|
|
(local $5 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $1
|
|
|
|
i32.load
|
|
|
|
local.set $3
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 348
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.ge_u
|
|
|
|
local.tee $4
|
|
|
|
if (result i32)
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MAX_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
else
|
|
|
|
local.get $4
|
|
|
|
end
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 349
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
i32.const 7
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 350
|
|
|
|
i32.const 4
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Root#remove
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.get $2
|
|
|
|
i32.sub
|
|
|
|
local.set $5
|
|
|
|
local.get $5
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
i32.add
|
|
|
|
i32.ge_u
|
|
|
|
if
|
|
|
|
local.get $1
|
|
|
|
local.get $2
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.and
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.add
|
|
|
|
local.get $2
|
|
|
|
i32.add
|
|
|
|
local.set $4
|
|
|
|
local.get $4
|
|
|
|
local.get $5
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.sub
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $0
|
|
|
|
local.get $4
|
|
|
|
call $~lib/allocator/tlsf/Root#insert
|
|
|
|
else
|
|
|
|
local.get $1
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.store
|
|
|
|
local.get $1
|
|
|
|
call $~lib/allocator/tlsf/Block#get:right
|
|
|
|
local.tee $4
|
|
|
|
i32.eqz
|
|
|
|
if (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 368
|
|
|
|
i32.const 25
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
else
|
|
|
|
local.get $4
|
|
|
|
end
|
|
|
|
local.set $4
|
|
|
|
local.get $4
|
|
|
|
local.get $4
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/LEFT_FREE
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.store
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.add
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/__memory_allocate (; 22 ;) (type $ii) (param $0 i32) (result i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $1 i32)
|
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
|
|
|
(local $5 i32)
|
|
|
|
(local $6 i32)
|
|
|
|
(local $7 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
global.get $~lib/allocator/tlsf/ROOT
|
|
|
|
local.set $1
|
|
|
|
local.get $1
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
global.get $~lib/memory/HEAP_BASE
|
|
|
|
i32.const 7
|
|
|
|
i32.add
|
|
|
|
i32.const 7
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.set $2
|
|
|
|
current_memory
|
|
|
|
local.set $3
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/Root.SIZE
|
|
|
|
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 $4
|
|
|
|
local.get $4
|
|
|
|
local.get $3
|
|
|
|
i32.gt_s
|
|
|
|
local.tee $5
|
|
|
|
if (result i32)
|
|
|
|
local.get $4
|
|
|
|
local.get $3
|
|
|
|
i32.sub
|
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
else
|
|
|
|
local.get $5
|
|
|
|
end
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
local.tee $1
|
|
|
|
global.set $~lib/allocator/tlsf/ROOT
|
|
|
|
local.get $1
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/allocator/tlsf/Root#set:tailRef
|
|
|
|
local.get $1
|
|
|
|
i32.const 0
|
|
|
|
i32.store
|
|
|
|
block $break|0
|
|
|
|
i32.const 0
|
|
|
|
local.set $5
|
|
|
|
loop $repeat|0
|
|
|
|
local.get $5
|
|
|
|
global.get $~lib/allocator/tlsf/FL_BITS
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
br_if $break|0
|
|
|
|
block
|
|
|
|
local.get $1
|
|
|
|
local.get $5
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/allocator/tlsf/Root#setSLMap
|
|
|
|
block $break|1
|
|
|
|
i32.const 0
|
|
|
|
local.set $6
|
|
|
|
loop $repeat|1
|
|
|
|
local.get $6
|
|
|
|
global.get $~lib/allocator/tlsf/SL_SIZE
|
|
|
|
i32.lt_u
|
|
|
|
i32.eqz
|
|
|
|
br_if $break|1
|
|
|
|
local.get $1
|
|
|
|
local.get $5
|
|
|
|
local.get $6
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/allocator/tlsf/Root#setHead
|
|
|
|
local.get $6
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $6
|
|
|
|
br $repeat|1
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local.get $5
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $5
|
|
|
|
br $repeat|0
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
local.get $2
|
|
|
|
global.get $~lib/allocator/tlsf/Root.SIZE
|
|
|
|
i32.add
|
|
|
|
i32.const 7
|
|
|
|
i32.add
|
|
|
|
i32.const 7
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
current_memory
|
|
|
|
i32.const 16
|
|
|
|
i32.shl
|
|
|
|
call $~lib/allocator/tlsf/Root#addMemory
|
|
|
|
drop
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MAX_SIZE
|
|
|
|
i32.gt_u
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $0
|
|
|
|
i32.const 7
|
|
|
|
i32.add
|
|
|
|
i32.const 7
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.tee $4
|
|
|
|
global.get $~lib/allocator/tlsf/Block.MIN_SIZE
|
|
|
|
local.tee $3
|
|
|
|
local.get $4
|
|
|
|
local.get $3
|
|
|
|
i32.gt_u
|
|
|
|
select
|
|
|
|
local.set $0
|
|
|
|
local.get $1
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/tlsf/Root#search
|
|
|
|
local.set $7
|
|
|
|
local.get $7
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
current_memory
|
|
|
|
local.set $4
|
|
|
|
local.get $0
|
|
|
|
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 $4
|
|
|
|
local.tee $2
|
|
|
|
local.get $3
|
|
|
|
local.tee $5
|
|
|
|
local.get $2
|
|
|
|
local.get $5
|
|
|
|
i32.gt_s
|
|
|
|
select
|
|
|
|
local.set $2
|
|
|
|
local.get $2
|
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
if
|
|
|
|
local.get $3
|
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
end
|
|
|
|
current_memory
|
|
|
|
local.set $5
|
|
|
|
local.get $1
|
|
|
|
local.get $4
|
|
|
|
i32.const 16
|
|
|
|
i32.shl
|
|
|
|
local.get $5
|
|
|
|
i32.const 16
|
|
|
|
i32.shl
|
|
|
|
call $~lib/allocator/tlsf/Root#addMemory
|
|
|
|
drop
|
|
|
|
local.get $1
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/tlsf/Root#search
|
|
|
|
local.tee $6
|
|
|
|
i32.eqz
|
|
|
|
if (result i32)
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 480
|
|
|
|
i32.const 12
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
else
|
|
|
|
local.get $6
|
|
|
|
end
|
|
|
|
local.set $7
|
|
|
|
end
|
|
|
|
local.get $7
|
|
|
|
i32.load
|
|
|
|
global.get $~lib/allocator/tlsf/TAGS
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
local.get $0
|
|
|
|
i32.ge_u
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 483
|
|
|
|
i32.const 2
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $1
|
|
|
|
local.get $7
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/tlsf/Root#use
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/memory/memory.allocate (; 23 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/tlsf/__memory_allocate
|
|
|
|
return
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/__memory_free (; 24 ;) (type $i_) (param $0 i32)
|
2018-02-12 19:17:50 +01:00
|
|
|
(local $1 i32)
|
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $0
|
|
|
|
if
|
|
|
|
global.get $~lib/allocator/tlsf/ROOT
|
|
|
|
local.set $1
|
|
|
|
local.get $1
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.sub
|
|
|
|
local.set $2
|
|
|
|
local.get $2
|
|
|
|
i32.load
|
|
|
|
local.set $3
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.and
|
|
|
|
i32.eqz
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 494
|
|
|
|
i32.const 6
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
local.get $3
|
|
|
|
global.get $~lib/allocator/tlsf/FREE
|
|
|
|
i32.or
|
|
|
|
i32.store
|
|
|
|
local.get $1
|
|
|
|
local.get $0
|
|
|
|
global.get $~lib/allocator/tlsf/Block.INFO
|
|
|
|
i32.sub
|
|
|
|
call $~lib/allocator/tlsf/Root#insert
|
|
|
|
end
|
|
|
|
end
|
|
|
|
)
|
|
|
|
(func $~lib/memory/memory.free (; 25 ;) (type $i_) (param $0 i32)
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/tlsf/__memory_free
|
|
|
|
return
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/tlsf/__memory_reset (; 26 ;) (type $_)
|
|
|
|
unreachable
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/memory/memory.reset (; 27 ;) (type $_)
|
|
|
|
call $~lib/allocator/tlsf/__memory_reset
|
|
|
|
return
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $start (; 28 ;) (type $_)
|
|
|
|
call $start:assembly/index
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $null (; 29 ;) (type $_)
|
2018-02-12 19:17:50 +01:00
|
|
|
)
|
|
|
|
)
|