Skip to content

Commit 756d3e6

Browse files
committed
Use APIs to query list of method instances.
1 parent 974e859 commit 756d3e6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/jlgen.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,19 @@ function compile_method_instance(@nospecialize(job::CompilerJob))
668668
cache_gbl = nothing
669669
end
670670

671+
if VERSION >= v"1.12.0-DEV.1703"
672+
# on sufficiently recent versions of Julia, we can query the MIs compiled.
673+
# this is required after the move to `invokce(::CodeInstance)`, because our
674+
# lookup function (used to populate method_instances) isn't always called then.
675+
676+
num_mis = Ref{Csize_t}(0)
677+
@ccall jl_get_llvm_mis(native_code::Ptr{Cvoid}, num_mis::Ptr{Csize_t},
678+
C_NULL::Ptr{Cvoid})::Nothing
679+
resize!(method_instances, num_mis[])
680+
@ccall jl_get_llvm_mis(native_code::Ptr{Cvoid}, num_mis::Ptr{Csize_t},
681+
method_instances::Ptr{Cvoid})::Nothing
682+
end
683+
671684
# process all compiled method instances
672685
compiled = Dict()
673686
for mi in method_instances

0 commit comments

Comments
 (0)