summaryrefslogtreecommitdiff
path: root/test/interp/run-export-with-argument.txt
blob: 55bec6628818e1926b29bbb44ed61a674c0e9fae (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
31
32
33
34
;;; TOOL: run-interp
;;; ARGS1: --run-export=func_sum --argument=i64:8 --argument=i64:5 --run-export=func_fac --argument=i32:10
(module
  (func (export "func_sum") (param i64) (param i64) (result i64)
    local.get 0
    local.get 1
    i64.add
    return)

  (func (export "func_fac") (param i32) (result i32)
    local.get 0
    call $fac)

  (func $fac (param i32) (result i32)
    local.get 0
    i32.const 0
    i32.gt_s 
    if (result i32)
      local.get 0
      local.get 0
      i32.const 1
      i32.sub
      call $fac
      i32.mul
      return
    else
      i32.const 1
      return
    end) 
)
(;; STDOUT ;;;
func_sum(i64:8, i64:5) => i64:13
func_fac(i32:10) => i32:3628800
;;; STDOUT ;;)