mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-29 06:31:59 +00:00
optimize logical and/or, initial null checking in flows
This commit is contained in:
@ -39,19 +39,15 @@
|
||||
(export "$.collect" (func $~lib/runtime/runtime.collect))
|
||||
(start $start)
|
||||
(func $~lib/runtime/runtime.flags (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
local.tee $1
|
||||
i32.eqz
|
||||
if
|
||||
if (result i32)
|
||||
local.get $0
|
||||
i32.const 176
|
||||
i32.load
|
||||
i32.gt_u
|
||||
local.set $1
|
||||
else
|
||||
i32.const 1
|
||||
end
|
||||
local.get $1
|
||||
if (result i32)
|
||||
unreachable
|
||||
else
|
||||
@ -940,7 +936,7 @@
|
||||
i32.load
|
||||
i32.le_u
|
||||
else
|
||||
local.get $0
|
||||
i32.const 0
|
||||
end
|
||||
if
|
||||
loop $continue|0
|
||||
@ -1128,7 +1124,7 @@
|
||||
(local $5 i32)
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.eqz
|
||||
@ -1140,20 +1136,19 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.const -4
|
||||
i32.and
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.const 16
|
||||
i32.ge_u
|
||||
local.tee $2
|
||||
if
|
||||
local.get $3
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
local.set $2
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
local.get $2
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -1163,67 +1158,67 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 256
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.div_u
|
||||
local.set $4
|
||||
i32.const 0
|
||||
else
|
||||
local.get $3
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $2
|
||||
call $~lib/allocator/tlsf/fls<usize>
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.const 5
|
||||
i32.sub
|
||||
i32.shr_u
|
||||
i32.const 32
|
||||
i32.xor
|
||||
local.set $4
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.const 7
|
||||
i32.sub
|
||||
end
|
||||
local.set $2
|
||||
local.set $3
|
||||
local.get $1
|
||||
i32.load offset=8
|
||||
local.set $3
|
||||
local.set $2
|
||||
local.get $1
|
||||
i32.load offset=4
|
||||
local.tee $5
|
||||
if
|
||||
local.get $5
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.store offset=8
|
||||
end
|
||||
local.get $3
|
||||
local.get $2
|
||||
if
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $5
|
||||
i32.store offset=4
|
||||
end
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
call $~lib/allocator/tlsf/Root#getHead
|
||||
local.get $1
|
||||
i32.eq
|
||||
if
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
local.get $3
|
||||
local.get $2
|
||||
call $~lib/allocator/tlsf/Root#setHead
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.eqz
|
||||
if
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
call $~lib/allocator/tlsf/Root#getSLMap
|
||||
i32.const 1
|
||||
local.get $4
|
||||
@ -1240,7 +1235,7 @@
|
||||
local.get $0
|
||||
i32.load
|
||||
i32.const 1
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.shl
|
||||
i32.const -1
|
||||
i32.xor
|
||||
@ -1342,7 +1337,7 @@
|
||||
end
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.eqz
|
||||
@ -1358,17 +1353,16 @@
|
||||
i32.load
|
||||
i32.const -4
|
||||
i32.and
|
||||
local.tee $4
|
||||
local.tee $3
|
||||
i32.const 16
|
||||
i32.ge_u
|
||||
local.tee $2
|
||||
if
|
||||
local.get $4
|
||||
if (result i32)
|
||||
local.get $3
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
local.set $2
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
local.get $2
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -1380,7 +1374,7 @@
|
||||
end
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Block#get:right
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -1390,14 +1384,14 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.load
|
||||
local.tee $4
|
||||
i32.const 1
|
||||
i32.and
|
||||
if
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
call $~lib/allocator/tlsf/Root#remove
|
||||
local.get $1
|
||||
local.get $4
|
||||
@ -1405,17 +1399,17 @@
|
||||
i32.and
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.add
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.store
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Block#get:right
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.load
|
||||
local.set $4
|
||||
end
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.and
|
||||
if
|
||||
@ -1449,38 +1443,37 @@
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Root#remove
|
||||
local.get $1
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const -4
|
||||
i32.and
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.get $5
|
||||
i32.add
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.store
|
||||
end
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
i32.const 2
|
||||
i32.or
|
||||
i32.store
|
||||
local.get $1
|
||||
local.get $2
|
||||
call $~lib/allocator/tlsf/Root#setJump
|
||||
local.get $3
|
||||
call $~lib/allocator/tlsf/Root#setJump
|
||||
local.get $2
|
||||
i32.const -4
|
||||
i32.and
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.const 16
|
||||
i32.ge_u
|
||||
local.tee $2
|
||||
if
|
||||
local.get $3
|
||||
if (result i32)
|
||||
local.get $2
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
local.set $2
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
local.get $2
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -1491,32 +1484,32 @@
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 256
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.div_u
|
||||
local.set $3
|
||||
local.set $2
|
||||
i32.const 0
|
||||
else
|
||||
local.get $3
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $2
|
||||
call $~lib/allocator/tlsf/fls<usize>
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.const 5
|
||||
i32.sub
|
||||
i32.shr_u
|
||||
i32.const 32
|
||||
i32.xor
|
||||
local.set $3
|
||||
local.get $2
|
||||
local.set $2
|
||||
local.get $3
|
||||
i32.const 7
|
||||
i32.sub
|
||||
end
|
||||
local.tee $2
|
||||
local.get $3
|
||||
local.tee $3
|
||||
local.get $2
|
||||
call $~lib/allocator/tlsf/Root#getHead
|
||||
local.set $4
|
||||
local.get $1
|
||||
@ -1532,25 +1525,25 @@
|
||||
i32.store offset=4
|
||||
end
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Root#setHead
|
||||
local.get $0
|
||||
local.get $0
|
||||
i32.load
|
||||
i32.const 1
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.shl
|
||||
i32.or
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $3
|
||||
call $~lib/allocator/tlsf/Root#getSLMap
|
||||
i32.const 1
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.shl
|
||||
i32.or
|
||||
call $~lib/allocator/tlsf/Root#setSLMap
|
||||
@ -1696,16 +1689,13 @@
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
local.get $1
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
i32.const 0
|
||||
local.get $1
|
||||
i32.const 16
|
||||
i32.ge_u
|
||||
local.tee $2
|
||||
if
|
||||
local.get $1
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
local.set $2
|
||||
end
|
||||
local.get $2
|
||||
select
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -1719,8 +1709,6 @@
|
||||
i32.const 256
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
local.set $2
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.div_u
|
||||
@ -1809,7 +1797,7 @@
|
||||
(local $4 i32)
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $4
|
||||
local.tee $3
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.eqz
|
||||
@ -1822,16 +1810,13 @@
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
i32.const 0
|
||||
local.get $2
|
||||
i32.const 16
|
||||
i32.ge_u
|
||||
local.tee $3
|
||||
if
|
||||
local.get $2
|
||||
i32.const 1073741824
|
||||
i32.lt_u
|
||||
local.set $3
|
||||
end
|
||||
local.get $3
|
||||
select
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -1855,17 +1840,17 @@
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Root#remove
|
||||
local.get $4
|
||||
local.get $3
|
||||
i32.const -4
|
||||
i32.and
|
||||
local.get $2
|
||||
i32.sub
|
||||
local.tee $3
|
||||
local.tee $4
|
||||
i32.const 24
|
||||
i32.ge_u
|
||||
if
|
||||
local.get $1
|
||||
local.get $4
|
||||
local.get $3
|
||||
i32.const 2
|
||||
i32.and
|
||||
local.get $2
|
||||
@ -1877,7 +1862,7 @@
|
||||
local.get $2
|
||||
i32.add
|
||||
local.tee $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 1
|
||||
@ -1888,7 +1873,7 @@
|
||||
call $~lib/allocator/tlsf/Root#insert
|
||||
else
|
||||
local.get $1
|
||||
local.get $4
|
||||
local.get $3
|
||||
i32.const -2
|
||||
i32.and
|
||||
i32.store
|
||||
@ -1925,18 +1910,17 @@
|
||||
if
|
||||
i32.const 1
|
||||
current_memory
|
||||
local.tee $1
|
||||
i32.gt_s
|
||||
local.tee $2
|
||||
i32.gt_s
|
||||
if (result i32)
|
||||
i32.const 1
|
||||
local.get $1
|
||||
local.get $2
|
||||
i32.sub
|
||||
grow_memory
|
||||
i32.const 0
|
||||
i32.lt_s
|
||||
else
|
||||
local.get $2
|
||||
i32.const 0
|
||||
end
|
||||
if
|
||||
unreachable
|
||||
@ -1951,8 +1935,6 @@
|
||||
i32.const 656
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 0
|
||||
local.set $1
|
||||
loop $repeat|0
|
||||
local.get $1
|
||||
i32.const 22
|
||||
@ -2296,19 +2278,17 @@
|
||||
i32.store offset=8
|
||||
)
|
||||
(func $~lib/collector/itcm/__ref_link (; 63 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
call $~lib/collector/itcm/maybeInit
|
||||
global.get $~lib/collector/itcm/white
|
||||
i32.eqz
|
||||
local.get $1
|
||||
i32.const 16
|
||||
i32.sub
|
||||
local.tee $2
|
||||
local.tee $1
|
||||
i32.load offset=8
|
||||
i32.const 3
|
||||
i32.and
|
||||
i32.eq
|
||||
local.tee $1
|
||||
if (result i32)
|
||||
global.get $~lib/collector/itcm/white
|
||||
local.get $0
|
||||
@ -2319,10 +2299,10 @@
|
||||
i32.and
|
||||
i32.eq
|
||||
else
|
||||
local.get $1
|
||||
i32.const 0
|
||||
end
|
||||
if
|
||||
local.get $2
|
||||
local.get $1
|
||||
call $~lib/collector/itcm/ManagedObject#makeGray
|
||||
end
|
||||
)
|
||||
@ -2333,15 +2313,13 @@
|
||||
(local $5 i32)
|
||||
local.get $0
|
||||
local.tee $3
|
||||
i32.eqz
|
||||
local.tee $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
else
|
||||
local.get $3
|
||||
i32.const 176
|
||||
i32.load
|
||||
i32.gt_u
|
||||
else
|
||||
i32.const 1
|
||||
end
|
||||
if (result i32)
|
||||
unreachable
|
||||
|
Reference in New Issue
Block a user