Skip to content

Commit b4affd2

Browse files
committed
improve comments
1 parent bab249a commit b4affd2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/ir/effects.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class EffectAnalyzer {
6666
// Walk an entire function body. This will ignore effects that are not
6767
// noticeable from the perspective of the caller, that is, effects that are
6868
// only noticeable during the call, but "vanish" when the call stack is
69-
// unwound.
69+
// unwound. Unlike walking just the body, walking the function will also
70+
// include the effects of any return calls the function makes.
7071
void walk(Function* func) {
7172
walk(func->body);
7273

@@ -148,11 +149,13 @@ class EffectAnalyzer {
148149
// or a continuation that is never continued, are examples of that.
149150
bool mayNotReturn = false;
150151

151-
// Return calls are indistinguishable from normal returns from the perspective
152-
// of their surrounding code, and the return-callee's effects only become
153-
// visible when considering the effects of the whole function containing the
154-
// return call. To model this correctly, stash the callee's effects on the
155-
// side and only merge them in after walking a full function body.
152+
// Since return calls return out of the body of the function before performing
153+
// their call, they are indistinguishable from normal returns from the
154+
// perspective of their surrounding code, and the return-callee's effects only
155+
// become visible when considering the effects of the whole function
156+
// containing the return call. To model this correctly, stash the callee's
157+
// effects on the side and only merge them in after walking a full function
158+
// body.
156159
//
157160
// We currently do this stashing only for the throw effect, but in principle
158161
// we could do it for all effects if it made a difference.

0 commit comments

Comments
 (0)