Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing GC write barrier in jl_reserve_excstack #51096

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

qinsoon
Copy link
Contributor

@qinsoon qinsoon commented Aug 29, 2023

jl_push_excstack and jl_reserve_excstack take an address to the field excstack in jl_task_t, and may update the field. In such a case, a GC write barrier is needed. This PR adds the missing write barrier.

Note: I am not sure if this affects the correctness of Julia GC or not. This could be special cased in the GC code, as the task is always rooted. However, generally if the task is in the old generation, it does not have to be scanned even if it is a root. A write barrier is needed to make sure the GC is aware of the update.

@vtjnash
Copy link
Member

vtjnash commented Aug 30, 2023

There is special handling in GC for Task which keeps it in the remset:

julia/src/gc.c

Lines 2517 to 2518 in f9792b4

// assume tasks always reference young objects: set lowest bit
uintptr_t nptr = (npointers << 2) | 1 | bits;

We should probably try to tighten that up though, and actually track that accurately.

@vtjnash vtjnash merged commit 197180d into JuliaLang:master Aug 30, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants