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

refactor GC scanning code to reflect jl_binding_t are now first class #51035

Merged
merged 4 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2318,19 +2318,10 @@ STATIC_INLINE void gc_mark_excstack(jl_ptls_t ptls, jl_excstack_t *excstack, siz
}

// Mark module binding
STATIC_INLINE void gc_mark_module_binding(jl_ptls_t ptls, jl_module_t *mb_parent, jl_binding_t **mb_begin,
jl_binding_t **mb_end, uintptr_t nptr,
STATIC_INLINE void gc_mark_module_binding(jl_ptls_t ptls, jl_module_t *mb_parent, uintptr_t nptr,
uint8_t bits) JL_NOTSAFEPOINT
{
jl_gc_markqueue_t *mq = &ptls->mark_queue;
for (; mb_begin < mb_end; mb_begin++) {
d-netto marked this conversation as resolved.
Show resolved Hide resolved
jl_binding_t *b = *mb_begin;
if (b == (jl_binding_t *)jl_nothing)
continue;
verify_parent1("module", mb_parent, mb_begin, "binding_buff");
gc_assert_parent_validity((jl_value_t *)mb_parent, (jl_value_t *)b);
gc_try_claim_and_push(mq, b, &nptr);
}
jl_value_t *bindings = (jl_value_t *)jl_atomic_load_relaxed(&mb_parent->bindings);
gc_assert_parent_validity((jl_value_t *)mb_parent, bindings);
gc_try_claim_and_push(mq, bindings, &nptr);
Expand Down Expand Up @@ -2465,9 +2456,7 @@ FORCE_INLINE void gc_mark_outrefs(jl_ptls_t ptls, jl_gc_markqueue_t *mq, void *_
jl_binding_t **table = (jl_binding_t**)jl_svec_data(bindings);
size_t bsize = jl_svec_len(bindings);
uintptr_t nptr = ((bsize + mb_parent->usings.len + 1) << 2) | (bits & GC_OLD);
d-netto marked this conversation as resolved.
Show resolved Hide resolved
jl_binding_t **mb_begin = table + 1;
jl_binding_t **mb_end = table + bsize;
gc_mark_module_binding(ptls, mb_parent, mb_begin, mb_end, nptr, bits);
gc_mark_module_binding(ptls, mb_parent, nptr, bits);
}
else if (vtag == jl_task_tag << 4) {
if (update_meta)
Expand Down
2 changes: 1 addition & 1 deletion src/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ typedef struct _mallocarray_t {

// pool page metadata
typedef struct _jl_gc_pagemeta_t {
// next metadata structre in per-thread list
// next metadata structure in per-thread list
// or in one of the `jl_gc_global_page_pool_t`
struct _jl_gc_pagemeta_t *next;
// index of pool that owns this page
Expand Down