@@ -15,9 +15,9 @@ using ..Compiler:
15
15
hasintersect, haskey, in, isdispatchelem, isempty, isexpr, iterate, length, map!, max,
16
16
pop!, popfirst!, push!, pushfirst!, reinterpret, reverse!, reverse, setindex!,
17
17
setproperty!, similar, singleton_type, sptypes_from_meth_instance,
18
- unsafe_pointer_to_objref, widenconst,
18
+ unsafe_pointer_to_objref, widenconst, isconcretetype,
19
19
# misc
20
- @nospecialize , C_NULL
20
+ @nospecialize , @assert , C_NULL
21
21
using .. IRShow: LineInfoNode, print, show, println, append_scopes!, IOContext, IO, normalize_method_name
22
22
using .. Base: Base, sourceinfo_slotnames
23
23
using .. Base. StackTraces: StackFrame
@@ -166,7 +166,7 @@ function may_dispatch(@nospecialize ftyp)
166
166
end
167
167
end
168
168
169
- function verify_codeinstance! (codeinst:: CodeInstance , codeinfo:: CodeInfo , inspected:: IdSet{CodeInstance} , caches:: IdDict{MethodInstance,CodeInstance} , parents:: ParentMap , errors:: ErrorList )
169
+ function verify_codeinstance! (interp :: NativeInterpreter , codeinst:: CodeInstance , codeinfo:: CodeInfo , inspected:: IdSet{CodeInstance} , caches:: IdDict{MethodInstance,CodeInstance} , parents:: ParentMap , errors:: ErrorList )
170
170
mi = get_ci_mi (codeinst)
171
171
sptypes = sptypes_from_meth_instance (mi)
172
172
src = codeinfo. code
@@ -199,9 +199,9 @@ function verify_codeinstance!(codeinst::CodeInstance, codeinfo::CodeInfo, inspec
199
199
if ! may_dispatch (ftyp)
200
200
continue
201
201
end
202
- # TODO : Make interp elsewhere
203
- interp = NativeInterpreter (Base . get_world_counter ())
204
- if Core. _apply_iterate isa ftyp
202
+ if ! isconcretetype (ftyp)
203
+ error = " unresolved call to (unknown) builtin "
204
+ elseif Core. _apply_iterate isa ftyp
205
205
if length (stmt. args) >= 3
206
206
# args[1] is _apply_iterate object
207
207
# args[2] is invoke object
@@ -233,9 +233,23 @@ function verify_codeinstance!(codeinst::CodeInstance, codeinfo::CodeInfo, inspec
233
233
234
234
error = " unresolved finalizer registered"
235
235
end
236
- else
237
- error = " unresolved call to builtin"
238
- end
236
+ elseif Core. _apply isa ftyp
237
+ error = " trim verification not yet implemented for builtin `Core._apply`"
238
+ elseif Core. _call_in_world_total isa ftyp
239
+ error = " trim verification not yet implemented for builtin `Core._call_in_world_total`"
240
+ elseif Core. invoke isa ftyp
241
+ error = " trim verification not yet implemented for builtin `Core.invoke`"
242
+ elseif Core. invoke_in_world isa ftyp
243
+ error = " trim verification not yet implemented for builtin `Core.invoke_in_world`"
244
+ elseif Core. invokelatest isa ftyp
245
+ error = " trim verification not yet implemented for builtin `Core.invokelatest`"
246
+ elseif Core. modifyfield! isa ftyp
247
+ error = " trim verification not yet implemented for builtin `Core.modifyfield!`"
248
+ elseif Core. modifyglobal! isa ftyp
249
+ error = " trim verification not yet implemented for builtin `Core.modifyglobal!`"
250
+ elseif Core. memoryrefmodify! isa ftyp
251
+ error = " trim verification not yet implemented for builtin `Core.memoryrefmodify!`"
252
+ else @assert false " unexpected builtin" end
239
253
end
240
254
extyp = argextype (SSAValue (i), codeinfo, sptypes)
241
255
if extyp === Union{}
267
281
268
282
function get_verify_typeinf_trim (codeinfos:: Vector{Any} )
269
283
this_world = get_world_counter ()
284
+ interp = NativeInterpreter (this_world)
270
285
inspected = IdSet {CodeInstance} ()
271
286
caches = IdDict {MethodInstance,CodeInstance} ()
272
287
errors = ErrorList ()
@@ -287,7 +302,7 @@ function get_verify_typeinf_trim(codeinfos::Vector{Any})
287
302
item = codeinfos[i]
288
303
if item isa CodeInstance
289
304
src = codeinfos[i + 1 ]:: CodeInfo
290
- verify_codeinstance! (item, src, inspected, caches, parents, errors)
305
+ verify_codeinstance! (interp, item, src, inspected, caches, parents, errors)
291
306
elseif item isa SimpleVector
292
307
rt = item[1 ]:: Type
293
308
sig = item[2 ]:: Type
0 commit comments