blob: 2607e13c945cd93a5d2d62cbc4a815136e22c43c (
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
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
|
;; 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,test3 --kept-exports=test1,test2,test3 --quiet -all -S -o - | filecheck %s
(module
;; CHECK: (type $array (array (mut i8)))
(type $array (array (mut i8)))
;; CHECK: (type $struct (struct (field externref)))
(type $struct (struct (field externref)))
;; CHECK: (type $none_=>_externref (func (result externref)))
;; CHECK: (type $none_=>_anyref (func (result anyref)))
;; CHECK: (global $ctor-eval$global (ref $array) (array.new_fixed $array 3
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: (i32.const 2)
;; CHECK-NEXT: (i32.const 3)
;; CHECK-NEXT: ))
;; CHECK: (global $ctor-eval$global_1 (ref $struct) (struct.new $struct
;; CHECK-NEXT: (extern.externalize
;; CHECK-NEXT: (i31.new
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
;; CHECK: (export "test1" (func $test1_3))
(export "test1" (func $test1))
;; CHECK: (export "test2" (func $test2_4))
(export "test2" (func $test2))
;; CHECK: (export "test3" (func $test3_5))
(export "test3" (func $test3))
(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 3
(i32.const 1)
(i32.const 2)
(i32.const 3)
)
)
)
(func $test3 (result anyref)
;; This will add a global that contains an externalization operation.
(struct.new $struct
(extern.externalize
(i31.new
(i32.const 1)
)
)
)
)
)
;; CHECK: (func $test1_3 (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_4 (type $none_=>_externref) (result externref)
;; CHECK-NEXT: (extern.externalize
;; CHECK-NEXT: (global.get $ctor-eval$global)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK: (func $test3_5 (type $none_=>_anyref) (result anyref)
;; CHECK-NEXT: (global.get $ctor-eval$global_1)
;; CHECK-NEXT: )
|