-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Figure out loading semantics for Compiler
This tries to align the semantics of `using Compiler` with that of all other (upgradable, not-in-the-sysimage) stdlibs by semantically treating the Compiler as a non-loaded stdlib that just happens to already have its `.ji` file included in the sysimage. Then, when you ask it to create a `.ji` file, it simply writes out a stub file that redirects everything to the sysimage. Example: Here we load an unmodified compiler image. Everything is done in 1s and the `Compiler` you get back at toplevel is the same Compiler that Base uses. ``` 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 ```
- Loading branch information
Showing
7 changed files
with
165 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters