Skip to content

Commit 0c9292f

Browse files
authored
Add an interface extension point to prepare before anything happens. (#572)
1 parent 0c8d55e commit 0c9292f

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/driver.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ function codegen(output::Symbol, @nospecialize(job::CompilerJob);
128128
validate && check_invocation(job)
129129
end
130130

131+
prepare_job!(job)
132+
131133

132134
## LLVM IR
133135

src/interface.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ end
277277

278278
## extension points at important stages of compilation
279279

280+
# prepare the environment for compilation of a job. this can involve, e.g.,
281+
# priming the cache with entries that cannot be easily inferred.
282+
prepare_job!(@nospecialize(job::CompilerJob)) = return
283+
280284
# early extension point used to link-in external bitcode files.
281285
# this is typically used by downstream packages to link vendor libraries.
282286
link_libraries!(@nospecialize(job::CompilerJob), mod::LLVM.Module,

src/jlgen.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ end # HAS_INTEGRATED_CACHE
505505
function ci_cache_populate(interp, cache, mi, min_world, max_world)
506506
if VERSION >= v"1.12.0-DEV.15"
507507
inferred_ci = CC.typeinf_ext_toplevel(interp, mi, CC.SOURCE_MODE_FORCE_SOURCE) # or SOURCE_MODE_FORCE_SOURCE_UNCACHED?
508+
@assert inferred_ci !== nothing "Inference of $mi failed"
508509

509510
# inference should have populated our cache
510511
wvc = WorldView(cache, min_world, max_world)

0 commit comments

Comments
 (0)