-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathlinking2.wast
More file actions
30 lines (24 loc) · 966 Bytes
/
linking2.wast
File metadata and controls
30 lines (24 loc) · 966 Bytes
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
(module $Mm
(memory $mem0 (export "mem0") 0 0)
(memory $mem1 (export "mem1") 1 5)
(memory $mem2 (export "mem2") 0 0)
(data (memory 1) (i32.const 10) "\00\01\02\03\04\05\06\07\08\09")
(func (export "load") (param $a i32) (result i32)
(i32.load8_u $mem1 (local.get 0))
)
)
(register "Mm" $Mm)
(module $Pm
(memory (import "Mm" "mem1") 1 8)
(func (export "grow") (param $a i32) (result i32)
(memory.grow (local.get 0))
)
)
(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 1))
(assert_return (invoke $Pm "grow" (i32.const 2)) (i32.const 1))
(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 3))
(assert_return (invoke $Pm "grow" (i32.const 1)) (i32.const 3))
(assert_return (invoke $Pm "grow" (i32.const 1)) (i32.const 4))
(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 5))
(assert_return (invoke $Pm "grow" (i32.const 1)) (i32.const -1))
(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 5))