Skip to content

Commit ff527a1

Browse files
authored
Be more careful about iterator invalidation during recursive invalida… (JuliaLang#57934)
…tion It is possible for one MethodInstance to have a backedge to itself (`typejoin` is a prime example). This didn't used to be much of a problem prior to JuliaLang#57625 because we would just delete the backedges list at the top of invalidation. However, now that we're more selective, we need to be careful not to move backedges around while a frame higher on the stack may be looking at it. To this end, move the compaction part of the deletion into a separate pass and only delete (but don't move around) backedges while a frame higher on the stack may be looking at it. Fixes JuliaLang#57696
1 parent 6e9b1a8 commit ff527a1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/invalidation.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,8 @@ begin take!(GLOBAL_BUFFER)
283283
@test isnothing(pr48932_caller_inlined(42))
284284
@test "42" == String(take!(GLOBAL_BUFFER))
285285
end
286+
287+
# Issue #57696
288+
# This test checks for invalidation of recursive backedges. However, unfortunately, the original failure
289+
# manifestation was an unreliable segfault or an assertion failure, so we don't have a more compact test.
290+
@test success(`$(Base.julia_cmd()) -e 'Base.typejoin(x, ::Type) = 0; exit()'`)

0 commit comments

Comments
 (0)