forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add relocatable root compression (JuliaLang#43881)
Currently we can't cache "external" CodeInstances, i.e., those generated by compiling other modules' methods with externally-defined types. For example, consider `push!([], MyPkg.MyType())`: Base owns the method `push!(::Vector{Any}, ::Any)` but doesn't know about `MyType`. While there are several obstacles to caching exteral CodeInstances, the primary one is that in compressed IR, method roots are referenced from a list by index, and the index is defined by order of insertion. This order might change depending on package-loading sequence or other history-dependent factors. If the order isn't consistent, our current serialization techniques would result in corrupted code upon decompression, and that would generally trigger catastrophic failure. To avoid this problem, we simply avoid caching such CodeInstances. This enables roots to be referenced with respect to a `(key, index)` pair, where `key` identifies the module and `index` numbers just those roots with the same `key`. Roots with `key = 0` are considered to be of unknown origin, and CodeInstances referencing such roots will remain unserializable unless all such roots were added at the time of system image creation. To track this additional data, this adds two fields to core types: - to methods, it adds a `nroots_sysimg` field to count the number of roots defined at the time of writing the system image (such occur first in the list of `roots`) - to CodeInstances, it adds a flag `relocatability` having value 1 if every root is "safe," meaning it was either added at sysimg creation or is tagged with a non-zero `key`. Even a single unsafe root will cause this to have value 0.
- Loading branch information
1 parent
98f5d51
commit 49162bf
Showing
19 changed files
with
341 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,4 +97,3 @@ jl_symbol("undef"), | |
jl_symbol("sizeof"), | ||
jl_symbol("String"), | ||
jl_symbol("namedtuple.jl"), | ||
jl_symbol("pop"), |
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
Oops, something went wrong.