Skip to content

Commit 00027c4

Browse files
stedolanpoechsel
authored andcommitted
flambda-backend: permanent/default-to-best-fit (cherry-pick 64240fd716a9d0db57d779ebe5b6f1a67704cdec)
Change the default policy to best-fit and space overhead to 100
1 parent 2561dd9 commit 00027c4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

runtime/caml/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ typedef uint64_t uintnat;
240240
/* Default speed setting for the major GC. The heap will grow until
241241
the dead objects and the free list represent this percentage of the
242242
total size of live objects. */
243-
#define Percent_free_def 80
243+
#define Percent_free_def 100
244244

245245
/* Default setting for the compacter: 500%
246246
(i.e. trigger the compacter when 5/6 of the heap is free or garbage)

runtime/freelist.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,7 @@ enum {
17541754
policy_best_fit = 2,
17551755
};
17561756

1757-
uintnat caml_allocation_policy = policy_next_fit;
1757+
uintnat caml_allocation_policy = policy_best_fit;
17581758

17591759
/********************* exported functions *****************************/
17601760

@@ -1763,25 +1763,25 @@ uintnat caml_allocation_policy = policy_next_fit;
17631763
[caml_fl_allocate] returns a head pointer, or NULL if no suitable block
17641764
is found in the free set.
17651765
*/
1766-
header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz) = &nf_allocate;
1766+
header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz) = &bf_allocate;
17671767

17681768
/* Initialize the merge_block machinery (at start of sweeping). */
1769-
void (*caml_fl_p_init_merge) (void) = &nf_init_merge;
1769+
void (*caml_fl_p_init_merge) (void) = &bf_init_merge;
17701770

17711771
/* These are called internally. */
1772-
static void (*caml_fl_p_init) (void) = &nf_init;
1773-
static void (*caml_fl_p_reset) (void) = &nf_reset;
1772+
static void (*caml_fl_p_init) (void) = &bf_init;
1773+
static void (*caml_fl_p_reset) (void) = &bf_reset;
17741774

17751775
/* [caml_fl_merge_block] returns the head pointer of the next block after [bp],
17761776
because merging blocks may change the size of [bp]. */
1777-
header_t *(*caml_fl_p_merge_block) (value bp, char *limit) = &nf_merge_block;
1777+
header_t *(*caml_fl_p_merge_block) (value bp, char *limit) = &bf_merge_block;
17781778

17791779
/* [bp] must point to a list of blocks of wosize >= 1 chained by their field 0,
17801780
terminated by Val_NULL, and field 1 of the first block must point to
17811781
the last block.
17821782
The blocks must be blue.
17831783
*/
1784-
void (*caml_fl_p_add_blocks) (value bp) = &nf_add_blocks;
1784+
void (*caml_fl_p_add_blocks) (value bp) = &bf_add_blocks;
17851785

17861786
/* Cut a block of memory into pieces of size [Max_wosize], give them headers,
17871787
and optionally merge them into the free list.
@@ -1795,9 +1795,9 @@ void (*caml_fl_p_add_blocks) (value bp) = &nf_add_blocks;
17951795
*/
17961796
void (*caml_fl_p_make_free_blocks)
17971797
(value *p, mlsize_t size, int do_merge, int color)
1798-
= &nf_make_free_blocks;
1798+
= &bf_make_free_blocks;
17991799
#ifdef DEBUG
1800-
void (*caml_fl_p_check) (void) = &nf_check;
1800+
void (*caml_fl_p_check) (void) = &bf_check;
18011801
#endif
18021802

18031803
void caml_set_allocation_policy (intnat p)

0 commit comments

Comments
 (0)