mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-20 02:11:31 +00:00
Slim down indexed access as far as currently possible
Interestingly, the same code written as statements is significantly slower. See notes.
This commit is contained in:
@ -35,56 +35,32 @@
|
||||
)
|
||||
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(set_local $2
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $1)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 92)
|
||||
(i32.const 64)
|
||||
(i32.const 37)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0 (result i32)
|
||||
(set_local $4
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $5
|
||||
(if (result i32)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(br $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -2919,9 +2895,6 @@
|
||||
(func $~lib/array/Array<i32>#__set (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
@ -2951,7 +2924,7 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 92)
|
||||
(i32.const 75)
|
||||
(i32.const 81)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2982,26 +2955,15 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/storeUnsafe<i32>|inlined.0
|
||||
(set_local $5
|
||||
(i32.store offset=8
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $6
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $7
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(i32.shl
|
||||
(get_local $6)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $start (; 12 ;) (type $v)
|
||||
|
Reference in New Issue
Block a user