@@ -307,21 +307,19 @@ else
307307 import Core. Compiler: get_world_counter, get_world_counter as get_inference_world
308308end
309309
310- using Core. Compiler: OverlayMethodTable
311310const MTType = Core. MethodTable
312311if isdefined(Core. Compiler, :CachedMethodTable)
313312 using Core. Compiler: CachedMethodTable
314- const GPUMethodTableView = CachedMethodTable{OverlayMethodTable}
315- get_method_table_view(world:: UInt , mt:: MTType ) =
316- CachedMethodTable(OverlayMethodTable(world, mt))
313+ maybe_cached(mtv:: CC.MethodTableView ) = CachedMethodTable(mtv)
317314else
318- const GPUMethodTableView = OverlayMethodTable
319- get_method_table_view(world:: UInt , mt:: MTType ) = OverlayMethodTable(world, mt)
315+ maybe_cached(mtv:: CC.MethodTableView ) = mtv
320316end
321317
322- struct GPUInterpreter <: CC.AbstractInterpreter
318+ get_method_table_view(world:: UInt , mt:: CC.MethodTable ) = CC. OverlayMethodTable(world, mt)
319+
320+ struct GPUInterpreter{MTV<: CC.MethodTableView } <: CC.AbstractInterpreter
323321 world:: UInt
324- method_table :: GPUMethodTableView
322+ method_table_view :: MTV
325323
326324@static if HAS_INTEGRATED_CACHE
327325 token:: Any
@@ -336,57 +334,55 @@ end
336334
337335@static if HAS_INTEGRATED_CACHE
338336function GPUInterpreter(world:: UInt = Base. get_world_counter();
339- method_table :: MTType ,
337+ method_table_view :: CC.MethodTableView ,
340338 token:: Any ,
341339 inf_params:: CC.InferenceParams ,
342340 opt_params:: CC.OptimizationParams )
343341 @assert world <= Base. get_world_counter()
344342
345- method_table = get_method_table_view(world, method_table)
346343 inf_cache = Vector{CC. InferenceResult}()
347344
348- return GPUInterpreter(world, method_table ,
345+ return GPUInterpreter(world, method_table_view ,
349346 token, inf_cache,
350347 inf_params, opt_params)
351348end
352349
353350function GPUInterpreter(interp:: GPUInterpreter ;
354351 world:: UInt = interp. world,
355- method_table :: GPUMethodTableView = interp. method_table ,
352+ method_table_view :: Core.MethodTable = interp. method_table_view ,
356353 token:: Any = interp. token,
357354 inf_cache:: Vector{CC.InferenceResult} = interp. inf_cache,
358355 inf_params:: CC.InferenceParams = interp. inf_params,
359356 opt_params:: CC.OptimizationParams = interp. opt_params)
360- return GPUInterpreter(world, method_table ,
357+ return GPUInterpreter(world, method_table_view ,
361358 token, inf_cache,
362359 inf_params, opt_params)
363360end
364361
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