julia_gc: include julia.h globally for better CHANGED_BAG - #6490
Draft
fingolfin wants to merge 2 commits into
Draft
julia_gc: include julia.h globally for better CHANGED_BAG#6490fingolfin wants to merge 2 commits into
julia.h globally for better CHANGED_BAG#6490fingolfin wants to merge 2 commits into
Conversation
CHANGED_BAG is supposed to have minimal overhead, which normally is achieved by inlining it. But we never had this for the Julia GC, mainly because it was painful to do so in our C++ source files. This PR addresses this. As a side effect, this enables future work I have planned that will need the Julia headers globally.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6490 +/- ##
=======================================
Coverage 79.03% 79.03%
=======================================
Files 685 685
Lines 293790 293793 +3
Branches 8664 8642 -22
=======================================
+ Hits 232203 232206 +3
Misses 59786 59786
Partials 1801 1801 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
fingolfin
marked this pull request as draft
August 5, 2026 21:23
Inlining `CHANGED_BAG` by calling `jl_gc_wb_back` does not work: Julia declares that function `static inline`, and C forbids referencing an identifier with internal linkage from an inline function with external linkage. Making `CHANGED_BAG` itself `static inline` is not an option either, as it is used by other `EXPORT_INLINE` functions, which then run into the very same problem; and turning all of those into `static inline` would drop symbols from libgap which GAP.jl relies on. So instead inline a copy of Julia's write barrier, which only refers to `jl_gc_queue_root`. Since src/gasman.h now includes julia.h, packages need the Julia headers as well, so pass them on via sysinfo.gap. The flags reported by julia-config.jl are quoted, which does not survive the way sysinfo.gap is consumed, hence strip the quotes; and resolve the clash between Julia's `FORCE_INLINE` and the one used by our copy of MurmurHash3. AI disclosure: Claude Code (Opus 5) diagnosed the build failures, drafted the changes, and verified them locally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
This may need some more refining... |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGED_BAGis supposed to have minimal overhead, which normally is achieved by inlining it. But we never had this for the Julia GC, mainly because it was painful to do so in our C++ source files. This PR addresses this.As a side effect, this enables future work I have planned that will need the Julia headers globally.
Note that
CHANGED_BAGcannot simply calljl_gc_wb_back: Julia declares that asstatic inline, and C forbids referencing an identifier with internal linkage from an inline function with external linkage. MarkingCHANGED_BAGasstatic inlineinstead is not an option either, as it is used by otherEXPORT_INLINEfunctions (such asPushPlist), which then run into the very same problem. So we inline a copy of Julia's write barrier, which only refers tojl_gc_queue_root.Since
src/gasman.hnow includesjulia.h, all GAP kernel extensions need the Julia headers, too, so we pass those on to packages viasysinfo.gap. TheJULIA=yesCI job now also runstestmockpkgto catch regressions here.This also means that macros defined by
julia.hcan now clash with code in kernel extensions. One such clash affects GAP.jl'sJuliaInterface, which declaresjl_n_threadsitself; theCI with GAP.jljobs will therefore keep failing until oscar-system/GAP.jl#1412 has been merged.