1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-19 01:10:57 -08:00

Adding walker, in anticipation of change for request.dylan.170440

Copied from Perforce
 Change: 19282
 ServerID: perforce.ravenbrook.com
This commit is contained in:
David Jones 1998-01-28 16:38:52 +00:00
parent c96cf902fb
commit a911bc6657
4 changed files with 35 additions and 12 deletions

View file

@ -1,6 +1,6 @@
/* impl.h.mpm: MEMORY POOL MANAGER DEFINITIONS
*
* $HopeName: MMsrc!mpm.h(trunk.68) $
* $HopeName: MMsrc!mpm.h(trunk.69) $
* Copyright (C) 1997, 1998 The Harlequin Group Limited. All rights reserved.
*/
@ -350,6 +350,9 @@ extern void MessageNoFinalizationRef(Ref *refReturn,
Arena arena, Message message);
extern Res PoolNoAct(Pool pool, Action action);
extern void PoolNoWalk(Pool pool, Seg seg,
void (*f)(Addr, void *, unsigned long),
void *, unsigned long);
extern Res PoolCollectAct(Pool pool, Action action);

View file

@ -1,6 +1,6 @@
/* impl.h.mpmst: MEMORY POOL MANAGER DATA STRUCTURES
*
* $HopeName: MMsrc!mpmst.h(trunk.47) $
* $HopeName: MMsrc!mpmst.h(trunk.48) $
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
*
* .readership: MM developers.
@ -83,9 +83,9 @@ typedef struct PoolClassStruct {
PoolFreeMethod free; /* free memory to pool */
PoolBufferInitMethod bufferInit; /* additional buffer init */
PoolBufferFillMethod bufferFill; /* out-of-line reserve */
PoolBufferEmptyMethod bufferEmpty; /* out-of-line commit */
PoolBufferEmptyMethod bufferEmpty; /* out-of-line commit */
PoolBufferFinishMethod bufferFinish; /* additional buffer finish */
PoolTraceBeginMethod traceBegin;
PoolTraceBeginMethod traceBegin; /* no idea what this does @@@@ */
PoolWhitenMethod whiten; /* whiten objects in a segment */
PoolGreyMethod grey; /* grey non-white objects */
PoolBlackenMethod blacken; /* blacken grey objects without scanning */
@ -94,6 +94,7 @@ typedef struct PoolClassStruct {
PoolReclaimMethod reclaim; /* reclaim dead objects after tracing */
PoolBenefitMethod benefit; /* calculate benefit of action */
PoolActMethod act; /* do an action */
PoolWalkMethod walk; /* walk over a segment */
PoolDescribeMethod describe; /* describe the contents of the pool */
Sig endSig; /* .class.end-sig */
} PoolClassStruct;

View file

@ -1,6 +1,6 @@
/* impl.h.mpmtypes: MEMORY POOL MANAGER TYPES
*
* $HopeName: MMsrc!mpmtypes.h(trunk.38) $
* $HopeName: MMsrc!mpmtypes.h(trunk.39) $
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
*
* .readership: MM developers.
@ -102,17 +102,18 @@ typedef struct MessageClassStruct *MessageClass; /* design.mps.message */
/* Pool*Method -- see design.mps.class-interface */
/* Order of types corresponds to PoolClassStruct in impl.h.mpmst */
typedef Res (*PoolInitMethod)(Pool pool, va_list args);
typedef void (*PoolFinishMethod)(Pool pool);
typedef Res (*PoolAllocMethod)(Addr *pReturn, Pool pool, Size size);
typedef void (*PoolFreeMethod)(Pool pool, Addr old, Size size);
typedef Res (*PoolBufferInitMethod)(Pool pool, Buffer buf, va_list args);
typedef void (*PoolBufferFinishMethod)(Pool pool, Buffer buf);
typedef Res (*PoolBufferFillMethod)(Seg *segReturn,
Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size);
typedef void (*PoolBufferEmptyMethod)(Pool pool, Buffer buffer);
typedef Res (*PoolDescribeMethod)(Pool pool, mps_lib_FILE *stream);
typedef void (*PoolBufferFinishMethod)(Pool pool, Buffer buf);
typedef Res (*PoolTraceBeginMethod)(Pool pool, Trace trace);
typedef Res (*PoolWhitenMethod)(Pool pool, Trace trace, Seg seg);
typedef void (*PoolGreyMethod)(Pool pool, Trace trace, Seg seg);
@ -122,6 +123,11 @@ typedef Res (*PoolFixMethod)(Pool pool, ScanState ss, Seg seg,
Ref *refIO);
typedef void (*PoolReclaimMethod)(Pool pool, Trace trace, Seg seg);
typedef double (*PoolBenefitMethod)(Pool pool, Action action);
typedef Res (*PoolActMethod)(Pool pool, Action action);
typedef void (*PoolWalkMethod)(Pool pool, Seg seg,
void (*f)(Addr, void *, unsigned long),
void *p, unsigned long s);
typedef Res (*PoolDescribeMethod)(Pool pool, mps_lib_FILE *stream);
/* Message*Method -- design.mps.message */
@ -136,9 +142,6 @@ typedef void (*MessageFinalizationRefMethod)
typedef struct MessageFinalizationStruct *MessageFinalization;
typedef Res (*PoolActMethod)(Pool pool, Action action);
/* Format*Method -- see design.mps.format-interface */
/* .fmt-methods: These methods must match those defined in the */
/* MPS C Interface. (See impl.h.mps.fmt-methods.) */

View file

@ -1,6 +1,6 @@
/* impl.c.pool: POOL IMPLEMENTATION
*
* $HopeName: MMsrc!pool.c(trunk.41) $
* $HopeName: MMsrc!pool.c(trunk.42) $
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
*
* This is the implementation of the generic pool interface. The
@ -12,7 +12,7 @@
#include "mpm.h"
SRCID(pool, "$HopeName: MMsrc!pool.c(trunk.41) $");
SRCID(pool, "$HopeName: MMsrc!pool.c(trunk.42) $");
Bool PoolClassCheck(PoolClass class)
@ -40,6 +40,7 @@ Bool PoolClassCheck(PoolClass class)
CHECKL(FUNCHECK(class->reclaim));
CHECKL(FUNCHECK(class->benefit));
CHECKL(FUNCHECK(class->act));
CHECKL(FUNCHECK(class->walk));
CHECKL(FUNCHECK(class->describe));
CHECKL(class->endSig == PoolClassSig);
return TRUE;
@ -372,6 +373,7 @@ Res PoolAct(Pool pool, Action action)
}
Res PoolDescribe(Pool pool, mps_lib_FILE *stream)
{
Res res;
@ -809,3 +811,17 @@ failBegin:
failCreate:
return res;
}
void PoolNoWalk(Pool pool, Seg seg,
void (*f)(Addr, void *, unsigned long),
void *p, unsigned long s)
{
AVERT(Pool, pool);
AVERT(Seg, seg);
AVER(FunCheck((Fun)f));
/* p and s are arbitrary closures, hence can't be checked */
UNUSED(p);
UNUSED(s);
NOTREACHED;
}