1
1
const max_methods = 4 # maximum number of MethodInstances tracked for a particular :call statement
2
2
3
+ struct FrameInstance
4
+ framecode:: JuliaFrameCode
5
+ sparam_vals:: SimpleVector
6
+ end
7
+
3
8
"""
4
9
framecode, lenv = get_call_framecode(fargs, parentframe::JuliaFrameCode, idx::Int)
5
10
@@ -34,9 +39,8 @@ function get_call_framecode(fargs, parentframe::JuliaFrameCode, idx::Int)
34
39
tmeprev. next = tme. next
35
40
tme. next = tme1
36
41
end
37
- # The framecode is stashed in the `inferred` field of the MethodInstance
38
- mi = tme. func:: MethodInstance
39
- return mi. inferred:: JuliaFrameCode , mi. sparam_vals
42
+ mi = tme. func:: FrameInstance
43
+ return mi. framecode, mi. sparam_vals
40
44
end
41
45
end
42
46
depth += 1
@@ -53,17 +57,17 @@ function get_call_framecode(fargs, parentframe::JuliaFrameCode, idx::Int)
53
57
isa (ret, Compiled) && return ret, nothing
54
58
framecode, args, env, argtypes = ret
55
59
# Store the results of the method lookup in the local method table
60
+ mi = FrameInstance (framecode, env)
61
+ # it's sort of odd to call this a TypeMapEntry, then set most of the fields incorrectly
62
+ # but since we're just using it as a linked list, it's probably ok
56
63
tme = ccall (:jl_new_struct_uninit , Any, (Any,), TypeMapEntry):: TypeMapEntry
57
- tme. func = mi = ccall (:jl_new_struct_uninit , Any, (Any,), MethodInstance):: MethodInstance
58
- tme. sig = mi. specTypes = argtypes
64
+ tme. func = mi
65
+ tme. simplesig = nothing
66
+ tme. sig = argtypes
59
67
tme. isleafsig = true
60
68
tme. issimplesig = false
61
69
method = framecode. scope:: Method
62
70
tme. va = method. isva
63
- mi. def = method
64
- mi. rettype = Any
65
- mi. sparam_vals = env
66
- mi. inferred = framecode # a slight abuse, but not insane
67
71
if isassigned (parentframe. methodtables, idx)
68
72
tme. next = parentframe. methodtables[idx]
69
73
# Drop the oldest tme, if necessary
0 commit comments