File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1107,6 +1107,12 @@ class EffectAnalyzer {
1107
1107
void visitContBind (ContBind* curr) {
1108
1108
// traps when curr->cont is null ref.
1109
1109
parent.implicitTrap = true ;
1110
+
1111
+ // The input continuation is modified, as it will trap if resumed. This is
1112
+ // a globally-noticeable effect, which we model as a call for now, but we
1113
+ // could in theory use something more refined here (|modifiesContinuation|
1114
+ // perhaps, to parallel |writesMemory| etc.).
1115
+ parent.calls = true ;
1110
1116
}
1111
1117
void visitSuspend (Suspend* curr) {
1112
1118
// Similar to resume/call: Suspending means that we execute arbitrary
Original file line number Diff line number Diff line change 9
9
;; CHECK: (type $cont (cont $func))
10
10
(type $cont (cont $func ))
11
11
12
+ ;; CHECK: (type $func-i32 (func (param i32)))
13
+ (type $func-i32 (func (param i32 )))
14
+ ;; CHECK: (type $cont-i32 (cont $func-i32))
15
+ (type $cont-i32 (cont $func-i32 ))
16
+
17
+ ;; CHECK: (type $4 (func (param (ref $cont-i32))))
18
+
12
19
;; CHECK: (elem declare func $cont.new)
13
20
14
21
;; CHECK: (func $cont.new (type $func)
36
43
)
37
44
)
38
45
)
46
+
47
+ ;; CHECK: (func $cont.bind (type $4) (param $cont-i32 (ref $cont-i32))
48
+ ;; CHECK-NEXT: (drop
49
+ ;; CHECK-NEXT: (cont.bind $cont-i32 $cont
50
+ ;; CHECK-NEXT: (i32.const 42)
51
+ ;; CHECK-NEXT: (local.get $cont-i32)
52
+ ;; CHECK-NEXT: )
53
+ ;; CHECK-NEXT: )
54
+ ;; CHECK-NEXT: (drop
55
+ ;; CHECK-NEXT: (cont.bind $cont-i32 $cont
56
+ ;; CHECK-NEXT: (i32.const 42)
57
+ ;; CHECK-NEXT: (local.get $cont-i32)
58
+ ;; CHECK-NEXT: )
59
+ ;; CHECK-NEXT: )
60
+ ;; CHECK-NEXT: )
61
+ (func $cont.bind (param $cont-i32 (ref $cont-i32 ))
62
+ ;; We cannot optimize here: Each of these has a side effect of modifying the
63
+ ;; continuation they were given, as it will trap if resumed, and in fact the
64
+ ;; second cont.bind here should trap, which we should not remove.
65
+ (drop
66
+ (cont.bind $cont-i32 $cont
67
+ (i32.const 42 )
68
+ (local.get $cont-i32 )
69
+ )
70
+ )
71
+ (drop
72
+ (cont.bind $cont-i32 $cont
73
+ (i32.const 42 )
74
+ (local.get $cont-i32 )
75
+ )
76
+ )
77
+ )
39
78
)
40
79
You can’t perform that action at this time.
0 commit comments