Skip to content

Commit 957625b

Browse files
KristofferCtimholy
authored andcommitted
move sparams initialization into framedata creation (#311)
1 parent 0c1189b commit 957625b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/construct.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function prepare_call(@nospecialize(f), allargs; enter_generated = false)
257257
return framecode, args, lenv, argtypes
258258
end
259259

260-
function prepare_framedata(framecode, argvals::Vector{Any}, caller_will_catch_err::Bool=false)
260+
function prepare_framedata(framecode, argvals::Vector{Any}, lenv::SimpleVector=empty_svec, caller_will_catch_err::Bool=false)
261261
if isa(framecode.scope, Method)
262262
meth, src = framecode.scope::Method, framecode.src
263263
slotnames = src.slotnames::SlotNamesType
@@ -309,6 +309,13 @@ function prepare_framedata(framecode, argvals::Vector{Any}, caller_will_catch_er
309309
callargs = Any[]
310310
last_exception = Ref{Any}(nothing)
311311
end
312+
resize!(sparams, length(lenv))
313+
# Add static parameters to environment
314+
for i = 1:length(lenv)
315+
T = lenv[i]
316+
isa(T, TypeVar) && continue # only fill concrete types
317+
sparams[i] = T
318+
end
312319
FrameData(locals, ssavalues, sparams, exception_frames, last_exception, caller_will_catch_err, last_reference, callargs)
313320
end
314321

@@ -319,14 +326,7 @@ Construct a new `Frame` for `framecode`, given lowered-code arguments `frameargs
319326
static parameters `lenv`. See [`JuliaInterpreter.prepare_call`](@ref) for information about how to prepare the inputs.
320327
"""
321328
function prepare_frame(framecode::FrameCode, args::Vector{Any}, lenv::SimpleVector, caller_will_catch_err::Bool=false)
322-
framedata = prepare_framedata(framecode, args, caller_will_catch_err)
323-
resize!(framedata.sparams, length(lenv))
324-
# Add static parameters to environment
325-
for i = 1:length(lenv)
326-
T = lenv[i]
327-
isa(T, TypeVar) && continue # only fill concrete types
328-
framedata.sparams[i] = T
329-
end
329+
framedata = prepare_framedata(framecode, args, lenv, caller_will_catch_err)
330330
return Frame(framecode, framedata)
331331
end
332332

src/precompile.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function _precompile_()
2424
@assert precompile(Tuple{typeof(split_expressions!), Vector{Tuple{Module,Expr}}, Dict{Module,Vector{Expr}}, Expr, Module, Expr})
2525
@assert precompile(Tuple{typeof(prepare_thunk), Module, Expr})
2626
@assert precompile(Tuple{typeof(prepare_thunk), Module, Expr, Bool})
27-
@assert precompile(Tuple{typeof(prepare_framedata), FrameCode, Vector{Any}})
27+
@assert precompile(Tuple{typeof(prepare_framedata), FrameCode, Vector{Any}, SimpleVector, Bool})
2828
@assert precompile(Tuple{typeof(prepare_args), Any, Vector{Any}, Vector{Any}})
2929
@assert precompile(Tuple{typeof(prepare_call), Any, Vector{Any}})
3030
@assert precompile(Tuple{typeof(Core.kwfunc(prepare_call)), NamedTuple{(:enter_generated,),Tuple{Bool}}, typeof(prepare_call), Function, Vector{Any}})

0 commit comments

Comments
 (0)