Skip to content

Commit 748c17f

Browse files
move register_root_module into _include_from_serialized
1 parent 2af598d commit 748c17f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

base/loading.jl

+5-7
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ const TIMING_IMPORTS = Threads.Atomic{Int}(0)
11891189
# these return either the array of modules loaded from the path / content given
11901190
# or an Exception that describes why it couldn't be loaded
11911191
# 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)
11931193
if isnothing(ignore_native)
11941194
if JLOptions().code_coverage == 0 && JLOptions().malloc_log == 0
11951195
ignore_native = false
@@ -1238,6 +1238,7 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
12381238
for M in restored
12391239
M = M::Module
12401240
if parentmodule(M) === M && PkgId(M) == pkg
1241+
register && register_root_module(M)
12411242
if timing_imports
12421243
elapsed = round((time_ns() - t_before) / 1e6, digits = 1)
12431244
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
18971898
depmods[i] = dep
18981899
end
18991900
# 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)
19021902
return loaded
19031903
end
19041904

@@ -1965,8 +1965,7 @@ end
19651965
if dep === nothing
19661966
try
19671967
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)
19701969
finally
19711970
end_loading(modkey, dep)
19721971
end
@@ -1982,9 +1981,8 @@ end
19821981
end
19831982
restored = get(loaded_precompiles, pkg => newbuild_id, nothing)
19841983
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)
19861985
end
1987-
isa(restored, Module) && stalecheck && register_root_module(restored)
19881986
isa(restored, Module) && return restored
19891987
@debug "Deserialization checks failed while attempting to load cache from $path_to_try" exception=restored
19901988
@label check_next_path

0 commit comments

Comments
 (0)