mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 06:21:29 +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:
@ -47,56 +47,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 180)
|
||||
(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)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -2873,9 +2849,6 @@
|
||||
(func $~lib/array/Array<i32>#__set (; 10 ;) (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)
|
||||
@ -2905,7 +2878,7 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 75)
|
||||
(i32.const 81)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2936,26 +2909,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 $~lib/array/Array<i64>#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -2967,65 +2929,38 @@
|
||||
)
|
||||
(func $~lib/array/Array<i64>#__get (; 12 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64)
|
||||
(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 3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $1)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 64)
|
||||
(i32.const 37)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<i64>|inlined.0 (result i64)
|
||||
(set_local $4
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $5
|
||||
(if (result i64)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(br $~lib/internal/arraybuffer/loadUnsafe<i64>|inlined.0
|
||||
(i64.load offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<i64>#__set (; 13 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i64)
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
@ -3055,7 +2990,7 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 75)
|
||||
(i32.const 81)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3086,26 +3021,15 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/storeUnsafe<i64>|inlined.0
|
||||
(set_local $5
|
||||
(i64.store offset=8
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $6
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $7
|
||||
(get_local $2)
|
||||
)
|
||||
(i64.store offset=8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(i32.shl
|
||||
(get_local $6)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 3)
|
||||
)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<f32>#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -3117,65 +3041,38 @@
|
||||
)
|
||||
(func $~lib/array/Array<f32>#__get (; 15 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32)
|
||||
(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 180)
|
||||
(i32.const 64)
|
||||
(i32.const 37)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<f32>|inlined.0 (result f32)
|
||||
(set_local $4
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $5
|
||||
(if (result f32)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(br $~lib/internal/arraybuffer/loadUnsafe<f32>|inlined.0
|
||||
(f32.load offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(i32.const 2)
|
||||
)
|
||||
(f32.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<f32>#__set (; 16 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 f32)
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
@ -3205,7 +3102,7 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 75)
|
||||
(i32.const 81)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3236,26 +3133,15 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/storeUnsafe<f32>|inlined.0
|
||||
(set_local $5
|
||||
(f32.store offset=8
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $6
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $7
|
||||
(get_local $2)
|
||||
)
|
||||
(f32.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 $~lib/array/Array<f64>#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -3267,65 +3153,38 @@
|
||||
)
|
||||
(func $~lib/array/Array<f64>#__get (; 18 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
|
||||
(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 3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $1)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 64)
|
||||
(i32.const 37)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<f64>|inlined.0 (result f64)
|
||||
(set_local $4
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $5
|
||||
(if (result f64)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(br $~lib/internal/arraybuffer/loadUnsafe<f64>|inlined.0
|
||||
(f64.load offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(i32.const 3)
|
||||
)
|
||||
(f64.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<f64>#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 f64)
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
@ -3355,7 +3214,7 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 75)
|
||||
(i32.const 81)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
@ -3386,26 +3245,15 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/storeUnsafe<f64>|inlined.0
|
||||
(set_local $5
|
||||
(f64.store offset=8
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $6
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $7
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(i32.shl
|
||||
(get_local $6)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 3)
|
||||
)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $start (; 20 ;) (type $v)
|
||||
|
Reference in New Issue
Block a user