summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-03-16 14:12:44 -0700
committerGitHub <noreply@github.com>2017-03-16 14:12:44 -0700
commitee501dfb427e675adee7790a6dbc7e90f9f5a4ca (patch)
tree0889eb6cd2bff3cebebe019e8132eb816bd52d27 /test
parent5079b89949d4c5c5c7b6d29658d058db459be9e6 (diff)
downloadbinaryen-ee501dfb427e675adee7790a6dbc7e90f9f5a4ca.tar.gz
binaryen-ee501dfb427e675adee7790a6dbc7e90f9f5a4ca.tar.bz2
binaryen-ee501dfb427e675adee7790a6dbc7e90f9f5a4ca.zip
add a pass to log execution traces via instrumenting the code (#950)
Diffstat (limited to 'test')
-rw-r--r--test/passes/log-execution.txt88
-rw-r--r--test/passes/log-execution.wast35
2 files changed, 123 insertions, 0 deletions
diff --git a/test/passes/log-execution.txt b/test/passes/log-execution.txt
new file mode 100644
index 000000000..32bbd88eb
--- /dev/null
+++ b/test/passes/log-execution.txt
@@ -0,0 +1,88 @@
+(module
+ (type $0 (func))
+ (type $1 (func (result i32)))
+ (type $FUNCSIG$vi (func (param i32)))
+ (import "env" "log_execution" (func $log_execution (param i32)))
+ (memory $0 0)
+ (func $nopp (type $0)
+ (call $log_execution
+ (i32.const 0)
+ )
+ (nop)
+ )
+ (func $intt (type $1) (result i32)
+ (call $log_execution
+ (i32.const 1)
+ )
+ (i32.const 10)
+ )
+ (func $workk (type $0)
+ (call $log_execution
+ (i32.const 2)
+ )
+ (block
+ (if
+ (i32.const 0)
+ (nop)
+ )
+ (drop
+ (i32.const 1)
+ )
+ )
+ )
+ (func $loops (type $0)
+ (call $log_execution
+ (i32.const 6)
+ )
+ (block
+ (loop $x
+ (call $log_execution
+ (i32.const 3)
+ )
+ (block
+ (call $loops)
+ (br $x)
+ )
+ )
+ (if
+ (call $intt)
+ (loop $y
+ (call $log_execution
+ (i32.const 4)
+ )
+ (call $loops)
+ )
+ )
+ (loop $loop-in
+ (call $log_execution
+ (i32.const 5)
+ )
+ (block
+ (drop
+ (i32.const 10)
+ )
+ (drop
+ (i32.const 20)
+ )
+ (drop
+ (i32.const 30)
+ )
+ )
+ )
+ )
+ )
+ (func $loops-similar (type $0)
+ (call $log_execution
+ (i32.const 8)
+ )
+ (loop $x
+ (call $log_execution
+ (i32.const 7)
+ )
+ (block
+ (call $loops)
+ (br $x)
+ )
+ )
+ )
+)
diff --git a/test/passes/log-execution.wast b/test/passes/log-execution.wast
new file mode 100644
index 000000000..12175fbcb
--- /dev/null
+++ b/test/passes/log-execution.wast
@@ -0,0 +1,35 @@
+(module
+ (func $nopp
+ (nop)
+ )
+ (func $intt (result i32)
+ (i32.const 10)
+ )
+ (func $workk
+ (if (i32.const 0) (nop))
+ (drop (i32.const 1))
+ )
+ (func $loops
+ (loop $x
+ (call $loops)
+ (br $x)
+ )
+ (if (call $intt)
+ (loop $y
+ (call $loops)
+ )
+ )
+ (loop
+ (drop (i32.const 10))
+ (drop (i32.const 20))
+ (drop (i32.const 30))
+ )
+ )
+ (func $loops-similar
+ (loop $x
+ (call $loops)
+ (br $x)
+ )
+ )
+)
+