Skip to content

Commit

Permalink
fix incorrect static parameter munging as part of inlineable (JuliaLa…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels authored and JeffBezanson committed Aug 16, 2017
1 parent 67f3fc0 commit b36fc63
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3757,7 +3757,9 @@ function substitute!(@nospecialize(e), na::Int, argexprs::Vector{Any}, @nospecia
e = e::Expr
head = e.head
if head === :static_parameter
return spvals[e.args[1]]
sp = spvals[e.args[1]]
is_self_quoting(sp) && return sp
return QuoteNode(sp)
elseif head === :foreigncall
@assert !isa(spsig,UnionAll) || !isempty(spvals)
for i = 1:length(e.args)
Expand Down Expand Up @@ -4459,17 +4461,6 @@ function inlineable(@nospecialize(f), @nospecialize(ft), e::Expr, atypes::Vector
add_backedge!(linfo, sv)
end

spvals = Any[]
for i = 1:length(methsp)
push!(spvals, methsp[i])
end
for i = 1:length(spvals)
si = spvals[i]
if isa(si, Symbol) || isa(si, SSAValue) || isa(si, Slot)
spvals[i] = QuoteNode(si)
end
end

nm = length(unwrap_unionall(metharg).parameters)

body = Expr(:block)
Expand Down Expand Up @@ -4535,7 +4526,7 @@ function inlineable(@nospecialize(f), @nospecialize(ft), e::Expr, atypes::Vector
end

# ok, substitute argument expressions for argument names in the body
body = substitute!(body, na, argexprs, method.sig, spvals, length(sv.src.slotnames) - na)
body = substitute!(body, na, argexprs, method.sig, Any[methsp...], length(sv.src.slotnames) - na)
append!(sv.src.slotnames, src.slotnames[(na + 1):end])
append!(sv.src.slottypes, src.slottypes[(na + 1):end])
append!(sv.src.slotflags, src.slotflags[(na + 1):end])
Expand Down

0 comments on commit b36fc63

Please sign in to comment.