mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-21 13:31:37 -07:00
Merge branch/2016-04-21/amswalk.
Copied from Perforce Change: 192184 ServerID: perforce.ravenbrook.com
This commit is contained in:
commit
e69de535d3
4 changed files with 69 additions and 5 deletions
|
|
@ -80,8 +80,7 @@ Bool PoolClassCheck(PoolClass klass)
|
|||
|
||||
/* Check that pool classes that set attributes also override the
|
||||
methods they imply. */
|
||||
/* .check.ams.walk: Can't enforce this one until job003738 is resolved. */
|
||||
/* CHECKL(((klass->attr & AttrFMT) == 0) == (klass->walk == PoolNoWalk)); */
|
||||
CHECKL(((klass->attr & AttrFMT) == 0) == (klass->walk == PoolNoWalk));
|
||||
if (klass != &CLASS_STATIC(AbstractCollectPool)) {
|
||||
CHECKL(((klass->attr & AttrGC) == 0) == (klass->fix == PoolNoFix));
|
||||
CHECKL(((klass->attr & AttrGC) == 0) == (klass->fixEmergency == PoolNoFix));
|
||||
|
|
|
|||
|
|
@ -1642,6 +1642,66 @@ static void AMSReclaim(Pool pool, Trace trace, Seg seg)
|
|||
}
|
||||
|
||||
|
||||
/* AMSWalk -- walk formatted objects in AMC pool */
|
||||
|
||||
static void AMSWalk(Pool pool, Seg seg, FormattedObjectsVisitor f,
|
||||
void *p, size_t s)
|
||||
{
|
||||
AMS ams;
|
||||
AMSSeg amsseg;
|
||||
Addr object, base, limit;
|
||||
Format format;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Seg, seg);
|
||||
AVER(FUNCHECK(f));
|
||||
/* p and s are arbitrary closures and can't be checked */
|
||||
|
||||
ams = PoolAMS(pool);
|
||||
AVERT(AMS, ams);
|
||||
amsseg = Seg2AMSSeg(seg);
|
||||
AVERT(AMSSeg, amsseg);
|
||||
|
||||
format = pool->format;
|
||||
|
||||
base = SegBase(seg);
|
||||
object = base;
|
||||
limit = SegLimit(seg);
|
||||
|
||||
while (object < limit) {
|
||||
/* object is a slight misnomer because it might point to a free grain */
|
||||
Addr next;
|
||||
Index i;
|
||||
Buffer buffer;
|
||||
|
||||
if (SegBuffer(&buffer, seg)) {
|
||||
if (object == BufferScanLimit(buffer)
|
||||
&& BufferScanLimit(buffer) != BufferLimit(buffer)) {
|
||||
/* skip over buffered area */
|
||||
object = BufferLimit(buffer);
|
||||
continue;
|
||||
}
|
||||
/* since we skip over the buffered area we are always */
|
||||
/* either before the buffer, or after it, never in it */
|
||||
AVER(object < BufferGetInit(buffer) || BufferLimit(buffer) <= object);
|
||||
}
|
||||
i = AMS_ADDR_INDEX(seg, object);
|
||||
if (!AMS_ALLOCED(seg, i)) {
|
||||
/* This grain is free */
|
||||
object = AddrAdd(object, PoolAlignment(pool));
|
||||
continue;
|
||||
}
|
||||
object = AddrAdd(object, format->headerSize);
|
||||
next = format->skip(object);
|
||||
next = AddrSub(next, format->headerSize);
|
||||
AVER(AddrIsAligned(next, PoolAlignment(pool)));
|
||||
if (!amsseg->colourTablesInUse || !AMS_IS_WHITE(seg, i))
|
||||
(*f)(object, pool->format, pool, p, s);
|
||||
object = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AMSFreeWalk -- free block walking method of the pool class */
|
||||
|
||||
static void AMSFreeWalk(Pool pool, FreeBlockVisitor f, void *p)
|
||||
|
|
@ -1756,8 +1816,7 @@ DEFINE_CLASS(Pool, AMSPool, klass)
|
|||
klass->fix = AMSFix;
|
||||
klass->fixEmergency = AMSFix;
|
||||
klass->reclaim = AMSReclaim;
|
||||
/* TODO: job003738. See also impl.c.pool.check.ams.walk. */
|
||||
klass->walk = PoolNoWalk;
|
||||
klass->walk = AMSWalk;
|
||||
klass->freewalk = AMSFreeWalk;
|
||||
klass->totalSize = AMSTotalSize;
|
||||
klass->freeSize = AMSFreeSize;
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
test(arena, mps_class_amc());
|
||||
test(arena, mps_class_amcz());
|
||||
/* TODO: test(arena, mps_class_ams()); -- see job003738 */
|
||||
test(arena, mps_class_ams());
|
||||
test(arena, mps_class_awl());
|
||||
test(arena, mps_class_lo());
|
||||
test(arena, mps_class_snc());
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ Other changes
|
|||
|
||||
.. _job003559: https://www.ravenbrook.com/project/mps/issue/job003559/
|
||||
|
||||
#. The function :c:func:`mps_arena_formatted_objects_walk` walks the
|
||||
formatted objects in all pools. Previously this was not implemented
|
||||
for :ref:`pool-ams` pools. See job003738_.
|
||||
|
||||
.. _job003738: https://www.ravenbrook.com/project/mps/issue/job003738/
|
||||
|
||||
#. Objects in :ref:`pool-snc` pools are no longer scanned after their
|
||||
:term:`allocation frame` is popped, and so do not keep objects in
|
||||
automatically managed pools alive. See job003883_.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue