Skip to content

Commit 0b467da

Browse files
authored
Fix invalidation in eval_rex (#729)
This invalidation was triggered by convert(::Type{T}, i::LoopVectorization.UpperBoundedInteger) where T<:Number It turns out `eval_rex` had a `Core.Box` and various issues stemming from too many small Unions for inference to succeed. Some of the later calls imply that the type must be specific (there are no methods that can handle the alternative type). By type-asserting that type early we avoid the inference failures.
1 parent f5f8c6f commit 0b467da

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/packagedef.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ function delete_missing!(mod_exs_sigs_old::ModuleExprsSigs, mod_exs_sigs_new)
311311
end
312312

313313
function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mode::Symbol=:eval)
314-
sigs, includes = nothing, nothing
315-
with_logger(_debug_logger) do
314+
return with_logger(_debug_logger) do
315+
sigs, includes = nothing, nothing
316316
rexo = getkey(exs_sigs_old, rex, nothing)
317317
# extract the signatures and update the line info
318318
if rexo === nothing
@@ -338,9 +338,10 @@ function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mo
338338
# Update location info
339339
ln, lno = firstline(unwrap(rex)), firstline(unwrap(rexo))
340340
if sigs !== nothing && !isempty(sigs) && ln != lno
341+
ln, lno = ln::LineNumberNode, lno::LineNumberNode
341342
@debug "LineOffset" _group="Action" time=time() deltainfo=(sigs, lno=>ln)
342343
for sig in sigs
343-
locdefs = CodeTracking.method_info[sig]
344+
locdefs = CodeTracking.method_info[sig]::AbstractVector
344345
ld = map(pr->linediff(lno, pr[1]), locdefs)
345346
idx = argmin(ld)
346347
if ld[idx] === typemax(eltype(ld))
@@ -352,8 +353,8 @@ function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mo
352353
end
353354
end
354355
end
356+
return sigs, includes
355357
end
356-
return sigs, includes
357358
end
358359

359360
# These are typically bypassed in favor of expression-by-expression evaluation to

0 commit comments

Comments
 (0)