From 9bcdd3537092c06a1d7f7afe0fd91f72f2c4c4e0 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 20 Apr 2016 22:07:14 -0400 Subject: [PATCH] Added more GC constants --- gc.c | 2 +- include/cyclone/types.h | 6 ++++-- runtime.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gc.c b/gc.c index d5cddfc4..bbfd90f9 100644 --- a/gc.c +++ b/gc.c @@ -393,7 +393,7 @@ int gc_grow_heap(gc_heap *h, int heap_type, size_t size, size_t chunk_size) // so for now it is not used. If it is used again, the initial heaps will // need to start at a lower size (EG 1 MB). { - size_t prev_size = 2 * 1024 * 1024; + size_t prev_size = GROW_HEAP_BY_SIZE; new_size = 0; h_last = h; while (h_last->next) { diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 5a7dff31..b6b943ce 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -28,8 +28,10 @@ // This is used as the first generation of the GC. #define STACK_SIZE 500000 -// Size of a "page" on the heap (the second generation), in bytes. -#define HEAP_SIZE (16 * 1024 * 1024) +// Parameters for size of a "page" on the heap (the second generation GC), in bytes. +#define GROW_HEAP_BY_SIZE (2 * 1024 * 1024) // Grow first page by adding this amount to it +#define INITIAL_HEAP_SIZE (3 * 1024 * 1024) // Size of the first page +#define HEAP_SIZE (16 * 1024 * 1024) // Normal size of a page ///////////////////////////// // Major GC tuning parameters diff --git a/runtime.c b/runtime.c index 099f8928..c7706e17 100644 --- a/runtime.c +++ b/runtime.c @@ -159,7 +159,7 @@ static bool set_insert(ck_hs_t *hs, const void *value) void gc_init_heap(long heap_size) { - size_t initial_heap_size = 3 * 1024 * 1024; + size_t initial_heap_size = INITIAL_HEAP_SIZE; Cyc_heap = malloc(sizeof(gc_heap_root)); Cyc_heap->heap = gc_heap_create(HEAP_REST, initial_heap_size, 0, 0); Cyc_heap->small_obj_heap = gc_heap_create(HEAP_SM, initial_heap_size, 0, 0);