1
- using Core . Compiler : AbstractInterpreter, CodeInstance, MethodInstance, WorldView, NativeInterpreter
1
+ using . CC : AbstractInterpreter, CodeInstance, MethodInstance, WorldView, NativeInterpreter
2
2
using InteractiveUtils
3
3
4
4
function infer_function (interp, tt)
@@ -13,23 +13,23 @@ function infer_function(interp, tt)
13
13
mtypes, msp, m = mthds[1 ]
14
14
15
15
# Grab the appropriate method instance for these types
16
- mi = Core . Compiler . specialize_method (m, mtypes, msp)
16
+ mi = CC . specialize_method (m, mtypes, msp)
17
17
18
18
# Construct InferenceResult to hold the result,
19
- result = Core . Compiler . InferenceResult (mi)
19
+ result = CC . InferenceResult (mi)
20
20
21
21
# Create an InferenceState to begin inference, give it a world that is always newest
22
- frame = Core . Compiler . InferenceState (result, #= cached=# true , interp)
22
+ frame = CC . InferenceState (result, #= cached=# true , interp)
23
23
24
24
# Run type inference on this frame. Because the interpreter is embedded
25
25
# within this InferenceResult, we don't need to pass the interpreter in.
26
- Core . Compiler . typeinf (interp, frame)
26
+ CC . typeinf (interp, frame)
27
27
28
28
# Give the result back
29
29
return (mi, result)
30
30
end
31
31
32
- struct ExtractingInterpreter <: Core.Compiler .AbstractInterpreter
32
+ struct ExtractingInterpreter <: CC .AbstractInterpreter
33
33
code:: Dict{MethodInstance, CodeInstance}
34
34
native_interpreter:: NativeInterpreter
35
35
msgs:: Vector{Tuple{MethodInstance, Int, String}}
@@ -43,7 +43,7 @@ ExtractingInterpreter(;optimize=false) = ExtractingInterpreter(
43
43
optimize
44
44
)
45
45
46
- import Core . Compiler : InferenceParams, OptimizationParams, #= get_inference_world,=#
46
+ import . CC : InferenceParams, OptimizationParams, #= get_inference_world,=#
47
47
get_inference_cache, code_cache,
48
48
WorldView, lock_mi_inference, unlock_mi_inference, InferenceState
49
49
InferenceParams (ei:: ExtractingInterpreter ) = InferenceParams (ei. native_interpreter)
@@ -56,18 +56,14 @@ lock_mi_inference(ei::ExtractingInterpreter, mi::MethodInstance) = nothing
56
56
unlock_mi_inference (ei:: ExtractingInterpreter , mi:: MethodInstance ) = nothing
57
57
58
58
code_cache (ei:: ExtractingInterpreter ) = ei. code
59
- Core. Compiler. get (a:: Dict , b, c) = Base. get (a,b,c)
60
- Core. Compiler. get (a:: WorldView{<:Dict} , b, c) = Base. get (a. cache,b,c)
61
- Core. Compiler. haskey (a:: Dict , b) = Base. haskey (a, b)
62
- Core. Compiler. haskey (a:: WorldView{<:Dict} , b) =
63
- Core. Compiler. haskey (a. cache, b)
64
- Core. Compiler. setindex! (a:: Dict , b, c) = setindex! (a, b, c)
65
- Core. Compiler. may_optimize (ei:: ExtractingInterpreter ) = ei. optimize
66
- Core. Compiler. may_compress (ei:: ExtractingInterpreter ) = false
67
- Core. Compiler. may_discard_trees (ei:: ExtractingInterpreter ) = false
68
-
69
- function Core. Compiler. add_remark! (ei:: ExtractingInterpreter , sv:: InferenceState , msg)
70
- @show msg
59
+ CC. get (a:: WorldView{<:Dict} , b, c) = Base. get (a. cache,b,c)
60
+ CC. haskey (a:: WorldView{<:Dict} , b) =
61
+ CC. haskey (a. cache, b)
62
+ CC. may_optimize (ei:: ExtractingInterpreter ) = ei. optimize
63
+ CC. may_compress (ei:: ExtractingInterpreter ) = false
64
+ CC. may_discard_trees (ei:: ExtractingInterpreter ) = false
65
+
66
+ function CC. add_remark! (ei:: ExtractingInterpreter , sv:: InferenceState , msg)
71
67
push! (ei. msgs, (sv. linfo, sv. currpc, msg))
72
68
end
73
69
0 commit comments