|
65 | 65 | #=CC.=#get_inference_world(interp::CthulhuInterpreter) = get_inference_world(interp.native) |
66 | 66 | CC.get_inference_cache(interp::CthulhuInterpreter) = get_inference_cache(interp.native) |
67 | 67 |
|
68 | | -# No need to do any locking since we're not putting our results into the runtime cache |
69 | | -CC.lock_mi_inference(interp::CthulhuInterpreter, mi::MethodInstance) = nothing |
70 | | -CC.unlock_mi_inference(interp::CthulhuInterpreter, mi::MethodInstance) = nothing |
| 68 | +CC.may_optimize(interp::CthulhuInterpreter) = true |
| 69 | +CC.may_compress(interp::CthulhuInterpreter) = false |
| 70 | +CC.may_discard_trees(interp::CthulhuInterpreter) = false |
| 71 | +CC.verbose_stmt_info(interp::CthulhuInterpreter) = true |
| 72 | + |
71 | 73 | CC.method_table(interp::CthulhuInterpreter) = method_table(interp.native) |
72 | 74 |
|
73 | | -if isdefined(CC, :cache_owner) |
| 75 | +@static if VERSION ≥ v"1.11.0-DEV.1552" |
| 76 | +# Since the cache for `CthulhuInterpreter` is volatile and does not involve with the |
| 77 | +# internal code cache, technically, there's no requirement to supply `cache_owner` as an |
| 78 | +# identifier for the internal code cache. However, the definition of `cache_owner` is |
| 79 | +# necessary for utilizing the default `CodeInstance` constructor, define the overload here. |
74 | 80 | struct CthulhuCacheToken |
75 | 81 | token |
76 | 82 | end |
|
80 | 86 | struct CthulhuCache |
81 | 87 | cache::OptimizationDict |
82 | 88 | end |
83 | | - |
84 | 89 | CC.code_cache(interp::CthulhuInterpreter) = WorldView(CthulhuCache(interp.opt), WorldRange(get_inference_world(interp))) |
85 | 90 | CC.get(wvc::WorldView{CthulhuCache}, mi::MethodInstance, default) = get(wvc.cache.cache, mi, default) |
86 | 91 | CC.haskey(wvc::WorldView{CthulhuCache}, mi::MethodInstance) = haskey(wvc.cache.cache, mi) |
87 | 92 | CC.setindex!(wvc::WorldView{CthulhuCache}, ci::CodeInstance, mi::MethodInstance) = setindex!(wvc.cache.cache, ci, mi) |
88 | 93 |
|
89 | | -CC.may_optimize(interp::CthulhuInterpreter) = true |
90 | | -CC.may_compress(interp::CthulhuInterpreter) = false |
91 | | -CC.may_discard_trees(interp::CthulhuInterpreter) = false |
92 | | -CC.verbose_stmt_info(interp::CthulhuInterpreter) = true |
93 | | - |
94 | 94 | function CC.add_remark!(interp::CthulhuInterpreter, sv::InferenceState, msg) |
95 | 95 | key = CC.any(sv.result.overridden_by_const) ? sv.result : sv.linfo |
96 | 96 | push!(get!(PC2Remarks, interp.remarks, key), sv.currpc=>msg) |
|
0 commit comments