You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Short-cut parsing the compiler if you dev the loaded version
This adds a special mechanism to shortcut parsing/loading the whole compiler
if the version you have dev'ed happens to exactly match (under the usual criteria
for cache validation) match the version that you have compiled into the system
image. As written, this does not extend to `add`'ed packages. I would like to
make that work in the future, but the refactoring required is too extensive
for my current taste and somewhat independent. Fortuantely, it's just an
optimization, so it can be added later. Still, I would like to keep this
path for `dev` so that we can exercise it to see if there's any other problems with it.
Demo: With `dev stdlib/Compiler`, we get a small `7k` .so file, since the Compiler does not
get re-loaded.
```
julia> @time using Compiler
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since pkgimage /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so was not found
└ @ Base loading.jl:3945
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_ajVhJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since the flags are mismatched
│ requested flags: use_pkgimages = true, debug_level = 1, check_bounds = 0, inline = true, opt_level = 2 [163]
│ cache file: use_pkgimages = true, debug_level = 2, check_bounds = 0, inline = true, opt_level = 2 [165]
└ @ Base loading.jl:3918
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since pkgimage /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so was not found
└ @ Base loading.jl:3945
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_ajVhJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since the flags are mismatched
│ requested flags: use_pkgimages = true, debug_level = 1, check_bounds = 0, inline = true, opt_level = 2 [163]
│ cache file: use_pkgimages = true, debug_level = 2, check_bounds = 0, inline = true, opt_level = 2 [165]
└ @ Base loading.jl:3918
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since pkgimage /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so was not found
└ @ Base loading.jl:3945
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_ajVhJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since the flags are mismatched
│ requested flags: use_pkgimages = true, debug_level = 1, check_bounds = 0, inline = true, opt_level = 2 [163]
│ cache file: use_pkgimages = true, debug_level = 2, check_bounds = 0, inline = true, opt_level = 2 [165]
└ @ Base loading.jl:3918
[ Info: Precompiling Compiler [807dbc54-b67e-4c79-8afb-eafe4df6f2e1] (cache misses: mismatched flags (2), missing ocachefile (2))
┌ Debug: Generating object cache file for Compiler [807dbc54-b67e-4c79-8afb-eafe4df6f2e1]
└ @ Base loading.jl:3021
┌ Debug: Loading object cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so for Compiler [807dbc54-b67e-4c79-8afb-eafe4df6f2e1]
└ @ Base loading.jl:1277
1.000245 seconds (507.60 k allocations: 29.245 MiB, 1.68% gc time, 65.46% compilation time)
shell> ls -la /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so
-rwxrwxr-x 1 keno keno 7112 Nov 1 07:33 /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so
julia> Compiler === Base.Compiler
true
```
Next, we dev the Compiler from another Julia version. Now it just treats
is as a regular package load and generates a 5MB .ji that contains the usual
pkgimage.
```
(@v1.12) pkg> dev /home/keno/julia2/stdlib/Compiler
Resolving package versions...
Updating `~/.julia/environments/v1.12/Project.toml`
[807dbc54] + Compiler v0.0.1 `~/julia2/stdlib/Compiler`
Updating `~/.julia/environments/v1.12/Manifest.toml`
[807dbc54] + Compiler v0.0.1 `~/julia2/stdlib/Compiler`
julia> using Compiler
┌ Debug: Rejecting stale cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.ji because file size of /home/keno/julia2/stdlib/Compiler/src/Compiler.jl has changed (file size 5958, before 5949)
└ @ Base loading.jl:3875
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_ajVhJ.ji for Base.PkgId(Base.UUID("807dbc54-b67e-4c79-8afb-eafe4df6f2e1"), "Compiler") since the flags are mismatched
│ requested flags: use_pkgimages = true, debug_level = 1, check_bounds = 0, inline = true, opt_level = 2 [163]
│ cache file: use_pkgimages = true, debug_level = 2, check_bounds = 0, inline = true, opt_level = 2 [165]
└ @ Base loading.jl:3918
┌ Debug: Rejecting stale cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.ji because file size of /home/keno/julia2/stdlib/Compiler/src/Compiler.jl has changed (file size 5958, before 5949)
└ @ Base loading.jl:3875
┌ Debug: Rejecting cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_ajVhJ.ji for Base.PkgId(nothing, "") since the flags are mismatched
│ requested flags: use_pkgimages = true, debug_level = 1, check_bounds = 0, inline = true, opt_level = 2 [163]
│ cache file: use_pkgimages = true, debug_level = 2, check_bounds = 0, inline = true, opt_level = 2 [165]
└ @ Base loading.jl:3918
Precompiling Compiler finished.
1 dependency successfully precompiled in 3 seconds
┌ Debug: Loading object cache file /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so for Compiler [807dbc54-b67e-4c79-8afb-eafe4df6f2e1]
└ @ Base loading.jl:1277
shell> ls -la /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so
-rwxrwxr-x 1 keno keno 5706792 Nov 1 07:40 /home/keno/.julia/compiled/v1.12/Compiler/DqelA_OpSbJ.so
julia> Compiler === Base.Compiler
false
```
const _concrete_dependencies = Pair{PkgId,UInt128}[] # these dependency versions are "set in stone", because they are explicitly loaded, and the process should try to avoid invalidating them
2240
2240
const _require_dependencies = Any[] # a list of (mod, abspath, fsize, hash, mtime) tuples that are the file dependencies of the module currently being precompiled
2241
2241
const _track_dependencies =Ref(false) # set this to true to track the list of file dependencies
0 commit comments