-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ssa conversion for catch blocks #117
Conversation
the slotused function was not enough to account for all slot used by the catch block and its successors. With this change, ssa conversion keeps a live list of all catch 'branch' instructions and fetches the reaching definitions for slots at the location of these :catch instructions.
ecc14b8
to
4651208
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #117 +/- ##
==========================================
+ Coverage 73.29% 73.61% +0.31%
==========================================
Files 16 16
Lines 1494 1512 +18
==========================================
+ Hits 1095 1113 +18
Misses 399 399 ☔ View full report in Codecov by Sentry. |
|
||
ir = @code_ir f_try_catch4(42, false) | ||
fir = func(ir) | ||
# This should be @test_throws UndefVarError fir(nothing,42,false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test_throws UndefVarError ... broken=true
for this? (and the one above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. It looks like @test_throws
does not support broken=true
yet so I had added @test try ... end broken=true
instead.
function reaching(b, slot) | ||
haskey(defs[b.id], slot) && return defs[b.id][slot] | ||
b.id == 1 && return undef | ||
x = defs[b.id][v] = argument!(b, type = v.type, insert = false) | ||
x = defs[b.id][slot] = argument!(b, type = slot.type, insert = false) | ||
for pred in predecessors(b) | ||
if pred.id < current | ||
for br in branches(pred, b) | ||
push!(br.args, reaching(pred, v)) | ||
push!(br.args, reaching(pred, slot)) | ||
end | ||
else | ||
push!(get!(todo[pred.id], b.id, Slot[]), v) | ||
push!(get!(todo[pred.id], b.id, Slot[]), slot) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is purely just a clarification of the existing code, right? to rename v
to slot
(A good clarification)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! In other parts of the package, v
often refers to a Variable
(SSA value) so I renamed to clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense.
Add the test_broken
and this should be good to merge
the slotused function was not enough to account for all slot used by the catch block and its successors. With this change, ssa conversion keeps a live list of all catch 'branch' instructions and fetches the reaching definitions for slots at the location of these :catch instructions.
See as an example the added test where the ir is: