summaryrefslogtreecommitdiff
path: root/test/wasm2js/grow-memory-tricky.wast
blob: 163892d58ceee4dee679e6f858e70121532a3588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(module
 (type $0 (func (param i32) (result i32)))
 (type $1 (func (result i32)))
 (memory $0 1)
 (export "memory" (memory $0))
 (export "f1" (func $0))
 (export "f2" (func $1))

 (func $0 (result i32)
  (block (result i32)
    (i32.store (i32.const 0) (memory.grow (i32.const 1)))
    (i32.load (i32.const 0))
  )
 )

 (func $1 (result i32)
  (block (result i32)
    (i32.store (i32.const 0) (call $grow))
    (i32.load (i32.const 0))
  )
 )

 (func $grow (result i32)
  (memory.grow (i32.const 1))
 )
)


(assert_return (invoke "f1") (i32.const 1))
(assert_return (invoke "f2") (i32.const 2))