mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 06:21:29 +00:00
More std array
This commit is contained in:
@ -97,6 +97,8 @@ glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => {
|
||||
actualOptimized = module.toText();
|
||||
module.runPasses([ "inlining" ]);
|
||||
actualInlined = module.toText();
|
||||
if (isCreate)
|
||||
fs.writeFileSync(__dirname + "/compiler/" + fixture + ".optimized.wasm", module.toBinary());
|
||||
} else {
|
||||
failed = true;
|
||||
console.log(chalk.red("validate ERROR"));
|
||||
|
1
tests/compiler/.gitignore
vendored
Normal file
1
tests/compiler/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.wasm
|
@ -4,6 +4,7 @@
|
||||
(type $iv (func (param i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(global $std:heap/HEAP_OFFSET (mut i32) (i32.const 0))
|
||||
(global $std/array/arr (mut i32) (i32.const 0))
|
||||
@ -101,7 +102,12 @@
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(func $std:heap/copy_memory (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $std:array/Array#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $std:heap/copy_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(loop $continue|0
|
||||
@ -1677,7 +1683,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:heap/move_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $std:heap/move_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(if
|
||||
(i32.eq
|
||||
@ -1967,10 +1973,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:heap/free_memory (; 3 ;) (type $iv) (param $0 i32)
|
||||
(func $std:heap/free_memory (; 4 ;) (type $iv) (param $0 i32)
|
||||
(nop)
|
||||
)
|
||||
(func $std:array/Array#__grow (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $std:array/Array#__grow (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
(if
|
||||
(i32.le_s
|
||||
@ -2022,11 +2028,10 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#push (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $std:array/Array#push (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
@ -2036,27 +2041,17 @@
|
||||
)
|
||||
(call $std:array/Array#__grow
|
||||
(get_local $0)
|
||||
(select
|
||||
(tee_local $2
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
(if (result i32)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.shl
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(tee_local $3
|
||||
(i32.shl
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -2087,7 +2082,7 @@
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(func $std:array/Array#__get (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $std:array/Array#__get (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $1)
|
||||
@ -2109,66 +2104,52 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#pop (; 7 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std:array/Array#pop (; 8 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(if
|
||||
(i32.and
|
||||
(if (result i32)
|
||||
(tee_local $1
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
(i32.gt_u
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(i32.sub
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(i32.load offset=8
|
||||
(block (result i32)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(tee_local $1
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#unshift (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $std:array/Array#unshift (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(tee_local $4
|
||||
(tee_local $2
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
@ -2177,26 +2158,14 @@
|
||||
(block
|
||||
(if
|
||||
(i32.le_s
|
||||
(tee_local $2
|
||||
(select
|
||||
(tee_local $2
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(tee_local $3
|
||||
(i32.mul
|
||||
(get_local $4)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.gt_s
|
||||
(tee_local $3
|
||||
(if (result i32)
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.load offset=4
|
||||
@ -2205,10 +2174,10 @@
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $4
|
||||
(call $std:heap/allocate_memory
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -2220,14 +2189,14 @@
|
||||
(block
|
||||
(call $std:heap/move_memory
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
(i32.const 4)
|
||||
)
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $4)
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -2240,11 +2209,11 @@
|
||||
)
|
||||
(i32.store
|
||||
(get_local $0)
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(call $std:heap/move_memory
|
||||
@ -2258,7 +2227,7 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $4)
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -2271,7 +2240,7 @@
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(tee_local $2
|
||||
(tee_local $0
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
@ -2280,9 +2249,9 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $std:heap/set_memory (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $std:heap/set_memory (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i64)
|
||||
(local $4 i32)
|
||||
(if
|
||||
@ -2615,28 +2584,12 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#shift (; 10 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std:array/Array#shift (; 11 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(if
|
||||
(i32.and
|
||||
(if (result i32)
|
||||
(tee_local $1
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
(i32.gt_u
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
@ -2698,7 +2651,250 @@
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(func $start (; 11 ;) (type $v)
|
||||
(func $std:array/Array#reverse (; 12 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(set_local $1
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
(block
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $std:array/Array#indexOf (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_u
|
||||
(get_local $2)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.eq
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(return
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const -1)
|
||||
)
|
||||
(func $std:array/Array#splice (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(tee_local $1
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 0)
|
||||
)
|
||||
(if
|
||||
(i32.ge_s
|
||||
(get_local $1)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_s
|
||||
(get_local $1)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
)
|
||||
(call $std:heap/move_memory
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(tee_local $2
|
||||
(select
|
||||
(get_local $2)
|
||||
(tee_local $1
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 15 ;) (type $v)
|
||||
(set_global $std:heap/HEAP_OFFSET
|
||||
(get_global $HEAP_BASE)
|
||||
)
|
||||
@ -2708,7 +2904,7 @@
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2737,7 +2933,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -2766,7 +2962,7 @@
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2788,7 +2984,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -2822,7 +3018,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 2)
|
||||
@ -2866,7 +3062,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 3)
|
||||
@ -2920,7 +3116,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 4)
|
||||
@ -2984,7 +3180,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 5)
|
||||
@ -3064,7 +3260,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 4)
|
||||
@ -3134,7 +3330,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 3)
|
||||
@ -3180,5 +3376,140 @@
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(drop
|
||||
(call $std:array/Array#reverse
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=4
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 8)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 44)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 43)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.const 42)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_global $std/array/i
|
||||
(call $std:array/Array#indexOf
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 44)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(get_global $std/array/i)
|
||||
(unreachable)
|
||||
)
|
||||
(set_global $std/array/i
|
||||
(call $std:array/Array#indexOf
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 42)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(get_global $std/array/i)
|
||||
(i32.const 2)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_global $std/array/i
|
||||
(call $std:array/Array#indexOf
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 45)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(get_global $std/array/i)
|
||||
(i32.const -1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(call $std:array/Array#splice
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load offset=4
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 8)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 44)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 42)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -73,3 +73,30 @@ assert(arr.__capacity == 8);
|
||||
assert(arr[0] == 42);
|
||||
assert(arr[1] == 43);
|
||||
assert(arr[2] == 44);
|
||||
|
||||
arr.reverse();
|
||||
|
||||
assert(arr.length == 3);
|
||||
assert(arr.__capacity == 8);
|
||||
assert(arr[0] == 44);
|
||||
assert(arr[1] == 43);
|
||||
assert(arr[2] == 42);
|
||||
|
||||
i = arr.indexOf(44);
|
||||
|
||||
assert(i == 0);
|
||||
|
||||
i = arr.indexOf(42);
|
||||
|
||||
assert(i == 2);
|
||||
|
||||
i = arr.indexOf(45);
|
||||
|
||||
assert(i == - 1);
|
||||
|
||||
arr.splice(1, 1);
|
||||
|
||||
assert(arr.length == 2);
|
||||
assert(arr.__capacity == 8);
|
||||
assert(arr[0] == 44);
|
||||
assert(arr[1] == 42);
|
||||
|
@ -5,6 +5,7 @@
|
||||
(type $iv (func (param i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(global $std:heap/HEAP_OFFSET (mut i32) (i32.const 0))
|
||||
(global $std:heap/ALIGN_LOG2 i32 (i32.const 3))
|
||||
@ -113,7 +114,14 @@
|
||||
(get_local $4)
|
||||
)
|
||||
)
|
||||
(func $std:heap/copy_memory (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $std:array/Array#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(return
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:heap/copy_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -1913,7 +1921,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:heap/move_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $std:heap/move_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(if
|
||||
(i32.eq
|
||||
@ -2237,9 +2245,9 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:heap/free_memory (; 3 ;) (type $iv) (param $0 i32)
|
||||
(func $std:heap/free_memory (; 4 ;) (type $iv) (param $0 i32)
|
||||
)
|
||||
(func $std:array/Array#__grow (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $std:array/Array#__grow (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
@ -2295,11 +2303,10 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#push (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $std:array/Array#push (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
@ -2309,27 +2316,17 @@
|
||||
)
|
||||
(call $std:array/Array#__grow
|
||||
(get_local $0)
|
||||
(select
|
||||
(tee_local $2
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
(if (result i32)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.shl
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(tee_local $3
|
||||
(i32.shl
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -2365,7 +2362,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#__get (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $std:array/Array#__get (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $1)
|
||||
@ -2389,44 +2386,16 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#pop (; 7 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std:array/Array#pop (; 8 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(if
|
||||
(i32.and
|
||||
(if (result i32)
|
||||
(i32.ne
|
||||
(tee_local $1
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(get_local $1)
|
||||
(i32.gt_u
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(i32.sub
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(return
|
||||
(i32.load
|
||||
@ -2435,8 +2404,20 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(set_local $1
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -2444,12 +2425,11 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#unshift (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $std:array/Array#unshift (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(block
|
||||
(set_local $2
|
||||
(i32.load offset=4
|
||||
@ -2458,7 +2438,7 @@
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
@ -2466,33 +2446,21 @@
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(set_local $5
|
||||
(select
|
||||
(tee_local $3
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(tee_local $4
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
(set_local $3
|
||||
(if (result i32)
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.gt_s
|
||||
(get_local $5)
|
||||
(get_local $3)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
@ -2501,10 +2469,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
(block
|
||||
(set_local $6
|
||||
(set_local $4
|
||||
(call $std:heap/allocate_memory
|
||||
(i32.mul
|
||||
(get_local $5)
|
||||
(get_local $3)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -2517,7 +2485,7 @@
|
||||
(block
|
||||
(call $std:heap/move_memory
|
||||
(i32.add
|
||||
(get_local $6)
|
||||
(get_local $4)
|
||||
(i32.const 4)
|
||||
)
|
||||
(i32.load
|
||||
@ -2537,11 +2505,11 @@
|
||||
)
|
||||
(i32.store
|
||||
(get_local $0)
|
||||
(get_local $6)
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
(get_local $5)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(call $std:heap/move_memory
|
||||
@ -2568,7 +2536,7 @@
|
||||
)
|
||||
(return
|
||||
(block (result i32)
|
||||
(set_local $3
|
||||
(set_local $5
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
@ -2578,13 +2546,13 @@
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(get_local $3)
|
||||
(get_local $5)
|
||||
)
|
||||
(get_local $3)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:heap/set_memory (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $std:heap/set_memory (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
@ -2945,39 +2913,19 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#shift (; 10 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std:array/Array#shift (; 11 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(if
|
||||
(i32.and
|
||||
(if (result i32)
|
||||
(i32.ne
|
||||
(tee_local $1
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(get_local $1)
|
||||
(i32.gt_u
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i32.lt_s
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $1
|
||||
(i32.load
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
@ -3033,10 +2981,282 @@
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $start (; 11 ;) (type $v)
|
||||
(func $std:array/Array#reverse (; 12 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(block $break|0
|
||||
(block
|
||||
(set_local $1
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(block
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#indexOf (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_u
|
||||
(get_local $2)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(if
|
||||
(i32.eq
|
||||
(i32.load
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(return
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i32.sub
|
||||
(i32.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std:array/Array#splice (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(block
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 0)
|
||||
)
|
||||
(if
|
||||
(i32.ge_s
|
||||
(get_local $1)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_s
|
||||
(get_local $1)
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(select
|
||||
(tee_local $3
|
||||
(get_local $2)
|
||||
)
|
||||
(tee_local $4
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(i32.lt_s
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call $std:heap/move_memory
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.mul
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.mul
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(get_local $0)
|
||||
(i32.sub
|
||||
(i32.load offset=8
|
||||
(get_local $0)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 15 ;) (type $v)
|
||||
(set_global $std:heap/HEAP_OFFSET
|
||||
(get_global $HEAP_BASE)
|
||||
)
|
||||
@ -3054,7 +3274,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 0)
|
||||
@ -3094,7 +3314,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -3130,7 +3350,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 0)
|
||||
@ -3158,7 +3378,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -3198,7 +3418,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 2)
|
||||
@ -3250,7 +3470,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 3)
|
||||
@ -3314,7 +3534,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 4)
|
||||
@ -3390,7 +3610,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 5)
|
||||
@ -3486,7 +3706,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 4)
|
||||
@ -3570,7 +3790,7 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=8
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 3)
|
||||
@ -3625,6 +3845,171 @@
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(drop
|
||||
(call $std:array/Array#reverse
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=4
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 8)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 44)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 43)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.const 42)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_global $std/array/i
|
||||
(call $std:array/Array#indexOf
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 44)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_global $std/array/i)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_global $std/array/i
|
||||
(call $std:array/Array#indexOf
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 42)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_global $std/array/i)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_global $std/array/i
|
||||
(call $std:array/Array#indexOf
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 45)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_global $std/array/i)
|
||||
(i32.sub
|
||||
(i32.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(call $std:array/Array#splice
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#get:length
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load offset=4
|
||||
(get_global $std/array/arr)
|
||||
)
|
||||
(i32.const 8)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 44)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $std:array/Array#__get
|
||||
(get_global $std/array/arr)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 42)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(;
|
||||
@ -3673,6 +4058,7 @@
|
||||
GLOBAL: HEAP_BASE
|
||||
CLASS_PROTOTYPE: std:array/Array
|
||||
CLASS_PROTOTYPE: Array
|
||||
PROPERTY: std:array/Array#length
|
||||
CLASS_PROTOTYPE: std:array/CArray
|
||||
CLASS_PROTOTYPE: CArray
|
||||
CLASS_PROTOTYPE: std:error/Error
|
||||
|
@ -251,6 +251,7 @@
|
||||
GLOBAL: HEAP_BASE
|
||||
CLASS_PROTOTYPE: std:array/Array
|
||||
CLASS_PROTOTYPE: Array
|
||||
PROPERTY: std:array/Array#length
|
||||
CLASS_PROTOTYPE: std:array/CArray
|
||||
CLASS_PROTOTYPE: CArray
|
||||
CLASS_PROTOTYPE: std:error/Error
|
||||
|
@ -2842,6 +2842,7 @@
|
||||
GLOBAL: HEAP_BASE
|
||||
CLASS_PROTOTYPE: std:array/Array
|
||||
CLASS_PROTOTYPE: Array
|
||||
PROPERTY: std:array/Array#length
|
||||
CLASS_PROTOTYPE: std:array/CArray
|
||||
CLASS_PROTOTYPE: CArray
|
||||
CLASS_PROTOTYPE: std:error/Error
|
||||
|
Reference in New Issue
Block a user