Skip to content

Commit a7e7c93

Browse files
committed
precompile: move precompile_utils logic from C to julia
This helps reveal how badly implemented this was in basically every case (trim, all, hinting, external) having different bugs by starting to merge those code paths together. Actually fixing those myriad of issues is left as an exercise to the reader. Written with help by Claude.
1 parent c6e7650 commit a7e7c93

21 files changed

+617
-560
lines changed

Compiler/src/Compiler.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using Base: @_foldable_meta, @_gc_preserve_begin, @_gc_preserve_end, @nospeciali
5353
_array_for, _bits_findnext, _methods_by_ftype, _uniontypes, all, allocatedinline, any,
5454
argument_datatype, binding_kind, cconvert, copy_exprargs, datatype_arrayelem,
5555
datatype_fieldcount, datatype_fieldtypes, datatype_layoutsize, datatype_nfields,
56-
datatype_pointerfree, decode_effects_override, diff_names, fieldindex,
56+
datatype_pointerfree, decode_effects_override, diff_names, fieldindex, visit,
5757
generating_output, get_nospecializeinfer_sig, get_world_counter, has_free_typevars,
5858
hasgenerator, hasintersect, indexed_iterate, isType, is_file_tracked, is_function_def,
5959
is_meta_expr, is_meta_expr_head, is_nospecialized, is_nospecializeinfer, is_defined_const_binding,
@@ -187,6 +187,7 @@ include("typeinfer.jl")
187187
include("optimize.jl")
188188

189189
include("bootstrap.jl")
190+
include("precompile.jl")
190191
include("reflection_interface.jl")
191192
include("opaque_closure.jl")
192193

Compiler/src/bootstrap.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
function activate_codegen!()
99
ccall(:jl_set_typeinf_func, Cvoid, (Any,), typeinf_ext_toplevel)
10+
# Register the new unified compile and emit function
11+
ccall(:jl_set_compile_and_emit_func, Cvoid, (Any,), compile_and_emit_native)
1012
Core.eval(Compiler, quote
1113
let typeinf_world_age = Base.tls_world_age()
1214
@eval Core.OptimizedGenerics.CompilerPlugins.typeinf(::Nothing, mi::MethodInstance, source_mode::UInt8) =

0 commit comments

Comments
 (0)