1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-26 23:20:29 -08:00

The alignment of an awl pool is now set to the format alignment, as documented. the alignment restriction on pointers is now based on sizeof(void *), not mps_pf_align.

Copied from Perforce
 Change: 185357
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-04-08 18:29:25 +01:00
parent 3f50055416
commit 00901670be
3 changed files with 23 additions and 12 deletions

View file

@ -558,6 +558,7 @@ static Res AWLInit(Pool pool, ArgList args)
AVERT(Format, format);
pool->format = format;
pool->alignment = format->alignment;
AVER(FUNCHECK(findDependent));
awl->findDependent = findDependent;
@ -570,7 +571,7 @@ static Res AWLInit(Pool pool, ArgList args)
if (res != ResOK)
goto failGenInit;
awl->alignShift = SizeLog2(pool->alignment);
awl->alignShift = SizeLog2(PoolAlignment(pool));
awl->size = (Size)0;
awl->succAccesses = 0;
@ -937,7 +938,7 @@ static Res awlScanSinglePass(Bool *anyScannedReturn,
i = awlIndexOfAddr(base, awl, p);
if (!BTGet(awlseg->alloc, i)) {
p = AddrAdd(p, pool->alignment);
p = AddrAdd(p, PoolAlignment(pool));
continue;
}
hp = AddrAdd(p, format->headerSize);
@ -954,7 +955,8 @@ static Res awlScanSinglePass(Bool *anyScannedReturn,
}
objectLimit = AddrSub(objectLimit, format->headerSize);
AVER(p < objectLimit);
p = AddrAlignUp(objectLimit, pool->alignment);
AVER(AddrIsAligned(objectLimit, PoolAlignment(pool)));
p = objectLimit;
}
AVER(p == limit);
@ -1051,7 +1053,7 @@ static Res AWLFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
switch(ss->rank) {
case RankAMBIG:
/* not a real pointer if not aligned or not allocated */
if (!AddrIsAligned(base, pool->alignment) || !BTGet(awlseg->alloc, i))
if (!AddrIsAligned(base, sizeof(void *)) || !BTGet(awlseg->alloc, i))
return ResOK;
/* falls through */
case RankEXACT:
@ -1125,7 +1127,7 @@ static void AWLReclaim(Pool pool, Trace trace, Seg seg)
}
q = format->skip(AddrAdd(p, format->headerSize));
q = AddrSub(q, format->headerSize);
q = AddrAlignUp(q, pool->alignment);
AVER(AddrIsAligned(q, PoolAlignment(pool)));
j = awlIndexOfAddr(base, awl, q);
AVER(j <= awlseg->grains);
if(BTGet(awlseg->mark, i)) {
@ -1243,13 +1245,13 @@ static void AWLWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
i = awlIndexOfAddr(base, awl, object);
if (!BTGet(awlseg->alloc, i)) {
/* This grain is free */
object = AddrAdd(object, pool->alignment);
object = AddrAdd(object, PoolAlignment(pool));
continue;
}
object = AddrAdd(object, format->headerSize);
next = format->skip(object);
next = AddrSub(next, format->headerSize);
next = AddrAlignUp(next, pool->alignment);
AVER(AddrIsAligned(next, PoolAlignment(pool)));
if (BTGet(awlseg->mark, i) && BTGet(awlseg->scanned, i))
(*f)(object, pool->format, pool, p, s);
object = next;

View file

@ -282,11 +282,10 @@ the format of objects allocated in it:
that it does not look like an aligned pointer.
"Aligned pointer" means a word whose numeric value (that is, its
value when treated as an unsigned integer) is a multiple of the
architecture's :term:`natural alignment` (see
:c:macro:`MPS_PF_ALIGN`). If you're using a 32-bit architecture,
that means that an aligned pointer is a multiple of 4 and its bottom
two bits are both zero.
value when treated as an unsigned integer) is a multiple of the size
of a pointer. For you're using a 32-bit architecture, that means
that an aligned pointer is a multiple of 4 and its bottom two bits
are both zero.
The bottom line is that references from an object in an AWL pool
must be untagged and aligned, and integers must be tagged with a

View file

@ -27,6 +27,16 @@ New features
calling :c:func:`mps_pool_create_k`.
Other changes
.............
#. The alignment of :ref:`pool-awl` pools is now configurable via the
object format, as documented, and is no longer always
:c:macro:`MPS_PF_ALIGN`. See job003745_.
.. _job003745: https://www.ravenbrook.com/project/mps/issue/job003745/
.. _release-notes-1.113:
Release 1.113.0