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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
;; =====================
;; Instrument the binary
;; =====================
;; RUN: wasm-split -all --instrument %s -o %t.instrumented.wasm
;; Create profiles
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.foo.prof foo
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.bar.prof bar
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.both.prof foo bar
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.none.prof
;; Create profile-guided splits
;; RUN: wasm-split -all %s --profile=%t.foo.prof -v -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm \
;; RUN: | filecheck %s --check-prefix FOO
;; RUN: wasm-split -all %s --profile=%t.bar.prof -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \
;; RUN: | filecheck %s --check-prefix BAR
;; RUN: wasm-split -all %s --profile=%t.both.prof -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm \
;; RUN: | filecheck %s --check-prefix BOTH
;; RUN: wasm-split -all %s --profile=%t.none.prof -v -o1 %t.none.1.wasm -o2 %t.none.2.wasm \
;; RUN: | filecheck %s --check-prefix NONE
;; RUN: wasm-split -all %s --profile=%t.bar.prof --keep-funcs=uncalled -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \
;; RUN: | filecheck %s --check-prefix PROFILE_KEEP
;; RUN: wasm-split -all %s --profile=%t.both.prof --split-funcs=shared_callee -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm 2>&1 \
;; RUN: | filecheck %s --check-prefix PROFILE_SPLIT
;; =================================
;; Do it all again using --in-memory
;; =================================
;; RUN: wasm-split -all --instrument --in-memory %s -o %t.instrumented.wasm
;; Create profiles
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.foo.prof foo
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.bar.prof bar
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.both.prof foo bar
;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.none.prof
;; Create profile-guided splits
;; RUN: wasm-split -all %s --profile=%t.foo.prof -v -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm \
;; RUN: | filecheck %s --check-prefix FOO
;; RUN: wasm-split -all %s --profile=%t.bar.prof -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \
;; RUN: | filecheck %s --check-prefix BAR
;; RUN: wasm-split -all %s --profile=%t.both.prof -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm \
;; RUN: | filecheck %s --check-prefix BOTH
;; RUN: wasm-split -all %s --profile=%t.none.prof -v -o1 %t.none.1.wasm -o2 %t.none.2.wasm \
;; RUN: | filecheck %s --check-prefix NONE
;; RUN: wasm-split -all %s --profile=%t.bar.prof --keep-funcs=uncalled -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \
;; RUN: | filecheck %s --check-prefix PROFILE_KEEP
;; RUN: wasm-split -all %s --profile=%t.both.prof --split-funcs=shared_callee -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm 2>&1 \
;; RUN: | filecheck %s --check-prefix PROFILE_SPLIT
;; =======
;; Results
;; =======
;; FOO: Keeping functions: deep_foo_callee, foo, foo_callee, shared_callee
;; FOO: Splitting out functions: bar, bar_callee, uncalled
;; BAR: Keeping functions: bar, bar_callee, shared_callee
;; BAR: Splitting out functions: deep_foo_callee, foo, foo_callee, uncalled
;; BOTH: Keeping functions: bar, bar_callee, deep_foo_callee, foo, foo_callee, shared_callee
;; BOTH: Splitting out functions: uncalled
;; NONE: Keeping functions:
;; NONE: Splitting out functions: bar, bar_callee, deep_foo_callee, foo, foo_callee, shared_callee, uncalled
;; PROFILE_KEEP: Keeping functions: bar, bar_callee, shared_callee, uncalled
;; PROFILE_KEEP: Splitting out functions: deep_foo_callee, foo, foo_callee
;; PROFILE_SPLIT: Keeping functions: bar, bar_callee, deep_foo_callee, foo, foo_callee
;; PROFILE_SPLIT: Splitting out functions: shared_callee, uncalled
(module
(memory $mem 1 1 shared)
(export "memory" (memory $mem))
(export "foo" (func $foo))
(export "bar" (func $bar))
(export "uncalled" (func $uncalled))
(func $foo
(call $foo_callee)
(call $shared_callee)
)
(func $bar
(call $shared_callee)
(call $bar_callee)
)
(func $uncalled)
(func $foo_callee
(call $deep_foo_callee)
)
(func $bar_callee)
(func $shared_callee)
(func $deep_foo_callee)
)
|