mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-15 10:10:21 +02:00
mark-sweep: mutator data structure separate from heap
This will allow thread-local allocation buffers.
This commit is contained in:
parent
61d38e4205
commit
2401732e31
1 changed files with 10 additions and 7 deletions
17
mark-sweep.h
17
mark-sweep.h
|
@ -116,12 +116,12 @@ struct context {
|
|||
struct mark_space { struct context cx; };
|
||||
struct heap { struct mark_space mark_space; };
|
||||
struct mutator {
|
||||
struct heap heap;
|
||||
struct heap *heap;
|
||||
struct handle *roots;
|
||||
};
|
||||
|
||||
static inline struct heap* mutator_heap(struct mutator *mut) {
|
||||
return &mut->heap;
|
||||
return mut->heap;
|
||||
}
|
||||
static inline struct mark_space* heap_mark_space(struct heap *heap) {
|
||||
return &heap->mark_space;
|
||||
|
@ -472,11 +472,9 @@ static int initialize_gc(size_t size, struct heap **heap,
|
|||
return 0;
|
||||
}
|
||||
|
||||
*mut = calloc(1, sizeof(struct mutator));
|
||||
if (!*mut) abort();
|
||||
(*mut)->roots = NULL;
|
||||
*heap = mutator_heap(*mut);
|
||||
struct mark_space *space = mutator_mark_space(*mut);
|
||||
*heap = calloc(1, sizeof(struct heap));
|
||||
if (!*heap) abort();
|
||||
struct mark_space *space = heap_mark_space(*heap);
|
||||
struct context *cx = &space->cx;
|
||||
|
||||
cx->mem = mem;
|
||||
|
@ -501,6 +499,11 @@ static int initialize_gc(size_t size, struct heap **heap,
|
|||
abort();
|
||||
reclaim(cx, (void*)cx->heap_base, size_to_granules(cx->heap_size));
|
||||
|
||||
*mut = calloc(1, sizeof(struct mutator));
|
||||
if (!*mut) abort();
|
||||
(*mut)->heap = *heap;
|
||||
(*mut)->roots = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue