mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-20 18:26:40 +00:00
Improve inlining where locals can be aliased; Add a crude mechanism for explicit unchecked array accesses
The `unchecked` builtin should be handled with ultimate care and it would be a lot better if there'd be a mechanism doing this automatically.
This commit is contained in:
@ -11,6 +11,12 @@
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(block
|
||||
(set_local $0
|
||||
(i32.const 127)
|
||||
@ -296,15 +302,15 @@
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.const 32767)
|
||||
)
|
||||
(nop)
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -315,7 +321,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const -32768)
|
||||
)
|
||||
)
|
||||
@ -329,11 +335,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -344,7 +350,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 32767)
|
||||
)
|
||||
)
|
||||
@ -358,16 +364,16 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $3
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(get_local $1)
|
||||
(set_local $4
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -375,13 +381,13 @@
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $4)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const -32768)
|
||||
)
|
||||
)
|
||||
@ -395,16 +401,16 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $3
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(get_local $1)
|
||||
(set_local $4
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -412,13 +418,13 @@
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $4)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 32767)
|
||||
)
|
||||
)
|
||||
@ -432,11 +438,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -447,7 +453,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const -32768)
|
||||
)
|
||||
)
|
||||
@ -461,11 +467,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -476,7 +482,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 32767)
|
||||
)
|
||||
)
|
||||
@ -490,12 +496,12 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(tee_local $1
|
||||
(set_local $3
|
||||
(tee_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -507,7 +513,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const -32768)
|
||||
)
|
||||
)
|
||||
@ -521,12 +527,12 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(tee_local $1
|
||||
(set_local $3
|
||||
(tee_local $2
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -538,7 +544,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 32767)
|
||||
)
|
||||
)
|
||||
@ -558,7 +564,7 @@
|
||||
(i32.shr_s
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 16)
|
||||
@ -580,14 +586,14 @@
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.const 0)
|
||||
)
|
||||
(nop)
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -596,7 +602,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 255)
|
||||
)
|
||||
)
|
||||
@ -610,10 +616,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -622,7 +628,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -636,27 +642,27 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $5
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(get_local $0)
|
||||
(set_local $6
|
||||
(get_local $4)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 255)
|
||||
)
|
||||
)
|
||||
@ -670,27 +676,27 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $5
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(get_local $0)
|
||||
(set_local $6
|
||||
(get_local $4)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -704,10 +710,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -716,7 +722,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 255)
|
||||
)
|
||||
)
|
||||
@ -730,10 +736,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $4
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -742,7 +748,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -756,11 +762,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(tee_local $0
|
||||
(set_local $5
|
||||
(tee_local $4
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -770,7 +776,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 255)
|
||||
)
|
||||
)
|
||||
@ -784,11 +790,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(tee_local $0
|
||||
(set_local $5
|
||||
(tee_local $4
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -798,7 +804,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -817,7 +823,7 @@
|
||||
(i32.eq
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 255)
|
||||
@ -837,14 +843,14 @@
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.const 0)
|
||||
)
|
||||
(nop)
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
@ -853,7 +859,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 65535)
|
||||
)
|
||||
)
|
||||
@ -867,10 +873,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
@ -879,7 +885,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -893,27 +899,27 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $7
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(get_local $1)
|
||||
(set_local $8
|
||||
(get_local $6)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $8)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 65535)
|
||||
)
|
||||
)
|
||||
@ -927,27 +933,27 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(set_local $7
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(get_local $1)
|
||||
(set_local $8
|
||||
(get_local $6)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $8)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -961,10 +967,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
@ -973,7 +979,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 65535)
|
||||
)
|
||||
)
|
||||
@ -987,10 +993,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(set_local $6
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
@ -999,7 +1005,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -1013,11 +1019,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(tee_local $1
|
||||
(set_local $7
|
||||
(tee_local $6
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
@ -1027,7 +1033,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 65535)
|
||||
)
|
||||
)
|
||||
@ -1041,11 +1047,11 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(tee_local $1
|
||||
(set_local $7
|
||||
(tee_local $6
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
@ -1055,7 +1061,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -1074,7 +1080,7 @@
|
||||
(i32.eq
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 65535)
|
||||
|
Reference in New Issue
Block a user