From e02a69f88b01ca711f6a651c8e932b07cd27fa0c Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Wed, 29 Jan 2014 17:15:31 +0000 Subject: [PATCH] =?UTF-8?q?The=20awl=20and=20lo=20pools=20were=20allocatin?= =?UTF-8?q?g=20their=20segments=20along=20with=20other=20pool=E2=80=99s=20?= =?UTF-8?q?generation=201,=20while=20accounting=20sizes=20into=20generatio?= =?UTF-8?q?n=200.=20=20in=20fact,=20this=20=E2=80=9Cgeneration=201?= =?UTF-8?q?=E2=80=9D=20was=20really=20a=20kind=20of=20placement=20?= =?UTF-8?q?=E2=80=9Cclump=E2=80=9D=20and=20the=20segments=20really=20lived?= =?UTF-8?q?=20in=20generation=200.=20=20however,=20this=20confused=20the?= =?UTF-8?q?=20new=20chainalloc=20because=20there=20are=20no=20longer=20any?= =?UTF-8?q?=20=E2=80=9Cclumps=E2=80=9D=20maintained=20by=20the=20arena,=20?= =?UTF-8?q?causing=20awlut=20to=20fail.=20=20fixed=20awl=20and=20lo=20to?= =?UTF-8?q?=20be=20truthful=20about=20the=20generation=20they=E2=80=99re?= =?UTF-8?q?=20allocating=20in.=20=20placement=20concerns=20have=20been=20r?= =?UTF-8?q?emoved.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copied from Perforce Change: 184220 ServerID: perforce.ravenbrook.com --- mps/code/locus.c | 1 + mps/code/poolawl.c | 11 ++--------- mps/code/poollo.c | 9 +++------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/mps/code/locus.c b/mps/code/locus.c index e3cbef3a8a2..c826cbe71d8 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -342,6 +342,7 @@ Res ChainCondemnAuto(double *mortalityReturn, Chain chain, Trace trace) genNewSize = GenDescNewSize(gen); } while (genNewSize >= gen->capacity * (Size)1024); + AVER(condemnedSet != ZoneSetEMPTY || condemnedSize == 0); EVENT3(ChainCondemnAuto, chain, topCondemnedGenSerial, chain->genCount); UNUSED(topCondemnedGenSerial); /* only used for EVENT */ diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index d3245b265d7..4dbd659cb27 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -48,9 +48,6 @@ SRCID(poolawl, "$Id$"); #define AWLSig ((Sig)0x519B7A37) /* SIGnature PooL AWL */ -#define AWLGen ((Serial)1) /* "generation" for AWL pools */ -/* This and the dynamic criterion are the only ways AWL will get collected. */ - /* awlStat* -- Statistics gathering about instruction emulation * @@ -90,7 +87,6 @@ typedef struct AWLStruct { Chain chain; /* dummy chain */ PoolGenStruct pgen; /* generation representing the pool */ Size size; /* allocated size in bytes */ - Serial gen; /* associated generation (for SegAlloc) */ Count succAccesses; /* number of successive single accesses */ FindDependentMethod findDependent; /* to find a dependent object */ awlStatTotalStruct stats; @@ -470,9 +466,10 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn, if (size == 0) return ResMEMORY; MPS_ARGS_BEGIN(args) { + Serial gen = 0; /* AWL only has one generation in its chain */ MPS_ARGS_ADD_FIELD(args, awlKeySegRankSet, u, rankSet); MPS_ARGS_DONE(args); - res = ChainAlloc(&seg, awl->chain, awl->gen, AWLSegClassGet(), + res = ChainAlloc(&seg, awl->chain, gen, AWLSegClassGet(), size, pool, reservoirPermit, args); } MPS_ARGS_END(args); if (res != ResOK) @@ -569,7 +566,6 @@ static Res AWLInit(Pool pool, ArgList args) goto failGenInit; awl->alignShift = SizeLog2(pool->alignment); - awl->gen = AWLGen; awl->size = (Size)0; awl->succAccesses = 0; @@ -1300,9 +1296,6 @@ static Bool AWLCheck(AWL awl) CHECKL(awl->poolStruct.class == AWLPoolClassGet()); CHECKL((Align)1 << awl->alignShift == awl->poolStruct.alignment); CHECKD(Chain, awl->chain); - CHECKL(NONNEGATIVE(awl->gen)); - /* 30 is just a sanity check really, not a constraint. */ - CHECKL(awl->gen <= 30); /* Nothing to check about succAccesses. */ CHECKL(FUNCHECK(awl->findDependent)); /* Don't bother to check stats. */ diff --git a/mps/code/poollo.c b/mps/code/poollo.c index 971c83ea556..1d1077145a0 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -15,9 +15,6 @@ SRCID(poollo, "$Id$"); -#define LOGen ((Serial)1) - - /* LOStruct -- leaf object pool instance structure */ #define LOSig ((Sig)0x51970B07) /* SIGnature LO POoL */ @@ -27,7 +24,6 @@ typedef struct LOStruct *LO; typedef struct LOStruct { PoolStruct poolStruct; /* generic pool structure */ Shift alignShift; /* log_2 of pool alignment */ - Serial gen; /* generation for placement */ Chain chain; /* chain used by this pool */ PoolGenStruct pgen; /* generation representing the pool */ Sig sig; @@ -286,6 +282,7 @@ static Res loSegCreate(LOSeg *loSegReturn, Pool pool, Size size, LO lo; Seg seg; Res res; + Serial gen; AVER(loSegReturn != NULL); AVERT(Pool, pool); @@ -294,7 +291,8 @@ static Res loSegCreate(LOSeg *loSegReturn, Pool pool, Size size, lo = PoolPoolLO(pool); AVERT(LO, lo); - res = ChainAlloc(&seg, lo->chain, lo->gen, EnsureLOSegClass(), + gen = 0; /* LO only has one generation in its chain */ + res = ChainAlloc(&seg, lo->chain, gen, EnsureLOSegClass(), SizeAlignUp(size, ArenaAlign(PoolArena(pool))), pool, withReservoirPermit, argsNone); if (res != ResOK) @@ -494,7 +492,6 @@ static Res LOInit(Pool pool, ArgList args) lo->poolStruct.alignment = format->alignment; lo->alignShift = SizeLog2((Size)PoolAlignment(&lo->poolStruct)); - lo->gen = LOGen; /* may be modified in debugger */ res = ChainCreate(&lo->chain, arena, 1, &loGenParam); if (res != ResOK) return res;