@@ -20,8 +20,12 @@ function get_call_framecode(fargs::Vector{Any}, parentframe::FrameCode, idx::Int
2020 sig = d_meth. sig. parameters:: SimpleVector
2121 if length (sig) == nargs
2222 # If this is generated, match only if `enter_generated` also matches
23- fi = d_meth. frameinstance:: FrameInstance
24- matches = ! is_generated (scopeof (fi. framecode)) || enter_generated == fi. enter_generated
23+ fi = d_meth. frameinstance
24+ if fi isa FrameInstance
25+ matches = ! is_generated (scopeof (fi. framecode)) || enter_generated == fi. enter_generated
26+ else
27+ matches = ! enter_generated
28+ end
2529 if matches
2630 for i = 1 : nargs
2731 if ! isa (fargs[i], sig[i])
@@ -38,7 +42,11 @@ function get_call_framecode(fargs::Vector{Any}, parentframe::FrameCode, idx::Int
3842 d_methprev. next = d_meth. next
3943 d_meth. next = d_meth1
4044 end
41- return fi. framecode, fi. sparam_vals
45+ if fi isa Compiled
46+ return Compiled (), nothing
47+ else
48+ return fi. framecode, fi. sparam_vals
49+ end
4250 end
4351 end
4452 depth += 1
@@ -52,11 +60,16 @@ function get_call_framecode(fargs::Vector{Any}, parentframe::FrameCode, idx::Int
5260 fargs[1 ] = f = to_function (fargs[1 ])
5361 ret = prepare_call (f, fargs; enter_generated= enter_generated)
5462 ret === nothing && return f (fargs[2 : end ]. .. ), nothing
55- isa (ret, Compiled) && return ret, nothing
56- framecode, args, env, argtypes = ret
57- # Store the results of the method lookup in the local method table
58- fi = FrameInstance (framecode, env, is_generated (scopeof (framecode)) && enter_generated)
59- d_meth = DispatchableMethod (nothing , fi, argtypes)
63+ is_compiled = isa (ret[1 ], Compiled)
64+ local framecode
65+ if is_compiled
66+ d_meth = DispatchableMethod (nothing , Compiled (), ret[2 ])
67+ else
68+ framecode, args, env, argtypes = ret
69+ # Store the results of the method lookup in the local method table
70+ fi = FrameInstance (framecode, env, is_generated (scopeof (framecode)) && enter_generated)
71+ d_meth = DispatchableMethod (nothing , fi, argtypes)
72+ end
6073 if isassigned (parentframe. methodtables, idx)
6174 d_meth. next = parentframe. methodtables[idx]
6275 # Drop the oldest d_meth, if necessary
@@ -74,5 +87,9 @@ function get_call_framecode(fargs::Vector{Any}, parentframe::FrameCode, idx::Int
7487 d_meth. next = nothing
7588 end
7689 parentframe. methodtables[idx] = d_meth
77- return framecode, env
90+ if is_compiled
91+ return Compiled (), nothing
92+ else
93+ return framecode, env
94+ end
7895end
0 commit comments