summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split/instrument-in-secondary-memory-custom-names.wast
blob: a211e5d8a5d58f63036d6fcfe95e5bfb4f9eda04 (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
;; RUN: wasm-split %s --instrument --in-secondary-memory --import-namespace=custom_env --secondary-memory-name=custom_name -all -S -o - | filecheck %s

;; Check that the output round trips and validates as well
;; RUN: wasm-split %s --instrument --in-secondary-memory -all -g -o %t.wasm
;; RUN: wasm-opt -all %t.wasm -S -o -

(module
  (import "env" "foo" (func $foo))
  (export "bar" (func $bar))
  (memory $0 1 1)
  (func $bar
    (call $foo)
  )
  (func $baz (param i32) (result i32)
    (local.get 0)
  )
)

;; Check that a memory import has been added for secondary memory
;; CHECK: (import "custom_env" "custom_name" (memory $custom_name 1 1 shared))

;; And the profiling function exported
;; CHECK: (export "__write_profile" (func $__write_profile))

;; And main memory has been exported
;; CHECK: (export "profile-memory" (memory $0))

;; Check that the function instrumentation uses the correct memory name
;; CHECK:  (i32.atomic.store8 $custom_name
;; CHECK:  (i32.atomic.store8 $custom_name offset=1
;; CHECK:  (i32.atomic.load8_u $custom_name