@@ -15,9 +15,9 @@ using ..Compiler:
1515     hasintersect, haskey, in, isdispatchelem, isempty, isexpr, iterate, length, map!, max,
1616     pop!, popfirst!, push!, pushfirst!, reinterpret, reverse!, reverse, setindex!,
1717     setproperty!, similar, singleton_type, sptypes_from_meth_instance,
18-      unsafe_pointer_to_objref, widenconst,
18+      unsafe_pointer_to_objref, widenconst, isconcretetype, 
1919     #  misc
20-      @nospecialize , C_NULL 
20+      @nospecialize , @assert ,  C_NULL 
2121using  .. IRShow:  LineInfoNode, print, show, println, append_scopes!, IOContext, IO, normalize_method_name
2222using  .. Base:  Base, sourceinfo_slotnames
2323using  .. Base. StackTraces:  StackFrame
@@ -166,7 +166,7 @@ function may_dispatch(@nospecialize ftyp)
166166    end 
167167end 
168168
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 )
170170    mi =  get_ci_mi (codeinst)
171171    sptypes =  sptypes_from_meth_instance (mi)
172172    src =  codeinfo. code
@@ -199,9 +199,9 @@ function verify_codeinstance!(codeinst::CodeInstance, codeinfo::CodeInfo, inspec
199199                if  ! may_dispatch (ftyp)
200200                    continue 
201201                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
205205                    if  length (stmt. args) >=  3 
206206                        #  args[1] is _apply_iterate object
207207                        #  args[2] is invoke object
@@ -233,9 +233,23 @@ function verify_codeinstance!(codeinst::CodeInstance, codeinfo::CodeInfo, inspec
233233
234234                        error =  " unresolved finalizer registered" 
235235                    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 
239253            end 
240254            extyp =  argextype (SSAValue (i), codeinfo, sptypes)
241255            if  extyp ===  Union{}
267281
268282function  get_verify_typeinf_trim (codeinfos:: Vector{Any} )
269283    this_world =  get_world_counter ()
284+     interp =  NativeInterpreter (this_world)
270285    inspected =  IdSet {CodeInstance} ()
271286    caches =  IdDict {MethodInstance,CodeInstance} ()
272287    errors =  ErrorList ()
@@ -287,7 +302,7 @@ function get_verify_typeinf_trim(codeinfos::Vector{Any})
287302        item =  codeinfos[i]
288303        if  item isa  CodeInstance
289304            src =  codeinfos[i +  1 ]:: CodeInfo 
290-             verify_codeinstance! (item, src, inspected, caches, parents, errors)
305+             verify_codeinstance! (interp,  item, src, inspected, caches, parents, errors)
291306        elseif  item isa  SimpleVector
292307            rt =  item[1 ]:: Type 
293308            sig =  item[2 ]:: Type 
0 commit comments