1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 05:01:02 -08:00

Assert if you try to create a pool using a format from another arena, a pool using a chain from another arena, or a root using a thread from another arena.

Copied from Perforce
 Change: 187268
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-10-14 22:21:43 +01:00
parent 0c42e3aa23
commit d4b8907389
7 changed files with 18 additions and 4 deletions

View file

@ -844,7 +844,9 @@ static Res amcInitComm(Pool pool, RankSet rankSet, ArgList args)
largeSize = arg.val.size;
AVERT(Format, pool->format);
AVER(FormatArena(pool->format) == arena);
AVERT(Chain, chain);
AVER(chain->arena == arena);
AVER(extendBy > 0);
AVER(largeSize > 0);
/* TODO: it would be nice to be able to manage large objects that

View file

@ -831,13 +831,15 @@ Res AMSInitInternal(AMS ams, Format format, Chain chain, unsigned gen,
Res res;
/* Can't check ams, it's not initialized. */
AVERT(Format, format);
AVERT(Chain, chain);
AVER(gen <= ChainGens(chain));
pool = AMSPool(ams);
AVERT(Pool, pool);
AVERT(Format, format);
AVER(FormatArena(format) == PoolArena(pool));
pool->format = format;
AVERT(Chain, chain);
AVER(gen <= ChainGens(chain));
AVER(chain->arena == PoolArena(pool));
pool->alignment = pool->format->alignment;
ams->grainShift = SizeLog2(PoolAlignment(pool));

View file

@ -575,6 +575,7 @@ static Res AWLInit(Pool pool, ArgList args)
gen = arg.val.u;
AVERT(Format, format);
AVER(FormatArena(format) == PoolArena(pool));
pool->format = format;
pool->alignment = format->alignment;
@ -583,6 +584,7 @@ static Res AWLInit(Pool pool, ArgList args)
AVERT(Chain, chain);
AVER(gen <= ChainGens(chain));
AVER(chain->arena == PoolArena(pool));
res = PoolGenInit(&awl->pgen, ChainGen(chain, gen), pool);
if (res != ResOK)

View file

@ -504,8 +504,10 @@ static Res LOInit(Pool pool, ArgList args)
gen = arg.val.u;
AVERT(Format, pool->format);
AVER(FormatArena(pool->format) == arena);
AVERT(Chain, chain);
AVER(gen <= ChainGens(chain));
AVER(chain->arena == arena);
pool->alignment = pool->format->alignment;
lo->alignShift = SizeLog2((Size)PoolAlignment(pool));

View file

@ -387,6 +387,7 @@ static Res SNCInit(Pool pool, ArgList args)
format = arg.val.format;
AVERT(Format, format);
AVER(FormatArena(format) == PoolArena(pool));
pool->format = format;
snc->freeSegs = NULL;
snc->sig = SNCSig;

View file

@ -304,6 +304,7 @@ Res RootCreateReg(Root *rootReturn, Arena arena,
AVERT(Arena, arena);
AVERT(Rank, rank);
AVERT(Thread, thread);
AVER(ThreadArena(thread) == arena);
AVER(scan != NULL);
theUnion.reg.scan = scan;