summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-10-17 00:42:15 +0200
committerGitHub <noreply@github.com>2023-10-16 15:42:15 -0700
commitf686b6887439f81a99599b0667e02c8d1f698935 (patch)
tree82a60490c7259ee78aa3696e93f4038cca162eef /test
parent46df199c9041a6e9031617021714328352d0979b (diff)
downloadbinaryen-f686b6887439f81a99599b0667e02c8d1f698935.tar.gz
binaryen-f686b6887439f81a99599b0667e02c8d1f698935.tar.bz2
binaryen-f686b6887439f81a99599b0667e02c8d1f698935.zip
[wasm-split] Fix instrumentation to work with memory 64 (#6013)
Correctly use the output memory's index type when generating the __write_profile function. Requires moving some code around, but is a very small fix.
Diffstat (limited to 'test')
-rw-r--r--test/lit/wasm-split/instrument-memory64.wast49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/lit/wasm-split/instrument-memory64.wast b/test/lit/wasm-split/instrument-memory64.wast
new file mode 100644
index 000000000..ec737b95f
--- /dev/null
+++ b/test/lit/wasm-split/instrument-memory64.wast
@@ -0,0 +1,49 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; Check that the instrumentation is correct when the output memory is 64-bit.
+
+;; RUN: wasm-split %s -all --instrument -S -o - | filecheck %s
+
+;; Check that the output round trips and validates as well
+;; RUN: wasm-split %s -all --instrument -g -o %t
+;; RUN: wasm-opt %t -all --print | filecheck %s
+
+(module
+ (import "env" "foo" (func $foo))
+ (export "bar" (func $bar))
+
+ (memory $mem i64 1 1)
+
+ (func $bar
+ (call $foo)
+ )
+ (func $baz (param i32) (result i32)
+ (local.get 0)
+ )
+)
+
+;; Check that the $addr parameter is an i64.
+
+;; CHECK: (func $__write_profile (type $2) (param $addr i64) (param $size i32) (result i32)
+;; CHECK-NEXT: (if
+;; CHECK-NEXT: (i32.ge_u
+;; CHECK-NEXT: (local.get $size)
+;; CHECK-NEXT: (i32.const 16)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (block
+;; CHECK-NEXT: (i64.store align=1
+;; CHECK-NEXT: (local.get $addr)
+;; CHECK-NEXT: (i64.const {{.*}})
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (i32.store offset=8 align=1
+;; CHECK-NEXT: (local.get $addr)
+;; CHECK-NEXT: (global.get $bar_timestamp)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (i32.store offset=12 align=1
+;; CHECK-NEXT: (local.get $addr)
+;; CHECK-NEXT: (global.get $baz_timestamp)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (i32.const 16)
+;; CHECK-NEXT: )