C#: Introduce inherited CFG completions#1486
Conversation
15f7b6b to
292e5dc
Compare
When completions are inherited by elements inside `finally` blocks, we previously
threw away the underlying completion. For example, in
```
try
{
if (b)
throw new Exception();
}
finally
{
if (b)
...
}
```
the completions for `b` inside the `finally` block are `true` and `throw(Exception)`,
where the latter is inherited from the `try` block, with an underlying `false`
completion. Throwing away the `false` completion meant that we were unable to prune
the `false` edge (Boolean CFG splitting).
292e5dc to
f91e460
Compare
There was a problem hiding this comment.
As discussed offline, we agreed that NestedCompletion, Nested* , Nestable* would be slightly better, and also getInnerCompletion() and getOuterCompletion().
I wasn't sure about the need for the split the completion classes into -Inherited and -Direct (perhaps renamed to Nested- and NonNested-). I think it would be more maintainable to avoid the Nested- variants (and assume everything is NonNested-), and remember to use getInnerCompletion() where needed.
09a2ec1 to
421e75d
Compare
calumgrant
left a comment
There was a problem hiding this comment.
LGTM and happy to merge. A few very minor comments that could be fixed later/never if you prefer.
| @@ -668,165 +658,142 @@ abstract private class InheritableCompletion extends AbnormalCompletion { } | |||
| * `System.Console.WriteLine("M called")` inherits the throw completion | |||
There was a problem hiding this comment.
We should remove the word "inherits" and "underlying" and replace it with "has the outer" and "has the inner"
When completions are inherited by elements inside
finallyblocks, we previouslythrew away the underlying completion. For example, in
the completions for
binside thefinallyblock aretrueandthrow(Exception),where the latter is inherited from the
tryblock, with an underlyingfalsecompletion. Throwing away the
falsecompletion meant that we were unable to prunethe
falseedge (Boolean CFG splitting).Profiling report here (internal link).