summaryrefslogtreecommitdiffstats
path: root/third_party/rust/lucet-runtime-wasmsbx/tests/instruction_counting/calls.wat
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/lucet-runtime-wasmsbx/tests/instruction_counting/calls.wat')
-rw-r--r--third_party/rust/lucet-runtime-wasmsbx/tests/instruction_counting/calls.wat22
1 files changed, 22 insertions, 0 deletions
diff --git a/third_party/rust/lucet-runtime-wasmsbx/tests/instruction_counting/calls.wat b/third_party/rust/lucet-runtime-wasmsbx/tests/instruction_counting/calls.wat
new file mode 100644
index 0000000000..6fba4c4e6e
--- /dev/null
+++ b/third_party/rust/lucet-runtime-wasmsbx/tests/instruction_counting/calls.wat
@@ -0,0 +1,22 @@
+(module
+ (func $mul2 (param $in i64) (result i64)
+ get_local $in
+ get_local $in
+ i64.mul
+ )
+ (func $main (export "test_function")
+ i64.const 1
+ call $mul2 ;; one from the call, three from the called function, one for the return
+ drop
+ i64.const 2
+ call $mul2 ;; and again
+ drop
+ i64.const 3
+ call $mul2 ;; and again
+ ;; for a total of 3 * 6 == 18 instructions
+ drop
+ )
+ (func $instruction_count (export "instruction_count") (result i64)
+ i64.const 18
+ )
+)