16b alignment, cleanup

This commit is contained in:
dcode 2019-04-15 13:10:41 +02:00
parent 586ca8b580
commit aee3a3e3a7
12 changed files with 281 additions and 308 deletions

View File

@ -16,7 +16,7 @@
(func $../../compiler/runtime/asrt/setTail (; 0 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
local.get $1
i32.store offset=2912
i32.store offset=2784
)
(func $../../compiler/runtime/asrt/setSLMap (; 1 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
local.get $0
@ -86,11 +86,11 @@
i32.const -4
i32.and
local.tee $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
@ -106,7 +106,7 @@
i32.xor
local.set $4
local.get $3
i32.const 7
i32.const 8
i32.sub
end
local.set $3
@ -247,11 +247,11 @@
i32.const -4
i32.and
local.tee $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
@ -267,7 +267,7 @@
i32.xor
local.set $2
local.get $3
i32.const 7
i32.const 8
i32.sub
end
local.tee $3
@ -315,7 +315,7 @@
local.get $2
block (result i32)
local.get $0
i32.load offset=2912
i32.load offset=2784
local.tee $2
if
local.get $1
@ -379,9 +379,9 @@
(local $1 i32)
(local $2 i32)
(local $3 i32)
i32.const 8
i32.const 16
local.tee $3
i32.const 68451
i32.const 68323
i32.add
i32.const -65536
i32.and
@ -414,7 +414,7 @@
loop $repeat|0
block $break|0
local.get $2
i32.const 22
i32.const 21
i32.ge_u
br_if $break|0
local.get $0
@ -450,9 +450,9 @@
end
local.get $0
local.get $3
i32.const 2923
i32.const 2803
i32.add
i32.const -8
i32.const -16
i32.and
current_memory
i32.const 16
@ -463,11 +463,11 @@
(func $../../compiler/runtime/asrt/searchBlock (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 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
@ -481,7 +481,7 @@
i32.xor
local.set $1
local.get $2
i32.const 7
i32.const 8
i32.sub
local.set $2
local.get $1
@ -658,9 +658,9 @@
end
local.get $2
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

View File

@ -15,9 +15,6 @@
(elem (i32.const 0) $null)
(global $../../compiler/runtime/asrt/ROOT (mut i32) (i32.const 0))
(global $../../compiler/runtime/asrt/ACYCLIC_FLAG i32 (i32.const 0))
(global $../../compiler/runtime/asrt/ROOTS (mut i32) (i32.const 0))
(global $../../compiler/runtime/asrt/CUR (mut i32) (i32.const 0))
(global $../../compiler/runtime/asrt/END (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 84))
(export "memory" (memory $0))
(export "memory.allocate" (func $assembly/index/memory.allocate))
@ -25,17 +22,17 @@
(func $../../compiler/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 $../../compiler/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
@ -50,7 +47,7 @@
)
(func $../../compiler/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
@ -63,7 +60,7 @@
if
i32.const 0
i32.const 24
i32.const 179
i32.const 178
i32.const 13
call $~lib/builtins/abort
unreachable
@ -82,7 +79,7 @@
)
(func $../../compiler/runtime/asrt/getTail (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load offset=2912
i32.load offset=2784
)
(func $../../compiler/runtime/asrt/getRight (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
@ -99,7 +96,7 @@
if
i32.const 0
i32.const 24
i32.const 112
i32.const 111
i32.const 13
call $~lib/builtins/abort
unreachable
@ -119,7 +116,7 @@
if
i32.const 0
i32.const 24
i32.const 114
i32.const 113
i32.const 13
call $~lib/builtins/abort
unreachable
@ -134,7 +131,7 @@
if
i32.const 0
i32.const 24
i32.const 467
i32.const 465
i32.const 13
call $~lib/builtins/abort
unreachable
@ -146,7 +143,7 @@
)
(func $../../compiler/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
@ -159,7 +156,7 @@
if
i32.const 0
i32.const 24
i32.const 170
i32.const 169
i32.const 13
call $~lib/builtins/abort
unreachable
@ -177,13 +174,13 @@
)
(func $../../compiler/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
@ -213,7 +210,7 @@
if
i32.const 0
i32.const 24
i32.const 260
i32.const 259
i32.const 13
call $~lib/builtins/abort
unreachable
@ -238,19 +235,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
@ -268,7 +265,7 @@
i32.xor
local.set $5
local.get $4
i32.const 8
i32.const 9
i32.const 1
i32.sub
i32.sub
@ -349,7 +346,7 @@
if
i32.const 0
i32.const 24
i32.const 103
i32.const 102
i32.const 13
call $~lib/builtins/abort
unreachable
@ -364,7 +361,7 @@
if
i32.const 0
i32.const 24
i32.const 105
i32.const 104
i32.const 13
call $~lib/builtins/abort
unreachable
@ -386,7 +383,7 @@
if
i32.const 0
i32.const 24
i32.const 195
i32.const 194
i32.const 13
call $~lib/builtins/abort
unreachable
@ -401,7 +398,7 @@
if
i32.const 0
i32.const 24
i32.const 197
i32.const 196
i32.const 13
call $~lib/builtins/abort
unreachable
@ -455,7 +452,7 @@
if
i32.const 0
i32.const 24
i32.const 215
i32.const 214
i32.const 15
call $~lib/builtins/abort
unreachable
@ -505,7 +502,7 @@
if
i32.const 0
i32.const 24
i32.const 228
i32.const 227
i32.const 13
call $~lib/builtins/abort
unreachable
@ -521,7 +518,7 @@
if
i32.const 0
i32.const 24
i32.const 229
i32.const 228
i32.const 13
call $~lib/builtins/abort
unreachable
@ -532,13 +529,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
@ -556,7 +553,7 @@
i32.xor
local.set $9
local.get $8
i32.const 8
i32.const 9
i32.const 1
i32.sub
i32.sub
@ -614,7 +611,7 @@
i32.le_u
if (result i32)
local.get $1
i32.const 7
i32.const 15
i32.and
i32.eqz
else
@ -622,7 +619,7 @@
end
if (result i32)
local.get $2
i32.const 7
i32.const 15
i32.and
i32.eqz
else
@ -632,7 +629,7 @@
if
i32.const 0
i32.const 24
i32.const 372
i32.const 371
i32.const 4
call $~lib/builtins/abort
unreachable
@ -653,8 +650,8 @@
if
i32.const 0
i32.const 24
i32.const 382
i32.const 4
i32.const 381
i32.const 15
call $~lib/builtins/abort
unreachable
end
@ -672,28 +669,19 @@
i32.load
local.set $4
else
i32.const 0
i32.eqz
if
i32.const 0
i32.const 24
i32.const 391
i32.const 17
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
if
i32.const 0
i32.const 24
i32.const 395
i32.const 393
i32.const 4
call $~lib/builtins/abort
unreachable
@ -764,9 +752,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
@ -774,7 +762,7 @@
current_memory
local.set $1
local.get $0
i32.const 2916
i32.const 2788
i32.add
i32.const 65535
i32.add
@ -814,7 +802,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
@ -858,11 +846,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
@ -881,7 +869,7 @@
if
i32.const 0
i32.const 24
i32.const 461
i32.const 459
i32.const 13
call $~lib/builtins/abort
unreachable
@ -897,7 +885,7 @@
if
i32.const 0
i32.const 24
i32.const 461
i32.const 459
i32.const 13
call $~lib/builtins/abort
unreachable
@ -912,13 +900,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
@ -936,7 +924,7 @@
i32.xor
local.set $3
local.get $2
i32.const 8
i32.const 9
i32.const 1
i32.sub
i32.sub
@ -1002,7 +990,7 @@
if
i32.const 0
i32.const 24
i32.const 329
i32.const 328
i32.const 17
call $~lib/builtins/abort
unreachable
@ -1091,7 +1079,7 @@
i32.ne
if (result i32)
local.get $2
i32.const 7
i32.const 15
i32.and
i32.eqz
else
@ -1101,7 +1089,7 @@
if
i32.const 0
i32.const 24
i32.const 344
i32.const 343
i32.const 4
call $~lib/builtins/abort
unreachable
@ -1190,9 +1178,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
@ -1223,7 +1211,7 @@
if
i32.const 0
i32.const 24
i32.const 490
i32.const 488
i32.const 15
call $~lib/builtins/abort
unreachable
@ -1241,7 +1229,7 @@
if
i32.const 0
i32.const 24
i32.const 492
i32.const 490
i32.const 13
call $~lib/builtins/abort
unreachable
@ -1277,8 +1265,8 @@
if
i32.const 0
i32.const 24
i32.const 454
i32.const 13
i32.const 452
i32.const 2
call $~lib/builtins/abort
unreachable
end
@ -1296,14 +1284,14 @@
local.get $0
if
local.get $0
i32.const 7
i32.const 15
i32.and
i32.eqz
i32.eqz
if
i32.const 0
i32.const 24
i32.const 503
i32.const 501
i32.const 4
call $~lib/builtins/abort
unreachable

View File

@ -152,7 +152,7 @@
if
i32.const 0
i32.const 72
i32.const 454
i32.const 452
i32.const 2
call $~lib/builtins/abort
unreachable
@ -688,7 +688,7 @@
if
local.get $1
local.get $3
i32.const 4
i32.const 8
i32.add
i32.ge_u
i32.eqz
@ -713,17 +713,6 @@
local.get $3
i32.load
local.set $4
else
i32.const 0
i32.eqz
if
i32.const 0
i32.const 72
i32.const 415
i32.const 8
call $~lib/builtins/abort
unreachable
end
end
else
local.get $1
@ -735,7 +724,7 @@
if
i32.const 0
i32.const 72
i32.const 419
i32.const 417
i32.const 6
call $~lib/builtins/abort
unreachable
@ -806,7 +795,7 @@
if
i32.const 0
i32.const 72
i32.const 448
i32.const 446
i32.const 2
call $~lib/builtins/abort
unreachable
@ -822,7 +811,7 @@
if
i32.const 0
i32.const 72
i32.const 448
i32.const 446
i32.const 2
call $~lib/builtins/abort
unreachable
@ -1248,7 +1237,7 @@
if (result i32)
i32.const 0
i32.const 72
i32.const 509
i32.const 507
i32.const 12
call $~lib/builtins/abort
unreachable
@ -1269,7 +1258,7 @@
if
i32.const 0
i32.const 72
i32.const 512
i32.const 510
i32.const 2
call $~lib/builtins/abort
unreachable
@ -1298,7 +1287,7 @@
if
i32.const 0
i32.const 72
i32.const 521
i32.const 519
i32.const 4
call $~lib/builtins/abort
unreachable
@ -1322,7 +1311,7 @@
if
i32.const 0
i32.const 72
i32.const 526
i32.const 524
i32.const 6
call $~lib/builtins/abort
unreachable

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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