Experimenting with a medium object heap

This commit is contained in:
Justin Ethier 2016-04-12 21:34:18 -04:00
parent 4457cd24c0
commit 89881e901a
3 changed files with 5 additions and 0 deletions

3
gc.c
View file

@ -438,6 +438,8 @@ void *gc_alloc(gc_heap_root *hrt, size_t size, char *obj, gc_thread_data *thd, i
size = gc_heap_align(size);
if (size <= 32){
h = hrt->small_obj_heap;
} else if (size <= 64) {
h = hrt->medium_obj_heap;
} else {
h = hrt->heap;
}
@ -1199,6 +1201,7 @@ fprintf(stderr, "DEBUG - after wait_handshake async\n");
//sweep :
max_freed = gc_sweep(gc_get_heap()->heap, &freed);
max_freed = gc_sweep(gc_get_heap()->small_obj_heap, &freed);
max_freed = gc_sweep(gc_get_heap()->medium_obj_heap, &freed);
total_size = cached_heap_total_size; //gc_heap_total_size(gc_get_heap());
total_free = cached_heap_free_size; //gc_heap_total_free_size(gc_get_heap());

View file

@ -131,6 +131,7 @@ struct gc_heap_t {
typedef struct gc_heap_root_t gc_heap_root;
struct gc_heap_root_t {
gc_heap *small_obj_heap;
gc_heap *medium_obj_heap;
gc_heap *heap;
};

View file

@ -168,6 +168,7 @@ void gc_init_heap(long heap_size)
Cyc_heap = malloc(sizeof(gc_heap_root));
Cyc_heap->heap = gc_heap_create(heap_size, 0, 0);
Cyc_heap->small_obj_heap = gc_heap_create(heap_size, 0, 0);
Cyc_heap->medium_obj_heap = gc_heap_create(heap_size, 0, 0);
if (!ck_hs_init(&symbol_table,
CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,