Skip to content

Commit

Permalink
Merge pull request #2 from WAFoundation/feature/table-working
Browse files Browse the repository at this point in the history
call_indirect passes
  • Loading branch information
syrusakbary authored Oct 23, 2018
2 parents 6c9087a + 10eff5f commit 3107dc1
Show file tree
Hide file tree
Showing 11 changed files with 3,003 additions and 140 deletions.
30 changes: 30 additions & 0 deletions examples/call_indirect.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(module
(type $multiply_signature (func (param i32 i32) (result i32)))
(table 1 1 anyfunc)
(elem (i32.const 0) $multiply)
(memory $0 1)
(export "memory" (memory $0))
(export "dispatch" (func $dispatch))
(export "multiply" (func $multiply))
(export "main" (func $main))
(func $dispatch (; 0 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(call_indirect (type $multiply_signature)
(get_local $1)
(get_local $2)
(get_local $0)
)
)
(func $multiply (; 1 ;) (type $multiply_signature) (param $0 i32) (param $1 i32) (result i32)
(i32.mul
(get_local $1)
(get_local $0)
)
)
(func $main (; 2 ;) (result i32)
(call $dispatch
(i32.const 0)
(i32.const 20)
(i32.const 30)
)
)
)
Loading

0 comments on commit 3107dc1

Please sign in to comment.