Skip to content

Commit 85cf5e6

Browse files
committed
inference: remove duplicated handling of sparam_vals
1 parent 8b103cf commit 85cf5e6

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

base/inference.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,16 @@ type InferenceState
7575
inferred::Bool
7676
tfunc_bp::Union{TypeMapEntry, Void}
7777

78-
function InferenceState(linfo::LambdaInfo, atypes::ANY, sparams::SimpleVector, optimize::Bool)
78+
function InferenceState(linfo::LambdaInfo, optimize::Bool)
7979
@assert isa(linfo.code,Array{Any,1})
8080
linfo.inInference = true
8181
nslots = length(linfo.slotnames)
8282
nl = label_counter(linfo.code)+1
8383

84-
if length(linfo.sparam_vals) > 0
85-
sp = linfo.sparam_vals
86-
elseif isempty(sparams) && !isempty(linfo.sparam_syms)
84+
if isempty(linfo.sparam_vals) && !isempty(linfo.sparam_syms)
8785
sp = svec(Any[ TypeVar(sym, Any, true) for sym in linfo.sparam_syms ]...)
8886
else
89-
sp = sparams
87+
sp = linfo.sparam_vals
9088
end
9189

9290
if !isa(linfo.slottypes, Array)
@@ -101,6 +99,7 @@ type InferenceState
10199
# initial types
102100
s[1] = Any[ VarState(Bottom,true) for i=1:nslots ]
103101

102+
atypes = linfo.specTypes
104103
la = linfo.nargs
105104
if la > 0
106105
if linfo.isva
@@ -1510,7 +1509,7 @@ function typeinf_edge(method::Method, atypes::ANY, sparams::SimpleVector, needtr
15101509
linfo = specialize_method(method, atypes, sparams)
15111510
end
15121511
# our stack frame inference context
1513-
frame = InferenceState(unshare_linfo!(linfo::LambdaInfo), atypes, sparams, optimize)
1512+
frame = InferenceState(unshare_linfo!(linfo::LambdaInfo), optimize)
15141513
if cached
15151514
frame.tfunc_bp = ccall(:jl_specializations_insert, Ref{TypeMapEntry}, (Any, Any, Any), method, atypes, linfo)
15161515
end
@@ -1554,7 +1553,7 @@ end
15541553
function typeinf_ext(linfo::LambdaInfo)
15551554
if isdefined(linfo, :def)
15561555
# method lambda - infer this specialization via the method cache
1557-
(code, _t, _) = typeinf_edge(linfo.def, linfo.specTypes, svec(), true, true, true, linfo)
1556+
(code, _t, _) = typeinf_edge(linfo.def, linfo.specTypes, linfo.sparam_vals, true, true, true, linfo)
15581557
if code.inferred
15591558
linfo.inferred = true
15601559
linfo.inInference = false
@@ -1570,7 +1569,7 @@ function typeinf_ext(linfo::LambdaInfo)
15701569
end
15711570
else
15721571
# toplevel lambda - infer directly
1573-
frame = InferenceState(linfo, linfo.specTypes, svec(), true)
1572+
frame = InferenceState(linfo, true)
15741573
typeinf_loop(frame)
15751574
@assert frame.inferred # TODO: deal with this better
15761575
end

0 commit comments

Comments
 (0)