mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-26 07:00:35 -08:00
Add poolblacken method on pools
Copied from Perforce Change: 18717 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
22d34f4cd1
commit
8b2448b2db
11 changed files with 153 additions and 22 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.h.mpm: MEMORY POOL MANAGER DEFINITIONS
|
||||
*
|
||||
* $HopeName: MMsrc!mpm.h(trunk.43) $
|
||||
* $HopeName: MMsrc!mpm.h(trunk.44) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*/
|
||||
|
||||
|
|
@ -271,6 +271,7 @@ extern void PoolFree(Pool pool, Addr old, Size size);
|
|||
extern Res PoolTraceBegin(Pool pool, Trace trace, Action action);
|
||||
extern Res PoolCondemn(Pool pool, Trace trace, Seg seg, Action action);
|
||||
extern void PoolGrey(Pool pool, Trace trace, Seg seg);
|
||||
extern void PoolBlacken(Pool pool, TraceSet traceSet, Seg seg);
|
||||
extern Res PoolScan(ScanState ss, Pool pool, Seg seg);
|
||||
extern Res (PoolFix)(Pool pool, ScanState ss, Seg seg, Addr *refIO);
|
||||
#define PoolFix(pool, ss, seg, refIO) \
|
||||
|
|
@ -301,6 +302,8 @@ extern Res PoolTrivTraceBegin(Pool pool, Trace trace, Action action);
|
|||
extern Res PoolNoCondemn(Pool pool, Trace trace, Seg seg, Action action);
|
||||
extern void PoolNoGrey(Pool pool, Trace trace, Seg seg);
|
||||
extern void PoolTrivGrey(Pool pool, Trace trace, Seg seg);
|
||||
extern void PoolNoBlacken(Pool pool, TraceSet traceSet, Seg seg);
|
||||
extern void PoolTrivBlacken(Pool pool, TraceSet traceSet, Seg seg);
|
||||
extern Res PoolNoScan(ScanState ss, Pool pool, Seg seg);
|
||||
extern Res PoolNoFix(Pool pool, ScanState ss, Seg seg, Ref *refIO);
|
||||
extern void PoolNoReclaim(Pool pool, Trace trace, Seg seg);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.h.mpmst: MEMORY POOL MANAGER DATA STRUCTURES
|
||||
*
|
||||
* $HopeName: MMsrc!mpmst.h(trunk.32) $
|
||||
* $HopeName: MMsrc!mpmst.h(trunk.33) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* .readership: MM developers.
|
||||
|
|
@ -88,6 +88,7 @@ typedef struct PoolClassStruct {
|
|||
PoolTraceBeginMethod traceBegin;
|
||||
PoolCondemnMethod condemn; /* condemn (some or all) objects */
|
||||
PoolGreyMethod grey; /* grey non-white objects */
|
||||
PoolBlackenMethod blacken; /* blacken grey objects without scanning */
|
||||
PoolScanMethod scan; /* find references during tracing */
|
||||
PoolFixMethod fix; /* referent reachable during tracing */
|
||||
PoolReclaimMethod reclaim; /* reclaim dead objects after tracing */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.h.mpmtypes: MEMORY POOL MANAGER TYPES
|
||||
*
|
||||
* $HopeName: MMsrc!mpmtypes.h(trunk.29) $
|
||||
* $HopeName: MMsrc!mpmtypes.h(trunk.30) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* .readership: MM developers.
|
||||
|
|
@ -111,6 +111,7 @@ typedef Res (*PoolTraceBeginMethod)(Pool pool, Trace trace,
|
|||
typedef Res (*PoolCondemnMethod)(Pool pool, Trace trace,
|
||||
Seg seg, Action action);
|
||||
typedef void (*PoolGreyMethod)(Pool pool, Trace trace, Seg seg);
|
||||
typedef void (*PoolBlackenMethod)(Pool pool, TraceSet traceSet, Seg seg);
|
||||
typedef Res (*PoolScanMethod)(ScanState ss, Pool pool, Seg seg);
|
||||
typedef Res (*PoolFixMethod)(Pool pool, ScanState ss, Seg seg,
|
||||
Ref *refIO);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.pool: POOL IMPLEMENTATION
|
||||
*
|
||||
* $HopeName: MMsrc!pool.c(trunk.34) $
|
||||
* $HopeName: MMsrc!pool.c(trunk.35) $
|
||||
* 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.34) $");
|
||||
SRCID(pool, "$HopeName: MMsrc!pool.c(trunk.35) $");
|
||||
|
||||
|
||||
Bool PoolClassCheck(PoolClass class)
|
||||
|
|
@ -282,6 +282,15 @@ void PoolGrey(Pool pool, Trace trace, Seg seg)
|
|||
(*pool->class->grey)(pool, trace, seg);
|
||||
}
|
||||
|
||||
void PoolBlacken(Pool pool, TraceSet traceSet, Seg seg)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(TraceSet, traceSet);
|
||||
AVERT(Seg, seg);
|
||||
AVER(SegPool(seg) == pool);
|
||||
(*pool->class->blacken)(pool, traceSet, seg);
|
||||
}
|
||||
|
||||
Res PoolScan(ScanState ss, Pool pool, Seg seg)
|
||||
{
|
||||
AVERT(ScanState, ss);
|
||||
|
|
@ -652,6 +661,25 @@ void PoolTrivGrey(Pool pool, Trace trace, Seg seg)
|
|||
SegSetGrey(seg, TraceSetSingle(trace->ti));
|
||||
}
|
||||
|
||||
void PoolNoBlacken(Pool pool, TraceSet traceSet, Seg seg)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(TraceSet, traceSet);
|
||||
AVERT(Seg, seg);
|
||||
NOTREACHED;
|
||||
}
|
||||
|
||||
void PoolTrivBlacken(Pool pool, TraceSet traceSet, Seg seg)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(TraceSet, traceSet);
|
||||
AVERT(Seg, seg);
|
||||
|
||||
/* the trivial blacken method does nothing; for pool classes which do
|
||||
* not keep additional colour information. */
|
||||
NOOP;
|
||||
}
|
||||
|
||||
Res PoolNoScan(ScanState ss, Pool pool, Seg seg)
|
||||
{
|
||||
AVERT(ScanState, ss);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.poolams: AUTOMATIC MARK & SWEEP POOL CLASS
|
||||
*
|
||||
* $HopeName: MMsrc!poolams.c(trunk.7) $
|
||||
* $HopeName: MMsrc!poolams.c(trunk.8) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* NOTES
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "mpm.h"
|
||||
#include "mpscams.h"
|
||||
|
||||
SRCID(poolams, "$HopeName: MMsrc!poolams.c(trunk.7) $");
|
||||
SRCID(poolams, "$HopeName: MMsrc!poolams.c(trunk.8) $");
|
||||
|
||||
|
||||
#define AMSSig ((Sig)0x519A3599) /* SIGnature AMS */
|
||||
|
|
@ -686,6 +686,66 @@ static Res AMSIterate(AMS ams, AMSGroup group, Seg seg, Arena arena,
|
|||
}
|
||||
|
||||
|
||||
/* AMSBlackenObject -- blacken a single object (if it is grey).
|
||||
*
|
||||
* This is the object function passed to AMSIterate by AMSBlacken.
|
||||
* It just blackens the object if it is grey. It takes no closure.
|
||||
*/
|
||||
|
||||
static Res AMSBlackenObject(AMSGroup group,
|
||||
Index i, Addr p, Addr next, int colour,
|
||||
void *clos)
|
||||
{
|
||||
AVERT(AMSGroup, group);
|
||||
AVER(i < group->grains);
|
||||
AVER(p != 0);
|
||||
AVER(p < next);
|
||||
AVER(clos == NULL);
|
||||
AVER(colour != AMS_ILLEGAL);
|
||||
AVER(AMSColourIsValid(colour));
|
||||
|
||||
/* if the object is grey, make it black */
|
||||
if (colour == AMS_GREY)
|
||||
BTSet(group->scanTable, i);
|
||||
|
||||
return ResOK;
|
||||
}
|
||||
|
||||
/* AMSBlacken -- the pool class segment blackening method
|
||||
*
|
||||
* See design.mps.poolams.blacken
|
||||
*/
|
||||
|
||||
static void AMSBlacken(Pool pool, TraceSet traceSet, Seg seg)
|
||||
{
|
||||
Res res;
|
||||
AMS ams;
|
||||
Arena arena;
|
||||
AMSGroup group;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
AVER(TraceSetCheck(traceSet));
|
||||
AVER(SegCheck(seg));
|
||||
|
||||
/* only do anything if the bitmaps apply to one of these traces. */
|
||||
/* see design.mps.poolams.invariant.object */
|
||||
if (TraceSetInter(SegWhite(seg), traceSet) != TraceSetEMPTY) {
|
||||
ams = PoolPoolAMS(pool);
|
||||
AVERT(AMS, ams);
|
||||
arena = PoolArena(pool);
|
||||
|
||||
group = AMSSegGroup(seg);
|
||||
AVERT(AMSGroup, group);
|
||||
|
||||
ShieldExpose(arena, seg); /* so we can skip through it */
|
||||
res = AMSIterate(ams, group, seg, arena, AMSBlackenObject, NULL);
|
||||
AVER(res == ResOK); /* AMSBlackenObject always returns ResOK */
|
||||
ShieldCover(arena, seg);
|
||||
|
||||
group->marked = FALSE; /* design.mps.poolams.blacken.marked */
|
||||
}
|
||||
}
|
||||
|
||||
/* The closure of the object scanning function */
|
||||
|
||||
struct AMSScanClosureStruct {
|
||||
|
|
@ -773,6 +833,7 @@ static Res AMSScan(ScanState ss, Pool pool, Seg seg)
|
|||
&closureStruct);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
group->marked = FALSE;
|
||||
|
||||
} else { /* design.mps.poolams.scan.iter */
|
||||
|
||||
|
|
@ -1150,6 +1211,7 @@ static PoolClassStruct PoolClassAMSStruct = {
|
|||
PoolTrivTraceBegin, /* design.mps.poolams.triv-trace-begin */
|
||||
AMSCondemn, /* condemn */
|
||||
PoolTrivGrey, /* design.mps.poolams.triv-grey */
|
||||
AMSBlacken, /* blacken */
|
||||
AMSScan, /* scan */
|
||||
AMSFix, /* fix */
|
||||
AMSReclaim, /* reclaim */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.poolawl: AUTOMATIC WEAK LINKED POOL CLASS
|
||||
*
|
||||
* $HopeName: MMsrc!poolawl.c(trunk.15) $
|
||||
* $HopeName: MMsrc!poolawl.c(trunk.16) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* READERSHIP
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
#include "mpm.h"
|
||||
#include "mpscawl.h"
|
||||
|
||||
SRCID(poolawl, "$HopeName: MMsrc!poolawl.c(trunk.15) $");
|
||||
SRCID(poolawl, "$HopeName: MMsrc!poolawl.c(trunk.16) $");
|
||||
|
||||
|
||||
#define AWLSig ((Sig)0x519b7a37) /* SIGPooLAWL */
|
||||
|
|
@ -384,6 +384,23 @@ static void AWLGrey(Pool pool, Trace trace, Seg seg)
|
|||
}
|
||||
}
|
||||
|
||||
static void AWLBlacken(Pool pool, TraceSet traceSet, Seg seg)
|
||||
{
|
||||
AWL awl;
|
||||
AWLGroup group;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
AVER(TraceSetCheck(traceSet));
|
||||
AVER(SegCheck(seg));
|
||||
|
||||
awl = PoolPoolAWL(pool);
|
||||
AVERT(AWL, awl);
|
||||
group = (AWLGroup)SegP(seg);
|
||||
AVERT(AWLGroup, group);
|
||||
|
||||
BTSetRange(group->scanned, 0, group->grains);
|
||||
}
|
||||
|
||||
|
||||
/* Returns the linked object (or possibly there is none) */
|
||||
/* see design.mps.poolawl.fun.dependent-object, and */
|
||||
|
|
@ -676,6 +693,7 @@ struct PoolClassStruct PoolClassAWLStruct = {
|
|||
AWLTraceBegin,
|
||||
AWLCondemn,
|
||||
AWLGrey,
|
||||
AWLBlacken,
|
||||
AWLScan,
|
||||
AWLFix,
|
||||
AWLReclaim,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.poolmfs: MANUAL FIXED SMALL UNIT POOL
|
||||
*
|
||||
* $HopeName: MMsrc!poolmfs.c(trunk.21) $
|
||||
* $HopeName: MMsrc!poolmfs.c(trunk.22) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* This is the implementation of the MFS pool class.
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
#include "mpm.h"
|
||||
#include "poolmfs.h"
|
||||
|
||||
SRCID(poolmfs, "$HopeName: MMsrc!poolmfs.c(trunk.21) $");
|
||||
SRCID(poolmfs, "$HopeName: MMsrc!poolmfs.c(trunk.22) $");
|
||||
|
||||
|
||||
/* == Round up ==
|
||||
|
|
@ -278,6 +278,7 @@ static PoolClassStruct PoolClassMFSStruct = {
|
|||
PoolNoTraceBegin, /* traceBegin */
|
||||
PoolNoCondemn, /* condemn */
|
||||
PoolNoGrey, /* grey */
|
||||
PoolNoBlacken, /* blacken */
|
||||
PoolNoScan, /* scan */
|
||||
PoolNoFix, /* fix */
|
||||
PoolNoReclaim, /* reclaim */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* MANUAL RANK GUARDIAN POOL
|
||||
*
|
||||
* $HopeName: MMsrc!poolmrg.c(trunk.12) $
|
||||
* $HopeName: MMsrc!poolmrg.c(trunk.13) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* READERSHIP
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#include "mpm.h"
|
||||
#include "poolmrg.h"
|
||||
|
||||
SRCID(poolmrg, "$HopeName: MMsrc!poolmrg.c(trunk.12) $");
|
||||
SRCID(poolmrg, "$HopeName: MMsrc!poolmrg.c(trunk.13) $");
|
||||
|
||||
|
||||
#define MRGSig ((Sig)0x519369B0) /* SIGnature MRG POol */
|
||||
|
|
@ -418,6 +418,7 @@ static PoolClassStruct PoolClassMRGStruct = {
|
|||
PoolNoTraceBegin, /* traceBegin */
|
||||
PoolNoCondemn, /* condemn */
|
||||
PoolTrivGrey, /* grey */
|
||||
PoolTrivBlacken, /* blacken */
|
||||
MRGScan, /* scan */
|
||||
PoolNoFix, /* fix */
|
||||
PoolNoReclaim, /* reclaim */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.poolmv: MANUAL VARIABLE POOL
|
||||
*
|
||||
* $HopeName: MMsrc!poolmv.c(trunk.22) $
|
||||
* $HopeName: MMsrc!poolmv.c(trunk.23) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* **** RESTRICTION: This pool may not allocate from the arena control
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#include "poolmfs.h"
|
||||
#include "mpscmv.h"
|
||||
|
||||
SRCID(poolmv, "$HopeName: MMsrc!poolmv.c(trunk.22) $");
|
||||
SRCID(poolmv, "$HopeName: MMsrc!poolmv.c(trunk.23) $");
|
||||
|
||||
|
||||
#define BLOCKPOOL(mv) (MFSPool(&(mv)->blockPoolStruct))
|
||||
|
|
@ -621,7 +621,8 @@ static PoolClassStruct PoolClassMVStruct = {
|
|||
PoolTrivBufferFinish, /* bufferFinish */
|
||||
PoolNoTraceBegin, /* traceBegin */
|
||||
PoolNoCondemn, /* condemn */
|
||||
PoolNoGrey, /* mark */
|
||||
PoolNoGrey, /* grey */
|
||||
PoolNoBlacken, /* blacken */
|
||||
PoolNoScan, /* scan */
|
||||
PoolNoFix, /* fix */
|
||||
PoolNoReclaim, /* relcaim */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.pooln: NULL POOL
|
||||
*
|
||||
* $HopeName: MMsrc!pooln.c(trunk.12) $
|
||||
* $HopeName: MMsrc!pooln.c(trunk.13) $
|
||||
* Copyright(C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*
|
||||
* This is the implementation of the null pool class. Begin null it
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#include "mpm.h"
|
||||
#include "pooln.h"
|
||||
|
||||
SRCID(pooln, "$HopeName: MMsrc!pooln.c(trunk.12) $");
|
||||
SRCID(pooln, "$HopeName: MMsrc!pooln.c(trunk.13) $");
|
||||
|
||||
|
||||
typedef struct PoolNStruct {
|
||||
|
|
@ -177,6 +177,18 @@ static void NGrey(Pool pool, Trace trace, Seg seg)
|
|||
AVERT(Seg, seg);
|
||||
}
|
||||
|
||||
static void NBlacken(Pool pool, TraceSet traceSet, Seg seg)
|
||||
{
|
||||
PoolN poolN;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
poolN = PoolPoolN(pool);
|
||||
AVERT(PoolN, poolN);
|
||||
|
||||
AVERT(TraceSet, traceSet);
|
||||
AVERT(Seg, seg);
|
||||
}
|
||||
|
||||
static Res NScan(ScanState ss, Pool pool, Seg seg)
|
||||
{
|
||||
PoolN poolN;
|
||||
|
|
@ -237,6 +249,7 @@ static PoolClassStruct PoolClassNStruct = {
|
|||
PoolNoTraceBegin, /* traceBegin */
|
||||
NCondemn, /* condemn */
|
||||
NGrey, /* grey */
|
||||
NBlacken, /* blacken */
|
||||
NScan, /* scan */
|
||||
NFix, /* fix */
|
||||
NReclaim, /* reclaim */
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/* impl.c.trace: GENERIC TRACER IMPLEMENTATION
|
||||
*
|
||||
* $HopeName: MMsrc!trace.c(trunk.43) $
|
||||
* $HopeName: MMsrc!trace.c(trunk.44) $
|
||||
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "mpm.h"
|
||||
|
||||
SRCID(trace, "$HopeName: MMsrc!trace.c(trunk.43) $");
|
||||
SRCID(trace, "$HopeName: MMsrc!trace.c(trunk.44) $");
|
||||
|
||||
|
||||
/* ScanStateCheck -- check consistency of a ScanState object */
|
||||
|
|
@ -608,7 +608,9 @@ static Res TraceScan(TraceSet ts, Rank rank,
|
|||
white = RefSetUnion(white, ArenaTrace(arena, ti)->white);
|
||||
|
||||
/* only scan a segment if it refers to the white set */
|
||||
if (RefSetInter(white, SegSummary(seg)) != RefSetEMPTY) {
|
||||
if (RefSetInter(white, SegSummary(seg)) == RefSetEMPTY) { /* blacken it */
|
||||
PoolBlacken(SegPool(seg), ts, seg);
|
||||
} else { /* scan it */
|
||||
ss.rank = rank;
|
||||
ss.traces = ts;
|
||||
ss.fix = TraceFix;
|
||||
|
|
@ -644,7 +646,7 @@ static Res TraceScan(TraceSet ts, Rank rank,
|
|||
ss.sig = SigInvalid; /* just in case */
|
||||
}
|
||||
|
||||
/* The segment has been scanned, so remove the greyness from it. */
|
||||
/* The segment is now black, so remove the greyness from it. */
|
||||
SegSetGrey(seg, TraceSetDiff(SegGrey(seg), ts));
|
||||
|
||||
return ResOK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue