mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-26 23:31:55 -08:00
Eliminating special case of amsinitinternal, since amst can now just use a standard next-method.
Copied from Perforce Change: 191476 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
4be15a5b0b
commit
3f76b36cf4
2 changed files with 14 additions and 51 deletions
|
|
@ -784,6 +784,7 @@ static Res AMSInit(Pool pool, Arena arena, PoolClass klass, ArgList args)
|
|||
Bool supportAmbiguous = AMS_SUPPORT_AMBIGUOUS_DEFAULT;
|
||||
unsigned gen = AMS_GEN_DEFAULT;
|
||||
ArgStruct arg;
|
||||
AMS ams;
|
||||
|
||||
AVER(pool != NULL);
|
||||
AVERT(Arena, arena);
|
||||
|
|
@ -801,45 +802,22 @@ static Res AMSInit(Pool pool, Arena arena, PoolClass klass, ArgList args)
|
|||
if (ArgPick(&arg, args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS))
|
||||
supportAmbiguous = arg.val.b;
|
||||
|
||||
/* .ambiguous.noshare: If the pool is required to support ambiguous */
|
||||
/* references, the alloc and white tables cannot be shared. */
|
||||
res = AMSInitInternal(PoolAMS(pool), arena, klass,
|
||||
chain, gen, !supportAmbiguous, args);
|
||||
if (res == ResOK) {
|
||||
EVENT3(PoolInitAMS, pool, PoolArena(pool), pool->format);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
AVERT(Chain, chain);
|
||||
AVER(gen <= ChainGens(chain));
|
||||
AVER(chain->arena == arena);
|
||||
|
||||
|
||||
/* AMSInitInternal -- initialize an AMS pool, given the format and the chain */
|
||||
|
||||
Res AMSInitInternal(AMS ams, Arena arena, PoolClass klass,
|
||||
Chain chain, unsigned gen,
|
||||
Bool shareAllocTable, ArgList args)
|
||||
{
|
||||
Pool pool;
|
||||
Res res;
|
||||
|
||||
/* Can't check ams, it's not initialized. */
|
||||
pool = AMSPool(ams);
|
||||
|
||||
AVERT(Arena, arena);
|
||||
res = PoolAbsInit(pool, arena, klass, args);
|
||||
if (res != ResOK)
|
||||
goto failAbsInit;
|
||||
AVER(ams == CouldBeA(AMSPool, pool));
|
||||
|
||||
|
||||
AVERT(Chain, chain);
|
||||
AVER(gen <= ChainGens(chain));
|
||||
AVER(chain->arena == PoolArena(pool));
|
||||
ams = CouldBeA(AMSPool, pool);
|
||||
|
||||
/* Ensure a format was supplied in the argument list. */
|
||||
AVER(pool->format != NULL);
|
||||
pool->alignment = pool->format->alignment;
|
||||
ams->grainShift = SizeLog2(PoolAlignment(pool));
|
||||
ams->shareAllocTable = shareAllocTable;
|
||||
/* .ambiguous.noshare: If the pool is required to support ambiguous */
|
||||
/* references, the alloc and white tables cannot be shared. */
|
||||
ams->shareAllocTable = !supportAmbiguous;
|
||||
ams->pgen = NULL;
|
||||
|
||||
RingInit(&ams->segRing);
|
||||
|
|
@ -859,6 +837,8 @@ Res AMSInitInternal(AMS ams, Arena arena, PoolClass klass,
|
|||
goto failGenInit;
|
||||
ams->pgen = &ams->pgenStruct;
|
||||
|
||||
EVENT3(PoolInitAMS, pool, PoolArena(pool), pool->format);
|
||||
|
||||
return ResOK;
|
||||
|
||||
failGenInit:
|
||||
|
|
|
|||
|
|
@ -314,31 +314,14 @@ static Res AMSTSegSizePolicy(Size *sizeReturn,
|
|||
|
||||
static Res AMSTInit(Pool pool, Arena arena, PoolClass klass, ArgList args)
|
||||
{
|
||||
AMST amst; AMS ams;
|
||||
Chain chain;
|
||||
AMST amst;
|
||||
AMS ams;
|
||||
Res res;
|
||||
unsigned gen = AMS_GEN_DEFAULT;
|
||||
ArgStruct arg;
|
||||
|
||||
AVER(pool != NULL);
|
||||
AVERT(Arena, arena);
|
||||
AVERT(ArgList, args);
|
||||
UNUSED(klass); /* used for debug pools only */
|
||||
|
||||
if (ArgPick(&arg, args, MPS_KEY_CHAIN))
|
||||
chain = arg.val.chain;
|
||||
else {
|
||||
chain = ArenaGlobals(arena)->defaultChain;
|
||||
gen = 1; /* avoid the nursery of the default chain by default */
|
||||
}
|
||||
if (ArgPick(&arg, args, MPS_KEY_GEN))
|
||||
gen = arg.val.u;
|
||||
|
||||
/* FIXME: Generalise to next-method call */
|
||||
res = AMSInitInternal(PoolAMS(pool), arena, klass,
|
||||
chain, gen, FALSE, args);
|
||||
res = NextMethod(Pool, AMSTPool, init)(pool, arena, klass, args);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
amst = CouldBeA(AMSTPool, pool);
|
||||
ams = MustBeA(AMSPool, pool);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue