From c34562d0d44356c0d54da81572692f87fbb0df41 Mon Sep 17 00:00:00 2001
From: David Lovemore
Date: Sun, 23 Feb 2014 13:44:54 +0000
Subject: [PATCH 01/29] Add pin-leaf option to gcbench.
Remove default chain from gcbench.
Copied from Perforce
Change: 184454
ServerID: perforce.ravenbrook.com
---
mps/code/gcbench.c | 45 ++++++++++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c
index 77886851d41..071c3de0331 100644
--- a/mps/code/gcbench.c
+++ b/mps/code/gcbench.c
@@ -33,9 +33,6 @@ static mps_arena_t arena;
static mps_pool_t pool;
static mps_fmt_t format;
static mps_chain_t chain;
-static mps_gen_param_s genDefault[] = {
- { 5 * 1024 * 1024, 0.85 },
- { 50 * 1024 * 1024, 0.45 } };
/* objNULL needs to be odd so that it's ignored in exactRoots. */
#define objNULL ((obj_t)MPS_WORD_CONST(0xDECEA5ED))
@@ -52,6 +49,7 @@ static double pupdate = 0.1; /* probability of update */
static unsigned ngen = 0; /* number of generations specified */
static mps_gen_param_s gen[genLIMIT]; /* generation parameters */
static size_t arenasize = 256ul * 1024 * 1024; /* arena size */
+static unsigned pinleaf = FALSE; /* are leaf objects pinned at start */
typedef struct gcthread_s *gcthread_t;
@@ -82,13 +80,13 @@ static void aset(obj_t v, size_t i, obj_t val) {
}
/* mktree - make a tree of nodes with depth d. */
-static obj_t mktree(mps_ap_t ap, unsigned d) {
+static obj_t mktree(mps_ap_t ap, unsigned d, obj_t leaf) {
obj_t tree;
size_t i;
- if (d <= 0) return objNULL;
+ if (d <= 0) return leaf;
tree = mkvector(ap, width);
for (i = 0; i < width; ++i) {
- aset(tree, i, mktree(ap, d - 1));
+ aset(tree, i, mktree(ap, d - 1, leaf));
}
return tree;
}
@@ -154,8 +152,9 @@ static obj_t update_tree(mps_ap_t ap, obj_t oldtree, unsigned d) {
static void *gc_tree(gcthread_t thread) {
unsigned i, j;
mps_ap_t ap = thread->ap;
+ obj_t leaf = pinleaf ? mktree(ap, 1, objNULL) : objNULL;
for (i = 0; i < niter; ++i) {
- obj_t tree = mktree(ap, depth);
+ obj_t tree = mktree(ap, depth, leaf);
for (j = 0 ; j < npass; ++j) {
if (preuse < 1.0)
tree = new_tree(ap, tree, depth);
@@ -248,10 +247,12 @@ static void arena_setup(gcthread_fn_t fn,
/* Make wrappers now to avoid race condition. */
/* dylan_make_wrappers() uses malloc. */
RESMUST(dylan_make_wrappers());
- RESMUST(mps_chain_create(&chain, arena, ngen, gen));
+ if (ngen > 0)
+ RESMUST(mps_chain_create(&chain, arena, ngen, gen));
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
- MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
+ if (ngen > 0)
+ MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
MPS_ARGS_DONE(args);
RESMUST(mps_pool_create_k(&pool, arena, pool_class, args));
} MPS_ARGS_END(args);
@@ -276,6 +277,8 @@ static struct option longopts[] = {
{"depth", required_argument, NULL, 'd'},
{"preuse", required_argument, NULL, 'r'},
{"pupdate", required_argument, NULL, 'u'},
+ {"pin-leaf", no_argument, NULL, 'l'},
+ {"seed", required_argument, NULL, 'x'},
{NULL, 0, NULL, 0}
};
@@ -295,10 +298,17 @@ static struct {
int main(int argc, char *argv[]) {
int ch;
unsigned i;
+ int k;
seed = rnd_seed();
+ for(k=0; k 0) {
From 372b8de373ab4f503c6db4f157a8496fdd642c76 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Sun, 23 Feb 2014 20:42:38 +0000
Subject: [PATCH 02/29] Adding missing keyword expansion to c source files.
Copied from Perforce
Change: 184462
ServerID: perforce.ravenbrook.com
From e502b4880aaee4cc8dff5bc528584c5b81f6f6a1 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Sun, 23 Feb 2014 20:54:09 +0000
Subject: [PATCH 03/29] Branching branch/2014-02-22/splay-tune to
branch/2014-02-23/mvff-tune to fix the mvff pool and possibly make it a
candidate to replace the old mv pool.
Copied from Perforce
Change: 184463
ServerID: perforce.ravenbrook.com
From a8720f2615a7538fb2ff3d689eea46723f324e04 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Sun, 23 Feb 2014 20:58:00 +0000
Subject: [PATCH 04/29] Adding cbssize and freelistsize functions to calculate
the size of freelist contents.
Copied from Perforce
Change: 184466
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 23 ++++++++++++++++++++++-
mps/code/cbs.h | 2 ++
mps/code/freelist.c | 31 +++++++++++++++++++++++++++----
mps/code/freelist.h | 4 +++-
mps/code/poolmv2.c | 5 ++---
5 files changed, 56 insertions(+), 9 deletions(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index d4363f44475..2db3c8e955c 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -744,7 +744,8 @@ static void cbsFindDeleteRange(Range rangeReturn, Range oldRangeReturn,
deleted from one end of the block, so cbsDeleteFromTree did not
need to allocate a new block. */
AVER(res == ResOK);
- }
+ } else
+ RangeFinish(oldRangeReturn);
}
@@ -863,6 +864,26 @@ Bool CBSFindLargest(Range rangeReturn, Range oldRangeReturn,
}
+/* CBSSize -- calculate the total size of blocks in the CBS */
+
+static Bool CBSSizeIterate(CBS cbs, Range range, void *closureP, Size closureS)
+{
+ Size *sizeP = closureP;
+ UNUSED(cbs);
+ UNUSED(closureS);
+ *sizeP += RangeSize(range);
+ return TRUE;
+}
+
+Size CBSSize(CBS cbs)
+{
+ Size size = 0;
+ AVERT(CBS, cbs);
+ CBSIterate(cbs, CBSSizeIterate, &size, 0);
+ return size;
+}
+
+
/* CBSDescribe -- describe a CBS
*
* See .
diff --git a/mps/code/cbs.h b/mps/code/cbs.h
index 7ef712f6249..86364ed94c4 100644
--- a/mps/code/cbs.h
+++ b/mps/code/cbs.h
@@ -55,6 +55,8 @@ extern Bool CBSFindLast(Range rangeReturn, Range oldRangeReturn,
extern Bool CBSFindLargest(Range rangeReturn, Range oldRangeReturn,
CBS cbs, Size size, FindDelete findDelete);
+extern Size CBSSize(CBS cbs);
+
#endif /* cbs_h */
diff --git a/mps/code/freelist.c b/mps/code/freelist.c
index 6260451ff59..d171345bd2b 100644
--- a/mps/code/freelist.c
+++ b/mps/code/freelist.c
@@ -201,7 +201,7 @@ static void freelistBlockSetPrevNext(Freelist fl, FreelistBlock prev,
}
-Res FreelistInsert(Range rangeReturn, Freelist fl, Range range)
+void FreelistInsert(Range rangeReturn, Freelist fl, Range range)
{
FreelistBlock prev, cur, next, new;
Addr base, limit;
@@ -218,8 +218,10 @@ Res FreelistInsert(Range rangeReturn, Freelist fl, Range range)
prev = NULL;
cur = fl->list;
while (cur) {
- if (base < FreelistBlockLimit(fl, cur) && FreelistBlockBase(cur) < limit)
- return ResFAIL; /* range overlaps with cur */
+ if (base < FreelistBlockLimit(fl, cur) && FreelistBlockBase(cur) < limit) {
+ NOTREACHED; /* range overlaps with cur */
+ return; /* defensive ignore */
+ }
if (limit <= FreelistBlockBase(cur))
break;
next = FreelistBlockNext(cur);
@@ -262,7 +264,6 @@ Res FreelistInsert(Range rangeReturn, Freelist fl, Range range)
}
RangeInit(rangeReturn, base, limit);
- return ResOK;
}
@@ -624,6 +625,28 @@ void FreelistFlushToCBS(Freelist fl, CBS cbs)
}
+/* FreelistSize -- calculate the total size of blocks in the freelist */
+
+static Bool FreelistSizeVisitor(Bool *deleteReturn,
+ Range range,
+ void *closureP, Size closureS)
+{
+ Size *sizeP = closureP;
+ UNUSED(closureS);
+ *sizeP += RangeSize(range);
+ deleteReturn = FALSE;
+ return TRUE;
+}
+
+Size FreelistSize(Freelist fl)
+{
+ Size size = 0;
+ AVERT(Freelist, fl);
+ FreelistIterate(fl, FreelistSizeVisitor, &size, 0);
+ return size;
+}
+
+
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2013 Ravenbrook Limited .
diff --git a/mps/code/freelist.h b/mps/code/freelist.h
index 1bb9840c8c9..9624eba0e7e 100644
--- a/mps/code/freelist.h
+++ b/mps/code/freelist.h
@@ -32,7 +32,7 @@ extern Bool FreelistCheck(Freelist fl);
extern Res FreelistInit(Freelist fl, Align alignment);
extern void FreelistFinish(Freelist fl);
-extern Res FreelistInsert(Range rangeReturn, Freelist fl, Range range);
+extern void FreelistInsert(Range rangeReturn, Freelist fl, Range range);
extern Res FreelistDelete(Range rangeReturn, Freelist fl, Range range);
extern Res FreelistDescribe(Freelist fl, mps_lib_FILE *stream);
@@ -48,6 +48,8 @@ extern Bool FreelistFindLargest(Range rangeReturn, Range oldRangeReturn,
extern void FreelistFlushToCBS(Freelist fl, CBS cbs);
+extern Size FreelistSize(Freelist fl);
+
#endif /* freelist.h */
diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c
index 27382a91b61..290005f6f89 100644
--- a/mps/code/poolmv2.c
+++ b/mps/code/poolmv2.c
@@ -825,9 +825,8 @@ static Res MVTInsert(MVT mvt, Addr base, Addr limit)
if (ResIsAllocFailure(res)) {
/* CBS ran out of memory for splay nodes: add range to emergency
* free list instead. */
- res = FreelistInsert(&newRange, MVTFreelist(mvt), &range);
- }
- if (res != ResOK)
+ FreelistInsert(&newRange, MVTFreelist(mvt), &range);
+ } else
return res;
if (RangeSize(&newRange) >= mvt->reuseSize) {
From 05a27138266b51e97090f0999883ede25a8dad74 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Sun, 23 Feb 2014 21:00:53 +0000
Subject: [PATCH 05/29] Reforming mvff pool class to avoid using segments and
to actually have a chance to return memory to the arena.
Copied from Perforce
Change: 184467
ServerID: perforce.ravenbrook.com
---
mps/code/poolmvff.c | 404 +++++++++++++++++++++-----------------------
1 file changed, 193 insertions(+), 211 deletions(-)
diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c
index d2c2997e725..2bbf8873601 100644
--- a/mps/code/poolmvff.c
+++ b/mps/code/poolmvff.c
@@ -26,6 +26,8 @@
SRCID(poolmvff, "$Id$");
+/* #define MVFF_DEBUG */
+
/* Would go in poolmvff.h if the class had any MPS-internal clients. */
extern PoolClass PoolClassMVFF(void);
@@ -42,13 +44,13 @@ extern PoolClass PoolClassMVFF(void);
typedef struct MVFFStruct *MVFF;
typedef struct MVFFStruct { /* MVFF pool outer structure */
PoolStruct poolStruct; /* generic structure */
- SegPref segPref; /* the preferences for segments */
- Size extendBy; /* segment size to extend pool by */
- Size minSegSize; /* minimum size of segment */
+ SegPrefStruct segPrefStruct; /* the preferences for segments */
+ Size extendBy; /* size to extend pool by */
Size avgSize; /* client estimate of allocation size */
Size total; /* total bytes in pool */
Size free; /* total free bytes in pool */
- CBSStruct cbsStruct; /* free list */
+ CBSStruct totalCBSStruct; /* all memory allocated from the arena */
+ CBSStruct freeCBSStruct; /* free list */
FreelistStruct flStruct; /* emergency free list */
Bool firstFit; /* as opposed to last fit */
Bool slotHigh; /* prefers high part of large block */
@@ -56,12 +58,14 @@ typedef struct MVFFStruct { /* MVFF pool outer structure */
} MVFFStruct;
-#define Pool2MVFF(pool) PARENT(MVFFStruct, poolStruct, pool)
+#define Pool2MVFF(pool) PARENT(MVFFStruct, poolStruct, pool)
#define MVFF2Pool(mvff) (&((mvff)->poolStruct))
-#define CBSOfMVFF(mvff) (&((mvff)->cbsStruct))
-#define MVFFOfCBS(cbs) PARENT(MVFFStruct, cbsStruct, cbs)
-#define FreelistOfMVFF(mvff) (&((mvff)->flStruct))
-#define MVFFOfFreelist(fl) PARENT(MVFFStruct, flStruct, fl)
+#define MVFFFreeCBS(mvff) (&((mvff)->freeCBSStruct))
+#define MVFFTotalCBS(mvff) (&((mvff)->totalCBSStruct))
+#define MVFFOfCBS(cbs) PARENT(MVFFStruct, cbsStruct, cbs)
+#define MVFFFreelist(mvff) (&((mvff)->flStruct))
+#define MVFFOfFreelist(fl) PARENT(MVFFStruct, flStruct, fl)
+#define MVFFSegPref(mvff) (&((mvff)->segPrefStruct))
static Bool MVFFCheck(MVFF mvff);
@@ -80,151 +84,143 @@ typedef MVFFDebugStruct *MVFFDebug;
#define MVFFDebug2MVFF(mvffd) (&((mvffd)->mvffStruct))
-/* MVFFAddToFreeList -- Add given range to free list
+/* MVFFAddToFree -- Add given range to free list
*
- * Updates MVFF counters for additional free space. Returns maximally
- * coalesced range containing given range. Does not attempt to free
- * segments (see MVFFFreeSegs).
+ * Returns the maximally coalesced range containing the given range.
+ * Updates MVFF counters for additional free space.
*/
-static Res MVFFAddToFreeList(Addr *baseIO, Addr *limitIO, MVFF mvff) {
+
+static void MVFFAddToFree(Range coalesced, MVFF mvff, Range range) {
Res res;
- RangeStruct range, newRange;
- AVER(baseIO != NULL);
- AVER(limitIO != NULL);
+ AVERT(Range, range);
AVERT(MVFF, mvff);
- RangeInit(&range, *baseIO, *limitIO);
+ AVER(coalesced != range);
- res = CBSInsert(&newRange, CBSOfMVFF(mvff), &range);
- if (ResIsAllocFailure(res)) {
+ res = CBSInsert(coalesced, MVFFFreeCBS(mvff), range);
+ if (res != ResOK) {
/* CBS ran out of memory for splay nodes: add range to emergency
* free list instead. */
- res = FreelistInsert(&newRange, FreelistOfMVFF(mvff), &range);
+ AVER(ResIsAllocFailure(res));
+ FreelistInsert(coalesced, MVFFFreelist(mvff), range);
}
- if (res == ResOK) {
- mvff->free += RangeSize(&range);
- *baseIO = RangeBase(&newRange);
- *limitIO = RangeLimit(&newRange);
- }
-
- return res;
+ mvff->free += RangeSize(range);
}
-/* MVFFFreeSegs -- Free segments from given range
+/* MVFFDeleteFromFree -- delete range from free list
*
- * Given a free range, attempts to find entire segments within
+ * This wraps CBSDelete so that it cannot fail due to allocation.
+ *
+ * If the CBS ran out of memory for splay nodes then there were fragments
+ * on both sides: see . Handle
+ * this by deleting the full range (which requires no allocation) and
+ * re-inserting the fragments, which can't fail because it falls back
+ * to the freelist.
+ */
+
+static void MVFFDeleteFromFree(MVFF mvff, Range range)
+{
+ RangeStruct fullRange, oldRange, fragRange;
+ Res res;
+
+ res = CBSDelete(&fullRange, MVFFFreeCBS(mvff), range);
+ if (res == ResOK) {
+ mvff->free -= RangeSize(range);
+ } else if (res == ResFAIL) {
+ /* Not found in the CBS: must be found in the Freelist. */
+ res = FreelistDelete(&oldRange, MVFFFreelist(mvff), range);
+ AVER(res == ResOK);
+ mvff->free -= RangeSize(range);
+ } else if (ResIsAllocFailure(res)) {
+ res = CBSDelete(&oldRange, MVFFFreeCBS(mvff), &fullRange);
+ AVER(res == ResOK);
+ AVER(RangesEqual(&oldRange, &fullRange));
+ mvff->free -= RangeSize(&fullRange);
+
+ AVER(RangeBase(&fullRange) < RangeBase(range));
+ RangeInit(&fragRange, RangeBase(&fullRange), RangeBase(range));
+ MVFFAddToFree(&oldRange, mvff, &fragRange);
+
+ AVER(RangeLimit(range) < RangeLimit(&fullRange));
+ RangeInit(&fragRange, RangeLimit(range), RangeLimit(&fullRange));
+ MVFFAddToFree(&oldRange, mvff, &fragRange);
+ } else {
+ NOTREACHED; /* unexpected kind of failure from CBSDelete */
+ }
+}
+
+
+/* MVFFReduce -- free segments from given range
+ *
+ * Given a free range, attempts to find entire tracts within
* it, and returns them to the arena, updating total size counter.
*
* This is usually called immediately after MVFFAddToFreeList.
* It is not combined with MVFFAddToFreeList because the latter
* is also called when new segments are added under MVFFAlloc.
*/
-static void MVFFFreeSegs(MVFF mvff, Addr base, Addr limit)
+
+static void MVFFReduce(MVFF mvff, Range range)
{
- Seg seg = NULL; /* suppress "may be used uninitialized" */
Arena arena;
- Bool b;
- Addr segLimit; /* limit of the current segment when iterating */
- Addr segBase; /* base of the current segment when iterating */
+ RangeStruct alignedRange, oldRange;
+ Addr base, limit;
+ Size size;
Res res;
AVERT(MVFF, mvff);
- AVER(base < limit);
+ AVER(RangeBase(range) < RangeLimit(range));
/* Could profitably AVER that the given range is free, */
/* but the CBS doesn't provide that facility. */
- if (AddrOffset(base, limit) < mvff->minSegSize)
- return; /* not large enough for entire segments */
+ size = RangeSize(range);
arena = PoolArena(MVFF2Pool(mvff));
- b = SegOfAddr(&seg, arena, base);
- AVER(b);
-
- segBase = SegBase(seg);
- segLimit = SegLimit(seg);
-
- while(segLimit <= limit) { /* segment ends in range */
- if (segBase >= base) { /* segment starts in range */
- RangeStruct range, oldRange;
- RangeInit(&range, segBase, segLimit);
-
- res = CBSDelete(&oldRange, CBSOfMVFF(mvff), &range);
- if (res == ResOK) {
- mvff->free -= RangeSize(&range);
- } else if (ResIsAllocFailure(res)) {
- /* CBS ran out of memory for splay nodes, which must mean that
- * there were fragments on both sides: see
- * . Handle this by
- * deleting the whole of oldRange (which requires no
- * allocation) and re-inserting the fragments. */
- RangeStruct oldRange2;
- res = CBSDelete(&oldRange2, CBSOfMVFF(mvff), &oldRange);
- AVER(res == ResOK);
- AVER(RangesEqual(&oldRange2, &oldRange));
- mvff->free -= RangeSize(&oldRange);
- AVER(RangeBase(&oldRange) != segBase);
- {
- Addr leftBase = RangeBase(&oldRange);
- Addr leftLimit = segBase;
- res = MVFFAddToFreeList(&leftBase, &leftLimit, mvff);
- }
- AVER(RangeLimit(&oldRange) != segLimit);
- {
- Addr rightBase = segLimit;
- Addr rightLimit = RangeLimit(&oldRange);
- res = MVFFAddToFreeList(&rightBase, &rightLimit, mvff);
- }
- } else if (res == ResFAIL) {
- /* Not found in the CBS: must be found in the Freelist. */
- res = FreelistDelete(&oldRange, FreelistOfMVFF(mvff), &range);
- AVER(res == ResOK);
- mvff->free -= RangeSize(&range);
- }
-
- AVER(res == ResOK);
- AVER(RangesNest(&oldRange, &range));
-
- /* Can't free the segment earlier, because if it was on the
- * Freelist rather than the CBS then it likely contains data
- * that needs to be read in order to update the Freelist. */
- SegFree(seg);
- mvff->total -= RangeSize(&range);
- }
-
- /* Avoid calling SegNext if the next segment would fail */
- /* the loop test, mainly because there might not be a */
- /* next segment. */
- if (segLimit == limit) /* segment ends at end of range */
- break;
-
- b = SegFindAboveAddr(&seg, arena, segBase);
- AVER(b);
- segBase = SegBase(seg);
- segLimit = SegLimit(seg);
+ base = AddrAlignUp(RangeBase(range), ArenaAlign(arena));
+ limit = AddrAlignDown(RangeLimit(range), ArenaAlign(arena));
+ if (base >= limit) { /* no whole tracts */
+ return;
}
- return;
+ RangeInit(&alignedRange, base, limit);
+ AVER(RangesNest(range, &alignedRange));
+
+ /* Delete the range from the free list before attempting to delete it
+ from the total allocated memory, so that we don't have dangling blocks
+ in the freelist, even for a moment. If we fail to delete from the
+ totalCBS we add back to the freelist, which can't fail. */
+
+ MVFFDeleteFromFree(mvff, &alignedRange);
+
+ res = CBSDelete(&oldRange, MVFFTotalCBS(mvff), &alignedRange);
+ if (res != ResOK) {
+ RangeStruct coalesced;
+ MVFFAddToFree(&coalesced, mvff, &alignedRange);
+ return;
+ }
+ mvff->total -= RangeSize(&alignedRange);
+
+ ArenaFree(base, AddrOffset(base, limit), MVFF2Pool(mvff));
}
-/* MVFFAddSeg -- Allocates a new segment from the arena
+/* MVFFExtend -- Allocates a new segment from the arena
*
* Allocates a new segment from the arena (with the given
* withReservoirPermit flag) of at least the specified size. The
* specified size should be pool-aligned. Adds it to the free list.
*/
-static Res MVFFAddSeg(Seg *segReturn,
- MVFF mvff, Size size, Bool withReservoirPermit)
+static Res MVFFExtend(MVFF mvff, Size size, Bool withReservoirPermit)
{
Pool pool;
Arena arena;
Size segSize;
- Seg seg;
Res res;
Align align;
Addr base, limit;
+ RangeStruct range, coalesced;
AVERT(MVFF, mvff);
AVER(size > 0);
@@ -245,31 +241,29 @@ static Res MVFFAddSeg(Seg *segReturn,
segSize = SizeAlignUp(segSize, align);
- res = SegAlloc(&seg, SegClassGet(), mvff->segPref, segSize, pool,
- withReservoirPermit, argsNone);
+ res = ArenaAlloc(&base, MVFFSegPref(mvff), segSize, pool, withReservoirPermit);
if (res != ResOK) {
/* try again for a seg just large enough for object */
/* see */
segSize = SizeAlignUp(size, align);
- res = SegAlloc(&seg, SegClassGet(), mvff->segPref, segSize, pool,
- withReservoirPermit, argsNone);
- if (res != ResOK) {
+ res = ArenaAlloc(&base, MVFFSegPref(mvff), segSize, pool, withReservoirPermit);
+ if (res != ResOK)
return res;
- }
}
-
- mvff->total += segSize;
- base = SegBase(seg);
+
limit = AddrAdd(base, segSize);
+ RangeInit(&range, base, limit);
+
+ res = CBSInsert(&coalesced, MVFFTotalCBS(mvff), &range);
+ if (res != ResOK) {
+ ArenaFree(base, segSize, pool);
+ return res;
+ }
+ mvff->total += segSize;
+
DebugPoolFreeSplat(pool, base, limit);
- res = MVFFAddToFreeList(&base, &limit, mvff);
- AVER(res == ResOK);
- AVER(base <= SegBase(seg));
- if (mvff->minSegSize > segSize) mvff->minSegSize = segSize;
+ MVFFAddToFree(&coalesced, mvff, &range);
- /* Don't call MVFFFreeSegs; that would be silly. */
-
- *segReturn = seg;
return ResOK;
}
@@ -297,29 +291,31 @@ static Bool MVFFFindFirstFree(Addr *baseReturn, Addr *limitReturn,
AVER(size > 0);
AVER(SizeIsAligned(size, PoolAlignment(MVFF2Pool(mvff))));
- FreelistFlushToCBS(FreelistOfMVFF(mvff), CBSOfMVFF(mvff));
+ FreelistFlushToCBS(MVFFFreelist(mvff), MVFFFreeCBS(mvff));
findDelete = mvff->slotHigh ? FindDeleteHIGH : FindDeleteLOW;
foundBlock =
(mvff->firstFit ? CBSFindFirst : CBSFindLast)
- (&range, &oldRange, CBSOfMVFF(mvff), size, findDelete);
+ (&range, &oldRange, MVFFFreeCBS(mvff), size, findDelete);
if (!foundBlock) {
/* Failed to find a block in the CBS: try the emergency free list
* as well. */
foundBlock =
(mvff->firstFit ? FreelistFindFirst : FreelistFindLast)
- (&range, &oldRange, FreelistOfMVFF(mvff), size, findDelete);
+ (&range, &oldRange, MVFFFreelist(mvff), size, findDelete);
}
+
+ if (!foundBlock)
+ return FALSE;
- if (foundBlock) {
- *baseReturn = RangeBase(&range);
- *limitReturn = RangeLimit(&range);
- mvff->free -= size;
- }
+ AVER(RangeSize(&range) == size);
+ mvff->free -= size;
- return foundBlock;
+ *baseReturn = RangeBase(&range);
+ *limitReturn = RangeLimit(&range);
+ return TRUE;
}
@@ -345,28 +341,15 @@ static Res MVFFAlloc(Addr *aReturn, Pool pool, Size size,
foundBlock = MVFFFindFirstFree(&base, &limit, mvff, size);
if (!foundBlock) {
- Seg seg;
-
- res = MVFFAddSeg(&seg, mvff, size, withReservoirPermit);
+ res = MVFFExtend(mvff, size, withReservoirPermit);
if (res != ResOK)
return res;
foundBlock = MVFFFindFirstFree(&base, &limit, mvff, size);
-
- /* We know that the found range must intersect the new segment. */
- /* In particular, it doesn't necessarily lie entirely within it. */
- /* The next three AVERs test for intersection of two intervals. */
- AVER(base >= SegBase(seg) || limit <= SegLimit(seg));
- AVER(base < SegLimit(seg));
- AVER(SegBase(seg) < limit);
-
- /* We also know that the found range is no larger than the segment. */
- AVER(SegSize(seg) >= AddrOffset(base, limit));
}
AVER(foundBlock);
AVER(AddrOffset(base, limit) == size);
*aReturn = base;
-
return ResOK;
}
@@ -375,8 +358,7 @@ static Res MVFFAlloc(Addr *aReturn, Pool pool, Size size,
static void MVFFFree(Pool pool, Addr old, Size size)
{
- Res res;
- Addr base, limit;
+ RangeStruct range, coalescedRange;
MVFF mvff;
AVERT(Pool, pool);
@@ -388,15 +370,9 @@ static void MVFFFree(Pool pool, Addr old, Size size)
AVER(size > 0);
size = SizeAlignUp(size, PoolAlignment(pool));
- base = old;
- limit = AddrAdd(base, size);
-
- res = MVFFAddToFreeList(&base, &limit, mvff);
- AVER(res == ResOK);
- if (res == ResOK)
- MVFFFreeSegs(mvff, base, limit);
-
- return;
+ RangeInit(&range, old, AddrAdd(old, size));
+ MVFFAddToFree(&coalescedRange, mvff, &range);
+ MVFFReduce(mvff, &coalescedRange);
}
/* MVFFFindLargest -- call CBSFindLargest and then fall back to
@@ -411,12 +387,12 @@ static Bool MVFFFindLargest(Range range, Range oldRange, MVFF mvff,
AVER(size > 0);
AVERT(FindDelete, findDelete);
- FreelistFlushToCBS(FreelistOfMVFF(mvff), CBSOfMVFF(mvff));
+ FreelistFlushToCBS(MVFFFreelist(mvff), MVFFFreeCBS(mvff));
- if (CBSFindLargest(range, oldRange, CBSOfMVFF(mvff), size, findDelete))
+ if (CBSFindLargest(range, oldRange, MVFFFreeCBS(mvff), size, findDelete))
return TRUE;
- if (FreelistFindLargest(range, oldRange, FreelistOfMVFF(mvff),
+ if (FreelistFindLargest(range, oldRange, MVFFFreelist(mvff),
size, findDelete))
return TRUE;
@@ -436,7 +412,6 @@ static Res MVFFBufferFill(Addr *baseReturn, Addr *limitReturn,
MVFF mvff;
RangeStruct range, oldRange;
Bool found;
- Seg seg = NULL;
AVER(baseReturn != NULL);
AVER(limitReturn != NULL);
AVERT(Pool, pool);
@@ -450,12 +425,13 @@ static Res MVFFBufferFill(Addr *baseReturn, Addr *limitReturn,
found = MVFFFindLargest(&range, &oldRange, mvff, size, FindDeleteENTIRE);
if (!found) {
/* Add a new segment to the free list and try again. */
- res = MVFFAddSeg(&seg, mvff, size, withReservoirPermit);
+ res = MVFFExtend(mvff, size, withReservoirPermit);
if (res != ResOK)
return res;
found = MVFFFindLargest(&range, &oldRange, mvff, size, FindDeleteENTIRE);
}
AVER(found);
+ AVER(RangesEqual(&range, &oldRange));
AVER(RangeSize(&range) >= size);
mvff->free -= RangeSize(&range);
@@ -471,8 +447,8 @@ static Res MVFFBufferFill(Addr *baseReturn, Addr *limitReturn,
static void MVFFBufferEmpty(Pool pool, Buffer buffer,
Addr base, Addr limit)
{
- Res res;
MVFF mvff;
+ RangeStruct range, coalescedRange;
AVERT(Pool, pool);
mvff = Pool2MVFF(pool);
@@ -484,12 +460,9 @@ static void MVFFBufferEmpty(Pool pool, Buffer buffer,
if (base == limit)
return;
- res = MVFFAddToFreeList(&base, &limit, mvff);
- AVER(res == ResOK);
- if (res == ResOK)
- MVFFFreeSegs(mvff, base, limit);
-
- return;
+ RangeInit(&range, base, limit);
+ MVFFAddToFree(&coalescedRange, mvff, &range);
+ MVFFReduce(mvff, &coalescedRange);
}
@@ -538,7 +511,6 @@ static Res MVFFInit(Pool pool, ArgList args)
MVFF mvff;
Arena arena;
Res res;
- void *p;
ZoneSet zones;
ArgStruct arg;
@@ -579,36 +551,34 @@ static Res MVFFInit(Pool pool, ArgList args)
mvff = Pool2MVFF(pool);
mvff->extendBy = extendBy;
- if (extendBy < ArenaAlign(arena))
- mvff->minSegSize = ArenaAlign(arena);
- else
- mvff->minSegSize = extendBy;
mvff->avgSize = avgSize;
pool->alignment = align;
mvff->slotHigh = slotHigh;
mvff->firstFit = firstFit;
- res = ControlAlloc(&p, arena, sizeof(SegPrefStruct), FALSE);
- if (res != ResOK)
- return res;
-
- mvff->segPref = (SegPref)p;
- SegPrefInit(mvff->segPref);
- SegPrefExpress(mvff->segPref, arenaHigh ? SegPrefHigh : SegPrefLow, NULL);
+ SegPrefInit(MVFFSegPref(mvff));
+ SegPrefExpress(MVFFSegPref(mvff), arenaHigh ? SegPrefHigh : SegPrefLow, NULL);
/* If using zoneset placement, just put it apart from the others. */
zones = ZoneSetComp(ArenaDefaultZONESET);
- SegPrefExpress(mvff->segPref, SegPrefZoneSet, (void *)&zones);
+ SegPrefExpress(MVFFSegPref(mvff), SegPrefZoneSet, (void *)&zones);
mvff->total = 0;
mvff->free = 0;
- res = FreelistInit(FreelistOfMVFF(mvff), align);
+ res = FreelistInit(MVFFFreelist(mvff), align);
if (res != ResOK)
- goto failInit;
+ goto failFreelistInit;
- res = CBSInit(arena, CBSOfMVFF(mvff), (void *)mvff, align, TRUE, args);
+ /* TODO: Share the MFS pool between these two, since the totalCBS will
+ probably have few nodes in it. */
+
+ res = CBSInit(arena, MVFFTotalCBS(mvff), mvff, align, FALSE, args);
if (res != ResOK)
- goto failInit;
+ goto failTotalInit;
+
+ res = CBSInit(arena, MVFFFreeCBS(mvff), mvff, align, TRUE, args);
+ if (res != ResOK)
+ goto failFreeInit;
mvff->sig = MVFFSig;
AVERT(MVFF, mvff);
@@ -616,43 +586,47 @@ static Res MVFFInit(Pool pool, ArgList args)
slotHigh, arenaHigh, firstFit);
return ResOK;
-failInit:
- ControlFree(arena, p, sizeof(SegPrefStruct));
+failFreeInit:
+ CBSFinish(MVFFTotalCBS(mvff));
+failTotalInit:
+ FreelistFinish(MVFFFreelist(mvff));
+failFreelistInit:
+ AVER(res != ResOK);
return res;
}
/* MVFFFinish -- finish method for MVFF */
+static Bool MVFFTotalFreeVisitor(CBS cbs, Range range,
+ void *closureP, Size closureS)
+{
+ Pool pool = closureP;
+ UNUSED(cbs);
+ UNUSED(closureS);
+ ArenaFree(RangeBase(range), RangeSize(range), pool);
+ return TRUE;
+}
+
static void MVFFFinish(Pool pool)
{
MVFF mvff;
- Arena arena;
- Seg seg;
- Ring ring, node, nextNode;
AVERT(Pool, pool);
mvff = Pool2MVFF(pool);
AVERT(MVFF, mvff);
- ring = PoolSegRing(pool);
- RING_FOR(node, ring, nextNode) {
- seg = SegOfPoolRing(node);
- AVER(SegPool(seg) == pool);
- SegFree(seg);
- }
+ mvff->sig = SigInvalid;
+
+ (void)CBSIterate(MVFFTotalCBS(mvff), MVFFTotalFreeVisitor, pool, 0);
/* Could maintain mvff->total here and check it falls to zero, */
/* but that would just make the function slow. If only we had */
/* a way to do operations only if AVERs are turned on. */
- arena = PoolArena(pool);
- ControlFree(arena, mvff->segPref, sizeof(SegPrefStruct));
-
- CBSFinish(CBSOfMVFF(mvff));
- FreelistFinish(FreelistOfMVFF(mvff));
-
- mvff->sig = SigInvalid;
+ CBSFinish(MVFFFreeCBS(mvff));
+ CBSFinish(MVFFTotalCBS(mvff));
+ FreelistFinish(MVFFFreelist(mvff));
}
@@ -694,11 +668,15 @@ static Res MVFFDescribe(Pool pool, mps_lib_FILE *stream)
if (res != ResOK)
return res;
- res = CBSDescribe(CBSOfMVFF(mvff), stream);
+ res = CBSDescribe(MVFFTotalCBS(mvff), stream);
if (res != ResOK)
return res;
- res = FreelistDescribe(FreelistOfMVFF(mvff), stream);
+ res = CBSDescribe(MVFFFreeCBS(mvff), stream);
+ if (res != ResOK)
+ return res;
+
+ res = FreelistDescribe(MVFFFreelist(mvff), stream);
if (res != ResOK)
return res;
@@ -797,18 +775,22 @@ static Bool MVFFCheck(MVFF mvff)
CHECKS(MVFF, mvff);
CHECKD(Pool, MVFF2Pool(mvff));
CHECKL(IsSubclassPoly(MVFF2Pool(mvff)->class, MVFFPoolClassGet()));
- CHECKD(SegPref, mvff->segPref);
+ CHECKD(SegPref, MVFFSegPref(mvff));
CHECKL(mvff->extendBy > 0); /* see .arg.check */
- CHECKL(mvff->minSegSize >= ArenaAlign(PoolArena(MVFF2Pool(mvff))));
CHECKL(mvff->avgSize > 0); /* see .arg.check */
CHECKL(mvff->avgSize <= mvff->extendBy); /* see .arg.check */
CHECKL(mvff->total >= mvff->free);
CHECKL(SizeIsAligned(mvff->free, PoolAlignment(MVFF2Pool(mvff))));
CHECKL(SizeIsAligned(mvff->total, ArenaAlign(PoolArena(MVFF2Pool(mvff)))));
- CHECKD(CBS, CBSOfMVFF(mvff));
- CHECKD(Freelist, FreelistOfMVFF(mvff));
+ CHECKD(CBS, MVFFFreeCBS(mvff));
+ CHECKD(Freelist, MVFFFreelist(mvff));
CHECKL(BoolCheck(mvff->slotHigh));
CHECKL(BoolCheck(mvff->firstFit));
+#if MVFF_DEBUG
+ CHECKL(CBSSize(MVFFFreeCBS(mvff)) +
+ FreelistSize(MVFFFreelist(mvff)) == mvff->free);
+ CHECKL(CBSSize(MVFFTotalCBS(mvff)) == mvff->total);
+#endif
return TRUE;
}
@@ -825,7 +807,7 @@ CBS _mps_mvff_cbs(mps_pool_t mps_pool) {
mvff = Pool2MVFF(pool);
AVERT(MVFF, mvff);
- return CBSOfMVFF(mvff);
+ return MVFFFreeCBS(mvff);
}
From 09dd8e7027600d73b8d54a36aef067ab335671e9 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 24 Feb 2014 18:07:14 +0000
Subject: [PATCH 06/29] Avoid use of unreachable code in protcatchthread on os
x.
Copied from Perforce
Change: 184478
ServerID: perforce.ravenbrook.com
---
mps/code/protxc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mps/code/protxc.c b/mps/code/protxc.c
index fbd399b4878..8f62bb3a5df 100644
--- a/mps/code/protxc.c
+++ b/mps/code/protxc.c
@@ -1,7 +1,7 @@
/* protxc.c: PROTECTION EXCEPTION HANDLER FOR OS X MACH
*
* $Id$
- * Copyright (c) 2013 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2013-2014 Ravenbrook Limited. See end of file for license.
*
* This is the protection exception handling code for OS X using the
* Mach interface (not pthreads).
@@ -283,9 +283,9 @@ static void protCatchOne(void)
*/
static void *protCatchThread(void *p) {
+ UNUSED(p);
for (;;)
protCatchOne();
- return p;
}
@@ -403,7 +403,7 @@ void ProtSetup(void)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2013 Ravenbrook Limited .
+ * Copyright (C) 2013-2014 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
From bdd84a3a0f7016dfcfad3de95ed49c1c471b45cc Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 17:42:19 +0000
Subject: [PATCH 07/29] =?UTF-8?q?Bug=20fix.=20ensuring=20cbsfinddeleterang?=
=?UTF-8?q?e=20returns=20oldrangereturn=20even=20if=20it=20doesn=E2=80=99t?=
=?UTF-8?q?=20delete=20a=20block.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Copied from Perforce
Change: 184485
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 2db3c8e955c..16279dd5557 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -745,7 +745,7 @@ static void cbsFindDeleteRange(Range rangeReturn, Range oldRangeReturn,
need to allocate a new block. */
AVER(res == ResOK);
} else
- RangeFinish(oldRangeReturn);
+ mps_lib_memcpy(oldRangeReturn, rangeReturn, sizeof(RangeStruct));
}
From 5fc0d82d6ae6c870cc1a02a11f2fe264a0db4089 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 18:10:17 +0000
Subject: [PATCH 08/29] =?UTF-8?q?Initialising=20a=20shared=20inline=20mfs?=
=?UTF-8?q?=20for=20the=20cbss=20in=20mvff=20so=20that=20mvff=20can=20be?=
=?UTF-8?q?=20used=20as=20the=20arena=E2=80=99s=20bootstrap=20and=20contro?=
=?UTF-8?q?l=20pool.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Copied from Perforce
Change: 184486
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 58 ++++++++++++++++++++++++++-------------------
mps/code/cbs.h | 14 +++++++++++
mps/code/poolmvff.c | 26 +++++++++++++++-----
3 files changed, 67 insertions(+), 31 deletions(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 16279dd5557..f3e0c7b26fb 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -20,14 +20,7 @@
SRCID(cbs, "$Id$");
-
typedef struct CBSBlockStruct *CBSBlock;
-typedef struct CBSBlockStruct {
- TreeStruct node;
- Addr base;
- Addr limit;
- Size maxSize; /* accurate maximum block size of sub-tree */
-} CBSBlockStruct;
#define CBSBlockBase(block) ((block)->base)
#define CBSBlockLimit(block) ((block)->limit)
@@ -202,32 +195,20 @@ static void cbsUpdateNode(SplayTree tree, Tree node)
ARG_DEFINE_KEY(cbs_extend_by, Size);
-Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment,
- Bool fastFind, ArgList args)
+Res CBSInitWithPool(Arena arena, CBS cbs, void *owner, Align alignment,
+ Bool fastFind, Pool blockPool)
{
- Size extendBy = CBS_EXTEND_BY_DEFAULT;
- ArgStruct arg;
- Res res;
-
AVERT(Arena, arena);
-
- if (ArgPick(&arg, args, MPS_KEY_CBS_EXTEND_BY))
- extendBy = arg.val.size;
+ AVERT(Pool, blockPool);
+ AVER(BoolCheck(fastFind));
SplayTreeInit(treeOfCBS(cbs),
cbsCompare,
cbsKey,
fastFind ? cbsUpdateNode : SplayTrivUpdate);
- MPS_ARGS_BEGIN(pcArgs) {
- MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct));
- MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, extendBy);
- MPS_ARGS_DONE(pcArgs);
- res = PoolCreate(&(cbs->blockPool), arena, PoolClassMFS(), pcArgs);
- } MPS_ARGS_END(pcArgs);
- if (res != ResOK)
- return res;
- cbs->treeSize = 0;
+ cbs->treeSize = 0;
+ cbs->blockPool = blockPool;
cbs->fastFind = fastFind;
cbs->alignment = alignment;
cbs->inCBS = TRUE;
@@ -237,11 +218,38 @@ Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment,
cbs->sig = CBSSig;
AVERT(CBS, cbs);
+
EVENT2(CBSInit, cbs, owner);
cbsLeave(cbs);
+
return ResOK;
}
+Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment,
+ Bool fastFind, ArgList args)
+{
+ Size extendBy = CBS_EXTEND_BY_DEFAULT;
+ ArgStruct arg;
+ Res res;
+ Pool blockPool;
+
+ AVERT(Arena, arena);
+
+ if (ArgPick(&arg, args, MPS_KEY_CBS_EXTEND_BY))
+ extendBy = arg.val.size;
+
+ MPS_ARGS_BEGIN(pcArgs) {
+ MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct));
+ MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, extendBy);
+ MPS_ARGS_DONE(pcArgs);
+ res = PoolCreate(&blockPool, arena, PoolClassMFS(), pcArgs);
+ } MPS_ARGS_END(pcArgs);
+ if (res != ResOK)
+ return res;
+
+ return CBSInitWithPool(arena, cbs, owner, alignment, fastFind, blockPool);
+}
+
/* CBSFinish -- Finish a CBS structure
*
diff --git a/mps/code/cbs.h b/mps/code/cbs.h
index 86364ed94c4..648412beeb2 100644
--- a/mps/code/cbs.h
+++ b/mps/code/cbs.h
@@ -35,10 +35,24 @@ typedef struct CBSStruct {
Sig sig; /* sig at end because embeded */
} CBSStruct;
+
+/* CBSBlockStruct is here so that its size can be known, but should
+ be treated as opaque outside cbs.c. */
+
+typedef struct CBSBlockStruct {
+ TreeStruct node;
+ Addr base;
+ Addr limit;
+ Size maxSize; /* accurate maximum block size of sub-tree */
+} CBSBlockStruct;
+
+
extern Bool CBSCheck(CBS cbs);
extern Res CBSInit(Arena arena, CBS cbs, void *owner,
Align alignment, Bool fastFind, ArgList args);
+extern Res CBSInitWithPool(Arena arena, CBS cbs, void *owner,
+ Align alignment, Bool fastFind, Pool blockPool);
extern void CBSFinish(CBS cbs);
extern Res CBSInsert(Range rangeReturn, CBS cbs, Range range);
diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c
index 2bbf8873601..4e5d7924417 100644
--- a/mps/code/poolmvff.c
+++ b/mps/code/poolmvff.c
@@ -49,6 +49,7 @@ typedef struct MVFFStruct { /* MVFF pool outer structure */
Size avgSize; /* client estimate of allocation size */
Size total; /* total bytes in pool */
Size free; /* total free bytes in pool */
+ MFSStruct cbsBlockPoolStruct; /* stores blocks for CBSs */
CBSStruct totalCBSStruct; /* all memory allocated from the arena */
CBSStruct freeCBSStruct; /* free list */
FreelistStruct flStruct; /* emergency free list */
@@ -66,6 +67,7 @@ typedef struct MVFFStruct { /* MVFF pool outer structure */
#define MVFFFreelist(mvff) (&((mvff)->flStruct))
#define MVFFOfFreelist(fl) PARENT(MVFFStruct, flStruct, fl)
#define MVFFSegPref(mvff) (&((mvff)->segPrefStruct))
+#define MVFFBlockPool(mvff) (&((mvff)->cbsBlockPoolStruct.poolStruct))
static Bool MVFFCheck(MVFF mvff);
@@ -558,9 +560,8 @@ static Res MVFFInit(Pool pool, ArgList args)
SegPrefInit(MVFFSegPref(mvff));
SegPrefExpress(MVFFSegPref(mvff), arenaHigh ? SegPrefHigh : SegPrefLow, NULL);
- /* If using zoneset placement, just put it apart from the others. */
zones = ZoneSetComp(ArenaDefaultZONESET);
- SegPrefExpress(MVFFSegPref(mvff), SegPrefZoneSet, (void *)&zones);
+ SegPrefExpress(MVFFSegPref(mvff), SegPrefZoneSet, &zones);
mvff->total = 0;
mvff->free = 0;
@@ -569,14 +570,25 @@ static Res MVFFInit(Pool pool, ArgList args)
if (res != ResOK)
goto failFreelistInit;
- /* TODO: Share the MFS pool between these two, since the totalCBS will
- probably have few nodes in it. */
+ /* An MFS pool is explicitly initialised for the two CBSs partly to share
+ space, but mostly to avoid a call to PoolCreate, so that MVFF can be
+ used during arena bootstrap as the control pool. */
- res = CBSInit(arena, MVFFTotalCBS(mvff), mvff, align, FALSE, args);
+ MPS_ARGS_BEGIN(piArgs) {
+ MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct));
+ MPS_ARGS_DONE(piArgs);
+ res = PoolInit(MVFFBlockPool(mvff), arena, PoolClassMFS(), piArgs);
+ } MPS_ARGS_END(piArgs);
+ if (res != ResOK)
+ goto failBlockPoolInit;
+
+ res = CBSInitWithPool(arena, MVFFTotalCBS(mvff), mvff, ArenaAlign(arena),
+ TRUE, MVFFBlockPool(mvff));
if (res != ResOK)
goto failTotalInit;
- res = CBSInit(arena, MVFFFreeCBS(mvff), mvff, align, TRUE, args);
+ res = CBSInitWithPool(arena, MVFFFreeCBS(mvff), mvff, align,
+ TRUE, MVFFBlockPool(mvff));
if (res != ResOK)
goto failFreeInit;
@@ -589,6 +601,8 @@ static Res MVFFInit(Pool pool, ArgList args)
failFreeInit:
CBSFinish(MVFFTotalCBS(mvff));
failTotalInit:
+ PoolFinish(MVFFBlockPool(mvff));
+failBlockPoolInit:
FreelistFinish(MVFFFreelist(mvff));
failFreelistInit:
AVER(res != ResOK);
From 57c9c5aac8bd05b9fb12c9a4af23dc375b854ecc Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 19:04:49 +0000
Subject: [PATCH 09/29] Finishing the mvff block pool. oops.
Copied from Perforce
Change: 184487
ServerID: perforce.ravenbrook.com
---
mps/code/poolmvff.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c
index 4e5d7924417..d26011856b7 100644
--- a/mps/code/poolmvff.c
+++ b/mps/code/poolmvff.c
@@ -640,6 +640,7 @@ static void MVFFFinish(Pool pool)
CBSFinish(MVFFFreeCBS(mvff));
CBSFinish(MVFFTotalCBS(mvff));
+ PoolFinish(MVFFBlockPool(mvff));
FreelistFinish(MVFFFreelist(mvff));
}
From b876c0ff82b90f93fd2fd09ca24d67f1e5cda042 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 19:05:43 +0000
Subject: [PATCH 10/29] Only finishing the cbs block pool when cbs created it.
oops.
Copied from Perforce
Change: 184488
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 15 +++++++++++++--
mps/code/cbs.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index f3e0c7b26fb..1835d2dee07 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -212,6 +212,7 @@ Res CBSInitWithPool(Arena arena, CBS cbs, void *owner, Align alignment,
cbs->fastFind = fastFind;
cbs->alignment = alignment;
cbs->inCBS = TRUE;
+ cbs->blockPoolMine = FALSE;
METER_INIT(cbs->treeSearch, "size of tree", (void *)cbs);
@@ -247,7 +248,16 @@ Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment,
if (res != ResOK)
return res;
- return CBSInitWithPool(arena, cbs, owner, alignment, fastFind, blockPool);
+ res = CBSInitWithPool(arena, cbs, owner, alignment, fastFind, blockPool);
+ if (res != ResOK)
+ goto failCBSInit;
+
+ cbs->blockPoolMine = TRUE;
+ return ResOK;
+
+failCBSInit:
+ PoolDestroy(blockPool);
+ return res;
}
@@ -266,7 +276,8 @@ void CBSFinish(CBS cbs)
cbs->sig = SigInvalid;
SplayTreeFinish(treeOfCBS(cbs));
- PoolDestroy(cbs->blockPool);
+ if (cbs->blockPoolMine)
+ PoolDestroy(cbs->blockPool);
}
diff --git a/mps/code/cbs.h b/mps/code/cbs.h
index 648412beeb2..288b7ccca90 100644
--- a/mps/code/cbs.h
+++ b/mps/code/cbs.h
@@ -30,6 +30,7 @@ typedef struct CBSStruct {
Align alignment;
Bool fastFind;
Bool inCBS; /* prevent reentrance */
+ Bool blockPoolMine;
/* meters for sizes of search structures at each op */
METER_DECL(treeSearch);
Sig sig; /* sig at end because embeded */
From 4f73fc5afe77743b13da4d697bd06bff5641686a Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 19:11:21 +0000
Subject: [PATCH 11/29] Initial hack at replacing the arena control pool with
mvff.
Copied from Perforce
Change: 184489
ServerID: perforce.ravenbrook.com
---
mps/code/arena.c | 20 ++++++++++----------
mps/code/mpm.h | 1 +
mps/code/mpmst.h | 6 ++++--
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/mps/code/arena.c b/mps/code/arena.c
index b1584cb733e..d9199549751 100644
--- a/mps/code/arena.c
+++ b/mps/code/arena.c
@@ -12,11 +12,6 @@
SRCID(arena, "$Id$");
-/* ArenaControlPool -- get the control pool */
-
-#define ArenaControlPool(arena) MV2Pool(&(arena)->controlPoolStruct)
-
-
/* Forward declarations */
static void ArenaTrivCompact(Arena arena, Trace trace);
@@ -113,7 +108,7 @@ Bool ArenaCheck(Arena arena)
CHECKL(BoolCheck(arena->poolReady));
if (arena->poolReady) { /* */
- CHECKD(MV, &arena->controlPoolStruct);
+ CHECKD(Pool, ArenaControlPool(arena));
CHECKD(Reservoir, &arena->reservoirStruct);
}
/* Can't check that limit>=size because we may call ArenaCheck */
@@ -307,16 +302,21 @@ void ArenaDestroy(Arena arena)
/* ControlInit -- initialize the control pool */
+extern PoolClass PoolClassMVFF(void); /* FIXME: May need poolmvff.h */
+
Res ControlInit(Arena arena)
{
Res res;
+ PoolClass poolClass = PoolClassMVFF();
AVERT(Arena, arena);
+ AVER(sizeof(arena->control) >= poolClass->size);
+ AVER((char *)ArenaControlPool(arena) - (char *)&arena->control == poolClass->offset);
+
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, CONTROL_EXTEND_BY);
MPS_ARGS_DONE(args);
- res = PoolInit(&arena->controlPoolStruct.poolStruct, arena,
- PoolClassMV(), args);
+ res = PoolInit(ArenaControlPool(arena), arena, poolClass, args);
} MPS_ARGS_END(args);
if (res != ResOK)
return res;
@@ -331,7 +331,7 @@ void ControlFinish(Arena arena)
{
AVERT(Arena, arena);
arena->poolReady = FALSE;
- PoolFinish(&arena->controlPoolStruct.poolStruct);
+ PoolFinish(ArenaControlPool(arena));
}
@@ -353,7 +353,7 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream)
if (arena->poolReady) {
res = WriteF(stream,
- " controlPool $P\n", (WriteFP)&arena->controlPoolStruct,
+ " controlPool $P\n", (WriteFP)ArenaControlPool(arena),
NULL);
if (res != ResOK) return res;
}
diff --git a/mps/code/mpm.h b/mps/code/mpm.h
index b5cbabfb04c..32b54d75a52 100644
--- a/mps/code/mpm.h
+++ b/mps/code/mpm.h
@@ -508,6 +508,7 @@ extern Ring GlobalsRememberedSummaryRing(Globals);
#define ArenaAlign(arena) ((arena)->alignment)
#define ArenaGreyRing(arena, rank) (&(arena)->greyRing[rank])
#define ArenaPoolRing(arena) (&ArenaGlobals(arena)->poolRing)
+#define ArenaControlPool(arena) (&(arena)->control.poolStruct)
extern void (ArenaEnter)(Arena arena);
extern void (ArenaLeave)(Arena arena);
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h
index d0d3c12fbe9..57c3e288c4a 100644
--- a/mps/code/mpmst.h
+++ b/mps/code/mpmst.h
@@ -614,8 +614,10 @@ typedef struct mps_arena_s {
ArenaClass class; /* arena class structure */
Bool poolReady; /* */
- MVStruct controlPoolStruct; /* */
-
+ union {
+ char space[2984]; /* FIXME: Avoid moving tons of structures to mpmst.h */
+ PoolStruct poolStruct;
+ } control; /* */
ReservoirStruct reservoirStruct; /* */
Size committed; /* amount of committed RAM */
From c1ef37731aae5fc3400909eef507a4ef83ef2798 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 24 Feb 2014 21:32:22 +0000
Subject: [PATCH 12/29] Refactor the computation of the chunk size into its own
function, thus avoiding an "unreachable code" error from clang.
Copied from Perforce
Change: 184482
ServerID: perforce.ravenbrook.com
---
mps/code/arenavm.c | 58 +++++++++++++++++++++++++---------------------
1 file changed, 31 insertions(+), 27 deletions(-)
diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c
index 2df8d7065b1..fae4419a3fa 100644
--- a/mps/code/arenavm.c
+++ b/mps/code/arenavm.c
@@ -1,7 +1,7 @@
/* arenavm.c: VIRTUAL MEMORY ARENA CLASS
*
* $Id$
- * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
*
* DESIGN
@@ -909,6 +909,34 @@ static Bool pagesFindFreeWithSegPref(Index *baseReturn, VMChunk *chunkReturn,
}
+/* vmArenaChunkSize -- choose chunk size for arena extension
+ *
+ * .vmchunk.overhead: This code still lacks a proper estimate of
+ * the overhead required by a vmChunk for chunkStruct, page tables
+ * etc. For now, estimate it as 10%. RHSK 2007-12-21
+ */
+static Size vmArenaChunkSize(VMArena vmArena, Size size)
+{
+ Size fraction = 10; /* 10% -- see .vmchunk.overhead */
+ Size chunkSize;
+ Size chunkOverhead;
+
+ /* 1: use extendBy, if it is big enough for size + overhead */
+ chunkSize = vmArena->extendBy;
+ chunkOverhead = chunkSize / fraction;
+ if(chunkSize > size && (chunkSize - size) >= chunkOverhead)
+ return chunkSize;
+
+ /* 2: use size + overhead (unless it overflows SizeMAX) */
+ chunkOverhead = size / (fraction - 1);
+ if((SizeMAX - size) >= chunkOverhead)
+ return size + chunkOverhead;
+
+ /* 3: use SizeMAX */
+ return SizeMAX;
+}
+
+
/* vmArenaExtend -- Extend the arena by making a new chunk
*
* The size arg specifies how much we wish to allocate after the extension.
@@ -919,31 +947,7 @@ static Res vmArenaExtend(VMArena vmArena, Size size)
Size chunkSize;
Res res;
- /* Choose chunk size. */
- /* .vmchunk.overhead: This code still lacks a proper estimate of */
- /* the overhead required by a vmChunk for chunkStruct, page tables */
- /* etc. For now, estimate it as 10%. RHSK 2007-12-21 */
- do {
- Size fraction = 10; /* 10% -- see .vmchunk.overhead */
- Size chunkOverhead;
-
- /* 1: use extendBy, if it is big enough for size + overhead */
- chunkSize = vmArena->extendBy;
- chunkOverhead = chunkSize / fraction;
- if(chunkSize > size && (chunkSize - size) >= chunkOverhead)
- break;
-
- /* 2: use size + overhead (unless it overflows SizeMAX) */
- chunkOverhead = size / (fraction - 1);
- if((SizeMAX - size) >= chunkOverhead) {
- chunkSize = size + chunkOverhead;
- break;
- }
-
- /* 3: use SizeMAX */
- chunkSize = SizeMAX;
- break;
- } while(0);
+ chunkSize = vmArenaChunkSize(vmArena, size);
EVENT3(vmArenaExtendStart, size, chunkSize,
VMArenaReserved(VMArena2Arena(vmArena)));
@@ -1571,7 +1575,7 @@ mps_arena_class_t mps_arena_class_vmnz(void)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2013 Ravenbrook Limited .
+ * Copyright (C) 2001-2014 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
From 018653d16001cdd7ab3ca40c0c28a995177084b6 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 22:25:48 +0000
Subject: [PATCH 13/29] Fixing compiler warning.
Copied from Perforce
Change: 184490
ServerID: perforce.ravenbrook.com
---
mps/code/arena.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mps/code/arena.c b/mps/code/arena.c
index d9199549751..2c713ec1042 100644
--- a/mps/code/arena.c
+++ b/mps/code/arena.c
@@ -311,7 +311,7 @@ Res ControlInit(Arena arena)
AVERT(Arena, arena);
AVER(sizeof(arena->control) >= poolClass->size);
- AVER((char *)ArenaControlPool(arena) - (char *)&arena->control == poolClass->offset);
+ AVER((Size)((char *)ArenaControlPool(arena) - (char *)&arena->control) == poolClass->offset);
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, CONTROL_EXTEND_BY);
From dc38189d5c5e0510b25f6e63b18bc0bc437a57c3 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 22:26:22 +0000
Subject: [PATCH 14/29] Adding rangeisempty.
Copied from Perforce
Change: 184491
ServerID: perforce.ravenbrook.com
---
mps/code/range.c | 6 ++++++
mps/code/range.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/mps/code/range.c b/mps/code/range.c
index b2d4494454e..c12682ddd3a 100644
--- a/mps/code/range.c
+++ b/mps/code/range.c
@@ -94,6 +94,12 @@ Bool RangeIsAligned(Range range, Align alignment)
&& AddrIsAligned(RangeLimit(range), alignment);
}
+Bool RangeIsEmpty(Range range)
+{
+ AVERT(Range, range);
+ return RangeBase(range) == RangeLimit(range);
+}
+
Addr (RangeBase)(Range range) {
AVERT(Range, range);
return RangeBase(range);
diff --git a/mps/code/range.h b/mps/code/range.h
index 42ab4167715..69bd95d31a8 100644
--- a/mps/code/range.h
+++ b/mps/code/range.h
@@ -32,6 +32,7 @@ extern void RangeFinish(Range range);
extern Res RangeDescribe(Range range, mps_lib_FILE *stream);
extern Bool RangeCheck(Range range);
extern Bool RangeIsAligned(Range range, Align align);
+extern Bool RangeIsEmpty(Range range);
extern Bool RangesOverlap(Range range1, Range range2);
extern Bool RangesNest(Range outer, Range inner);
extern Bool RangesEqual(Range range1, Range range2);
From a28fda3fc557e8795c7494cfa4a2657896afbd4f Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 22:27:16 +0000
Subject: [PATCH 15/29] Making assertions in cbsupdatenode critical, since this
is extremely hot in any cbs with fast find.
Copied from Perforce
Change: 184492
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 1835d2dee07..7e221a6b3f8 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -165,9 +165,9 @@ static void cbsUpdateNode(SplayTree tree, Tree node)
Size maxSize;
CBSBlock block;
- AVERT(SplayTree, tree);
- AVERT(Tree, node);
- AVER(cbsOfTree(tree)->fastFind);
+ AVERT_CRITICAL(SplayTree, tree);
+ AVERT_CRITICAL(Tree, node);
+ AVER_CRITICAL(cbsOfTree(tree)->fastFind);
block = cbsBlockOfNode(node);
maxSize = CBSBlockSize(block);
From 7db856f7b8e516b663c20a181427f4a097465d4a Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 22:48:48 +0000
Subject: [PATCH 16/29] Fixed a bug in cbsfindlargest where it always deleted
the entire range found even when finddeletelow or finddeletehigh were passed.
Copied from Perforce
Change: 184493
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 7e221a6b3f8..fc4ae964603 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -874,7 +874,7 @@ Bool CBSFindLargest(Range rangeReturn, Range oldRangeReturn,
RangeInit(&range, CBSBlockBase(block), CBSBlockLimit(block));
AVER(RangeSize(&range) >= maxSize);
cbsFindDeleteRange(rangeReturn, oldRangeReturn, cbs, &range,
- maxSize, findDelete);
+ size, findDelete);
}
}
From 5f9e0724121e4652f04ed86fef1d714be29196b2 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 23:02:42 +0000
Subject: [PATCH 17/29] Bug fix. nonsensical case in cbsfindlargest when size
is passed as zero.
Added RangeCopy.
Copied from Perforce
Change: 184496
ServerID: perforce.ravenbrook.com
---
mps/code/cbs.c | 11 ++++++++---
mps/code/range.c | 8 ++++++++
mps/code/range.h | 1 +
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index fc4ae964603..f20896b97b7 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -764,7 +764,7 @@ static void cbsFindDeleteRange(Range rangeReturn, Range oldRangeReturn,
need to allocate a new block. */
AVER(res == ResOK);
} else
- mps_lib_memcpy(oldRangeReturn, rangeReturn, sizeof(RangeStruct));
+ RangeCopy(oldRangeReturn, rangeReturn);
}
@@ -873,8 +873,13 @@ Bool CBSFindLargest(Range rangeReturn, Range oldRangeReturn,
AVER(CBSBlockSize(block) >= maxSize);
RangeInit(&range, CBSBlockBase(block), CBSBlockLimit(block));
AVER(RangeSize(&range) >= maxSize);
- cbsFindDeleteRange(rangeReturn, oldRangeReturn, cbs, &range,
- size, findDelete);
+ if (size > 0)
+ cbsFindDeleteRange(rangeReturn, oldRangeReturn, cbs, &range,
+ size, findDelete);
+ else {
+ RangeCopy(rangeReturn, &range); /* FIXME: sense? */
+ RangeCopy(oldRangeReturn, &range);
+ }
}
}
diff --git a/mps/code/range.c b/mps/code/range.c
index c12682ddd3a..eb22a9d22e6 100644
--- a/mps/code/range.c
+++ b/mps/code/range.c
@@ -43,6 +43,14 @@ void RangeFinish(Range range)
range->base = range->limit = NULL;
}
+void RangeCopy(Range toRange, Range fromRange)
+{
+ AVERT(Range, fromRange);
+ toRange->base = fromRange->base;
+ toRange->limit = fromRange->limit;
+ toRange->sig = RangeSig;
+}
+
Res RangeDescribe(Range range, mps_lib_FILE *stream)
{
Res res;
diff --git a/mps/code/range.h b/mps/code/range.h
index 69bd95d31a8..ea113ab656e 100644
--- a/mps/code/range.h
+++ b/mps/code/range.h
@@ -29,6 +29,7 @@ typedef struct RangeStruct *Range;
extern void RangeInit(Range range, Addr base, Addr limit);
extern void RangeFinish(Range range);
+extern void RangeCopy(Range toRange, Range fromRange);
extern Res RangeDescribe(Range range, mps_lib_FILE *stream);
extern Bool RangeCheck(Range range);
extern Bool RangeIsAligned(Range range, Align align);
From 5ac2b0b14e0ada5fcff5dd7589f5bc07e8849273 Mon Sep 17 00:00:00 2001
From: Richard Brooksby
Date: Mon, 24 Feb 2014 23:03:10 +0000
Subject: [PATCH 18/29] Bug fix. gcbench attempted to delete a nonexistent
chain by default.
Copied from Perforce
Change: 184497
ServerID: perforce.ravenbrook.com
---
mps/code/gcbench.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c
index 071c3de0331..833203a23c2 100644
--- a/mps/code/gcbench.c
+++ b/mps/code/gcbench.c
@@ -259,7 +259,8 @@ static void arena_setup(gcthread_fn_t fn,
watch(fn, name);
mps_pool_destroy(pool);
mps_fmt_destroy(format);
- mps_chain_destroy(chain);
+ if (ngen > 0)
+ mps_chain_destroy(chain);
mps_arena_destroy(arena);
}
From af51318a09bb126b5213b141da94149a9886f988 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 26 Feb 2014 11:52:13 +0000
Subject: [PATCH 19/29] Branch for obsoleting mps_args_done.
Copied from Perforce
Change: 184537
ServerID: perforce.ravenbrook.com
From 6d31337e897d076692bbd72f8049c80575ef6603 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 26 Feb 2014 12:23:21 +0000
Subject: [PATCH 20/29] Remove duplicate documentation for mps_key_chain
argument to ams.
Write "takes" instead of "requires" when documenting keyword arguments for debugging pool classes.
Copied from Perforce
Change: 184540
ServerID: perforce.ravenbrook.com
---
mps/manual/source/pool/ams.rst | 8 ++------
mps/manual/source/pool/mv.rst | 2 +-
mps/manual/source/pool/mvff.rst | 2 +-
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/mps/manual/source/pool/ams.rst b/mps/manual/source/pool/ams.rst
index 922d9d8e366..b5d7db84757 100644
--- a/mps/manual/source/pool/ams.rst
+++ b/mps/manual/source/pool/ams.rst
@@ -103,17 +103,13 @@ AMS interface
:term:`pool`.
When creating an AMS pool, :c:func:`mps_pool_create_k` requires
- two :term:`keyword arguments`:
+ one :term:`keyword argument`:
* :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
the :term:`object format` for the objects allocated in the pool.
The format must provide a :term:`scan method` and a :term:`skip
method`.
- * :c:macro:`MPS_KEY_CHAIN` (type :c:type:`mps_chain_t`) specifies
- the :term:`generation chain` for the pool. It must have a single
- generation.
-
It accepts three optional keyword arguments:
* :c:macro:`MPS_KEY_CHAIN` (type :c:type:`mps_chain_t`) specifies
@@ -186,7 +182,7 @@ AMS interface
class.
When creating a debugging AMS pool, :c:func:`mps_pool_create_k`
- requires three keyword arguments: :c:macro:`MPS_KEY_FORMAT` and
+ takes three keyword arguments: :c:macro:`MPS_KEY_FORMAT` and
:c:macro:`MPS_KEY_CHAIN` are as described above, and
:c:macro:`MPS_KEY_POOL_DEBUG_OPTIONS` specifies the debugging
options. See :c:type:`mps_debug_option_s`.
diff --git a/mps/manual/source/pool/mv.rst b/mps/manual/source/pool/mv.rst
index b49fc34e1f9..6a9d6e9e666 100644
--- a/mps/manual/source/pool/mv.rst
+++ b/mps/manual/source/pool/mv.rst
@@ -118,7 +118,7 @@ MV interface
class.
When creating a debugging MV pool, :c:func:`mps_pool_create_k`
- requires four keyword arguments: :c:macro:`MPS_KEY_EXTEND_SIZE`,
+ takes four keyword arguments: :c:macro:`MPS_KEY_EXTEND_SIZE`,
:c:macro:`MPS_KEY_MEAN_SIZE`, :c:macro:`MPS_KEY_MAX_SIZE` are as
described above, and :c:macro:`MPS_KEY_POOL_DEBUG_OPTIONS`
specifies the debugging options. See :c:type:`mps_debug_option_s`.
diff --git a/mps/manual/source/pool/mvff.rst b/mps/manual/source/pool/mvff.rst
index 0b184615909..7536d2d5d75 100644
--- a/mps/manual/source/pool/mvff.rst
+++ b/mps/manual/source/pool/mvff.rst
@@ -195,7 +195,7 @@ MVFF interface
class.
When creating a debugging MVFF pool, :c:func:`mps_pool_create_k`
- requires seven :term:`keyword arguments`.
+ takes seven :term:`keyword arguments`.
* :c:macro:`MPS_KEY_EXTEND_BY`, :c:macro:`MPS_KEY_MEAN_SIZE`,
:c:macro:`MPS_KEY_ALIGN`, :c:macro:`MPS_KEY_MVFF_ARENA_HIGH`,
From 6971bee496cd312553123991f19b467ca47a9210 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 26 Feb 2014 12:47:27 +0000
Subject: [PATCH 21/29] Make mps_args_done obsolete.
Copied from Perforce
Change: 184543
ServerID: perforce.ravenbrook.com
---
mps/code/amsss.c | 4 ----
mps/code/arena.c | 1 -
mps/code/arenacv.c | 2 --
mps/code/awlut.c | 1 -
mps/code/awluthe.c | 1 -
mps/code/cbs.c | 1 -
mps/code/dbgpool.c | 1 -
mps/code/djbench.c | 1 -
mps/code/fotest.c | 2 --
mps/code/gcbench.c | 2 --
mps/code/mps.h | 8 +++++---
mps/code/mpsi.c | 4 ----
mps/code/mv2test.c | 1 -
mps/code/poolamc.c | 1 -
mps/code/poolawl.c | 1 -
mps/code/poolmrg.c | 1 -
mps/code/poolmv.c | 2 --
mps/code/poolncv.c | 1 -
mps/code/segsmss.c | 1 -
mps/example/scheme/scheme-advanced.c | 8 --------
mps/example/scheme/scheme.c | 3 ---
mps/manual/source/guide/advanced.rst | 4 ----
mps/manual/source/guide/lang.rst | 4 ----
mps/manual/source/pool/amc.rst | 1 -
mps/manual/source/pool/amcz.rst | 1 -
mps/manual/source/pool/ams.rst | 2 --
mps/manual/source/pool/awl.rst | 2 --
mps/manual/source/pool/lo.rst | 1 -
mps/manual/source/pool/mfs.rst | 1 -
mps/manual/source/pool/mv.rst | 1 -
mps/manual/source/pool/mvff.rst | 1 -
mps/manual/source/pool/mvt.rst | 1 -
mps/manual/source/pool/snc.rst | 2 --
mps/manual/source/topic/arena.rst | 2 --
mps/manual/source/topic/debugging.rst | 1 -
mps/manual/source/topic/format.rst | 1 -
mps/manual/source/topic/keyword.rst | 28 ++++++++++-----------------
37 files changed, 15 insertions(+), 85 deletions(-)
diff --git a/mps/code/amsss.c b/mps/code/amsss.c
index 67d1018aba8..43d2541f401 100644
--- a/mps/code/amsss.c
+++ b/mps/code/amsss.c
@@ -226,7 +226,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, FALSE);
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_ams_debug(), args),
"pool_create(ams_debug,share)");
} MPS_ARGS_END(args);
@@ -239,7 +238,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, TRUE);
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_ams_debug(), args),
"pool_create(ams_debug,ambig)");
} MPS_ARGS_END(args);
@@ -252,7 +250,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, TRUE);
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_ams(), args),
"pool_create(ams,ambig)");
} MPS_ARGS_END(args);
@@ -265,7 +262,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, FALSE);
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_ams(), args),
"pool_create(ams,share)");
} MPS_ARGS_END(args);
diff --git a/mps/code/arena.c b/mps/code/arena.c
index b1584cb733e..f2e94f99fed 100644
--- a/mps/code/arena.c
+++ b/mps/code/arena.c
@@ -314,7 +314,6 @@ Res ControlInit(Arena arena)
AVERT(Arena, arena);
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, CONTROL_EXTEND_BY);
- MPS_ARGS_DONE(args);
res = PoolInit(&arena->controlPoolStruct.poolStruct, arena,
PoolClassMV(), args);
} MPS_ARGS_END(args);
diff --git a/mps/code/arenacv.c b/mps/code/arenacv.c
index 10ef9c45314..b52345f9013 100644
--- a/mps/code/arenacv.c
+++ b/mps/code/arenacv.c
@@ -344,7 +344,6 @@ static void testPageTable(ArenaClass class, Size size, Addr addr)
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, addr);
- MPS_ARGS_DONE(args);
die(ArenaCreate(&arena, class, args), "ArenaCreate");
} MPS_ARGS_END(args);
@@ -382,7 +381,6 @@ static void testSize(Size size)
do {
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
- MPS_ARGS_DONE(args);
res = ArenaCreate(&arena, class, args);
} MPS_ARGS_END(args);
if (res == ResOK)
diff --git a/mps/code/awlut.c b/mps/code/awlut.c
index a39ccb7c6cb..25ceb34b29b 100644
--- a/mps/code/awlut.c
+++ b/mps/code/awlut.c
@@ -278,7 +278,6 @@ static void *setup(void *v, size_t s)
weaknesss and want things to die in it promptly. */
MPS_ARGS_ADD(args, MPS_KEY_GEN, 0);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, dylanfmt);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&leafpool, arena, mps_class_lo(), args),
"Leaf Pool Create\n");
} MPS_ARGS_END(args);
diff --git a/mps/code/awluthe.c b/mps/code/awluthe.c
index 9f450d55c50..6b56d05f78d 100644
--- a/mps/code/awluthe.c
+++ b/mps/code/awluthe.c
@@ -281,7 +281,6 @@ static void *setup(void *v, size_t s)
weaknesss and want things to die in it promptly. */
MPS_ARGS_ADD(args, MPS_KEY_GEN, 0);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, dylanfmt);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&leafpool, arena, mps_class_lo(), args),
"Leaf Pool Create\n");
} MPS_ARGS_END(args);
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 98b57c789b0..84913dd9eab 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -223,7 +223,6 @@ Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment,
MPS_ARGS_BEGIN(pcArgs) {
MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct));
MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, extendBy);
- MPS_ARGS_DONE(pcArgs);
res = PoolCreate(&(cbs->blockPool), arena, PoolClassMFS(), pcArgs);
} MPS_ARGS_END(pcArgs);
if (res != ResOK)
diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c
index 3d670d8d361..db4fab371c3 100644
--- a/mps/code/dbgpool.c
+++ b/mps/code/dbgpool.c
@@ -188,7 +188,6 @@ static Res DebugPoolInit(Pool pool, ArgList args)
MPS_ARGS_BEGIN(pcArgs) {
MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, debug->tagSize); /* FIXME: Check this */
MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, debug->tagSize);
- MPS_ARGS_DONE(pcArgs);
res = PoolCreate(&debug->tagPool, PoolArena(pool), PoolClassMFS(), pcArgs);
} MPS_ARGS_END(pcArgs);
if (res != ResOK)
diff --git a/mps/code/djbench.c b/mps/code/djbench.c
index 74fd09dadab..09eaa6d513c 100644
--- a/mps/code/djbench.c
+++ b/mps/code/djbench.c
@@ -187,7 +187,6 @@ static void arena_wrap(dj_t dj, mps_class_t pool_class, const char *name)
{
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 256ul * 1024 * 1024); /* FIXME: Why is there no default? */
- MPS_ARGS_DONE(args);
DJMUST(mps_arena_create_k(&arena, mps_arena_class_vm(), args));
} MPS_ARGS_END(args);
DJMUST(mps_pool_create_k(&pool, arena, pool_class, mps_args_none));
diff --git a/mps/code/fotest.c b/mps/code/fotest.c
index 333da328475..cab1d0f4e31 100644
--- a/mps/code/fotest.c
+++ b/mps/code/fotest.c
@@ -183,7 +183,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, rnd() % 2);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, rnd() % 2);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, rnd() % 2);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_mvff(), args), "create MVFF");
} MPS_ARGS_END(args);
{
@@ -203,7 +202,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, (1 + rnd() % 4) * 1024);
MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, (1 + rnd() % 64) * 16);
MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, (rnd() % 101) / 100.0);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_mvt(), args), "create MVFF");
} MPS_ARGS_END(args);
{
diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c
index 833203a23c2..7e0ccbfb323 100644
--- a/mps/code/gcbench.c
+++ b/mps/code/gcbench.c
@@ -240,7 +240,6 @@ static void arena_setup(gcthread_fn_t fn,
{
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, arenasize);
- MPS_ARGS_DONE(args);
RESMUST(mps_arena_create_k(&arena, mps_arena_class_vm(), args));
} MPS_ARGS_END(args);
RESMUST(dylan_fmt(&format, arena));
@@ -253,7 +252,6 @@ static void arena_setup(gcthread_fn_t fn,
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
if (ngen > 0)
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
- MPS_ARGS_DONE(args);
RESMUST(mps_pool_create_k(&pool, arena, pool_class, args));
} MPS_ARGS_END(args);
watch(fn, name);
diff --git a/mps/code/mps.h b/mps/code/mps.h
index f8751d01372..156e0fae7b7 100644
--- a/mps/code/mps.h
+++ b/mps/code/mps.h
@@ -222,9 +222,10 @@ extern const struct mps_key_s _mps_key_fmt_class;
#define MPS_ARGS_BEGIN(_var) \
MPS_BEGIN \
- mps_arg_s _var[MPS_ARGS_MAX]; \
- unsigned _var##_i = 0; \
- MPS_BEGIN
+ mps_arg_s _var[MPS_ARGS_MAX]; \
+ unsigned _var##_i = 0; \
+ _var[_var##_i].key = MPS_KEY_ARGS_END; \
+ MPS_BEGIN
#define MPS_ARGS_ADD_FIELD(_var, _key, _field, _val) \
MPS_BEGIN \
@@ -232,6 +233,7 @@ extern const struct mps_key_s _mps_key_fmt_class;
_var[_var##_i].key = (_key); \
_var[_var##_i].val._field = (_val); \
++_var##_i; \
+ _var[_var##_i].key = MPS_KEY_ARGS_END; \
MPS_END
#define MPS_ARGS_ADD(_var, _key, _val) \
diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c
index eb7fdb89558..1d52208be9a 100644
--- a/mps/code/mpsi.c
+++ b/mps/code/mpsi.c
@@ -498,7 +498,6 @@ mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o,
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, mps_fmt_A->fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt_A->isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt_A->pad);
- MPS_ARGS_DONE(args);
res = FormatCreate(&format, arena, args);
} MPS_ARGS_END(args);
@@ -533,7 +532,6 @@ mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o,
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt_B->isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt_B->pad);
MPS_ARGS_ADD(args, MPS_KEY_FMT_CLASS, mps_fmt_B->mps_class);
- MPS_ARGS_DONE(args);
res = FormatCreate(&format, arena, args);
} MPS_ARGS_END(args);
@@ -568,7 +566,6 @@ mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o,
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, mps_fmt->fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt->isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt->pad);
- MPS_ARGS_DONE(args);
res = FormatCreate(&format, arena, args);
} MPS_ARGS_END(args);
@@ -601,7 +598,6 @@ mps_res_t mps_fmt_create_fixed(mps_fmt_t *mps_fmt_o,
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, mps_fmt_fixed->fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt_fixed->isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt_fixed->pad);
- MPS_ARGS_DONE(args);
res = FormatCreate(&format, arena, args);
} MPS_ARGS_END(args);
diff --git a/mps/code/mv2test.c b/mps/code/mv2test.c
index 29e5606327a..10f7f3353c5 100644
--- a/mps/code/mv2test.c
+++ b/mps/code/mv2test.c
@@ -187,7 +187,6 @@ static void stress_with_arena_class(mps_arena_class_t aclass)
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, max);
MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, TEST_SET_SIZE/2);
MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, 0.3);
- MPS_ARGS_DONE(args);
die(stress(mps_class_mvt(), arena, randomSize, args), "stress MVT");
} MPS_ARGS_END(args);
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c
index b6ce34ff624..d7d8e0cbfd1 100644
--- a/mps/code/poolamc.c
+++ b/mps/code/poolamc.c
@@ -1191,7 +1191,6 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
alignedSize = SizeAlignUp(size, ArenaAlign(arena));
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD_FIELD(args, amcKeySegType, p, &gen->type); /* .segtype */
- MPS_ARGS_DONE(args);
res = ChainAlloc(&seg, amc->chain, PoolGenNr(pgen), amcSegClassGet(),
alignedSize, pool, withReservoirPermit, args);
} MPS_ARGS_END(args);
diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c
index 26979c6c2f2..83890b34b6e 100644
--- a/mps/code/poolawl.c
+++ b/mps/code/poolawl.c
@@ -467,7 +467,6 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn,
return ResMEMORY;
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD_FIELD(args, awlKeySegRankSet, u, rankSet);
- MPS_ARGS_DONE(args);
res = ChainAlloc(&seg, awl->chain, awl->pgen.nr, AWLSegClassGet(),
size, pool, reservoirPermit, args);
} MPS_ARGS_END(args);
diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c
index 8e8086ae16c..c945029a9db 100644
--- a/mps/code/poolmrg.c
+++ b/mps/code/poolmrg.c
@@ -526,7 +526,6 @@ static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg,
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD_FIELD(args, mrgKeyLinkSeg, p, linkseg); /* .ref.initarg */
- MPS_ARGS_DONE(args);
res = SegAlloc(&segRefPart, EnsureMRGRefSegClass(),
SegPrefDefault(), mrg->extendBy, pool,
withReservoirPermit, args);
diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c
index 14cf2c12ce2..9acd64380f6 100644
--- a/mps/code/poolmv.c
+++ b/mps/code/poolmv.c
@@ -243,7 +243,6 @@ static Res MVInit(Pool pool, ArgList args)
MPS_ARGS_BEGIN(piArgs) {
MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, blockExtendBy);
MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(MVBlockStruct));
- MPS_ARGS_DONE(piArgs);
res = PoolInit(&mv->blockPoolStruct.poolStruct, arena, PoolClassMFS(), piArgs);
} MPS_ARGS_END(piArgs);
if(res != ResOK)
@@ -254,7 +253,6 @@ static Res MVInit(Pool pool, ArgList args)
MPS_ARGS_BEGIN(piArgs) {
MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, spanExtendBy);
MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(MVSpanStruct));
- MPS_ARGS_DONE(piArgs);
res = PoolInit(&mv->spanPoolStruct.poolStruct, arena, PoolClassMFS(), piArgs);
} MPS_ARGS_END(piArgs);
if(res != ResOK)
diff --git a/mps/code/poolncv.c b/mps/code/poolncv.c
index 3df734a3df8..deee10715da 100644
--- a/mps/code/poolncv.c
+++ b/mps/code/poolncv.c
@@ -36,7 +36,6 @@ int main(int argc, char *argv[])
testlib_unused(argc);
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 600000);
- MPS_ARGS_DONE(args);
testit((ArenaClass)mps_arena_class_vm(), args);
} MPS_ARGS_END(args);
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c
index a1d53669494..2e071e6dc0f 100644
--- a/mps/code/segsmss.c
+++ b/mps/code/segsmss.c
@@ -767,7 +767,6 @@ static void *test(void *arg, size_t s)
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
- MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_amst(), args),
"pool_create(amst)");
} MPS_ARGS_END(args);
diff --git a/mps/example/scheme/scheme-advanced.c b/mps/example/scheme/scheme-advanced.c
index 837556b333b..22009cf2323 100644
--- a/mps/example/scheme/scheme-advanced.c
+++ b/mps/example/scheme/scheme-advanced.c
@@ -4458,7 +4458,6 @@ int main(int argc, char *argv[])
It holds all the MPS "global" state and is where everything happens. */
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_vm(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create arena");
@@ -4473,7 +4472,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad);
- MPS_ARGS_DONE(args);
res = mps_fmt_create_k(&obj_fmt, arena, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj format");
@@ -4490,7 +4488,6 @@ int main(int argc, char *argv[])
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj pool");
@@ -4507,7 +4504,6 @@ int main(int argc, char *argv[])
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&leaf_pool, arena, mps_class_amcz(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create leaf pool");
@@ -4521,7 +4517,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FMT_ALIGN, ALIGNMENT);
MPS_ARGS_ADD(args, MPS_KEY_FMT_SCAN, buckets_scan);
MPS_ARGS_ADD(args, MPS_KEY_FMT_SKIP, buckets_skip);
- MPS_ARGS_DONE(args);
res = mps_fmt_create_k(&buckets_fmt, arena, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create buckets format");
@@ -4531,7 +4526,6 @@ int main(int argc, char *argv[])
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, buckets_fmt);
MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, buckets_find_dependent);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&buckets_pool, arena, mps_class_awl(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create buckets pool");
@@ -4539,13 +4533,11 @@ int main(int argc, char *argv[])
/* Create allocation points for weak and strong buckets. */
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&strong_buckets_ap, buckets_pool, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create strong buckets allocation point");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_weak());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&weak_buckets_ap, buckets_pool, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create weak buckets allocation point");
diff --git a/mps/example/scheme/scheme.c b/mps/example/scheme/scheme.c
index 4b825581bc1..4b2b36797c5 100644
--- a/mps/example/scheme/scheme.c
+++ b/mps/example/scheme/scheme.c
@@ -4392,7 +4392,6 @@ int main(int argc, char *argv[])
It holds all the MPS "global" state and is where everything happens. */
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_vm(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create arena");
@@ -4407,7 +4406,6 @@ int main(int argc, char *argv[])
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad);
- MPS_ARGS_DONE(args);
res = mps_fmt_create_k(&obj_fmt, arena, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj format");
@@ -4424,7 +4422,6 @@ int main(int argc, char *argv[])
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj pool");
diff --git a/mps/manual/source/guide/advanced.rst b/mps/manual/source/guide/advanced.rst
index 13635cca796..69a9934823b 100644
--- a/mps/manual/source/guide/advanced.rst
+++ b/mps/manual/source/guide/advanced.rst
@@ -691,7 +691,6 @@ points::
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, buckets_fmt);
MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, buckets_find_dependent);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&buckets_pool, arena, mps_class_awl(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create buckets pool");
@@ -699,13 +698,11 @@ points::
/* Create allocation points for weak and strong buckets. */
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&strong_buckets_ap, buckets_pool, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create strong buckets allocation point");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_weak());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&weak_buckets_ap, buckets_pool, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create weak buckets allocation point");
@@ -880,7 +877,6 @@ Second, the leaf objects must be allocated on ``leaf_ap`` instead of
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&leaf_pool, arena, mps_class_amcz(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create leaf pool");
diff --git a/mps/manual/source/guide/lang.rst b/mps/manual/source/guide/lang.rst
index aa18ac80174..3b71f61ff20 100644
--- a/mps/manual/source/guide/lang.rst
+++ b/mps/manual/source/guide/lang.rst
@@ -177,7 +177,6 @@ Let's reserve 32 megabytes::
mps_res_t res;
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_vm(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create arena");
@@ -263,7 +262,6 @@ code for creating the object format for the toy Scheme interpreter::
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad);
- MPS_ARGS_DONE(args);
res = mps_fmt_create_k(&obj_fmt, arena, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj format");
@@ -694,7 +692,6 @@ Second, the :term:`object format`::
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad);
- MPS_ARGS_DONE(args);
res = mps_fmt_create_k(&obj_fmt, arena, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj format");
@@ -704,7 +701,6 @@ And finally the :term:`pool`::
mps_pool_t obj_pool;
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj pool");
diff --git a/mps/manual/source/pool/amc.rst b/mps/manual/source/pool/amc.rst
index beef282c141..37d03f263eb 100644
--- a/mps/manual/source/pool/amc.rst
+++ b/mps/manual/source/pool/amc.rst
@@ -123,7 +123,6 @@ AMC interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_amc(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/amcz.rst b/mps/manual/source/pool/amcz.rst
index 8f72af9050a..70d38ffa6ab 100644
--- a/mps/manual/source/pool/amcz.rst
+++ b/mps/manual/source/pool/amcz.rst
@@ -78,7 +78,6 @@ AMCZ interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_amcz(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/ams.rst b/mps/manual/source/pool/ams.rst
index 922d9d8e366..7bcc47c928a 100644
--- a/mps/manual/source/pool/ams.rst
+++ b/mps/manual/source/pool/ams.rst
@@ -138,7 +138,6 @@ AMS interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, 1);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_ams(), args);
} MPS_ARGS_END(args);
@@ -168,7 +167,6 @@ AMS interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_ambig());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&ap, ams_pool, args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/awl.rst b/mps/manual/source/pool/awl.rst
index b187965bb0c..4128339227a 100644
--- a/mps/manual/source/pool/awl.rst
+++ b/mps/manual/source/pool/awl.rst
@@ -346,7 +346,6 @@ AWL interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, find_dependent);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_awl(), args);
} MPS_ARGS_END(args);
@@ -375,7 +374,6 @@ AWL interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_weak());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&ap, awl_pool, args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/lo.rst b/mps/manual/source/pool/lo.rst
index 5814e36e0a7..e1723a42e0d 100644
--- a/mps/manual/source/pool/lo.rst
+++ b/mps/manual/source/pool/lo.rst
@@ -134,7 +134,6 @@ LO interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_lo(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/mfs.rst b/mps/manual/source/pool/mfs.rst
index d4b3155f650..cfaad56e6ab 100644
--- a/mps/manual/source/pool/mfs.rst
+++ b/mps/manual/source/pool/mfs.rst
@@ -101,7 +101,6 @@ MFS interface
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_MFS_UNIT_SIZE, 1024);
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, 1024 * 1024);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_mfs(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/mv.rst b/mps/manual/source/pool/mv.rst
index b49fc34e1f9..19d8363a253 100644
--- a/mps/manual/source/pool/mv.rst
+++ b/mps/manual/source/pool/mv.rst
@@ -96,7 +96,6 @@ MV interface
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, 32);
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, 1024);
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, 1024 * 1024);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_mfs(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/mvff.rst b/mps/manual/source/pool/mvff.rst
index 0b184615909..4379c912acf 100644
--- a/mps/manual/source/pool/mvff.rst
+++ b/mps/manual/source/pool/mvff.rst
@@ -170,7 +170,6 @@ MVFF interface
MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, 1);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, 1);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, 0);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_mvff(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/mvt.rst b/mps/manual/source/pool/mvt.rst
index 79501c81465..f3bbba705a0 100644
--- a/mps/manual/source/pool/mvt.rst
+++ b/mps/manual/source/pool/mvt.rst
@@ -191,7 +191,6 @@ MVT interface
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, 1024);
MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, 256);
MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, 0.5);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_mvt(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/pool/snc.rst b/mps/manual/source/pool/snc.rst
index 25cdae8b739..2146a417552 100644
--- a/mps/manual/source/pool/snc.rst
+++ b/mps/manual/source/pool/snc.rst
@@ -108,7 +108,6 @@ SNC introspection
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_snc(), args);
} MPS_ARGS_END(args);
@@ -132,7 +131,6 @@ SNC introspection
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact());
- MPS_ARGS_DONE(args);
res = mps_ap_create_k(&ap, awl_pool, args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/topic/arena.rst b/mps/manual/source/topic/arena.rst
index a8de113f6ed..5220ece4007 100644
--- a/mps/manual/source/topic/arena.rst
+++ b/mps/manual/source/topic/arena.rst
@@ -170,7 +170,6 @@ Client arenas
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, base);
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_cl(), args);
} MPS_ARGS_END(args);
@@ -281,7 +280,6 @@ Virtual memory arenas
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_cl(), args);
} MPS_ARGS_END(args);
diff --git a/mps/manual/source/topic/debugging.rst b/mps/manual/source/topic/debugging.rst
index 980e982da60..70494aa20cf 100644
--- a/mps/manual/source/topic/debugging.rst
+++ b/mps/manual/source/topic/debugging.rst
@@ -74,7 +74,6 @@ For example::
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &debug_options);
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, &fmt);
- MPS_ARGS_DONE(args);
res = mps_pool_create_k(&pool, arena, mps_class_ams_debug(), args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("can't create debug pool");
diff --git a/mps/manual/source/topic/format.rst b/mps/manual/source/topic/format.rst
index 7c24f70d011..91ac7ae6462 100644
--- a/mps/manual/source/topic/format.rst
+++ b/mps/manual/source/topic/format.rst
@@ -118,7 +118,6 @@ Interface
MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd);
MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad);
- MPS_ARGS_DONE(args);
res = mps_fmt_create_k(&obj_fmt, arena, args);
} MPS_ARGS_END(args);
if (res != MPS_RES_OK) error("Couldn't create obj format");
diff --git a/mps/manual/source/topic/keyword.rst b/mps/manual/source/topic/keyword.rst
index dac5cce2626..5f804a63847 100644
--- a/mps/manual/source/topic/keyword.rst
+++ b/mps/manual/source/topic/keyword.rst
@@ -32,7 +32,6 @@ help with forming keyword argument lists::
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 6553600);
MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, base_address);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_cl(), args);
} MPS_ARGS_END(args);
@@ -128,14 +127,12 @@ now :c:macro:`MPS_KEY_ARGS_END`.
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 6553600);
MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, base_address);
- MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_cl(), args);
} MPS_ARGS_END(args);
That is, you must call :c:func:`MPS_ARGS_ADD` (or
- :c:func:`MPS_ARGS_ADD_FIELD`) zero or more times, and then call
- :c:func:`MPS_ARGS_DONE` before passing the arguments to a
- function.
+ :c:func:`MPS_ARGS_ADD_FIELD`) zero or more times, and then pass
+ the arguments to a function.
``args`` is the name of the array that contains the keyword
arguments. The array is stack-allocated, and exists between
@@ -185,19 +182,6 @@ now :c:macro:`MPS_KEY_ARGS_END`.
you don't need to look up the name of the field.
-.. c:function:: MPS_ARGS_DONE(args)
-
- Finalize a list of keyword arguments. This macro must be used only
- between :c:macro:`MPS_ARGS_BEGIN` and :c:macro:`MPS_ARGS_END`.
-
- ``args`` is the name of array that contains the keyword arguments.
- It must match the argument to the preceding call to
- :c:func:`MPS_ARGS_BEGIN`.
-
- After calling this macro, the array ``args`` is ready to pass to a
- function.
-
-
.. c:function:: MPS_ARGS_END(args)
Finish using a list of keyword arguments whose construction was
@@ -206,3 +190,11 @@ now :c:macro:`MPS_KEY_ARGS_END`.
``args`` is the name of array that contains the keyword arguments.
It must match the argument to the preceding call to
:c:func:`MPS_ARGS_BEGIN`.
+
+
+.. c:function:: MPS_ARGS_DONE(args)
+
+ .. deprecated:: starting with version 1.113.
+
+ Formerly this was used to finalize a list of keyword arguments
+ before passing it to a function. It is no longer needed.
From 00898bf2e9716e7e6cb27d0e0fca46845f8f5d0d Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 26 Feb 2014 12:51:30 +0000
Subject: [PATCH 22/29] Fix the aver: need two slots in the array, not just
one.
Copied from Perforce
Change: 184545
ServerID: perforce.ravenbrook.com
---
mps/code/mps.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mps/code/mps.h b/mps/code/mps.h
index 156e0fae7b7..a767da3b29d 100644
--- a/mps/code/mps.h
+++ b/mps/code/mps.h
@@ -229,7 +229,7 @@ extern const struct mps_key_s _mps_key_fmt_class;
#define MPS_ARGS_ADD_FIELD(_var, _key, _field, _val) \
MPS_BEGIN \
- /* TODO: AVER(_var##_i < MPS_ARGS_MAX); */ \
+ /* TODO: AVER(_var##_i + 1 < MPS_ARGS_MAX); */ \
_var[_var##_i].key = (_key); \
_var[_var##_i].val._field = (_val); \
++_var##_i; \
From 15134f454243e80be815e9e61545cccdbb74ea26 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 7 Mar 2014 17:23:15 +0000
Subject: [PATCH 23/29] Emphasize the need to check that the test suite passes
on all supported platforms.
Copied from Perforce
Change: 184674
ServerID: perforce.ravenbrook.com
---
mps/procedure/branch-merge.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mps/procedure/branch-merge.rst b/mps/procedure/branch-merge.rst
index 232a5a925b4..9730a7d5726 100644
--- a/mps/procedure/branch-merge.rst
+++ b/mps/procedure/branch-merge.rst
@@ -70,7 +70,7 @@ This document contains procedures and checklists for branching and merging durin
#. Is there an automated test case?
-#. Does the test suite pass?
+#. Does the test suite pass on all supported platforms?
#. If there are interface changes, is there documentation?
@@ -103,8 +103,8 @@ This document contains procedures and checklists for branching and merging durin
p4 submit -d "Catch-up merge from the master sources to $BRANCH"
-#. Update the branch on other platforms and check that the test suite
- passes.
+#. Update the branch on all supported platforms and check that the
+ test suite passes.
#. Backward merge into the master sources (or the appropriate
customer-specific mainline)::
From f40425bef2f9694c8f064c6ebdc1562710b35ee3 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 7 Mar 2014 17:24:46 +0000
Subject: [PATCH 24/29] Ensure that the mps builds on windows by adding to
mpmcommon.
Copied from Perforce
Change: 184675
ServerID: perforce.ravenbrook.com
---
mps/code/commpre.nmk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mps/code/commpre.nmk b/mps/code/commpre.nmk
index a78eee3ef22..de9052303a1 100644
--- a/mps/code/commpre.nmk
+++ b/mps/code/commpre.nmk
@@ -95,7 +95,7 @@ MPMCOMMON = \
\
\
[ \
- ] \
+ \
PLINTH =
AMC =
From 690ddfdde45eb1d429d3096cf20c4953f12b561d Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 7 Mar 2014 19:02:05 +0000
Subject: [PATCH 25/29] Delete .gdbinit: it hasn't been necessary to "handle
sigbus nostop" on os x since the we started using mach exceptions (change
183002).
Copied from Perforce
Change: 184678
ServerID: perforce.ravenbrook.com
---
mps/code/.gdbinit | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 mps/code/.gdbinit
diff --git a/mps/code/.gdbinit b/mps/code/.gdbinit
deleted file mode 100644
index cbdac5f7cce..00000000000
--- a/mps/code/.gdbinit
+++ /dev/null
@@ -1 +0,0 @@
-handle SIGBUS nostop
From 8e92959b44c8fca05c2f7094ef69a79b628c368a Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 7 Mar 2014 23:41:17 +0000
Subject: [PATCH 26/29] Oops: mistaken submit.
Copied from Perforce
Change: 184686
ServerID: perforce.ravenbrook.com
From d2b6956f6a986b9ebebe77e45f72639ae6420f92 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Sat, 8 Mar 2014 00:24:04 +0000
Subject: [PATCH 27/29] Add locbwcss and locusss to the test suite on os x,
freebsd and linux.
Add const qualifier so that locbwcss and locusss compile without warnings.
Build djbench and gcbench on FreeBSD and Linux.
Don't include -- alloca is in stdlib.h.
Copied from Perforce
Change: 184689
ServerID: perforce.ravenbrook.com
---
mps/code/comm.gmk | 26 ++-
mps/code/djbench.c | 3 +-
mps/code/locbwcss.c | 6 +-
mps/code/locusss.c | 6 +-
mps/code/mps.xcodeproj/project.pbxproj | 230 ++++++++++++++++++++++++-
5 files changed, 256 insertions(+), 15 deletions(-)
diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk
index 1fca1af7b0f..e8590cb1f38 100644
--- a/mps/code/comm.gmk
+++ b/mps/code/comm.gmk
@@ -3,7 +3,7 @@
# comm.gmk: COMMON GNUMAKEFILE FRAGMENT
#
# $Id$
-# Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
+# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
#
# DESCRIPTION
#
@@ -225,17 +225,19 @@ LIB_TARGETS=mps.a mpsplan.a
# build) as an automated test case, add it to AUTO_TEST_TARGETS.
AUTO_TEST_TARGETS=abqtest amcss amcsshe amcssth amsss amssshe apss \
- arenacv awlut awluthe awlutth btcv exposet0 expt825 fbmtest finalcv \
- finaltest fotest lockcov locv messtest mpmss mpsicv mv2test \
- poolncv qs sacss segsmss steptest walkt0 zmess
+ arenacv awlut awluthe awlutth btcv exposet0 expt825 fbmtest \
+ finalcv finaltest fotest locbwcss lockcov locusss locv messtest \
+ mpmss mpsicv mv2test poolncv qs sacss segsmss steptest walkt0 \
+ zmess
# If it is not runnable as an automated test case, but is buildable,
# add it to OTHER_TEST_TARGETS with a note.
#
# bttest and teletest -- interactive and so cannot be run unattended.
+# djbench and gcbench -- benchmarks, not test cases.
# zcoll -- takes too long to be useful as a regularly run smoke test.
-OTHER_TEST_TARGETS=bttest teletest zcoll
+OTHER_TEST_TARGETS=bttest teletest djbench gcbench zcoll
# This target records programs that we were once able to build but
# can't at the moment:
@@ -377,6 +379,9 @@ $(PFM)/$(VARIETY)/btcv: $(PFM)/$(VARIETY)/btcv.o \
$(PFM)/$(VARIETY)/bttest: $(PFM)/$(VARIETY)/bttest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+$(PFM)/$(VARIETY)/djbench: $(PFM)/$(VARIETY)/djbench.o \
+ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+
$(PFM)/$(VARIETY)/exposet0: $(PFM)/$(VARIETY)/exposet0.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
@@ -395,9 +400,18 @@ $(PFM)/$(VARIETY)/finaltest: $(PFM)/$(VARIETY)/finaltest.o \
$(PFM)/$(VARIETY)/fotest: $(PFM)/$(VARIETY)/fotest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+$(PFM)/$(VARIETY)/gcbench: $(PFM)/$(VARIETY)/gcbench.o \
+ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+
+$(PFM)/$(VARIETY)/locbwcss: $(PFM)/$(VARIETY)/locbwcss.o \
+ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+
$(PFM)/$(VARIETY)/lockcov: $(PFM)/$(VARIETY)/lockcov.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+$(PFM)/$(VARIETY)/locusss: $(PFM)/$(VARIETY)/locusss.o \
+ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+
$(PFM)/$(VARIETY)/locv: $(PFM)/$(VARIETY)/locv.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
@@ -567,7 +581,7 @@ find-puns: phony
# C. COPYRIGHT AND LICENSE
#
-# Copyright (c) 2001-2013 Ravenbrook Limited .
+# Copyright (c) 2001-2014 Ravenbrook Limited .
# All rights reserved. This is an open source license. Contact
# Ravenbrook for commercial licensing options.
#
diff --git a/mps/code/djbench.c b/mps/code/djbench.c
index 09eaa6d513c..d81832500ff 100644
--- a/mps/code/djbench.c
+++ b/mps/code/djbench.c
@@ -16,7 +16,6 @@
#include
#include
#include
-#include
#include
#include "getopt.h"
#include "testlib.h"
@@ -334,7 +333,7 @@ int main(int argc, char *argv[]) {
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (c) 2001-2013 Ravenbrook Limited .
+ * Copyright (c) 2001-2014 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/locbwcss.c b/mps/code/locbwcss.c
index 5f9d6095623..33639aab907 100644
--- a/mps/code/locbwcss.c
+++ b/mps/code/locbwcss.c
@@ -1,7 +1,7 @@
/* locbwcss.c: LOCUS BACKWARDS COMPATIBILITY STRESS TEST
*
* $Id$
- * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*/
#include "mpscmvff.h"
@@ -129,7 +129,7 @@ static void allocMultiple(PoolStat stat)
/* reportResults - print a report on a PoolStat */
-static void reportResults(PoolStat stat, char *name)
+static void reportResults(PoolStat stat, const char *name)
{
printf("\nResults for ");
fputs(name, stdout);
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (c) 2001-2013 Ravenbrook Limited .
+ * Copyright (c) 2001-2014 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/locusss.c b/mps/code/locusss.c
index c9a86fa37dc..aab01d6f56c 100644
--- a/mps/code/locusss.c
+++ b/mps/code/locusss.c
@@ -1,7 +1,7 @@
/* locusss.c: LOCUS STRESS TEST
*
* $Id$
- * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*/
#include "mpscmvff.h"
@@ -133,7 +133,7 @@ static mps_res_t allocMultiple(PoolStat stat)
/* reportResults - print a report on a PoolStat */
-static void reportResults(PoolStat stat, char *name)
+static void reportResults(PoolStat stat, const char *name)
{
printf("\nResults for ");
printf("%s", name);
@@ -251,7 +251,7 @@ int main(int argc, char *argv[])
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (c) 2001-2013 Ravenbrook Limited .
+ * Copyright (c) 2001-2014 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj
index 9524465561a..0f5a83f6f99 100644
--- a/mps/code/mps.xcodeproj/project.pbxproj
+++ b/mps/code/mps.xcodeproj/project.pbxproj
@@ -47,7 +47,9 @@
3114A5EA156E93C4001E0AA3 /* PBXTargetDependency */,
224CC79D175E187C002FF81B /* PBXTargetDependency */,
22B2BC3F18B643B700C33E63 /* PBXTargetDependency */,
+ 2231BB6D18CA986B002D6322 /* PBXTargetDependency */,
31D60034156D3D5A00337B26 /* PBXTargetDependency */,
+ 2231BB6F18CA986D002D6322 /* PBXTargetDependency */,
3114A5A0156E915A001E0AA3 /* PBXTargetDependency */,
3114A6A7156E9739001E0AA3 /* PBXTargetDependency */,
3104AFFE156D37C6000A585A /* PBXTargetDependency */,
@@ -74,6 +76,12 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 2231BB5118CA97D8002D6322 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
+ 2231BB5318CA97D8002D6322 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
+ 2231BB5F18CA97DC002D6322 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
+ 2231BB6118CA97DC002D6322 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
+ 2231BB6A18CA984F002D6322 /* locusss.c in Sources */ = {isa = PBXBuildFile; fileRef = 2231BB6918CA983C002D6322 /* locusss.c */; };
+ 2231BB6B18CA9861002D6322 /* locbwcss.c in Sources */ = {isa = PBXBuildFile; fileRef = 2231BB6818CA9834002D6322 /* locbwcss.c */; };
224CC791175E1821002FF81B /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
224CC793175E1821002FF81B /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
224CC79F175E321C002FF81B /* mv2test.c in Sources */ = {isa = PBXBuildFile; fileRef = 3114A686156E9674001E0AA3 /* mv2test.c */; };
@@ -261,6 +269,34 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 2231BB4E18CA97D8002D6322 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 31EEABFA156AAF9D00714D05;
+ remoteInfo = mps;
+ };
+ 2231BB5C18CA97DC002D6322 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 31EEABFA156AAF9D00714D05;
+ remoteInfo = mps;
+ };
+ 2231BB6C18CA986B002D6322 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 2231BB4C18CA97D8002D6322;
+ remoteInfo = locbwcss;
+ };
+ 2231BB6E18CA986D002D6322 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 2231BB5A18CA97DC002D6322;
+ remoteInfo = locusss;
+ };
224CC78E175E1821002FF81B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
@@ -810,6 +846,24 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
+ 2231BB5418CA97D8002D6322 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 2231BB6218CA97DC002D6322 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
224CC794175E1821002FF81B /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -1182,6 +1236,10 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 2231BB5918CA97D8002D6322 /* locbwcss */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = locbwcss; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2231BB6718CA97DC002D6322 /* locusss */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = locusss; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2231BB6818CA9834002D6322 /* locbwcss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locbwcss.c; sourceTree = ""; };
+ 2231BB6918CA983C002D6322 /* locusss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locusss.c; sourceTree = ""; };
224CC799175E1821002FF81B /* fotest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fotest; sourceTree = BUILT_PRODUCTS_DIR; };
224CC79E175E3202002FF81B /* fotest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fotest.c; sourceTree = ""; };
2291A5A8175CAA51001D4920 /* poolmv2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmv2.h; sourceTree = ""; };
@@ -1467,6 +1525,22 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 2231BB5218CA97D8002D6322 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2231BB5318CA97D8002D6322 /* libmps.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2231BB6018CA97DC002D6322 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2231BB6118CA97DC002D6322 /* libmps.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
224CC792175E1821002FF81B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -1936,7 +2010,9 @@
3124CAE4156BE6D500753214 /* fmthe.c */,
3124CACC156BE4C200753214 /* fmtno.c */,
224CC79E175E3202002FF81B /* fotest.c */,
+ 2231BB6818CA9834002D6322 /* locbwcss.c */,
31D60036156D3E0200337B26 /* lockcov.c */,
+ 2231BB6918CA983C002D6322 /* locusss.c */,
3114A5A1156E9168001E0AA3 /* locv.c */,
3114A69F156E9725001E0AA3 /* messtest.c */,
31EEAC74156AB58E00714D05 /* mpmss.c */,
@@ -2039,6 +2115,8 @@
318DA8CD1892B0F30089718C /* djbench */,
6313D47218A400B200EB03EF /* gcbench */,
22B2BC3618B6434F00C33E63 /* scheme-advanced */,
+ 2231BB5918CA97D8002D6322 /* locbwcss */,
+ 2231BB6718CA97DC002D6322 /* locusss */,
);
name = Products;
sourceTree = "";
@@ -2214,6 +2292,42 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 2231BB4C18CA97D8002D6322 /* locbwcss */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2231BB5518CA97D8002D6322 /* Build configuration list for PBXNativeTarget "locbwcss" */;
+ buildPhases = (
+ 2231BB4F18CA97D8002D6322 /* Sources */,
+ 2231BB5218CA97D8002D6322 /* Frameworks */,
+ 2231BB5418CA97D8002D6322 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 2231BB4D18CA97D8002D6322 /* PBXTargetDependency */,
+ );
+ name = locbwcss;
+ productName = lockcov;
+ productReference = 2231BB5918CA97D8002D6322 /* locbwcss */;
+ productType = "com.apple.product-type.tool";
+ };
+ 2231BB5A18CA97DC002D6322 /* locusss */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2231BB6318CA97DC002D6322 /* Build configuration list for PBXNativeTarget "locusss" */;
+ buildPhases = (
+ 2231BB5D18CA97DC002D6322 /* Sources */,
+ 2231BB6018CA97DC002D6322 /* Frameworks */,
+ 2231BB6218CA97DC002D6322 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 2231BB5B18CA97DC002D6322 /* PBXTargetDependency */,
+ );
+ name = locusss;
+ productName = lockcov;
+ productReference = 2231BB6718CA97DC002D6322 /* locusss */;
+ productType = "com.apple.product-type.tool";
+ };
224CC78C175E1821002FF81B /* fotest */ = {
isa = PBXNativeTarget;
buildConfigurationList = 224CC795175E1821002FF81B /* Build configuration list for PBXNativeTarget "fotest" */;
@@ -3007,7 +3121,9 @@
3114A5D5156E93A0001E0AA3 /* finaltest */,
224CC78C175E1821002FF81B /* fotest */,
6313D46718A400B200EB03EF /* gcbench */,
+ 2231BB4C18CA97D8002D6322 /* locbwcss */,
31D60026156D3D3E00337B26 /* lockcov */,
+ 2231BB5A18CA97DC002D6322 /* locusss */,
3114A58F156E913C001E0AA3 /* locv */,
3114A694156E971B001E0AA3 /* messtest */,
31EEAC64156AB52600714D05 /* mpmss */,
@@ -3043,12 +3159,30 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "# Not listed here:\n# awlutth -- fails (job003506).\n# bttest and teletest -- interactive and so cannot be run unattended.\n# zcoll -- takes too long to be useful as a regularly run smoke test.\nTESTCASES=\"abqtest amcss amcsshe amcssth amsss amssshe apss arenacv \\\n awlut awlutth awluthe btcv expt825 exposet0 fbmtest finalcv \\\n finaltest fotest lockcov locv messtest mpmss mpsicv mv2test \\\n poolncv qs sacss segsmss steptest walkt0 zmess\"\n\n../tool/testrun.sh $(for TEST in $TESTCASES; do echo $TARGET_BUILD_DIR/$TEST; done)\n\n# Coverage\nif [ \"$CONFIGURATION\" == \"Debug\" ]; then\n (cd xc/$PROJECT.build/$CONFIGURATION/$PROJECT.build/Objects-normal/x86_64 &&\n gcov mps.c 2> /dev/null) | ../tool/gcovfmt.py\nfi";
+ shellScript = "# Not listed here:\n# bttest and teletest -- interactive and so cannot be run unattended.\n# djbench and gcbench -- benchmarks, not test cases.\n# zcoll -- takes too long to be useful as a regularly run smoke test.\nTESTCASES=\"abqtest amcss amcsshe amcssth amsss amssshe apss arenacv \\\n awlut awlutth awluthe btcv expt825 exposet0 fbmtest finalcv \\\n finaltest fotest locbwcss lockcov locusss locv messtest mpmss \\\n mpsicv mv2test poolncv qs sacss segsmss steptest walkt0 zmess\"\n\n../tool/testrun.sh $(for TEST in $TESTCASES; do echo $TARGET_BUILD_DIR/$TEST; done)\n\n# Coverage\nif [ \"$CONFIGURATION\" == \"Debug\" ]; then\n (cd xc/$PROJECT.build/$CONFIGURATION/$PROJECT.build/Objects-normal/x86_64 &&\n gcov mps.c 2> /dev/null) | ../tool/gcovfmt.py\nfi";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
+ 2231BB4F18CA97D8002D6322 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2231BB6B18CA9861002D6322 /* locbwcss.c in Sources */,
+ 2231BB5118CA97D8002D6322 /* testlib.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2231BB5D18CA97DC002D6322 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2231BB6A18CA984F002D6322 /* locusss.c in Sources */,
+ 2231BB5F18CA97DC002D6322 /* testlib.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
224CC78F175E1821002FF81B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -3493,6 +3627,26 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 2231BB4D18CA97D8002D6322 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 31EEABFA156AAF9D00714D05 /* mps */;
+ targetProxy = 2231BB4E18CA97D8002D6322 /* PBXContainerItemProxy */;
+ };
+ 2231BB5B18CA97DC002D6322 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 31EEABFA156AAF9D00714D05 /* mps */;
+ targetProxy = 2231BB5C18CA97DC002D6322 /* PBXContainerItemProxy */;
+ };
+ 2231BB6D18CA986B002D6322 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 2231BB4C18CA97D8002D6322 /* locbwcss */;
+ targetProxy = 2231BB6C18CA986B002D6322 /* PBXContainerItemProxy */;
+ };
+ 2231BB6F18CA986D002D6322 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 2231BB5A18CA97DC002D6322 /* locusss */;
+ targetProxy = 2231BB6E18CA986D002D6322 /* PBXContainerItemProxy */;
+ };
224CC78D175E1821002FF81B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 31EEABFA156AAF9D00714D05 /* mps */;
@@ -3886,6 +4040,60 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
+ 2231BB5618CA97D8002D6322 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = YES;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
+ PRODUCT_NAME = locbwcss;
+ };
+ name = Debug;
+ };
+ 2231BB5718CA97D8002D6322 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = NO;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
+ PRODUCT_NAME = locbwcss;
+ };
+ name = Release;
+ };
+ 2231BB5818CA97D8002D6322 /* RASH */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = NO;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
+ PRODUCT_NAME = locbwcss;
+ };
+ name = RASH;
+ };
+ 2231BB6418CA97DC002D6322 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = YES;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
+ PRODUCT_NAME = locusss;
+ };
+ name = Debug;
+ };
+ 2231BB6518CA97DC002D6322 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = NO;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
+ PRODUCT_NAME = locusss;
+ };
+ name = Release;
+ };
+ 2231BB6618CA97DC002D6322 /* RASH */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_TEST_COVERAGE_FILES = NO;
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
+ PRODUCT_NAME = locusss;
+ };
+ name = RASH;
+ };
224CC796175E1821002FF81B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -5227,6 +5435,26 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 2231BB5518CA97D8002D6322 /* Build configuration list for PBXNativeTarget "locbwcss" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2231BB5618CA97D8002D6322 /* Debug */,
+ 2231BB5718CA97D8002D6322 /* Release */,
+ 2231BB5818CA97D8002D6322 /* RASH */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 2231BB6318CA97DC002D6322 /* Build configuration list for PBXNativeTarget "locusss" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2231BB6418CA97DC002D6322 /* Debug */,
+ 2231BB6518CA97DC002D6322 /* Release */,
+ 2231BB6618CA97DC002D6322 /* RASH */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
224CC795175E1821002FF81B /* Build configuration list for PBXNativeTarget "fotest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
From cf4d9b0596dec46b2fda6860e06baf9406076899 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Sat, 8 Mar 2014 00:36:32 +0000
Subject: [PATCH 28/29] Ensure that djbench and gcbench compile on freebsd:
Link fmtdy with gcbench.
RESERVE_ALLOC in djbench ignores the return values from mps_reserve and mps_commit.
Don't include alloca.h -- alloca is in stdlib.h.
Rename start, finish to begin, end to avoid "local variable shadows global" error from gcc.
Copied from Perforce
Change: 184691
ServerID: perforce.ravenbrook.com
---
mps/code/comm.gmk | 2 +-
mps/code/djbench.c | 4 ++--
mps/code/gcbench.c | 9 ++++-----
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk
index e8590cb1f38..abc9c5a3025 100644
--- a/mps/code/comm.gmk
+++ b/mps/code/comm.gmk
@@ -401,7 +401,7 @@ $(PFM)/$(VARIETY)/fotest: $(PFM)/$(VARIETY)/fotest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
$(PFM)/$(VARIETY)/gcbench: $(PFM)/$(VARIETY)/gcbench.o \
- $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
+ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
$(PFM)/$(VARIETY)/locbwcss: $(PFM)/$(VARIETY)/locbwcss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
diff --git a/mps/code/djbench.c b/mps/code/djbench.c
index d81832500ff..a4fb093a7f6 100644
--- a/mps/code/djbench.c
+++ b/mps/code/djbench.c
@@ -123,8 +123,8 @@ DJRUN(dj_alloc, MPS_ALLOC, MPS_FREE)
#define RESERVE_ALLOC(p, s) \
do { \
size_t _s = ALIGN_UP(s, (size_t)MPS_PF_ALIGN); \
- mps_reserve(&p, ap, _s); \
- mps_commit(ap, p, _s); \
+ (void)mps_reserve(&p, ap, _s); \
+ (void)mps_commit(ap, p, _s); \
} while(0)
#define RESERVE_FREE(p, s) do { mps_free(pool, p, s); } while(0)
diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c
index 7e0ccbfb323..5c01ba5d986 100644
--- a/mps/code/gcbench.c
+++ b/mps/code/gcbench.c
@@ -12,7 +12,6 @@
#include
#include
#include
-#include
#include
#include "getopt.h"
#include "testlib.h"
@@ -219,16 +218,16 @@ static void weave1(gcthread_fn_t fn)
static void watch(gcthread_fn_t fn, const char *name)
{
- clock_t start, finish;
+ clock_t begin, end;
- start = clock();
+ begin = clock();
if (nthreads == 1)
weave1(fn);
else
weave(fn);
- finish = clock();
+ end = clock();
- printf("%s: %g\n", name, (double)(finish - start) / CLOCKS_PER_SEC);
+ printf("%s: %g\n", name, (double)(end - begin) / CLOCKS_PER_SEC);
}
From 784bc484ca8d309d8b8e464f255d2b6bd7dea804 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Sat, 8 Mar 2014 10:23:09 +0000
Subject: [PATCH 29/29] Poolfix is on the critical path, so use aver_critical
rather than aver.
Copied from Perforce
Change: 184693
ServerID: perforce.ravenbrook.com
---
mps/code/pool.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/mps/code/pool.c b/mps/code/pool.c
index df6b0fa9032..0524d69525c 100644
--- a/mps/code/pool.c
+++ b/mps/code/pool.c
@@ -1,7 +1,7 @@
/* pool.c: POOL IMPLEMENTATION
*
* $Id$
- * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2001 Global Graphics Software.
*
* DESIGN
@@ -409,14 +409,14 @@ Res PoolScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
Res (PoolFix)(Pool pool, ScanState ss, Seg seg, Addr *refIO)
{
- AVERT(Pool, pool);
- AVERT(ScanState, ss);
- AVERT(Seg, seg);
- AVER(pool == SegPool(seg));
- AVER(refIO != NULL);
+ AVERT_CRITICAL(Pool, pool);
+ AVERT_CRITICAL(ScanState, ss);
+ AVERT_CRITICAL(Seg, seg);
+ AVER_CRITICAL(pool == SegPool(seg));
+ AVER_CRITICAL(refIO != NULL);
/* Should only be fixing references to white segments. */
- AVER(TraceSetInter(SegWhite(seg), ss->traces) != TraceSetEMPTY);
+ AVER_CRITICAL(TraceSetInter(SegWhite(seg), ss->traces) != TraceSetEMPTY);
return PoolFix(pool, ss, seg, refIO);
}
@@ -425,17 +425,17 @@ Res PoolFixEmergency(Pool pool, ScanState ss, Seg seg, Addr *refIO)
{
Res res;
- AVERT(Pool, pool);
- AVERT(ScanState, ss);
- AVERT(Seg, seg);
- AVER(pool == SegPool(seg));
- AVER(refIO != NULL);
+ AVERT_CRITICAL(Pool, pool);
+ AVERT_CRITICAL(ScanState, ss);
+ AVERT_CRITICAL(Seg, seg);
+ AVER_CRITICAL(pool == SegPool(seg));
+ AVER_CRITICAL(refIO != NULL);
/* Should only be fixing references to white segments. */
- AVER(TraceSetInter(SegWhite(seg), ss->traces) != TraceSetEMPTY);
+ AVER_CRITICAL(TraceSetInter(SegWhite(seg), ss->traces) != TraceSetEMPTY);
res = (pool->class->fixEmergency)(pool, ss, seg, refIO);
- AVER(res == ResOK);
+ AVER_CRITICAL(res == ResOK);
return res;
}
@@ -684,7 +684,7 @@ Bool PoolHasRange(Pool pool, Addr base, Addr limit)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2013 Ravenbrook Limited .
+ * Copyright (C) 2001-2014 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*