@@ -307,21 +307,18 @@ else
307307 import Core. Compiler: get_world_counter, get_world_counter as get_inference_world
308308end
309309
310- using Core. Compiler: OverlayMethodTable
311- const MTType = Core. MethodTable
312310if isdefined(Core. Compiler, :CachedMethodTable)
313311 using Core. Compiler: CachedMethodTable
314- const GPUMethodTableView = CachedMethodTable{OverlayMethodTable}
315- get_method_table_view(world:: UInt , mt:: MTType ) =
316- CachedMethodTable(OverlayMethodTable(world, mt))
312+ maybe_cached(mtv:: CC.MethodTableView ) = CachedMethodTable(mtv)
317313else
318- const GPUMethodTableView = OverlayMethodTable
319- get_method_table_view(world:: UInt , mt:: MTType ) = OverlayMethodTable(world, mt)
314+ maybe_cached(mtv:: CC.MethodTableView ) = mtv
320315end
321316
322- struct GPUInterpreter <: CC.AbstractInterpreter
317+ get_method_table_view(world:: UInt , mt:: CC.MethodTable ) = CC. OverlayMethodTable(world, mt)
318+
319+ struct GPUInterpreter{MTV<: CC.MethodTableView } <: CC.AbstractInterpreter
323320 world:: UInt
324- method_table :: GPUMethodTableView
321+ method_table_view :: MTV
325322
326323@static if HAS_INTEGRATED_CACHE
327324 token:: Any
@@ -365,28 +362,27 @@ end
365362else
366363
367364function GPUInterpreter(world:: UInt = Base. get_world_counter();
368- method_table :: MTType ,
365+ method_table_view :: CC.MethodTableView ,
369366 code_cache:: CodeCache ,
370367 inf_params:: CC.InferenceParams ,
371368 opt_params:: CC.OptimizationParams )
372369 @assert world <= Base. get_world_counter()
373370
374- method_table = get_method_table_view(world, method_table)
375371 inf_cache = Vector{CC. InferenceResult}()
376372
377- return GPUInterpreter(world, method_table ,
373+ return GPUInterpreter(world, method_table_view ,
378374 code_cache, inf_cache,
379375 inf_params, opt_params)
380376end
381377
382378function GPUInterpreter(interp:: GPUInterpreter ;
383379 world:: UInt = interp. world,
384- method_table :: GPUMethodTableView = interp. method_table ,
380+ method_table_view :: CC.MethodTableView = interp. method_table_view ,
385381 code_cache:: CodeCache = interp. code_cache,
386382 inf_cache:: Vector{CC.InferenceResult} = interp. inf_cache,
387383 inf_params:: CC.InferenceParams = interp. inf_params,
388384 opt_params:: CC.OptimizationParams = interp. opt_params)
389- return GPUInterpreter(world, method_table ,
385+ return GPUInterpreter(world, method_table_view ,
390386 code_cache, inf_cache,
391387 inf_params, opt_params)
392388end
@@ -416,7 +412,7 @@ CC.may_discard_trees(interp::GPUInterpreter) = true
416412@static if VERSION <= v" 1.12.0-DEV.1531"
417413CC. verbose_stmt_info(interp:: GPUInterpreter ) = false
418414end
419- CC. method_table(interp:: GPUInterpreter ) = interp. method_table
415+ CC. method_table(interp:: GPUInterpreter ) = interp. method_table_view
420416
421417# semi-concrete interepretation is broken with overlays (JuliaLang/julia#47349)
422418function CC. concrete_eval_eligible(interp:: GPUInterpreter ,
0 commit comments