mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
copy-space: refactor to copy_space_can_allocate
This commit is contained in:
parent
68e3a692f5
commit
b517464d7f
2 changed files with 6 additions and 6 deletions
|
@ -567,16 +567,16 @@ copy_space_finish_gc(struct copy_space *space, int is_minor_gc) {
|
|||
space->in_gc = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
static size_t
|
||||
copy_space_can_allocate(struct copy_space *space, size_t bytes) {
|
||||
// With lock!
|
||||
size_t count = 0;
|
||||
for (struct copy_space_block *empties = space->empty.list.head;
|
||||
empties;
|
||||
empties && count < bytes;
|
||||
empties = empties->next) {
|
||||
if (bytes <= COPY_SPACE_REGION_SIZE) return 1;
|
||||
bytes -= COPY_SPACE_REGION_SIZE;
|
||||
count += COPY_SPACE_REGION_SIZE;
|
||||
}
|
||||
return 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -813,7 +813,7 @@ heap_can_minor_gc(struct gc_heap *heap) {
|
|||
struct copy_space *new_space = heap_new_space(heap);
|
||||
struct copy_space *old_space = heap_old_space(heap);
|
||||
size_t nursery_size = heap_nursery_size(heap);
|
||||
return copy_space_can_allocate(old_space, nursery_size);
|
||||
return copy_space_can_allocate(old_space, nursery_size) >= nursery_size;
|
||||
}
|
||||
|
||||
static enum gc_collection_kind
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue