@@ -2,23 +2,41 @@ export @snoopi
2
2
3
3
const __inf_timing__ = Tuple{Float64,Core. MethodInstance}[]
4
4
5
- function typeinf_ext_timed (linfo:: Core.MethodInstance , params:: Core.Compiler.Params )
6
- tstart = time ()
7
- ret = Core. Compiler. typeinf_ext (linfo, params)
8
- tstop = time ()
9
- push! (__inf_timing__, (tstop- tstart, linfo))
10
- return ret
11
- end
12
- function typeinf_ext_timed (linfo:: Core.MethodInstance , world:: UInt )
13
- tstart = time ()
14
- ret = Core. Compiler. typeinf_ext (linfo, world)
15
- tstop = time ()
16
- push! (__inf_timing__, (tstop- tstart, linfo))
17
- return ret
5
+ if isdefined (Core. Compiler, :Params )
6
+ function typeinf_ext_timed (linfo:: Core.MethodInstance , params:: Core.Compiler.Params )
7
+ tstart = time ()
8
+ ret = Core. Compiler. typeinf_ext (linfo, params)
9
+ tstop = time ()
10
+ push! (__inf_timing__, (tstop- tstart, linfo))
11
+ return ret
12
+ end
13
+ function typeinf_ext_timed (linfo:: Core.MethodInstance , world:: UInt )
14
+ tstart = time ()
15
+ ret = Core. Compiler. typeinf_ext (linfo, world)
16
+ tstop = time ()
17
+ push! (__inf_timing__, (tstop- tstart, linfo))
18
+ return ret
19
+ end
20
+ @noinline stop_timing () = ccall (:jl_set_typeinf_func , Cvoid, (Any,), Core. Compiler. typeinf_ext)
21
+ else
22
+ function typeinf_ext_timed (interp:: Core.Compiler.AbstractInterpreter , linfo:: Core.MethodInstance )
23
+ tstart = time ()
24
+ ret = Core. Compiler. typeinf_ext_toplevel (interp, linfo)
25
+ tstop = time ()
26
+ push! (__inf_timing__, (tstop- tstart, linfo))
27
+ return ret
28
+ end
29
+ function typeinf_ext_timed (linfo:: Core.MethodInstance , world:: UInt )
30
+ tstart = time ()
31
+ ret = Core. Compiler. typeinf_ext_toplevel (linfo, world)
32
+ tstop = time ()
33
+ push! (__inf_timing__, (tstop- tstart, linfo))
34
+ return ret
35
+ end
36
+ @noinline stop_timing () = ccall (:jl_set_typeinf_func , Cvoid, (Any,), Core. Compiler. typeinf_ext_toplevel)
18
37
end
19
38
20
39
@noinline start_timing () = ccall (:jl_set_typeinf_func , Cvoid, (Any,), typeinf_ext_timed)
21
- @noinline stop_timing () = ccall (:jl_set_typeinf_func , Cvoid, (Any,), Core. Compiler. typeinf_ext)
22
40
23
41
function sort_timed_inf (tmin)
24
42
data = __inf_timing__
@@ -68,8 +86,13 @@ function __init__()
68
86
# typeinf_ext_timed must be compiled before it gets run
69
87
# We do this in __init__ to make sure it gets compiled to native code
70
88
# (the *.ji file stores only the inferred code)
71
- precompile (typeinf_ext_timed, (Core. MethodInstance, Core. Compiler. Params))
72
- precompile (typeinf_ext_timed, (Core. MethodInstance, UInt))
89
+ if isdefined (Core. Compiler, :Params )
90
+ @assert precompile (typeinf_ext_timed, (Core. MethodInstance, Core. Compiler. Params))
91
+ @assert precompile (typeinf_ext_timed, (Core. MethodInstance, UInt))
92
+ else
93
+ @assert precompile (typeinf_ext_timed, (Core. Compiler. NativeInterpreter, Core. MethodInstance))
94
+ @assert precompile (typeinf_ext_timed, (Core. MethodInstance, UInt))
95
+ end
73
96
precompile (start_timing, ())
74
97
precompile (stop_timing, ())
75
98
nothing
0 commit comments