mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-27 21:40:34 +02:00
Merge remote-tracking branch 'whippet/main' into wip-whippet
This commit is contained in:
commit
975860e5e2
7 changed files with 54 additions and 65 deletions
|
@ -65,7 +65,6 @@ struct gc_heap {
|
|||
|
||||
struct gc_mutator {
|
||||
void *freelists[GC_INLINE_FREELIST_COUNT];
|
||||
void *pointerless_freelists[GC_INLINE_FREELIST_COUNT];
|
||||
struct gc_heap *heap;
|
||||
struct gc_mutator_roots *roots;
|
||||
struct gc_mutator *next; // with heap lock
|
||||
|
@ -122,9 +121,7 @@ allocate_small(void **freelist, size_t idx, enum gc_inline_kind kind) {
|
|||
}
|
||||
|
||||
*freelist = *(void **)(head);
|
||||
|
||||
if (kind == GC_INLINE_KIND_POINTERLESS)
|
||||
memset(head, 0, gc_inline_freelist_object_size(idx));
|
||||
*(void**)head = NULL;
|
||||
|
||||
return head;
|
||||
}
|
||||
|
@ -133,42 +130,39 @@ void* gc_allocate_slow(struct gc_mutator *mut, size_t size,
|
|||
enum gc_allocation_kind kind) {
|
||||
GC_ASSERT(size != 0);
|
||||
if (size <= gc_allocator_large_threshold()) {
|
||||
size_t idx = gc_inline_bytes_to_freelist_index(size);
|
||||
void **freelists;
|
||||
enum gc_inline_kind freelist_kind;
|
||||
switch (kind) {
|
||||
case GC_ALLOCATION_TAGGED:
|
||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE:
|
||||
return allocate_small(&mut->freelists[idx], idx, GC_INLINE_KIND_NORMAL);
|
||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
||||
return allocate_small(&mut->pointerless_freelists[idx], idx,
|
||||
GC_INLINE_KIND_POINTERLESS);
|
||||
default:
|
||||
GC_CRASH();
|
||||
}
|
||||
} else {
|
||||
switch (kind) {
|
||||
case GC_ALLOCATION_TAGGED:
|
||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE: {
|
||||
void *ret = GC_malloc(size);
|
||||
if (GC_LIKELY (ret != NULL))
|
||||
return ret;
|
||||
return __the_bdw_gc_heap->allocation_failure(__the_bdw_gc_heap, size);
|
||||
size_t idx = gc_inline_bytes_to_freelist_index(size);
|
||||
return allocate_small(&mut->freelists[idx], idx, GC_INLINE_KIND_NORMAL);
|
||||
}
|
||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS: {
|
||||
void *ret = GC_malloc_atomic(size);
|
||||
if (GC_LIKELY (ret != NULL)) {
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
return __the_bdw_gc_heap->allocation_failure(__the_bdw_gc_heap, size);
|
||||
}
|
||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS:
|
||||
break;
|
||||
default:
|
||||
GC_CRASH();
|
||||
}
|
||||
}
|
||||
switch (kind) {
|
||||
case GC_ALLOCATION_TAGGED:
|
||||
case GC_ALLOCATION_UNTAGGED_CONSERVATIVE: {
|
||||
void *ret = GC_malloc(size);
|
||||
if (GC_LIKELY (ret != NULL))
|
||||
return ret;
|
||||
return __the_bdw_gc_heap->allocation_failure(__the_bdw_gc_heap, size);
|
||||
}
|
||||
case GC_ALLOCATION_TAGGED_POINTERLESS:
|
||||
case GC_ALLOCATION_UNTAGGED_POINTERLESS: {
|
||||
void *ret = GC_malloc_atomic(size);
|
||||
if (GC_LIKELY (ret != NULL)) {
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
return __the_bdw_gc_heap->allocation_failure(__the_bdw_gc_heap, size);
|
||||
}
|
||||
default:
|
||||
GC_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
void gc_pin_object(struct gc_mutator *mut, struct gc_ref ref) {
|
||||
|
@ -399,18 +393,7 @@ mark_mutator(GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
|
|||
return state.mark_stack_ptr;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GC_INLINE_FREELIST_COUNT; i++)
|
||||
state.mark_stack_ptr = GC_MARK_AND_PUSH (mut->freelists[i],
|
||||
state.mark_stack_ptr,
|
||||
state.mark_stack_limit,
|
||||
NULL);
|
||||
|
||||
for (int i = 0; i < GC_INLINE_FREELIST_COUNT; i++)
|
||||
for (void *head = mut->pointerless_freelists[i]; head; head = *(void**)head)
|
||||
state.mark_stack_ptr = GC_MARK_AND_PUSH (head,
|
||||
state.mark_stack_ptr,
|
||||
state.mark_stack_limit,
|
||||
NULL);
|
||||
memset(mut->freelists, 0, sizeof(void*) * GC_INLINE_FREELIST_COUNT);
|
||||
|
||||
if (mut->roots)
|
||||
gc_trace_mutator_roots(mut->roots, bdw_mark_edge, mut->heap, &state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue