From 00027c45be548e9f14a6ec9caafea16a199c8ce2 Mon Sep 17 00:00:00 2001 From: Stephen Dolan Date: Fri, 6 Mar 2020 16:08:43 +0000 Subject: [PATCH] flambda-backend: permanent/default-to-best-fit (cherry-pick 64240fd716a9d0db57d779ebe5b6f1a67704cdec) Change the default policy to best-fit and space overhead to 100 --- runtime/caml/config.h | 2 +- runtime/freelist.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/caml/config.h b/runtime/caml/config.h index 2976853a1dea..657462a2609c 100644 --- a/runtime/caml/config.h +++ b/runtime/caml/config.h @@ -240,7 +240,7 @@ typedef uint64_t uintnat; /* Default speed setting for the major GC. The heap will grow until the dead objects and the free list represent this percentage of the total size of live objects. */ -#define Percent_free_def 80 +#define Percent_free_def 100 /* Default setting for the compacter: 500% (i.e. trigger the compacter when 5/6 of the heap is free or garbage) diff --git a/runtime/freelist.c b/runtime/freelist.c index 66bcca3b4fbc..1c78c68e2d05 100644 --- a/runtime/freelist.c +++ b/runtime/freelist.c @@ -1754,7 +1754,7 @@ enum { policy_best_fit = 2, }; -uintnat caml_allocation_policy = policy_next_fit; +uintnat caml_allocation_policy = policy_best_fit; /********************* exported functions *****************************/ @@ -1763,25 +1763,25 @@ uintnat caml_allocation_policy = policy_next_fit; [caml_fl_allocate] returns a head pointer, or NULL if no suitable block is found in the free set. */ -header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz) = &nf_allocate; +header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz) = &bf_allocate; /* Initialize the merge_block machinery (at start of sweeping). */ -void (*caml_fl_p_init_merge) (void) = &nf_init_merge; +void (*caml_fl_p_init_merge) (void) = &bf_init_merge; /* These are called internally. */ -static void (*caml_fl_p_init) (void) = &nf_init; -static void (*caml_fl_p_reset) (void) = &nf_reset; +static void (*caml_fl_p_init) (void) = &bf_init; +static void (*caml_fl_p_reset) (void) = &bf_reset; /* [caml_fl_merge_block] returns the head pointer of the next block after [bp], because merging blocks may change the size of [bp]. */ -header_t *(*caml_fl_p_merge_block) (value bp, char *limit) = &nf_merge_block; +header_t *(*caml_fl_p_merge_block) (value bp, char *limit) = &bf_merge_block; /* [bp] must point to a list of blocks of wosize >= 1 chained by their field 0, terminated by Val_NULL, and field 1 of the first block must point to the last block. The blocks must be blue. */ -void (*caml_fl_p_add_blocks) (value bp) = &nf_add_blocks; +void (*caml_fl_p_add_blocks) (value bp) = &bf_add_blocks; /* Cut a block of memory into pieces of size [Max_wosize], give them headers, and optionally merge them into the free list. @@ -1795,9 +1795,9 @@ void (*caml_fl_p_add_blocks) (value bp) = &nf_add_blocks; */ void (*caml_fl_p_make_free_blocks) (value *p, mlsize_t size, int do_merge, int color) - = &nf_make_free_blocks; + = &bf_make_free_blocks; #ifdef DEBUG -void (*caml_fl_p_check) (void) = &nf_check; +void (*caml_fl_p_check) (void) = &bf_check; #endif void caml_set_allocation_policy (intnat p)