mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 01:41:30 +00:00
Initial element access compilation; Carefully approaching std array
This commit is contained in:
157
tests/compiler/std/carray.optimized.wast
Normal file
157
tests/compiler/std/carray.optimized.wast
Normal file
@ -0,0 +1,157 @@
|
||||
(module
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(global $std/carray/arr (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 4))
|
||||
(memory $0 1)
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $std:array/CArray#__get (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(i32.load
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/CArray#__set (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(i32.store
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $start (; 2 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(set_global $std/carray/arr
|
||||
(get_global $HEAP_BASE)
|
||||
)
|
||||
(if
|
||||
(i32.load
|
||||
(get_global $HEAP_BASE)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.load
|
||||
(i32.add
|
||||
(get_global $HEAP_BASE)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(call $std:array/CArray#__get
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(call $std:array/CArray#__get
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(call $std:array/CArray#__set
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 0)
|
||||
(i32.const 42)
|
||||
)
|
||||
(call $std:array/CArray#__set
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 1)
|
||||
(i32.const 24)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load
|
||||
(get_global $HEAP_BASE)
|
||||
)
|
||||
(i32.const 42)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load
|
||||
(i32.add
|
||||
(get_global $HEAP_BASE)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.const 24)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/CArray#__get
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 42)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/CArray#__get
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 24)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(block (result i32)
|
||||
(call $std:array/CArray#__set
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 3)
|
||||
(tee_local $0
|
||||
(i32.const 9000)
|
||||
)
|
||||
)
|
||||
(i32.ne
|
||||
(get_local $0)
|
||||
(i32.const 9000)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load
|
||||
(i32.add
|
||||
(get_global $HEAP_BASE)
|
||||
(i32.const 12)
|
||||
)
|
||||
)
|
||||
(i32.const 9000)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/CArray#__get
|
||||
(get_global $std/carray/arr)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i32.const 9000)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user