diff options
author | Alon Zakai <azakai@google.com> | 2023-03-16 16:17:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 16:17:22 -0700 |
commit | ecbebfbee12f2f25af648119604915fc37427f6f (patch) | |
tree | 98cadb5c6b9a4fb7bd2cccc3c23e69967b18b14a /test | |
parent | 121d1572f9a3b7a59c52deda0fedd9dd4a950aa9 (diff) | |
download | binaryen-ecbebfbee12f2f25af648119604915fc37427f6f.tar.gz binaryen-ecbebfbee12f2f25af648119604915fc37427f6f.tar.bz2 binaryen-ecbebfbee12f2f25af648119604915fc37427f6f.zip |
[Wasm GC] wasm-ctor-eval: Handle externalized data (#5582)
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/ctor-eval/extern.wast | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test/lit/ctor-eval/extern.wast b/test/lit/ctor-eval/extern.wast new file mode 100644 index 000000000..1bd738380 --- /dev/null +++ b/test/lit/ctor-eval/extern.wast @@ -0,0 +1,59 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; RUN: wasm-ctor-eval %s --ctors=test1,test2 --kept-exports=test1,test2 --quiet -all -S -o - | filecheck %s + +(module + ;; CHECK: (type $array (array (mut i8))) + (type $array (array (mut i8))) + + ;; CHECK: (type $none_=>_externref (func (result externref))) + + ;; CHECK: (global $ctor-eval$global (ref $array) (array.new_fixed $array + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: )) + + ;; CHECK: (export "test1" (func $test1_0)) + (export "test1" (func $test1)) + ;; CHECK: (export "test2" (func $test2_0)) + (export "test2" (func $test2)) + + (func $test1 (result externref) + ;; This will remain almost the same, even though we eval it, since the + ;; serialization of an externalized i31 is what is written here. But the add + ;; will be evalled out. + (extern.externalize + (i31.new + (i32.add + (i32.const 41) + (i32.const 1) + ) + ) + ) + ) + + (func $test2 (result externref) + ;; This will be evalled into an externalization of a global.get. + (extern.externalize + (array.new_fixed $array + (i32.const 1) + (i32.const 2) + (i32.const 3) + ) + ) + ) +) + +;; CHECK: (func $test1_0 (type $none_=>_externref) (result externref) +;; CHECK-NEXT: (extern.externalize +;; CHECK-NEXT: (i31.new +;; CHECK-NEXT: (i32.const 42) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) + +;; CHECK: (func $test2_0 (type $none_=>_externref) (result externref) +;; CHECK-NEXT: (extern.externalize +;; CHECK-NEXT: (global.get $ctor-eval$global) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) |