@@ -95,24 +95,24 @@ lower_level(interp::ADInterpreter) = change_level(interp, interp.current_level -
95
95
disable_forward (interp:: ADInterpreter ) = ADInterpreter (interp; forward= false )
96
96
97
97
function CC. InferenceState (result:: InferenceResult , cache:: Symbol , interp:: ADInterpreter )
98
+ sv = @invoke CC. InferenceState (result:: InferenceResult , cache:: Symbol , interp:: AbstractInterpreter )
99
+ sv === nothing && return sv
98
100
if interp. current_level === missing
99
- error ()
101
+ # override initial bestguess
102
+ arginfo = ArgInfo (nothing , result. argtypes)
103
+ si = StmtInfo (true )
104
+ sv. bestguess = CC. abstract_call (interp. native_interpreter, arginfo, si, sv). rt
100
105
end
101
- return @invoke CC. InferenceState (result:: InferenceResult , cache:: Symbol , interp:: AbstractInterpreter )
102
- # prepare an InferenceState object for inferring lambda
103
- world = get_world_counter (interp)
104
- src = retrieve_code_info (result. linfo, world)
105
- src === nothing && return nothing
106
- validate_code_in_debug_mode (result. linfo, src, " lowered" )
107
- return InferenceState (result, src, cache, interp, Bottom)
106
+ return sv
108
107
end
109
108
110
-
111
- function CC . initial_bestguess (interp :: ADInterpreter , result :: InferenceResult )
109
+ function CC . update_bestguess! (interp :: ADInterpreter , frame :: InferenceState ,
110
+ currstate :: CC.VarTable , @nospecialize (rt) )
112
111
if interp. current_level === missing
113
- return CC. typeinf_lattice (interp . native_interpreter, result . linfo )
112
+ rt = CC. getfield_tfunc (rt, Const ( 1 ) )
114
113
end
115
- return Bottom
114
+ return @invoke CC. update_bestguess! (interp:: AbstractInterpreter , frame:: InferenceState ,
115
+ currstate:: CC.VarTable , rt:: Any )
116
116
end
117
117
118
118
function Cthulhu. get_optimized_codeinst (interp:: ADInterpreter , curs:: ADCursor )
@@ -121,7 +121,6 @@ function Cthulhu.get_optimized_codeinst(interp::ADInterpreter, curs::ADCursor)
121
121
end
122
122
Cthulhu. AbstractCursor (interp:: ADInterpreter , mi:: MethodInstance ) = ADCursor (0 , mi, false )
123
123
124
-
125
124
# This is a lie, but let's clean this up later
126
125
Cthulhu. can_descend (interp:: ADInterpreter , @nospecialize (key), optimize:: Bool ) = true
127
126
0 commit comments