1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 15:00:45 -08:00

Turn off the hysteresis on the mvff pool so that we are testing the arena hysteresis only.

Copied from Perforce
 Change: 187175
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-10-10 12:08:12 +01:00
parent ae4328ad5a
commit 5cf7a4aa4e

View file

@ -9,7 +9,7 @@ TEST_HEADER
OUTPUT_SPEC
reduce1 > 4000000
reduce2 <= 0
reduce3 > 4000000
reduce3 > 3000000
completed = yes
END_HEADER
*/
@ -18,9 +18,6 @@ END_HEADER
#include "mpscmvff.h"
#include "mpsavm.h"
#define MVFF_HI_PARMS EXTEND,AVGSIZE,MPS_PF_ALIGN,1,1,0
#define MVFF_LO_PARMS EXTEND,AVGSIZE,MPS_PF_ALIGN,0,0,1
mps_arena_t arena;
#define MAXOBJS (10000)
@ -30,7 +27,7 @@ mps_addr_t sizes[MAXOBJS];
static void test(void)
{
mps_pool_t poolhi, poollo;
mps_pool_t pool;
mps_thr_t thread;
unsigned long com0, com1, com2;
@ -46,20 +43,25 @@ static void test(void)
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&poolhi, arena, mps_class_mvff(), MVFF_HI_PARMS),
"create high pool");
cdie(
mps_pool_create(&poollo, arena, mps_class_mvff(), MVFF_LO_PARMS),
"create low pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, EXTEND);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, AVGSIZE);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, 0);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, 0);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, 1);
/* Set SPARE to 0 as we are testing arena hysteresis here and we
don't want MVFF hysteresis to get in the way. */
MPS_ARGS_ADD(args, MPS_KEY_SPARE, 0.0);
cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), args),
"create low pool");
} MPS_ARGS_END(args);
/* Set the spare commit limit to 0MB */
mps_arena_spare_commit_limit_set(arena, (size_t) 0);
die(mps_alloc(&objs[0], poollo, BIGSIZE), "alloc");
die(mps_alloc(&objs[0], pool, BIGSIZE), "alloc");
com0 = mps_arena_committed(arena);
mps_free(poollo, objs[0], BIGSIZE);
mps_free(pool, objs[0], BIGSIZE);
com1 = mps_arena_committed(arena);
/* the free should have reduced the total amount committed */
@ -69,9 +71,9 @@ static void test(void)
/* nb. size_t unsigned, therefore (size_t)-1 is the maximum limit */
mps_arena_spare_commit_limit_set(arena, (size_t)-1);
die(mps_alloc(&objs[0], poollo, BIGSIZE), "alloc");
die(mps_alloc(&objs[0], pool, BIGSIZE), "alloc");
com0 = mps_arena_committed(arena);
mps_free(poollo, objs[0], BIGSIZE);
mps_free(pool, objs[0], BIGSIZE);
com1 = mps_arena_committed(arena);
/* This time the free shouldn't make any difference */
@ -81,16 +83,10 @@ static void test(void)
mps_arena_spare_commit_limit_set(arena, (size_t)(1024*1024));
com2 = mps_arena_committed(arena);
report("reduce3", "%ld", com0-com2);
comment("Finishing off.");
mps_pool_destroy(poolhi);
mps_pool_destroy(poollo);
mps_pool_destroy(pool);
comment("Destroyed pool.");
mps_thread_dereg(thread);