optimize logical and/or, initial null checking in flows

This commit is contained in:
dcode
2019-04-09 03:04:45 +02:00
parent c16c19e18d
commit da4a7751fd
73 changed files with 5920 additions and 6866 deletions

View File

@ -44,7 +44,7 @@
i32.load
i32.le_u
else
local.get $0
i32.const 0
end
if
loop $continue|0
@ -68,19 +68,15 @@
i32.const 0
)
(func $~lib/runtime/runtime.flags (; 2 ;) (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 128
i32.load
i32.gt_u
local.set $1
else
i32.const 1
end
local.get $1
if (result i32)
unreachable
else
@ -257,7 +253,7 @@
(local $5 i32)
local.get $1
i32.load
local.tee $2
local.tee $3
i32.const 1
i32.and
i32.eqz
@ -269,20 +265,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
@ -292,67 +287,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
@ -369,7 +364,7 @@
local.get $0
i32.load
i32.const 1
local.get $2
local.get $3
i32.shl
i32.const -1
i32.xor
@ -471,7 +466,7 @@
end
local.get $1
i32.load
local.tee $3
local.tee $2
i32.const 1
i32.and
i32.eqz
@ -487,17 +482,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
@ -509,7 +503,7 @@
end
local.get $1
call $~lib/allocator/tlsf/Block#get:right
local.tee $2
local.tee $3
i32.eqz
if
i32.const 0
@ -519,14 +513,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
@ -534,17 +528,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
@ -578,38 +572,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
@ -620,32 +613,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
@ -661,25 +654,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
@ -825,16 +818,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
@ -848,8 +838,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
@ -938,7 +926,7 @@
(local $4 i32)
local.get $1
i32.load
local.tee $4
local.tee $3
i32.const 1
i32.and
i32.eqz
@ -951,16 +939,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
@ -984,17 +969,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
@ -1006,7 +991,7 @@
local.get $2
i32.add
local.tee $2
local.get $3
local.get $4
i32.const 8
i32.sub
i32.const 1
@ -1017,7 +1002,7 @@
call $~lib/allocator/tlsf/Root#insert
else
local.get $1
local.get $4
local.get $3
i32.const -2
i32.and
i32.store
@ -1054,18 +1039,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
@ -1080,8 +1064,6 @@
i32.const 280
i32.const 0
i32.store
i32.const 0
local.set $1
loop $repeat|0
local.get $1
i32.const 22
@ -1425,19 +1407,17 @@
i32.store offset=8
)
(func $~lib/collector/itcm/__ref_link (; 27 ;) (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
@ -1448,10 +1428,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
)
@ -1462,15 +1442,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 128
i32.load
i32.gt_u
else
i32.const 1
end
if (result i32)
unreachable