diff --git a/mps/code/abq.c b/mps/code/abq.c index 7a3df81408e..c6620be89da 100644 --- a/mps/code/abq.c +++ b/mps/code/abq.c @@ -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; diff --git a/mps/code/arena.c b/mps/code/arena.c index e34fc3f6fc6..a74201c75d4 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -632,8 +632,7 @@ Res ArenaDescribeTracts(Arena arena, mps_lib_FILE *stream, Count depth) * with void* (), 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); diff --git a/mps/code/arenacv.c b/mps/code/arenacv.c index 7b02c11bcc2..0d7e4edf6f8 100644 --- a/mps/code/arenacv.c +++ b/mps/code/arenacv.c @@ -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; } diff --git a/mps/code/bt.c b/mps/code/bt.c index 1a79b82f5f3..844846ba723 100644 --- a/mps/code/bt.c +++ b/mps/code/bt.c @@ -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; diff --git a/mps/code/buffer.c b/mps/code/buffer.c index edef611c217..c98751ca558 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -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 . */ -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; diff --git a/mps/code/cbs.c b/mps/code/cbs.c index 6fb96b6940f..966c4babbc0 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -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; diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c index 6a8417595f7..48fe846cc0d 100644 --- a/mps/code/dbgpool.c +++ b/mps/code/dbgpool.c @@ -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) { /* 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; } diff --git a/mps/code/eventdef.h b/mps/code/eventdef.h index 081b45de7c2..9ef997213ee 100644 --- a/mps/code/eventdef.h +++ b/mps/code/eventdef.h @@ -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) \ diff --git a/mps/code/fbmtest.c b/mps/code/fbmtest.c index 0ef954d071d..601cee57918 100644 --- a/mps/code/fbmtest.c +++ b/mps/code/fbmtest.c @@ -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 */ diff --git a/mps/code/format.c b/mps/code/format.c index 26b3e4bb751..351c150208a 100644 --- a/mps/code/format.c +++ b/mps/code/format.c @@ -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 */ diff --git a/mps/code/fotest.c b/mps/code/fotest.c index 750883f61a4..2a3551452a9 100644 --- a/mps/code/fotest.c +++ b/mps/code/fotest.c @@ -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; diff --git a/mps/code/global.c b/mps/code/global.c index 78821c9562c..48f8ccb7188 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -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; diff --git a/mps/code/land.c b/mps/code/land.c index 1853b4a6ad5..7a2101cc673 100644 --- a/mps/code/land.c +++ b/mps/code/land.c @@ -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; diff --git a/mps/code/landtest.c b/mps/code/landtest.c index 7ec55461d1e..df09e17f490 100644 --- a/mps/code/landtest.c +++ b/mps/code/landtest.c @@ -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); diff --git a/mps/code/locus.c b/mps/code/locus.c index cc367b15a6c..e590b410a24 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -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; diff --git a/mps/code/locus.h b/mps/code/locus.h index d1d9716303e..649820a1433 100644 --- a/mps/code/locus.h +++ b/mps/code/locus.h @@ -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); diff --git a/mps/code/messtest.c b/mps/code/messtest.c index 96deeebfc58..5090a5d4c11 100644 --- a/mps/code/messtest.c +++ b/mps/code/messtest.c @@ -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); diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 3dfa4bf5e67..03d65699f1c 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -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 */ /* 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 */ diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index 747b041bf85..c375e0a507f 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h @@ -156,7 +156,7 @@ typedef void (*FreeBlockVisitor)(Addr base, Addr limit, Pool pool, void *p); /* Seg*Method -- see */ 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 */ @@ -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); diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index b97c6c4dc2b..8e73a908395 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -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); diff --git a/mps/code/nailboard.c b/mps/code/nailboard.c index 0b91ab35e13..90d26c84295 100644 --- a/mps/code/nailboard.c +++ b/mps/code/nailboard.c @@ -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; diff --git a/mps/code/pool.c b/mps/code/pool.c index f939bca84e9..a1508908f14 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -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. */ diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index 30f5d0f999e..92f10752f97 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c @@ -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; diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 7b625c4dac4..0d4228c7093 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -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 . */ 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); diff --git a/mps/code/poolams.c b/mps/code/poolams.c index 40ca5f65426..71701be7bee 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -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, * . */ 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 */ /* ). */ @@ -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); diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 6d7c4d6efb2..42460f97056 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -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)); diff --git a/mps/code/poollo.c b/mps/code/poollo.c index a1a3f328468..23c73e38cfa 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -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; } diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c index 4ce6e66ed1c..6841517d846 100644 --- a/mps/code/poolmfs.c +++ b/mps/code/poolmfs.c @@ -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; diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index ec48151ab4e..18eef9fe271 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -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) /* */ if (RingIsSingle(&mrg->freeRing)) { - res = MRGSegPairCreate(&junk, mrg, /* withReservoirPermit */ FALSE); + res = MRGSegPairCreate(&junk, mrg); if (res != ResOK) return res; } diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 19b3c2bb443..719cba6d7df 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -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; diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index 1189f7d73e1..dc352d6eb81 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -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 */ 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. */ 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. */ 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); diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index 1125f018a07..82d5c072ff3 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c @@ -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 */ 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 . */ 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); diff --git a/mps/code/pooln.c b/mps/code/pooln.c index cfb7bc0b61d..4a3e7d72ffc 100644 --- a/mps/code/pooln.c +++ b/mps/code/pooln.c @@ -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; diff --git a/mps/code/poolncv.c b/mps/code/poolncv.c index a3f85342cb8..a8173246589 100644 --- a/mps/code/poolncv.c +++ b/mps/code/poolncv.c @@ -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"); diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c index ef295fc7d9a..db0985dc795 100644 --- a/mps/code/poolsnc.c +++ b/mps/code/poolsnc.c @@ -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; diff --git a/mps/code/root.c b/mps/code/root.c index 63445f0ef21..c241430ab63 100644 --- a/mps/code/root.c +++ b/mps/code/root.c @@ -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 */ diff --git a/mps/code/sac.c b/mps/code/sac.c index ab8bf867e3f..e7b13327ea1 100644 --- a/mps/code/sac.c +++ b/mps/code/sac.c @@ -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 */ diff --git a/mps/code/sac.h b/mps/code/sac.h index bd52a35daff..b60047e9ee3 100644 --- a/mps/code/sac.h +++ b/mps/code/sac.h @@ -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); diff --git a/mps/code/seg.c b/mps/code/seg.c index 7007bca62b7..04785652e90 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -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 */ -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 */ /* 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 */ -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 */ /* 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 & */ @@ -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; diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 73f3f79461b..746c253f321 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -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"); diff --git a/mps/code/than.c b/mps/code/than.c index 3e2dbaa81a0..dc4781dd6cd 100644 --- a/mps/code/than.c +++ b/mps/code/than.c @@ -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; diff --git a/mps/code/thix.c b/mps/code/thix.c index 219ae33bcdd..a5b4559f3db 100644 --- a/mps/code/thix.c +++ b/mps/code/thix.c @@ -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; diff --git a/mps/code/thw3.c b/mps/code/thw3.c index b8b8b106680..af44eb33018 100644 --- a/mps/code/thw3.c +++ b/mps/code/thw3.c @@ -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 */ diff --git a/mps/code/thxc.c b/mps/code/thxc.c index 3bb449d46fe..190c94fb92c 100644 --- a/mps/code/thxc.c +++ b/mps/code/thxc.c @@ -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; diff --git a/mps/code/traceanc.c b/mps/code/traceanc.c index c57500c0b65..9212a633ba1 100644 --- a/mps/code/traceanc.c +++ b/mps/code/traceanc.c @@ -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; } diff --git a/mps/design/object-debug.txt b/mps/design/object-debug.txt index df89b5cf21c..1c9a03cb9ad 100644 --- a/mps/design/object-debug.txt +++ b/mps/design/object-debug.txt @@ -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::