diff --git a/mps/code/abqtest.c b/mps/code/abqtest.c index b385dd53cd1..244ffb132c9 100644 --- a/mps/code/abqtest.c +++ b/mps/code/abqtest.c @@ -5,21 +5,12 @@ */ #include "abq.h" -#include "cbs.h" -#include "mpm.h" #include "mps.h" #include "mpsavm.h" -#include "testlib.h" -#include "mpslib.h" -#include -#include -#include #include "mpstd.h" -#ifdef MPS_OS_IA -struct itimerspec; /* stop complaints from time.h */ -#endif -#include -#include +#include "testlib.h" + +#include SRCID(abqtest, "$Id$"); diff --git a/mps/code/cbs.c b/mps/code/cbs.c index 809bd340c23..98b57c789b0 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -29,12 +29,9 @@ typedef struct CBSBlockStruct { Size maxSize; /* accurate maximum block size of sub-tree */ } CBSBlockStruct; - -extern Bool CBSBlockCheck(CBSBlock block); #define CBSBlockBase(block) ((block)->base) #define CBSBlockLimit(block) ((block)->limit) #define CBSBlockSize(block) AddrOffset((block)->base, (block)->limit) -extern Size (CBSBlockSize)(CBSBlock block); #define cbsOfSplayTree(tree) PARENT(CBSStruct, splayTree, (tree)) @@ -44,7 +41,7 @@ extern Size (CBSBlockSize)(CBSBlock block); #define keyOfCBSBlock(block) ((void *)&((block)->base)) -/* CBSEnter, CBSLeave -- Avoid re-entrance +/* cbsEnter, cbsLeave -- Avoid re-entrance * * .enter-leave: The callbacks are restricted in what they may call. * These functions enforce this. @@ -52,7 +49,7 @@ extern Size (CBSBlockSize)(CBSBlock block); * .enter-leave.simple: Simple queries may be called from callbacks. */ -static void CBSEnter(CBS cbs) +static void cbsEnter(CBS cbs) { /* Don't need to check as always called from interface function. */ AVER(!cbs->inCBS); @@ -60,7 +57,7 @@ static void CBSEnter(CBS cbs) return; } -static void CBSLeave(CBS cbs) +static void cbsLeave(CBS cbs) { /* Don't need to check as always called from interface function. */ AVER(cbs->inCBS); @@ -87,7 +84,7 @@ Bool CBSCheck(CBS cbs) } -Bool CBSBlockCheck(CBSBlock block) +static Bool CBSBlockCheck(CBSBlock block) { /* See .enter-leave.simple. */ UNUSED(block); /* Required because there is no signature */ @@ -102,13 +99,6 @@ Bool CBSBlockCheck(CBSBlock block) } -Size (CBSBlockSize)(CBSBlock block) -{ - /* See .enter-leave.simple. */ - return CBSBlockSize(block); -} - - /* cbsSplayCompare -- Compare key to [base,limit) * * See @@ -250,7 +240,7 @@ Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment, AVERT(CBS, cbs); EVENT2(CBSInit, cbs, owner); - CBSLeave(cbs); + cbsLeave(cbs); return ResOK; } @@ -263,7 +253,7 @@ Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment, void CBSFinish(CBS cbs) { AVERT(CBS, cbs); - CBSEnter(cbs); + cbsEnter(cbs); METER_EMIT(&cbs->splaySearch); @@ -491,7 +481,7 @@ Res CBSInsert(Range rangeReturn, CBS cbs, Range range) Res res; AVERT(CBS, cbs); - CBSEnter(cbs); + cbsEnter(cbs); AVER(rangeReturn != NULL); AVERT(Range, range); @@ -499,7 +489,7 @@ Res CBSInsert(Range rangeReturn, CBS cbs, Range range) res = cbsInsertIntoTree(rangeReturn, cbs, range); - CBSLeave(cbs); + cbsLeave(cbs); return res; } @@ -591,7 +581,7 @@ Res CBSDelete(Range rangeReturn, CBS cbs, Range range) Res res; AVERT(CBS, cbs); - CBSEnter(cbs); + cbsEnter(cbs); AVER(rangeReturn != NULL); AVERT(Range, range); @@ -599,12 +589,12 @@ Res CBSDelete(Range rangeReturn, CBS cbs, Range range) res = cbsDeleteFromTree(rangeReturn, cbs, range); - CBSLeave(cbs); + cbsLeave(cbs); return res; } -static Res CBSBlockDescribe(CBSBlock block, mps_lib_FILE *stream) +static Res cbsBlockDescribe(CBSBlock block, mps_lib_FILE *stream) { Res res; @@ -619,14 +609,14 @@ static Res CBSBlockDescribe(CBSBlock block, mps_lib_FILE *stream) return res; } -static Res CBSSplayNodeDescribe(SplayNode splayNode, mps_lib_FILE *stream) +static Res cbsSplayNodeDescribe(SplayNode splayNode, mps_lib_FILE *stream) { Res res; if (splayNode == NULL) return ResFAIL; if (stream == NULL) return ResFAIL; - res = CBSBlockDescribe(cbsBlockOfSplayNode(splayNode), stream); + res = cbsBlockDescribe(cbsBlockOfSplayNode(splayNode), stream); return res; } @@ -637,15 +627,15 @@ static Res CBSSplayNodeDescribe(SplayNode splayNode, mps_lib_FILE *stream) * See . */ -/* Internal version without enter/leave checking. */ -static void cbsIterateInternal(CBS cbs, CBSIterateMethod iterate, - void *closureP, Size closureS) +void CBSIterate(CBS cbs, CBSIterateMethod iterate, + void *closureP, Size closureS) { SplayNode splayNode; SplayTree splayTree; CBSBlock cbsBlock; AVERT(CBS, cbs); + cbsEnter(cbs); AVER(FUNCHECK(iterate)); splayTree = splayTreeOfCBS(cbs); @@ -662,20 +652,8 @@ static void cbsIterateInternal(CBS cbs, CBSIterateMethod iterate, METER_ACC(cbs->splaySearch, cbs->splayTreeSize); splayNode = SplayTreeNext(splayTree, splayNode, keyOfCBSBlock(cbsBlock)); } - return; -} -void CBSIterate(CBS cbs, CBSIterateMethod iterate, - void *closureP, Size closureS) -{ - AVERT(CBS, cbs); - CBSEnter(cbs); - - AVER(FUNCHECK(iterate)); - - cbsIterateInternal(cbs, iterate, closureP, closureS); - - CBSLeave(cbs); + cbsLeave(cbs); return; } @@ -762,7 +740,7 @@ Bool CBSFindFirst(Range rangeReturn, Range oldRangeReturn, SplayNode node; AVERT(CBS, cbs); - CBSEnter(cbs); + cbsEnter(cbs); AVER(rangeReturn != NULL); AVER(oldRangeReturn != NULL); @@ -785,7 +763,7 @@ Bool CBSFindFirst(Range rangeReturn, Range oldRangeReturn, size, findDelete); } - CBSLeave(cbs); + cbsLeave(cbs); return found; } @@ -799,7 +777,7 @@ Bool CBSFindLast(Range rangeReturn, Range oldRangeReturn, SplayNode node; AVERT(CBS, cbs); - CBSEnter(cbs); + cbsEnter(cbs); AVER(rangeReturn != NULL); AVER(oldRangeReturn != NULL); @@ -822,7 +800,7 @@ Bool CBSFindLast(Range rangeReturn, Range oldRangeReturn, size, findDelete); } - CBSLeave(cbs); + cbsLeave(cbs); return found; } @@ -837,7 +815,7 @@ Bool CBSFindLargest(Range rangeReturn, Range oldRangeReturn, Bool notEmpty; AVERT(CBS, cbs); - CBSEnter(cbs); + cbsEnter(cbs); AVER(rangeReturn != NULL); AVER(oldRangeReturn != NULL); @@ -866,7 +844,7 @@ Bool CBSFindLargest(Range rangeReturn, Range oldRangeReturn, } } - CBSLeave(cbs); + cbsLeave(cbs); return found; } @@ -893,7 +871,7 @@ Res CBSDescribe(CBS cbs, mps_lib_FILE *stream) NULL); if (res != ResOK) return res; - res = SplayTreeDescribe(splayTreeOfCBS(cbs), stream, &CBSSplayNodeDescribe); + res = SplayTreeDescribe(splayTreeOfCBS(cbs), stream, &cbsSplayNodeDescribe); if (res != ResOK) return res; res = METER_WRITE(cbs->splaySearch, stream); diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 90a99607daf..4fdf22a11df 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -384,15 +384,15 @@ $(PFM)/$(VARIETY)/btcv: $(PFM)/$(VARIETY)/btcv.o \ $(PFM)/$(VARIETY)/bttest: $(PFM)/$(VARIETY)/bttest.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a -$(PFM)/$(VARIETY)/fbmtest: $(PFM)/$(VARIETY)/fbmtest.o \ - $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a - $(PFM)/$(VARIETY)/exposet0: $(PFM)/$(VARIETY)/exposet0.o \ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/expt825: $(PFM)/$(VARIETY)/expt825.o \ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a +$(PFM)/$(VARIETY)/fbmtest: $(PFM)/$(VARIETY)/fbmtest.o \ + $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(PFM)/$(VARIETY)/finalcv: $(PFM)/$(VARIETY)/finalcv.o \ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index 617b319d186..bd0601ca918 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -43,7 +43,7 @@ static Res MVTSegAlloc(Seg *segReturn, MVT mvt, Size size, Pool pool, Bool withReservoirPermit); static void MVTSegFree(MVT mvt, Seg seg); -static Bool MVTReturnRangeSegs(MVT mvt, Range range, Arena arena); +static Bool MVTReturnSegs(MVT mvt, Range range, Arena arena); static Res MVTInsert(MVT mvt, Addr base, Addr limit); static Res MVTDelete(MVT mvt, Addr base, Addr limit); static void MVTRefillIfNecessary(MVT mvt, Size size); @@ -632,7 +632,7 @@ static Res MVTReserve(MVT mvt, Range range) res = ABQPeek(MVTABQ(mvt), &oldRange); AVER(res == ResOK); AVERT(Range, &oldRange); - if (!MVTReturnRangeSegs(mvt, &oldRange, arena)) + if (!MVTReturnSegs(mvt, &oldRange, arena)) goto failOverflow; METER_ACC(mvt->returns, RangeSize(&oldRange)); res = ABQPush(MVTABQ(mvt), range); @@ -1086,10 +1086,9 @@ static void MVTSegFree(MVT mvt, Seg seg) } -/* MVTReturnRangeSegs -- return (interior) segments of a block to the - * arena - */ -static Bool MVTReturnRangeSegs(MVT mvt, Range range, Arena arena) +/* MVTReturnSegs -- return (interior) segments of a range to the arena */ + +static Bool MVTReturnSegs(MVT mvt, Range range, Arena arena) { Addr base, limit; Bool success = FALSE;