mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-21 10:41:42 +00:00
optimize logical and/or, initial null checking in flows
This commit is contained in:
@ -204,7 +204,7 @@
|
||||
(local $5 i32)
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.eqz
|
||||
@ -216,20 +216,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
|
||||
@ -239,67 +238,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
|
||||
@ -316,7 +315,7 @@
|
||||
local.get $0
|
||||
i32.load
|
||||
i32.const 1
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.shl
|
||||
i32.const -1
|
||||
i32.xor
|
||||
@ -418,7 +417,7 @@
|
||||
end
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.eqz
|
||||
@ -434,17 +433,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
|
||||
@ -456,7 +454,7 @@
|
||||
end
|
||||
local.get $1
|
||||
call $~lib/allocator/tlsf/Block#get:right
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
@ -466,14 +464,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
|
||||
@ -481,17 +479,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
|
||||
@ -525,38 +523,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
|
||||
@ -567,32 +564,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
|
||||
@ -608,25 +605,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
|
||||
@ -772,16 +769,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
|
||||
@ -795,8 +789,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
|
||||
@ -885,7 +877,7 @@
|
||||
(local $4 i32)
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $4
|
||||
local.tee $3
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.eqz
|
||||
@ -898,16 +890,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
|
||||
@ -931,17 +920,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
|
||||
@ -953,7 +942,7 @@
|
||||
local.get $2
|
||||
i32.add
|
||||
local.tee $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 1
|
||||
@ -964,7 +953,7 @@
|
||||
call $~lib/allocator/tlsf/Root#insert
|
||||
else
|
||||
local.get $1
|
||||
local.get $4
|
||||
local.get $3
|
||||
i32.const -2
|
||||
i32.and
|
||||
i32.store
|
||||
@ -1001,18 +990,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
|
||||
@ -1027,8 +1015,6 @@
|
||||
i32.const 272
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 0
|
||||
local.set $1
|
||||
loop $repeat|0
|
||||
local.get $1
|
||||
i32.const 22
|
||||
@ -1782,7 +1768,6 @@
|
||||
(func $start:std/runtime (; 24 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
loop $repeat|0
|
||||
local.get $0
|
||||
i32.const 9000
|
||||
@ -1797,19 +1782,14 @@
|
||||
i32.sub
|
||||
i32.shl
|
||||
local.tee $1
|
||||
local.get $1
|
||||
i32.const 1
|
||||
i32.sub
|
||||
i32.and
|
||||
i32.eqz
|
||||
i32.const 0
|
||||
i32.ne
|
||||
local.tee $2
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.const 1
|
||||
i32.sub
|
||||
local.get $1
|
||||
i32.and
|
||||
i32.eqz
|
||||
else
|
||||
local.get $2
|
||||
end
|
||||
local.get $1
|
||||
select
|
||||
if
|
||||
local.get $0
|
||||
i32.const 1
|
||||
|
Reference in New Issue
Block a user