Skip to content

Commit 5de5a5c

Browse files
authored
Clarify invoke backedge invalidation. (#443)
1 parent 587e53e commit 5de5a5c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/jlgen.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,15 @@ function invalidate_code_cache(cache::CodeCache, replaced::MethodInstance, max_w
326326
# recurse to all backedges to update their valid range also
327327
if isdefined(replaced, :backedges)
328328
backedges = filter(replaced.backedges) do @nospecialize(mi)
329-
mi isa MethodInstance || return false # might be `Type` object representing an `invoke` signature
330-
return mi seen
329+
if mi isa MethodInstance
330+
mi seen
331+
elseif mi isa Type
332+
# an `invoke` call, which is a `(sig, MethodInstance)` pair.
333+
# let's ignore the `sig` and process the `MethodInstance` next.
334+
false
335+
else
336+
error("invalid backedge")
337+
end
331338
end
332339

333340
# Don't touch/empty backedges `invalidate_method_instance` in C will do that later

0 commit comments

Comments
 (0)