@@ -176,29 +176,26 @@ function store_backedges(frame::InferenceState)
176
176
if ! toplevel && (frame. cached || frame. parent != = nothing )
177
177
caller = frame. result. linfo
178
178
for edges in frame. stmt_edges
179
- edges === nothing && continue
180
- i = 1
181
- while i <= length (edges)
182
- to = edges[i]
183
- if isa (to, MethodInstance)
184
- ccall (:jl_method_instance_add_backedge , Cvoid, (Any, Any), to, caller)
185
- i += 1
186
- else
187
- typeassert (to, Core. MethodTable)
188
- typ = edges[i + 1 ]
189
- ccall (:jl_method_table_add_backedge , Cvoid, (Any, Any, Any), to, typ, caller)
190
- i += 2
191
- end
192
- end
179
+ store_backedges (caller, edges)
193
180
end
194
- edges = frame. src. edges
195
- if edges != = nothing
196
- edges = edges:: Vector{MethodInstance}
197
- for edge in edges
198
- @assert isa (edge, MethodInstance)
199
- ccall (:jl_method_instance_add_backedge , Cvoid, (Any, Any), edge, caller)
200
- end
201
- frame. src. edges = nothing
181
+ store_backedges (caller, frame. src. edges)
182
+ frame. src. edges = nothing
183
+ end
184
+ end
185
+
186
+ store_backedges (caller, edges:: Nothing ) = nothing
187
+ function store_backedges (caller, edges:: Vector )
188
+ i = 1
189
+ while i <= length (edges)
190
+ to = edges[i]
191
+ if isa (to, MethodInstance)
192
+ ccall (:jl_method_instance_add_backedge , Cvoid, (Any, Any), to, caller)
193
+ i += 1
194
+ else
195
+ typeassert (to, Core. MethodTable)
196
+ typ = edges[i + 1 ]
197
+ ccall (:jl_method_table_add_backedge , Cvoid, (Any, Any, Any), to, typ, caller)
198
+ i += 2
202
199
end
203
200
end
204
201
end
0 commit comments