@@ -1189,7 +1189,7 @@ const TIMING_IMPORTS = Threads.Atomic{Int}(0)
1189
1189
# these return either the array of modules loaded from the path / content given
1190
1190
# or an Exception that describes why it couldn't be loaded
1191
1191
# and it reconnects the Base.Docs.META
1192
- function _include_from_serialized (pkg:: PkgId , path:: String , ocachepath:: Union{Nothing, String} , depmods:: Vector{Any} , ignore_native:: Union{Nothing,Bool} = nothing )
1192
+ function _include_from_serialized (pkg:: PkgId , path:: String , ocachepath:: Union{Nothing, String} , depmods:: Vector{Any} , ignore_native:: Union{Nothing,Bool} = nothing ; register :: Bool = true )
1193
1193
if isnothing (ignore_native)
1194
1194
if JLOptions (). code_coverage == 0 && JLOptions (). malloc_log == 0
1195
1195
ignore_native = false
@@ -1238,6 +1238,7 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
1238
1238
for M in restored
1239
1239
M = M:: Module
1240
1240
if parentmodule (M) === M && PkgId (M) == pkg
1241
+ register && register_root_module (M)
1241
1242
if timing_imports
1242
1243
elapsed = round ((time_ns () - t_before) / 1e6 , digits = 1 )
1243
1244
comp_time, recomp_time = cumulative_compile_time_ns () .- t_comp_before
@@ -1897,8 +1898,7 @@ function _tryrequire_from_serialized(pkg::PkgId, path::String, ocachepath::Union
1897
1898
depmods[i] = dep
1898
1899
end
1899
1900
# then load the file
1900
- loaded = _include_from_serialized (pkg, path, ocachepath, depmods, ignore_native)
1901
- loaded isa Module && register_root_module (loaded)
1901
+ loaded = _include_from_serialized (pkg, path, ocachepath, depmods, ignore_native; register = true )
1902
1902
return loaded
1903
1903
end
1904
1904
@@ -1965,8 +1965,7 @@ end
1965
1965
if dep === nothing
1966
1966
try
1967
1967
set_pkgorigin_version_path (modkey, modpath)
1968
- dep = _include_from_serialized (modkey, modcachepath, modocachepath, modstaledeps)
1969
- dep isa Module && stalecheck && register_root_module (dep)
1968
+ dep = _include_from_serialized (modkey, modcachepath, modocachepath, modstaledeps; register = stalecheck)
1970
1969
finally
1971
1970
end_loading (modkey, dep)
1972
1971
end
@@ -1982,9 +1981,8 @@ end
1982
1981
end
1983
1982
restored = get (loaded_precompiles, pkg => newbuild_id, nothing )
1984
1983
if ! isa (restored, Module)
1985
- restored = _include_from_serialized (pkg, path_to_try, ocachefile, staledeps)
1984
+ restored = _include_from_serialized (pkg, path_to_try, ocachefile, staledeps; register = stalecheck )
1986
1985
end
1987
- isa (restored, Module) && stalecheck && register_root_module (restored)
1988
1986
isa (restored, Module) && return restored
1989
1987
@debug " Deserialization checks failed while attempting to load cache from $path_to_try " exception= restored
1990
1988
@label check_next_path
0 commit comments