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

Eliminating withreservoirpermit and all its variants.

Copied from Perforce
 Change: 190005
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2016-03-13 21:04:01 +00:00
parent ca7dcd913e
commit 07987ab579
46 changed files with 206 additions and 377 deletions

View file

@ -41,8 +41,7 @@ Res ABQInit(Arena arena, ABQ abq, void *owner, Count elements, Size elementSize)
"empty" from "full" */
elements = elements + 1;
res = ControlAlloc(&p, arena, ABQQueueSize(elements, elementSize),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, ABQQueueSize(elements, elementSize));
if (res != ResOK)
return res;

View file

@ -632,8 +632,7 @@ Res ArenaDescribeTracts(Arena arena, mps_lib_FILE *stream, Count depth)
* with void* (<design/type/#addr.use>), ControlAlloc must take care of
* allocating so that the block can be addressed with a void*. */
Res ControlAlloc(void **baseReturn, Arena arena, size_t size,
Bool withReservoirPermit)
Res ControlAlloc(void **baseReturn, Arena arena, size_t size)
{
Addr base;
Res res;
@ -641,11 +640,9 @@ Res ControlAlloc(void **baseReturn, Arena arena, size_t size,
AVERT(Arena, arena);
AVER(baseReturn != NULL);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
AVER(arena->poolReady);
res = PoolAlloc(&base, ArenaControlPool(arena), (Size)size,
withReservoirPermit);
res = PoolAlloc(&base, ArenaControlPool(arena), (Size)size);
if (res != ResOK)
return res;
@ -1076,8 +1073,7 @@ failMark:
/* ArenaAlloc -- allocate some tracts from the arena */
Res ArenaAlloc(Addr *baseReturn, LocusPref pref, Size size, Pool pool,
Bool withReservoirPermit)
Res ArenaAlloc(Addr *baseReturn, LocusPref pref, Size size, Pool pool)
{
Res res;
Arena arena;
@ -1088,7 +1084,6 @@ Res ArenaAlloc(Addr *baseReturn, LocusPref pref, Size size, Pool pool,
AVERT(LocusPref, pref);
AVER(size > (Size)0);
AVERT(Pool, pool);
AVERT(Bool, withReservoirPermit);
arena = PoolArena(pool);
AVERT(Arena, arena);

View file

@ -161,7 +161,7 @@ static Res allocAsTract(AllocInfoStruct *aiReturn, LocusPref pref,
{
Res res;
Addr base;
res = ArenaAlloc(&base, pref, size, pool, FALSE);
res = ArenaAlloc(&base, pref, size, pool);
if (res == ResOK) {
aiReturn->the.tractData.base = base;
aiReturn->the.tractData.size = size;
@ -249,7 +249,7 @@ static Res allocAsSeg(AllocInfoStruct *aiReturn, LocusPref pref,
{
Res res;
Seg seg;
res = SegAlloc(&seg, SegClassGet(), pref, size, pool, FALSE, argsNone);
res = SegAlloc(&seg, SegClassGet(), pref, size, pool, argsNone);
if (res == ResOK) {
aiReturn->the.segData.seg = seg;
}

View file

@ -191,8 +191,7 @@ Res BTCreate(BT *btReturn, Arena arena, Count length)
AVERT(Arena, arena);
AVER(length > 0);
res = ControlAlloc(&p, arena, BTSize(length),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, BTSize(length));
if (res != ResOK)
return res;
bt = (BT)p;

View file

@ -279,8 +279,7 @@ Res BufferCreate(Buffer *bufferReturn, BufferClass class,
arena = PoolArena(pool);
/* Allocate memory for the buffer descriptor structure. */
res = ControlAlloc(&p, arena, class->size,
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, class->size);
if (res != ResOK)
goto failAlloc;
buffer = p;
@ -588,8 +587,7 @@ Res BufferFramePop(Buffer buffer, AllocFrame frame)
*
* .reserve: Keep in sync with <code/mps.h#reserve>. */
Res BufferReserve(Addr *pReturn, Buffer buffer, Size size,
Bool withReservoirPermit)
Res BufferReserve(Addr *pReturn, Buffer buffer, Size size)
{
Addr next;
@ -598,7 +596,6 @@ Res BufferReserve(Addr *pReturn, Buffer buffer, Size size,
AVER(size > 0);
AVER(SizeIsAligned(size, BufferPool(buffer)->alignment));
AVER(BufferIsReady(buffer));
AVERT(Bool, withReservoirPermit);
/* Is there enough room in the unallocated portion of the buffer to */
/* satisfy the request? If so, just increase the alloc marker and */
@ -612,7 +609,7 @@ Res BufferReserve(Addr *pReturn, Buffer buffer, Size size,
}
/* If the buffer can't accommodate the request, call "fill". */
return BufferFill(pReturn, buffer, size, withReservoirPermit);
return BufferFill(pReturn, buffer, size);
}
@ -673,8 +670,7 @@ void BufferAttach(Buffer buffer, Addr base, Addr limit,
* allocation request. This might be because the buffer has been
* trapped and "limit" has been set to zero. */
Res BufferFill(Addr *pReturn, Buffer buffer, Size size,
Bool withReservoirPermit)
Res BufferFill(Addr *pReturn, Buffer buffer, Size size)
{
Res res;
Pool pool;
@ -721,9 +717,7 @@ Res BufferFill(Addr *pReturn, Buffer buffer, Size size,
BufferDetach(buffer, pool);
/* Ask the pool for some memory. */
res = (*pool->class->bufferFill)(&base, &limit,
pool, buffer, size,
withReservoirPermit);
res = (*pool->class->bufferFill)(&base, &limit, pool, buffer, size);
if (res != ResOK)
return res;

View file

@ -402,8 +402,7 @@ static Res cbsBlockAlloc(CBSBlock *blockReturn, CBS cbs, Range range)
AVERT(CBS, cbs);
AVERT(Range, range);
res = PoolAlloc(&p, cbsBlockPool(cbs), cbs->blockStructSize,
/* withReservoirPermit */ FALSE);
res = PoolAlloc(&p, cbsBlockPool(cbs), cbs->blockStructSize);
if (res != ResOK)
goto failPoolAlloc;
block = (CBSBlock)p;

View file

@ -397,14 +397,14 @@ static Bool freeCheck(PoolDebugMixin debug, Pool pool, Addr base, Addr limit)
/* freeCheckAlloc -- allocation wrapper for free-checking */
static Res freeCheckAlloc(Addr *aReturn, PoolDebugMixin debug, Pool pool,
Size size, Bool withReservoir)
Size size)
{
Res res;
Addr new;
AVER(aReturn != NULL);
res = SuperclassOfPool(pool)->alloc(&new, pool, size, withReservoir);
res = SuperclassOfPool(pool)->alloc(&new, pool, size);
if (res != ResOK)
return res;
if (debug->freeSize != 0)
@ -445,7 +445,7 @@ static void freeCheckFree(PoolDebugMixin debug,
*/
static Res fenceAlloc(Addr *aReturn, PoolDebugMixin debug, Pool pool,
Size size, Bool withReservoir)
Size size)
{
Res res;
Addr obj, startFence, clientNew, clientLimit, limit;
@ -458,8 +458,7 @@ static Res fenceAlloc(Addr *aReturn, PoolDebugMixin debug, Pool pool,
alignedFenceSize = SizeAlignUp(debug->fenceSize, PoolAlignment(pool));
alignedSize = SizeAlignUp(size, PoolAlignment(pool));
res = freeCheckAlloc(&obj, debug, pool,
alignedSize + 2 * alignedFenceSize,
withReservoir);
alignedSize + 2 * alignedFenceSize);
if (res != ResOK)
return res;
@ -526,7 +525,7 @@ static void fenceFree(PoolDebugMixin debug,
/* tagAlloc -- allocation wrapper for tagged pools */
static Res tagAlloc(PoolDebugMixin debug,
Pool pool, Addr new, Size size, Bool withReservoir)
Pool pool, Addr new, Size size)
{
Tag tag;
Res res;
@ -534,15 +533,9 @@ static Res tagAlloc(PoolDebugMixin debug,
Addr addr;
UNUSED(pool);
res = PoolAlloc(&addr, debug->tagPool, debug->tagSize, FALSE);
if (res != ResOK) {
if (withReservoir) { /* <design/object-debug/#out-of-space */
debug->missingTags++;
return ResOK;
} else {
return res;
}
}
res = PoolAlloc(&addr, debug->tagPool, debug->tagSize);
if (res != ResOK)
return res;
tag = (Tag)addr;
tag->addr = new; tag->size = size;
TreeInit(TagTree(tag));
@ -585,8 +578,7 @@ static void tagFree(PoolDebugMixin debug, Pool pool, Addr old, Size size)
* Eventually, tag init args will need to be handled somewhere here.
*/
static Res DebugPoolAlloc(Addr *aReturn,
Pool pool, Size size, Bool withReservoir)
static Res DebugPoolAlloc(Addr *aReturn, Pool pool, Size size)
{
Res res;
Addr new = NULL; /* suppress "may be used uninitialized" warning */
@ -595,20 +587,19 @@ static Res DebugPoolAlloc(Addr *aReturn,
AVER(aReturn != NULL);
AVERT(Pool, pool);
AVER(size > 0);
AVERT(Bool, withReservoir);
debug = DebugPoolDebugMixin(pool);
AVER(debug != NULL);
AVERT(PoolDebugMixin, debug);
if (debug->fenceSize != 0)
res = fenceAlloc(&new, debug, pool, size, withReservoir);
res = fenceAlloc(&new, debug, pool, size);
else
res = freeCheckAlloc(&new, debug, pool, size, withReservoir);
res = freeCheckAlloc(&new, debug, pool, size);
if (res != ResOK)
return res;
/* Allocate object first, so it fits even when the tag doesn't. */
if (debug->tagInit != NULL) {
res = tagAlloc(debug, pool, new, size, withReservoir);
res = tagAlloc(debug, pool, new, size);
if (res != ResOK)
goto tagFail;
}

View file

@ -583,8 +583,7 @@
#define EVENT_SegMerge_PARAMS(PARAM, X) \
PARAM(X, 0, P, segLo) \
PARAM(X, 1, P, segHi) \
PARAM(X, 2, B, withReservoirPermit)
PARAM(X, 1, P, segHi)
#define EVENT_SegSplit_PARAMS(PARAM, X) \
PARAM(X, 0, P, seg) \

View file

@ -576,8 +576,7 @@ extern int main(int argc, char *argv[])
/* We're not going to use this block, but I feel unhappy just */
/* inventing addresses. */
die((mps_res_t)ControlAlloc(&p, arena, ArraySize * align,
/* withReservoirPermit */ FALSE),
die((mps_res_t)ControlAlloc(&p, arena, ArraySize * align);
"failed to allocate block");
dummyBlock = p; /* avoid pun */

View file

@ -133,8 +133,7 @@ Res FormatCreate(Format *formatReturn, Arena arena, ArgList args)
if (ArgPick(&arg, args, MPS_KEY_FMT_CLASS))
fmtClass = arg.val.fmt_class;
res = ControlAlloc(&p, arena, sizeof(FormatStruct),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, sizeof(FormatStruct));
if(res != ResOK)
return res;
format = (Format)p; /* avoid pun */

View file

@ -45,13 +45,11 @@ extern Land _mps_mvt_cbs(Pool);
/* "OOM" pool class -- dummy alloc/free pool class whose alloc()
* method always fails and whose free method does nothing. */
static Res oomAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
static Res oomAlloc(Addr *pReturn, Pool pool, Size size)
{
UNUSED(pReturn);
UNUSED(pool);
UNUSED(size);
UNUSED(withReservoirPermit);
switch (rnd() % 3) {
case 0:
return ResRESOURCE;

View file

@ -352,7 +352,7 @@ Res GlobalsCompleteCreate(Globals arenaGlobals)
{
void *v;
res = ControlAlloc(&v, arena, BTSize(MessageTypeLIMIT), FALSE);
res = ControlAlloc(&v, arena, BTSize(MessageTypeLIMIT));
if (res != ResOK)
return res;
arena->enabledMessageTypes = v;
@ -366,7 +366,7 @@ Res GlobalsCompleteCreate(Globals arenaGlobals)
return res;
TRACE_SET_ITER_END(ti, trace, TraceSetUNIV, arena);
res = ControlAlloc(&p, arena, LockSize(), FALSE);
res = ControlAlloc(&p, arena, LockSize());
if (res != ResOK)
return res;
arenaGlobals->lock = (Lock)p;

View file

@ -117,8 +117,7 @@ Res LandCreate(Land *landReturn, Arena arena, LandClass class, Align alignment,
AVERT(Arena, arena);
AVERT(LandClass, class);
res = ControlAlloc(&p, arena, class->size,
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, class->size);
if (res != ResOK)
goto failAlloc;
land = p;

View file

@ -459,8 +459,7 @@ extern int main(int argc, char *argv[])
die((mps_res_t)BTCreate(&state.allocTable, arena, state.size),
"failed to create alloc table");
die((mps_res_t)ControlAlloc(&p, arena, (state.size + 1) * state.align,
/* withReservoirPermit */ FALSE),
die((mps_res_t)ControlAlloc(&p, arena, (state.size + 1) * state.align),
"failed to allocate block");
state.block = AddrAlignUp(p, state.align);

View file

@ -205,7 +205,7 @@ Res ChainCreate(Chain *chainReturn, Arena arena, size_t genCount,
AVER(params[i].mortality < 1.0);
}
res = ControlAlloc(&p, arena, genCount * sizeof(GenDescStruct), FALSE);
res = ControlAlloc(&p, arena, genCount * sizeof(GenDescStruct));
if (res != ResOK)
return res;
gens = (GenDescStruct *)p;
@ -219,7 +219,7 @@ Res ChainCreate(Chain *chainReturn, Arena arena, size_t genCount,
AVERT(GenDesc, &gens[i]);
}
res = ControlAlloc(&p, arena, sizeof(ChainStruct), FALSE);
res = ControlAlloc(&p, arena, sizeof(ChainStruct));
if (res != ResOK)
goto failChainAlloc;
chain = (Chain)p;
@ -313,7 +313,7 @@ GenDesc ChainGen(Chain chain, Index gen)
*/
Res PoolGenAlloc(Seg *segReturn, PoolGen pgen, SegClass class, Size size,
Bool withReservoirPermit, ArgList args)
ArgList args)
{
LocusPrefStruct pref;
Res res;
@ -326,7 +326,6 @@ Res PoolGenAlloc(Seg *segReturn, PoolGen pgen, SegClass class, Size size,
AVERT(PoolGen, pgen);
AVERT(SegClass, class);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
AVERT(ArgList, args);
arena = PoolArena(pgen->pool);
@ -337,8 +336,7 @@ Res PoolGenAlloc(Seg *segReturn, PoolGen pgen, SegClass class, Size size,
pref.high = FALSE;
pref.zones = zones;
pref.avoid = ZoneSetBlacklist(arena);
res = SegAlloc(&seg, class, &pref, size, pgen->pool, withReservoirPermit,
args);
res = SegAlloc(&seg, class, &pref, size, pgen->pool, args);
if (res != ResOK)
return res;

View file

@ -96,7 +96,7 @@ extern Bool PoolGenCheck(PoolGen pgen);
extern Res PoolGenInit(PoolGen pgen, GenDesc gen, Pool pool);
extern void PoolGenFinish(PoolGen pgen);
extern Res PoolGenAlloc(Seg *segReturn, PoolGen pgen, SegClass class,
Size size, Bool withReservoirPermit, ArgList args);
Size size, ArgList args);
extern void PoolGenFree(PoolGen pgen, Seg seg, Size freeSize, Size oldSize,
Size newSize, Bool deferred);
extern void PoolGenAccountForFill(PoolGen pgen, Size size, Bool deferred);

View file

@ -77,7 +77,7 @@ static void postDummyMessage(Arena arena, MessageClass class,
void *p;
Message message;
die((mps_res_t)ControlAlloc(&p, arena, sizeof(MessageStruct), FALSE),
die((mps_res_t)ControlAlloc(&p, arena, sizeof(MessageStruct)),
"AllocMessage");
message = (Message)p;
MessageInit(arena, message, class, type);

View file

@ -208,8 +208,7 @@ extern Res PoolCreate(Pool *poolReturn, Arena arena, PoolClass class,
ArgList args);
extern void PoolDestroy(Pool pool);
extern BufferClass PoolDefaultBufferClass(Pool pool);
extern Res PoolAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit);
extern Res PoolAlloc(Addr *pReturn, Pool pool, Size size);
extern void PoolFree(Pool pool, Addr old, Size size);
extern Res PoolTraceBegin(Pool pool, Trace trace);
extern Res PoolAccess(Pool pool, Seg seg, Addr addr,
@ -233,18 +232,14 @@ extern Size PoolFreeSize(Pool pool);
extern Res PoolTrivInit(Pool pool, ArgList arg);
extern void PoolTrivFinish(Pool pool);
extern Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit);
extern Res PoolTrivAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit);
extern Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size);
extern Res PoolTrivAlloc(Addr *pReturn, Pool pool, Size size);
extern void PoolNoFree(Pool pool, Addr old, Size size);
extern void PoolTrivFree(Pool pool, Addr old, Size size);
extern Res PoolNoBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit);
Pool pool, Buffer buffer, Size size);
extern Res PoolTrivBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit);
Pool pool, Buffer buffer, Size size);
extern void PoolNoBufferEmpty(Pool pool, Buffer buffer,
Addr init, Addr limit);
extern void PoolTrivBufferEmpty(Pool pool, Buffer buffer,
@ -576,8 +571,7 @@ extern Bool ArenaEmergency(Arena arean);
extern Res ControlInit(Arena arena);
extern void ControlFinish(Arena arena);
extern Res ControlAlloc(void **baseReturn, Arena arena, size_t size,
Bool withReservoirPermit);
extern Res ControlAlloc(void **baseReturn, Arena arena, size_t size);
extern void ControlFree(Arena arena, void *base, size_t size);
extern Res ControlDescribe(Arena arena, mps_lib_FILE *stream, Count depth);
@ -635,7 +629,7 @@ extern Res ArenaFinalize(Arena arena, Ref obj);
extern Res ArenaDefinalize(Arena arena, Ref obj);
extern Res ArenaAlloc(Addr *baseReturn, LocusPref pref,
Size size, Pool pool, Bool withReservoirPermit);
Size size, Pool pool);
extern Res ArenaFreeLandAlloc(Tract *tractReturn, Arena arena, ZoneSet zones,
Bool high, Size size, Pool pool);
extern void ArenaFree(Addr base, Size size, Pool pool);
@ -671,7 +665,7 @@ extern Bool LocusCheck(Arena arena);
/* Segment interface */
extern Res SegAlloc(Seg *segReturn, SegClass class, LocusPref pref,
Size size, Pool pool, Bool withReservoirPermit,
Size size, Pool pool,
ArgList args);
extern void SegFree(Seg seg);
extern Bool SegOfAddr(Seg *segReturn, Arena arena, Addr addr);
@ -682,10 +676,8 @@ extern void SegSetWhite(Seg seg, TraceSet white);
extern void SegSetGrey(Seg seg, TraceSet grey);
extern void SegSetRankSet(Seg seg, RankSet rankSet);
extern void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary);
extern Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
Bool withReservoirPermit);
extern Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at,
Bool withReservoirPermit);
extern Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi);
extern Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at);
extern Res SegDescribe(Seg seg, mps_lib_FILE *stream, Count depth);
extern void SegSetSummary(Seg seg, RefSet summary);
extern Buffer SegBuffer(Seg seg);
@ -746,21 +738,19 @@ extern void BufferDestroy(Buffer buffer);
extern Bool BufferCheck(Buffer buffer);
extern Bool SegBufCheck(SegBuf segbuf);
extern Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth);
extern Res BufferReserve(Addr *pReturn, Buffer buffer, Size size,
Bool withReservoirPermit);
extern Res BufferReserve(Addr *pReturn, Buffer buffer, Size size);
/* macro equivalent for BufferReserve, keep in sync with <code/buffer.c> */
/* TODO: Perhaps this isn't really necessary now that we build the MPS with
more global optimisation and inlining. RB 2012-09-07 */
#define BUFFER_RESERVE(pReturn, buffer, size, withReservoirPermit) \
#define BUFFER_RESERVE(pReturn, buffer, size) \
(AddrAdd(BufferAlloc(buffer), size) > BufferAlloc(buffer) && \
AddrAdd(BufferAlloc(buffer), size) <= (Addr)BufferAP(buffer)->limit ? \
(*(pReturn) = BufferAlloc(buffer), \
BufferAP(buffer)->alloc = AddrAdd(BufferAlloc(buffer), size), \
ResOK) : \
BufferFill(pReturn, buffer, size, withReservoirPermit))
BufferFill(pReturn, buffer, size))
extern Res BufferFill(Addr *pReturn, Buffer buffer, Size size,
Bool withReservoirPermit);
extern Res BufferFill(Addr *pReturn, Buffer buffer, Size size);
extern Bool BufferCommit(Buffer buffer, Addr p, Size size);
/* macro equivalent for BufferCommit, keep in sync with <code/buffer.c> */

View file

@ -156,7 +156,7 @@ typedef void (*FreeBlockVisitor)(Addr base, Addr limit, Pool pool, void *p);
/* Seg*Method -- see <design/seg/> */
typedef Res (*SegInitMethod)(Seg seg, Pool pool, Addr base, Size size,
Bool withReservoirPermit, ArgList args);
ArgList args);
typedef void (*SegFinishMethod)(Seg seg);
typedef void (*SegSetGreyMethod)(Seg seg, TraceSet grey);
typedef void (*SegSetWhiteMethod)(Seg seg, TraceSet white);
@ -168,11 +168,9 @@ typedef Buffer (*SegBufferMethod)(Seg seg);
typedef void (*SegSetBufferMethod)(Seg seg, Buffer buffer);
typedef Res (*SegDescribeMethod)(Seg seg, mps_lib_FILE *stream, Count depth);
typedef Res (*SegMergeMethod)(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit);
Addr base, Addr mid, Addr limit);
typedef Res (*SegSplitMethod)(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit);
Addr base, Addr mid, Addr limit);
/* Buffer*Method -- see <design/buffer/> */
@ -196,12 +194,10 @@ typedef Res (*BufferDescribeMethod)(Buffer buffer, mps_lib_FILE *stream, Count d
typedef void (*PoolVarargsMethod)(ArgStruct args[], va_list varargs);
typedef Res (*PoolInitMethod)(Pool pool, ArgList args);
typedef void (*PoolFinishMethod)(Pool pool);
typedef Res (*PoolAllocMethod)(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit);
typedef Res (*PoolAllocMethod)(Addr *pReturn, Pool pool, Size size);
typedef void (*PoolFreeMethod)(Pool pool, Addr old, Size size);
typedef Res (*PoolBufferFillMethod)(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit);
Pool pool, Buffer buffer, Size size);
typedef void (*PoolBufferEmptyMethod)(Pool pool, Buffer buffer,
Addr init, Addr limit);
typedef Res (*PoolTraceBeginMethod)(Pool pool, Trace trace);

View file

@ -742,7 +742,7 @@ mps_res_t mps_alloc(mps_addr_t *p_o, mps_pool_t pool, size_t size)
/* @@@@ There is currently no requirement for reservoirs to work */
/* with unbuffered allocation. */
res = PoolAlloc(&p, pool, size, FALSE);
res = PoolAlloc(&p, pool, size);
ArenaLeave(arena);
@ -1035,7 +1035,7 @@ mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size)
AVER(size > 0);
AVER(SizeIsAligned(size, BufferPool(buf)->alignment));
res = BufferFill(&p, buf, size, FALSE);
res = BufferFill(&p, buf, size);
ArenaLeave(arena);
@ -1158,10 +1158,11 @@ mps_res_t mps_sac_fill(mps_addr_t *p_o, mps_sac_t mps_sac, size_t size,
AVER(p_o != NULL);
AVER(TESTT(SAC, sac));
arena = SACArena(sac);
UNUSED(has_reservoir_permit); /* FIXME */
ArenaEnter(arena);
res = SACFill(&p, sac, size, (has_reservoir_permit != 0));
res = SACFill(&p, sac, size);
ArenaLeave(arena);

View file

@ -127,7 +127,7 @@ Res NailboardCreate(Nailboard *boardReturn, Arena arena, Align alignment,
alignShift = SizeLog2((Size)alignment);
nails = AddrOffset(base, limit) >> alignShift;
levels = nailboardLevels(nails);
res = ControlAlloc(&p, arena, nailboardSize(nails, levels), FALSE);
res = ControlAlloc(&p, arena, nailboardSize(nails, levels));
if (res != ResOK)
return res;

View file

@ -195,8 +195,7 @@ Res PoolCreate(Pool *poolReturn, Arena arena,
/* .space.alloc: Allocate the pool instance structure with the size */
/* requested in the pool class. See .space.free */
res = ControlAlloc(&base, arena, class->size,
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&base, arena, class->size);
if (res != ResOK)
goto failControlAlloc;
@ -274,17 +273,15 @@ BufferClass PoolDefaultBufferClass(Pool pool)
/* PoolAlloc -- allocate a block of memory from a pool */
Res PoolAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
Res PoolAlloc(Addr *pReturn, Pool pool, Size size)
{
Res res;
AVER(pReturn != NULL);
AVERT(Pool, pool);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
res = (*pool->class->alloc)(pReturn, pool, size, withReservoirPermit);
res = (*pool->class->alloc)(pReturn, pool, size);
if (res != ResOK)
return res;
/* Make sure that the allocated address was in the pool's memory. */

View file

@ -196,24 +196,20 @@ Res PoolTrivInit(Pool pool, ArgList args)
return ResOK;
}
Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size)
{
AVER(pReturn != NULL);
AVERT(Pool, pool);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
NOTREACHED;
return ResUNIMPL;
}
Res PoolTrivAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
Res PoolTrivAlloc(Addr *pReturn, Pool pool, Size size)
{
AVER(pReturn != NULL);
AVERT(Pool, pool);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
return ResLIMIT;
}
@ -235,22 +231,19 @@ void PoolTrivFree(Pool pool, Addr old, Size size)
Res PoolNoBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
AVER(baseReturn != NULL);
AVER(limitReturn != NULL);
AVERT(Pool, pool);
AVERT(Buffer, buffer);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
NOTREACHED;
return ResUNIMPL;
}
Res PoolTrivBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
Res res;
Addr p;
@ -260,9 +253,8 @@ Res PoolTrivBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Pool, pool);
AVERT(Buffer, buffer);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
res = PoolAlloc(&p, pool, size, withReservoirPermit);
res = PoolAlloc(&p, pool, size);
if (res != ResOK)
return res;

View file

@ -123,8 +123,7 @@ static Bool amcSegCheck(amcSeg amcseg)
ARG_DEFINE_KEY(amc_seg_gen, Pointer);
#define amcKeySegGen (&_mps_key_amc_seg_gen)
static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
amcGen amcgen;
SegClass super;
@ -138,11 +137,10 @@ static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size,
AVERT(Seg, seg);
amcseg = Seg2amcSeg(seg);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(amcSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if(res != ResOK)
return res;
@ -592,7 +590,7 @@ static Res amcGenCreate(amcGen *genReturn, AMC amc, GenDesc gen)
pool = AMCPool(amc);
arena = pool->arena;
res = ControlAlloc(&p, arena, sizeof(amcGenStruct), FALSE);
res = ControlAlloc(&p, arena, sizeof(amcGenStruct));
if(res != ResOK)
goto failControlAlloc;
amcgen = (amcGen)p;
@ -807,7 +805,7 @@ static Res amcInitComm(Pool pool, RankSet rankSet, ArgList args)
/* One gen for each one in the chain plus dynamic gen. */
genArraySize = sizeof(amcGen) * (genCount + 1);
res = ControlAlloc(&p, arena, genArraySize, FALSE);
res = ControlAlloc(&p, arena, genArraySize);
if(res != ResOK)
goto failGensAlloc;
amc->gen = p;
@ -916,8 +914,7 @@ static void AMCFinish(Pool pool)
* See <design/poolamc/#fill>.
*/
static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
Seg seg;
AMC amc;
@ -938,7 +935,6 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
AVER(BufferIsReset(buffer));
AVER(size > 0);
AVER(SizeIsAligned(size, PoolAlignment(pool)));
AVERT(Bool, withReservoirPermit);
arena = PoolArena(pool);
gen = amcBufGen(buffer);
@ -957,8 +953,7 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
}
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD_FIELD(args, amcKeySegGen, p, gen);
res = PoolGenAlloc(&seg, pgen, amcSegClassGet(), grainsSize,
withReservoirPermit, args);
res = PoolGenAlloc(&seg, pgen, amcSegClassGet(), grainsSize, args);
} MPS_ARGS_END(args);
if(res != ResOK)
return res;
@ -1642,7 +1637,7 @@ static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
STATISTIC_STAT(++ss->forwardedCount);
ss->forwardedSize += length;
do {
res = BUFFER_RESERVE(&newBase, buffer, length, FALSE);
res = BUFFER_RESERVE(&newBase, buffer, length);
if (res != ResOK)
goto returnRes;
newRef = AddrAdd(newBase, headerSize);

View file

@ -215,8 +215,7 @@ static void amsDestroyTables(AMS ams, BT allocTable,
/* AMSSegInit -- Init method for AMS segments */
static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
SegClass super;
AMSSeg amsseg;
@ -231,11 +230,10 @@ static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size,
AVERT(AMS, ams);
arena = PoolArena(pool);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(AMSSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (res != ResOK)
goto failNextMethod;
@ -328,8 +326,7 @@ static void AMSSegFinish(Seg seg)
*/
static Res AMSSegMerge(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
SegClass super;
Count loGrains, hiGrains, allGrains;
@ -367,8 +364,7 @@ static Res AMSSegMerge(Seg seg, Seg segHi,
/* Merge the superclass fields via next-method call */
super = SEG_SUPERCLASS(AMSSegClass);
res = super->merge(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->merge(seg, segHi, base, mid, limit);
if (res != ResOK)
goto failSuper;
@ -414,8 +410,7 @@ failCreateTables:
static Res AMSSegSplit(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
SegClass super;
Count loGrains, hiGrains, allGrains;
@ -462,7 +457,7 @@ static Res AMSSegSplit(Seg seg, Seg segHi,
/* Split the superclass fields via next-method call */
super = SEG_SUPERCLASS(AMSSegClass);
res = super->split(seg, segHi, base, mid, limit, withReservoirPermit);
res = super->split(seg, segHi, base, mid, limit);
if (res != ResOK)
goto failSuper;
@ -682,7 +677,7 @@ static Res AMSSegSizePolicy(Size *sizeReturn,
/* AMSSegCreate -- create a single AMSSeg */
static Res AMSSegCreate(Seg *segReturn, Pool pool, Size size,
RankSet rankSet, Bool withReservoirPermit)
RankSet rankSet)
{
Seg seg;
AMS ams;
@ -694,7 +689,6 @@ static Res AMSSegCreate(Seg *segReturn, Pool pool, Size size,
AVERT(Pool, pool);
AVER(size > 0);
AVERT(RankSet, rankSet);
AVERT(Bool, withReservoirPermit);
ams = PoolAMS(pool);
AVERT(AMS,ams);
@ -705,13 +699,13 @@ static Res AMSSegCreate(Seg *segReturn, Pool pool, Size size,
goto failSize;
res = PoolGenAlloc(&seg, &ams->pgen, (*ams->segClass)(), prefSize,
withReservoirPermit, argsNone);
argsNone);
if (res != ResOK) { /* try to allocate one that's just large enough */
Size minSize = SizeArenaGrains(size, arena);
if (minSize == prefSize)
goto failSeg;
res = PoolGenAlloc(&seg, &ams->pgen, (*ams->segClass)(), prefSize,
withReservoirPermit, argsNone);
argsNone);
if (res != ResOK)
goto failSeg;
}
@ -946,8 +940,7 @@ static Bool amsSegAlloc(Index *baseReturn, Index *limitReturn,
* <design/poolams/#fill>.
*/
static Res AMSBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
Res res;
AMS ams;
@ -967,7 +960,6 @@ static Res AMSBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Buffer, buffer);
AVER(size > 0);
AVER(SizeIsAligned(size, PoolAlignment(pool)));
AVERT(Bool, withReservoirPermit);
/* Check that we're not in the grey mutator phase (see */
/* <design/poolams/#fill.colour>). */
@ -996,8 +988,7 @@ static Res AMSBufferFill(Addr *baseReturn, Addr *limitReturn,
}
/* No suitable segment found; make a new one. */
res = AMSSegCreate(&seg, pool, size, rankSet,
withReservoirPermit);
res = AMSSegCreate(&seg, pool, size, rankSet);
if (res != ResOK)
return res;
b = amsSegAlloc(&base, &limit, seg, size);

View file

@ -172,8 +172,7 @@ static void awlStatTotalInit(AWL awl)
ARG_DEFINE_KEY(awl_seg_rank_set, RankSet);
#define awlKeySegRankSet (&_mps_key_awl_seg_rank_set)
static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
SegClass super;
AWLSeg awlseg;
@ -191,7 +190,6 @@ static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size,
AVERT(Pool, pool);
arena = PoolArena(pool);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
ArgRequire(&arg, args, awlKeySegRankSet);
rankSet = arg.val.u;
AVERT(RankSet, rankSet);
@ -204,21 +202,21 @@ static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size,
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(AWLSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (res != ResOK)
return res;
bits = size >> awl->alignShift;
tableSize = BTSize(bits);
res = ControlAlloc(&v, arena, tableSize, reservoirPermit);
res = ControlAlloc(&v, arena, tableSize);
if (res != ResOK)
goto failControlAllocMark;
awlseg->mark = v;
res = ControlAlloc(&v, arena, tableSize, reservoirPermit);
res = ControlAlloc(&v, arena, tableSize);
if (res != ResOK)
goto failControlAllocScanned;
awlseg->scanned = v;
res = ControlAlloc(&v, arena, tableSize, reservoirPermit);
res = ControlAlloc(&v, arena, tableSize);
if (res != ResOK)
goto failControlAllocAlloc;
awlseg->alloc = v;
@ -451,8 +449,7 @@ static void AWLNoteScan(AWL awl, Seg seg, ScanState ss)
/* AWLSegCreate -- Create a new segment of at least given size */
static Res AWLSegCreate(AWLSeg *awlsegReturn,
RankSet rankSet, Pool pool, Size size,
Bool reservoirPermit)
RankSet rankSet, Pool pool, Size size)
{
AWL awl;
Seg seg;
@ -464,7 +461,6 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn,
AVERT(RankSet, rankSet);
AVERT(Pool, pool);
AVER(size > 0);
AVERT(Bool, reservoirPermit);
awl = PoolAWL(pool);
AVERT(AWL, awl);
@ -478,8 +474,7 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn,
return ResMEMORY;
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD_FIELD(args, awlKeySegRankSet, u, rankSet);
res = PoolGenAlloc(&seg, &awl->pgen, AWLSegClassGet(), size,
reservoirPermit, args);
res = PoolGenAlloc(&seg, &awl->pgen, AWLSegClassGet(), size, args);
} MPS_ARGS_END(args);
if (res != ResOK)
return res;
@ -636,8 +631,7 @@ static void AWLFinish(Pool pool)
/* AWLBufferFill -- BufferFill method for AWL */
static Res AWLBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool reservoirPermit)
Pool pool, Buffer buffer, Size size)
{
Addr base, limit;
AWLSeg awlseg;
@ -650,7 +644,6 @@ static Res AWLBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Pool, pool);
AVERT(Buffer, buffer);
AVER(size > 0);
AVERT(Bool, reservoirPermit);
awl = PoolAWL(pool);
AVERT(AWL, awl);
@ -674,8 +667,7 @@ static Res AWLBufferFill(Addr *baseReturn, Addr *limitReturn,
/* No free space in existing awlsegs, so create new awlseg */
res = AWLSegCreate(&awlseg, BufferRankSet(buffer), pool, size,
reservoirPermit);
res = AWLSegCreate(&awlseg, BufferRankSet(buffer), pool, size);
if (res != ResOK)
return res;
base = SegBase(AWLSeg2Seg(awlseg));

View file

@ -59,8 +59,7 @@ typedef struct LOSegStruct {
/* forward decls */
static Res loSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args);
static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args);
static void loSegFinish(Seg seg);
static Count loSegGrains(LOSeg loseg);
@ -98,8 +97,7 @@ static Bool LOSegCheck(LOSeg loseg)
/* loSegInit -- Init method for LO segments */
static Res loSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
SegClass super;
LOSeg loseg;
@ -116,13 +114,12 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size,
AVERT(Pool, pool);
arena = PoolArena(pool);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
lo = PoolPoolLO(pool);
AVERT(LO, lo);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(LOSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if(res != ResOK)
return res;
@ -130,11 +127,11 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size,
grains = size >> lo->alignShift;
tablebytes = BTSize(grains);
res = ControlAlloc(&p, arena, tablebytes, reservoirPermit);
res = ControlAlloc(&p, arena, tablebytes);
if(res != ResOK)
goto failMarkTable;
loseg->mark = p;
res = ControlAlloc(&p, arena, tablebytes, reservoirPermit);
res = ControlAlloc(&p, arena, tablebytes);
if(res != ResOK)
goto failAllocTable;
loseg->alloc = p;
@ -280,8 +277,7 @@ static Bool loSegFindFree(Addr *bReturn, Addr *lReturn,
* Segments will be multiples of ArenaGrainSize.
*/
static Res loSegCreate(LOSeg *loSegReturn, Pool pool, Size size,
Bool withReservoirPermit)
static Res loSegCreate(LOSeg *loSegReturn, Pool pool, Size size)
{
LO lo;
Seg seg;
@ -290,13 +286,12 @@ static Res loSegCreate(LOSeg *loSegReturn, Pool pool, Size size,
AVER(loSegReturn != NULL);
AVERT(Pool, pool);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
lo = PoolPoolLO(pool);
AVERT(LO, lo);
res = PoolGenAlloc(&seg, &lo->pgen, EnsureLOSegClass(),
SizeArenaGrains(size, PoolArena(pool)),
withReservoirPermit, argsNone);
argsNone);
if (res != ResOK)
return res;
@ -556,7 +551,7 @@ static void LOFinish(Pool pool)
static Res LOBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer,
Size size, Bool withReservoirPermit)
Size size)
{
Res res;
Ring node, nextNode;
@ -574,7 +569,6 @@ static Res LOBufferFill(Addr *baseReturn, Addr *limitReturn,
AVER(BufferRankSet(buffer) == RankSetEMPTY);
AVER(size > 0);
AVER(SizeIsAligned(size, PoolAlignment(pool)));
AVERT(Bool, withReservoirPermit);
/* Try to find a segment with enough space already. */
RING_FOR(node, &pool->segRing, nextNode) {
@ -587,7 +581,7 @@ static Res LOBufferFill(Addr *baseReturn, Addr *limitReturn,
}
/* No segment had enough space, so make a new one. */
res = loSegCreate(&loseg, pool, size, withReservoirPermit);
res = loSegCreate(&loseg, pool, size);
if(res != ResOK) {
goto failCreate;
}

View file

@ -225,8 +225,7 @@ void MFSExtend(Pool pool, Addr base, Size size)
* arena.
*/
static Res MFSAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
static Res MFSAlloc(Addr *pReturn, Pool pool, Size size)
{
Header f;
Res res;
@ -238,7 +237,6 @@ static Res MFSAlloc(Addr *pReturn, Pool pool, Size size,
AVER(pReturn != NULL);
AVER(size == mfs->unroundedUnitSize);
AVERT(Bool, withReservoirPermit);
f = mfs->freeList;
@ -253,8 +251,7 @@ static Res MFSAlloc(Addr *pReturn, Pool pool, Size size,
return ResLIMIT;
/* Create a new region and attach it to the pool. */
res = ArenaAlloc(&base, LocusPrefDefault(), mfs->extendBy, pool,
withReservoirPermit);
res = ArenaAlloc(&base, LocusPrefDefault(), mfs->extendBy, pool);
if(res != ResOK)
return res;

View file

@ -215,7 +215,7 @@ static Bool MRGRefSegCheck(MRGRefSeg refseg)
/* MRGLinkSegInit -- initialise a link segment */
static Res MRGLinkSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
ArgList args)
{
SegClass super;
MRGLinkSeg linkseg;
@ -228,11 +228,10 @@ static Res MRGLinkSegInit(Seg seg, Pool pool, Addr base, Size size,
mrg = PoolMRG(pool);
AVERT(MRG, mrg);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(MRGLinkSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (res != ResOK)
return res;
linkseg->refSeg = NULL; /* .link.nullref */
@ -248,8 +247,7 @@ static Res MRGLinkSegInit(Seg seg, Pool pool, Addr base, Size size,
ARG_DEFINE_KEY(mrg_seg_link_seg, Pointer);
#define mrgKeyLinkSeg (&_mps_key_mrg_seg_link_seg)
static Res MRGRefSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res MRGRefSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
MRGLinkSeg linkseg;
MRGRefSeg refseg;
@ -271,12 +269,11 @@ static Res MRGRefSegInit(Seg seg, Pool pool, Addr base, Size size,
mrg = PoolMRG(pool);
AVERT(MRG, mrg);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
AVERT(MRGLinkSeg, linkseg);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(MRGRefSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (res != ResOK)
return res;
@ -499,8 +496,7 @@ static void MRGSegPairDestroy(MRGRefSeg refseg)
/* MRGSegPairCreate -- create a pair of segments (link & ref) */
static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg,
Bool withReservoirPermit)
static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg)
{
RefPart refPartBase;
Count nGuardians; /* guardians per seg */
@ -525,7 +521,7 @@ static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg,
res = SegAlloc(&segLink, EnsureMRGLinkSegClass(),
LocusPrefDefault(), linkSegSize, pool,
withReservoirPermit, argsNone);
argsNone);
if (res != ResOK)
goto failLinkSegAlloc;
linkseg = Seg2LinkSeg(segLink);
@ -534,7 +530,7 @@ static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg,
MPS_ARGS_ADD_FIELD(args, mrgKeyLinkSeg, p, linkseg); /* .ref.initarg */
res = SegAlloc(&segRefPart, EnsureMRGRefSegClass(),
LocusPrefDefault(), mrg->extendBy, pool,
withReservoirPermit, args);
args);
} MPS_ARGS_END(args);
if (res != ResOK)
goto failRefPartSegAlloc;
@ -722,7 +718,7 @@ Res MRGRegister(Pool pool, Ref ref)
/* <design/poolmrg/#alloc.grow> */
if (RingIsSingle(&mrg->freeRing)) {
res = MRGSegPairCreate(&junk, mrg, /* withReservoirPermit */ FALSE);
res = MRGSegPairCreate(&junk, mrg);
if (res != ResOK)
return res;
}

View file

@ -458,8 +458,7 @@ static Res MVSpanFree(MVSpan span, Addr base, Addr limit, Pool blockPool)
/* The freed area is buried in the middle of the block, so the */
/* block must be split into two parts. */
res = PoolAlloc(&addr, blockPool, sizeof(MVBlockStruct),
/* withReservoirPermit */ FALSE);
res = PoolAlloc(&addr, blockPool, sizeof(MVBlockStruct));
if (res != ResOK)
return res;
new = (MVBlock)addr;
@ -513,8 +512,7 @@ static Res MVSpanFree(MVSpan span, Addr base, Addr limit, Pool blockPool)
/* MVAlloc -- allocate method for class MV */
static Res MVAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
static Res MVAlloc(Addr *pReturn, Pool pool, Size size)
{
Res res;
MVSpan span;
@ -530,7 +528,6 @@ static Res MVAlloc(Addr *pReturn, Pool pool, Size size,
mv = PoolMV(pool);
AVERT(MV, mv);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
size = SizeAlignUp(size, pool->alignment);
@ -556,8 +553,7 @@ static Res MVAlloc(Addr *pReturn, Pool pool, Size size,
/* pool with a new region which will hold the requested allocation. */
/* Allocate a new span descriptor and initialize it to point at the */
/* region. */
res = PoolAlloc(&addr, mvSpanPool(mv), sizeof(MVSpanStruct),
withReservoirPermit);
res = PoolAlloc(&addr, mvSpanPool(mv), sizeof(MVSpanStruct));
if(res != ResOK)
return res;
span = (MVSpan)addr;
@ -570,12 +566,10 @@ static Res MVAlloc(Addr *pReturn, Pool pool, Size size,
arena = PoolArena(pool);
regionSize = SizeArenaGrains(regionSize, arena);
res = ArenaAlloc(&base, LocusPrefDefault(), regionSize, pool,
withReservoirPermit);
res = ArenaAlloc(&base, LocusPrefDefault(), regionSize, pool);
if(res != ResOK) { /* try again with a region big enough for this object */
regionSize = SizeArenaGrains(size, arena);
res = ArenaAlloc(&base, LocusPrefDefault(), regionSize, pool,
withReservoirPermit);
res = ArenaAlloc(&base, LocusPrefDefault(), regionSize, pool);
if (res != ResOK) {
PoolFree(mvSpanPool(mv), (Addr)span, sizeof(MVSpanStruct));
return res;

View file

@ -35,15 +35,13 @@ static Res MVTInit(Pool pool, ArgList arg);
static Bool MVTCheck(MVT mvt);
static void MVTFinish(Pool pool);
static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size minSize,
Bool withReservoirPermit);
Pool pool, Buffer buffer, Size minSize);
static void MVTBufferEmpty(Pool pool, Buffer buffer, Addr base, Addr limit);
static void MVTFree(Pool pool, Addr base, Size size);
static Res MVTDescribe(Pool pool, mps_lib_FILE *stream, Count depth);
static Size MVTTotalSize(Pool pool);
static Size MVTFreeSize(Pool pool);
static Res MVTSegAlloc(Seg *segReturn, MVT mvt, Size size,
Bool withReservoirPermit);
static Res MVTSegAlloc(Seg *segReturn, MVT mvt, Size size);
static void MVTSegFree(MVT mvt, Seg seg);
static Bool MVTReturnSegs(MVT mvt, Range range, Arena arena);
@ -491,8 +489,7 @@ static void MVTNoteFill(MVT mvt, Addr base, Addr limit, Size minSize) {
static Res MVTOversizeFill(Addr *baseReturn,
Addr *limitReturn,
MVT mvt,
Size minSize,
Bool withReservoirPermit)
Size minSize)
{
Res res;
Seg seg;
@ -501,7 +498,7 @@ static Res MVTOversizeFill(Addr *baseReturn,
alignedSize = SizeArenaGrains(minSize, PoolArena(MVTPool(mvt)));
res = MVTSegAlloc(&seg, mvt, alignedSize, withReservoirPermit);
res = MVTSegAlloc(&seg, mvt, alignedSize);
if (res != ResOK)
return res;
@ -660,14 +657,13 @@ static Bool MVTContingencyFill(Addr *baseReturn, Addr *limitReturn,
static Res MVTSegFill(Addr *baseReturn, Addr *limitReturn,
MVT mvt, Size fillSize,
Size minSize,
Bool withReservoirPermit)
Size minSize)
{
Res res;
Seg seg;
Addr base, limit;
res = MVTSegAlloc(&seg, mvt, fillSize, withReservoirPermit);
res = MVTSegAlloc(&seg, mvt, fillSize);
if (res != ResOK)
return res;
@ -686,8 +682,7 @@ static Res MVTSegFill(Addr *baseReturn, Addr *limitReturn,
* See <design/poolmvt/#impl.c.ap.fill>
*/
static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size minSize,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size minSize)
{
MVT mvt;
Res res;
@ -701,13 +696,12 @@ static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn,
AVER(BufferIsReset(buffer));
AVER(minSize > 0);
AVER(SizeIsAligned(minSize, pool->alignment));
AVERT(Bool, withReservoirPermit);
/* Allocate oversize blocks exactly, directly from the arena.
<design/poolmvt/#arch.ap.no-fit.oversize> */
if (minSize > mvt->fillSize) {
return MVTOversizeFill(baseReturn, limitReturn, mvt,
minSize, withReservoirPermit);
minSize);
}
/* Use any splinter, if available.
@ -732,7 +726,7 @@ static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn,
/* Attempt to request a block from the arena.
<design/poolmvt/#impl.c.free.merge.segment> */
res = MVTSegFill(baseReturn, limitReturn,
mvt, mvt->fillSize, minSize, withReservoirPermit);
mvt, mvt->fillSize, minSize);
if (res == ResOK)
return ResOK;
@ -1133,11 +1127,10 @@ mps_pool_class_t mps_class_mvt(void)
/* MVTSegAlloc -- encapsulates SegAlloc with associated accounting and
* metering
*/
static Res MVTSegAlloc(Seg *segReturn, MVT mvt, Size size,
Bool withReservoirPermit)
static Res MVTSegAlloc(Seg *segReturn, MVT mvt, Size size)
{
Res res = SegAlloc(segReturn, SegClassGet(), LocusPrefDefault(), size,
MVTPool(mvt), withReservoirPermit, argsNone);
MVTPool(mvt), argsNone);
if (res == ResOK) {
Size segSize = SegSize(*segReturn);

View file

@ -189,13 +189,11 @@ static void MVFFReduce(MVFF mvff)
/* MVFFExtend -- allocate a new range from the arena
*
* Allocate a new range from the arena (with the given
* withReservoirPermit flag) of at least the specified size. The
* specified size should be pool-aligned. Add it to the allocated and
* free lists.
* Allocate a new range from the arena of at least the specified
* size. The specified size should be pool-aligned. Add it to the
* allocated and free lists.
*/
static Res MVFFExtend(Range rangeReturn, MVFF mvff, Size size,
Bool withReservoirPermit)
static Res MVFFExtend(Range rangeReturn, MVFF mvff, Size size)
{
Pool pool;
Arena arena;
@ -206,7 +204,6 @@ static Res MVFFExtend(Range rangeReturn, MVFF mvff, Size size,
AVERT(MVFF, mvff);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
pool = MVFFPool(mvff);
arena = PoolArena(pool);
@ -222,14 +219,12 @@ static Res MVFFExtend(Range rangeReturn, MVFF mvff, Size size,
allocSize = SizeArenaGrains(allocSize, arena);
res = ArenaAlloc(&base, MVFFLocusPref(mvff), allocSize, pool,
withReservoirPermit);
res = ArenaAlloc(&base, MVFFLocusPref(mvff), allocSize, pool);
if (res != ResOK) {
/* try again with a range just large enough for object */
/* see <design/poolmvff/#design.seg-fail> */
allocSize = SizeArenaGrains(size, arena);
res = ArenaAlloc(&base, MVFFLocusPref(mvff), allocSize, pool,
withReservoirPermit);
res = ArenaAlloc(&base, MVFFLocusPref(mvff), allocSize, pool);
if (res != ResOK)
return res;
}
@ -262,8 +257,7 @@ static Res MVFFExtend(Range rangeReturn, MVFF mvff, Size size,
* If there is no suitable free block, try extending the pool.
*/
static Res mvffFindFree(Range rangeReturn, MVFF mvff, Size size,
LandFindMethod findMethod, FindDelete findDelete,
Bool withReservoirPermit)
LandFindMethod findMethod, FindDelete findDelete)
{
Bool found;
RangeStruct oldRange;
@ -275,14 +269,13 @@ static Res mvffFindFree(Range rangeReturn, MVFF mvff, Size size,
AVER(SizeIsAligned(size, PoolAlignment(MVFFPool(mvff))));
AVER(FUNCHECK(findMethod));
AVERT(FindDelete, findDelete);
AVERT(Bool, withReservoirPermit);
land = MVFFFreeLand(mvff);
found = (*findMethod)(rangeReturn, &oldRange, land, size, findDelete);
if (!found) {
RangeStruct newRange;
Res res;
res = MVFFExtend(&newRange, mvff, size, withReservoirPermit);
res = MVFFExtend(&newRange, mvff, size);
if (res != ResOK)
return res;
found = (*findMethod)(rangeReturn, &oldRange, land, size, findDelete);
@ -300,8 +293,7 @@ static Res mvffFindFree(Range rangeReturn, MVFF mvff, Size size,
/* MVFFAlloc -- Allocate a block */
static Res MVFFAlloc(Addr *aReturn, Pool pool, Size size,
Bool withReservoirPermit)
static Res MVFFAlloc(Addr *aReturn, Pool pool, Size size)
{
Res res;
MVFF mvff;
@ -314,14 +306,12 @@ static Res MVFFAlloc(Addr *aReturn, Pool pool, Size size,
mvff = PoolMVFF(pool);
AVERT(MVFF, mvff);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
size = SizeAlignUp(size, PoolAlignment(pool));
findMethod = mvff->firstFit ? LandFindFirst : LandFindLast;
findDelete = mvff->slotHigh ? FindDeleteHIGH : FindDeleteLOW;
res = mvffFindFree(&range, mvff, size, findMethod, findDelete,
withReservoirPermit);
res = mvffFindFree(&range, mvff, size, findMethod, findDelete);
if (res != ResOK)
return res;
@ -361,8 +351,7 @@ static void MVFFFree(Pool pool, Addr old, Size size)
* allocation policy; see <design/poolmvff/#over.buffer>.
*/
static Res MVFFBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
Res res;
MVFF mvff;
@ -376,10 +365,8 @@ static Res MVFFBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Buffer, buffer);
AVER(size > 0);
AVER(SizeIsAligned(size, PoolAlignment(pool)));
AVERT(Bool, withReservoirPermit);
res = mvffFindFree(&range, mvff, size, LandFindLargest, FindDeleteENTIRE,
withReservoirPermit);
res = mvffFindFree(&range, mvff, size, LandFindLargest, FindDeleteENTIRE);
if (res != ResOK)
return res;
AVER(RangeSize(&range) >= size);

View file

@ -60,8 +60,7 @@ static void NFinish(Pool pool)
/* NAlloc -- alloc method for class N */
static Res NAlloc(Addr *pReturn, Pool pool, Size size,
Bool withReservoirPermit)
static Res NAlloc(Addr *pReturn, Pool pool, Size size)
{
PoolN poolN;
@ -71,7 +70,6 @@ static Res NAlloc(Addr *pReturn, Pool pool, Size size,
AVER(pReturn != NULL);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
return ResLIMIT; /* limit of nil blocks exceeded */
}
@ -97,8 +95,7 @@ static void NFree(Pool pool, Addr old, Size size)
/* NBufferFill -- buffer fill method for class N */
static Res NBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
PoolN poolN;
@ -110,7 +107,6 @@ static Res NBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Buffer, buffer);
AVER(BufferIsReset(buffer));
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
NOTREACHED; /* can't create buffers, so shouldn't fill them */
return ResUNIMPL;

View file

@ -23,7 +23,7 @@ static void testit(ArenaClass class, ArgList args)
die(ArenaCreate(&arena, class, args), "ArenaCreate");
die(PoolCreate(&pool, arena, PoolClassN(), argsNone), "PoolNCreate");
res = PoolAlloc(&p, pool, 1, /* withReservoirPermit */ FALSE);
res = PoolAlloc(&p, pool, 1);
if (res == ResOK) {
error("Error: Unexpectedly succeeded in"
"allocating block from PoolN\n");

View file

@ -226,8 +226,7 @@ static Bool SNCSegCheck(SNCSeg sncseg)
/* sncSegInit -- Init method for SNC segments */
static Res sncSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res sncSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
SegClass super;
SNCSeg sncseg;
@ -237,11 +236,10 @@ static Res sncSegInit(Seg seg, Pool pool, Addr base, Size size,
sncseg = SegSNCSeg(seg);
AVERT(Pool, pool);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(SNCSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (res != ResOK)
return res;
@ -419,8 +417,7 @@ static void SNCFinish(Pool pool)
static Res SNCBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
SNC snc;
Arena arena;
@ -433,7 +430,6 @@ static Res SNCBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Pool, pool);
AVERT(Buffer, buffer);
AVER(size > 0);
AVERT(Bool, withReservoirPermit);
AVER(BufferIsReset(buffer));
snc = PoolSNC(pool);
@ -448,7 +444,7 @@ static Res SNCBufferFill(Addr *baseReturn, Addr *limitReturn,
arena = PoolArena(pool);
asize = SizeArenaGrains(size, arena);
res = SegAlloc(&seg, SNCSegClassGet(), LocusPrefDefault(),
asize, pool, withReservoirPermit, argsNone);
asize, pool, argsNone);
if (res != ResOK)
return res;

View file

@ -185,7 +185,7 @@ static Res rootCreate(Root *rootReturn, Arena arena,
AVERT(RootVar, type);
globals = ArenaGlobals(arena);
res = ControlAlloc(&p, arena, sizeof(RootStruct), FALSE);
res = ControlAlloc(&p, arena, sizeof(RootStruct));
if (res != ResOK)
return res;
root = (Root)p; /* Avoid pun */

View file

@ -149,8 +149,7 @@ Res SACCreate(SAC *sacReturn, Pool pool, Count classesCount,
middleIndex = i + 1; /* there must exist another class at i+1 */
/* Allocate SAC */
res = ControlAlloc(&p, PoolArena(pool), sacSize(middleIndex, classesCount),
FALSE);
res = ControlAlloc(&p, PoolArena(pool), sacSize(middleIndex, classesCount));
if(res != ResOK)
goto failSACAlloc;
sac = p;
@ -245,7 +244,7 @@ static void sacFind(Index *iReturn, Size *blockSizeReturn,
/* SACFill -- alloc an object, and perhaps fill the cache */
Res SACFill(Addr *p_o, SAC sac, Size size, Bool hasReservoirPermit)
Res SACFill(Addr *p_o, SAC sac, Size size)
{
Index i;
Count blockCount, j;
@ -257,7 +256,6 @@ Res SACFill(Addr *p_o, SAC sac, Size size, Bool hasReservoirPermit)
AVER(p_o != NULL);
AVERT(SAC, sac);
AVER(size != 0);
AVERT(Bool, hasReservoirPermit);
esac = ExternalSACOfSAC(sac);
sacFind(&i, &blockSize, sac, size);
@ -272,7 +270,7 @@ Res SACFill(Addr *p_o, SAC sac, Size size, Bool hasReservoirPermit)
blockSize = SizeAlignUp(size, PoolAlignment(sac->pool));
for (j = 0, fl = esac->_freelists[i]._blocks;
j <= blockCount; ++j) {
res = PoolAlloc(&p, sac->pool, blockSize, hasReservoirPermit);
res = PoolAlloc(&p, sac->pool, blockSize);
if (res != ResOK)
break;
/* @@@@ ignoring shields for now */

View file

@ -44,7 +44,7 @@ typedef struct mps_sac_classes_s *SACClasses;
extern Res SACCreate(SAC *sac_o, Pool pool, Count classesCount,
SACClasses classes);
extern void SACDestroy(SAC sac);
extern Res SACFill(Addr *p_o, SAC sac, Size size, Bool hasReservoirPermit);
extern Res SACFill(Addr *p_o, SAC sac, Size size);
extern void SACEmpty(SAC sac, Addr p, Size size);
extern void SACFlush(SAC sac);

View file

@ -46,7 +46,7 @@ SRCID(seg, "$Id$");
static void SegFinish(Seg seg);
static Res SegInit(Seg seg, Pool pool, Addr base, Size size,
Bool withReservoirPermit, ArgList args);
ArgList args);
/* Generic interface support */
@ -55,7 +55,7 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size,
/* SegAlloc -- allocate a segment from the arena */
Res SegAlloc(Seg *segReturn, SegClass class, LocusPref pref,
Size size, Pool pool, Bool withReservoirPermit, ArgList args)
Size size, Pool pool, ArgList args)
{
Res res;
Arena arena;
@ -68,25 +68,24 @@ Res SegAlloc(Seg *segReturn, SegClass class, LocusPref pref,
AVERT(LocusPref, pref);
AVER(size > (Size)0);
AVERT(Pool, pool);
AVERT(Bool, withReservoirPermit);
arena = PoolArena(pool);
AVERT(Arena, arena);
AVER(SizeIsArenaGrains(size, arena));
/* allocate the memory from the arena */
res = ArenaAlloc(&base, pref, size, pool, withReservoirPermit);
res = ArenaAlloc(&base, pref, size, pool);
if (res != ResOK)
goto failArena;
/* allocate the segment object from the control pool */
res = ControlAlloc(&p, arena, class->size, withReservoirPermit);
res = ControlAlloc(&p, arena, class->size);
if (res != ResOK)
goto failControl;
seg = p;
seg->class = class;
res = SegInit(seg, pool, base, size, withReservoirPermit, args);
res = SegInit(seg, pool, base, size, args);
if (res != ResOK)
goto failInit;
@ -134,8 +133,7 @@ void SegFree(Seg seg)
/* SegInit -- initialize a segment */
static Res SegInit(Seg seg, Pool pool, Addr base, Size size,
Bool withReservoirPermit, ArgList args)
static Res SegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
Tract tract;
Addr addr, limit;
@ -150,7 +148,6 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size,
AVER(SizeIsArenaGrains(size, arena));
class = seg->class;
AVERT(SegClass, class);
AVERT(Bool, withReservoirPermit);
limit = AddrAdd(base, size);
seg->limit = limit;
@ -183,7 +180,7 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size,
RingInit(SegPoolRing(seg));
/* Class specific initialization comes last */
res = class->init(seg, pool, base, size, withReservoirPermit, args);
res = class->init(seg, pool, base, size, args);
if (res != ResOK)
goto failInit;
@ -556,8 +553,7 @@ Bool SegNext(Seg *segReturn, Arena arena, Seg seg)
* See <design/seg/#merge>
*/
Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
Bool withReservoirPermit)
Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi)
{
SegClass class;
Addr base, mid, limit;
@ -574,18 +570,16 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
mid = SegLimit(segLo);
limit = SegLimit(segHi);
AVER(SegBase(segHi) == SegLimit(segLo));
AVERT(Bool, withReservoirPermit);
arena = PoolArena(SegPool(segLo));
ShieldFlush(arena); /* see <design/seg/#split-merge.shield> */
/* Invoke class-specific methods to do the merge */
res = class->merge(segLo, segHi, base, mid, limit,
withReservoirPermit);
res = class->merge(segLo, segHi, base, mid, limit);
if (ResOK != res)
goto failMerge;
EVENT3(SegMerge, segLo, segHi, BOOLOF(withReservoirPermit));
EVENT2(SegMerge, segLo, segHi);
/* Deallocate segHi object */
ControlFree(arena, segHi, class->size);
AVERT(Seg, segLo);
@ -605,8 +599,7 @@ failMerge:
* See <design/seg/#split>
*/
Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at,
Bool withReservoirPermit)
Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at)
{
Addr base, limit;
SegClass class;
@ -626,7 +619,6 @@ Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at,
AVER(AddrIsArenaGrain(at, arena));
AVER(at > base);
AVER(at < limit);
AVERT(Bool, withReservoirPermit);
/* Can only split a buffered segment if the entire buffer is below
* the split point. */
@ -635,14 +627,13 @@ Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at,
ShieldFlush(arena); /* see <design/seg/#split-merge.shield> */
/* Allocate the new segment object from the control pool */
res = ControlAlloc(&p, arena, class->size, withReservoirPermit);
res = ControlAlloc(&p, arena, class->size);
if (ResOK != res)
goto failControl;
segNew = p;
/* Invoke class-specific methods to do the split */
res = class->split(seg, segNew, base, at, limit,
withReservoirPermit);
res = class->split(seg, segNew, base, at, limit);
if (ResOK != res)
goto failSplit;
@ -746,8 +737,7 @@ Bool SegCheck(Seg seg)
/* segTrivInit -- method to initialize the base fields of a segment */
static Res segTrivInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res segTrivInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
/* all the initialization happens in SegInit so checks are safe */
Arena arena;
@ -760,7 +750,6 @@ static Res segTrivInit(Seg seg, Pool pool, Addr base, Size size,
AVER(SegBase(seg) == base);
AVER(SegSize(seg) == size);
AVER(SegPool(seg) == pool);
AVERT(Bool, reservoirPermit);
AVERT(ArgList, args);
UNUSED(args);
return ResOK;
@ -853,8 +842,7 @@ static void segNoSetBuffer(Seg seg, Buffer buffer)
/* segNoMerge -- merge method for segs which don't support merge */
static Res segNoMerge(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
AVERT(Seg, seg);
AVERT(Seg, segHi);
@ -862,7 +850,6 @@ static Res segNoMerge(Seg seg, Seg segHi,
AVER(SegLimit(seg) == mid);
AVER(SegBase(segHi) == mid);
AVER(SegLimit(segHi) == limit);
AVERT(Bool, withReservoirPermit);
NOTREACHED;
return ResFAIL;
}
@ -875,8 +862,7 @@ static Res segNoMerge(Seg seg, Seg segHi,
*/
static Res segTrivMerge(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
Pool pool;
Arena arena;
@ -896,7 +882,6 @@ static Res segTrivMerge(Seg seg, Seg segHi,
AVER(SegLimit(seg) == mid);
AVER(SegBase(segHi) == mid);
AVER(SegLimit(segHi) == limit);
AVERT(Bool, withReservoirPermit);
/* .similar. */
AVER(seg->rankSet == segHi->rankSet);
@ -935,8 +920,7 @@ static Res segTrivMerge(Seg seg, Seg segHi,
/* segNoSplit -- split method for segs which don't support splitting */
static Res segNoSplit(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
AVERT(Seg, seg);
AVER(segHi != NULL); /* can't check fully, it's not initialized */
@ -944,7 +928,6 @@ static Res segNoSplit(Seg seg, Seg segHi,
AVER(mid < limit);
AVER(SegBase(seg) == base);
AVER(SegLimit(seg) == limit);
AVERT(Bool, withReservoirPermit);
NOTREACHED;
return ResFAIL;
@ -954,8 +937,7 @@ static Res segNoSplit(Seg seg, Seg segHi,
/* segTrivSplit -- Basic Seg split method */
static Res segTrivSplit(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
Tract tract;
Pool pool;
@ -973,7 +955,6 @@ static Res segTrivSplit(Seg seg, Seg segHi,
AVER(mid < limit);
AVER(SegBase(seg) == base);
AVER(SegLimit(seg) == limit);
AVERT(Bool, withReservoirPermit);
/* Segment may not be exposed, or in the shield cache */
/* See <design/seg/#split-merge.shield> & <code/shield.c#def.depth> */
@ -1084,8 +1065,7 @@ Bool GCSegCheck(GCSeg gcseg)
/* gcSegInit -- method to initialize a GC segment */
static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool withReservoirPermit, ArgList args)
static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
SegClass super;
GCSeg gcseg;
@ -1099,11 +1079,10 @@ static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size,
AVER(SizeIsArenaGrains(size, arena));
gcseg = SegGCSeg(seg);
AVER(&gcseg->segStruct == seg);
AVERT(Bool, withReservoirPermit);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(GCSegClass);
res = super->init(seg, pool, base, size, withReservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (ResOK != res)
return res;
@ -1443,8 +1422,7 @@ static void gcSegSetBuffer(Seg seg, Buffer buffer)
*/
static Res gcSegMerge(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
SegClass super;
GCSeg gcseg, gcsegHi;
@ -1465,7 +1443,6 @@ static Res gcSegMerge(Seg seg, Seg segHi,
AVER(SegLimit(seg) == mid);
AVER(SegBase(segHi) == mid);
AVER(SegLimit(segHi) == limit);
AVERT(Bool, withReservoirPermit);
buf = gcsegHi->buffer; /* any buffer on segHi must be reassigned */
AVER(buf == NULL || gcseg->buffer == NULL); /* See .buffer */
@ -1474,8 +1451,7 @@ static Res gcSegMerge(Seg seg, Seg segHi,
/* Merge the superclass fields via next-method call */
super = SEG_SUPERCLASS(GCSegClass);
res = super->merge(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->merge(seg, segHi, base, mid, limit);
if (res != ResOK)
goto failSuper;
@ -1513,8 +1489,7 @@ failSuper:
/* gcSegSplit -- GCSeg split method */
static Res gcSegSplit(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
SegClass super;
GCSeg gcseg, gcsegHi;
@ -1531,7 +1506,6 @@ static Res gcSegSplit(Seg seg, Seg segHi,
AVER(mid < limit);
AVER(SegBase(seg) == base);
AVER(SegLimit(seg) == limit);
AVERT(Bool, withReservoirPermit);
grey = SegGrey(seg);
buf = gcseg->buffer; /* Look for buffer to reassign to segHi */
@ -1546,8 +1520,7 @@ static Res gcSegSplit(Seg seg, Seg segHi,
/* Split the superclass fields via next-method call */
super = SEG_SUPERCLASS(GCSegClass);
res = super->split(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->split(seg, segHi, base, mid, limit);
if (res != ResOK)
goto failSuper;

View file

@ -111,8 +111,7 @@ static Bool AMSTSegCheck(AMSTSeg amstseg)
/* amstSegInit -- initialise an amst segment */
static Res amstSegInit(Seg seg, Pool pool, Addr base, Size size,
Bool reservoirPermit, ArgList args)
static Res amstSegInit(Seg seg, Pool pool, Addr base, Size size, ArgList args)
{
SegClass super;
AMSTSeg amstseg;
@ -125,11 +124,10 @@ static Res amstSegInit(Seg seg, Pool pool, Addr base, Size size,
amst = PoolAMST(pool);
AVERT(AMST, amst);
/* no useful checks for base and size */
AVERT(Bool, reservoirPermit);
/* Initialize the superclass fields first via next-method call */
super = SEG_SUPERCLASS(AMSTSegClass);
res = super->init(seg, pool, base, size, reservoirPermit, args);
res = super->init(seg, pool, base, size, args);
if (res != ResOK)
return res;
@ -176,8 +174,7 @@ static void amstSegFinish(Seg seg)
* anti-method.
*/
static Res amstSegMerge(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
SegClass super;
AMST amst;
@ -194,8 +191,7 @@ static Res amstSegMerge(Seg seg, Seg segHi,
/* Merge the superclass fields via direct next-method call */
super = SEG_SUPERCLASS(AMSTSegClass);
res = super->merge(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->merge(seg, segHi, base, mid, limit);
if (res != ResOK)
goto failSuper;
@ -214,8 +210,7 @@ static Res amstSegMerge(Seg seg, Seg segHi,
failDeliberate:
/* Call the anti-method (see .fail) */
res = super->split(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->split(seg, segHi, base, mid, limit);
AVER(res == ResOK);
res = ResFAIL;
failSuper:
@ -228,8 +223,7 @@ failSuper:
/* amstSegSplit -- AMSTSeg split method */
static Res amstSegSplit(Seg seg, Seg segHi,
Addr base, Addr mid, Addr limit,
Bool withReservoirPermit)
Addr base, Addr mid, Addr limit)
{
SegClass super;
AMST amst;
@ -245,8 +239,7 @@ static Res amstSegSplit(Seg seg, Seg segHi,
/* Split the superclass fields via direct next-method call */
super = SEG_SUPERCLASS(AMSTSegClass);
res = super->split(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->split(seg, segHi, base, mid, limit);
if (res != ResOK)
goto failSuper;
@ -269,8 +262,7 @@ static Res amstSegSplit(Seg seg, Seg segHi,
failDeliberate:
/* Call the anti-method. (see .fail) */
res = super->merge(seg, segHi, base, mid, limit,
withReservoirPermit);
res = super->merge(seg, segHi, base, mid, limit);
AVER(res == ResOK);
res = ResFAIL;
failSuper:
@ -526,8 +518,7 @@ static void AMSAllocateRange(AMS ams, Seg seg, Addr base, Addr limit)
* meet the request.
*/
static Res AMSTBufferFill(Addr *baseReturn, Addr *limitReturn,
Pool pool, Buffer buffer, Size size,
Bool withReservoirPermit)
Pool pool, Buffer buffer, Size size)
{
PoolClass super;
Addr base, limit;
@ -549,8 +540,7 @@ static Res AMSTBufferFill(Addr *baseReturn, Addr *limitReturn,
/* call next method */
super = POOL_SUPERCLASS(AMSTPoolClass);
res = super->bufferFill(&base, &limit, pool, buffer, size,
withReservoirPermit);
res = super->bufferFill(&base, &limit, pool, buffer, size);
if (res != ResOK)
return res;
@ -567,7 +557,7 @@ static Res AMSTBufferFill(Addr *baseReturn, Addr *limitReturn,
Res mres;
AMSUnallocateRange(ams, seg, base, limit);
mres = SegMerge(&mergedSeg, segLo, seg, withReservoirPermit);
mres = SegMerge(&mergedSeg, segLo, seg);
if (ResOK == mres) { /* successful merge */
AMSAllocateRange(ams, mergedSeg, base, limit);
/* leave range as-is */
@ -585,7 +575,7 @@ static Res AMSTBufferFill(Addr *baseReturn, Addr *limitReturn,
Seg segLo, segHi;
Res sres;
AMSUnallocateRange(ams, seg, mid, limit);
sres = SegSplit(&segLo, &segHi, seg, mid, withReservoirPermit);
sres = SegSplit(&segLo, &segHi, seg, mid);
if (ResOK == sres) { /* successful split */
limit = mid; /* range is lower segment */
} else { /* failed to split */
@ -639,7 +629,7 @@ static void AMSTStressBufferedSeg(Seg seg, Buffer buffer)
/* .bmerge */
Seg mergedSeg;
Res res;
res = SegMerge(&mergedSeg, seg, segHi, FALSE);
res = SegMerge(&mergedSeg, seg, segHi);
if (ResOK == res) {
amst->bmerges++;
printf("J");
@ -656,7 +646,7 @@ static void AMSTStressBufferedSeg(Seg seg, Buffer buffer)
/* .bsplit */
Seg segLo, segHi;
Res res;
res = SegSplit(&segLo, &segHi, seg, limit, FALSE);
res = SegSplit(&segLo, &segHi, seg, limit);
if (ResOK == res) {
amst->bsplits++;
printf("C");

View file

@ -47,8 +47,7 @@ Res ThreadRegister(Thread *threadReturn, Arena arena)
AVER(threadReturn != NULL);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct));
if (res != ResOK)
return res;
thread = (Thread)p;

View file

@ -86,8 +86,7 @@ Res ThreadRegister(Thread *threadReturn, Arena arena)
AVER(threadReturn != NULL);
AVERT(Arena, arena);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct));
if(res != ResOK)
return res;
thread = (Thread)p;

View file

@ -83,8 +83,7 @@ Res ThreadRegister(Thread *threadReturn, Arena arena)
AVER(threadReturn != NULL);
AVERT(Arena, arena);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct));
if(res != ResOK)
return res;
thread = (Thread)p; /* avoid pun */

View file

@ -69,8 +69,7 @@ Res ThreadRegister(Thread *threadReturn, Arena arena)
AVER(threadReturn != NULL);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct),
/* withReservoirPermit */ FALSE);
res = ControlAlloc(&p, arena, sizeof(ThreadStruct));
if (res != ResOK)
return res;
thread = (Thread)p;

View file

@ -467,12 +467,12 @@ Res TraceIdMessagesCreate(Arena arena, TraceId ti)
AVER(!arena->tsMessage[ti]);
AVER(!arena->tMessage[ti]);
res = ControlAlloc(&p, arena, sizeof(TraceStartMessageStruct), FALSE);
res = ControlAlloc(&p, arena, sizeof(TraceStartMessageStruct));
if(res != ResOK)
goto failTraceStartMessage;
tsMessage = p;
res = ControlAlloc(&p, arena, sizeof(TraceMessageStruct), FALSE);
res = ControlAlloc(&p, arena, sizeof(TraceMessageStruct));
if(res != ResOK)
goto failTraceMessage;
tMessage = p;
@ -674,7 +674,7 @@ static Res arenaRememberSummaryOne(Globals global, Addr base, RefSet summary)
RememberedSummaryBlock newBlock;
int res;
res = ControlAlloc(&p, arena, sizeof *newBlock, FALSE);
res = ControlAlloc(&p, arena, sizeof *newBlock);
if(res != ResOK) {
return res;
}

View file

@ -291,13 +291,10 @@ protocol.
This will be improved, when we figure out formatted pools -- they
don't need tags for fenceposting.
_`.out-of-space`: If there's no room for tags, we will not dip into
the reservoir, just fail to allocate the tag. If the alloc call had a
reservoir permit, we let it succeed even without a tag, and just make
sure the free method will not complain if it can't find a tag. If the
call didn't have a reservoir permit, we free the block allocated for
the object and fail the allocation, so that the client gets a chance
to do whatever low-memory actions they might want to do.
_`.out-of-space`: If there's no room for tags, we just fail to
allocate the tag. We free the block allocated for the object and fail
the allocation, so that the client gets a chance to do whatever
low-memory actions they might want to do.
.. note::