@@ -1203,7 +1203,7 @@ const TIMING_IMPORTS = Threads.Atomic{Int}(0)
1203
1203
# these return either the array of modules loaded from the path / content given
1204
1204
# or an Exception that describes why it couldn't be loaded
1205
1205
# and it reconnects the Base.Docs.META
1206
- function _include_from_serialized (pkg:: PkgId , path:: String , ocachepath:: Union{Nothing, String} , depmods:: Vector{Any} , ignore_native:: Union{Nothing,Bool} = nothing )
1206
+ function _include_from_serialized (pkg:: PkgId , path:: String , ocachepath:: Union{Nothing, String} , depmods:: Vector{Any} , ignore_native:: Union{Nothing,Bool} = nothing ; register :: Bool = true )
1207
1207
if isnothing (ignore_native)
1208
1208
if JLOptions (). code_coverage == 0 && JLOptions (). malloc_log == 0
1209
1209
ignore_native = false
@@ -1252,13 +1252,14 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
1252
1252
for M in restored
1253
1253
M = M:: Module
1254
1254
if parentmodule (M) === M && PkgId (M) == pkg
1255
+ register && register_root_module (M)
1255
1256
if timing_imports
1256
1257
elapsed = round ((time_ns () - t_before) / 1e6 , digits = 1 )
1257
1258
comp_time, recomp_time = cumulative_compile_time_ns () .- t_comp_before
1258
1259
print (lpad (elapsed, 9 ), " ms " )
1259
- parentid = get (EXT_PRIMED, pkg, nothing )
1260
- if parentid != = nothing
1261
- print (parentid . name , " → " )
1260
+ ext_parent = extension_parent_name (M )
1261
+ if ext_parent != = nothing
1262
+ print (ext_parent :: String , " → " )
1262
1263
end
1263
1264
print (pkg. name)
1264
1265
if comp_time > 0
@@ -1280,6 +1281,27 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
1280
1281
end
1281
1282
end
1282
1283
1284
+ # if M is an extension, return the string name of the parent. Otherwise return nothing
1285
+ function extension_parent_name (M:: Module )
1286
+ rootmodule = moduleroot (M)
1287
+ src_path = pathof (rootmodule)
1288
+ src_path === nothing && return nothing
1289
+ pkgdir_parts = splitpath (src_path)
1290
+ ext_pos = findlast (== (" ext" ), pkgdir_parts)
1291
+ if ext_pos != = nothing && ext_pos >= length (pkgdir_parts) - 2
1292
+ parent_package_root = joinpath (pkgdir_parts[1 : ext_pos- 1 ]. .. )
1293
+ parent_package_project_file = locate_project_file (parent_package_root)
1294
+ if parent_package_project_file isa String
1295
+ d = parsed_toml (parent_package_project_file)
1296
+ name = get (d, " name" , nothing )
1297
+ if name != = nothing
1298
+ return name
1299
+ end
1300
+ end
1301
+ end
1302
+ return nothing
1303
+ end
1304
+
1283
1305
function register_restored_modules (sv:: SimpleVector , pkg:: PkgId , path:: String )
1284
1306
# This function is also used by PkgCacheInspector.jl
1285
1307
restored = sv[1 ]:: Vector{Any}
@@ -1461,7 +1483,7 @@ function _insert_extension_triggers(parent::PkgId, extensions::Dict{String, Any}
1461
1483
triggers = triggers:: Union{String, Vector{String}}
1462
1484
triggers isa String && (triggers = [triggers])
1463
1485
id = PkgId (uuid5 (parent. uuid:: UUID , ext), ext)
1464
- if id in keys (EXT_PRIMED) || haskey (Base. loaded_modules, id)
1486
+ if haskey (EXT_PRIMED, id ) || haskey (Base. loaded_modules, id)
1465
1487
continue # extension is already primed or loaded, don't add it again
1466
1488
end
1467
1489
EXT_PRIMED[id] = parent
@@ -1890,8 +1912,7 @@ function _tryrequire_from_serialized(pkg::PkgId, path::String, ocachepath::Union
1890
1912
depmods[i] = dep
1891
1913
end
1892
1914
# then load the file
1893
- loaded = _include_from_serialized (pkg, path, ocachepath, depmods, ignore_native)
1894
- loaded isa Module && register_root_module (loaded)
1915
+ loaded = _include_from_serialized (pkg, path, ocachepath, depmods, ignore_native; register = true )
1895
1916
return loaded
1896
1917
end
1897
1918
@@ -1958,8 +1979,7 @@ end
1958
1979
if dep === nothing
1959
1980
try
1960
1981
set_pkgorigin_version_path (modkey, modpath)
1961
- dep = _include_from_serialized (modkey, modcachepath, modocachepath, modstaledeps)
1962
- dep isa Module && stalecheck && register_root_module (dep)
1982
+ dep = _include_from_serialized (modkey, modcachepath, modocachepath, modstaledeps; register = stalecheck)
1963
1983
finally
1964
1984
end_loading (modkey, dep)
1965
1985
end
@@ -1975,9 +1995,8 @@ end
1975
1995
end
1976
1996
restored = get (loaded_precompiles, pkg => newbuild_id, nothing )
1977
1997
if ! isa (restored, Module)
1978
- restored = _include_from_serialized (pkg, path_to_try, ocachefile, staledeps)
1998
+ restored = _include_from_serialized (pkg, path_to_try, ocachefile, staledeps; register = stalecheck )
1979
1999
end
1980
- isa (restored, Module) && stalecheck && register_root_module (restored)
1981
2000
isa (restored, Module) && return restored
1982
2001
@debug " Deserialization checks failed while attempting to load cache from $path_to_try " exception= restored
1983
2002
@label check_next_path
0 commit comments