44using Core: CodeInfo, MethodInstance, CodeInstance, SimpleVector, MethodMatch, MethodTable
55using . CC: AbstractInterpreter, NativeInterpreter, InferenceParams, OptimizationParams,
66 InferenceResult, InferenceState, OptimizationState, WorldRange, WorldView, ArgInfo,
7- StmtInfo, MethodCallResult, ConstCallResults , ConstPropResult, MethodTableView,
7+ StmtInfo, MethodCallResult, ConstCallResult , ConstPropResult, MethodTableView,
88 CachedMethodTable, InternalMethodTable, OverlayMethodTable, CallMeta, CallInfo,
99 IRCode, LazyDomtree, IRInterpretationState, set_inlineable!, block_for_inst,
1010 BitSetBoundedMinPrioritySet, AbsIntState, Future
@@ -117,7 +117,7 @@ struct DAEInterpreter <: AbstractInterpreter
117117 ipo_analysis_mode:: Bool = false ,
118118 in_analysis:: Bool = false )
119119 if code_cache === nothing
120- code_cache = get_code_cache (method_table, ipo_analysis_mode)
120+ code_cache = get_code_cache (world, method_table, ipo_analysis_mode)
121121 end
122122 if method_table != = nothing
123123 method_table = CachedMethodTable (OverlayMethodTable (world, method_table))
@@ -315,13 +315,10 @@ end
315315 return Future {MethodCallResult} (mret, interp, sv) do ret, interp, sv
316316 edge = ret. edge
317317 if edge != = nothing
318- cache = CC. get (CC. code_cache (interp), edge, nothing )
319- if cache != = nothing
320- src = @atomic :monotonic cache. inferred
321- if isa (src, DAECache)
322- info = src. info
323- merge_daeinfo! (interp, sv. result, info)
324- end
318+ src = @atomic :monotonic edge. inferred
319+ if isa (src, DAECache)
320+ info = src. info
321+ merge_daeinfo! (interp, sv. result, info)
325322 end
326323 end
327324 return ret
@@ -330,11 +327,11 @@ end
330327
331328@override function CC. const_prop_call (interp:: DAEInterpreter ,
332329 mi:: MethodInstance , result:: MethodCallResult , arginfo:: ArgInfo ,
333- sv:: InferenceState , concrete_eval_result:: Union{Nothing,ConstCallResults } )
330+ sv:: InferenceState , concrete_eval_result:: Union{Nothing,ConstCallResult } )
334331 ret = @invoke CC. const_prop_call (interp:: AbstractInterpreter ,
335332 mi:: MethodInstance , result:: MethodCallResult , arginfo:: ArgInfo ,
336- sv:: InferenceState , concrete_eval_result:: Union{Nothing,ConstCallResults } )
337- if isa (ret, ConstCallResults )
333+ sv:: InferenceState , concrete_eval_result:: Union{Nothing,ConstCallResult } )
334+ if isa (ret, ConstCallResult )
338335 const_result = ret. const_result:: ConstPropResult
339336 info = interp. dae_cache[const_result. result]
340337 merge_daeinfo! (interp, sv. result, info)
@@ -353,26 +350,20 @@ struct DAECache
353350 new (inferred, ir, info)
354351end
355352
356- @override CC. transform_result_for_cache (interp:: DAEInterpreter ,
357- mi:: MethodInstance , valid_worlds:: WorldRange , result:: InferenceResult , cond:: Bool ) =
358- _transform_result_for_cache (interp, mi, valid_worlds, result, cond)
359-
360- function _transform_result_for_cache (interp:: DAEInterpreter ,
361- mi:: MethodInstance , valid_worlds:: WorldRange , result:: InferenceResult , cond:: Bool = false )
353+ function CC. transform_result_for_cache (interp:: DAEInterpreter , result:: InferenceResult )
362354 src = result. src
363355 if isa (src, DAECache)
364356 return src
365357 end
366- inferred = @invoke CC. transform_result_for_cache (interp:: AbstractInterpreter ,
367- mi:: MethodInstance , valid_worlds:: WorldRange , result:: InferenceResult , cond:: Bool )
358+ inferred = @invoke CC. transform_result_for_cache (interp:: AbstractInterpreter , result)
368359 return DAECache (inferred, nothing , interp. dae_cache[result])
369360end
370361
371362# inlining
372363# --------
373364
374365function dae_inlining_policy (@nospecialize (src), @nospecialize (info:: CallInfo ), raise:: Bool = true )
375- if isa (info, Diffractor. FRuleCallInfo)
366+ if isa (info, Diffractor. FRuleCallInfo) && info . frule_call . rt != = Const ( nothing )
376367 return nothing
377368 end
378369 osrc = src
@@ -502,13 +493,10 @@ end
502493 result:: MethodCallResult , si:: StmtInfo , sv:: InferenceState , force:: Bool )
503494 edge = result. edge
504495 if edge != = nothing
505- cache = CC. get (CC. code_cache (interp), edge, nothing )
506- if cache != = nothing
507- src = @atomic :monotonic cache. inferred
508- if isa (src, DAECache)
509- src. info. has_dae_intrinsics && return true
510- src. info. has_scoperead && return true
511- end
496+ src = @atomic :monotonic edge. inferred
497+ if isa (src, DAECache)
498+ src. info. has_dae_intrinsics && return true
499+ src. info. has_scoperead && return true
512500 end
513501 end
514502 return @invoke CC. const_prop_rettype_heuristic (interp:: AbstractInterpreter ,
@@ -1052,7 +1040,7 @@ end
10521040using Cthulhu
10531041
10541042function Cthulhu. get_optimized_codeinst (interp:: DAEInterpreter , curs:: Cthulhu.CthulhuCursor )
1055- interp . code_cache . cache[ curs. mi]
1043+ CC . getindex (CC . code_cache (interp), curs. mi)
10561044end
10571045
10581046function Cthulhu. lookup (interp:: DAEInterpreter , curs:: Cthulhu.CthulhuCursor , optimize:: Bool )
@@ -1109,7 +1097,7 @@ function lookup_optimized(interp::DAEInterpreter, mi::MethodInstance, allow_no_s
11091097end
11101098
11111099Cthulhu. can_descend (interp:: DAEInterpreter , @nospecialize (key), optimize:: Bool ) =
1112- haskey ( optimize ? interp . code_cache . cache : interp. unopt, key)
1100+ optimize ? CC . haskey (CC . code_cache (interp), key) : haskey ( interp. unopt, key)
11131101
11141102# TODO : Why does Cthulhu have this separately from the lookup logic, which already
11151103# returns effects
0 commit comments