Skip to content

Commit

Permalink
resize of chunk-queues
Browse files Browse the repository at this point in the history
  • Loading branch information
d-netto committed Feb 12, 2023
1 parent 9be0e86 commit 5642dac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/gc-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ static void gc_verify_track(jl_ptls_t ptls)
jl_gc_markqueue_t mq;
jl_gc_markqueue_t *mq2 = &ptls->mark_queue;
ws_anchor_t anc = {0, 0};
ws_queue *cq = &mq.cq;
ws_queue_t *cq = &mq.cq;
ws_queue_t *q = &mq.q;
jl_atomic_store_relaxed(&cq->anchor, anc);
jl_atomic_store_relaxed(&cq->array, &mq2->cq.array);
jl_atomic_store_relaxed(&cq->array, jl_atomic_load_relaxed(&mq2->cq.array));
jl_atomic_store_relaxed(&q->anchor, anc);
jl_atomic_store_relaxed(&q->array, &mq2->q.array);
jl_atomic_store_relaxed(&q->array, jl_atomic_load_relaxed(&mq2->q.array));
arraylist_new(&mq.reclaim_set, 32);
arraylist_push(&lostval_parents_done, lostval);
jl_safe_printf("Now looking for %p =======\n", lostval);
Expand Down Expand Up @@ -259,12 +259,12 @@ void gc_verify(jl_ptls_t ptls)
jl_gc_markqueue_t mq;
jl_gc_markqueue_t *mq2 = &ptls->mark_queue;
ws_anchor_t anc = {0, 0};
ws_queue *cq = &mq.cq;
ws_queue_t *cq = &mq.cq;
ws_queue_t *q = &mq.q;
jl_atomic_store_relaxed(&cq->anchor, anc);
jl_atomic_store_relaxed(&cq->array, &mq2->cq.array);
jl_atomic_store_relaxed(&cq->array, jl_atomic_load_relaxed(&mq2->cq.array));
jl_atomic_store_relaxed(&q->anchor, anc);
jl_atomic_store_relaxed(&q->array, &mq2->q.array);
jl_atomic_store_relaxed(&q->array, jl_atomic_load_relaxed(&mq2->q.array));
arraylist_new(&mq.reclaim_set, 32);
lostval = NULL;
lostval_parents.len = 0;
Expand Down
8 changes: 6 additions & 2 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1817,8 +1817,12 @@ STATIC_INLINE void gc_chunkqueue_push(jl_gc_markqueue_t *mq, jl_gc_chunk_t *c) J
ws_anchor_t anc = jl_atomic_load_acquire(&cq->anchor);
ws_array_t *ary = jl_atomic_load_relaxed(&cq->array);
if (anc.tail == ary->capacity) {
jl_safe_printf("Chunk queue overflow\n");
abort();
// Resize queue
ws_array_t *new_ary = create_ws_array(2 * ary->capacity, sizeof(jl_gc_chunk_t));
memcpy(new_ary->buffer, ary->buffer, anc.tail * sizeof(jl_gc_chunk_t));
jl_atomic_store_relaxed(&cq->array, new_ary);
arraylist_push(&mq->reclaim_set, ary);
ary = new_ary;
}
((jl_gc_chunk_t *)ary->buffer)[anc.tail] = *c;
anc.tail++;
Expand Down
2 changes: 1 addition & 1 deletion src/work-stealing-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef struct {
int64_t capacity;
} ws_array_t;

static inline ws_array_t *create_ws_array(size_t capacity, size_t eltsz)
static inline ws_array_t *create_ws_array(size_t capacity, size_t eltsz) JL_NOTSAFEPOINT
{
ws_array_t *a = (ws_array_t *)malloc_s(sizeof(ws_array_t));
a->buffer = (void **)malloc_s(capacity * eltsz);
Expand Down

0 comments on commit 5642dac

Please sign in to comment.