codegen: Mark resolved const GlobalRef as method root#60945
codegen: Mark resolved const GlobalRef as method root#60945topolarity merged 1 commit intoJuliaLang:masterfrom
const GlobalRef as method root#60945Conversation
|
How was the code there not segfaulting? Because I thought in this case we just removed the globalref and got the underlying object but that was rooted by the code |
Are you referring to the MWE I posted? I think got some segfaults too while exploring, but usually it would halt before that with some other error message. |
|
Shockingly small impact on the sysimage: https://buildkite.com/julialang/julia-master/builds/54331#019c30cc-fd0f-4cc6-989c-ef6ae1c5376f/L2692 vs. https://buildkite.com/julialang/julia-master/builds/54334#019c3107-6984-4458-84a3-e78986f9948f/L2482 23.6 KB difference |
vtjnash
left a comment
There was a problem hiding this comment.
This seems like it should work, since it should shove it into the global dict eventually, which we then prune during sysimage generation
b8e3f96 to
069cc99
Compare
This allows `--trim` to safely* prune bindings without dropping the root required for the generated machine code. * uninferred GlobalRefs can lead to missing bindings at runtime, but these do not directly trigger UB / crash and they are relatively rare
069cc99 to
567c6ff
Compare
This allows `--trim` to safely* prune bindings without dropping the root required for the generated machine code. The (significantly more complex) alternative will be to examine the bindings (back)edges during `--trim` serialization and reconstruct the relevant binding dependency edges at that time but that does not seem worth it compared to the 23.6 KB overhead in the sysimage to track these roots explicitly. Resolves #60846. \* As a caveat, uninferred GlobalRefs can lead to missing bindings at runtime, but this is out-of-scope for --trim. (cherry picked from commit 484e7b1)
This allows `--trim` to safely* prune bindings without dropping the root required for the generated machine code. The (significantly more complex) alternative will be to examine the bindings (back)edges during `--trim` serialization and reconstruct the relevant binding dependency edges at that time but that does not seem worth it compared to the 23.6 KB overhead in the sysimage to track these roots explicitly. Resolves #60846. \* As a caveat, uninferred GlobalRefs can lead to missing bindings at runtime, but this is out-of-scope for --trim. (cherry picked from commit 484e7b1)
This allows
--trimto safely* prune bindings without dropping the root required for the generated machine code.Opening this PR with a "simple" solution to get numbers / opinions on the overhead of these extra roots.
The (significantly more complex) alternative will be to examine the bindings (back)edges during
--trimserialization and reconstruct the relevant binding dependency edges at that time. I'll update this PR in-place with that solution if it seems like the right direction to go instead.Resolves #60846.
* As a caveat, uninferred GlobalRefs can lead to missing bindings at runtime, but this is out-of-scope for --trim.