Skip to content

Commit 9c48b94

Browse files
committed
Compiler: abstract calls: type assert to help stability
It seems `la` is getting inferred as `Integer` instead of as `Int` for some reason. This reduces the number of invalidations from 2061 to 2046 on running this code: ```julia struct I <: Integer end Base.Int64(::I) = 7 ```
1 parent 502612e commit 9c48b94

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Compiler/src/abstractinterpretation.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ end
19561956
function abstract_call_builtin(interp::AbstractInterpreter, f::Builtin, (; fargs, argtypes)::ArgInfo,
19571957
sv::AbsIntState)
19581958
@nospecialize f
1959-
la = length(argtypes)
1959+
la = length(argtypes)::Int
19601960
𝕃ᵢ = typeinf_lattice(interp)
19611961
, , , = partialorder(𝕃ᵢ), strictpartialorder(𝕃ᵢ), join(𝕃ᵢ), meet(𝕃ᵢ)
19621962
if has_conditional(𝕃ᵢ, sv) && f === Core.ifelse && fargs isa Vector{Any} && la == 4
@@ -2622,7 +2622,7 @@ function abstract_call_known(interp::AbstractInterpreter, @nospecialize(f),
26222622
arginfo::ArgInfo, si::StmtInfo, sv::AbsIntState,
26232623
max_methods::Int = get_max_methods(interp, f, sv))
26242624
(; fargs, argtypes) = arginfo
2625-
la = length(argtypes)
2625+
la = length(argtypes)::Int
26262626
𝕃ᵢ = typeinf_lattice(interp)
26272627
if isa(f, Builtin)
26282628
if f === _apply_iterate

0 commit comments

Comments
 (0)