wasmer/src/spec/tests/call.wast

50 lines
974 B
Plaintext
Raw Normal View History

2018-10-13 13:31:56 +00:00
(module
(table 0 anyfunc)
(memory 0)
2018-10-15 13:58:23 +00:00
;; (func $for_2 (; 0 ;) (param $0 i32) (result i32)
;; (i32.shl
;; (get_local $0)
;; (i32.const 1)
;; )
;; )
;; (func (export "main") (; 1 ;) (result i32)
;; (call $for_2
;; (i32.const 2)
;; )
;; )
2018-10-16 01:21:49 +00:00
;; (func $multiply (; 1 ;) (param i32 i32) (result i32)
;; (i32.mul
;; (get_local 0)
;; (get_local 1)
;; )
;; )
2018-10-15 15:10:49 +00:00
2018-10-16 01:21:49 +00:00
;; (func (export "multiply_direct") (; 1 ;) (param $0 i32) (result i32)
;; (i32.mul
;; (get_local 0)
;; (i32.const 3)
;; )
;; )
2018-10-15 22:04:05 +00:00
2018-10-16 01:21:49 +00:00
;; (func (export "multiply_by_3") (; 1 ;) (param $0 i32) (result i32)
;; (call $multiply
;; (i32.const 3)
;; (get_local $0)
;; ;; (i32.const 2)
;; )
;; )
2018-10-15 15:10:49 +00:00
(func (export "multiply_by_3_raw") (; 1 ;) (param $0 i32) (result i32)
(i32.mul
(get_local $0)
2018-10-15 13:58:23 +00:00
(i32.const 3)
2018-10-13 13:31:56 +00:00
)
)
2018-10-15 13:58:23 +00:00
2018-10-13 13:31:56 +00:00
)
2018-10-15 15:10:49 +00:00
(assert_return (invoke "multiply_by_3_raw" (i32.const 2)) (i32.const 6))
2018-10-15 22:04:05 +00:00
;; (assert_return (invoke "multiply_by_3_raw" (i32.const 2)) (i32.const 6))