Skip to content

Commit

Permalink
Thread lattice through tuple_tail_elem (#49643)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno authored May 5, 2023
1 parent f4d9416 commit b8c347a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ function abstract_apply(interp::AbstractInterpreter, argtypes::Vector{Any}, si::
# This is vararg, we're not gonna be able to do any inlining,
# drop the info
info = nothing
tail = tuple_tail_elem(unwrapva(ct[end]), cti)
tail = tuple_tail_elem(typeinf_lattice(interp), unwrapva(ct[end]), cti)
push!(ctypes´, push!(ct[1:(end - 1)], tail))
else
push!(ctypes´, append!(ct[:], cti))
Expand All @@ -1562,7 +1562,7 @@ function abstract_apply(interp::AbstractInterpreter, argtypes::Vector{Any}, si::
for i = 1:lct-1
cti = ct[i]
if isvarargtype(cti)
ct[i] = tuple_tail_elem(unwrapva(cti), ct[(i+1):lct])
ct[i] = tuple_tail_elem(typeinf_lattice(interp), unwrapva(cti), ct[(i+1):lct])
resize!(ct, i)
break
end
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/typelimits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function _limit_type_size(@nospecialize(t), @nospecialize(c), sources::SimpleVec
Q = Any[ tP[i] for i in 1:np ]
if ltP > np
# combine tp[np:end] into tP[np] using Vararg
Q[np] = tuple_tail_elem(Bottom, Any[ tP[i] for i in np:ltP ])
Q[np] = tuple_tail_elem(fallback_lattice, Bottom, Any[ tP[i] for i in np:ltP ])
end
for i = 1:np
# now apply limit element-wise to Q
Expand Down
4 changes: 2 additions & 2 deletions base/compiler/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ end
_typename(union::UnionAll) = _typename(union.body)
_typename(a::DataType) = Const(a.name)

function tuple_tail_elem(@nospecialize(init), ct::Vector{Any})
function tuple_tail_elem(𝕃::AbstractLattice, @nospecialize(init), ct::Vector{Any})
t = init
for x in ct
# FIXME: this is broken: it violates subtyping relations and creates invalid types with free typevars
t = tmerge(t, unwraptv(unwrapva(x)))
t = tmerge(𝕃, t, unwraptv(unwrapva(x)))
end
return Vararg{widenconst(t)}
end
Expand Down

0 comments on commit b8c347a

Please sign in to comment.