mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-18 03:40:47 -08:00
Adding a free address space cbs to the arena, initialising and finishing it, but not using it yet.
Moved CBSStruct to mpmst.h so that it can be included inline in ArenaStruct without circularity problems. Copied from Perforce Change: 184044 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
9eeaa3a388
commit
c71a9513e0
4 changed files with 46 additions and 19 deletions
|
|
@ -8,6 +8,8 @@
|
|||
#include "tract.h"
|
||||
#include "poolmv.h"
|
||||
#include "mpm.h"
|
||||
#include "cbs.h"
|
||||
|
||||
|
||||
SRCID(arena, "$Id$");
|
||||
|
||||
|
|
@ -143,6 +145,9 @@ Bool ArenaCheck(Arena arena)
|
|||
/* nothing to check for chunkSerial */
|
||||
CHECKD(ChunkCacheEntry, &arena->chunkCache);
|
||||
|
||||
/* FIXME: Can't check freeCBS until it's initialised */
|
||||
/* CHECKD(CBS, &arena->freeCBS); */
|
||||
|
||||
CHECKL(LocusCheck(arena));
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -192,6 +197,14 @@ Res ArenaInit(Arena arena, ArenaClass class)
|
|||
|
||||
arena->sig = ArenaSig;
|
||||
|
||||
MPS_ARGS_BEGIN(cbsiArgs) {
|
||||
MPS_ARGS_ADD(cbsiArgs, MPS_KEY_CBS_EXTEND_BY, 0); /* FIXME: explain why we never extend */
|
||||
MPS_ARGS_DONE(cbsiArgs);
|
||||
res = CBSInit(arena, &arena->freeCBS, arena, arena->alignment, TRUE, cbsiArgs);
|
||||
} MPS_ARGS_END(cbsiArgs);
|
||||
if (res != ResOK)
|
||||
goto failCBSInit;
|
||||
|
||||
/* initialize the reservoir, <design/reservoir/> */
|
||||
res = ReservoirInit(&arena->reservoirStruct, arena);
|
||||
if (res != ResOK)
|
||||
|
|
@ -201,6 +214,8 @@ Res ArenaInit(Arena arena, ArenaClass class)
|
|||
return ResOK;
|
||||
|
||||
failReservoirInit:
|
||||
CBSFinish(&arena->freeCBS);
|
||||
failCBSInit:
|
||||
GlobalsFinish(ArenaGlobals(arena));
|
||||
failGlobalsInit:
|
||||
return res;
|
||||
|
|
@ -278,6 +293,7 @@ failInit:
|
|||
void ArenaFinish(Arena arena)
|
||||
{
|
||||
ReservoirFinish(ArenaReservoir(arena));
|
||||
CBSFinish(&arena->freeCBS);
|
||||
arena->sig = SigInvalid;
|
||||
GlobalsFinish(ArenaGlobals(arena));
|
||||
LocusFinish(arena);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#define cbs_h
|
||||
|
||||
#include "arg.h"
|
||||
#include "meter.h"
|
||||
#include "mpmtypes.h"
|
||||
#include "mpmst.h"
|
||||
#include "range.h"
|
||||
|
|
@ -21,21 +20,6 @@ typedef struct CBSStruct *CBS;
|
|||
typedef Bool (*CBSIterateMethod)(CBS cbs, Range range,
|
||||
void *closureP, Size closureS);
|
||||
|
||||
|
||||
#define CBSSig ((Sig)0x519CB599) /* SIGnature CBS */
|
||||
|
||||
typedef struct CBSStruct {
|
||||
SplayTreeStruct splayTree;
|
||||
Count splayTreeSize;
|
||||
MFSStruct blockPoolStruct; /* FIXME: ref to why this is inlined */
|
||||
Align alignment;
|
||||
Bool fastFind;
|
||||
Bool inCBS; /* prevent reentrance */
|
||||
/* meters for sizes of search structures at each op */
|
||||
METER_DECL(splaySearch);
|
||||
Sig sig; /* sig at end because embeded */
|
||||
} CBSStruct;
|
||||
|
||||
extern Bool CBSCheck(CBS cbs);
|
||||
|
||||
extern Res CBSInit(Arena arena, CBS cbs, void *owner,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#include "protocol.h"
|
||||
#include "ring.h"
|
||||
#include "chain.h"
|
||||
#include "splay.h"
|
||||
#include "meter.h"
|
||||
|
||||
|
||||
/* PoolClassStruct -- pool class structure
|
||||
|
|
@ -600,6 +602,26 @@ typedef struct GlobalsStruct {
|
|||
} GlobalsStruct;
|
||||
|
||||
|
||||
/* CBSStruct -- coalescing block structure
|
||||
*
|
||||
* See <code/cbs.c>.
|
||||
*/
|
||||
|
||||
#define CBSSig ((Sig)0x519CB599) /* SIGnature CBS */
|
||||
|
||||
typedef struct CBSStruct {
|
||||
SplayTreeStruct splayTree;
|
||||
Count splayTreeSize;
|
||||
MFSStruct blockPoolStruct; /* FIXME: ref to why this is inlined */
|
||||
Align alignment;
|
||||
Bool fastFind;
|
||||
Bool inCBS; /* prevent reentrance */
|
||||
/* meters for sizes of search structures at each op */
|
||||
METER_DECL(splaySearch);
|
||||
Sig sig; /* sig at end because embeded */
|
||||
} CBSStruct;
|
||||
|
||||
|
||||
/* ArenaStruct -- generic arena
|
||||
*
|
||||
* See <code/arena.c>. */
|
||||
|
|
@ -634,6 +656,8 @@ typedef struct mps_arena_s {
|
|||
Serial chunkSerial; /* next chunk number */
|
||||
ChunkCacheEntryStruct chunkCache; /* just one entry */
|
||||
|
||||
CBSStruct freeCBS; /* CBS of free address space */
|
||||
|
||||
/* locus fields (<code/locus.c>) */
|
||||
GenDescStruct topGen; /* generation descriptor for dynamic gen */
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static Res MFSInit(Pool pool, ArgList args)
|
|||
extendBy = unitSize;
|
||||
}
|
||||
|
||||
AVER(extendBy >= unitSize);
|
||||
AVER(extendBy == 0 || extendBy >= unitSize);
|
||||
|
||||
mfs = PoolPoolMFS(pool);
|
||||
arena = PoolArena(pool);
|
||||
|
|
@ -190,6 +190,9 @@ static Res MFSAlloc(Addr *pReturn, Pool pool, Size size,
|
|||
Addr base;
|
||||
Header header = NULL, next;
|
||||
|
||||
if (mfs->extendBy == 0)
|
||||
return ResLIMIT;
|
||||
|
||||
/* Create a new region and attach it to the pool. */
|
||||
res = ArenaAlloc(&base, SegPrefDefault(), mfs->extendBy, pool,
|
||||
withReservoirPermit);
|
||||
|
|
@ -322,7 +325,7 @@ Bool MFSCheck(MFS mfs)
|
|||
CHECKD(Pool, &mfs->poolStruct);
|
||||
CHECKL(mfs->poolStruct.class == EnsureMFSPoolClass());
|
||||
CHECKL(mfs->unroundedUnitSize >= UNIT_MIN);
|
||||
CHECKL(mfs->extendBy >= UNIT_MIN);
|
||||
CHECKL(mfs->extendBy == 0 || mfs->extendBy >= UNIT_MIN);
|
||||
arena = PoolArena(&mfs->poolStruct);
|
||||
CHECKL(SizeIsAligned(mfs->extendBy, ArenaAlign(arena)));
|
||||
CHECKL(SizeAlignUp(mfs->unroundedUnitSize, mfs->poolStruct.alignment) ==
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue