mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-20 02:11:31 +00:00
16b alignment, cleanup
This commit is contained in:
@ -644,13 +644,13 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 2912
|
||||
i32.load
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
local.tee $3
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 4
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.lt_u
|
||||
if
|
||||
@ -724,9 +724,9 @@
|
||||
local.tee $2
|
||||
i32.const 2
|
||||
i32.store
|
||||
i32.const 2912
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.store
|
||||
i32.store offset=2912
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Root#insert
|
||||
@ -942,7 +942,7 @@
|
||||
local.set $2
|
||||
i32.const 280
|
||||
global.set $~lib/allocator/tlsf/ROOT
|
||||
i32.const 2912
|
||||
i32.const 3192
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 280
|
||||
|
@ -115,7 +115,7 @@
|
||||
i32.shl
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Root#set:tailRef (; 4 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
i32.const 0
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=2912
|
||||
)
|
||||
@ -173,7 +173,7 @@
|
||||
i32.store offset=96
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Root#get:tailRef (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
i32.const 0
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Block#get:right (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
@ -760,7 +760,7 @@
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 4
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.ge_u
|
||||
i32.eqz
|
||||
|
@ -15,8 +15,8 @@
|
||||
(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")
|
||||
(global $runtime/asrt/ROOT (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/ROOTS (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/CUR (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/ROOTS (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "__mm_allocate" (func $runtime/asrt/__mm_allocate))
|
||||
(export "__mm_free" (func $runtime/asrt/__mm_free))
|
||||
@ -26,12 +26,12 @@
|
||||
(export "__gc_collect" (func $runtime/asrt/collectCycles))
|
||||
(func $runtime/asrt/setSLMap (; 1 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.ge_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 165
|
||||
i32.const 164
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -50,14 +50,14 @@
|
||||
i32.lt_u
|
||||
i32.const 0
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
select
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 179
|
||||
i32.const 178
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -85,7 +85,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 112
|
||||
i32.const 111
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -102,7 +102,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 114
|
||||
i32.const 113
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -131,14 +131,14 @@
|
||||
i32.lt_u
|
||||
i32.const 0
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
select
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 170
|
||||
i32.const 169
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -156,12 +156,12 @@
|
||||
)
|
||||
(func $runtime/asrt/getSLMap (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.ge_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 160
|
||||
i32.const 159
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -187,7 +187,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 260
|
||||
i32.const 259
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -209,17 +209,17 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 262
|
||||
i32.const 261
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
i32.const 256
|
||||
i32.const 512
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.div_u
|
||||
local.set $4
|
||||
i32.const 0
|
||||
@ -235,7 +235,7 @@
|
||||
i32.xor
|
||||
local.set $4
|
||||
local.get $3
|
||||
i32.const 7
|
||||
i32.const 8
|
||||
i32.sub
|
||||
end
|
||||
local.set $3
|
||||
@ -310,7 +310,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 103
|
||||
i32.const 102
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -324,7 +324,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 105
|
||||
i32.const 104
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -341,7 +341,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 195
|
||||
i32.const 194
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -355,7 +355,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 197
|
||||
i32.const 196
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -402,7 +402,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 215
|
||||
i32.const 214
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -443,7 +443,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 228
|
||||
i32.const 227
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -458,7 +458,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 229
|
||||
i32.const 228
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -470,11 +470,11 @@
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.const 256
|
||||
i32.const 512
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.div_u
|
||||
local.set $2
|
||||
i32.const 0
|
||||
@ -490,7 +490,7 @@
|
||||
i32.xor
|
||||
local.set $2
|
||||
local.get $3
|
||||
i32.const 7
|
||||
i32.const 8
|
||||
i32.sub
|
||||
end
|
||||
local.tee $4
|
||||
@ -537,12 +537,12 @@
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $2
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
i32.const 0
|
||||
local.get $1
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
i32.const 0
|
||||
@ -555,40 +555,46 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 372
|
||||
i32.const 371
|
||||
i32.const 4
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
i32.load offset=2784
|
||||
local.tee $3
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 16
|
||||
i32.add
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 381
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $1
|
||||
i32.const 16
|
||||
i32.sub
|
||||
local.get $3
|
||||
i32.eq
|
||||
if (result i32)
|
||||
if
|
||||
local.get $3
|
||||
i32.load
|
||||
local.set $4
|
||||
local.get $1
|
||||
i32.const 16
|
||||
i32.sub
|
||||
else
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 389
|
||||
i32.const 6
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
local.set $1
|
||||
end
|
||||
local.set $1
|
||||
else
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.const 2916
|
||||
i32.const 2788
|
||||
i32.add
|
||||
i32.lt_u
|
||||
if
|
||||
@ -636,7 +642,7 @@
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.store offset=2912
|
||||
i32.store offset=2784
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $runtime/asrt/insertBlock
|
||||
@ -661,20 +667,20 @@
|
||||
if
|
||||
unreachable
|
||||
end
|
||||
i32.const 104
|
||||
i32.const 112
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 3016
|
||||
i32.const 2896
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 0
|
||||
local.set $0
|
||||
loop $repeat|0
|
||||
local.get $0
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 104
|
||||
i32.const 112
|
||||
local.get $0
|
||||
i32.const 0
|
||||
call $runtime/asrt/setSLMap
|
||||
@ -685,7 +691,7 @@
|
||||
i32.const 32
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 104
|
||||
i32.const 112
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.const 0
|
||||
@ -704,13 +710,13 @@
|
||||
br $repeat|0
|
||||
end
|
||||
end
|
||||
i32.const 104
|
||||
i32.const 3024
|
||||
i32.const 112
|
||||
i32.const 2912
|
||||
current_memory
|
||||
i32.const 16
|
||||
i32.shl
|
||||
call $runtime/asrt/addMemory
|
||||
i32.const 104
|
||||
i32.const 112
|
||||
)
|
||||
(func $runtime/asrt/ffs<usize> (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
@ -730,17 +736,17 @@
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
local.get $1
|
||||
i32.const 256
|
||||
i32.const 512
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.div_u
|
||||
else
|
||||
local.get $1
|
||||
call $runtime/asrt/fls<usize>
|
||||
local.tee $3
|
||||
i32.const 7
|
||||
i32.const 8
|
||||
i32.sub
|
||||
local.set $2
|
||||
local.get $1
|
||||
@ -801,7 +807,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 329
|
||||
i32.const 328
|
||||
i32.const 17
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -863,7 +869,7 @@
|
||||
i32.and
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
else
|
||||
@ -873,7 +879,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 344
|
||||
i32.const 343
|
||||
i32.const 4
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -950,9 +956,9 @@
|
||||
end
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.add
|
||||
i32.const -8
|
||||
i32.const -16
|
||||
i32.and
|
||||
local.tee $0
|
||||
i32.const 16
|
||||
@ -1021,7 +1027,7 @@
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 452
|
||||
i32.const 13
|
||||
i32.const 2
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
@ -1039,7 +1045,7 @@
|
||||
local.get $0
|
||||
if
|
||||
local.get $0
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
if
|
||||
i32.const 0
|
||||
@ -1078,7 +1084,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 640
|
||||
i32.const 624
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1184,7 +1190,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 595
|
||||
i32.const 579
|
||||
i32.const 17
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1232,7 +1238,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 606
|
||||
i32.const 590
|
||||
i32.const 6
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1262,7 +1268,7 @@
|
||||
end
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 617
|
||||
i32.const 601
|
||||
i32.const 24
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1284,7 +1290,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 624
|
||||
i32.const 608
|
||||
i32.const 2
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
|
@ -1,13 +1,12 @@
|
||||
// An experimental standalone AssemblyScript runtime based on TLSF and PureRC.
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const DEBUG = true;
|
||||
@inline const DEBUG = true;
|
||||
|
||||
// Alignment guarantees
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline const AL_BITS: u32 = 3; // 8 bytes
|
||||
@inline const AL_BITS: u32 = 4; // 16 bytes to fit up to v128
|
||||
// @ts-ignore: decorator
|
||||
@inline const AL_SIZE: usize = 1 << <usize>AL_BITS;
|
||||
// @ts-ignore: decorator
|
||||
@ -115,7 +114,7 @@ function getRight(block: Block): Block {
|
||||
return right;
|
||||
}
|
||||
|
||||
// ╒════════════════ Root structure layout (32-bit) ═══════════════╕
|
||||
// ╒═════════════════════ Root layout (32-bit) ════════════════════╕
|
||||
// 3 2 1
|
||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
|
||||
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ ┐
|
||||
@ -133,7 +132,7 @@ function getRight(block: Block): Block {
|
||||
// ├───────────────────────────────────────────────────────────────┤ │
|
||||
// │ head[703] │ ◄────┤
|
||||
// ╞═══════════════════════════════════════════════════════════════╡ │
|
||||
// │ tailRef │ ◄────┘
|
||||
// │ tail │ ◄────┘
|
||||
// └───────────────────────────────────────────────────────────────┘ SIZE ┘
|
||||
// S: Small blocks map
|
||||
@unmanaged class Root {
|
||||
@ -379,7 +378,7 @@ function addMemory(root: Root, start: usize, end: usize): bool {
|
||||
var tail = getTail(root);
|
||||
var tailInfo: usize = 0;
|
||||
if (tail) { // more memory
|
||||
assert(start >= changetype<usize>(tail) + BLOCK_OVERHEAD);
|
||||
if (DEBUG) assert(start >= changetype<usize>(tail) + BLOCK_OVERHEAD);
|
||||
|
||||
// merge with current tail if adjacent
|
||||
if (start - BLOCK_OVERHEAD == changetype<usize>(tail)) {
|
||||
@ -388,7 +387,6 @@ function addMemory(root: Root, start: usize, end: usize): bool {
|
||||
} else {
|
||||
// We don't do this, but a user might `memory.grow` manually
|
||||
// leading to non-adjacent pages managed by TLSF.
|
||||
if (DEBUG) assert(false); // FIXME: remove me
|
||||
}
|
||||
|
||||
} else if (DEBUG) { // first memory
|
||||
@ -451,7 +449,7 @@ function initialize(): Root {
|
||||
|
||||
function freeBlock(root: Root, block: Block): void {
|
||||
var blockInfo = block.mmInfo;
|
||||
if (DEBUG) assert(!(blockInfo & FREE)); // must be used
|
||||
assert(!(blockInfo & FREE)); // must be used (user might call through to this)
|
||||
block.mmInfo = blockInfo | FREE;
|
||||
insertBlock(root, block);
|
||||
}
|
||||
@ -500,7 +498,7 @@ function __mm_allocate(size: usize): usize {
|
||||
@global @unsafe
|
||||
function __mm_free(data: usize): void {
|
||||
if (data) {
|
||||
assert(!(data & AL_MASK)); // must be aligned
|
||||
assert(!(data & AL_MASK)); // must be aligned (user might call through to this)
|
||||
let root = ROOT;
|
||||
if (root) freeBlock(root, changetype<Block>(data - BLOCK_OVERHEAD));
|
||||
}
|
||||
@ -523,20 +521,15 @@ const ACYCLIC_FLAG: u32 = 0;
|
||||
// B: buffered
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const BUFFERED_MASK: u32 = 1 << (sizeof<u32>() * 8 - 1);
|
||||
@inline const BUFFERED_MASK: u32 = 1 << (sizeof<u32>() * 8 - 1);
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_BITS = 3;
|
||||
@inline const COLOR_BITS = 3;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_SHIFT: u32 = ctz(BUFFERED_MASK) - COLOR_BITS;
|
||||
@inline const COLOR_SHIFT: u32 = ctz(BUFFERED_MASK) - COLOR_BITS;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_MASK: u32 = ((1 << COLOR_BITS) - 1) << COLOR_SHIFT;
|
||||
@inline const COLOR_MASK: u32 = ((1 << COLOR_BITS) - 1) << COLOR_SHIFT;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const REFCOUNT_MASK: u32 = (1 << COLOR_SHIFT) - 1;
|
||||
@inline const REFCOUNT_MASK: u32 = (1 << COLOR_SHIFT) - 1;
|
||||
|
||||
// ╒════════╤═══════════════════ Colors ═══════════════════════════╕
|
||||
// │ Color │ Meaning │
|
||||
@ -551,39 +544,28 @@ const REFCOUNT_MASK: u32 = (1 << COLOR_SHIFT) - 1;
|
||||
// Acyclic detection has been decoupled, hence no GREEN.
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_BLACK: u32 = 0 << COLOR_SHIFT;
|
||||
@inline const COLOR_BLACK: u32 = 0 << COLOR_SHIFT;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_GRAY: u32 = 1 << COLOR_SHIFT;
|
||||
@inline const COLOR_GRAY: u32 = 1 << COLOR_SHIFT;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_WHITE: u32 = 2 << COLOR_SHIFT;
|
||||
@inline const COLOR_WHITE: u32 = 2 << COLOR_SHIFT;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_PURPLE: u32 = 3 << COLOR_SHIFT;
|
||||
@inline const COLOR_PURPLE: u32 = 3 << COLOR_SHIFT;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_RED: u32 = 4 << COLOR_SHIFT;
|
||||
@inline const COLOR_RED: u32 = 4 << COLOR_SHIFT;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const COLOR_ORANGE: u32 = 5 << COLOR_SHIFT;
|
||||
@inline const COLOR_ORANGE: u32 = 5 << COLOR_SHIFT;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const VISIT_DECREMENT = 1; // guard 0
|
||||
@inline const VISIT_DECREMENT = 1; // guard 0
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const VISIT_MARKGRAY = 2;
|
||||
@inline const VISIT_MARKGRAY = 2;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const VISIT_SCAN = 3;
|
||||
@inline const VISIT_SCAN = 3;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const VISIT_SCANBLACK = 4;
|
||||
@inline const VISIT_SCANBLACK = 4;
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
const VISIT_COLLECTWHITE = 5;
|
||||
@inline const VISIT_COLLECTWHITE = 5;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@global
|
||||
@ -652,11 +634,14 @@ function decrement(s: Block): void {
|
||||
}
|
||||
|
||||
/** Buffer of possible roots. */
|
||||
var ROOTS: usize;
|
||||
// @ts-ignore: decorator
|
||||
@lazy var ROOTS: usize;
|
||||
/** Current absolute offset into the `ROOTS` buffer. */
|
||||
var CUR: usize = 0;
|
||||
// @ts-ignore: decorator
|
||||
@lazy var CUR: usize = 0;
|
||||
/** Current absolute end offset into the `ROOTS` buffer. */
|
||||
var END: usize = 0;
|
||||
// @ts-ignore: decorator
|
||||
@lazy var END: usize = 0;
|
||||
|
||||
/** Appends a block to possible roots. */
|
||||
function appendRoot(s: Block): void {
|
||||
|
@ -16,9 +16,9 @@
|
||||
(elem (i32.const 0) $null)
|
||||
(global $runtime/asrt/ROOT (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/ACYCLIC_FLAG i32 (i32.const 0))
|
||||
(global $runtime/asrt/ROOTS (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/CUR (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/END (mut i32) (i32.const 0))
|
||||
(global $runtime/asrt/ROOTS (mut i32) (i32.const 0))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 100))
|
||||
(export "memory" (memory $0))
|
||||
(export "__mm_allocate" (func $runtime/asrt/__mm_allocate))
|
||||
@ -30,17 +30,17 @@
|
||||
(func $runtime/asrt/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=2912
|
||||
i32.store offset=2784
|
||||
)
|
||||
(func $runtime/asrt/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 165
|
||||
i32.const 164
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -55,7 +55,7 @@
|
||||
)
|
||||
(func $runtime/asrt/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $2
|
||||
@ -68,7 +68,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 179
|
||||
i32.const 178
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -87,7 +87,7 @@
|
||||
)
|
||||
(func $runtime/asrt/getTail (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
i32.load offset=2784
|
||||
)
|
||||
(func $runtime/asrt/getRight (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
@ -104,7 +104,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 112
|
||||
i32.const 111
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -124,7 +124,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 114
|
||||
i32.const 113
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -151,7 +151,7 @@
|
||||
)
|
||||
(func $runtime/asrt/getHead (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $2
|
||||
@ -164,7 +164,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 170
|
||||
i32.const 169
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -182,13 +182,13 @@
|
||||
)
|
||||
(func $runtime/asrt/getSLMap (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
local.get $1
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 160
|
||||
i32.const 159
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -218,7 +218,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 260
|
||||
i32.const 259
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -243,19 +243,19 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 262
|
||||
i32.const 261
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $3
|
||||
i32.const 256
|
||||
i32.const 512
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 0
|
||||
local.set $4
|
||||
local.get $3
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.div_u
|
||||
local.set $5
|
||||
else
|
||||
@ -273,7 +273,7 @@
|
||||
i32.xor
|
||||
local.set $5
|
||||
local.get $4
|
||||
i32.const 8
|
||||
i32.const 9
|
||||
i32.const 1
|
||||
i32.sub
|
||||
i32.sub
|
||||
@ -354,7 +354,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 103
|
||||
i32.const 102
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -369,7 +369,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 105
|
||||
i32.const 104
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -391,7 +391,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 195
|
||||
i32.const 194
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -406,7 +406,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 197
|
||||
i32.const 196
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -460,7 +460,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 215
|
||||
i32.const 214
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -510,7 +510,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 228
|
||||
i32.const 227
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -526,7 +526,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 229
|
||||
i32.const 228
|
||||
i32.const 13
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -537,13 +537,13 @@
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $7
|
||||
i32.const 256
|
||||
i32.const 512
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 0
|
||||
local.set $8
|
||||
local.get $7
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.div_u
|
||||
local.set $9
|
||||
else
|
||||
@ -561,7 +561,7 @@
|
||||
i32.xor
|
||||
local.set $9
|
||||
local.get $8
|
||||
i32.const 8
|
||||
i32.const 9
|
||||
i32.const 1
|
||||
i32.sub
|
||||
i32.sub
|
||||
@ -619,7 +619,7 @@
|
||||
i32.le_u
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
else
|
||||
@ -627,7 +627,7 @@
|
||||
end
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
else
|
||||
@ -637,7 +637,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 372
|
||||
i32.const 371
|
||||
i32.const 4
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -649,6 +649,20 @@
|
||||
local.set $4
|
||||
local.get $3
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 16
|
||||
i32.add
|
||||
i32.ge_u
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 381
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $1
|
||||
i32.const 16
|
||||
i32.sub
|
||||
@ -663,21 +677,12 @@
|
||||
i32.load
|
||||
local.set $4
|
||||
else
|
||||
i32.const 0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 389
|
||||
i32.const 6
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
nop
|
||||
end
|
||||
else
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.const 2916
|
||||
i32.const 2788
|
||||
i32.add
|
||||
i32.ge_u
|
||||
i32.eqz
|
||||
@ -755,9 +760,9 @@
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
global.get $~lib/memory/HEAP_BASE
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.add
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.const -1
|
||||
i32.xor
|
||||
i32.and
|
||||
@ -765,7 +770,7 @@
|
||||
current_memory
|
||||
local.set $1
|
||||
local.get $0
|
||||
i32.const 2916
|
||||
i32.const 2788
|
||||
i32.add
|
||||
i32.const 65535
|
||||
i32.add
|
||||
@ -805,7 +810,7 @@
|
||||
local.set $4
|
||||
loop $repeat|0
|
||||
local.get $4
|
||||
i32.const 22
|
||||
i32.const 21
|
||||
i32.lt_u
|
||||
i32.eqz
|
||||
br_if $break|0
|
||||
@ -849,11 +854,11 @@
|
||||
end
|
||||
local.get $3
|
||||
local.get $0
|
||||
i32.const 2916
|
||||
i32.const 2788
|
||||
i32.add
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.add
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.const -1
|
||||
i32.xor
|
||||
i32.and
|
||||
@ -903,13 +908,13 @@
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
local.get $1
|
||||
i32.const 256
|
||||
i32.const 512
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 0
|
||||
local.set $2
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.div_u
|
||||
local.set $3
|
||||
else
|
||||
@ -927,7 +932,7 @@
|
||||
i32.xor
|
||||
local.set $3
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.const 9
|
||||
i32.const 1
|
||||
i32.sub
|
||||
i32.sub
|
||||
@ -993,7 +998,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 329
|
||||
i32.const 328
|
||||
i32.const 17
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1082,7 +1087,7 @@
|
||||
i32.ne
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
else
|
||||
@ -1092,7 +1097,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 344
|
||||
i32.const 343
|
||||
i32.const 4
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1181,9 +1186,9 @@
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.add
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.const -1
|
||||
i32.xor
|
||||
i32.and
|
||||
@ -1265,7 +1270,7 @@
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 452
|
||||
i32.const 13
|
||||
i32.const 2
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
@ -1283,7 +1288,7 @@
|
||||
local.get $0
|
||||
if
|
||||
local.get $0
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
@ -1636,7 +1641,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 640
|
||||
i32.const 624
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1834,7 +1839,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 595
|
||||
i32.const 579
|
||||
i32.const 17
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1881,7 +1886,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 606
|
||||
i32.const 590
|
||||
i32.const 6
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1918,7 +1923,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 617
|
||||
i32.const 601
|
||||
i32.const 24
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
@ -1947,7 +1952,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 624
|
||||
i32.const 608
|
||||
i32.const 2
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
|
@ -1515,13 +1515,13 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 2912
|
||||
i32.load
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
local.tee $3
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 4
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.lt_u
|
||||
if
|
||||
@ -1595,9 +1595,9 @@
|
||||
local.tee $2
|
||||
i32.const 2
|
||||
i32.store
|
||||
i32.const 2912
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.store
|
||||
i32.store offset=2912
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Root#insert
|
||||
@ -1813,7 +1813,7 @@
|
||||
local.set $2
|
||||
i32.const 656
|
||||
global.set $~lib/allocator/tlsf/ROOT
|
||||
i32.const 2912
|
||||
i32.const 3568
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 656
|
||||
|
@ -863,7 +863,7 @@
|
||||
i32.shl
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Root#set:tailRef (; 40 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
i32.const 0
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=2912
|
||||
)
|
||||
@ -921,7 +921,7 @@
|
||||
i32.store offset=96
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Root#get:tailRef (; 43 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
i32.const 0
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Block#get:right (; 44 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
@ -1508,7 +1508,7 @@
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 4
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.ge_u
|
||||
i32.eqz
|
||||
|
@ -595,13 +595,13 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 2912
|
||||
i32.load
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
local.tee $3
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 4
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.lt_u
|
||||
if
|
||||
@ -675,9 +675,9 @@
|
||||
local.tee $2
|
||||
i32.const 2
|
||||
i32.store
|
||||
i32.const 2912
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.store
|
||||
i32.store offset=2912
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Root#insert
|
||||
@ -893,7 +893,7 @@
|
||||
local.set $2
|
||||
i32.const 272
|
||||
global.set $~lib/allocator/tlsf/ROOT
|
||||
i32.const 2912
|
||||
i32.const 3184
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 272
|
||||
|
@ -70,7 +70,7 @@
|
||||
end
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Root#set:tailRef (; 4 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
i32.const 0
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=2912
|
||||
)
|
||||
@ -128,7 +128,7 @@
|
||||
i32.store offset=96
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Root#get:tailRef (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
i32.const 0
|
||||
local.get $0
|
||||
i32.load offset=2912
|
||||
)
|
||||
(func $~lib/allocator/tlsf/Block#get:right (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
@ -715,7 +715,7 @@
|
||||
if
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.const 4
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.ge_u
|
||||
i32.eqz
|
||||
|
Reference in New Issue
Block a user