comparison src/effectize.sml @ 1438:b6df00ed536c

Fix soundness bug in Effectize, which lead to missing effects in event handlers
author Adam Chlipala <adam@chlipala.net>
date Fri, 18 Mar 2011 09:46:24 -0400
parents 66092ce45a76
children e15234fbb163
comparison
equal deleted inserted replaced
1437:493e087f5479 1438:b6df00ed536c
95 95
96 fun doDecl (d, evs as (writers, readers, pushers)) = 96 fun doDecl (d, evs as (writers, readers, pushers)) =
97 case #1 d of 97 case #1 d of
98 DVal (x, n, t, e, s) => 98 DVal (x, n, t, e, s) =>
99 let 99 let
100 val e = dejs e 100 val e' = dejs e
101 in 101 in
102 (d, (if couldWrite writers e then 102 (d, (if couldWrite writers e' then
103 IM.insert (writers, n, (#2 d, s)) 103 IM.insert (writers, n, (#2 d, s))
104 else 104 else
105 writers, 105 writers,
106 if couldReadCookie readers e then 106 if couldReadCookie readers e' then
107 IM.insert (readers, n, (#2 d, s)) 107 IM.insert (readers, n, (#2 d, s))
108 else 108 else
109 readers, 109 readers,
110 if couldWriteWithRpc writers readers pushers e then 110 if couldWriteWithRpc writers readers pushers e then
111 IM.insert (pushers, n, (#2 d, s)) 111 IM.insert (pushers, n, (#2 d, s))
115 | DValRec vis => 115 | DValRec vis =>
116 let 116 let
117 fun oneRound evs = 117 fun oneRound evs =
118 foldl (fn ((_, n, _, e, s), (changed, (writers, readers, pushers))) => 118 foldl (fn ((_, n, _, e, s), (changed, (writers, readers, pushers))) =>
119 let 119 let
120 val e = dejs e 120 val e' = dejs e
121 121
122 val (changed, writers) = 122 val (changed, writers) =
123 if couldWrite writers e andalso not (IM.inDomain (writers, n)) then 123 if couldWrite writers e' andalso not (IM.inDomain (writers, n)) then
124 (true, IM.insert (writers, n, (#2 d, s))) 124 (true, IM.insert (writers, n, (#2 d, s)))
125 else 125 else
126 (changed, writers) 126 (changed, writers)
127 127
128 val (changed, readers) = 128 val (changed, readers) =
129 if couldReadCookie readers e andalso not (IM.inDomain (readers, n)) then 129 if couldReadCookie readers e' andalso not (IM.inDomain (readers, n)) then
130 (true, IM.insert (readers, n, (#2 d, s))) 130 (true, IM.insert (readers, n, (#2 d, s)))
131 else 131 else
132 (changed, readers) 132 (changed, readers)
133 133
134 val (changed, pushers) = 134 val (changed, pushers) =