mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 13:05:05 +02:00
Experimenting with a medium object heap
This commit is contained in:
parent
4457cd24c0
commit
89881e901a
3 changed files with 5 additions and 0 deletions
3
gc.c
3
gc.c
|
@ -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);
|
size = gc_heap_align(size);
|
||||||
if (size <= 32){
|
if (size <= 32){
|
||||||
h = hrt->small_obj_heap;
|
h = hrt->small_obj_heap;
|
||||||
|
} else if (size <= 64) {
|
||||||
|
h = hrt->medium_obj_heap;
|
||||||
} else {
|
} else {
|
||||||
h = hrt->heap;
|
h = hrt->heap;
|
||||||
}
|
}
|
||||||
|
@ -1199,6 +1201,7 @@ fprintf(stderr, "DEBUG - after wait_handshake async\n");
|
||||||
//sweep :
|
//sweep :
|
||||||
max_freed = gc_sweep(gc_get_heap()->heap, &freed);
|
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()->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_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());
|
total_free = cached_heap_free_size; //gc_heap_total_free_size(gc_get_heap());
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ struct gc_heap_t {
|
||||||
typedef struct gc_heap_root_t gc_heap_root;
|
typedef struct gc_heap_root_t gc_heap_root;
|
||||||
struct gc_heap_root_t {
|
struct gc_heap_root_t {
|
||||||
gc_heap *small_obj_heap;
|
gc_heap *small_obj_heap;
|
||||||
|
gc_heap *medium_obj_heap;
|
||||||
gc_heap *heap;
|
gc_heap *heap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,7 @@ void gc_init_heap(long heap_size)
|
||||||
Cyc_heap = malloc(sizeof(gc_heap_root));
|
Cyc_heap = malloc(sizeof(gc_heap_root));
|
||||||
Cyc_heap->heap = gc_heap_create(heap_size, 0, 0);
|
Cyc_heap->heap = gc_heap_create(heap_size, 0, 0);
|
||||||
Cyc_heap->small_obj_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,
|
if (!ck_hs_init(&symbol_table,
|
||||||
CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,
|
CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,
|
||||||
|
|
Loading…
Add table
Reference in a new issue