Avoid looping over the tracts of a span in mvspancheck in production varieties. (merged from change 184499.)

Copied from Perforce
 Change: 186077
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-05-13 14:30:52 +01:00
commit 113a2fa79d

View file

@ -134,9 +134,7 @@ typedef struct MVSpanStruct {
ATTRIBUTE_UNUSED
static Bool MVSpanCheck(MVSpan span)
{
Addr addr, base, limit;
Arena arena;
Tract tract;
Addr base, limit;
CHECKS(MVSpan, span);
@ -172,13 +170,22 @@ static Bool MVSpanCheck(MVSpan span)
CHECKL(span->largest == SpanSize(span)+1);
}
/* Each tract of the span must refer to the span */
arena = PoolArena(TractPool(span->tract));
TRACT_FOR(tract, addr, arena, base, limit) {
CHECKD_NOSIG(Tract, tract);
CHECKL(TractP(tract) == (void *)span);
/* Note that even if the CHECKs are compiled away there is still a
* significant cost in looping over the tracts, hence this guard. */
#if defined(AVER_AND_CHECK_ALL)
{
Addr addr;
Arena arena;
Tract tract;
/* Each tract of the span must refer to the span */
arena = PoolArena(TractPool(span->tract));
TRACT_FOR(tract, addr, arena, base, limit) {
CHECKD_NOSIG(Tract, tract);
CHECKL(TractP(tract) == (void *)span);
}
CHECKL(addr == limit);
}
CHECKL(addr == limit);
#endif
return TRUE;
}