From f31fc5325ac40853449d6d2dc138348dbc87c77c Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Mon, 24 Feb 2014 23:04:31 +0000 Subject: [PATCH 01/93] Instead of aggressively returning every page it can, mvff takes a parameter for the proportion of spare space to hold in its free lists before attempting to return space to the arena. Copied from Perforce Change: 184498 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 1 + mps/code/mps.h | 3 ++ mps/code/pool.c | 1 + mps/code/poolmvff.c | 126 +++++++++++++++++++++++++++++--------------- 4 files changed, 88 insertions(+), 43 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index 4ad6ea51f15..da4bf132400 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -277,6 +277,7 @@ #define MVFF_SLOT_HIGH_DEFAULT FALSE #define MVFF_ARENA_HIGH_DEFAULT FALSE #define MVFF_FIRST_FIT_DEFAULT TRUE +#define MVFF_SPARE_DEFAULT 0.75 /* Pool MVT Configuration -- see */ diff --git a/mps/code/mps.h b/mps/code/mps.h index f8751d01372..7e3e734d336 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -184,6 +184,9 @@ extern const struct mps_key_s _mps_key_max_size; extern const struct mps_key_s _mps_key_align; #define MPS_KEY_ALIGN (&_mps_key_align) #define MPS_KEY_ALIGN_FIELD align +extern const struct mps_key_s _mps_key_spare; +#define MPS_KEY_SPARE (&_mps_key_spare) +#define MPS_KEY_SPARE_FIELD double extern const struct mps_key_s _mps_key_cbs_extend_by; #define MPS_KEY_CBS_EXTEND_BY (&_mps_key_cbs_extend_by) #define MPS_KEY_CBS_EXTEND_BY_FIELD size diff --git a/mps/code/pool.c b/mps/code/pool.c index df6b0fa9032..eaf751b25d8 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -118,6 +118,7 @@ ARG_DEFINE_KEY(min_size, Size); ARG_DEFINE_KEY(mean_size, Size); ARG_DEFINE_KEY(max_size, Size); ARG_DEFINE_KEY(align, Align); +ARG_DEFINE_KEY(spare, double); /* PoolInit -- initialize a pool diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index d26011856b7..07adb19ad4d 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 */ + double spare; /* spare space fraction, see MVFFReduce */ MFSStruct cbsBlockPoolStruct; /* stores blocks for CBSs */ CBSStruct totalCBSStruct; /* all memory allocated from the arena */ CBSStruct freeCBSStruct; /* free list */ @@ -156,55 +157,85 @@ static void MVFFDeleteFromFree(MVFF mvff, Range range) /* 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. + * Consider reducing the total size of the pool by returning memory + * to the arena. * * 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 MVFFReduce(MVFF mvff, Range range) +static void MVFFReduce(MVFF mvff) { Arena arena; - RangeStruct alignedRange, oldRange; - Addr base, limit; - Size size; - Res res; - - AVERT(MVFF, mvff); - AVER(RangeBase(range) < RangeLimit(range)); - /* Could profitably AVER that the given range is free, */ - /* but the CBS doesn't provide that facility. */ - - size = RangeSize(range); - - arena = PoolArena(MVFF2Pool(mvff)); - base = AddrAlignUp(RangeBase(range), ArenaAlign(arena)); - limit = AddrAlignDown(RangeLimit(range), ArenaAlign(arena)); - if (base >= limit) { /* no whole tracts */ - 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. */ + RangeStruct freeRange; + Size freeLimit, targetFree; + Align align; - MVFFDeleteFromFree(mvff, &alignedRange); + AVERT(MVFF, mvff); + arena = PoolArena(MVFF2Pool(mvff)); + align = ArenaAlign(arena); - res = CBSDelete(&oldRange, MVFFTotalCBS(mvff), &alignedRange); - if (res != ResOK) { - RangeStruct coalesced; - MVFFAddToFree(&coalesced, mvff, &alignedRange); + /* Try to return memory when the amount of free memory exceeds a + threshold fraction of the total memory. */ + + /* NOTE: If this code becomes very hot, then the test of whether there's + a large free block in the CBS could be inlined, since it's a property + stored at the root node. */ + + freeLimit = (Size)(mvff->total * mvff->spare); + if (mvff->free < freeLimit) return; - } - mvff->total -= RangeSize(&alignedRange); - ArenaFree(base, AddrOffset(base, limit), MVFF2Pool(mvff)); + targetFree = freeLimit / 2; + while (mvff->free > targetFree && + CBSFindLargest(&freeRange, &freeRange, MVFFFreeCBS(mvff), + 0, FindDeleteNONE)) { + RangeStruct pageRange, oldRange; + Size size; + Res res; + Addr base, limit; + + base = AddrAlignUp(RangeBase(&freeRange), align); + limit = AddrAlignDown(RangeLimit(&freeRange), align); + + /* Give up if the block is too small to contain a whole page when + aligned, even though it might be masking smaller better aligned + pages that we could return, because CBSFindLargest won't be able + to find those. */ + if (base >= limit) + break; + + size = AddrOffset(base, limit); + + /* Don't return (much) more than we need to. */ + if (size > mvff->free - targetFree) + size = SizeAlignUp(mvff->free - targetFree, align); + + /* Calculate the range of pages we can return to the arena near the + top end of the free memory (because we're first fit). */ + RangeInit(&pageRange, AddrSub(limit, size), limit); + AVER(!RangeIsEmpty(&pageRange)); + AVER(RangesNest(&freeRange, &pageRange)); + AVER(RangeIsAligned(&pageRange, align)); + + /* 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, &pageRange); + + res = CBSDelete(&oldRange, MVFFTotalCBS(mvff), &pageRange); + if (res != ResOK) { + RangeStruct coalesced; + MVFFAddToFree(&coalesced, mvff, &pageRange); + return; + } + mvff->total -= RangeSize(&pageRange); + + ArenaFree(RangeBase(&pageRange), RangeSize(&pageRange), MVFF2Pool(mvff)); + } } @@ -374,7 +405,7 @@ static void MVFFFree(Pool pool, Addr old, Size size) size = SizeAlignUp(size, PoolAlignment(pool)); RangeInit(&range, old, AddrAdd(old, size)); MVFFAddToFree(&coalescedRange, mvff, &range); - MVFFReduce(mvff, &coalescedRange); + MVFFReduce(mvff); } /* MVFFFindLargest -- call CBSFindLargest and then fall back to @@ -464,7 +495,7 @@ static void MVFFBufferEmpty(Pool pool, Buffer buffer, RangeInit(&range, base, limit); MVFFAddToFree(&coalescedRange, mvff, &range); - MVFFReduce(mvff, &coalescedRange); + MVFFReduce(mvff); } @@ -510,6 +541,7 @@ static Res MVFFInit(Pool pool, ArgList args) Bool slotHigh = MVFF_SLOT_HIGH_DEFAULT; Bool arenaHigh = MVFF_ARENA_HIGH_DEFAULT; Bool firstFit = MVFF_FIRST_FIT_DEFAULT; + double spare = MVFF_SPARE_DEFAULT; MVFF mvff; Arena arena; Res res; @@ -533,6 +565,9 @@ static Res MVFFInit(Pool pool, ArgList args) if (ArgPick(&arg, args, MPS_KEY_ALIGN)) align = arg.val.align; + if (ArgPick(&arg, args, MPS_KEY_SPARE)) + spare = arg.val.d; + if (ArgPick(&arg, args, MPS_KEY_MVFF_SLOT_HIGH)) slotHigh = arg.val.b; @@ -545,6 +580,8 @@ static Res MVFFInit(Pool pool, ArgList args) AVER(extendBy > 0); /* .arg.check */ AVER(avgSize > 0); /* .arg.check */ AVER(avgSize <= extendBy); /* .arg.check */ + AVER(spare >= 0.0); /* .arg.check */ + AVER(spare <= 1.0); /* .arg.check */ AVER(SizeIsAligned(align, MPS_PF_ALIGN)); AVER(BoolCheck(slotHigh)); AVER(BoolCheck(arenaHigh)); @@ -557,6 +594,7 @@ static Res MVFFInit(Pool pool, ArgList args) pool->alignment = align; mvff->slotHigh = slotHigh; mvff->firstFit = firstFit; + mvff->spare = spare; SegPrefInit(MVFFSegPref(mvff)); SegPrefExpress(MVFFSegPref(mvff), arenaHigh ? SegPrefHigh : SegPrefLow, NULL); @@ -794,6 +832,8 @@ static Bool MVFFCheck(MVFF mvff) CHECKL(mvff->extendBy > 0); /* see .arg.check */ CHECKL(mvff->avgSize > 0); /* see .arg.check */ CHECKL(mvff->avgSize <= mvff->extendBy); /* see .arg.check */ + CHECKL(mvff->spare >= 0.0); /* see .arg.check */ + CHECKL(mvff->spare <= 1.0); /* see .arg.check */ CHECKL(mvff->total >= mvff->free); CHECKL(SizeIsAligned(mvff->free, PoolAlignment(MVFF2Pool(mvff)))); CHECKL(SizeIsAligned(mvff->total, ArenaAlign(PoolArena(MVFF2Pool(mvff))))); @@ -801,10 +841,10 @@ static Bool MVFFCheck(MVFF 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); +#ifdef MVFF_DEBUG /* FIXME: Consider using just "if" */ + CHECKL(mvff->free == CBSSize(MVFFFreeCBS(mvff)) + + FreelistSize(MVFFFreelist(mvff))); + CHECKL(mvff->total == CBSSize(MVFFTotalCBS(mvff))); #endif return TRUE; } From 3dd5db139d60707b53b0cbfd50d0814d7fea5797 Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Mon, 24 Feb 2014 23:40:08 +0000 Subject: [PATCH 02/93] Avoid checking every tract in a span on mvspancheck. Copied from Perforce Change: 184499 ServerID: perforce.ravenbrook.com --- mps/code/poolmv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 14cf2c12ce2..b132581969d 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -132,9 +132,7 @@ typedef struct MVSpanStruct { static Bool MVSpanCheck(MVSpan span) { - Addr addr, base, limit; - Arena arena; - Tract tract; + Addr base, limit; CHECKS(MVSpan, span); @@ -170,13 +168,20 @@ static Bool MVSpanCheck(MVSpan span) CHECKL(span->largest == SpanSize(span)+1); } - /* Each tract of the span must refer to the span */ - arena = PoolArena(TractPool(span->tract)); - TRACT_FOR(tract, addr, arena, base, limit) { - CHECKD_NOSIG(Tract, tract); - CHECKL(TractP(tract) == (void *)span); +#ifdef MV_DEBUG + { + Addr addr; + Arena arena; + Tract tract; + /* Each tract of the span must refer to the span */ + arena = PoolArena(TractPool(span->tract)); + TRACT_FOR(tract, addr, arena, base, limit) { + CHECKD_NOSIG(Tract, tract); + CHECKL(TractP(tract) == (void *)span); + } + CHECKL(addr == limit); } - CHECKL(addr == limit); +#endif return TRUE; } From 04645226763d119d5a916e5fe5ddda1c6ce28d69 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 18 Mar 2014 14:40:01 +0000 Subject: [PATCH 03/93] Branching master to version/1.113. Copied from Perforce Change: 184858 ServerID: perforce.ravenbrook.com From b1182c7f117699405a172c3670768e2f4582006d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 18 Mar 2014 18:11:48 +0000 Subject: [PATCH 04/93] Update release index and bump release number accordingly. Copied from Perforce Change: 184870 ServerID: perforce.ravenbrook.com --- mps/code/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/version.c b/mps/code/version.c index 28f1b3e1ce0..32711dd43a5 100644 --- a/mps/code/version.c +++ b/mps/code/version.c @@ -38,7 +38,7 @@ SRCID(version, "$Id$"); * .release.old: before 2006-02-01 the style was "release.epcore.chub". */ -#define MPS_RELEASE "release/1.113.0" +#define MPS_RELEASE "release/1.113.1" /* MPSCopyrightNotice -- copyright notice for the binary From 9fe14e3c1dd817e50abb3c7e1dd957a8a5f541ff Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 20 Mar 2014 13:24:00 +0000 Subject: [PATCH 05/93] In the 1.113.0 release notes, explain the backwards-imcompatible consequences of the generation chain changes. Copied from Perforce Change: 184903 ServerID: perforce.ravenbrook.com --- mps/manual/source/release.rst | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/mps/manual/source/release.rst b/mps/manual/source/release.rst index 3e6f650e146..ff3d466705f 100644 --- a/mps/manual/source/release.rst +++ b/mps/manual/source/release.rst @@ -8,6 +8,45 @@ Release notes Release 1.113.0 --------------- +New features +............ + +#. In previous releases there was an implicit connection between + blocks allocated by blocks allocated by :ref:`pool-awl` and + :ref:`pool-lo` pools, and blocks allocated by other automatically + managed pool classes. + + In particular, blocks allocated by AWL and LO pools were garbage + collected together with blocks allocated by :ref:`pool-ams` pools, + and blocks allocated by :ref:`pool-amc` pools in generation 1 of + their chains. + + This is no longer the case: to arrange for blocks to be collected + together you need to ensure that they are allocated in the *same* + generation chain, using the :c:macro:`MPS_KEY_CHAIN` and + :c:macro:`MPS_KEY_GEN` keyword arguments to + :c:func:`mps_pool_create_k`. + + So if you have code like this:: + + res = mps_pool_create(&my_amc, arena, mps_class_amc(), my_chain); + res = mps_pool_create(&my_awl, arena, mps_class_awl()); + + and you want to retain the connection between these pools, then you + must ensure that they use the same generation chain:: + + MPS_ARGS_BEGIN(args) { + MPS_ARGS_ADD(args, MPS_KEY_CHAIN, my_chain); + res = mps_pool_create_k(&my_amc, arena, mps_class_amc(), args); + } MPS_ARGS_END(args); + + MPS_ARGS_BEGIN(args) { + MPS_ARGS_ADD(args, MPS_KEY_CHAIN, my_chain); + MPS_ARGS_ADD(args, MPS_KEY_GEN, 1); + res = mps_pool_create_k(&my_awl, arena, mps_class_awl(), args); + } MPS_ARGS_END(args); + + Interface changes ................. From e09de16bfe1055ed0b6aa126b05359e1e3633276 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 20 Mar 2014 17:34:54 +0000 Subject: [PATCH 06/93] Fix typo. Copied from Perforce Change: 184909 ServerID: perforce.ravenbrook.com --- mps/manual/source/release.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mps/manual/source/release.rst b/mps/manual/source/release.rst index ff3d466705f..e660c2ff95b 100644 --- a/mps/manual/source/release.rst +++ b/mps/manual/source/release.rst @@ -12,9 +12,8 @@ New features ............ #. In previous releases there was an implicit connection between - blocks allocated by blocks allocated by :ref:`pool-awl` and - :ref:`pool-lo` pools, and blocks allocated by other automatically - managed pool classes. + blocks allocated by :ref:`pool-awl` and :ref:`pool-lo` pools, and + blocks allocated by other automatically managed pool classes. In particular, blocks allocated by AWL and LO pools were garbage collected together with blocks allocated by :ref:`pool-ams` pools, From ef146b011f881f5fc610771dce61e8dd7af1a77e Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 25 Mar 2014 16:01:06 +0000 Subject: [PATCH 07/93] Branching master to branch/2014-03-25/ansi. Copied from Perforce Change: 185015 ServerID: perforce.ravenbrook.com From 561b76b73c112f3b837ef74e1767605896fbbda0 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Mar 2014 12:27:35 +0000 Subject: [PATCH 08/93] Fix review comments from dl . Add __attribute__((__format__(printf))) to functions that take a printf-compatible format string (when building using GCC or Clang), so that format string mistakes can be detected statically. Copied from Perforce Change: 185021 ServerID: perforce.ravenbrook.com --- mps/code/mps.c | 14 +++++++++++++- mps/code/mps.xcodeproj/project.pbxproj | 8 ++++++++ mps/code/protan.c | 2 +- mps/code/vman.c | 3 ++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/mps/code/mps.c b/mps/code/mps.c index ef2484eabdf..b3be2615c5b 100644 --- a/mps/code/mps.c +++ b/mps/code/mps.c @@ -95,9 +95,21 @@ #include "mpsioan.c" #endif +/* ANSI back end. */ + +#if defined(CONFIG_ANSI) + +#include "lockan.c" /* generic locks */ +#include "than.c" /* generic threads manager */ +#include "vman.c" /* malloc-based pseudo memory mapping */ +#include "protan.c" /* generic memory protection */ +#include "prmcan.c" /* generic protection mutator context */ +#include "span.c" /* generic stack probe */ +#include "ssan.c" /* generic stack scanner */ + /* Mac OS X on 32-bit Intel built with Clang or GCC */ -#if defined(MPS_PF_XCI3LL) || defined(MPS_PF_XCI3GC) +#elif defined(MPS_PF_XCI3LL) || defined(MPS_PF_XCI3GC) #include "lockix.c" /* Posix locks */ #include "thxc.c" /* OS X Mach threading */ diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index d7865d3d4a6..37fb0893447 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -4439,6 +4439,10 @@ 3114A654156E9596001E0AA3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + "CONFIG_VAR_COOL=1", + "CONFIG_ANSI=1", + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -4523,6 +4527,10 @@ 3124CAC0156BE3EC00753214 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + CONFIG_VAR_COOL, + CONFIG_ANSI, + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; diff --git a/mps/code/protan.c b/mps/code/protan.c index 51b2edd6df8..b9fb46e7062 100644 --- a/mps/code/protan.c +++ b/mps/code/protan.c @@ -59,7 +59,7 @@ void ProtSync(Arena arena) ShieldLeave(arena); synced = FALSE; } - } while(SegNext(&seg, arena, base)); + } while(SegNext(&seg, arena, seg)); } } while(!synced); } diff --git a/mps/code/vman.c b/mps/code/vman.c index db7795c9f2e..2b4f0c3ecb2 100644 --- a/mps/code/vman.c +++ b/mps/code/vman.c @@ -63,11 +63,12 @@ Res VMParamFromArgs(void *params, size_t paramSize, ArgList args) /* VMCreate -- reserve some virtual address space, and create a VM structure */ -Res VMCreate(VM *vmReturn, Size size) +Res VMCreate(VM *vmReturn, Size size, void *params) { VM vm; AVER(vmReturn != NULL); + AVER(params != NULL); /* Note that because we add VMANPageALIGNMENT rather than */ /* VMANPageALIGNMENT-1 we are not in danger of overflowing */ From bfc3de38fa2107a6de2838b63a5d319d1fceae3a Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Mar 2014 16:25:14 +0000 Subject: [PATCH 09/93] Symbols starting config_ must be confined to config.h (see design.mps.config.impl.dep). Copied from Perforce Change: 185027 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 12 ++++++++++++ mps/code/mps.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index 4778b4b7552..bf056d2dc0d 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -152,6 +152,18 @@ #endif +/* CONFIG_PF_ANSI -- use the ANSI platform + * + * This symbol tells mps.c to exclude the sources for the + * auto-detected platform, and use the generic ("ANSI") platform + * instead. + */ + +#if defined(CONFIG_PF_ANSI) +#define PLATFORM_ANSI +#endif + + #define MPS_VARIETY_STRING \ MPS_ASSERT_STRING "." MPS_LOG_STRING "." MPS_STATS_STRING diff --git a/mps/code/mps.c b/mps/code/mps.c index b3be2615c5b..4fe83c151ec 100644 --- a/mps/code/mps.c +++ b/mps/code/mps.c @@ -95,9 +95,9 @@ #include "mpsioan.c" #endif -/* ANSI back end. */ +/* Generic ("ANSI") platform */ -#if defined(CONFIG_ANSI) +#if defined(PLATFORM_ANSI) #include "lockan.c" /* generic locks */ #include "than.c" /* generic threads manager */ From 4e7384be4bded7bd74b328cec671f2560315d3c0 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Mar 2014 17:09:49 +0000 Subject: [PATCH 10/93] Generic stack scanner implementation. Copied from Perforce Change: 185032 ServerID: perforce.ravenbrook.com --- mps/code/ssan.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/mps/code/ssan.c b/mps/code/ssan.c index 6f632dd1d24..603895dbf49 100644 --- a/mps/code/ssan.c +++ b/mps/code/ssan.c @@ -3,10 +3,16 @@ * $Id$ * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. * - * This module provides zero functionality. It exists to feed the - * linker (prevent linker errors). + * This module makes a best effort to scan the stack and fix the + * registers which may contain roots, using only the features of the + * Standard C library. + * + * .assume.setjmp: The implementation assumes that setjmp stores all + * the registers that need to be scanned in the jmp_buf. */ +#include + #include "mpmtypes.h" #include "misc.h" #include "ss.h" @@ -17,8 +23,17 @@ SRCID(ssan, "$Id$"); Res StackScan(ScanState ss, Addr *stackBot) { - UNUSED(ss); UNUSED(stackBot); - return ResUNIMPL; + jmp_buf jb; + void *stackTop = &jb; + + /* .assume.stack: This implementation assumes that the stack grows + * downwards, so that the address of the jmp_buf is the limit of the + * part of the stack that needs to be scanned. (StackScanInner makes + * the same assumption.) + */ + AVER(stackTop < (void *)stackBot); + + return StackScanInner(ss, stackBot, stackTop, sizeof jb / sizeof(Addr*)); } From 8e5ef0719910a56d2f9c7e84396b1191284f1001 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Mar 2014 21:23:04 +0000 Subject: [PATCH 11/93] Refactor comm.gmk so that cflags is reserved for the user. this means that if you want to build using the ansi platform you can run "make -f xci6ll.gmk cflags=-dconfig_pf_ansi". Don't include the testrun target in the "all" target. Copied from Perforce Change: 185034 ServerID: perforce.ravenbrook.com --- mps/code/comm.gmk | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index ffef57e63fa..bd0346e1679 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -15,8 +15,8 @@ # Assumes the following variables and definitions: # EXTRA_TARGETS a list of extra targets to build # CFLAGSCOMPILER a list of flags for all compilations -# CFLAGSSTRICT a list of flags for almost all compilations -# CFLAGSLAX a list of flags for compilations which can't be as +# CFLAGSCOMPILERSTRICT a list of flags for almost all compilations +# CFLAGSCOMPILERLAX a list of flags for compilations which can't be as # strict (e.g. because they have to include a third- # party header file that isn't -ansi -pedantic). # CFLAGSDEBUG a list of flags for compilations with maximum debug @@ -108,7 +108,7 @@ endif # These flags are included in all compilations. # Avoid using PFMDEFS in platform makefiles, as they prevent the MPS being # built with a simple command like "cc -c mps.c". -CFLAGSCOMMON = $(PFMDEFS) $(CFLAGSCOMPILER) $(CFLAGSCOMPILERSTRICT) +CFLAGSCOMMONSTRICT = $(PFMDEFS) $(CFLAGSCOMPILER) $(CFLAGSCOMPILERSTRICT) CFLAGSCOMMONLAX = $(PFMDEFS) $(CFLAGSCOMPILER) $(CFLAGSCOMPILERLAX) # %%VARIETY: When adding a new variety, define a macro containing the set @@ -119,20 +119,17 @@ CFRASH = -DCONFIG_VAR_RASH -DNDEBUG $(CFLAGSOPT) CFHOT = -DCONFIG_VAR_HOT -DNDEBUG $(CFLAGSOPT) CFCOOL = -DCONFIG_VAR_COOL $(CFLAGSDEBUG) -# Bind CFLAGS to the appropriate set of flags for the variety. -# %%VARIETY: When adding a new variety, add a test for the variety and set -# CFLAGS here. +# Bind CFLAGSVARIETY to the appropriate set of flags for the variety. +# %%VARIETY: When adding a new variety, add a test for the variety and +# set CFLAGSVARIETY here. ifeq ($(VARIETY),rash) -CFLAGS=$(CFLAGSCOMMON) $(CFRASH) -CFLAGSLAX=$(CFLAGSCOMMONLAX) $(CFRASH) +CFLAGSVARIETY=$(CFRASH) else ifeq ($(VARIETY),hot) -CFLAGS=$(CFLAGSCOMMON) $(CFHOT) -CFLAGSLAX=$(CFLAGSCOMMONLAX) $(CFHOT) +CFLAGSVARIETY=$(CFHOT) else ifeq ($(VARIETY),cool) -CFLAGS=$(CFLAGSCOMMON) $(CFCOOL) -CFLAGSLAX=$(CFLAGSCOMMONLAX) $(CFCOOL) +CFLAGSVARIETY=$(CFCOOL) else ifneq ($(VARIETY),) $(error Variety "$(VARIETY)" not recognized: must be rash/hot/cool) @@ -141,7 +138,8 @@ endif endif endif - +CFLAGSSTRICT=$(CFLAGSCOMMONSTRICT) $(CFLAGSVARIETY) $(CFLAGS) +CFLAGSLAX=$(CFLAGSCOMMONLAX) $(CFLAGSVARIETY) $(CFLAGS) ARFLAGS=rc$(ARFLAGSPFM) @@ -273,7 +271,7 @@ TEST_TARGETS=\ UNBUILDABLE_TARGETS=\ replay # depends on the EPVM pool -ALL_TARGETS=$(LIB_TARGETS) $(TEST_TARGETS) $(EXTRA_TARGETS) testrun +ALL_TARGETS=$(LIB_TARGETS) $(TEST_TARGETS) $(EXTRA_TARGETS) # == Pseudo-targets == @@ -290,7 +288,7 @@ $(PFM)/$(VARIETY)/testrun: $(TEST_TARGETS) # These convenience targets allow one to type "make foo" to build target # foo in selected varieties (or none, for the latter rule). -$(ALL_TARGETS): phony +$(ALL_TARGETS) testrun: phony ifdef VARIETY $(MAKE) -f $(PFM).gmk TARGET=$@ variety else @@ -513,11 +511,11 @@ endif # Object files -define run-cc +define run-cc-strict $(ECHO) "$(PFM): $@" mkdir -p $(PFM) mkdir -p $(PFM)/$(VARIETY) -$(CC) $(CFLAGS) -c -o $@ $< +$(CC) $(CFLAGSSTRICT) -c -o $@ $< endef define run-cc-lax @@ -529,16 +527,16 @@ endef # .rule.c-to-o: $(PFM)/$(VARIETY)/%.o: %.c - $(run-cc) + $(run-cc-strict) $(PFM)/$(VARIETY)/eventsql.o: eventsql.c $(run-cc-lax) $(PFM)/$(VARIETY)/%.o: %.s - $(run-cc) + $(run-cc-strict) $(PFM)/$(VARIETY)/%.o: %.S - $(run-cc) + $(run-cc-strict) # Dependencies # @@ -587,7 +585,7 @@ endif $(PFM)/$(VARIETY)/%.a: $(ECHO) "$(PFM): $@" rm -f $@ - $(CC) $(CFLAGS) -c -o $(PFM)/$(VARIETY)/version.o version.c + $(CC) $(CFLAGSSTRICT) -c -o $(PFM)/$(VARIETY)/version.o version.c $(AR) $(ARFLAGS) $@ $^ $(PFM)/$(VARIETY)/version.o $(RANLIB) $@ @@ -595,11 +593,11 @@ $(PFM)/$(VARIETY)/%.a: $(PFM)/$(VARIETY)/%: $(ECHO) "$(PFM): $@" - $(CC) $(CFLAGS) $(LINKFLAGS) -o $@ $^ $(LIBS) + $(CC) $(CFLAGSSTRICT) $(LINKFLAGS) -o $@ $^ $(LIBS) $(PFM)/$(VARIETY)/mpseventsql: $(ECHO) "$(PFM): $@" - $(CC) $(CFLAGS) $(LINKFLAGS) -o $@ $^ $(LIBS) -lsqlite3 + $(CC) $(CFLAGSLAX) $(LINKFLAGS) -o $@ $^ $(LIBS) -lsqlite3 # Special targets for development From a683ecf9f32b4b7d8fa9aece4e13e7cc3c592069 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Mar 2014 23:19:04 +0000 Subject: [PATCH 12/93] Add and document new configuration options config_thread_single and config_protection_none. Copied from Perforce Change: 185037 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 29 +++++++++++++++++++++++++++-- mps/code/lock.h | 13 ++----------- mps/code/lockix.c | 24 ++++++++++++------------ mps/code/lockli.c | 24 ++++++++++++------------ mps/code/lockw3.c | 24 ++++++++++++------------ mps/design/config.txt | 39 +++++++++++++++++++++++++++++++++++++-- 6 files changed, 102 insertions(+), 51 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index bf056d2dc0d..a1ebc2e688a 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -164,6 +164,33 @@ #endif +/* CONFIG_THREAD_SINGLE -- support single-threaded execution only + * + * This symbol causes the MPS to be built for single-threaded + * execution only, where locks are not needed and so lock operations + * can be defined as no-ops by lock.h. + */ + +#if defined(CONFIG_THREAD_SINGLE) +#define THREAD_SINGLE +#else +#define THREAD_MULTI +#endif + +/* CONFIG_PROTECTION_NONE -- no support for memory protection + * + * This symbol causes the MPS to built for an environment where there + * is no memory protection, and so segment summaries cannot be + * maintained by seg.c. + */ + +#if defined(CONFIG_PROTECTION_NONE) +#define PROTECTION_NONE +#else +#define PROTECTION +#endif + + #define MPS_VARIETY_STRING \ MPS_ASSERT_STRING "." MPS_LOG_STRING "." MPS_STATS_STRING @@ -517,8 +544,6 @@ #define MPS_PROD_STRING "mps" #define MPS_PROD_MPS -#define THREAD_MULTI -#define PROTECTION #define PROD_CHECKLEVEL_INITIAL CheckLevelSHALLOW /* TODO: This should be proportional to the memory usage of the MPS, not diff --git a/mps/code/lock.h b/mps/code/lock.h index 1431bbacd85..5faddfa05b8 100644 --- a/mps/code/lock.h +++ b/mps/code/lock.h @@ -85,9 +85,6 @@ #define LockSig ((Sig)0x51970CC9) /* SIGnature LOCK */ -#if defined(THREAD_MULTI) - - /* LockSize -- Return the size of a LockStruct * * Supports allocation of locks. @@ -198,8 +195,7 @@ extern void LockClaimGlobal(void); extern void LockReleaseGlobal(void); -#elif defined(THREAD_SINGLE) - +#ifdef THREAD_SINGLE #define LockSize() MPS_PF_ALIGN #define LockInit(lock) UNUSED(lock) @@ -214,12 +210,7 @@ extern void LockReleaseGlobal(void); #define LockClaimGlobal() #define LockReleaseGlobal() - -#else - -#error "No threading defined." - -#endif +#endif /* THREAD_SINGLE */ #endif /* lock_h */ diff --git a/mps/code/lockix.c b/mps/code/lockix.c index c32361e8560..2afd294246e 100644 --- a/mps/code/lockix.c +++ b/mps/code/lockix.c @@ -58,7 +58,7 @@ typedef struct LockStruct { /* LockSize -- size of a LockStruct */ -size_t LockSize(void) +size_t (LockSize)(void) { return sizeof(LockStruct); } @@ -66,7 +66,7 @@ size_t LockSize(void) /* LockCheck -- check a lock */ -Bool LockCheck(Lock lock) +Bool (LockCheck)(Lock lock) { CHECKS(Lock, lock); /* While claims can't be very large, I don't dare to put a limit on it. */ @@ -77,7 +77,7 @@ Bool LockCheck(Lock lock) /* LockInit -- initialize a lock */ -void LockInit(Lock lock) +void (LockInit)(Lock lock) { pthread_mutexattr_t attr; int res; @@ -99,7 +99,7 @@ void LockInit(Lock lock) /* LockFinish -- finish a lock */ -void LockFinish(Lock lock) +void (LockFinish)(Lock lock) { int res; @@ -114,7 +114,7 @@ void LockFinish(Lock lock) /* LockClaim -- claim a lock (non-recursive) */ -void LockClaim(Lock lock) +void (LockClaim)(Lock lock) { int res; @@ -133,7 +133,7 @@ void LockClaim(Lock lock) /* LockReleaseMPM -- release a lock (non-recursive) */ -void LockReleaseMPM(Lock lock) +void (LockReleaseMPM)(Lock lock) { int res; @@ -148,7 +148,7 @@ void LockReleaseMPM(Lock lock) /* LockClaimRecursive -- claim a lock (recursive) */ -void LockClaimRecursive(Lock lock) +void (LockClaimRecursive)(Lock lock) { int res; @@ -168,7 +168,7 @@ void LockClaimRecursive(Lock lock) /* LockReleaseRecursive -- release a lock (recursive) */ -void LockReleaseRecursive(Lock lock) +void (LockReleaseRecursive)(Lock lock) { int res; @@ -203,7 +203,7 @@ static void globalLockInit(void) /* LockClaimGlobalRecursive -- claim the global recursive lock */ -void LockClaimGlobalRecursive(void) +void (LockClaimGlobalRecursive)(void) { int res; @@ -216,7 +216,7 @@ void LockClaimGlobalRecursive(void) /* LockReleaseGlobalRecursive -- release the global recursive lock */ -void LockReleaseGlobalRecursive(void) +void (LockReleaseGlobalRecursive)(void) { LockReleaseRecursive(globalRecLock); } @@ -224,7 +224,7 @@ void LockReleaseGlobalRecursive(void) /* LockClaimGlobal -- claim the global non-recursive lock */ -void LockClaimGlobal(void) +void (LockClaimGlobal)(void) { int res; @@ -237,7 +237,7 @@ void LockClaimGlobal(void) /* LockReleaseGlobal -- release the global non-recursive lock */ -void LockReleaseGlobal(void) +void (LockReleaseGlobal)(void) { LockReleaseMPM(globalLock); } diff --git a/mps/code/lockli.c b/mps/code/lockli.c index 06437b5b531..5e63e15d291 100644 --- a/mps/code/lockli.c +++ b/mps/code/lockli.c @@ -72,7 +72,7 @@ typedef struct LockStruct { /* LockSize -- size of a LockStruct */ -size_t LockSize(void) +size_t (LockSize)(void) { return sizeof(LockStruct); } @@ -80,7 +80,7 @@ size_t LockSize(void) /* LockCheck -- check a lock */ -Bool LockCheck(Lock lock) +Bool (LockCheck)(Lock lock) { CHECKS(Lock, lock); /* While claims can't be very large, I don't dare to put a limit on it. */ @@ -91,7 +91,7 @@ Bool LockCheck(Lock lock) /* LockInit -- initialize a lock */ -void LockInit(Lock lock) +void (LockInit)(Lock lock) { pthread_mutexattr_t attr; int res; @@ -113,7 +113,7 @@ void LockInit(Lock lock) /* LockFinish -- finish a lock */ -void LockFinish(Lock lock) +void (LockFinish)(Lock lock) { int res; @@ -128,7 +128,7 @@ void LockFinish(Lock lock) /* LockClaim -- claim a lock (non-recursive) */ -void LockClaim(Lock lock) +void (LockClaim)(Lock lock) { int res; @@ -147,7 +147,7 @@ void LockClaim(Lock lock) /* LockReleaseMPM -- release a lock (non-recursive) */ -void LockReleaseMPM(Lock lock) +void (LockReleaseMPM)(Lock lock) { int res; @@ -162,7 +162,7 @@ void LockReleaseMPM(Lock lock) /* LockClaimRecursive -- claim a lock (recursive) */ -void LockClaimRecursive(Lock lock) +void L(ockClaimRecursive)(Lock lock) { int res; @@ -182,7 +182,7 @@ void LockClaimRecursive(Lock lock) /* LockReleaseRecursive -- release a lock (recursive) */ -void LockReleaseRecursive(Lock lock) +void (LockReleaseRecursive)(Lock lock) { int res; @@ -217,7 +217,7 @@ static void globalLockInit(void) /* LockClaimGlobalRecursive -- claim the global recursive lock */ -void LockClaimGlobalRecursive(void) +void (LockClaimGlobalRecursive)(void) { int res; @@ -230,7 +230,7 @@ void LockClaimGlobalRecursive(void) /* LockReleaseGlobalRecursive -- release the global recursive lock */ -void LockReleaseGlobalRecursive(void) +void (LockReleaseGlobalRecursive)(void) { LockReleaseRecursive(globalRecLock); } @@ -238,7 +238,7 @@ void LockReleaseGlobalRecursive(void) /* LockClaimGlobal -- claim the global non-recursive lock */ -void LockClaimGlobal(void) +void (LockClaimGlobal)(void) { int res; @@ -251,7 +251,7 @@ void LockClaimGlobal(void) /* LockReleaseGlobal -- release the global non-recursive lock */ -void LockReleaseGlobal(void) +void (LockReleaseGlobal)(void) { LockReleaseMPM(globalLock); } diff --git a/mps/code/lockw3.c b/mps/code/lockw3.c index 258b31bff44..2fdc2800032 100644 --- a/mps/code/lockw3.c +++ b/mps/code/lockw3.c @@ -40,18 +40,18 @@ typedef struct LockStruct { } LockStruct; -size_t LockSize(void) +size_t (LockSize)(void) { return sizeof(LockStruct); } -Bool LockCheck(Lock lock) +Bool (LockCheck)(Lock lock) { CHECKS(Lock, lock); return TRUE; } -void LockInit(Lock lock) +void (LockInit)(Lock lock) { AVER(lock != NULL); lock->claims = 0; @@ -60,7 +60,7 @@ void LockInit(Lock lock) AVERT(Lock, lock); } -void LockFinish(Lock lock) +void (LockFinish)(Lock lock) { AVERT(Lock, lock); /* Lock should not be finished while held */ @@ -69,7 +69,7 @@ void LockFinish(Lock lock) lock->sig = SigInvalid; } -void LockClaim(Lock lock) +void (LockClaim)(Lock lock) { AVERT(Lock, lock); EnterCriticalSection(&lock->cs); @@ -79,7 +79,7 @@ void LockClaim(Lock lock) lock->claims = 1; } -void LockReleaseMPM(Lock lock) +void (LockReleaseMPM)(Lock lock) { AVERT(Lock, lock); AVER(lock->claims == 1); /* The lock should only be held once */ @@ -87,7 +87,7 @@ void LockReleaseMPM(Lock lock) LeaveCriticalSection(&lock->cs); } -void LockClaimRecursive(Lock lock) +void (LockClaimRecursive)(Lock lock) { AVERT(Lock, lock); EnterCriticalSection(&lock->cs); @@ -95,7 +95,7 @@ void LockClaimRecursive(Lock lock) AVER(lock->claims > 0); } -void LockReleaseRecursive(Lock lock) +void (LockReleaseRecursive)(Lock lock) { AVERT(Lock, lock); AVER(lock->claims > 0); @@ -129,27 +129,27 @@ static void lockEnsureGlobalLock(void) } } -void LockClaimGlobalRecursive(void) +void (LockClaimGlobalRecursive)(void) { lockEnsureGlobalLock(); AVER(globalLockInit); LockClaimRecursive(globalRecLock); } -void LockReleaseGlobalRecursive(void) +void (LockReleaseGlobalRecursive)(void) { AVER(globalLockInit); LockReleaseRecursive(globalRecLock); } -void LockClaimGlobal(void) +void (LockClaimGlobal)(void) { lockEnsureGlobalLock(); AVER(globalLockInit); LockClaim(globalLock); } -void LockReleaseGlobal(void) +void (LockReleaseGlobal)(void) { AVER(globalLockInit); LockReleaseMPM(globalLock); diff --git a/mps/design/config.txt b/mps/design/config.txt index 03bfec5109a..c7184ab31ee 100644 --- a/mps/design/config.txt +++ b/mps/design/config.txt @@ -97,6 +97,10 @@ as a dimension of configuration since `.req.prod`_ has been retired. _`.def.target`: The *target* is the result of the build. +_`.def.option`: An *option* is a feature of the MPS that is not +selected via the *platform* and *variety*. See `.opt`_. + + Overview -------- @@ -150,7 +154,7 @@ _`.build.cc`: A consequence of this approach is that it should always be possible to build a complete target with a single UNIX command line calling the compiler driver (usually "cc" or "gcc"), for example:: - cc -o main -DCONFIG_VAR_DF foo.c bar.c baz.s -lz + cc -o main -DCONFIG_VAR_COOL foo.c bar.c baz.s -lz _`.build.defs`: The "defs" are the set of preprocessor macros which are to be predefined when compiling the module sources:: @@ -319,12 +323,14 @@ _`.pf.form`: This file consists of sets of directives of the form:: #elif #define MPS_PF_ + #define MPS_PF_STRING "" #define MPS_OS_ #define MPS_ARCH_ #define MPS_BUILD_ #define MPS_T_WORD #define MPS_T_ULONGEST - #define MPS_WORD_SHIFT + #define MPS_WORD_WIDTH + #define MPS_WORD_SHIFT #define MPS_PF_ALIGN _`.pf.detect`: The conjunction of builder predefinitions is a constant @@ -513,6 +519,35 @@ For example, this sort of thing:: This violates `.no-spaghetti`_. +Configuration options +--------------------- + +_`.opt`: Options select features of the MPS that are not selected by the *platform* and the *variety*. + +_`.opt.support`: The features selected by options are not supported or +documented in the public interface. This is to keep the complexity of +the MPS manageable: at present the number of supported configuration +is *platforms* × *varieties* (at time of writing, 9 × 3 = 27). Each +supported option would double (or worse) the number of supported +configurations. + +_`.opt.ansi`: ``CONFIG_PF_ANSI`` tells ``mps.c`` to exclude the +sources for the auto-detected platform, and use the generic ("ANSI") +platform instead. + +_`.opt.thread`: ``CONFIG_THREAD_SINGLE`` causes the MPS to be built +for single-threaded execution only, where locks are not needed and so +lock operations can be defined as no-ops by ``lock.h``. + +_`.opt.prot`: ``CONFIG_PROTECTION_NONE`` causes the MPS to be built +for an environment where there is no memory protection, and so segment summaries cannot be maintained by ``seg.c``. + +_`.opt.prot.thread`: If both ``CONFIG_THREAD_SINGLE`` and +``CONFIG_PROTECTION_NONE`` are defined, then the shield is not needed +and so shield operations can be defined as no-ops by ``mpm.h``. + + + To document ----------- - What about constants in config.h? From 945f444158002f3f930c00af6b75815c067b4bba Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 11:52:27 +0000 Subject: [PATCH 13/93] Provide three different test targets for different purposes: * testrun = "smoke test", fast enough to run before every commit * testci = continuous integration tests, must be known good * testall = all test cases, for ensuring quality of a release Switch the main "make test" from testrun to testci. Put test cases into "database" so that they can be selected. Copied from Perforce Change: 185039 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 7 +- mps/code/comm.gmk | 14 ++- mps/code/mps.xcodeproj/project.pbxproj | 160 ++++++++++++++++++++++--- mps/tool/testcases.txt | 54 +++++++++ mps/tool/testrun.sh | 71 ++++------- 5 files changed, 234 insertions(+), 72 deletions(-) create mode 100644 mps/tool/testcases.txt diff --git a/mps/Makefile.in b/mps/Makefile.in index 2d558588673..960903ba43a 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -68,11 +68,10 @@ make-install-dirs: install: @INSTALL_TARGET@ test-make-build: @BUILD_TARGET@ - $(MAKE) $(TARGET_OPTS) VARIETY=cool testrun - $(MAKE) $(TARGET_OPTS) VARIETY=hot testrun + $(MAKE) $(TARGET_OPTS) testci test-xcode-build: - $(XCODEBUILD) -config Release -target testrun - $(XCODEBUILD) -config Debug -target testrun + $(XCODEBUILD) -config Release -target testci + $(XCODEBUILD) -config Debug -target testci test: @TEST_TARGET@ diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index bd0346e1679..837b025e974 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -279,16 +279,22 @@ ALL_TARGETS=$(LIB_TARGETS) $(TEST_TARGETS) $(EXTRA_TARGETS) all: $(ALL_TARGETS) -# Run the automated tests. +# == Automated test suites == +# +# testrun = "smoke test", fast enough to run before every commit +# testci = continuous integration tests, must be known good +# testall = all test cases, for ensuring quality of a release -$(PFM)/$(VARIETY)/testrun: $(TEST_TARGETS) - ../tool/testrun.sh "$(PFM)/$(VARIETY)" +TEST_SUITES=testrun testci testall + +$(addprefix $(PFM)/$(VARIETY)/,$(TEST_SUITES)): $(TEST_TARGETS) + ../tool/testrun.sh "$(PFM)/$(VARIETY)" "$(notdir $@)" # These convenience targets allow one to type "make foo" to build target # foo in selected varieties (or none, for the latter rule). -$(ALL_TARGETS) testrun: phony +$(ALL_TARGETS) $(TEST_SUITES): phony ifdef VARIETY $(MAKE) -f $(PFM).gmk TARGET=$@ variety else diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index adbe341583b..1c9f39ff0f1 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -7,6 +7,30 @@ objects = { /* Begin PBXAggregateTarget section */ + 225F0AFC18E4453A003F2183 /* testci */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 225F0B0018E4453A003F2183 /* Build configuration list for PBXAggregateTarget "testci" */; + buildPhases = ( + 225F0AFF18E4453A003F2183 /* ShellScript */, + ); + dependencies = ( + 225F0AFD18E4453A003F2183 /* PBXTargetDependency */, + ); + name = testci; + productName = testrun; + }; + 225F0B0418E44549003F2183 /* testall */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 225F0B0818E44549003F2183 /* Build configuration list for PBXAggregateTarget "testall" */; + buildPhases = ( + 225F0B0718E44549003F2183 /* ShellScript */, + ); + dependencies = ( + 225F0B0518E44549003F2183 /* PBXTargetDependency */, + ); + name = testall; + productName = testrun; + }; 22CDE8EF16E9E97D00366D0A /* testrun */ = { isa = PBXAggregateTarget; buildConfigurationList = 22CDE8F016E9E97E00366D0A /* Build configuration list for PBXAggregateTarget "testrun" */; @@ -320,6 +344,20 @@ remoteGlobalIDString = 224CC78C175E1821002FF81B; remoteInfo = mvfftest; }; + 225F0AFE18E4453A003F2183 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3104AFF1156D37A0000A585A; + remoteInfo = all; + }; + 225F0B0618E44549003F2183 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3104AFF1156D37A0000A585A; + remoteInfo = all; + }; 2275798816C5422900B662B0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; @@ -1326,8 +1364,6 @@ 22FACED5188807FF000FDBC1 /* fmtno.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtno.h; sourceTree = ""; }; 22FACED6188807FF000FDBC1 /* fmtscheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fmtscheme.c; sourceTree = ""; }; 22FACED7188807FF000FDBC1 /* fmtscheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtscheme.h; sourceTree = ""; }; - 22FACED8188807FF000FDBC1 /* locbwcss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locbwcss.c; sourceTree = ""; }; - 22FACED9188807FF000FDBC1 /* locusss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locusss.c; sourceTree = ""; }; 22FACEDA1888088A000FDBC1 /* ss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ss.c; sourceTree = ""; }; 22FACEDB188808D5000FDBC1 /* mpscmfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpscmfs.h; sourceTree = ""; }; 22FACEDC18880933000FDBC1 /* poolmfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmfs.h; sourceTree = ""; }; @@ -3248,6 +3284,8 @@ targets = ( 3104AFF1156D37A0000A585A /* all */, 22CDE8EF16E9E97D00366D0A /* testrun */, + 225F0AFC18E4453A003F2183 /* testci */, + 225F0B0418E44549003F2183 /* testall */, 31EEABFA156AAF9D00714D05 /* mps */, 3114A632156E94DB001E0AA3 /* abqtest */, 22FACEE018880983000FDBC1 /* airtest */, @@ -3299,6 +3337,34 @@ /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ + 225F0AFF18E4453A003F2183 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; + showEnvVarsInLog = 0; + }; + 225F0B0718E44549003F2183 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; + showEnvVarsInLog = 0; + }; 22CDE8F416E9E9D400366D0A /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -3310,7 +3376,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\"\n"; + shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -3827,6 +3893,16 @@ target = 224CC78C175E1821002FF81B /* fotest */; targetProxy = 224CC79C175E187C002FF81B /* PBXContainerItemProxy */; }; + 225F0AFD18E4453A003F2183 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3104AFF1156D37A0000A585A /* all */; + targetProxy = 225F0AFE18E4453A003F2183 /* PBXContainerItemProxy */; + }; + 225F0B0518E44549003F2183 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3104AFF1156D37A0000A585A /* all */; + targetProxy = 225F0B0618E44549003F2183 /* PBXContainerItemProxy */; + }; 2275798916C5422900B662B0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 2D604B9B16514B1A003AAF46 /* mpseventtxt */; @@ -4286,6 +4362,48 @@ }; name = Release; }; + 225F0B0118E4453A003F2183 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testrun copy"; + }; + name = Debug; + }; + 225F0B0218E4453A003F2183 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testrun copy"; + }; + name = Release; + }; + 225F0B0318E4453A003F2183 /* RASH */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testrun copy"; + }; + name = RASH; + }; + 225F0B0918E44549003F2183 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testrun copy copy"; + }; + name = Debug; + }; + 225F0B0A18E44549003F2183 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testrun copy copy"; + }; + name = Release; + }; + 225F0B0B18E44549003F2183 /* RASH */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testrun copy copy"; + }; + name = RASH; + }; 2291A5BA175CAB2F001D4920 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -4362,8 +4480,6 @@ 22C2ACAC18BE400A006B3677 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = YES; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; PRODUCT_NAME = nailboardtest; }; name = Debug; @@ -4371,8 +4487,6 @@ 22C2ACAD18BE400A006B3677 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; PRODUCT_NAME = nailboardtest; }; name = Release; @@ -4380,8 +4494,6 @@ 22C2ACAE18BE400A006B3677 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; PRODUCT_NAME = nailboardtest; }; name = RASH; @@ -4417,8 +4529,6 @@ 22FACEEA18880983000FDBC1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = YES; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; PRODUCT_NAME = airtest; }; name = Debug; @@ -4426,8 +4536,6 @@ 22FACEEB18880983000FDBC1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; PRODUCT_NAME = airtest; }; name = Release; @@ -4435,8 +4543,6 @@ 22FACEEC18880983000FDBC1 /* WE */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; PRODUCT_NAME = airtest; }; name = WE; @@ -4686,10 +4792,6 @@ 3114A654156E9596001E0AA3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = ( - "CONFIG_VAR_COOL=1", - "CONFIG_ANSI=1", - ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -5500,6 +5602,26 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 225F0B0018E4453A003F2183 /* Build configuration list for PBXAggregateTarget "testci" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 225F0B0118E4453A003F2183 /* Debug */, + 225F0B0218E4453A003F2183 /* Release */, + 225F0B0318E4453A003F2183 /* RASH */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 225F0B0818E44549003F2183 /* Build configuration list for PBXAggregateTarget "testall" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 225F0B0918E44549003F2183 /* Debug */, + 225F0B0A18E44549003F2183 /* Release */, + 225F0B0B18E44549003F2183 /* RASH */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 2291A5B9175CAB2F001D4920 /* Build configuration list for PBXNativeTarget "awlutth" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/mps/tool/testcases.txt b/mps/tool/testcases.txt new file mode 100644 index 00000000000..96d3a4d2cff --- /dev/null +++ b/mps/tool/testcases.txt @@ -0,0 +1,54 @@ +============= ================ ========================================== +Test case Flags Notes +============= ================ ========================================== +abqtest +airtest +amcss +amcsshe +amcssth =B =X job003561, job003703 +amsss +amssshe +apss +arenacv +awlut +awluthe +awlutth =X +btcv +bttest =N interactive +djbench =N benchmark +exposet0 +expt825 +fbmtest +finalcv +finaltest +fotest +gcbench =N benchmark +locbwcss +lockcov +lockutw3 =W +locusss +locv +messtest +mpmss +mpsicv +mv2test +nailboardtest +poolncv +qs +sacss +segsmss +steptest +teletest =N interactive +walkt0 +zcoll =B =L +zmess +============= ================ ========================================== + +Key to flags +............ + + B -- known Bad + L -- Long runtime + N -- Not an automated test case + W -- Windows-only + X -- Unix-only diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 9cecd1c6fd5..2785929db8f 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -12,57 +12,38 @@ # # Usage:: # -# testrun.sh DIR [CASE1 CASE2 ...] - -ALL_TEST_CASES=" - abqtest - amcss - amcsshe - amcssth - amsss - amssshe - apss - 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 -" -# bttest -- interactive, so cannot be run unattended -# djbench -- benchmark, not test case -# gcbench -- benchmark, not test case -# teletest -- interactive, so cannot be run unattended -# zcoll -- takes too long to be useful as a regularly run smoke test +# testrun.sh DIR ( SUITE | CASE1 CASE2 [...] ) # Make a temporary output directory for the test logs. LOGDIR=$(mktemp -d /tmp/mps.log.XXXXXX) -TEST_DIR=$1 echo "MPS test suite" echo "Logging test output to $LOGDIR" -echo "Test directory: $TEST_DIR" + +# First argument is the directory containing the test cases. +TEST_DIR=$1 shift -TEST_CASES=${*:-${ALL_TEST_CASES}} +echo "Test directory: $TEST_DIR" + +# Determine which tests to run. +TEST_CASE_DB=$(dirname -- "$0")/testcases.txt +if [ $# == 1 ]; then + TEST_SUITE=$1 + echo "Test suite: $TEST_SUITE" + case $TEST_SUITE in + testrun) EXCLUDE="=[LNW]" ;; + testci) EXCLUDE="=[BNW]" ;; + testall) EXCLUDE="=[NW]" ;; + *) + echo "Test suite $TEST_SUITE not recognized." + exit 1 ;; + esac + TEST_CASES=$(<"$TEST_CASE_DB" grep -e '^[a-z]' | + grep -v -e "$EXCLUDE" | + cut -d' ' -f1) +else + echo "$# test cases from the command line" + TEST_CASES=$* +fi SEPARATOR="----------------------------------------" TEST_COUNT=0 From 28d986563790ade7792310d034f14db3167bdf3e Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 12:22:19 +0000 Subject: [PATCH 14/93] Fix typo. Copied from Perforce Change: 185042 ServerID: perforce.ravenbrook.com --- mps/code/lockli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/lockli.c b/mps/code/lockli.c index 5e63e15d291..89e8f4f0653 100644 --- a/mps/code/lockli.c +++ b/mps/code/lockli.c @@ -162,7 +162,7 @@ void (LockReleaseMPM)(Lock lock) /* LockClaimRecursive -- claim a lock (recursive) */ -void L(ockClaimRecursive)(Lock lock) +void (LockClaimRecursive)(Lock lock) { int res; From a5d60601fdd712a51c77909ff9f1aa3c64a1d4b8 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 14:01:16 +0000 Subject: [PATCH 15/93] Share test case database between windows and unix. Add testci and testall targets on Windows. Copied from Perforce Change: 185047 ServerID: perforce.ravenbrook.com --- mps/code/commpost.nmk | 10 +++--- mps/tool/testrun.bat | 71 ++++++++++++++++--------------------------- mps/tool/testrun.sh | 8 ++--- 3 files changed, 35 insertions(+), 54 deletions(-) diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index f049123a276..46203a321a3 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -53,15 +53,15 @@ variety: $(PFM)\$(VARIETY)\$(TARGET) !ENDIF !ENDIF -# testrun +# testrun testci testall # Runs automated test cases. -testrun: $(TEST_TARGETS) +testrun testci testall: $(TEST_TARGETS) !IFDEF VARIETY - ..\tool\testrun.bat $(PFM) $(VARIETY) + ..\tool\testrun.bat $(PFM) $(VARIETY) $@ !ELSE - $(MAKE) /nologo /f $(PFM).nmk VARIETY=hot testrun - $(MAKE) /nologo /f $(PFM).nmk VARIETY=cool testrun + $(MAKE) /nologo /f $(PFM).nmk VARIETY=hot $@ + $(MAKE) /nologo /f $(PFM).nmk VARIETY=cool $@ !ENDIF diff --git a/mps/tool/testrun.bat b/mps/tool/testrun.bat index 696aaac0fd9..06f947a25e3 100755 --- a/mps/tool/testrun.bat +++ b/mps/tool/testrun.bat @@ -14,56 +14,28 @@ @echo off -@rem First two arguments are platform and variety. +@rem Find test case database in same directory as this script. +for %%F in ("%0") do set TEST_CASE_DB=%%~dpF%testcases.txt + set PFM=%1 shift set VARIETY=%1 shift +set TESTSUITE=%1 @rem Make a temporary output directory for the test logs. set LOGDIR=%TMP%\mps-%PFM%-%VARIETY%-log +echo MPS test suite echo Logging test output to %LOGDIR% +echo Test directory: %PFM%\%VARIETY% rmdir /q /s %LOGDIR% mkdir %LOGDIR% @rem Determine which tests to run. - - -set ALL_TEST_CASES=^ - abqtest.exe ^ - airtest.exe ^ - amcss.exe ^ - amcsshe.exe ^ - amsss.exe ^ - amssshe.exe ^ - apss.exe ^ - arenacv.exe ^ - awlut.exe ^ - awluthe.exe ^ - btcv.exe ^ - exposet0.exe ^ - expt825.exe ^ - fbmtest.exe ^ - finalcv.exe ^ - finaltest.exe ^ - fotest.exe ^ - locbwcss.exe ^ - lockcov.exe ^ - lockutw3.exe ^ - locusss.exe ^ - locv.exe ^ - messtest.exe ^ - mpmss.exe ^ - mpsicv.exe ^ - mv2test.exe ^ - nailboardtest.exe ^ - poolncv.exe ^ - qs.exe ^ - sacss.exe ^ - segsmss.exe ^ - steptest.exe ^ - walkt0.exe ^ - zmess.exe +set EXCLUDE= +if "%TESTSUITE%"=="testrun" set EXCLUDE=LNX +if "%TESTSUITE%"=="testci" set EXCLUDE=BNX +if "%TESTSUITE%"=="testall" set EXCLUDE=NX @rem Ensure that test cases don't pop up dialog box on abort() set MPS_TESTLIB_NOABORT=true @@ -72,18 +44,28 @@ set PASS_COUNT=0 set FAIL_COUNT=0 set SEPARATOR=---------------------------------------- -if "%1"=="" call :run_tests %ALL_TEST_CASES% +if "%EXCLUDE%"=="" goto :args +for /f "tokens=1" %%T IN ('type %TEST_CASE_DB% ^|^ + findstr /b /r [abcdefghijklmnopqrstuvwxyz] ^|^ + findstr /v /r =[%EXCLUDE%]') do call :run_test %%T +goto :done +:args +if "%1"=="" goto :done +call :run_test %1 +shift +goto :args + +:done if "%FAIL_COUNT%"=="0" ( echo Tests: %TEST_COUNT%. All tests pass. - exit 0 + exit /b 0 ) else ( echo Tests: %TEST_COUNT%. Passes: %PASS_COUNT%. Failures: %FAIL_COUNT%. - exit 1 + exit /b 1 ) -:run_tests -if "%1"=="" exit /b +:run_test set /a TEST_COUNT=%TEST_COUNT%+1 echo Running %1 %PFM%\%VARIETY%\%1 > %LOGDIR%\%1 @@ -95,8 +77,7 @@ if "%errorlevel%"=="0" ( echo %SEPARATOR%%SEPARATOR% set /a FAIL_COUNT=%FAIL_COUNT%+1 ) -shift -goto run_tests +exit /b @rem C. COPYRIGHT AND LICENSE diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 2785929db8f..303168cad63 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -30,15 +30,15 @@ if [ $# == 1 ]; then TEST_SUITE=$1 echo "Test suite: $TEST_SUITE" case $TEST_SUITE in - testrun) EXCLUDE="=[LNW]" ;; - testci) EXCLUDE="=[BNW]" ;; - testall) EXCLUDE="=[NW]" ;; + testrun) EXCLUDE="LNW" ;; + testci) EXCLUDE="BNW" ;; + testall) EXCLUDE="NW" ;; *) echo "Test suite $TEST_SUITE not recognized." exit 1 ;; esac TEST_CASES=$(<"$TEST_CASE_DB" grep -e '^[a-z]' | - grep -v -e "$EXCLUDE" | + grep -v -e "=[$EXCLUDE]" | cut -d' ' -f1) else echo "$# test cases from the command line" From 14b565e39aec2b938800031f7b1d433c09861033 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 14:19:01 +0000 Subject: [PATCH 16/93] Don't depend on test accepting == (not portable to /bin/sh). Copied from Perforce Change: 185048 ServerID: perforce.ravenbrook.com --- mps/tool/testrun.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 303168cad63..35197dd879c 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -26,7 +26,7 @@ echo "Test directory: $TEST_DIR" # Determine which tests to run. TEST_CASE_DB=$(dirname -- "$0")/testcases.txt -if [ $# == 1 ]; then +if [ $# -eq 1 ]; then TEST_SUITE=$1 echo "Test suite: $TEST_SUITE" case $TEST_SUITE in From a2edf546f8feb8fab092e65bcd27930d2ee43b53 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 15:19:42 +0000 Subject: [PATCH 17/93] Test case database now notes which test cases use threads. New test suite "testansi" consists of test cases that run on the generic ("ANSI") platform. New target "ansi" builds the MPS with the CONFIG_PF_ANSI CONFIG_THREAD_SINGLE and CONFIG_PROTECTION_NONE settings. Build and test the "ansi" target as part of "make test" for the benefit of the buildbots (just Linux and FreeBSD for the moment). Copied from Perforce Change: 185050 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 7 ++- mps/code/comm.gmk | 3 +- mps/code/commpost.nmk | 4 +- mps/code/mps.xcodeproj/project.pbxproj | 70 ++++++++++++++++++++++++++ mps/tool/testcases.txt | 9 ++-- mps/tool/testrun.bat | 7 +-- mps/tool/testrun.sh | 7 +-- 7 files changed, 92 insertions(+), 15 deletions(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 960903ba43a..e77813f19d5 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -67,11 +67,14 @@ make-install-dirs: install: @INSTALL_TARGET@ -test-make-build: @BUILD_TARGET@ +test-make-build: + $(MAKE) clean + $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_PROTECTION_NONE" testansi + $(MAKE) clean $(MAKE) $(TARGET_OPTS) testci test-xcode-build: - $(XCODEBUILD) -config Release -target testci $(XCODEBUILD) -config Debug -target testci + $(XCODEBUILD) -config Release -target testci test: @TEST_TARGET@ diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 837b025e974..64ce520b560 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -284,8 +284,9 @@ all: $(ALL_TARGETS) # testrun = "smoke test", fast enough to run before every commit # testci = continuous integration tests, must be known good # testall = all test cases, for ensuring quality of a release +# testansi = tests that run on the generic ("ANSI") platform -TEST_SUITES=testrun testci testall +TEST_SUITES=testrun testci testall testansi $(addprefix $(PFM)/$(VARIETY)/,$(TEST_SUITES)): $(TEST_TARGETS) ../tool/testrun.sh "$(PFM)/$(VARIETY)" "$(notdir $@)" diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index 46203a321a3..6c9966efe03 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -53,10 +53,10 @@ variety: $(PFM)\$(VARIETY)\$(TARGET) !ENDIF !ENDIF -# testrun testci testall +# testrun testci testall testansi # Runs automated test cases. -testrun testci testall: $(TEST_TARGETS) +testrun testci testall testansi: $(TEST_TARGETS) !IFDEF VARIETY ..\tool\testrun.bat $(PFM) $(VARIETY) $@ !ELSE diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index 1c9f39ff0f1..cd178d5f855 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -31,6 +31,18 @@ name = testall; productName = testrun; }; + 2291B6E318E4754D0004B79C /* testansi */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 2291B6E718E4754D0004B79C /* Build configuration list for PBXAggregateTarget "testansi" */; + buildPhases = ( + 2291B6E618E4754D0004B79C /* ShellScript */, + ); + dependencies = ( + 2291B6E418E4754D0004B79C /* PBXTargetDependency */, + ); + name = testansi; + productName = testrun; + }; 22CDE8EF16E9E97D00366D0A /* testrun */ = { isa = PBXAggregateTarget; buildConfigurationList = 22CDE8F016E9E97E00366D0A /* Build configuration list for PBXAggregateTarget "testrun" */; @@ -407,6 +419,13 @@ remoteGlobalIDString = 2291A5C1175CAFCA001D4920; remoteInfo = expt825; }; + 2291B6E518E4754D0004B79C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3104AFF1156D37A0000A585A; + remoteInfo = all; + }; 22B2BC3818B643AD00C33E63 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; @@ -3286,6 +3305,7 @@ 22CDE8EF16E9E97D00366D0A /* testrun */, 225F0AFC18E4453A003F2183 /* testci */, 225F0B0418E44549003F2183 /* testall */, + 2291B6E318E4754D0004B79C /* testansi */, 31EEABFA156AAF9D00714D05 /* mps */, 3114A632156E94DB001E0AA3 /* abqtest */, 22FACEE018880983000FDBC1 /* airtest */, @@ -3365,6 +3385,20 @@ shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; showEnvVarsInLog = 0; }; + 2291B6E618E4754D0004B79C /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; + showEnvVarsInLog = 0; + }; 22CDE8F416E9E9D400366D0A /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -3938,6 +3972,11 @@ target = 2291A5C1175CAFCA001D4920 /* expt825 */; targetProxy = 2291A5E7175CB20E001D4920 /* PBXContainerItemProxy */; }; + 2291B6E418E4754D0004B79C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3104AFF1156D37A0000A585A /* all */; + targetProxy = 2291B6E518E4754D0004B79C /* PBXContainerItemProxy */; + }; 22B2BC3918B643AD00C33E63 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 31FCAE0917692403008C034C /* scheme */; @@ -4446,6 +4485,27 @@ }; name = Release; }; + 2291B6E818E4754D0004B79C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testall copy"; + }; + name = Debug; + }; + 2291B6E918E4754D0004B79C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testall copy"; + }; + name = Release; + }; + 2291B6EA18E4754D0004B79C /* RASH */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "testall copy"; + }; + name = RASH; + }; 22B2BC3318B6434F00C33E63 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -5652,6 +5712,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 2291B6E718E4754D0004B79C /* Build configuration list for PBXAggregateTarget "testansi" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2291B6E818E4754D0004B79C /* Debug */, + 2291B6E918E4754D0004B79C /* Release */, + 2291B6EA18E4754D0004B79C /* RASH */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 22B2BC3218B6434F00C33E63 /* Build configuration list for PBXNativeTarget "scheme-advanced" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/mps/tool/testcases.txt b/mps/tool/testcases.txt index 96d3a4d2cff..c60e79d8ccd 100644 --- a/mps/tool/testcases.txt +++ b/mps/tool/testcases.txt @@ -5,14 +5,14 @@ abqtest airtest amcss amcsshe -amcssth =B =X job003561, job003703 +amcssth =B =T =X job003561, job003703 amsss amssshe apss arenacv awlut awluthe -awlutth =X +awlutth =T =X btcv bttest =N interactive djbench =N benchmark @@ -25,7 +25,7 @@ fotest gcbench =N benchmark locbwcss lockcov -lockutw3 =W +lockutw3 =T =W locusss locv messtest @@ -40,7 +40,7 @@ segsmss steptest teletest =N interactive walkt0 -zcoll =B =L +zcoll =B =L job003658 zmess ============= ================ ========================================== @@ -50,5 +50,6 @@ Key to flags B -- known Bad L -- Long runtime N -- Not an automated test case + T -- multi-Threaded W -- Windows-only X -- Unix-only diff --git a/mps/tool/testrun.bat b/mps/tool/testrun.bat index 06f947a25e3..6b683762136 100755 --- a/mps/tool/testrun.bat +++ b/mps/tool/testrun.bat @@ -33,9 +33,10 @@ mkdir %LOGDIR% @rem Determine which tests to run. set EXCLUDE= -if "%TESTSUITE%"=="testrun" set EXCLUDE=LNX -if "%TESTSUITE%"=="testci" set EXCLUDE=BNX -if "%TESTSUITE%"=="testall" set EXCLUDE=NX +if "%TESTSUITE%"=="testrun" set EXCLUDE=LNX +if "%TESTSUITE%"=="testci" set EXCLUDE=BNX +if "%TESTSUITE%"=="testall" set EXCLUDE=NX +if "%TESTSUITE%"=="testansi" set EXCLUDE=LNTX @rem Ensure that test cases don't pop up dialog box on abort() set MPS_TESTLIB_NOABORT=true diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 35197dd879c..f5d54699cae 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -30,9 +30,10 @@ if [ $# -eq 1 ]; then TEST_SUITE=$1 echo "Test suite: $TEST_SUITE" case $TEST_SUITE in - testrun) EXCLUDE="LNW" ;; - testci) EXCLUDE="BNW" ;; - testall) EXCLUDE="NW" ;; + testrun) EXCLUDE="LNW" ;; + testci) EXCLUDE="BNW" ;; + testall) EXCLUDE="NW" ;; + testansi) EXCLUDE="LNTW" ;; *) echo "Test suite $TEST_SUITE not recognized." exit 1 ;; From efc5ce771b01419b3c7c3bf368ace78164f923af Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 15:38:39 +0000 Subject: [PATCH 18/93] Reduce busyness of the diff by restoring the order. Copied from Perforce Change: 185052 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index e77813f19d5..448a0219681 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -74,7 +74,7 @@ test-make-build: $(MAKE) $(TARGET_OPTS) testci test-xcode-build: - $(XCODEBUILD) -config Debug -target testci $(XCODEBUILD) -config Release -target testci + $(XCODEBUILD) -config Debug -target testci test: @TEST_TARGET@ From ad72ec24c830193fe04a8157f2ab3d398f34c1a5 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 15:57:34 +0000 Subject: [PATCH 19/93] Remove comment from rb "the thread_single and protection_none build configs aren't regularly tested, though they might well be useful for embedded custom targets. should test them." -- this configuration is now tested by "make test" on the linux and freebsd platforms. Copied from Perforce Change: 185054 ServerID: perforce.ravenbrook.com --- mps/code/global.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mps/code/global.c b/mps/code/global.c index 0bf481cb136..2dfda251f91 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -509,10 +509,6 @@ Ring GlobalsRememberedSummaryRing(Globals global) /* ArenaEnter -- enter the state where you can look at the arena */ -/* TODO: The THREAD_SINGLE and PROTECTION_NONE build configs aren't regularly - tested, though they might well be useful for embedded custom targets. - Should test them. RB 2012-09-03 */ - #if defined(THREAD_SINGLE) && defined(PROTECTION_NONE) void (ArenaEnter)(Arena arena) { From 443288ef61bd7a2a93dc553dc01428552a7b9ee5 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 17:47:15 +0000 Subject: [PATCH 20/93] Variable "base" no longer needed for passing to segnext, so remove it. Copied from Perforce Change: 185056 ServerID: perforce.ravenbrook.com --- mps/code/protan.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mps/code/protan.c b/mps/code/protan.c index b9fb46e7062..86afa645e63 100644 --- a/mps/code/protan.c +++ b/mps/code/protan.c @@ -50,9 +50,7 @@ void ProtSync(Arena arena) synced = TRUE; if (SegFirst(&seg, arena)) { - Addr base; do { - base = SegBase(seg); if (SegPM(seg) != AccessSetEMPTY) { /* */ ShieldEnter(arena); TraceSegAccess(arena, seg, SegPM(seg)); From fb0e42f6003729e7f75783280ac12cc65227396d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 20:41:31 +0000 Subject: [PATCH 21/93] Mark amsss and amssshe as bad because of job001549. Copied from Perforce Change: 185061 ServerID: perforce.ravenbrook.com --- mps/tool/testcases.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mps/tool/testcases.txt b/mps/tool/testcases.txt index 147ea76d3f9..29ed3667809 100644 --- a/mps/tool/testcases.txt +++ b/mps/tool/testcases.txt @@ -6,8 +6,8 @@ airtest amcss amcsshe amcssth =B =T =X job003561, job003703 -amsss -amssshe +amsss =B job001549 +amssshe =B job001549 apss arenacv awlut From 3896c4bdb107e8ac03c61e318640aa503979334b Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 27 Mar 2014 20:42:12 +0000 Subject: [PATCH 22/93] Zcoll no longer bad. Copied from Perforce Change: 185062 ServerID: perforce.ravenbrook.com --- mps/tool/testcases.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/tool/testcases.txt b/mps/tool/testcases.txt index 29ed3667809..4d724705d63 100644 --- a/mps/tool/testcases.txt +++ b/mps/tool/testcases.txt @@ -40,7 +40,7 @@ segsmss steptest teletest =N interactive walkt0 -zcoll =L job003658 +zcoll =L zmess ============= ================ ========================================== From 58b712b9f072c5f5cb9e39cb89695906ca88ef70 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 31 Mar 2014 20:50:42 +0100 Subject: [PATCH 23/93] Uniquify the test log files so that you can run the same test case multiple times and still capture the output from each run. Copied from Perforce Change: 185114 ServerID: perforce.ravenbrook.com --- mps/tool/testrun.bat | 5 +++-- mps/tool/testrun.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mps/tool/testrun.bat b/mps/tool/testrun.bat index 6b683762136..5496ef5afea 100755 --- a/mps/tool/testrun.bat +++ b/mps/tool/testrun.bat @@ -68,13 +68,14 @@ if "%FAIL_COUNT%"=="0" ( :run_test set /a TEST_COUNT=%TEST_COUNT%+1 +set LOGTEST=%LOGDIR%\%TEST_COUNT%-%1 echo Running %1 -%PFM%\%VARIETY%\%1 > %LOGDIR%\%1 +%PFM%\%VARIETY%\%1 > %LOGTEST% if "%errorlevel%"=="0" ( set /a PASS_COUNT=%PASS_COUNT%+1 ) else ( echo %SEPARATOR%%SEPARATOR% - type %LOGDIR%\%1 + type %LOGTEST% echo %SEPARATOR%%SEPARATOR% set /a FAIL_COUNT=%FAIL_COUNT%+1 ) diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index f5d54699cae..87559faf1d4 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -52,7 +52,7 @@ PASS_COUNT=0 FAIL_COUNT=0 for TESTCASE in $TEST_CASES; do TEST="$(basename -- "$TESTCASE")" - LOGTEST="$LOGDIR/$TEST" + LOGTEST="$LOGDIR/$TEST_COUNT-$TEST" echo "Running $TEST" TEST_COUNT=$(expr $TEST_COUNT + 1) if "$TEST_DIR/$TESTCASE" > "$LOGTEST" 2>&1; then From 84cd92ab890337244f22ba1750907d2b2c8ccba9 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 2 Apr 2014 15:48:57 +0100 Subject: [PATCH 24/93] Improve clarity of product configuration so that names more explicitly indicate what they do: * CONFIG_POLL_NONE (because the user-visible consequence is that polling is no longer supported; was CONFIG_PROTECTION_NONE). * DISABLE_LOCKS (was THREAD_SINGLE). * DISABLE_SHIELD (was THREAD_SINGLE && PROTECTION_NONE) * DISABLE_REMEMBERED_SET (was PROTECTION_NONE) When the shield is disabled, ArenaLeave asserts that there are no busy traces, and ArenaPoll is a no-op. By having functions implemented using the corresponding macro, we can avoid duplicated code, and avoid testing DISABLE_SHIELD in global.c. Remove all remaining references to MPS_PROD_EPCORE. Copied from Perforce Change: 185176 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 2 +- mps/code/config.h | 26 +++++++----- mps/code/eventrep.c | 95 ------------------------------------------- mps/code/global.c | 38 +++-------------- mps/code/lock.h | 4 +- mps/code/mpm.h | 23 ++++++----- mps/code/protix.c | 3 -- mps/code/protli.c | 3 -- mps/code/protsgix.c | 3 -- mps/code/protw3.c | 3 -- mps/code/protxc.c | 3 -- mps/code/qs.c | 2 + mps/code/seg.c | 7 +++- mps/design/config.txt | 13 +++--- 14 files changed, 49 insertions(+), 176 deletions(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 448a0219681..950e2d353dc 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -69,7 +69,7 @@ install: @INSTALL_TARGET@ test-make-build: $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_PROTECTION_NONE" testansi + $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" testansi $(MAKE) clean $(MAKE) $(TARGET_OPTS) testci diff --git a/mps/code/config.h b/mps/code/config.h index a1ebc2e688a..702ed5a6723 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -172,22 +172,26 @@ */ #if defined(CONFIG_THREAD_SINGLE) -#define THREAD_SINGLE -#else -#define THREAD_MULTI +#define DISABLE_LOCKS #endif -/* CONFIG_PROTECTION_NONE -- no support for memory protection + +/* CONFIG_POLL_NONE -- no support for polling * - * This symbol causes the MPS to built for an environment where there - * is no memory protection, and so segment summaries cannot be - * maintained by seg.c. + * This symbol causes the MPS to built without support for polling. + * This means that the arena must be clamped or parked at all times, + * garbage collections can only be carried out explicitly via + * mps_arena_collect(), but it also means that protection is not + * needed, and so shield operations can be replaced with no-ops in + * mpm.h. */ -#if defined(CONFIG_PROTECTION_NONE) -#define PROTECTION_NONE -#else -#define PROTECTION +#if defined(CONFIG_POLL_NONE) +#if !defined(CONFIG_THREAD_SINGLE) +#error "CONFIG_POLL_NONE without CONFIG_THREAD_SINGLE" +#endif +#define DISABLE_REMEMBERED_SET +#define DISABLE_SHIELD #endif diff --git a/mps/code/eventrep.c b/mps/code/eventrep.c index c2f611f7070..f216e51c70a 100644 --- a/mps/code/eventrep.c +++ b/mps/code/eventrep.c @@ -142,37 +142,6 @@ static void error(const char *format, ...) MPS_BEGIN if (!(cond)) error("line %d " #cond, __LINE__); MPS_END -#ifdef MPS_PROD_EPCORE - - -/* ensurePSFormat -- return the PS format, creating it, if necessary */ - -static mps_fmt_t psFormat = NULL; - -static void ensurePSFormat(mps_fmt_t *fmtOut, mps_arena_t arena) -{ - mps_res_t eres; - - if (psFormat == NULL) { - eres = mps_fmt_create_A(&psFormat, arena, ps_fmt_A()); - verifyMPS(eres); - } - *fmtOut = psFormat; -} - - -/* finishPSFormat -- finish the PS format, if necessary */ - -static void finishPSFormat(void) -{ - if (psFormat != NULL) - mps_fmt_destroy(psFormat); -} - - -#endif - - /* objectTableCreate -- create an objectTable */ static objectTable objectTableCreate(poolSupport support) @@ -417,10 +386,6 @@ void EventReplay(Event event, Word etime) case EventArenaDestroy: { /* arena */ found = TableLookup(&entry, arenaTable, (Word)event->p.p0); verify(found); -#ifdef MPS_PROD_EPCORE - /* @@@@ assuming there's only one arena at a time */ - finishPSFormat(); -#endif mps_arena_destroy((mps_arena_t)entry); ires = TableRemove(arenaTable, (Word)event->pw.p0); verify(ires == ResOK); @@ -455,30 +420,6 @@ void EventReplay(Event event, Word etime) /* all internal only */ ++discardedEvents; } break; -#ifdef MPS_PROD_EPCORE - case EventPoolInitEPVM: { - /* pool, arena, format, maxSaveLevel, saveLevel */ - mps_arena_t arena; - mps_fmt_t format; - - found = TableLookup(&entry, arenaTable, (Word)event->pppuu.p1); - verify(found); - arena = (mps_arena_t)entry; - ensurePSFormat(&format, arena); /* We know what the format is. */ - poolRecreate(event->pppuu.p0, event->pppuu.p1, - mps_class_epvm(), supportNothing, 2, format, - (mps_epvm_save_level_t)event->pppuu.u3, - (mps_epvm_save_level_t)event->pppuu.u4); - } break; - case EventPoolInitEPDL: { - /* pool, arena, isEPDL, extendBy, avgSize, align */ - poolRecreate(event->ppuwww.p0, event->ppuwww.p1, - event->ppuwww.u2 ? mps_class_epdl() : mps_class_epdr(), - event->ppuwww.u2 ? supportTruncate : supportFree, 0, - (size_t)event->ppuwww.w3, (size_t)event->ppuwww.w4, - (size_t)event->ppuwww.w5); - } break; -#endif case EventPoolFinish: { /* pool */ found = TableLookup(&entry, poolTable, (Word)event->p.p0); if (found) { @@ -541,22 +482,6 @@ void EventReplay(Event event, Word etime) ++discardedEvents; } } break; -#ifdef MPS_PROD_EPCORE - case EventBufferInitEPVM: { /* buffer, pool, isObj */ - found = TableLookup(&entry, poolTable, (Word)event->ppu.p1); - if (found) { - poolRep rep = (poolRep)entry; - - if(rep->bufferClassLevel == 2) { /* see .bufclass */ - apRecreate(event->ppu.p0, event->ppu.p1, (mps_bool_t)event->ppu.u2); - } else { - ++discardedEvents; - } - } else { - ++discardedEvents; - } - } break; -#endif case EventBufferFinish: { /* buffer */ found = TableLookup(&entry, apTable, (Word)event->p.p0); if (found) { @@ -619,26 +544,6 @@ void EventReplay(Event event, Word etime) ++discardedEvents; } } break; -#ifdef MPS_PROD_EPCORE - case EventPoolPush: { /* pool */ - found = TableLookup(&entry, poolTable, (Word)event->p.p0); - if (found) { - poolRep rep = (poolRep)entry; - - /* It must be EPVM. */ - mps_epvm_save(rep->pool); - } - } break; - case EventPoolPop: { /* pool, level */ - found = TableLookup(&entry, poolTable, (Word)event->pu.p0); - if (found) { - poolRep rep = (poolRep)entry; - - /* It must be EPVM. */ - mps_epvm_restore(rep->pool, (mps_epvm_save_level_t)event->pu.u1); - } - } break; -#endif case EventCommitLimitSet: { /* arena, limit, succeeded */ found = TableLookup(&entry, arenaTable, (Word)event->pwu.p0); verify(found); diff --git a/mps/code/global.c b/mps/code/global.c index 2dfda251f91..bfc2777d888 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -37,10 +37,6 @@ static Bool arenaRingInit = FALSE; static RingStruct arenaRing; /* */ static Serial arenaSerial; /* */ -/* forward declarations */ -void arenaEnterLock(Arena, int); -void arenaLeaveLock(Arena, int); - /* arenaClaimRingLock, arenaReleaseRingLock -- lock/release the arena ring * @@ -509,22 +505,15 @@ Ring GlobalsRememberedSummaryRing(Globals global) /* ArenaEnter -- enter the state where you can look at the arena */ -#if defined(THREAD_SINGLE) && defined(PROTECTION_NONE) void (ArenaEnter)(Arena arena) { - /* Don't need to lock, just check. */ AVERT(Arena, arena); + ArenaEnter(arena); } -#else -void ArenaEnter(Arena arena) -{ - arenaEnterLock(arena, 0); -} -#endif /* The recursive argument specifies whether to claim the lock recursively or not. */ -void arenaEnterLock(Arena arena, int recursive) +void ArenaEnterLock(Arena arena, Bool recursive) { Lock lock; @@ -559,25 +548,18 @@ void arenaEnterLock(Arena arena, int recursive) void ArenaEnterRecursive(Arena arena) { - arenaEnterLock(arena, 1); + ArenaEnterLock(arena, TRUE); } /* ArenaLeave -- leave the state where you can look at MPM data structures */ -#if defined(THREAD_SINGLE) && defined(PROTECTION_NONE) void (ArenaLeave)(Arena arena) { - /* Don't need to lock, just check. */ AVERT(Arena, arena); + ArenaLeave(arena); } -#else -void ArenaLeave(Arena arena) -{ - arenaLeaveLock(arena, 0); -} -#endif -void arenaLeaveLock(Arena arena, int recursive) +void ArenaLeaveLock(Arena arena, Bool recursive) { Lock lock; @@ -601,7 +583,7 @@ void arenaLeaveLock(Arena arena, int recursive) void ArenaLeaveRecursive(Arena arena) { - arenaLeaveLock(arena, 1); + ArenaLeaveLock(arena, TRUE); } /* mps_exception_info -- pointer to exception info @@ -701,14 +683,7 @@ Bool ArenaAccess(Addr addr, AccessSet mode, MutatorFaultContext context) * series of manual steps for looking around. This might be worthwhile * if we introduce background activities other than tracing. */ -#ifdef MPS_PROD_EPCORE void (ArenaPoll)(Globals globals) -{ - /* Don't poll, just check. */ - AVERT(Globals, globals); -} -#else -void ArenaPoll(Globals globals) { Arena arena; Clock start; @@ -763,7 +738,6 @@ void ArenaPoll(Globals globals) globals->insidePoll = FALSE; } -#endif /* Work out whether we have enough time here to collect the world, * and whether much time has passed since the last time we did that diff --git a/mps/code/lock.h b/mps/code/lock.h index 5faddfa05b8..5f0cadd7065 100644 --- a/mps/code/lock.h +++ b/mps/code/lock.h @@ -195,7 +195,7 @@ extern void LockClaimGlobal(void); extern void LockReleaseGlobal(void); -#ifdef THREAD_SINGLE +#ifdef DISABLE_LOCKS #define LockSize() MPS_PF_ALIGN #define LockInit(lock) UNUSED(lock) @@ -210,7 +210,7 @@ extern void LockReleaseGlobal(void); #define LockClaimGlobal() #define LockReleaseGlobal() -#endif /* THREAD_SINGLE */ +#endif /* DISABLE_LOCKS */ #endif /* lock_h */ diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 46dcd74b880..165d2c3b7ce 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -514,24 +514,25 @@ extern Ring GlobalsRememberedSummaryRing(Globals); #define ArenaGreyRing(arena, rank) (&(arena)->greyRing[rank]) #define ArenaPoolRing(arena) (&ArenaGlobals(arena)->poolRing) +extern void ArenaEnterLock(Arena arena, Bool recursive); +extern void ArenaLeaveLock(Arena arena, Bool recursive); + extern void (ArenaEnter)(Arena arena); extern void (ArenaLeave)(Arena arena); +extern void (ArenaPoll)(Globals globals); -#if defined(THREAD_SINGLE) && defined(PROTECTION_NONE) +#ifdef DISABLE_SHIELD #define ArenaEnter(arena) UNUSED(arena) -#define ArenaLeave(arena) UNUSED(arena) +#define ArenaLeave(arena) AVER(arena->busyTraces == TraceSetEMPTY) +#define ArenaPoll(globals) UNUSED(globals) +#else +#define ArenaEnter(arena) ArenaEnterLock(arena) +#define ArenaLeave(arena) ArenaLeaveLock(arena) #endif extern void ArenaEnterRecursive(Arena arena); extern void ArenaLeaveRecursive(Arena arena); -extern void (ArenaPoll)(Globals globals); -#ifdef MPS_PROD_EPCORE -#define ArenaPoll(globals) UNUSED(globals) -#endif -/* .nogc.why: ScriptWorks doesn't use MM-provided incremental GC, so */ -/* doesn't need to poll when allocating. */ - extern Bool (ArenaStep)(Globals globals, double interval, double multiplier); extern void ArenaClamp(Globals globals); extern void ArenaRelease(Globals globals); @@ -888,7 +889,7 @@ extern void (ShieldSuspend)(Arena arena); extern void (ShieldResume)(Arena arena); extern void (ShieldFlush)(Arena arena); -#if defined(THREAD_SINGLE) && defined(PROTECTION_NONE) +#ifdef DISABLE_SHIELD #define ShieldRaise(arena, seg, mode) \ BEGIN UNUSED(arena); UNUSED(seg); UNUSED(mode); END #define ShieldLower(arena, seg, mode) \ @@ -902,7 +903,7 @@ extern void (ShieldFlush)(Arena arena); #define ShieldSuspend(arena) BEGIN UNUSED(arena); END #define ShieldResume(arena) BEGIN UNUSED(arena); END #define ShieldFlush(arena) BEGIN UNUSED(arena); END -#endif +#endif /* DISABLE_SHIELD */ /* Protection Interface diff --git a/mps/code/protix.c b/mps/code/protix.c index 31c272bc5b9..e79972af9e6 100644 --- a/mps/code/protix.c +++ b/mps/code/protix.c @@ -44,9 +44,6 @@ #if !defined(MPS_OS_LI) && !defined(MPS_OS_FR) && !defined(MPS_OS_XC) #error "protix.c is Unix-specific, currently for MPS_OS_LI FR XC" #endif -#ifndef PROTECTION -#error "protix.c implements protection, but PROTECTION is not set" -#endif #include #include diff --git a/mps/code/protli.c b/mps/code/protli.c index ba48cab7f51..dc38154f2b7 100644 --- a/mps/code/protli.c +++ b/mps/code/protli.c @@ -16,9 +16,6 @@ #ifndef MPS_OS_LI #error "protli.c is Linux-specific, but MPS_OS_LI is not set" #endif -#ifndef PROTECTION -#error "protli.c implements protection, but PROTECTION is not set" -#endif #include #include diff --git a/mps/code/protsgix.c b/mps/code/protsgix.c index 39f19c90b4c..e587ac86424 100644 --- a/mps/code/protsgix.c +++ b/mps/code/protsgix.c @@ -24,9 +24,6 @@ #if defined(MPS_OS_XC) && defined(MPS_ARCH_PP) #error "protsgix.c does not work on Darwin on PowerPC. Use protxcpp.c" #endif -#ifndef PROTECTION -#error "protsgix.c implements protection, but PROTECTION is not set" -#endif #include /* for many functions */ #include /* for getpid */ diff --git a/mps/code/protw3.c b/mps/code/protw3.c index 37d886644f6..6ebd38d6e50 100644 --- a/mps/code/protw3.c +++ b/mps/code/protw3.c @@ -12,9 +12,6 @@ #ifndef MPS_OS_W3 #error "protw3.c is Win32-specific, but MPS_OS_W3 is not set" #endif -#ifndef PROTECTION -#error "protw3.c implements protection, but PROTECTION is not set" -#endif #include "mpswin.h" diff --git a/mps/code/protxc.c b/mps/code/protxc.c index 8f62bb3a5df..62ade6ed81b 100644 --- a/mps/code/protxc.c +++ b/mps/code/protxc.c @@ -76,9 +76,6 @@ #if !defined(MPS_OS_XC) #error "protxc.c is OS X specific" #endif -#if !defined(PROTECTION) -#error "protxc.c implements protection, but PROTECTION is not defined" -#endif SRCID(protxc, "$Id$"); diff --git a/mps/code/qs.c b/mps/code/qs.c index 40e290dceec..9f6e97a9972 100644 --- a/mps/code/qs.c +++ b/mps/code/qs.c @@ -532,6 +532,8 @@ int main(int argc, char *argv[]) die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); + mps_arena_spare_commit_limit_set(arena, 0); + mps_tramp(&r, &go, NULL, 0); mps_arena_destroy(arena); diff --git a/mps/code/seg.c b/mps/code/seg.c index 1ba5041d036..7e6ad00defa 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -309,7 +309,10 @@ void SegSetSummary(Seg seg, RefSet summary) AVERT(Seg, seg); AVER(summary == RefSetEMPTY || SegRankSet(seg) != RankSetEMPTY); -#ifdef PROTECTION_NONE +#ifdef DISABLE_REMEMBERED_SET + /* Without protection, we can't maintain the remembered set because + there are writes we don't know about. TODO: rethink this when + implementating control. */ summary = RefSetUNIV; #endif if (summary != SegSummary(seg)) @@ -324,7 +327,7 @@ void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary) AVERT(Seg, seg); AVER(RankSetCheck(rankSet)); -#ifdef PROTECTION_NONE +#ifdef DISABLE_REMEMBERED_SET if (rankSet != RankSetEMPTY) { summary = RefSetUNIV; } diff --git a/mps/design/config.txt b/mps/design/config.txt index c7184ab31ee..0bc7f71857b 100644 --- a/mps/design/config.txt +++ b/mps/design/config.txt @@ -539,13 +539,12 @@ _`.opt.thread`: ``CONFIG_THREAD_SINGLE`` causes the MPS to be built for single-threaded execution only, where locks are not needed and so lock operations can be defined as no-ops by ``lock.h``. -_`.opt.prot`: ``CONFIG_PROTECTION_NONE`` causes the MPS to be built -for an environment where there is no memory protection, and so segment summaries cannot be maintained by ``seg.c``. - -_`.opt.prot.thread`: If both ``CONFIG_THREAD_SINGLE`` and -``CONFIG_PROTECTION_NONE`` are defined, then the shield is not needed -and so shield operations can be defined as no-ops by ``mpm.h``. - +_`.opt.poll`: ``CONFIG_POLL_NONE`` causes the MPS to be built without +support for polling. This means that the arena must be clamped or +parked at all this, garbage collections can only be carried out +explicitly via ``mps_arena_collect()``, but it also means that +protection is not needed, and so shield operations can be replaced +with no-ops in ``mpm.h``. To document From 91427a8cfdef629b4701c954beafad7d03f89991 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 2 Apr 2014 15:50:18 +0100 Subject: [PATCH 25/93] We can't run the test cases yet with config_poll_none. Copied from Perforce Change: 185177 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 950e2d353dc..17bad3471c9 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -69,7 +69,7 @@ install: @INSTALL_TARGET@ test-make-build: $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" testansi + $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE" testansi $(MAKE) clean $(MAKE) $(TARGET_OPTS) testci From 43fc65b539a6432015df83e89c953cf46f2debab Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 2 Apr 2014 16:02:09 +0100 Subject: [PATCH 26/93] Oops: no need to set the spare commit limit here. Copied from Perforce Change: 185182 ServerID: perforce.ravenbrook.com --- mps/code/qs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mps/code/qs.c b/mps/code/qs.c index 9f6e97a9972..89f93fb2833 100644 --- a/mps/code/qs.c +++ b/mps/code/qs.c @@ -532,7 +532,6 @@ int main(int argc, char *argv[]) die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); - mps_arena_spare_commit_limit_set(arena, 0); mps_tramp(&r, &go, NULL, 0); mps_arena_destroy(arena); From 38eb93c97fc468559706d35638be31f819174a26 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 2 Apr 2014 16:53:46 +0100 Subject: [PATCH 27/93] Fix the build for the usual configuration (not disabled_shield). "make test" compiles the CONFIG_POLL_NONE configuration but doesn't run any test cases (not sure which ones are expected to pass yet). Copied from Perforce Change: 185188 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 4 +++- mps/code/mpm.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 17bad3471c9..4ecd4e90aea 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -68,10 +68,12 @@ make-install-dirs: install: @INSTALL_TARGET@ test-make-build: + $(MAKE) clean + $(MAKE) $(TARGET_OPTS) testci $(MAKE) clean $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE" testansi $(MAKE) clean - $(MAKE) $(TARGET_OPTS) testci + $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" # TODO: actually run some tests in this configuration test-xcode-build: $(XCODEBUILD) -config Release -target testci diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 165d2c3b7ce..3bbd71cbb23 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -526,8 +526,8 @@ extern void (ArenaPoll)(Globals globals); #define ArenaLeave(arena) AVER(arena->busyTraces == TraceSetEMPTY) #define ArenaPoll(globals) UNUSED(globals) #else -#define ArenaEnter(arena) ArenaEnterLock(arena) -#define ArenaLeave(arena) ArenaLeaveLock(arena) +#define ArenaEnter(arena) ArenaEnterLock(arena, FALSE) +#define ArenaLeave(arena) ArenaLeaveLock(arena, FALSE) #endif extern void ArenaEnterRecursive(Arena arena); From 7a520bcfca8dbf68902accaca37fbab96c7afa10 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 10 Apr 2014 12:22:12 +0100 Subject: [PATCH 28/93] Add tip about running the same test case many times. Copied from Perforce Change: 185420 ServerID: perforce.ravenbrook.com --- mps/tool/testrun.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 87559faf1d4..5950aa5d1e2 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -13,6 +13,14 @@ # Usage:: # # testrun.sh DIR ( SUITE | CASE1 CASE2 [...] ) +# +# You can use this feature to run the same test many times, to get +# lots of random coverage. For example:: +# +# yes amcss | head -100 | xargs tool/testrun.sh code/xc/Debug +# +# This runs the AMC stress test 100 times from the code/xc/Debug +# directory, reporting all failures. # Make a temporary output directory for the test logs. LOGDIR=$(mktemp -d /tmp/mps.log.XXXXXX) From b512c97d84fa9ea2f6b2e79b87539751e274f1da Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 16 Apr 2014 10:48:21 +0100 Subject: [PATCH 29/93] =?UTF-8?q?Use=20x=20and=20x=5Fnone=20for=20x=20?= =?UTF-8?q?=E2=88=88=20{lock,=20plinth,=20remembered=5Fset,=20shield}=20to?= =?UTF-8?q?=20match=20the=20other=20settings=20(aver=5Fand=5Fcheck,=20even?= =?UTF-8?q?t,=20statistics).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copied from Perforce Change: 185580 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 15 +++++++++++---- mps/code/lock.h | 10 ++++++---- mps/code/mpm.h | 16 +++++++++++----- mps/code/mps.c | 2 +- mps/code/seg.c | 9 +++++++-- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index 3e6158c1c7c..d68d1b52361 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -147,7 +147,9 @@ * cc -O2 -c -DCONFIG_PLINTH_NONE mps.c */ -#if defined(CONFIG_PLINTH_NONE) +#if !defined(CONFIG_PLINTH_NONE) +#define PLINTH +#else #define PLINTH_NONE #endif @@ -172,7 +174,9 @@ */ #if defined(CONFIG_THREAD_SINGLE) -#define DISABLE_LOCKS +#define LOCK +#else +#define LOCK_NONE #endif @@ -190,8 +194,11 @@ #if !defined(CONFIG_THREAD_SINGLE) #error "CONFIG_POLL_NONE without CONFIG_THREAD_SINGLE" #endif -#define DISABLE_REMEMBERED_SET -#define DISABLE_SHIELD +#define REMEMBERED_SET +#define SHIELD +#else +#define REMEMBERED_SET_NONE +#define SHIELD_NONE #endif diff --git a/mps/code/lock.h b/mps/code/lock.h index 5f0cadd7065..4fcd591a0f2 100644 --- a/mps/code/lock.h +++ b/mps/code/lock.h @@ -195,8 +195,9 @@ extern void LockClaimGlobal(void); extern void LockReleaseGlobal(void); -#ifdef DISABLE_LOCKS - +#if defined(LOCK) +/* Nothing to do: functions declared in all lock configurations. */ +#elif defined(LOCK_NONE) #define LockSize() MPS_PF_ALIGN #define LockInit(lock) UNUSED(lock) #define LockFinish(lock) UNUSED(lock) @@ -209,8 +210,9 @@ extern void LockReleaseGlobal(void); #define LockReleaseGlobalRecursive() #define LockClaimGlobal() #define LockReleaseGlobal() - -#endif /* DISABLE_LOCKS */ +#else +#error "No lock configuration." +#endif /* LOCK */ #endif /* lock_h */ diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 7876330de65..8c030acaa77 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -524,14 +524,16 @@ extern void (ArenaEnter)(Arena arena); extern void (ArenaLeave)(Arena arena); extern void (ArenaPoll)(Globals globals); -#ifdef DISABLE_SHIELD +#if defined(SHIELD) #define ArenaEnter(arena) UNUSED(arena) #define ArenaLeave(arena) AVER(arena->busyTraces == TraceSetEMPTY) #define ArenaPoll(globals) UNUSED(globals) -#else +#elif defined(SHIELD_NONE) #define ArenaEnter(arena) ArenaEnterLock(arena, FALSE) #define ArenaLeave(arena) ArenaLeaveLock(arena, FALSE) -#endif +#else +#error "No shield configuration." +#endif /* SHIELD */ extern void ArenaEnterRecursive(Arena arena); extern void ArenaLeaveRecursive(Arena arena); @@ -892,7 +894,9 @@ extern void (ShieldSuspend)(Arena arena); extern void (ShieldResume)(Arena arena); extern void (ShieldFlush)(Arena arena); -#ifdef DISABLE_SHIELD +#if defined(SHIELD) +/* Nothing to do: functions declared in all shield configurations. */ +#elif defined(SHIELD_NONE) #define ShieldRaise(arena, seg, mode) \ BEGIN UNUSED(arena); UNUSED(seg); UNUSED(mode); END #define ShieldLower(arena, seg, mode) \ @@ -906,7 +910,9 @@ extern void (ShieldFlush)(Arena arena); #define ShieldSuspend(arena) BEGIN UNUSED(arena); END #define ShieldResume(arena) BEGIN UNUSED(arena); END #define ShieldFlush(arena) BEGIN UNUSED(arena); END -#endif /* DISABLE_SHIELD */ +#else +#error "No shield configuration." +#endif /* SHIELD */ /* Protection Interface diff --git a/mps/code/mps.c b/mps/code/mps.c index 2125d2d4a3c..200f63e894c 100644 --- a/mps/code/mps.c +++ b/mps/code/mps.c @@ -91,7 +91,7 @@ /* ANSI Plinth */ -#if !defined(PLINTH_NONE) /* see CONFIG_PLINTH_NONE in config.h */ +#if defined(PLINTH) /* see CONFIG_PLINTH_NONE in config.h */ #include "mpsliban.c" #include "mpsioan.c" #endif diff --git a/mps/code/seg.c b/mps/code/seg.c index dea2b7d7ff7..62a7397dfeb 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -309,12 +309,17 @@ void SegSetSummary(Seg seg, RefSet summary) AVERT(Seg, seg); AVER(summary == RefSetEMPTY || SegRankSet(seg) != RankSetEMPTY); -#ifdef DISABLE_REMEMBERED_SET +#if defined(REMEMBERED_SET) +/* Nothing to do. */ +#elif defined(REMEMBERED_SET_NONE) /* Without protection, we can't maintain the remembered set because there are writes we don't know about. TODO: rethink this when implementating control. */ summary = RefSetUNIV; -#endif +#else +#error "No remembered set configuration." +#endif /* REMEMBERED_SET */ + if (summary != SegSummary(seg)) seg->class->setSummary(seg, summary); } From 63b095ce4dabb5557816931bf23416ac5eca88ab Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 16 Apr 2014 10:55:39 +0100 Subject: [PATCH 30/93] Oops: sense of test was wrong way round. Copied from Perforce Change: 185581 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 10 +++++----- mps/code/mpm.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index d68d1b52361..a4d8da21eb2 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -173,7 +173,7 @@ * can be defined as no-ops by lock.h. */ -#if defined(CONFIG_THREAD_SINGLE) +#if !defined(CONFIG_THREAD_SINGLE) #define LOCK #else #define LOCK_NONE @@ -190,13 +190,13 @@ * mpm.h. */ -#if defined(CONFIG_POLL_NONE) -#if !defined(CONFIG_THREAD_SINGLE) -#error "CONFIG_POLL_NONE without CONFIG_THREAD_SINGLE" -#endif +#if !defined(CONFIG_POLL_NONE) #define REMEMBERED_SET #define SHIELD #else +#if !defined(CONFIG_THREAD_SINGLE) +#error "CONFIG_POLL_NONE without CONFIG_THREAD_SINGLE" +#endif #define REMEMBERED_SET_NONE #define SHIELD_NONE #endif diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 8c030acaa77..8ed0d6aa608 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -525,12 +525,12 @@ extern void (ArenaLeave)(Arena arena); extern void (ArenaPoll)(Globals globals); #if defined(SHIELD) +#define ArenaEnter(arena) ArenaEnterLock(arena, FALSE) +#define ArenaLeave(arena) ArenaLeaveLock(arena, FALSE) +#elif defined(SHIELD_NONE) #define ArenaEnter(arena) UNUSED(arena) #define ArenaLeave(arena) AVER(arena->busyTraces == TraceSetEMPTY) #define ArenaPoll(globals) UNUSED(globals) -#elif defined(SHIELD_NONE) -#define ArenaEnter(arena) ArenaEnterLock(arena, FALSE) -#define ArenaLeave(arena) ArenaLeaveLock(arena, FALSE) #else #error "No shield configuration." #endif /* SHIELD */ From 748416c6930a75981ba5762dd00acb0b3b744c13 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 17 Apr 2014 18:03:18 +0100 Subject: [PATCH 31/93] Test script that clones and builds emscripten. Copied from Perforce Change: 185642 ServerID: perforce.ravenbrook.com --- mps/tool/testemscripten | 137 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100755 mps/tool/testemscripten diff --git a/mps/tool/testemscripten b/mps/tool/testemscripten new file mode 100755 index 00000000000..4639e9e69a4 --- /dev/null +++ b/mps/tool/testemscripten @@ -0,0 +1,137 @@ +#!/bin/sh +# +# Ravenbrook +# +# +# TESTEMSCRIPTEN -- TEST THE MPS WITH EMSCRIPTEN +# +# Gareth Rees, Ravenbrook Limited, 2014-04-17 +# +# +# 1. INTRODUCTION +# +# This shell script pulls Emscripten from GitHub and uses it to build +# the MPS. +# +# Supported platforms: ?. +# +# +# 1.1. PREREQUISITES +# +# clang, curl, git, nodejs +# +# "python" needs to be Python 2 (otherwise configure fails), so you +# may need to run: +# +# port select --set python python27 +# +# You need to have a program "python2" on your path (which runs Python +# 2.7.3), so on OS X with MacPorts you need to run: +# +# ln -s /opt/local/bin/python2.7 /opt/local/bin/python2 + + +# 2. CONFIGURATION + +# Emscripten git repository +EMSCRIPTEN_REMOTE=https://github.com/kripken/emscripten.git + +# Fastcomp git repository +FASTCOMP_REMOTE=https://github.com/kripken/emscripten-fastcomp.git + +# Fastcomp clang git repository +CLANG_REMOTE=https://github.com/kripken/emscripten-fastcomp-clang + +# Directory to put everything in +TESTDIR="$PWD/.test" +mkdir -p -- "$TESTDIR" +cd -- "$TESTDIR" + + +# 3. UTILITIES + +# 3.1. checkout REPO REMOTE -- clone a git repository and pull + +checkout () { + REPO=$1 + REMOTE=$2 + if [ -d "$REPO" ]; then + echo "$REPO exists: skipping clone." + else + echo "cloning $REMOTE into $REPO." + git clone --recursive -- "$REMOTE" "$REPO" + fi + ( + cd -- "$REPO" + git pull + ) +} + + +# 4. PROCEDURE + +checkout emscripten "$EMSCRIPTEN_REMOTE" + + +# See [FASTCOMP]. + +checkout emscripten-fastcomp "$FASTCOMP_REMOTE" +( + cd emscripten-fastcomp + ( + cd tools + checkout clang "$CLANG_REMOTE"; + ) + mkdir -p build + ( + cd build + ../configure --enable-optimized --disable-assertions --enable-targets=host,js + make; + ) +) + + +# A. REFERENCES +# +# [EMPSCRIPTEN] "Emscripten SDK" +# +# +# [FASTCOMP] "LLVM Backend, aka fastcomp" +# +# +# +# B. DOCUMENT HISTORY +# +# 2014-04-17 GDR Created based on [EMSCRIPTEN] and [FASTCOMP]. +# +# +# C. COPYRIGHT AND LICENCE +# +# Copyright (c) 2014 Ravenbrook Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +# $Id$ From 7754224b53a323920c8a75f98614ed8896076444 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 11:08:23 +0100 Subject: [PATCH 32/93] No need for prod_checklevel_initial (was unused). Copied from Perforce Change: 185876 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 1 - 1 file changed, 1 deletion(-) diff --git a/mps/code/config.h b/mps/code/config.h index a4d8da21eb2..4a3595e1f17 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -585,7 +585,6 @@ #define MPS_PROD_STRING "mps" #define MPS_PROD_MPS -#define PROD_CHECKLEVEL_INITIAL CheckLevelSHALLOW /* TODO: This should be proportional to the memory usage of the MPS, not a constant. That will require design, and then some interface and From b6e8dddfccdde40c34206441559ce179fbdba8c6 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 15:07:00 +0100 Subject: [PATCH 33/93] Correct links to task branches. Copied from Perforce Change: 185895 ServerID: perforce.ravenbrook.com --- mps/tool/branch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/tool/branch b/mps/tool/branch index db54da83ce1..5a3b4d8652d 100755 --- a/mps/tool/branch +++ b/mps/tool/branch @@ -46,7 +46,7 @@ CHILD_RE = r'(?:{}|{})$'.format(TASK_BRANCH_RE, VERSION_BRANCH_RE) TASK_BRANCH_ENTRY = ''' - {date}/{task} + {date}/{task} Changes {desc_html} Active (diffs). From 0a4c4fcaa632a7aee58aff64e4836e3f3b9eb860 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 15:24:26 +0100 Subject: [PATCH 34/93] Fix problems identified by dl in . Copied from Perforce Change: 185897 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 2 +- mps/code/comm.gmk | 3 ++- mps/code/commpost.nmk | 4 ++-- mps/code/poolamc.c | 14 ++++++++++---- mps/code/seg.c | 10 +++++++--- mps/code/ssan.c | 2 ++ mps/design/config.txt | 9 ++++----- mps/tool/testcases.txt | 11 ++++++----- mps/tool/testrun.bat | 3 +++ mps/tool/testrun.sh | 1 + 10 files changed, 38 insertions(+), 21 deletions(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 4ecd4e90aea..4d4a7d43be7 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -73,7 +73,7 @@ test-make-build: $(MAKE) clean $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE" testansi $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" # TODO: actually run some tests in this configuration + $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" testpoll test-xcode-build: $(XCODEBUILD) -config Release -target testci diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 72615cc8417..589b6db40ba 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -288,8 +288,9 @@ all: $(ALL_TARGETS) # testci = continuous integration tests, must be known good # testall = all test cases, for ensuring quality of a release # testansi = tests that run on the generic ("ANSI") platform +# testpoll = tests that run on the generic platform with CONFIG_POLL_NONE -TEST_SUITES=testrun testci testall testansi +TEST_SUITES=testrun testci testall testansi testpoll $(addprefix $(PFM)/$(VARIETY)/,$(TEST_SUITES)): $(TEST_TARGETS) ../tool/testrun.sh "$(PFM)/$(VARIETY)" "$(notdir $@)" diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index 9c34bb18f9d..ca44c8a7db2 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -53,10 +53,10 @@ variety: $(PFM)\$(VARIETY)\$(TARGET) !ENDIF !ENDIF -# testrun testci testall testansi +# testrun testci testall testansi testpoll # Runs automated test cases. -testrun testci testall testansi: $(TEST_TARGETS) +testrun testci testall testansi testpoll: $(TEST_TARGETS) !IFDEF VARIETY ..\tool\testrun.bat $(PFM) $(VARIETY) $@ !ELSE diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index aeb04454efe..d62fd48b54a 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -1719,10 +1719,13 @@ static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) /* Since we're moving an object from one segment to another, */ /* union the greyness and the summaries together. */ grey = SegGrey(seg); - if(SegRankSet(seg) != RankSetEMPTY) /* not for AMCZ */ + if(SegRankSet(seg) != RankSetEMPTY) { /* not for AMCZ */ grey = TraceSetUnion(grey, ss->traces); + SegSetSummary(toSeg, RefSetUnion(SegSummary(toSeg), SegSummary(seg))); + } else { + AVER(SegRankSet(toSeg) == RankSetEMPTY); + } SegSetGrey(toSeg, TraceSetUnion(SegGrey(toSeg), grey)); - SegSetSummary(toSeg, RefSetUnion(SegSummary(toSeg), SegSummary(seg))); /* */ (void)AddrCopy(newRef, ref, length); /* .exposed.seg */ @@ -1867,10 +1870,13 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) /* Since we're moving an object from one segment to another, */ /* union the greyness and the summaries together. */ grey = SegGrey(seg); - if(SegRankSet(seg) != RankSetEMPTY) /* not for AMCZ */ + if(SegRankSet(seg) != RankSetEMPTY) { /* not for AMCZ */ grey = TraceSetUnion(grey, ss->traces); + SegSetSummary(toSeg, RefSetUnion(SegSummary(toSeg), SegSummary(seg))); + } else { + AVER(SegRankSet(toSeg) == RankSetEMPTY); + } SegSetGrey(toSeg, TraceSetUnion(SegGrey(toSeg), grey)); - SegSetSummary(toSeg, RefSetUnion(SegSummary(toSeg), SegSummary(seg))); /* */ (void)AddrCopy(newBase, AddrSub(ref, headerSize), length); /* .exposed.seg */ diff --git a/mps/code/seg.c b/mps/code/seg.c index 62a7397dfeb..2fb680c7094 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -310,7 +310,7 @@ void SegSetSummary(Seg seg, RefSet summary) AVER(summary == RefSetEMPTY || SegRankSet(seg) != RankSetEMPTY); #if defined(REMEMBERED_SET) -/* Nothing to do. */ + /* Nothing to do. */ #elif defined(REMEMBERED_SET_NONE) /* Without protection, we can't maintain the remembered set because there are writes we don't know about. TODO: rethink this when @@ -332,11 +332,15 @@ void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary) AVERT(Seg, seg); AVERT(RankSet, rankSet); -#ifdef DISABLE_REMEMBERED_SET +#if defined(REMEMBERED_SET) + /* Nothing to do. */ +#elif defined(REMEMBERED_SET_NONE) if (rankSet != RankSetEMPTY) { summary = RefSetUNIV; } -#endif +#else +#error "No remembered set configuration." +#endif /* REMEMBERED_SET */ seg->class->setRankSummary(seg, rankSet, summary); } diff --git a/mps/code/ssan.c b/mps/code/ssan.c index 603895dbf49..27233e7b9f6 100644 --- a/mps/code/ssan.c +++ b/mps/code/ssan.c @@ -33,6 +33,8 @@ Res StackScan(ScanState ss, Addr *stackBot) */ AVER(stackTop < (void *)stackBot); + (void)setjmp(jb); + return StackScanInner(ss, stackBot, stackTop, sizeof jb / sizeof(Addr*)); } diff --git a/mps/design/config.txt b/mps/design/config.txt index 0bc7f71857b..b99191d7ab6 100644 --- a/mps/design/config.txt +++ b/mps/design/config.txt @@ -540,11 +540,10 @@ for single-threaded execution only, where locks are not needed and so lock operations can be defined as no-ops by ``lock.h``. _`.opt.poll`: ``CONFIG_POLL_NONE`` causes the MPS to be built without -support for polling. This means that the arena must be clamped or -parked at all this, garbage collections can only be carried out -explicitly via ``mps_arena_collect()``, but it also means that -protection is not needed, and so shield operations can be replaced -with no-ops in ``mpm.h``. +support for polling. This means that garbage collections will only +happen if requested explicitly via ``mps_arena_collect()`` or +``mps_arena_step()``, but it also means that protection is not needed, +and so shield operations can be replaced with no-ops in ``mpm.h``. To document diff --git a/mps/tool/testcases.txt b/mps/tool/testcases.txt index e75de947f88..ba49ae6f717 100644 --- a/mps/tool/testcases.txt +++ b/mps/tool/testcases.txt @@ -3,9 +3,9 @@ Test case Flags Notes ============= ================ ========================================== abqtest airtest -amcss -amcsshe -amcssth =B =T job003561, job003703 +amcss =P +amcsshe =P +amcssth =B =P =T job003561, job003703 amsss =B job001549 amssshe =B job001549 apss @@ -16,10 +16,10 @@ awlutth =T btcv bttest =N interactive djbench =N benchmark -exposet0 +exposet0 =P expt825 fbmtest -finalcv +finalcv =P finaltest fotest gcbench =N benchmark @@ -50,6 +50,7 @@ Key to flags B -- known Bad L -- Long runtime N -- Not an automated test case + P -- relies on Polling T -- multi-Threaded W -- Windows-only X -- Unix-only diff --git a/mps/tool/testrun.bat b/mps/tool/testrun.bat index b8f7c89d314..2aaf8aa4956 100755 --- a/mps/tool/testrun.bat +++ b/mps/tool/testrun.bat @@ -15,6 +15,8 @@ @echo off @rem Find test case database in same directory as this script. +@rem The incantation %%~dpF% expands %%F to a drive letter and path only. +@rem See "help for" for more details. for %%F in ("%0") do set TEST_CASE_DB=%%~dpF%testcases.txt set PFM=%1 @@ -37,6 +39,7 @@ if "%TESTSUITE%"=="testrun" set EXCLUDE=LNX if "%TESTSUITE%"=="testci" set EXCLUDE=BNX if "%TESTSUITE%"=="testall" set EXCLUDE=NX if "%TESTSUITE%"=="testansi" set EXCLUDE=LNTX +if "%TESTSUITE%"=="testpoll" set EXCLUDE=LNPTX @rem Ensure that test cases don't pop up dialog box on abort() set MPS_TESTLIB_NOABORT=true diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 5950aa5d1e2..3d296a15513 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -42,6 +42,7 @@ if [ $# -eq 1 ]; then testci) EXCLUDE="BNW" ;; testall) EXCLUDE="NW" ;; testansi) EXCLUDE="LNTW" ;; + testpoll) EXCLUDE="LNPTW" ;; *) echo "Test suite $TEST_SUITE not recognized." exit 1 ;; From 99c5015438d2844293d32b21997bd74c89c9c8ba Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 16:06:40 +0100 Subject: [PATCH 35/93] Use variety=cool to get more checking. Copied from Perforce Change: 185900 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 4d4a7d43be7..aaab5a677f2 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -31,7 +31,7 @@ install-make-build: make-install-dirs build-via-make $(INSTALL_DATA) code/mps*.h $(prefix)/include/ $(INSTALL_DATA) code/$(MPS_TARGET_NAME)/cool/mps.a $(prefix)/lib/libmps-debug.a $(INSTALL_DATA) code/$(MPS_TARGET_NAME)/hot/mps.a $(prefix)/lib/libmps.a - $(INSTALL_PROGRAM) $(addprefix code/$(MPS_TARGET_NAME)/hot/Release/,$(EXTRA_TARGETS)) $(prefix)/bin + $(INSTALL_PROGRAM) $(addprefix code/$(MPS_TARGET_NAME)/hot/,$(EXTRA_TARGETS)) $(prefix)/bin build-via-xcode: $(XCODEBUILD) -config Release @@ -71,9 +71,9 @@ test-make-build: $(MAKE) clean $(MAKE) $(TARGET_OPTS) testci $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE" testansi + $(MAKE) $(TARGET_OPTS) VARIETY=cool CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE" testansi $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=hot CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" testpoll + $(MAKE) $(TARGET_OPTS) VARIETY=cool CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" testpoll test-xcode-build: $(XCODEBUILD) -config Release -target testci From 3bdf7fc87843d8f0b41b7fda0cf0982c83d9e543 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 16:29:42 +0100 Subject: [PATCH 36/93] All prottramp implementations are now the same, so there is no need for separate implementations. Copied from Perforce Change: 185901 ServerID: perforce.ravenbrook.com --- mps/code/mpm.h | 2 -- mps/code/mpsi.c | 2 +- mps/code/protan.c | 17 ++--------------- mps/code/protix.c | 23 ++--------------------- mps/code/protw3.c | 22 ++-------------------- mps/design/prot.txt | 4 ---- mps/design/protli.txt | 5 ----- mps/design/protsu.txt | 5 ----- 8 files changed, 7 insertions(+), 73 deletions(-) diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 0cbad2b0f1c..499ca555113 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -922,8 +922,6 @@ extern void (ShieldFlush)(Arena arena); extern void ProtSetup(void); extern void ProtSet(Addr base, Addr limit, AccessSet mode); -extern void ProtTramp(void **resultReturn, void *(*f)(void *, size_t), - void *p, size_t s); extern void ProtSync(Arena arena); extern Bool ProtCanStepInstruction(MutatorFaultContext context); extern Res ProtStepInstruction(MutatorFaultContext context); diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 3df0913df83..45ffff50166 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -1380,7 +1380,7 @@ void (mps_tramp)(void **r_o, AVER(FUNCHECK(f)); /* Can't check p and s as they are interpreted by the client */ - ProtTramp(r_o, f, p, s); + *r_o = (*f)(p, s); } diff --git a/mps/code/protan.c b/mps/code/protan.c index 51b2edd6df8..3709e88be59 100644 --- a/mps/code/protan.c +++ b/mps/code/protan.c @@ -1,7 +1,7 @@ /* protan.c: ANSI MEMORY PROTECTION * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * * DESIGN @@ -65,22 +65,9 @@ void ProtSync(Arena arena) } -/* ProtTramp -- protection trampoline */ - -void ProtTramp(void **rReturn, void *(*f)(void *, size_t), - void *p, size_t s) -{ - AVER(rReturn != NULL); - AVER(FUNCHECK(f)); - /* Can't check p and s as they are interpreted by the client */ - - *(rReturn) = (*(f))(p, s); -} - - /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2002 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/protix.c b/mps/code/protix.c index 31c272bc5b9..854bfc98174 100644 --- a/mps/code/protix.c +++ b/mps/code/protix.c @@ -1,7 +1,7 @@ /* protix.c: PROTECTION FOR UNIX * * $Id$ - * Copyright (c) 2001,2007 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * Somewhat generic across different Unix systems. Shared between * Darwin (OS X), FreeBSD, and Linux. @@ -114,28 +114,9 @@ void ProtSync(Arena arena) } -/* ProtTramp -- protection trampoline - * - * The protection trampoline is trivial under Unix, as there is - * nothing that needs to be done in the dynamic context of the mutator in - * order to catch faults. (Contrast this with Win32 Structured Exception - * Handling.) - */ - -void ProtTramp(void **resultReturn, void *(*f)(void *, size_t), - void *p, size_t s) -{ - AVER(resultReturn != NULL); - AVER(FUNCHECK(f)); - /* Can't check p and s as they are interpreted by the client */ - - *resultReturn = (*f)(p, s); -} - - /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2007 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/protw3.c b/mps/code/protw3.c index 43e0522c074..84ef680ffb9 100644 --- a/mps/code/protw3.c +++ b/mps/code/protw3.c @@ -1,7 +1,7 @@ /* protw3.c: PROTECTION FOR WIN32 * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include "mpm.h" @@ -131,27 +131,9 @@ void ProtSync(Arena arena) } -/* ProtTramp -- wrap a mutator thread in a Structured Exception Handler filter - * - * This was the method by which we installed an exception handler on Windows - * prior to MPS 1.111. Now we are using Vectored Exception Handlers, so this - * is deprecated and just calls through to the mutator function. - */ - -void ProtTramp(void **resultReturn, void *(*f)(void *, size_t), - void *p, size_t s) -{ - AVER(resultReturn != NULL); - AVER(FUNCHECK(f)); - /* Can't check p and s as they are interpreted by the client */ - - *resultReturn = f(p, s); -} - - /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2002 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/design/prot.txt b/mps/design/prot.txt index a56e53db096..0d30017fede 100644 --- a/mps/design/prot.txt +++ b/mps/design/prot.txt @@ -47,10 +47,6 @@ forbidden. A request to forbid read accesses (that is, ``AccessREAD`` is set) may also forbid write accesses, but read accesses will not be forbidden unless ``AccessREAD`` is set. -``void ProtTramp(void **resultReturn, void *(*f)(void *, size_t), void *p, size_t s)`` - -_`.if.tramp`: [undocumented] - ``void ProtSync(Space space)`` _`.if.sync`: ``ProtSync()`` is called to ensure that the actual diff --git a/mps/design/protli.txt b/mps/design/protli.txt index a5cc1d57a15..9b0958ac191 100644 --- a/mps/design/protli.txt +++ b/mps/design/protli.txt @@ -88,11 +88,6 @@ underlying object). _`.fun.sync`: ``ProtSync()`` does nothing in this implementation as ``ProtSet()`` sets the protection without any delay. -_`.fun.tramp`: The protection trampoline, ``ProtTramp()``, is trivial -under Linux, as there is nothing that needs to be done in the dynamic -context of the mutator in order to catch faults. (Contrast this with -Win32 Structured Exception Handling.) - Threads ------- diff --git a/mps/design/protsu.txt b/mps/design/protsu.txt index 616d9134c88..1bd57e1004a 100644 --- a/mps/design/protsu.txt +++ b/mps/design/protsu.txt @@ -110,11 +110,6 @@ access that is compatible with the access of the underlying object). _`.fun.sync`: ``ProtSync()``. This does nothing in this implementation as ProtSet sets the protection without any delay. -_`.fun.tramp`: ``ProtTramp()``. The protection trampoline is trivial -under SunOS, as there is nothing that needs to be done in the dynamic -context of the mutator in order to catch faults. (Contrast this with -Win32 Structured Exception Handling.) - Document History ---------------- From f5212b5129f605a428bccc9edc3daee21268864f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 16:30:01 +0100 Subject: [PATCH 37/93] Update comment to match design. Copied from Perforce Change: 185902 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index 4a3595e1f17..d304d57a87a 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -183,11 +183,10 @@ /* CONFIG_POLL_NONE -- no support for polling * * This symbol causes the MPS to built without support for polling. - * This means that the arena must be clamped or parked at all times, - * garbage collections can only be carried out explicitly via - * mps_arena_collect(), but it also means that protection is not - * needed, and so shield operations can be replaced with no-ops in - * mpm.h. + * This means that garbage collections will only happen if requested + * explicitly via mps_arena_collect() or mps_arena_step(), but it also + * means that protection is not needed, and so shield operations can + * be replaced with no-ops in mpm.h. */ #if !defined(CONFIG_POLL_NONE) From de9b166661dae0d1452a1271611c2041d2934ca3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 17:00:11 +0100 Subject: [PATCH 38/93] Arenarelease now calls arenapoll (not tracepoll) so that it doesn't break in config_poll_none. Copied from Perforce Change: 185908 ServerID: perforce.ravenbrook.com --- mps/code/traceanc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/traceanc.c b/mps/code/traceanc.c index 675e18e1f95..8e0be12dac9 100644 --- a/mps/code/traceanc.c +++ b/mps/code/traceanc.c @@ -560,7 +560,7 @@ void ArenaRelease(Globals globals) AVERT(Globals, globals); arenaForgetProtection(globals); globals->clamped = FALSE; - (void)TracePoll(globals); + ArenaPoll(globals); } From 1e7cb5aa2f5a6a0f8cad38104fdad55c09f31c7d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 30 Apr 2014 17:38:51 +0100 Subject: [PATCH 39/93] Add testpoll on os x. Copied from Perforce Change: 185910 ServerID: perforce.ravenbrook.com --- mps/code/mps.xcodeproj/project.pbxproj | 94 ++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 12 deletions(-) diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index e5408fe2c93..4a1dc5ed506 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -17,7 +17,7 @@ 225F0AFD18E4453A003F2183 /* PBXTargetDependency */, ); name = testci; - productName = testrun; + productName = testci; }; 225F0B0418E44549003F2183 /* testall */ = { isa = PBXAggregateTarget; @@ -29,7 +29,7 @@ 225F0B0518E44549003F2183 /* PBXTargetDependency */, ); name = testall; - productName = testrun; + productName = testall; }; 2291B6E318E4754D0004B79C /* testansi */ = { isa = PBXAggregateTarget; @@ -41,7 +41,19 @@ 2291B6E418E4754D0004B79C /* PBXTargetDependency */, ); name = testansi; - productName = testrun; + productName = testansi; + }; + 22965BB219115D4600138A8F /* testpoll */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 22965BB619115D4600138A8F /* Build configuration list for PBXAggregateTarget "testpoll" */; + buildPhases = ( + 22965BB519115D4600138A8F /* ShellScript */, + ); + dependencies = ( + 22965BB319115D4600138A8F /* PBXTargetDependency */, + ); + name = testpoll; + productName = testpoll; }; 22CDE8EF16E9E97D00366D0A /* testrun */ = { isa = PBXAggregateTarget; @@ -442,6 +454,13 @@ remoteGlobalIDString = 3104AFF1156D37A0000A585A; remoteInfo = all; }; + 22965BB419115D4600138A8F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3104AFF1156D37A0000A585A; + remoteInfo = all; + }; 22B2BC3818B643AD00C33E63 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */; @@ -3372,6 +3391,7 @@ 225F0AFC18E4453A003F2183 /* testci */, 225F0B0418E44549003F2183 /* testall */, 2291B6E318E4754D0004B79C /* testansi */, + 22965BB219115D4600138A8F /* testpoll */, 31EEABFA156AAF9D00714D05 /* mps */, 3114A632156E94DB001E0AA3 /* abqtest */, 22FACEE018880983000FDBC1 /* airtest */, @@ -3466,6 +3486,20 @@ shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; showEnvVarsInLog = 0; }; + 22965BB519115D4600138A8F /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "../tool/testrun.sh \"$TARGET_BUILD_DIR\" \"$TARGET_NAME\""; + showEnvVarsInLog = 0; + }; 22CDE8F416E9E9D400366D0A /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -4063,6 +4097,11 @@ target = 3104AFF1156D37A0000A585A /* all */; targetProxy = 2291B6E518E4754D0004B79C /* PBXContainerItemProxy */; }; + 22965BB319115D4600138A8F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3104AFF1156D37A0000A585A /* all */; + targetProxy = 22965BB419115D4600138A8F /* PBXContainerItemProxy */; + }; 22B2BC3918B643AD00C33E63 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 31FCAE0917692403008C034C /* scheme */; @@ -4495,42 +4534,42 @@ 225F0B0118E4453A003F2183 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testrun copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 225F0B0218E4453A003F2183 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testrun copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 225F0B0318E4453A003F2183 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testrun copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; 225F0B0918E44549003F2183 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testrun copy copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 225F0B0A18E44549003F2183 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testrun copy copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 225F0B0B18E44549003F2183 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testrun copy copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -4579,21 +4618,42 @@ 2291B6E818E4754D0004B79C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testall copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 2291B6E918E4754D0004B79C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testall copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 2291B6EA18E4754D0004B79C /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = "testall copy"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = RASH; + }; + 22965BB719115D4600138A8F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 22965BB819115D4600138A8F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 22965BB919115D4600138A8F /* RASH */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -5819,6 +5879,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 22965BB619115D4600138A8F /* Build configuration list for PBXAggregateTarget "testpoll" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 22965BB719115D4600138A8F /* Debug */, + 22965BB819115D4600138A8F /* Release */, + 22965BB919115D4600138A8F /* RASH */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 22B2BC3218B6434F00C33E63 /* Build configuration list for PBXNativeTarget "scheme-advanced" */ = { isa = XCConfigurationList; buildConfigurations = ( From 7620c6fcd1a519c3c07d0ddfb18e2cea9eb6685a Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 1 May 2014 12:18:00 +0100 Subject: [PATCH 40/93] Fix rash build on os x by adding the unused attribute to functions declared static that are not called in the rash variety. Copied from Perforce Change: 185915 ServerID: perforce.ravenbrook.com --- mps/code/arenacl.c | 2 ++ mps/code/arenavm.c | 2 ++ mps/code/buffer.c | 1 + mps/code/cbs.c | 1 + mps/code/config.h | 9 +++++++++ mps/code/freelist.c | 5 +++-- mps/code/locus.c | 1 + mps/code/mpsi.c | 1 + mps/code/poolamc.c | 5 +++++ mps/code/poolawl.c | 2 ++ mps/code/poollo.c | 3 +++ mps/code/poolmrg.c | 4 ++++ mps/code/poolmv.c | 2 ++ mps/code/poolmv2.c | 1 + mps/code/poolmvff.c | 1 + mps/code/poolsnc.c | 3 +++ mps/code/reserv.c | 1 + mps/code/sac.c | 1 + mps/code/segsmss.c | 2 ++ mps/code/walk.c | 2 ++ 20 files changed, 47 insertions(+), 2 deletions(-) diff --git a/mps/code/arenacl.c b/mps/code/arenacl.c index 3d07f529779..1a0fcf3c6e3 100644 --- a/mps/code/arenacl.c +++ b/mps/code/arenacl.c @@ -61,6 +61,7 @@ typedef struct ClientChunkStruct { /* ClientChunkCheck -- check the consistency of a client chunk */ +ATTRIBUTE_UNUSED static Bool ClientChunkCheck(ClientChunk clChunk) { Chunk chunk; @@ -77,6 +78,7 @@ static Bool ClientChunkCheck(ClientChunk clChunk) /* ClientArenaCheck -- check the consistency of a client arena */ +ATTRIBUTE_UNUSED static Bool ClientArenaCheck(ClientArena clientArena) { CHECKS(ClientArena, clientArena); diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c index 81e0684c436..f878092bd01 100644 --- a/mps/code/arenavm.c +++ b/mps/code/arenavm.c @@ -93,6 +93,7 @@ static void VMCompact(Arena arena, Trace trace); /* VMChunkCheck -- check the consistency of a VM chunk */ +ATTRIBUTE_UNUSED static Bool VMChunkCheck(VMChunk vmchunk) { Chunk chunk; @@ -152,6 +153,7 @@ static Bool VMChunkCheck(VMChunk vmchunk) /* VMArenaCheck -- check the consistency of an arena structure */ +ATTRIBUTE_UNUSED static Bool VMArenaCheck(VMArena vmArena) { Arena arena; diff --git a/mps/code/buffer.c b/mps/code/buffer.c index bbae1f3eacd..a6cb2bee187 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -994,6 +994,7 @@ AllocPattern AllocPatternRampCollectAll(void) return &AllocPatternRampCollectAllStruct; } +ATTRIBUTE_UNUSED static Bool AllocPatternCheck(AllocPattern pattern) { CHECKL(pattern == &AllocPatternRampCollectAllStruct diff --git a/mps/code/cbs.c b/mps/code/cbs.c index 118d226a603..addebd398ad 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -80,6 +80,7 @@ Bool CBSCheck(CBS cbs) } +ATTRIBUTE_UNUSED static Bool CBSBlockCheck(CBSBlock block) { /* See .enter-leave.simple. */ diff --git a/mps/code/config.h b/mps/code/config.h index 0afa66c06bb..c07f646a0af 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -241,6 +241,15 @@ #define ATTRIBUTE_NORETURN #endif +/* Attribute for functions that may be unused in some build configurations. + * GCC: + */ +#if defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL) +#define ATTRIBUTE_UNUSED __attribute__((__unused__)) +#else +#define ATTRIBUTE_UNUSED +#endif + /* EPVMDefaultSubsequentSegSIZE is a default for the alignment of * subsequent segments (non-initial at each save level) in EPVM. See diff --git a/mps/code/freelist.c b/mps/code/freelist.c index 6260451ff59..1abc3f73cc8 100644 --- a/mps/code/freelist.c +++ b/mps/code/freelist.c @@ -1,7 +1,7 @@ /* freelist.c: FREE LIST ALLOCATOR IMPLEMENTATION * * $Id$ - * Copyright (c) 2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2013-2014 Ravenbrook Limited. See end of file for license. * * .sources: . */ @@ -60,6 +60,7 @@ static Addr FreelistBlockLimit(Freelist fl, FreelistBlock block) /* FreelistBlockCheck -- check a block. */ +ATTRIBUTE_UNUSED static Bool FreelistBlockCheck(FreelistBlock block) { CHECKL(block != NULL); @@ -626,7 +627,7 @@ void FreelistFlushToCBS(Freelist fl, CBS cbs) /* 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. * diff --git a/mps/code/locus.c b/mps/code/locus.c index 6e6e22128b7..10eae03840f 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -80,6 +80,7 @@ void SegPrefExpress(SegPref pref, SegPrefKind kind, void *p) /* GenDescCheck -- check a GenDesc */ +ATTRIBUTE_UNUSED static Bool GenDescCheck(GenDesc gen) { CHECKS(GenDesc, gen); diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 45ffff50166..f4e3f9e6f02 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -65,6 +65,7 @@ SRCID(mpsi, "$Id$"); * .check.enum.cast: enum comparisons have to be cast to avoid a warning * from the SunPro C compiler. See builder.sc.warn.enum. */ +ATTRIBUTE_UNUSED static Bool mpsi_check(void) { CHECKL(COMPATTYPE(mps_res_t, Res)); diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index aeb04454efe..6ae51fc4fe6 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -96,6 +96,7 @@ typedef struct amcSegStruct { #define amcSeg2Seg(amcseg) ((Seg)(amcseg)) +ATTRIBUTE_UNUSED static Bool amcSegCheck(amcSeg amcseg) { CHECKS(amcSeg, amcseg); @@ -475,6 +476,7 @@ typedef struct AMCStruct { /* */ /* amcGenCheck -- check consistency of a generation structure */ +ATTRIBUTE_UNUSED static Bool amcGenCheck(amcGen gen) { Arena arena; @@ -524,6 +526,7 @@ typedef struct amcBufStruct { /* amcBufCheck -- check consistency of an amcBuf */ +ATTRIBUTE_UNUSED static Bool amcBufCheck(amcBuf amcbuf) { CHECKS(amcBuf, amcbuf); @@ -2445,6 +2448,8 @@ void mps_amc_apply(mps_pool_t mps_pool, * * See . */ + +ATTRIBUTE_UNUSED static Bool AMCCheck(AMC amc) { CHECKS(AMC, amc); diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index cbece0b41fe..21edaaec1cb 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -131,6 +131,7 @@ typedef struct AWLSegStruct { extern SegClass AWLSegClassGet(void); +ATTRIBUTE_UNUSED static Bool AWLSegCheck(AWLSeg awlseg) { CHECKS(AWLSeg, awlseg); @@ -1299,6 +1300,7 @@ mps_class_t mps_class_awl(void) /* AWLCheck -- check an AWL pool */ +ATTRIBUTE_UNUSED static Bool AWLCheck(AWL awl) { CHECKS(AWL, awl); diff --git a/mps/code/poollo.c b/mps/code/poollo.c index d8f23584fba..3420e22b9ab 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -79,6 +79,7 @@ DEFINE_SEG_CLASS(LOSegClass, class) /* LOSegCheck -- check an LO segment */ +ATTRIBUTE_UNUSED static Bool LOSegCheck(LOSeg loseg) { CHECKS(LOSeg, loseg); @@ -184,6 +185,7 @@ static void loSegFinish(Seg seg) } +ATTRIBUTE_UNUSED static Count loSegBits(LOSeg loseg) { LO lo; @@ -805,6 +807,7 @@ mps_class_t mps_class_lo(void) /* LOCheck -- check an LO pool */ +ATTRIBUTE_UNUSED static Bool LOCheck(LO lo) { CHECKS(LO, lo); diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index 93d9f8bd25e..ace97865f1b 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -125,6 +125,7 @@ typedef struct MRGStruct { /* MRGCheck -- check an MRG pool */ +ATTRIBUTE_UNUSED static Bool MRGCheck(MRG mrg) { CHECKS(MRG, mrg); @@ -178,6 +179,8 @@ extern SegClass MRGRefSegClassGet(void); * field will be NULL. This will be initialized when the reference * segment is initialized. See . */ + +ATTRIBUTE_UNUSED static Bool MRGLinkSegCheck(MRGLinkSeg linkseg) { Seg seg; @@ -193,6 +196,7 @@ static Bool MRGLinkSegCheck(MRGLinkSeg linkseg) return TRUE; } +ATTRIBUTE_UNUSED static Bool MRGRefSegCheck(MRGRefSeg refseg) { Seg seg; diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 0ce4f28c95d..ccce962e42a 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -72,6 +72,7 @@ typedef struct MVBlockStruct { /* MVBlockCheck -- check the consistency of a block structure */ +ATTRIBUTE_UNUSED static Bool MVBlockCheck(MVBlock block) { AVER(block != NULL); @@ -130,6 +131,7 @@ typedef struct MVSpanStruct { /* MVSpanCheck -- check the consistency of a span structure */ +ATTRIBUTE_UNUSED static Bool MVSpanCheck(MVSpan span) { Addr addr, base, limit; diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index f6d85b1b134..b4ac6913fdf 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -356,6 +356,7 @@ failCBS: /* MVTCheck -- validate an MVT Pool */ +ATTRIBUTE_UNUSED static Bool MVTCheck(MVT mvt) { CHECKS(MVT, mvt); diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index 4971550c76a..3d569058697 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c @@ -791,6 +791,7 @@ size_t mps_mvff_size(mps_pool_t mps_pool) /* MVFFCheck -- check the consistency of an MVFF structure */ +ATTRIBUTE_UNUSED static Bool MVFFCheck(MVFF mvff) { CHECKS(MVFF, mvff); diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c index e9afe98a96b..139865fc5ec 100644 --- a/mps/code/poolsnc.c +++ b/mps/code/poolsnc.c @@ -84,6 +84,7 @@ typedef struct SNCBufStruct { /* SNCBufCheck -- check consistency of an SNCBuf */ +ATTRIBUTE_UNUSED static Bool SNCBufCheck(SNCBuf sncbuf) { SegBuf segbuf; @@ -214,6 +215,7 @@ typedef struct SNCSegStruct { #define sncSegSetNext(seg, nextseg) \ ((void)(SegSNCSeg(seg)->next = SegSNCSeg(nextseg))) +ATTRIBUTE_UNUSED static Bool SNCSegCheck(SNCSeg sncseg) { CHECKS(SNCSeg, sncseg); @@ -696,6 +698,7 @@ mps_class_t mps_class_snc(void) /* SNCCheck -- Check an SNC pool */ +ATTRIBUTE_UNUSED static Bool SNCCheck(SNC snc) { CHECKS(SNC, snc); diff --git a/mps/code/reserv.c b/mps/code/reserv.c index 02b18d66d88..c7dd0507482 100644 --- a/mps/code/reserv.c +++ b/mps/code/reserv.c @@ -107,6 +107,7 @@ Bool ReservoirCheck(Reservoir reservoir) /* reservoirIsConsistent -- returns FALSE if the reservoir is corrupt */ +ATTRIBUTE_UNUSED static Bool reservoirIsConsistent(Reservoir reservoir) { Size alignment, size = 0; diff --git a/mps/code/sac.c b/mps/code/sac.c index 3caf9ab893f..c85956c8f82 100644 --- a/mps/code/sac.c +++ b/mps/code/sac.c @@ -32,6 +32,7 @@ static Bool sacFreeListBlockCheck(SACFreeListBlock fb) return TRUE; } +ATTRIBUTE_UNUSED static Bool SACCheck(SAC sac) { Index i, j; diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 978c352e0dd..7efac5c64a5 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -59,6 +59,7 @@ typedef struct AMSTStruct *AMST; /* AMSTCheck -- the check method for an AMST */ +ATTRIBUTE_UNUSED static Bool AMSTCheck(AMST amst) { CHECKS(AMST, amst); @@ -96,6 +97,7 @@ typedef struct AMSTSegStruct { /* AMSTSegCheck -- check the AMST segment */ +ATTRIBUTE_UNUSED static Bool AMSTSegCheck(AMSTSeg amstseg) { CHECKS(AMSTSeg, amstseg); diff --git a/mps/code/walk.c b/mps/code/walk.c index 4dd0d6b9e98..544c9644498 100644 --- a/mps/code/walk.c +++ b/mps/code/walk.c @@ -26,6 +26,7 @@ typedef struct FormattedObjectsStepClosureStruct { } FormattedObjectsStepClosureStruct; +ATTRIBUTE_UNUSED static Bool FormattedObjectsStepClosureCheck(FormattedObjectsStepClosure c) { CHECKS(FormattedObjectsStepClosure, c); @@ -164,6 +165,7 @@ typedef struct rootsStepClosureStruct { /* rootsStepClosureCheck -- check a rootsStepClosure */ +ATTRIBUTE_UNUSED static Bool rootsStepClosureCheck(rootsStepClosure rsc) { CHECKS(rootsStepClosure, rsc); From f82973bf08dedb279415e315bdb152619e0da6ef Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 1 May 2014 12:21:17 +0100 Subject: [PATCH 41/93] Fix problems with the xcode project file (introduced in bad merges): * airtest got built as mv2test in the RASH config * airtest and nailboardtest got build with profiling in Debug config * airtest still had bogus WE config Copied from Perforce Change: 185916 ServerID: perforce.ravenbrook.com --- mps/code/mps.xcodeproj/project.pbxproj | 76 +++++++++----------------- 1 file changed, 25 insertions(+), 51 deletions(-) diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index 88f110bab01..29e47139571 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -2644,7 +2644,7 @@ 22FACEE118880983000FDBC1 /* PBXTargetDependency */, ); name = airtest; - productName = mv2test; + productName = airtest; productReference = 22FACEED18880983000FDBC1 /* airtest */; productType = "com.apple.product-type.tool"; }; @@ -4322,42 +4322,42 @@ 2231BB5618CA97D8002D6322 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = locbwcss; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 2231BB5718CA97D8002D6322 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = locbwcss; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 2231BB5818CA97D8002D6322 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = locbwcss; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; 2231BB6418CA97DC002D6322 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = locusss; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 2231BB6518CA97DC002D6322 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = locusss; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 2231BB6618CA97DC002D6322 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = locusss; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -4421,7 +4421,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = "scheme-advanced"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; @@ -4429,7 +4429,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = "scheme-advanced"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; @@ -4437,41 +4437,35 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = "scheme-advanced"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; 22C2ACA118BE3FEC006B3677 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = mv2test; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; 22C2ACAC18BE400A006B3677 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = YES; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; - PRODUCT_NAME = nailboardtest; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 22C2ACAD18BE400A006B3677 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; - PRODUCT_NAME = nailboardtest; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 22C2ACAE18BE400A006B3677 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; - PRODUCT_NAME = nailboardtest; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -4492,21 +4486,21 @@ 22F846BA18F437B900982BA7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = lockut; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 22F846BB18F437B900982BA7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = lockut; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 22F846BC18F437B900982BA7 /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = lockut; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -4527,30 +4521,17 @@ 22FACEEA18880983000FDBC1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = YES; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; - PRODUCT_NAME = airtest; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 22FACEEB18880983000FDBC1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; - PRODUCT_NAME = airtest; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; - 22FACEEC18880983000FDBC1 /* WE */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_GENERATE_TEST_COVERAGE_FILES = NO; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; - PRODUCT_NAME = airtest; - }; - name = WE; - }; 2D07B9751636FC9900DB751B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -4626,7 +4607,6 @@ 3104AFF3156D37A0000A585A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -4634,7 +4614,6 @@ 3104AFF4156D37A0000A585A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -4923,7 +4902,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = djbench; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; @@ -4931,7 +4910,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = djbench; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; @@ -4991,7 +4970,6 @@ 318DA8D51892C0D00089718C /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; @@ -5000,7 +4978,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -5285,7 +5262,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = djbench; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -5484,7 +5461,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -5494,7 +5470,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -5534,7 +5509,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = gcbench; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; @@ -5542,7 +5517,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = gcbench; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; @@ -5550,7 +5525,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = gcbench; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = RASH; }; @@ -5672,7 +5647,6 @@ buildConfigurations = ( 22FACEEA18880983000FDBC1 /* Debug */, 22FACEEB18880983000FDBC1 /* Release */, - 22FACEEC18880983000FDBC1 /* WE */, 22C2ACA118BE3FEC006B3677 /* RASH */, ); defaultConfigurationIsVisible = 0; From f8b0f015609e21596a221c8a640f8a370e6ce808 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 1 May 2014 15:51:26 +0100 Subject: [PATCH 42/93] Reorganize the mps branch index so that it contains a roughly prioritized list of branches that are ready for review. Copied from Perforce Change: 185920 ServerID: perforce.ravenbrook.com --- mps/tool/branch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/tool/branch b/mps/tool/branch index 5a3b4d8652d..bb54f0d4527 100755 --- a/mps/tool/branch +++ b/mps/tool/branch @@ -49,7 +49,7 @@ TASK_BRANCH_ENTRY = ''' {date}/{task} Changes {desc_html} - Active (diffs). + Diffs ''' From 58400fd7680ec12b4958cb1771eea2e6f7eae58e Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 1 May 2014 17:38:14 +0100 Subject: [PATCH 43/93] Add refsetsub assertion to the list of common assertions and their causes. Copied from Perforce Change: 185924 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/error.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mps/manual/source/topic/error.rst b/mps/manual/source/topic/error.rst index 6b2e9452fc2..fb55c9785f1 100644 --- a/mps/manual/source/topic/error.rst +++ b/mps/manual/source/topic/error.rst @@ -293,6 +293,16 @@ this documentation. condition? +``trace.c: RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg))`` + + The client program's :term:`scan method` failed to update a + reference to an object that moved. See + :ref:`topic-scanning-protocol`, which says, "If :c:func:`MPS_FIX2` + returns :c:macro:`MPS_RES_OK`, it may have updated the reference. + If necessary, make sure that the updated reference is stored back + to the region being scanned." + + .. index:: single: error handling; varieties single: variety From ef779449b4ff06fa1389a77eb9779e844f7b081f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 1 May 2014 18:02:53 +0100 Subject: [PATCH 44/93] Default value for mps_key_ams_support_ambiguous is now the safer value true. Copied from Perforce Change: 185927 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 2 +- mps/manual/source/pool/ams.rst | 12 ++++++------ mps/manual/source/release.rst | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index c07f646a0af..1dfd7858f86 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -290,7 +290,7 @@ /* Pool AMS Configuration -- see */ -#define AMS_SUPPORT_AMBIGUOUS_DEFAULT FALSE +#define AMS_SUPPORT_AMBIGUOUS_DEFAULT TRUE #define AMS_GEN_DEFAULT 0 diff --git a/mps/manual/source/pool/ams.rst b/mps/manual/source/pool/ams.rst index cb7966661a3..ae1d43f8bed 100644 --- a/mps/manual/source/pool/ams.rst +++ b/mps/manual/source/pool/ams.rst @@ -55,10 +55,11 @@ AMS properties never promoted out of the generation in which they are allocated. * Blocks may contain :term:`exact references` to blocks in the same or - other pools, or :term:`ambiguous references` (if the + other pools, or :term:`ambiguous references` (unless the :c:macro:`MPS_KEY_AMS_SUPPORT_AMBIGUOUS` keyword argument is set to - true when creating the pool). Blocks may not contain :term:`weak - references (1)`, and may not use :term:`remote references`. + ``FALSE`` when creating the pool). Blocks may not contain + :term:`weak references (1)`, and may not use :term:`remote + references`. * Allocations may be variable in size. @@ -126,14 +127,13 @@ AMS interface blocks remain in this generation and are not promoted. * :c:macro:`MPS_KEY_AMS_SUPPORT_AMBIGUOUS` (type - :c:type:`mps_bool_t`, default false) specifies whether references - may be ambiguous. + :c:type:`mps_bool_t`, default ``TRUE``) specifies whether + references to blocks in the pool may be ambiguous. For example:: MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); - MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, 1); res = mps_pool_create_k(&pool, arena, mps_class_ams(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/release.rst b/mps/manual/source/release.rst index 18cc8ed72e9..f9fc0054de5 100644 --- a/mps/manual/source/release.rst +++ b/mps/manual/source/release.rst @@ -35,6 +35,11 @@ Interface changes :c:func:`mps_arena_create_k` when creating a virtual memory arena. See :c:func:`mps_arena_class_vm`. +#. The keyword argument :c:macro:`MPS_KEY_AMS_SUPPORT_AMBIGUOUS` now + defaults to ``TRUE`` in order to better support the general case: + the value ``FALSE`` is appropriate only when you know that all + references are exact. See :ref:`pool-ams`. + Other changes ............. From a7e224e6633d59e34bb35e24e704fda9b722a2c0 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 1 May 2014 18:46:15 +0100 Subject: [PATCH 45/93] Update manual to describe new condemn logic resulting from fix for job003771. Copied from Perforce Change: 185929 ServerID: perforce.ravenbrook.com --- mps/manual/source/release.rst | 21 +++++++++++++++++++++ mps/manual/source/topic/collection.rst | 25 ++++++++++++------------- mps/manual/source/topic/pattern.rst | 16 ++++++++++++++-- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/mps/manual/source/release.rst b/mps/manual/source/release.rst index f9fc0054de5..0ac53f9020a 100644 --- a/mps/manual/source/release.rst +++ b/mps/manual/source/release.rst @@ -26,6 +26,20 @@ New features :c:macro:`MPS_KEY_INTERIOR` keyword argument to ``FALSE`` when calling :c:func:`mps_pool_create_k`. +#. The logic for deciding which generations should be collected has + changed. Now, a chain may be scheduled for collection if the new + size of *any* of its generations exceeds its capacity, and when a + chain is collected, all generations are collected up to, and + including, the highest generation whose new size exceeds its + capacity. This ensures that all generations are collected reliably + on chains where there is no allocation into the nursery generation. + See :ref:`topic-collection-schedule`. + + (Previously, only the nursery generation in each chain + was considered, and a chain was collected up to, but not including, + the lowest generation whose new size was within its capacity.) + + Interface changes ................. @@ -69,6 +83,13 @@ Other changes .. _job003756: https://www.ravenbrook.com/project/mps/issue/job003756/ +#. :ref:`pool-ams` pools get reliably collected, even in the case + where an AMS pool is the only pool on its generation chain and is + allocating into some generation other than the nursery. See + job003771_. + + .. _job003771: https://www.ravenbrook.com/project/mps/issue/job003771/ + .. _release-notes-1.113: diff --git a/mps/manual/source/topic/collection.rst b/mps/manual/source/topic/collection.rst index de5629e52d6..adf7c058e9e 100644 --- a/mps/manual/source/topic/collection.rst +++ b/mps/manual/source/topic/collection.rst @@ -57,9 +57,9 @@ Create a generation chain by preparing an array of kilobytes) and *predicted mortality* (between 0 and 1) of each generation, and passing them to :c:func:`mps_chain_create`. -When the size of the generation exceeds the capacity, the MPS will be -prepared to start collecting the generation. See -:ref:`topic-collection-schedule` below. +When the *new size* of a generation exceeds its capacity, the MPS will +be prepared to start collecting the chain to which the generation +belongs. See :ref:`topic-collection-schedule` below. For example:: @@ -163,20 +163,19 @@ size* of each generation (other than the topmost) is the same as its total size, but in pools like :ref:`pool-ams` where survivors do not get promoted, the two sizes can be different. -The first generation in a pool's chain is the :term:`nursery space`. -When the nursery's *new size* exceeds its capacity, the MPS considers -collecting the pool. (How long it takes to get around to it depends on -which other collections on other pools are in progress.) +When a generation's *new size* exceeds its capacity, the MPS considers +collecting the chain to which the generation belongs. (How long it +takes to get around to it depends on which other collections are in +progress.) .. note:: - You can affect the decision as to when to collect the nursery - space by using the :ref:`ramp allocation pattern - `. + You can affect the decision as to when to collect the chain by + using the :ref:`ramp allocation pattern `. -If the MPS decides to collect a pool at all, all generations are -collected below the first generation whose *new size* is less than its -capacity. +If the MPS decides to collect a chain, all generations are collected +up to, and including, the highest generation whose *new size* exceeds +its capacity. In pools such as :ref:`pool-amc`, blocks in generation *g* that survive collection get promoted to generation *g*\+1. If the last diff --git a/mps/manual/source/topic/pattern.rst b/mps/manual/source/topic/pattern.rst index 4d798c00b78..f460e019fba 100644 --- a/mps/manual/source/topic/pattern.rst +++ b/mps/manual/source/topic/pattern.rst @@ -110,10 +110,22 @@ cutoff and decline in the live size. This pattern is useful if you are building a structure that involves temporarily allocating much more memory than will fit into your -:term:`nursery generation`. The ramp allocation pattern causes the -collection of the nursery generation to be deferred until the ramp +:term:`nursery generation`. By applying the ramp allocation pattern, +the collection of that generation can be deferred until the ramp allocation is over. +In detail: if the ramp allocation pattern is applied to an +:term:`allocation point`, then allocation on that AP is ignored by the +MPS when it is deciding whether to schedule a collection of the chain +containing the generation into which the AP is allocating. See :ref:`topic-collection-schedule`. + +.. note:: + + This does not prevent the generation from being collected + altogether: there may be other APs allocating into the generation, + or the MPS may have to collect the generation in order to avoid + running out of memory. + .. note:: Ramp allocation is only supported by :ref:`pool-amc`. From e50f28afeba33ec206d4b60dc723c435000eee77 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 2 May 2014 11:34:38 +0100 Subject: [PATCH 46/93] The mps_args_add_field and mps_args_done now check that the number of arguments is in bounds. Copied from Perforce Change: 185938 ServerID: perforce.ravenbrook.com --- mps/code/airtest.c | 1 - mps/code/fmtscheme.c | 1 - mps/code/mps.h | 19 ++++++++++--------- mps/code/mpsi.c | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/mps/code/airtest.c b/mps/code/airtest.c index 56e1bd8c129..bf840957414 100644 --- a/mps/code/airtest.c +++ b/mps/code/airtest.c @@ -112,7 +112,6 @@ static void test_main(void *marker, int interior, int stack) MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt); MPS_ARGS_ADD(args, MPS_KEY_INTERIOR, interior); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&obj_pool, scheme_arena, mps_class_amc(), args), "mps_pool_create_k"); } MPS_ARGS_END(args); diff --git a/mps/code/fmtscheme.c b/mps/code/fmtscheme.c index 11900130a71..f43990ec619 100644 --- a/mps/code/fmtscheme.c +++ b/mps/code/fmtscheme.c @@ -452,7 +452,6 @@ void scheme_fmt(mps_fmt_t *fmt) 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(fmt, scheme_arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj format"); diff --git a/mps/code/mps.h b/mps/code/mps.h index b948a5f8d7d..18767cec60f 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -1,7 +1,7 @@ /* mps.h: RAVENBROOK MEMORY POOL SYSTEM C INTERFACE * * $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) 2002 Global Graphics Software. * * THIS HEADER IS NOT DOCUMENTATION. @@ -227,20 +227,22 @@ extern const struct mps_key_s _mps_key_fmt_class; /* Maximum length of a keyword argument list. */ #define MPS_ARGS_MAX 32 +extern void _mps_args_set_key(mps_arg_s args[MPS_ARGS_MAX], unsigned i, + mps_key_t key); + #define MPS_ARGS_BEGIN(_var) \ MPS_BEGIN \ mps_arg_s _var[MPS_ARGS_MAX]; \ unsigned _var##_i = 0; \ - _var[_var##_i].key = MPS_KEY_ARGS_END; \ + _mps_args_set_key(_var, _var##_i, MPS_KEY_ARGS_END); \ MPS_BEGIN #define MPS_ARGS_ADD_FIELD(_var, _key, _field, _val) \ MPS_BEGIN \ - /* TODO: AVER(_var##_i + 1 < MPS_ARGS_MAX); */ \ - _var[_var##_i].key = (_key); \ + _mps_args_set_key(_var, _var##_i, _key); \ _var[_var##_i].val._field = (_val); \ ++_var##_i; \ - _var[_var##_i].key = MPS_KEY_ARGS_END; \ + _mps_args_set_key(_var, _var##_i, MPS_KEY_ARGS_END); \ MPS_END #define MPS_ARGS_ADD(_var, _key, _val) \ @@ -248,9 +250,8 @@ extern const struct mps_key_s _mps_key_fmt_class; #define MPS_ARGS_DONE(_var) \ MPS_BEGIN \ - /* TODO: AVER(_var##_i < MPS_ARGS_MAX); */ \ - _var[_var##_i].key = MPS_KEY_ARGS_END; \ - /* TODO: _var##_i = MPS_ARGS_MAX; */ \ + _mps_args_set_key(_var, _var##_i, MPS_KEY_ARGS_END); \ + _var##_i = MPS_ARGS_MAX; \ MPS_END #define MPS_ARGS_END(_var) \ @@ -812,7 +813,7 @@ extern mps_res_t _mps_fix2(mps_ss_t, mps_addr_t *); /* 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/mpsi.c b/mps/code/mpsi.c index f4e3f9e6f02..0573a6d4256 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -1929,6 +1929,24 @@ void mps_chain_destroy(mps_chain_t chain) } +/* _mps_args_set_key -- set the key for a keyword argument + * + * This sets the key for the i'th keyword argument in the array args, + * with bounds checking on i. It is used by the MPS_ARGS_BEGIN, + * MPS_ARGS_ADD, and MPS_ARGS_DONE macros in mps.h. + * + * We implement this in a function here, rather than in a macro in + * mps.h, so that we can use AVER to do the bounds checking. + */ + +void _mps_args_set_key(mps_arg_s args[MPS_ARGS_MAX], unsigned i, + mps_key_t key) +{ + AVER(i < MPS_ARGS_MAX); + args[i].key = key; +} + + /* C. COPYRIGHT AND LICENSE * * Copyright (C) 2001-2014 Ravenbrook Limited . From b02491dabc26f1e7388089da6ad7cde291d200b1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 2 May 2014 11:43:52 +0100 Subject: [PATCH 47/93] Document the assertion that you get when you failed to destroy an object. Copied from Perforce Change: 185939 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/error.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mps/manual/source/topic/error.rst b/mps/manual/source/topic/error.rst index fb55c9785f1..29fefc6e1b6 100644 --- a/mps/manual/source/topic/error.rst +++ b/mps/manual/source/topic/error.rst @@ -232,13 +232,6 @@ assertion that is listed here but for which you discovered a different cause), please :ref:`let us know ` so that we can improve this documentation. -``sa.c: BTIsResRange(sa->mapped, 0, sa->length)`` - - The client program called :c:func:`mps_arena_destroy` without - having destroyed all pools in that arena first. (The assertion is - from the virtual memory manager which is checking that all pages - have been unmapped.) - ``dbgpool.c: fencepost check on free`` @@ -293,6 +286,15 @@ this documentation. condition? +``ring.c: ring->next == ring`` + + The client program destroyed an object without having destroyed + all the objects that it owns first. For example, it destroyed an + arena without first destroying all pools in that arena, or it + destroyed a pool without first destroying all allocation points + created on that pool. + + ``trace.c: RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg))`` The client program's :term:`scan method` failed to update a From 2200388b1005c5d423deb7b111787a37691bccd5 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 3 May 2014 10:43:12 +0100 Subject: [PATCH 48/93] Add note explaining that objects are not reclaimed immediately after discarding the finalization message, so you need to ensure they remain valid. Copied from Perforce Change: 185946 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/finalization.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mps/manual/source/topic/finalization.rst b/mps/manual/source/topic/finalization.rst index 32f618f19e7..2542f2ba1c7 100644 --- a/mps/manual/source/topic/finalization.rst +++ b/mps/manual/source/topic/finalization.rst @@ -85,6 +85,15 @@ calling :c:func:`mps_message_discard`. will cause it to be finalized again should all strong references disappear again. +.. note:: + + Calling :c:func:`mps_message_discard` does not reclaim the space + occupied by the finalized block (that happens at the next + collection, if the block is found to be dead at that point), and + so the block must remain validly formatted (:term:`scannable `, :term:`skippable `, and so on). You might + choose to replace it with a :term:`padding object`. + See :ref:`topic-message` for details of the message mechanism. From 9a10426569aca8a468729d4cd4a2f9caf610782f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 3 May 2014 10:45:50 +0100 Subject: [PATCH 49/93] Fix typo. Copied from Perforce Change: 185947 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/finalization.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mps/manual/source/topic/finalization.rst b/mps/manual/source/topic/finalization.rst index 2542f2ba1c7..745feefed16 100644 --- a/mps/manual/source/topic/finalization.rst +++ b/mps/manual/source/topic/finalization.rst @@ -91,8 +91,8 @@ calling :c:func:`mps_message_discard`. occupied by the finalized block (that happens at the next collection, if the block is found to be dead at that point), and so the block must remain validly formatted (:term:`scannable `, :term:`skippable `, and so on). You might - choose to replace it with a :term:`padding object`. + method>`, :term:`skippable `, and so on). It might + make sense to replace it with a :term:`padding object`. See :ref:`topic-message` for details of the message mechanism. @@ -132,12 +132,12 @@ Cautions finalization. The MPS does not finalize a block until it determines that the block is finalizable, which may require a full garbage collection in the worst case, and such a collection may - not :ref:`scheduled ` for some time. Or - the block may never become finalizable because it is incorrectly - determined to be reachable due to an :term:`ambiguous reference` - pointing to it. Or the block may never become finalizable because - it remains reachable through a reference, even if that reference - might never be used. + not be :ref:`scheduled ` for some time. + Or the block may never become finalizable because it is + incorrectly determined to be reachable due to an :term:`ambiguous + reference` pointing to it. Or the block may never become + finalizable because it remains reachable through a reference, even + if that reference might never be used. #. Even when blocks are finalized in a reasonably timely fashion, the client needs to process the finalization messages in time to avoid From 085b15deb2a5d861030a2a201842de33f6239a01 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 4 May 2014 20:39:31 +0100 Subject: [PATCH 50/93] Scheme constructors now take an allocation point. Copied from Perforce Change: 185959 ServerID: perforce.ravenbrook.com --- mps/code/airtest.c | 6 ++-- mps/code/fmtscheme.c | 68 ++++++++++++++++++++++---------------------- mps/code/fmtscheme.h | 26 +++++++++-------- 3 files changed, 51 insertions(+), 49 deletions(-) diff --git a/mps/code/airtest.c b/mps/code/airtest.c index bf840957414..a4537a390db 100644 --- a/mps/code/airtest.c +++ b/mps/code/airtest.c @@ -50,14 +50,14 @@ static void test_air(int interior, int stack) } mps_message_type_enable(scheme_arena, mps_message_type_finalization()); for (j = 0; j < OBJ_COUNT; ++j) { - obj_t n = scheme_make_integer((long)j); - obj_t obj = scheme_make_vector(OBJ_LEN, n); + obj_t n = scheme_make_integer(obj_ap, (long)j); + obj_t obj = scheme_make_vector(obj_ap, OBJ_LEN, n); mps_addr_t ref = obj; mps_finalize(scheme_arena, &ref); s[j] = obj->vector.vector; } for (i = 1; i < OBJ_LEN; ++i) { - obj_t n = scheme_make_integer((long)i); + obj_t n = scheme_make_integer(obj_ap, (long)i); mps_message_t msg; for (j = 0; j + 1 < OBJ_COUNT; ++j) { *++s[j] = n; diff --git a/mps/code/fmtscheme.c b/mps/code/fmtscheme.c index f43990ec619..24fa06db871 100644 --- a/mps/code/fmtscheme.c +++ b/mps/code/fmtscheme.c @@ -44,86 +44,86 @@ obj_t scheme_make_bool(int condition) return condition ? obj_true : obj_false; } -obj_t scheme_make_pair(obj_t car, obj_t cdr) +obj_t scheme_make_pair(mps_ap_t ap, obj_t car, obj_t cdr) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(sizeof(pair_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_pair"); obj = addr; obj->pair.type = TYPE_PAIR; CAR(obj) = car; CDR(obj) = cdr; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_integer(long integer) +obj_t scheme_make_integer(mps_ap_t ap, long integer) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(sizeof(integer_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_integer"); obj = addr; obj->integer.type = TYPE_INTEGER; obj->integer.integer = integer; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_symbol(size_t length, char string[]) +obj_t scheme_make_symbol(mps_ap_t ap, size_t length, char string[]) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(offsetof(symbol_s, string) + length+1); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_symbol"); obj = addr; obj->symbol.type = TYPE_SYMBOL; obj->symbol.length = length; memcpy(obj->symbol.string, string, length+1); - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_string(size_t length, char string[]) +obj_t scheme_make_string(mps_ap_t ap, size_t length, char string[]) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(offsetof(string_s, string) + length+1); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_string"); obj = addr; obj->string.type = TYPE_STRING; obj->string.length = length; if (string) memcpy(obj->string.string, string, length+1); else memset(obj->string.string, 0, length+1); - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_special(char *string) +obj_t scheme_make_special(mps_ap_t ap, char *string) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(sizeof(special_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_special"); obj = addr; obj->special.type = TYPE_SPECIAL; obj->special.name = string; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_operator(char *name, +obj_t scheme_make_operator(mps_ap_t ap, char *name, entry_t entry, obj_t arguments, obj_t body, obj_t env, obj_t op_env) { @@ -131,7 +131,7 @@ obj_t scheme_make_operator(char *name, mps_addr_t addr; size_t size = ALIGN_OBJ(sizeof(operator_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_operator"); obj = addr; obj->operator.type = TYPE_OPERATOR; @@ -141,70 +141,70 @@ obj_t scheme_make_operator(char *name, obj->operator.body = body; obj->operator.env = env; obj->operator.op_env = op_env; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_port(obj_t name, FILE *stream) +obj_t scheme_make_port(mps_ap_t ap, obj_t name, FILE *stream) { mps_addr_t port_ref; obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(sizeof(port_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_port"); obj = addr; obj->port.type = TYPE_PORT; obj->port.name = name; obj->port.stream = stream; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); port_ref = obj; mps_finalize(scheme_arena, &port_ref); return obj; } -obj_t scheme_make_character(char c) +obj_t scheme_make_character(mps_ap_t ap, char c) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(sizeof(character_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_character"); obj = addr; obj->character.type = TYPE_CHARACTER; obj->character.c = c; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_vector(size_t length, obj_t fill) +obj_t scheme_make_vector(mps_ap_t ap, size_t length, obj_t fill) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(offsetof(vector_s, vector) + length * sizeof(obj_t)); do { size_t i; - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_vector"); obj = addr; obj->vector.type = TYPE_VECTOR; obj->vector.length = length; for(i = 0; i < length; ++i) obj->vector.vector[i] = fill; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_buckets(size_t length) +obj_t scheme_make_buckets(mps_ap_t ap, size_t length) { obj_t obj; mps_addr_t addr; size_t size = ALIGN_OBJ(offsetof(buckets_s, bucket) + length * sizeof(obj->buckets.bucket[0])); do { size_t i; - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_buckets"); obj = addr; obj->buckets.type = TYPE_BUCKETS; @@ -215,27 +215,27 @@ obj_t scheme_make_buckets(size_t length) obj->buckets.bucket[i].key = NULL; obj->buckets.bucket[i].value = NULL; } - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); return obj; } -obj_t scheme_make_table(size_t length, hash_t hashf, cmp_t cmpf) +obj_t scheme_make_table(mps_ap_t ap, size_t length, hash_t hashf, cmp_t cmpf) { obj_t obj; mps_addr_t addr; size_t l, size = ALIGN_OBJ(sizeof(table_s)); do { - mps_res_t res = mps_reserve(&addr, obj_ap, size); + mps_res_t res = mps_reserve(&addr, ap, size); if (res != MPS_RES_OK) error("out of memory in make_table"); obj = addr; obj->table.type = TYPE_TABLE; obj->table.buckets = NULL; - } while(!mps_commit(obj_ap, addr, size)); + } while(!mps_commit(ap, addr, size)); obj->table.hash = hashf; obj->table.cmp = cmpf; /* round up to next power of 2 */ for(l = 1; l < length; l *= 2); - obj->table.buckets = scheme_make_buckets(l); + obj->table.buckets = scheme_make_buckets(ap, l); mps_ld_reset(&obj->table.ld, scheme_arena); return obj; } diff --git a/mps/code/fmtscheme.h b/mps/code/fmtscheme.h index fbbbddf8ccd..95a62a53cef 100644 --- a/mps/code/fmtscheme.h +++ b/mps/code/fmtscheme.h @@ -168,18 +168,20 @@ typedef union obj_u { extern obj_t scheme_make_bool(int condition); -extern obj_t scheme_make_pair(obj_t car, obj_t cdr); -extern obj_t scheme_make_integer(long integer); -extern obj_t scheme_make_symbol(size_t length, char string[]); -extern obj_t scheme_make_string(size_t length, char string[]); -extern obj_t scheme_make_special(char *string); -extern obj_t scheme_make_operator(char *name, entry_t entry, obj_t arguments, - obj_t body, obj_t env, obj_t op_env); -extern obj_t scheme_make_port(obj_t name, FILE *stream); -extern obj_t scheme_make_character(char c); -extern obj_t scheme_make_vector(size_t length, obj_t fill); -extern obj_t scheme_make_buckets(size_t length); -extern obj_t scheme_make_table(size_t length, hash_t hashf, cmp_t cmpf); +extern obj_t scheme_make_pair(mps_ap_t ap, obj_t car, obj_t cdr); +extern obj_t scheme_make_integer(mps_ap_t ap, long integer); +extern obj_t scheme_make_symbol(mps_ap_t ap, size_t length, char string[]); +extern obj_t scheme_make_string(mps_ap_t ap, size_t length, char string[]); +extern obj_t scheme_make_special(mps_ap_t ap, char *string); +extern obj_t scheme_make_operator(mps_ap_t ap, char *name, entry_t entry, + obj_t arguments, obj_t body, obj_t env, + obj_t op_env); +extern obj_t scheme_make_port(mps_ap_t ap, obj_t name, FILE *stream); +extern obj_t scheme_make_character(mps_ap_t ap, char c); +extern obj_t scheme_make_vector(mps_ap_t ap, size_t length, obj_t fill); +extern obj_t scheme_make_buckets(mps_ap_t ap, size_t length); +extern obj_t scheme_make_table(mps_ap_t ap, size_t length, hash_t hashf, + cmp_t cmpf); extern void scheme_fmt(mps_fmt_t *fmt); extern mps_arena_t scheme_arena; From 4c52e0390b2b514ca51a9e2a4e161b6c36df02da Mon Sep 17 00:00:00 2001 From: David Lovemore Date: Tue, 6 May 2014 12:19:06 +0100 Subject: [PATCH 51/93] Only include tract loop ion segcheck when check level > minimal. This is to speed up SegCheck in HOT variety. Copied from Perforce Change: 185971 ServerID: perforce.ravenbrook.com --- mps/code/seg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mps/code/seg.c b/mps/code/seg.c index 7f0cd4bc907..c9ff20913c9 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -701,6 +701,7 @@ Bool SegCheck(Seg seg) CHECKL(seg->limit > TractBase(seg->firstTract)); /* Each tract of the segment must agree about white traces */ +#ifdef CHECKLEVEL > CheckLevelMINIMAL TRACT_TRACT_FOR(tract, addr, arena, seg->firstTract, seg->limit) { Seg trseg = NULL; /* suppress compiler warning */ @@ -709,6 +710,7 @@ Bool SegCheck(Seg seg) CHECKL(TractWhite(tract) == seg->white); CHECKL(TractPool(tract) == pool); } +#endif CHECKL(addr == seg->limit); /* The segment must belong to some pool, so it should be on a */ From b29e2f818191c3f14dfc459c5684d0e9a6ce0406 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 7 May 2014 23:33:22 +0100 Subject: [PATCH 52/93] Fix typos. Copied from Perforce Change: 185977 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/arena.rst | 6 +++--- mps/manual/source/topic/interface.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mps/manual/source/topic/arena.rst b/mps/manual/source/topic/arena.rst index 1925117cc84..c62d3c58aae 100644 --- a/mps/manual/source/topic/arena.rst +++ b/mps/manual/source/topic/arena.rst @@ -396,8 +396,8 @@ Arena properties (over-)estimate the size of the heap. If you want to know how much memory the MPS is using then you're - probably interested in the value ``mps_arena_committed() - - mps_arena_spare_committed()``. + probably interested in the value :c:func:`mps_arena_committed()` − + :c:func:`mps_arena_spare_committed`. The amount of committed memory can be limited with the function :c:func:`mps_arena_commit_limit`. @@ -457,7 +457,7 @@ Arena properties Non-virtual-memory arena classes (for example, a :term:`client arena`) do not have spare committed memory. For these arenas, this - function functions sets a value but has no other effect. + function sets a value but has no other effect. Initially the spare commit limit is a configuration-dependent value. The value of the limit can be retrieved by the function diff --git a/mps/manual/source/topic/interface.rst b/mps/manual/source/topic/interface.rst index 478c22b8026..a939ddf302b 100644 --- a/mps/manual/source/topic/interface.rst +++ b/mps/manual/source/topic/interface.rst @@ -226,7 +226,7 @@ Macros implemented as a macro defined in the header, so a library function should not be declared explicitly if its header is included. Any macro definition of a function can be suppressed - locally be enclosing the name of the function in parentheses, + locally by enclosing the name of the function in parentheses, because the name is then not followed by the left parenthesis that indicates expansion of a macro function name. [...] Any invocation of a library function that is implemented as a From 5aee5122778a7b36553e6334a90104555317c09e Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 7 May 2014 23:38:51 +0100 Subject: [PATCH 53/93] Better to put the example first and discuss it afterwards. Copied from Perforce Change: 185978 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/arena.rst | 66 +++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/mps/manual/source/topic/arena.rst b/mps/manual/source/topic/arena.rst index c62d3c58aae..86e0a39550f 100644 --- a/mps/manual/source/topic/arena.rst +++ b/mps/manual/source/topic/arena.rst @@ -506,7 +506,7 @@ An arena is always in one of three states. In the *unclamped state*, garbage collection may take place, objects may move in memory, references may be updated, :term:`location dependencies` may become stale, virtual memory may - be requested from or return to the operating system, and other + be requested from or returned to the operating system, and other kinds of background activity may occur. This is the normal state. #. .. index:: @@ -531,19 +531,19 @@ An arena is always in one of three states. Here's a summary: -======================================== ================================== ============================= =========================== -State unclamped clamped parked -======================================== ================================== ============================= =========================== -Collections may be running? yes yes no -New collections may start? yes no no -Objects may move? yes no no -Location dependencies may become stale? yes no no -Memory may be returned to the OS? yes no no -Functions that leave arena in this state :c:func:`mps_arena_create`, :c:func:`mps_arena_clamp`, :c:func:`mps_arena_park`, - :c:func:`mps_arena_release`, :c:func:`mps_arena_step` :c:func:`mps_arena_collect` - :c:func:`mps_arena_start_collect`, - :c:func:`mps_arena_step` -======================================== ================================== ============================= =========================== +============================================ ================================== ============================= =========================== +State unclamped clamped parked +============================================ ================================== ============================= =========================== +Collections may be running? yes yes no +New collections may start? yes no no +Objects may move? yes no no +Location dependencies may become stale? yes no no +Memory may be returned to the OS? yes no no +Functions that leave the arena in this state :c:func:`mps_arena_create`, :c:func:`mps_arena_clamp`, :c:func:`mps_arena_park`, + :c:func:`mps_arena_release`, :c:func:`mps_arena_step` :c:func:`mps_arena_collect` + :c:func:`mps_arena_start_collect`, + :c:func:`mps_arena_step` +============================================ ================================== ============================= =========================== The clamped and parked states are important when introspecting and debugging. If you are examining the contents of the heap, you don't @@ -556,7 +556,7 @@ before inspecting memory, and:: (gdb) print mps_arena_release(arena) -afterward. +afterwards. The results of introspection functions like :c:func:`mps_arena_has_addr` only remain valid while the arena remains @@ -692,24 +692,7 @@ provides a function, :c:func:`mps_arena_step`, for making use of idle time to make memory management progress. Here's an example illustrating the use of this function in a program's -event loop. When the program is idle (there are no client actions to -perform), it requests that the MPS spend up to 10 milliseconds on -incremental work, by calling ``mps_arena_step(arena, 0.010, -0.0)``. When this returns false to indicate that there is no more work -to do, the program blocks on the client for two seconds: if this times -out, it predicts that the user will remain idle for at least a further -second, so it calls ``mps_arena_step(arena, 0.010, 100.0)`` to tell -that it's a good time to start a collection taking up to 10 ms × 100 -= 1 second, but not to pause for more than 10 ms. - -The program remains responsive: the MPS doesn't take control for more -than a few milliseconds at a time (at most 10). But at the same time, -major collection work can get done at times when the program would -otherwise be idle. Of course the numbers here are only for -illustration and should be chosen based on the requirements of the -application. - -:: +event loop. :: for (;;) { /* event loop */ for (;;) { @@ -729,6 +712,23 @@ application. } } +When the program is idle (there are no client actions to perform), it +requests that the MPS spend up to 10 milliseconds on incremental work, +by calling ``mps_arena_step(arena, 0.010, 0.0)``. When this returns +false to indicate that there is no more work to do, the program blocks +on the client for two seconds: if this times out, it predicts that the +user will remain idle for at least a further second, so it calls +``mps_arena_step(arena, 0.010, 100.0)`` to tell that it's a good time +to start a collection taking up to 10 ms × 100 = 1 second, but not to +pause for more than 10 ms. + +The program remains responsive: the MPS doesn't take control for more +than a few milliseconds at a time (at most 10). But at the same time, +major collection work can get done at times when the program would +otherwise be idle. Of course the numbers here are only for +illustration; they should be chosen based on the requirements of the +application. + .. c:function:: mps_bool_t mps_arena_step(mps_arena_t arena, double interval, double multiplier) From 3a6a9e1101a70159bfdd949772fb700a035273e3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 10 May 2014 09:44:25 +0100 Subject: [PATCH 54/93] Fix compilation of seg.c. 1. "#ifdef CHECKLEVEL > CheckLevelMINIMAL" was bogus: the #ifdef should have been #if, but even then it would not be right, because in the CHECKLEVEL_DYNAMIC configuration, CHECKLEVEL is a variable rather than a preprocessor constant. So use the condition defined(AVER_AND_CHECK_ALL) instead. 2. The final CHECKL(addr == seg->limit) only makes sense if the loop was executed. 3. The variables used by the loop need to be inside the #if to avoid warnings about unused variables. 4. Add reference to the job from a comment. Copied from Perforce Change: 185992 ServerID: perforce.ravenbrook.com --- mps/code/seg.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mps/code/seg.c b/mps/code/seg.c index c9ff20913c9..45a61abd185 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -678,10 +678,8 @@ failControl: Bool SegCheck(Seg seg) { - Tract tract; Arena arena; Pool pool; - Addr addr; Size align; CHECKS(Seg, seg); @@ -700,18 +698,25 @@ Bool SegCheck(Seg seg) CHECKL(AddrIsAligned(seg->limit, align)); CHECKL(seg->limit > TractBase(seg->firstTract)); - /* Each tract of the segment must agree about white traces */ -#ifdef CHECKLEVEL > CheckLevelMINIMAL - TRACT_TRACT_FOR(tract, addr, arena, seg->firstTract, seg->limit) { - Seg trseg = NULL; /* suppress compiler warning */ + /* Each tract of the segment must agree about white traces. Note + * that even if the CHECKs are compiled away there is still a + * significant cost in looping over the tracts, hence the guard. See + * job003778. */ +#if defined(AVER_AND_CHECK_ALL) + { + Tract tract; + Addr addr; + TRACT_TRACT_FOR(tract, addr, arena, seg->firstTract, seg->limit) { + Seg trseg = NULL; /* suppress compiler warning */ - CHECKD_NOSIG(Tract, tract); - CHECKL(TRACT_SEG(&trseg, tract) && (trseg == seg)); - CHECKL(TractWhite(tract) == seg->white); - CHECKL(TractPool(tract) == pool); + CHECKD_NOSIG(Tract, tract); + CHECKL(TRACT_SEG(&trseg, tract) && (trseg == seg)); + CHECKL(TractWhite(tract) == seg->white); + CHECKL(TractPool(tract) == pool); + } + CHECKL(addr == seg->limit); } -#endif - CHECKL(addr == seg->limit); +#endif /* AVER_AND_CHECK_ALL */ /* The segment must belong to some pool, so it should be on a */ /* pool's segment ring. (Actually, this isn't true just after */ From be87b190ed3ad729eb56fa4f5876824b3169612d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 10 May 2014 09:45:26 +0100 Subject: [PATCH 55/93] Defined(aver_and_check_all) is a better condition for invalidating the colour tables. Copied from Perforce Change: 185993 ServerID: perforce.ravenbrook.com --- mps/code/poolams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/poolams.c b/mps/code/poolams.c index 65b2dcf754f..134d1228be0 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -172,7 +172,7 @@ static Res amsCreateTables(AMS ams, BT *allocReturn, goto failWhite; } -#if defined(AVER_AND_CHECK) +#if defined(AVER_AND_CHECK_ALL) /* Invalidate the colour tables in checking varieties. The algorithm * is designed not to depend on the initial values of these tables, * so by invalidating them we get some checking of this. From 9166015cf7cebc188ce302132b6fec3cb141567d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 10 May 2014 09:47:58 +0100 Subject: [PATCH 56/93] Remove some unused headers. Copied from Perforce Change: 185994 ServerID: perforce.ravenbrook.com --- mps/code/clock.h | 1 - mps/code/misc.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/mps/code/clock.h b/mps/code/clock.h index 253f7a5e0e4..d5fd7bc0e4e 100644 --- a/mps/code/clock.h +++ b/mps/code/clock.h @@ -7,7 +7,6 @@ #ifndef clock_h #define clock_h -#include #include "mpmtypes.h" /* for Word */ diff --git a/mps/code/misc.h b/mps/code/misc.h index fed416157dd..7380421d5c5 100644 --- a/mps/code/misc.h +++ b/mps/code/misc.h @@ -13,8 +13,6 @@ #ifndef misc_h #define misc_h -#include - typedef int Bool; /* */ enum BoolEnum { From f23138db2f6c6b0c5df61b7bb742a73679f5d8bf Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 11 May 2014 18:16:46 +0100 Subject: [PATCH 57/93] Use xcrun so that we support xcode-select. Copied from Perforce Change: 185998 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 4 ++-- mps/tool/testcoverage | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mps/Makefile.in b/mps/Makefile.in index 2d558588673..e8899cce95c 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -1,7 +1,7 @@ # Makefile.in -- source for autoconf Makefile # # $Id$ -# Copyright (C) 2012-2013 Ravenbrook Limited. See end of file for license. +# Copyright (C) 2012-2014 Ravenbrook Limited. See end of file for license. # # YOU DON'T NEED AUTOCONF TO BUILD THE MPS # This is just here for people who want or expect a configure script. @@ -17,7 +17,7 @@ MPS_TARGET_NAME=@MPS_TARGET_NAME@ EXTRA_TARGETS=@EXTRA_TARGETS@ prefix=$(DESTDIR)@prefix@ TARGET_OPTS=-C code -f $(MPS_TARGET_NAME).gmk EXTRA_TARGETS="$(EXTRA_TARGETS)" -XCODEBUILD=xcodebuild -project code/mps.xcodeproj +XCODEBUILD=xcrun xcodebuild -project code/mps.xcodeproj all: @BUILD_TARGET@ diff --git a/mps/tool/testcoverage b/mps/tool/testcoverage index ff1967031dd..dacae8cd5f4 100755 --- a/mps/tool/testcoverage +++ b/mps/tool/testcoverage @@ -26,14 +26,14 @@ case "$ARCH-$OS" in CONFIGURATION=Debug ( cd -- "$CODE" - xcodebuild -config "$CONFIGURATION" clean - xcodebuild -config "$CONFIGURATION" -target testrun \ + xcrun xcodebuild -config "$CONFIGURATION" clean + xcrun xcodebuild -config "$CONFIGURATION" -target testrun \ GCC_GENERATE_TEST_COVERAGE_FILES=YES \ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES ) ( cd -- "$CODE/xc/$PROJECT.build/$CONFIGURATION/$PROJECT.build/Objects-normal/$ARCH" - gcov mps.c 2> /dev/null + xcrun gcov mps.c 2> /dev/null ) | "$TOOL/gcovfmt" ;; *) From d60451c8ad988362a6d6dab742a58f3b96bc2578 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 11 May 2014 18:17:40 +0100 Subject: [PATCH 58/93] Check keyword arguments after picking them. Copied from Perforce Change: 185999 ServerID: perforce.ravenbrook.com --- mps/code/arg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mps/code/arg.c b/mps/code/arg.c index e3fea68754d..407487b4060 100644 --- a/mps/code/arg.c +++ b/mps/code/arg.c @@ -159,6 +159,7 @@ Bool ArgPick(ArgStruct *argOut, ArgList args, Key key) { return FALSE; found: + AVER(key->check(&args[i])); *argOut = args[i]; for(;;) { args[i] = args[i + 1]; From 358a76bf0088632a6cb6536a8091805e332c094d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 11 May 2014 18:52:53 +0100 Subject: [PATCH 59/93] Remove unused function mfsgetinfo and unused type mfsinfo. Copied from Perforce Change: 186004 ServerID: perforce.ravenbrook.com --- mps/code/poolmfs.c | 10 ---------- mps/code/poolmfs.h | 12 ++---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c index 139b3f5c872..b40094d839c 100644 --- a/mps/code/poolmfs.c +++ b/mps/code/poolmfs.c @@ -57,18 +57,8 @@ typedef struct MFSHeaderStruct { } HeaderStruct, *Header; - #define UNIT_MIN sizeof(HeaderStruct) -MFSInfo MFSGetInfo(void) -{ - static const struct MFSInfoStruct info = - { - /* unitSizeMin */ UNIT_MIN - }; - return &info; -} - Pool (MFSPool)(MFS mfs) { diff --git a/mps/code/poolmfs.h b/mps/code/poolmfs.h index 7ab337d4393..5f2fd0780ed 100644 --- a/mps/code/poolmfs.h +++ b/mps/code/poolmfs.h @@ -2,7 +2,7 @@ * * $Id$ * - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * The MFS pool is used to manage small fixed-size chunks of memory. It * stores control structures in the memory it manages, rather than to one @@ -39,14 +39,6 @@ extern Bool MFSCheck(MFS mfs); extern Pool (MFSPool)(MFS mfs); -typedef const struct MFSInfoStruct *MFSInfo; - -struct MFSInfoStruct { - Size unitSizeMin; /* minimum unit size */ -}; - -extern MFSInfo MFSGetInfo(void); - extern const struct mps_key_s _mps_key_MFSExtendSelf; #define MFSExtendSelf (&_mps_key_MFSExtendSelf) #define MFSExtendSelf_FIELD b @@ -63,7 +55,7 @@ extern void MFSFinishTracts(Pool pool, MFSTractVisitor visitor, /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2002 Ravenbrook Limited . + * Copyright (C) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * From 3a1ce9493ff83aa34545e675fb6e4a833b4afd6d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 11 May 2014 19:09:44 +0100 Subject: [PATCH 60/93] Remove mps_key_cbs_extend_by and mfsextendself keyword arguments to cbsinit. these were unused and obsoleted by cbsblockpool. Copied from Perforce Change: 186006 ServerID: perforce.ravenbrook.com --- mps/code/cbs.c | 9 --------- mps/code/config.h | 5 ----- mps/code/mps.h | 3 --- 3 files changed, 17 deletions(-) diff --git a/mps/code/cbs.c b/mps/code/cbs.c index addebd398ad..3e3411023eb 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -232,14 +232,11 @@ static void cbsUpdateZonedNode(SplayTree splay, Tree tree) * See . */ -ARG_DEFINE_KEY(cbs_extend_by, Size); ARG_DEFINE_KEY(cbs_block_pool, Pool); Res CBSInit(CBS cbs, Arena arena, void *owner, Align alignment, Bool fastFind, Bool zoned, ArgList args) { - Size extendBy = CBS_EXTEND_BY_DEFAULT; - Bool extendSelf = TRUE; ArgStruct arg; Res res; Pool blockPool = NULL; @@ -253,10 +250,6 @@ Res CBSInit(CBS cbs, Arena arena, void *owner, Align alignment, if (ArgPick(&arg, args, CBSBlockPool)) blockPool = arg.val.pool; - if (ArgPick(&arg, args, MPS_KEY_CBS_EXTEND_BY)) - extendBy = arg.val.size; - if (ArgPick(&arg, args, MFSExtendSelf)) - extendSelf = arg.val.b; update = SplayTrivUpdate; if (fastFind) @@ -274,8 +267,6 @@ Res CBSInit(CBS cbs, Arena arena, void *owner, Align alignment, } else { 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_ADD(pcArgs, MFSExtendSelf, extendSelf); res = PoolCreate(&cbs->blockPool, arena, PoolClassMFS(), pcArgs); } MPS_ARGS_END(pcArgs); if (res != ResOK) diff --git a/mps/code/config.h b/mps/code/config.h index 1dfd7858f86..5d2eff42104 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -264,11 +264,6 @@ #define BUFFER_RANK_DEFAULT (mps_rank_exact()) -/* CBS Configuration -- see */ - -#define CBS_EXTEND_BY_DEFAULT ((Size)4096) - - /* Format defaults: see */ #define FMT_ALIGN_DEFAULT ((Align)MPS_PF_ALIGN) diff --git a/mps/code/mps.h b/mps/code/mps.h index 18767cec60f..049a489f96d 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -188,9 +188,6 @@ extern const struct mps_key_s _mps_key_max_size; extern const struct mps_key_s _mps_key_align; #define MPS_KEY_ALIGN (&_mps_key_align) #define MPS_KEY_ALIGN_FIELD align -extern const struct mps_key_s _mps_key_cbs_extend_by; -#define MPS_KEY_CBS_EXTEND_BY (&_mps_key_cbs_extend_by) -#define MPS_KEY_CBS_EXTEND_BY_FIELD size extern const struct mps_key_s _mps_key_interior; #define MPS_KEY_INTERIOR (&_mps_key_interior) #define MPS_KEY_INTERIOR_FIELD b From e25bb017998950c13df37006b2fc6eab907d58a9 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 11 May 2014 19:18:54 +0100 Subject: [PATCH 61/93] Check the argument using argcheck. Copied from Perforce Change: 186007 ServerID: perforce.ravenbrook.com --- mps/code/arg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/arg.c b/mps/code/arg.c index 407487b4060..784a7e57f30 100644 --- a/mps/code/arg.c +++ b/mps/code/arg.c @@ -159,7 +159,7 @@ Bool ArgPick(ArgStruct *argOut, ArgList args, Key key) { return FALSE; found: - AVER(key->check(&args[i])); + AVERT(Arg, &args[i]); *argOut = args[i]; for(;;) { args[i] = args[i + 1]; From 93d01e3ca82219c239694144dc8ce70380e288f8 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 11 May 2014 21:47:20 +0100 Subject: [PATCH 62/93] It is an error to destroy a chain if there is an active trace using the chain. Copied from Perforce Change: 186013 ServerID: perforce.ravenbrook.com --- mps/code/amcss.c | 2 ++ mps/code/amcsshe.c | 2 ++ mps/code/amsss.c | 1 + mps/code/amssshe.c | 2 ++ mps/code/locus.c | 1 + 5 files changed, 8 insertions(+) diff --git a/mps/code/amcss.c b/mps/code/amcss.c index 48892a45830..20e86f80897 100644 --- a/mps/code/amcss.c +++ b/mps/code/amcss.c @@ -275,6 +275,7 @@ static void test(mps_arena_t arena, mps_class_t pool_class, size_t roots_count) } (void)mps_commit(busy_ap, busy_init, 64); + mps_arena_park(arena); mps_ap_destroy(busy_ap); mps_ap_destroy(ap); mps_root_destroy(exactRoot); @@ -282,6 +283,7 @@ static void test(mps_arena_t arena, mps_class_t pool_class, size_t roots_count) mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); + mps_arena_release(arena); } int main(int argc, char *argv[]) diff --git a/mps/code/amcsshe.c b/mps/code/amcsshe.c index 8b3a0c65e36..cd19b4219e6 100644 --- a/mps/code/amcsshe.c +++ b/mps/code/amcsshe.c @@ -225,6 +225,7 @@ static void *test(mps_arena_t arena, mps_class_t pool_class, size_t roots_count) } (void)mps_commit(busy_ap, busy_init, 64); + mps_arena_park(arena); mps_ap_destroy(busy_ap); mps_ap_destroy(ap); mps_root_destroy(exactRoot); @@ -233,6 +234,7 @@ static void *test(mps_arena_t arena, mps_class_t pool_class, size_t roots_count) mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); + mps_arena_release(arena); return NULL; } diff --git a/mps/code/amsss.c b/mps/code/amsss.c index 9128561ecf2..d87ebe95c02 100644 --- a/mps/code/amsss.c +++ b/mps/code/amsss.c @@ -231,6 +231,7 @@ int main(int argc, char *argv[]) } MPS_ARGS_END(args); } + mps_arena_park(arena); mps_chain_destroy(chain); mps_fmt_destroy(format); mps_thread_dereg(thread); diff --git a/mps/code/amssshe.c b/mps/code/amssshe.c index ce5dd4800c8..206e7c29ffe 100644 --- a/mps/code/amssshe.c +++ b/mps/code/amssshe.c @@ -139,6 +139,7 @@ static void *test(void *arg, size_t s) } (void)mps_commit(busy_ap, busy_init, 64); + mps_arena_park(arena); mps_ap_destroy(busy_ap); mps_ap_destroy(ap); mps_root_destroy(exactRoot); @@ -146,6 +147,7 @@ static void *test(void *arg, size_t s) mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); + mps_arena_release(arena); return NULL; } diff --git a/mps/code/locus.c b/mps/code/locus.c index 10eae03840f..62b0b3be13e 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -212,6 +212,7 @@ void ChainDestroy(Chain chain) size_t i; AVERT(Chain, chain); + AVER(chain->activeTraces == TraceSetEMPTY); arena = chain->arena; genCount = chain->genCount; RingRemove(&chain->chainRing); From e13fc954cead11a9a478b19d7ca988c45e7a79a6 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 11:19:57 +0100 Subject: [PATCH 63/93] Park the arena before destroying the default chain, to ensure that there are no traces using that chain. Fix test cases that used automatic collection, but destroyed data structures without parking the arena. Document the requirement on mps_chain_destroy and add the assertion to "common assertions and their causes". Copied from Perforce Change: 186021 ServerID: perforce.ravenbrook.com --- mps/code/amcssth.c | 39 +++++++++++--------------- mps/code/exposet0.c | 1 + mps/code/global.c | 4 +++ mps/code/qs.c | 2 ++ mps/manual/source/topic/collection.rst | 8 ++++-- mps/manual/source/topic/error.rst | 11 +++++++- 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/mps/code/amcssth.c b/mps/code/amcssth.c index 2f91edee93e..b96df985028 100644 --- a/mps/code/amcssth.c +++ b/mps/code/amcssth.c @@ -149,17 +149,6 @@ static void init(void) } -/* finish -- finish roots and chain */ - -static void finish(void) -{ - mps_root_destroy(exactRoot); - mps_root_destroy(ambigRoot); - mps_chain_destroy(chain); - mps_fmt_destroy(format); -} - - /* churn -- create an object and install into roots */ static void churn(mps_ap_t ap, size_t roots_count) @@ -218,7 +207,7 @@ static void *kid_thread(void *arg) /* test -- the body of the test */ -static void *test_pool(mps_class_t pool_class, size_t roots_count, int mode) +static void test_pool(mps_pool_t pool, size_t roots_count, int mode) { size_t i; mps_word_t collections, rampSwitch; @@ -226,14 +215,10 @@ static void *test_pool(mps_class_t pool_class, size_t roots_count, int mode) int ramping; mps_ap_t ap, busy_ap; mps_addr_t busy_init; - mps_pool_t pool; testthr_t kids[10]; closure_s cl; int walked = FALSE, ramped = FALSE; - die(mps_pool_create(&pool, arena, pool_class, format, chain), - "pool_create(amc)"); - cl.pool = pool; cl.roots_count = roots_count; @@ -323,16 +308,13 @@ static void *test_pool(mps_class_t pool_class, size_t roots_count, int mode) for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) testthr_join(&kids[i], NULL); - - mps_pool_destroy(pool); - - return NULL; } static void test_arena(int mode) { mps_thr_t thread; mps_root_t reg_root; + mps_pool_t amc_pool, amcz_pool; void *marker = ▮ die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), @@ -345,12 +327,23 @@ static void test_arena(int mode) die(mps_root_create_reg(®_root, arena, mps_rank_ambig(), 0, thread, mps_stack_scan_ambig, marker, 0), "root_create"); - test_pool(mps_class_amc(), exactRootsCOUNT, mode); - test_pool(mps_class_amcz(), 0, mode); + die(mps_pool_create(&amc_pool, arena, mps_class_amc(), format, chain), + "pool_create(amc)"); + die(mps_pool_create(&amcz_pool, arena, mps_class_amcz(), format, chain), + "pool_create(amcz)"); + test_pool(amc_pool, exactRootsCOUNT, mode); + test_pool(amcz_pool, 0, mode); + + mps_arena_park(arena); + mps_pool_destroy(amc_pool); + mps_pool_destroy(amcz_pool); mps_root_destroy(reg_root); mps_thread_dereg(thread); - finish(); + mps_root_destroy(exactRoot); + mps_root_destroy(ambigRoot); + mps_chain_destroy(chain); + mps_fmt_destroy(format); report(arena); mps_arena_destroy(arena); } diff --git a/mps/code/exposet0.c b/mps/code/exposet0.c index 21f2567cbaa..a1e8fcdc6e8 100644 --- a/mps/code/exposet0.c +++ b/mps/code/exposet0.c @@ -222,6 +222,7 @@ static void *test(void *arg, size_t s) } (void)mps_commit(busy_ap, busy_init, 64); + mps_arena_park(arena); mps_ap_destroy(busy_ap); mps_ap_destroy(ap); mps_root_destroy(exactRoot); diff --git a/mps/code/global.c b/mps/code/global.c index ce4ebbe6faa..4e3528ad7f3 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -431,6 +431,10 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals) AVERT(Globals, arenaGlobals); + /* Park the arena before destroying the default chain, to ensure + * that there are no traces using that chain. */ + ArenaPark(arenaGlobals); + arena = GlobalsArena(arenaGlobals); arenaDenounce(arena); diff --git a/mps/code/qs.c b/mps/code/qs.c index 50fe8c48723..ec3b9cb28d2 100644 --- a/mps/code/qs.c +++ b/mps/code/qs.c @@ -367,6 +367,7 @@ static void *go(void *p, size_t s) qsort(list, listl, sizeof(mps_word_t), &compare); validate(); + mps_arena_park(arena); mps_root_destroy(regroot); mps_root_destroy(actroot); mps_ap_destroy(ap); @@ -374,6 +375,7 @@ static void *go(void *p, size_t s) mps_pool_destroy(mpool); mps_chain_destroy(chain); mps_fmt_destroy(format); + mps_arena_release(arena); return NULL; } diff --git a/mps/manual/source/topic/collection.rst b/mps/manual/source/topic/collection.rst index adf7c058e9e..f061d946ad8 100644 --- a/mps/manual/source/topic/collection.rst +++ b/mps/manual/source/topic/collection.rst @@ -134,8 +134,12 @@ For example:: ``chain`` is the generation chain. - It is an error to destroy a generation chain if there exists a - :term:`pool` using the chain. The pool must be destroyed first. + It is an error to destroy a generation chain if there is a garbage + collection in progress on the chain, or if there are any + :term:`pools` using the chain. Before calling this function, the + arena should be parked (by calling :c:func:`mps_arena_park`) to + ensure that there are no collections in progress, and pools using + the chain must be destroyed. .. index:: diff --git a/mps/manual/source/topic/error.rst b/mps/manual/source/topic/error.rst index 29fefc6e1b6..200c20af8bb 100644 --- a/mps/manual/source/topic/error.rst +++ b/mps/manual/source/topic/error.rst @@ -262,6 +262,15 @@ this documentation. :term:`format methods` and :term:`stepper functions`. +``locus.c: chain->activeTraces == TraceSetEMPTY)`` + + The client program called :c:func:`mps_chain_destroy`, but there + was a garbage collection in progress on that chain. + + Park the arena before destroying the chain by calling + :c:func:`mps_arena_park`. + + ``mpsi.c: SizeIsAligned(size, BufferPool(buf)->alignment)`` The client program reserved a block by calling @@ -269,7 +278,7 @@ this documentation. alignment required by the pool's :term:`object format`. -``pool.c: (pool->class->attr & AttrALLOC) != 0`` +``pool.c: PoolHasAttr(pool, AttrALLOC)`` The client program called :c:func:`mps_alloc` on a pool that does not support this form of allocation. Use an :term:`allocation From a80d29709947a5e08a25daa6c32534dc20b2480b Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 12:30:46 +0100 Subject: [PATCH 64/93] Mpseventtxt must not itself output telemetry, otherwise it is likely to overwrite the telemetry it is converting. Copied from Perforce Change: 186023 ServerID: perforce.ravenbrook.com --- mps/code/eventtxt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mps/code/eventtxt.c b/mps/code/eventtxt.c index 4c50ac994f9..bc0d550d122 100644 --- a/mps/code/eventtxt.c +++ b/mps/code/eventtxt.c @@ -40,9 +40,10 @@ #include "testlib.h" /* for ulongest_t and associated print formats */ #include +#include #include #include /* exit, EXIT_FAILURE, EXIT_SUCCESS */ -#include /* strcpy, strlen */ +#include /* strcpy, strerror, strlen */ static const char *prog; /* program name */ static const char *logFileName = NULL; @@ -571,6 +572,11 @@ int main(int argc, char *argv[]) everror("unable to open %s", logFileName); } + /* Ensure no telemetry output. */ + res = setenv("MPS_TELEMETRY_CONTROL", "0", 1); + if (res != 0) + everror("failed to set MPS_TELEMETRY_CONTROL: %s", strerror(errno)); + res = mps_arena_create_k(&arena, mps_arena_class_vm(), mps_args_none); if (res != MPS_RES_OK) everror("failed to create arena: %d", res); From 367ae766143b088eb2287fca00209d2b506b3b09 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 12:53:46 +0100 Subject: [PATCH 65/93] Park the arena before calling mps_chain_destroy. Speed up mpsicv by reducing number of objects and by only running the test once (there's no inlined mps_tramp any more). Copied from Perforce Change: 186024 ServerID: perforce.ravenbrook.com --- mps/code/expt825.c | 1 + mps/code/finalcv.c | 1 + mps/code/finaltest.c | 1 + mps/code/gcbench.c | 1 + mps/code/mpsicv.c | 5 +++-- mps/code/steptest.c | 2 ++ mps/code/walkt0.c | 3 +++ mps/code/zcoll.c | 1 + mps/code/zmess.c | 1 + 9 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mps/code/expt825.c b/mps/code/expt825.c index 5e775455909..bd6c5f2b1e0 100644 --- a/mps/code/expt825.c +++ b/mps/code/expt825.c @@ -250,6 +250,7 @@ static void *test(void *arg, size_t s) (ulongest_t)object_count); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_root_destroy(mps_root); mps_pool_destroy(amc); diff --git a/mps/code/finalcv.c b/mps/code/finalcv.c index 1466e514ff8..931503cf9bb 100644 --- a/mps/code/finalcv.c +++ b/mps/code/finalcv.c @@ -199,6 +199,7 @@ static void *test(void *arg, size_t s) /* @@@@ missing */ + mps_arena_park(arena); mps_ap_destroy(ap); mps_root_destroy(mps_root[1]); mps_root_destroy(mps_root[0]); diff --git a/mps/code/finaltest.c b/mps/code/finaltest.c index f449d7e1acf..a34dccec3be 100644 --- a/mps/code/finaltest.c +++ b/mps/code/finaltest.c @@ -284,6 +284,7 @@ int main(int argc, char *argv[]) test_mode(ModePOLL, arena, chain); test_mode(ModePARK, arena, NULL); + mps_arena_park(arena); mps_chain_destroy(chain); mps_thread_dereg(thread); mps_arena_destroy(arena); diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c index 2a18d1a7d10..c958128ce4f 100644 --- a/mps/code/gcbench.c +++ b/mps/code/gcbench.c @@ -243,6 +243,7 @@ static void arena_setup(gcthread_fn_t fn, RESMUST(mps_pool_create_k(&pool, arena, pool_class, args)); } MPS_ARGS_END(args); watch(fn, name); + mps_arena_park(arena); mps_pool_destroy(pool); mps_fmt_destroy(format); if (ngen > 0) diff --git a/mps/code/mpsicv.c b/mps/code/mpsicv.c index 55396aee3fe..6a241561a22 100644 --- a/mps/code/mpsicv.c +++ b/mps/code/mpsicv.c @@ -21,7 +21,7 @@ #define exactRootsCOUNT 49 #define ambigRootsCOUNT 49 -#define OBJECTS 200000 +#define OBJECTS 100000 #define patternFREQ 100 /* objNULL needs to be odd so that it's ignored in exactRoots. */ @@ -552,6 +552,8 @@ static void *test(void *arg, size_t s) mps_free(mv, alloced_obj, 32); alloc_v_test(mv); + + mps_arena_park(arena); mps_pool_destroy(mv); mps_ap_destroy(ap); mps_root_destroy(fmtRoot); @@ -589,7 +591,6 @@ int main(int argc, char *argv[]) marker, (size_t)0), "root_create_reg"); - (mps_tramp)(&r, test, arena, 0); /* non-inlined trampoline */ mps_tramp(&r, test, arena, 0); mps_root_destroy(reg_root); mps_thread_dereg(thread); diff --git a/mps/code/steptest.c b/mps/code/steptest.c index deee85fef2e..546eaa7e417 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -478,6 +478,8 @@ static void *test(void *arg, size_t s) printf(" %"PRIuLONGEST" clock reads; ", (ulongest_t)clock_reads); print_time("", total_clock_time / clock_reads, " per read;"); print_time(" recently measured as ", clock_time, ").\n"); + + mps_arena_park(arena); mps_ap_destroy(ap); mps_root_destroy(exactRoot); mps_root_destroy(ambigRoot); diff --git a/mps/code/walkt0.c b/mps/code/walkt0.c index 929408fc4b4..6b0002000d4 100644 --- a/mps/code/walkt0.c +++ b/mps/code/walkt0.c @@ -191,11 +191,14 @@ static void *test(mps_arena_t arena, mps_class_t pool_class) /* Note: stepper finds more than we expect, due to pad objects */ /* printf("stepper found %ld objs\n", sd->count); */ + + mps_arena_park(arena); mps_ap_destroy(ap); mps_root_destroy(exactRoot); mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); + mps_arena_release(arena); return NULL; } diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c index 06ef499f5b7..220368f39d3 100644 --- a/mps/code/zcoll.c +++ b/mps/code/zcoll.c @@ -774,6 +774,7 @@ static void *testscriptB(void *arg, size_t s) testscriptC(arena, ap, script); printf(" Destroy roots, pools, arena etc.\n\n"); + mps_arena_park(arena); mps_root_destroy(root_stackreg); mps_ap_destroy(ap); mps_root_destroy(root_table_Exact); diff --git a/mps/code/zmess.c b/mps/code/zmess.c index 555e7377d2c..4cfaf9944f3 100644 --- a/mps/code/zmess.c +++ b/mps/code/zmess.c @@ -381,6 +381,7 @@ static void *testscriptB(void *arg, size_t s) testscriptC(arena, script); + mps_arena_park(arena); mps_ap_destroy(ap); mps_root_destroy(root_table); mps_pool_destroy(amc); From ccb1d5a47c1a4807adad0f71276b63126d916a64 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 12:54:33 +0100 Subject: [PATCH 66/93] Improve coverage of events by turning on mps_telemetry_control=all and by running mpseventcnv, mpseventtxt and (if available) mpseventsql. Copied from Perforce Change: 186025 ServerID: perforce.ravenbrook.com --- mps/tool/testcoverage | 2 ++ mps/tool/testrun.sh | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/mps/tool/testcoverage b/mps/tool/testcoverage index dacae8cd5f4..cf4c62ae703 100755 --- a/mps/tool/testcoverage +++ b/mps/tool/testcoverage @@ -20,6 +20,8 @@ OS=$(uname -s) PROJECT=mps TOOL=$(dirname "$0") CODE=$TOOL/../code +MPS_TELEMETRY_CONTROL=all +export MPS_TELEMETRY_CONTROL case "$ARCH-$OS" in *-Darwin) diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index 175443bf820..f1719e7549a 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -67,13 +67,17 @@ echo "Test directory: $TEST_DIR" shift TEST_CASES=${*:-${ALL_TEST_CASES}} -SEPARATOR="----------------------------------------" +SEPARATOR=---------------------------------------- TEST_COUNT=0 PASS_COUNT=0 FAIL_COUNT=0 for TESTCASE in $TEST_CASES; do - TEST="$(basename -- "$TESTCASE")" - LOGTEST="$LOGDIR/$TEST" + TEST=$(basename -- "$TESTCASE") + LOGTEST=$LOGDIR/$TEST + TELEMETRY=$LOGDIR/$TEST-io + MPS_TELEMETRY_FILENAME=$TELEMETRY.log + export MPS_TELEMETRY_FILENAME + echo "Running $TEST" TEST_COUNT=$(expr $TEST_COUNT + 1) if "$TEST_DIR/$TESTCASE" > "$LOGTEST" 2>&1; then @@ -86,6 +90,18 @@ for TESTCASE in $TEST_CASES; do echo ${SEPARATOR}${SEPARATOR} FAIL_COUNT=$(expr $FAIL_COUNT + 1) fi + + if [ -f "$MPS_TELEMETRY_FILENAME" ]; then + "$TEST_DIR/mpseventcnv" -f "$MPS_TELEMETRY_FILENAME" > "$TELEMETRY.cnv" + gzip "$MPS_TELEMETRY_FILENAME" + "$TEST_DIR/mpseventtxt" < "$TELEMETRY.cnv" > "$TELEMETRY.txt" + if [ -x "$TEST_DIR/mpseventsql" ]; then + MPS_TELEMETRY_DATABASE=$TELEMETRY.db + export MPS_TELEMETRY_DATABASE + "$TEST_DIR/mpseventsql" < "$TELEMETRY.cnv" >> "$LOGTEST" 2>&1 + fi + rm -f "$TELEMETRY.cnv" "$TELEMETRY.txt" "$TELEMETRY.db" + fi done if [ $FAIL_COUNT = 0 ]; then echo "Tests: $TEST_COUNT. All tests pass." From 4c7106cd6f8d8c33c82a74130d05e44852d5a519 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 13:35:21 +0100 Subject: [PATCH 67/93] Check the trace argument to tracequantum. Copied from Perforce Change: 186027 ServerID: perforce.ravenbrook.com --- mps/code/trace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mps/code/trace.c b/mps/code/trace.c index bd2b871fb11..219c6d89a2c 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1738,7 +1738,10 @@ Res TraceStart(Trace trace, double mortality, double finishingTime) void TraceQuantum(Trace trace) { Size pollEnd; - Arena arena = trace->arena; + Arena arena; + + AVERT(Trace, trace); + arena = trace->arena; pollEnd = traceWorkClock(trace) + trace->rate; do { From 8f9c8f777bc21fd48117e36334a8303ad2a8ad04 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 15:58:16 +0100 Subject: [PATCH 68/93] Test cases must call mps_arena_park before mps_chain_destroy. Reduce the amount of work done by some test cases, to make the suite easier to run. Update the list of passing test cases. Copied from Perforce Change: 186030 ServerID: perforce.ravenbrook.com --- mps/test/function/10.c | 8 +++++--- mps/test/function/103.c | 1 + mps/test/function/104.c | 1 + mps/test/function/105.c | 1 + mps/test/function/106.c | 1 + mps/test/function/107.c | 1 + mps/test/function/108.c | 1 + mps/test/function/109.c | 1 + mps/test/function/11.c | 1 + mps/test/function/110.c | 2 ++ mps/test/function/111.c | 1 + mps/test/function/112.c | 1 + mps/test/function/113.c | 5 +++-- mps/test/function/114.c | 5 +++-- mps/test/function/116.c | 1 + mps/test/function/118.c | 1 + mps/test/function/12.c | 1 + mps/test/function/122.c | 1 + mps/test/function/123.c | 1 + mps/test/function/124.c | 3 ++- mps/test/function/125.c | 1 + mps/test/function/126.c | 1 + mps/test/function/127.c | 3 ++- mps/test/function/128.c | 3 ++- mps/test/function/129.c | 3 ++- mps/test/function/12p.c | 1 + mps/test/function/13.c | 1 + mps/test/function/130.c | 1 + mps/test/function/131.c | 1 + mps/test/function/132.c | 1 + mps/test/function/133.c | 1 + mps/test/function/134.c | 3 ++- mps/test/function/138.c | 1 + mps/test/function/14.c | 1 + mps/test/function/147.c | 1 + mps/test/function/148.c | 1 + mps/test/function/149.c | 1 + mps/test/function/15.c | 1 + mps/test/function/150.c | 2 ++ mps/test/function/151.c | 1 + mps/test/function/152.c | 1 + mps/test/function/153.c | 1 + mps/test/function/16.c | 1 + mps/test/function/17.c | 1 + mps/test/function/171.c | 1 + mps/test/function/2.c | 1 + mps/test/function/215.c | 1 + mps/test/function/223.c | 1 + mps/test/function/226.c | 1 + mps/test/function/227.c | 1 + mps/test/function/23.c | 2 ++ mps/test/function/24.c | 9 ++++++--- mps/test/function/25.c | 1 + mps/test/function/27.c | 2 +- mps/test/function/28.c | 1 + mps/test/function/29.c | 1 + mps/test/function/3.c | 1 + mps/test/function/30.c | 1 + mps/test/function/31.c | 1 + mps/test/function/32.c | 1 + mps/test/function/33.c | 1 + mps/test/function/34.c | 1 + mps/test/function/35.c | 1 + mps/test/function/36.c | 1 + mps/test/function/37.c | 1 + mps/test/function/38.c | 1 + mps/test/function/39.c | 1 + mps/test/function/4.c | 1 + mps/test/function/40.c | 1 + mps/test/function/41.c | 1 + mps/test/function/42.c | 1 + mps/test/function/43.c | 1 + mps/test/function/44.c | 1 + mps/test/function/45.c | 1 + mps/test/function/46.c | 1 + mps/test/function/47.c | 1 + mps/test/function/48.c | 1 + mps/test/function/49.c | 1 + mps/test/function/5.c | 1 + mps/test/function/50.c | 2 ++ mps/test/function/51.c | 1 + mps/test/function/52.c | 1 + mps/test/function/53.c | 1 + mps/test/function/54.c | 1 + mps/test/function/55.c | 1 + mps/test/function/56.c | 1 + mps/test/function/57.c | 1 + mps/test/function/6.c | 2 ++ mps/test/function/60.c | 7 ++++--- mps/test/function/61.c | 1 + mps/test/function/62.c | 1 + mps/test/function/63.c | 1 + mps/test/function/64.c | 1 + mps/test/function/65.c | 1 + mps/test/function/66.c | 1 + mps/test/function/69.c | 1 + mps/test/function/72.c | 1 + mps/test/function/73.c | 1 + mps/test/function/74.c | 1 + mps/test/function/75.c | 1 + mps/test/function/76.c | 1 + mps/test/function/77.c | 1 + mps/test/function/78.c | 1 + mps/test/function/79.c | 1 + mps/test/function/80.c | 1 + mps/test/function/81.c | 1 + mps/test/function/83.c | 1 + mps/test/function/9.c | 1 + mps/test/function/96.c | 1 + mps/test/function/97.c | 1 + mps/test/function/99.c | 1 + mps/test/testsets/passing | 6 +++--- 112 files changed, 140 insertions(+), 22 deletions(-) diff --git a/mps/test/function/10.c b/mps/test/function/10.c index 912901881a5..47cb48f5e0d 100644 --- a/mps/test/function/10.c +++ b/mps/test/function/10.c @@ -10,6 +10,7 @@ END_HEADER #include "testlib.h" #include "mpscamc.h" +#define OBJSIZE (1u << 20) #define genCOUNT (3) static mps_gen_param_s testChain[genCOUNT] = { @@ -26,7 +27,7 @@ static mps_res_t myscan(mps_ss_t ss, mps_addr_t base, mps_addr_t limit) static mps_addr_t myskip(mps_addr_t object) { - return (mps_addr_t) ((char *) object + 1); + return (mps_addr_t) ((char *) object + OBJSIZE); } static void mycopy(mps_addr_t object, mps_addr_t to) @@ -99,12 +100,13 @@ static void test(void) for(i=0; i<1000; i++) { do - { die(mps_reserve(&p, ap, 1024*1024), "Reserve: "); + { die(mps_reserve(&p, ap, OBJSIZE), "Reserve: "); } - while (!mps_commit(ap, p, 1024*1024)); + while (!mps_commit(ap, p, OBJSIZE)); comment("%i megabytes allocated", i); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_fmt_destroy(format); diff --git a/mps/test/function/103.c b/mps/test/function/103.c index c8c27225160..fc4a7fa160a 100644 --- a/mps/test/function/103.c +++ b/mps/test/function/103.c @@ -136,6 +136,7 @@ static void test(void) mps_arena_collect(arena); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/104.c b/mps/test/function/104.c index b267b9b07fe..6faba1afab9 100644 --- a/mps/test/function/104.c +++ b/mps/test/function/104.c @@ -213,6 +213,7 @@ static void test(void) comment("ok"); } + mps_arena_park(arena); mps_ap_destroy(apamc); mps_ap_destroy(aplo); mps_ap_destroy(apawl); diff --git a/mps/test/function/105.c b/mps/test/function/105.c index 888a0f74fa3..c3bf5c69a16 100644 --- a/mps/test/function/105.c +++ b/mps/test/function/105.c @@ -67,6 +67,7 @@ static void test(void) b = allocone(apamc, 1, mps_rank_exact()); a = allocone(apweak, 1, mps_rank_weak()); + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_ap_destroy(apweak); diff --git a/mps/test/function/106.c b/mps/test/function/106.c index 8f751cfaeb2..2ba628970c0 100644 --- a/mps/test/function/106.c +++ b/mps/test/function/106.c @@ -102,6 +102,7 @@ static void test(void) c = conc(string_ch("Hello there"), string_ch(" folks!")); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/107.c b/mps/test/function/107.c index 0a83d04a15d..91b5f02fc21 100644 --- a/mps/test/function/107.c +++ b/mps/test/function/107.c @@ -103,6 +103,7 @@ static void test(void) z = alloclo(ap, 0x4000); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/108.c b/mps/test/function/108.c index 10631e5eb5c..6dab9f5839d 100644 --- a/mps/test/function/108.c +++ b/mps/test/function/108.c @@ -82,6 +82,7 @@ static void test(void) b = allocdumb(apamc, 0x400*64, 0); } + mps_arena_park(arena); mps_ap_destroy(aplo); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/109.c b/mps/test/function/109.c index 0fccb523989..bccb5cfec7f 100644 --- a/mps/test/function/109.c +++ b/mps/test/function/109.c @@ -267,6 +267,7 @@ static void test(void) report("count2", "%d", final_count); + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_ap_destroy(aplo); diff --git a/mps/test/function/11.c b/mps/test/function/11.c index 286b06a385f..72009080e7f 100644 --- a/mps/test/function/11.c +++ b/mps/test/function/11.c @@ -77,6 +77,7 @@ static void test(void) comment("%d: %x", j, (int) a); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/110.c b/mps/test/function/110.c index e61536040de..bbf5aa0dc6d 100644 --- a/mps/test/function/110.c +++ b/mps/test/function/110.c @@ -262,6 +262,7 @@ static void test(void) finalpoll(&z, FINAL_DISCARD); } + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); @@ -280,6 +281,7 @@ static void test(void) report("count2", "%d", final_count); + mps_arena_park(arena); mps_pool_destroy(poolamc); mps_pool_destroy(poolawl); mps_pool_destroy(poollo); diff --git a/mps/test/function/111.c b/mps/test/function/111.c index f7544f82917..6117a82d29c 100644 --- a/mps/test/function/111.c +++ b/mps/test/function/111.c @@ -193,6 +193,7 @@ static void test(void) /* now to test leaving messages open for a long time! */ + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_ap_destroy(aplo); diff --git a/mps/test/function/112.c b/mps/test/function/112.c index 6626add3d9e..e22a67e4dfc 100644 --- a/mps/test/function/112.c +++ b/mps/test/function/112.c @@ -67,6 +67,7 @@ static void test(void) { /* (total allocated is 1000 M) */ + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); diff --git a/mps/test/function/113.c b/mps/test/function/113.c index 83a42fb1709..a897c7fb60a 100644 --- a/mps/test/function/113.c +++ b/mps/test/function/113.c @@ -73,9 +73,9 @@ static void test(void) b = allocone(apamc, 1, mps_rank_exact()); - for (j=1; j<100; j++) + for (j=1; j<=10; j++) { - comment("%i of 100.", j); + comment("%i of 10.", j); a = allocone(apamc, 5, mps_rank_exact()); b = a; c = a; @@ -100,6 +100,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/114.c b/mps/test/function/114.c index 6510796a9bb..c273f30cd52 100644 --- a/mps/test/function/114.c +++ b/mps/test/function/114.c @@ -73,9 +73,9 @@ static void test(void) b = allocone(apamc, 1, mps_rank_exact()); - for (j=1; j<100; j++) + for (j=1; j<=10; j++) { - comment("%i of 100.", j); + comment("%i of 10.", j); a = allocone(apamc, 5, mps_rank_exact()); b = a; c = a; @@ -100,6 +100,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/116.c b/mps/test/function/116.c index b065af6103e..d843e2b4691 100644 --- a/mps/test/function/116.c +++ b/mps/test/function/116.c @@ -96,6 +96,7 @@ static void test(void) report("postdie", "%s", err_text(res)); } + mps_arena_park(arena); mps_ap_destroy(ap2); comment("Destroyed ap."); diff --git a/mps/test/function/118.c b/mps/test/function/118.c index 4185a586dd6..a77ec4f8f8b 100644 --- a/mps/test/function/118.c +++ b/mps/test/function/118.c @@ -127,6 +127,7 @@ static void test(void) /* now simulate rest of commit */ (void)(busy_ap->limit != 0 || mps_ap_trip(busy_ap, busy_init, objSIZE)); + mps_arena_park(arena); mps_ap_destroy(busy_ap); mps_ap_destroy(ap); mps_pool_destroy(pool); diff --git a/mps/test/function/12.c b/mps/test/function/12.c index 9ac936dc763..5ebaec0dbb4 100644 --- a/mps/test/function/12.c +++ b/mps/test/function/12.c @@ -181,6 +181,7 @@ static void test(void) mps_ap_destroy(ap[i]); } + mps_arena_park(arena); mps_pool_destroy(pool); comment("Destroyed pool."); mps_chain_destroy(chain); diff --git a/mps/test/function/122.c b/mps/test/function/122.c index 4ba0c0c6090..349e5699628 100644 --- a/mps/test/function/122.c +++ b/mps/test/function/122.c @@ -156,6 +156,7 @@ static void test(void) report("count2", "%ld", rootcount); report("countspec", "%ld", speccount); + mps_arena_park(arena); mps_ap_destroy(apamc); mps_ap_destroy(aplo); mps_ap_destroy(apawl); diff --git a/mps/test/function/123.c b/mps/test/function/123.c index 280f05760cc..4166f30f685 100644 --- a/mps/test/function/123.c +++ b/mps/test/function/123.c @@ -95,6 +95,7 @@ static void test(void) setref(a, 0, b); } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/124.c b/mps/test/function/124.c index 5b84bea864f..cb4620b49de 100644 --- a/mps/test/function/124.c +++ b/mps/test/function/124.c @@ -30,7 +30,7 @@ static mps_gen_param_s testChain[genCOUNT] = { #define BACKITER (32) #define RAMPSIZE (128) -#define ITERATIONS (1000000ul) +#define ITERATIONS (100000ul) #define RAMP_INTERFACE /* @@ -137,6 +137,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); mps_chain_destroy(chain); diff --git a/mps/test/function/125.c b/mps/test/function/125.c index d457f9adc99..1ca2f61fe4a 100644 --- a/mps/test/function/125.c +++ b/mps/test/function/125.c @@ -79,6 +79,7 @@ static void test(void) mps_arena_collect(arena); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/126.c b/mps/test/function/126.c index 988205232f9..f72256a1095 100644 --- a/mps/test/function/126.c +++ b/mps/test/function/126.c @@ -81,6 +81,7 @@ static void test(void) comment("reserved %ld, committed %ld", mps_arena_reserved(arena), mps_arena_committed(arena)); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/127.c b/mps/test/function/127.c index afdb013e7c5..55c67961987 100644 --- a/mps/test/function/127.c +++ b/mps/test/function/127.c @@ -24,7 +24,7 @@ END_HEADER #define BACKITER (32) #define RAMPSIZE (128) -#define ITERATIONS (1000000ul) +#define ITERATIONS (100000ul) /* #define RAMP_INTERFACE @@ -137,6 +137,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/128.c b/mps/test/function/128.c index bfb406a23a2..6414e41d976 100644 --- a/mps/test/function/128.c +++ b/mps/test/function/128.c @@ -24,7 +24,7 @@ END_HEADER #define BACKITER (32) #define RAMPSIZE (128) -#define ITERATIONS (1000000ul) +#define ITERATIONS (100000ul) /* #define RAMP_INTERFACE @@ -137,6 +137,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/129.c b/mps/test/function/129.c index dd59be650f5..94512cf6e16 100644 --- a/mps/test/function/129.c +++ b/mps/test/function/129.c @@ -24,7 +24,7 @@ END_HEADER #define BACKITER (32) #define RAMPSIZE (128) -#define ITERATIONS (1000000ul) +#define ITERATIONS (100000ul) #define RAMP_INTERFACE /* @@ -136,6 +136,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/12p.c b/mps/test/function/12p.c index f748b8eddb7..db389e7f14f 100644 --- a/mps/test/function/12p.c +++ b/mps/test/function/12p.c @@ -196,6 +196,7 @@ cells = allocone(ap[0], NCELLS); mps_ap_destroy(ap[i]); } + mps_arena_park(arena); mps_pool_destroy(pool); comment("Destroyed pool."); diff --git a/mps/test/function/13.c b/mps/test/function/13.c index cd7662a8098..aa5ca31b3ee 100644 --- a/mps/test/function/13.c +++ b/mps/test/function/13.c @@ -192,6 +192,7 @@ cells = allocone(ap[0], NCELLS); mps_ap_destroy(ap[i]); } + mps_arena_park(arena); mps_pool_destroy(pool); comment("Destroyed pool."); diff --git a/mps/test/function/130.c b/mps/test/function/130.c index 1a4a6da3fec..4809d7bc74e 100644 --- a/mps/test/function/130.c +++ b/mps/test/function/130.c @@ -96,6 +96,7 @@ static void test(void) die(allocrone(&a, ap2, 128, mps_rank_exact()), "alloc failed"); + mps_arena_park(arena); mps_ap_destroy(ap2); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/131.c b/mps/test/function/131.c index 5256efeb141..06495ced080 100644 --- a/mps/test/function/131.c +++ b/mps/test/function/131.c @@ -101,6 +101,7 @@ static void test(void) report("postdie", "%s", err_text(res)); } + mps_arena_park(arena); mps_ap_destroy(ap2); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/132.c b/mps/test/function/132.c index f7cae603ce8..b617427cdfa 100644 --- a/mps/test/function/132.c +++ b/mps/test/function/132.c @@ -166,6 +166,7 @@ static void test(void) report("spill6", "%d", commit6-mps_arena_commit_limit(arena)); report("shrink6", "%d", avail5-avail6); + mps_arena_park(arena); mps_root_destroy(root); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/133.c b/mps/test/function/133.c index 0556d5cc9d3..d0ca1297af6 100644 --- a/mps/test/function/133.c +++ b/mps/test/function/133.c @@ -120,6 +120,7 @@ static void test(void) { /* destroy everything remaining */ + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/134.c b/mps/test/function/134.c index 178894d7316..5eee39e5c4f 100644 --- a/mps/test/function/134.c +++ b/mps/test/function/134.c @@ -24,7 +24,7 @@ END_HEADER #define BACKITER (32) #define RAMPSIZE (128) -#define ITERATIONS (1000000ul) +#define ITERATIONS (100000ul) #define RAMP_INTERFACE /* @@ -137,6 +137,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/138.c b/mps/test/function/138.c index 8c823c6c8a9..d4cfa5d5d4f 100644 --- a/mps/test/function/138.c +++ b/mps/test/function/138.c @@ -66,6 +66,7 @@ static void test(void) mps_arena_collect(arena); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/14.c b/mps/test/function/14.c index 9f0e9a4f26e..e77bafeb658 100644 --- a/mps/test/function/14.c +++ b/mps/test/function/14.c @@ -98,6 +98,7 @@ static void test(void) comment("Finished"); + mps_arena_park(arena); mps_ap_destroy(apA); mps_ap_destroy(apB); diff --git a/mps/test/function/147.c b/mps/test/function/147.c index 21c76bcdbdf..1911f05a54e 100644 --- a/mps/test/function/147.c +++ b/mps/test/function/147.c @@ -79,6 +79,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(sap); comment("Destroyed ap."); diff --git a/mps/test/function/148.c b/mps/test/function/148.c index ee80c9169bf..d78b9631450 100644 --- a/mps/test/function/148.c +++ b/mps/test/function/148.c @@ -124,6 +124,7 @@ static void test(void) report("inc4", "%ld", (com2-com1)/BIGSIZE); + mps_arena_park(arena); mps_ap_destroy(ap); mps_ap_destroy(sap); mps_pool_destroy(pool); diff --git a/mps/test/function/149.c b/mps/test/function/149.c index a9d47dac8dc..0792068fd28 100644 --- a/mps/test/function/149.c +++ b/mps/test/function/149.c @@ -168,6 +168,7 @@ static void test(void) { report("spill6", "%d", commit6-mps_arena_commit_limit(arena)); report("shrink6", "%d", avail5-avail6); + mps_arena_park(arena); mps_root_destroy(root); comment("Destroyed root."); diff --git a/mps/test/function/15.c b/mps/test/function/15.c index e84ad74313b..cf04dd75545 100644 --- a/mps/test/function/15.c +++ b/mps/test/function/15.c @@ -54,6 +54,7 @@ static void test(void) allocdumb(ap, 1024*256); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); diff --git a/mps/test/function/150.c b/mps/test/function/150.c index 1ff43383d3e..40202f6b482 100644 --- a/mps/test/function/150.c +++ b/mps/test/function/150.c @@ -286,6 +286,7 @@ static void test(void) messagepoll(&z, FINAL_DISCARD); } + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); @@ -304,6 +305,7 @@ static void test(void) report("count2", "%d", final_count); + mps_arena_park(arena); mps_pool_destroy(poolamc); mps_pool_destroy(poolawl); mps_pool_destroy(poollo); diff --git a/mps/test/function/151.c b/mps/test/function/151.c index c6bfb05de0b..9a1c20da6b2 100644 --- a/mps/test/function/151.c +++ b/mps/test/function/151.c @@ -59,6 +59,7 @@ static void test(void) comment("%i of %i", i, ITERATIONS); } + mps_arena_park(arena); mps_ap_destroy(sap); comment("Destroyed ap."); diff --git a/mps/test/function/152.c b/mps/test/function/152.c index 784a40a2a19..1836637668e 100644 --- a/mps/test/function/152.c +++ b/mps/test/function/152.c @@ -100,6 +100,7 @@ static void test(void) report("com", "%ld", com1); report("inc2", "%ld", (com1-com)/BIGSIZE); + mps_arena_park(arena); mps_ap_destroy(ap); mps_ap_destroy(sap); comment("Destroyed ap."); diff --git a/mps/test/function/153.c b/mps/test/function/153.c index 97dac39277f..fb23c98dee1 100644 --- a/mps/test/function/153.c +++ b/mps/test/function/153.c @@ -58,6 +58,7 @@ static void test(void) comment("%i of %i", i, ITERATIONS); } + mps_arena_park(arena); mps_ap_destroy(sap); comment("Destroyed ap."); diff --git a/mps/test/function/16.c b/mps/test/function/16.c index d89940f6542..f3088208377 100644 --- a/mps/test/function/16.c +++ b/mps/test/function/16.c @@ -88,6 +88,7 @@ static void test(void) comment("Finished"); + mps_arena_park(arena); mps_ap_destroy(apA); mps_ap_destroy(apB); diff --git a/mps/test/function/17.c b/mps/test/function/17.c index f029f9a742f..a8f665d3ab7 100644 --- a/mps/test/function/17.c +++ b/mps/test/function/17.c @@ -47,6 +47,7 @@ static void test(void) pool1=pool; } + mps_arena_park(arena); mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); diff --git a/mps/test/function/171.c b/mps/test/function/171.c index b6a0037aa5e..4473aae0f35 100644 --- a/mps/test/function/171.c +++ b/mps/test/function/171.c @@ -138,6 +138,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/2.c b/mps/test/function/2.c index 2133f56f47a..7c0c6974919 100644 --- a/mps/test/function/2.c +++ b/mps/test/function/2.c @@ -82,6 +82,7 @@ static void test(void) b = b->ref[0]; } + mps_arena_park(arena); mps_ap_destroy(ap); comment("Destroyed ap."); diff --git a/mps/test/function/215.c b/mps/test/function/215.c index ad55e9df432..14ad7a1b808 100644 --- a/mps/test/function/215.c +++ b/mps/test/function/215.c @@ -150,6 +150,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/223.c b/mps/test/function/223.c index 9340e44f456..7418a356518 100644 --- a/mps/test/function/223.c +++ b/mps/test/function/223.c @@ -150,6 +150,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed ap."); diff --git a/mps/test/function/226.c b/mps/test/function/226.c index 361c7cf1848..712b35972db 100644 --- a/mps/test/function/226.c +++ b/mps/test/function/226.c @@ -171,6 +171,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/227.c b/mps/test/function/227.c index 89e40fdae74..af07e083a32 100644 --- a/mps/test/function/227.c +++ b/mps/test/function/227.c @@ -164,6 +164,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apamc1); mps_ap_destroy(apamc2); comment("Destroyed ap."); diff --git a/mps/test/function/23.c b/mps/test/function/23.c index 02f08029a68..afcf764a059 100644 --- a/mps/test/function/23.c +++ b/mps/test/function/23.c @@ -103,6 +103,8 @@ static void test(void) r = mps_alloc(&p, poolMV, 1024*1024); report("refuse4", "%s", err_text(r)); } + + mps_arena_park(arena); mps_pool_destroy(poolMV); mps_ap_destroy(ap); diff --git a/mps/test/function/24.c b/mps/test/function/24.c index a16cdcec6e8..e28de201019 100644 --- a/mps/test/function/24.c +++ b/mps/test/function/24.c @@ -10,6 +10,8 @@ END_HEADER #include "testlib.h" #include "mpscamc.h" +#define OBJSIZE (10 * (1u << 20)) + #define genCOUNT (3) static mps_gen_param_s testChain[genCOUNT] = { @@ -27,7 +29,7 @@ static mps_res_t myscan(mps_ss_t ss, mps_addr_t base, mps_addr_t limit) static mps_addr_t myskip(mps_addr_t object) { - return (mps_addr_t) ((char *) object + 1); + return (mps_addr_t) ((char *) object + OBJSIZE); } static void mycopy(mps_addr_t object, mps_addr_t to) @@ -100,13 +102,14 @@ static void test(void) for(i=1; i<1000; i++) { do - { die(mps_reserve(&p, ap, 10*1024*1024), "Reserve: "); + { die(mps_reserve(&p, ap, OBJSIZE), "Reserve: "); } - while (!mps_commit(ap, p, 10*1024*1024)); + while (!mps_commit(ap, p, OBJSIZE)); comment("%i at %p", i, p); comment("%i objects of 10 megabytes each allocated", i); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_fmt_destroy(format); diff --git a/mps/test/function/25.c b/mps/test/function/25.c index 5ee683d2ccf..040202bacdf 100644 --- a/mps/test/function/25.c +++ b/mps/test/function/25.c @@ -94,6 +94,7 @@ static void test(void) { c = conc(string_ch("Hello there"), string_ch(" folks!")); } + mps_arena_park(arena); mps_ap_destroy(ap); comment("Destroyed ap."); diff --git a/mps/test/function/27.c b/mps/test/function/27.c index f0c186f3972..2f30b1a81c6 100644 --- a/mps/test/function/27.c +++ b/mps/test/function/27.c @@ -70,8 +70,8 @@ static void test(void) } + mps_arena_park(arena); mps_ap_destroy(ap); - mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); diff --git a/mps/test/function/28.c b/mps/test/function/28.c index 2ebfcd55bd2..5cbf8e803f4 100644 --- a/mps/test/function/28.c +++ b/mps/test/function/28.c @@ -96,6 +96,7 @@ static void test(void) checkfrom(a); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/29.c b/mps/test/function/29.c index d3294f348b0..70ef940a948 100644 --- a/mps/test/function/29.c +++ b/mps/test/function/29.c @@ -94,6 +94,7 @@ static void test(void) { z = alloclo(ap, 0x4000); } + mps_arena_park(arena); mps_ap_destroy(ap); comment("Destroyed ap."); diff --git a/mps/test/function/3.c b/mps/test/function/3.c index ffc2a533b40..02400bd0e77 100644 --- a/mps/test/function/3.c +++ b/mps/test/function/3.c @@ -82,6 +82,7 @@ static void test(void) comment("%d: %x", j, (int) a); } + mps_arena_park(arena); mps_ap_destroy(ap); comment("Destroyed ap."); diff --git a/mps/test/function/30.c b/mps/test/function/30.c index 748cf8b56a7..583429d8bc2 100644 --- a/mps/test/function/30.c +++ b/mps/test/function/30.c @@ -85,6 +85,7 @@ static void test(void) checkfrom(a); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_fmt_destroy(format); diff --git a/mps/test/function/31.c b/mps/test/function/31.c index 2221ed53e01..3000a11f1cc 100644 --- a/mps/test/function/31.c +++ b/mps/test/function/31.c @@ -83,6 +83,7 @@ static void test(void) comment("%d of 1000.", i); } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/32.c b/mps/test/function/32.c index f3cb17f155b..465899c6a13 100644 --- a/mps/test/function/32.c +++ b/mps/test/function/32.c @@ -83,6 +83,7 @@ static void test(void) b = allocdumb(apamc, 0x400*64, 0); } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/33.c b/mps/test/function/33.c index a883b7a7677..31eaeb1164f 100644 --- a/mps/test/function/33.c +++ b/mps/test/function/33.c @@ -82,6 +82,7 @@ static void test(void) b = allocdumb(apamc, 0x400*64, 0); } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/34.c b/mps/test/function/34.c index de1ad4ab423..3d513c75dfe 100644 --- a/mps/test/function/34.c +++ b/mps/test/function/34.c @@ -85,6 +85,7 @@ static void test(void) b = allocdumb(apamc, 0x400*64, 0); } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/35.c b/mps/test/function/35.c index a79ab52c99c..42def83780a 100644 --- a/mps/test/function/35.c +++ b/mps/test/function/35.c @@ -107,6 +107,7 @@ static void test(void) checkfrom(*a); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/36.c b/mps/test/function/36.c index 3d4482311a3..609d9f9210b 100644 --- a/mps/test/function/36.c +++ b/mps/test/function/36.c @@ -90,6 +90,7 @@ static void test(void) setref(a[j], z, a[k]); } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/37.c b/mps/test/function/37.c index 275cd58dce4..664e9a3dd68 100644 --- a/mps/test/function/37.c +++ b/mps/test/function/37.c @@ -109,6 +109,7 @@ static void test(void) checkfrom(*a); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/38.c b/mps/test/function/38.c index 409cc6a97b8..e3512864442 100644 --- a/mps/test/function/38.c +++ b/mps/test/function/38.c @@ -151,6 +151,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolmv); diff --git a/mps/test/function/39.c b/mps/test/function/39.c index 5b27b4ec94b..e2972230a8d 100644 --- a/mps/test/function/39.c +++ b/mps/test/function/39.c @@ -84,6 +84,7 @@ static void test(void) b = allocdumb(apamc, 0x400*64, 0); } + mps_arena_park(arena); mps_ap_destroy(aplo); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/4.c b/mps/test/function/4.c index 3294eb0a03e..e730bc77ff3 100644 --- a/mps/test/function/4.c +++ b/mps/test/function/4.c @@ -94,6 +94,7 @@ static void test(void) time0 = time1; } + mps_arena_park(arena); mps_ap_destroy(ap); comment("Destroyed ap."); diff --git a/mps/test/function/40.c b/mps/test/function/40.c index 5257e1fcfc1..de0e4dbe462 100644 --- a/mps/test/function/40.c +++ b/mps/test/function/40.c @@ -75,6 +75,7 @@ static void test(void) DC; DMC; + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/41.c b/mps/test/function/41.c index b394e5f37f8..8fcdb372a6d 100644 --- a/mps/test/function/41.c +++ b/mps/test/function/41.c @@ -110,6 +110,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/42.c b/mps/test/function/42.c index 093246cba11..b56a61f2a09 100644 --- a/mps/test/function/42.c +++ b/mps/test/function/42.c @@ -106,6 +106,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/43.c b/mps/test/function/43.c index da73237b90b..1b955f268b7 100644 --- a/mps/test/function/43.c +++ b/mps/test/function/43.c @@ -114,6 +114,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apweak); mps_ap_destroy(apexact); mps_ap_destroy(apamc); diff --git a/mps/test/function/44.c b/mps/test/function/44.c index 949fa922813..f38e36a06e0 100644 --- a/mps/test/function/44.c +++ b/mps/test/function/44.c @@ -166,6 +166,7 @@ static void test(void) RC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/45.c b/mps/test/function/45.c index 0442a4dbd35..e3c7f412931 100644 --- a/mps/test/function/45.c +++ b/mps/test/function/45.c @@ -191,6 +191,7 @@ static void test(void) mps_ap_destroy(ap[i]); } + mps_arena_park(arena); mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); diff --git a/mps/test/function/46.c b/mps/test/function/46.c index c5cd9437859..715ba899090 100644 --- a/mps/test/function/46.c +++ b/mps/test/function/46.c @@ -140,6 +140,7 @@ static void test(void) RC; } + mps_arena_park(arena); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/47.c b/mps/test/function/47.c index 28682810db0..ee7c5605c2e 100644 --- a/mps/test/function/47.c +++ b/mps/test/function/47.c @@ -87,6 +87,7 @@ static void test(void) { + mps_arena_park(arena); mps_ap_destroy(apawl); comment("Destroyed ap."); diff --git a/mps/test/function/48.c b/mps/test/function/48.c index 700c565dc63..3343684fdbf 100644 --- a/mps/test/function/48.c +++ b/mps/test/function/48.c @@ -115,6 +115,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_ap_destroy(apweak); diff --git a/mps/test/function/49.c b/mps/test/function/49.c index 5fd7f437e91..27864e380e9 100644 --- a/mps/test/function/49.c +++ b/mps/test/function/49.c @@ -273,6 +273,7 @@ static void test(void) report("count2", "%d", final_count); + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_ap_destroy(aplo); diff --git a/mps/test/function/5.c b/mps/test/function/5.c index ae5d74dd5af..7a91636ee30 100644 --- a/mps/test/function/5.c +++ b/mps/test/function/5.c @@ -78,6 +78,7 @@ static void test(void) q->data.size = OBJ_SIZE; (void) mps_commit(apA, p, OBJ_SIZE); + mps_arena_park(arena); mps_ap_destroy(apA); comment("Destroyed apA."); mps_ap_destroy(apB); diff --git a/mps/test/function/50.c b/mps/test/function/50.c index cae53e67e10..741f865eb98 100644 --- a/mps/test/function/50.c +++ b/mps/test/function/50.c @@ -263,6 +263,7 @@ static void test(void) finalpoll(&z, FINAL_DISCARD); } + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); @@ -281,6 +282,7 @@ static void test(void) report("count2", "%d", final_count); + mps_arena_park(arena); mps_pool_destroy(poolamc); mps_pool_destroy(poolawl); mps_pool_destroy(poollo); diff --git a/mps/test/function/51.c b/mps/test/function/51.c index 779445218ae..bdf1a87ad70 100644 --- a/mps/test/function/51.c +++ b/mps/test/function/51.c @@ -219,6 +219,7 @@ static void test(void) /* now to test leaving messages open for a long time! */ + mps_arena_park(arena); mps_ap_destroy(apamc); mps_ap_destroy(apamcz); mps_ap_destroy(apams); diff --git a/mps/test/function/52.c b/mps/test/function/52.c index 4663f49e65e..d0c757a3059 100644 --- a/mps/test/function/52.c +++ b/mps/test/function/52.c @@ -87,6 +87,7 @@ static void test(void) time0 = time1; } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/53.c b/mps/test/function/53.c index 4fc78b1b187..6012a05befc 100644 --- a/mps/test/function/53.c +++ b/mps/test/function/53.c @@ -103,6 +103,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apamc); mps_ap_destroy(aplo); comment("Destroyed aps."); diff --git a/mps/test/function/54.c b/mps/test/function/54.c index cbf4044a0e6..f2c712ac15a 100644 --- a/mps/test/function/54.c +++ b/mps/test/function/54.c @@ -105,6 +105,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/55.c b/mps/test/function/55.c index c8ed50f3c0c..f34a2fb1856 100644 --- a/mps/test/function/55.c +++ b/mps/test/function/55.c @@ -104,6 +104,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/56.c b/mps/test/function/56.c index 87f9a29b97a..697b2e04b6c 100644 --- a/mps/test/function/56.c +++ b/mps/test/function/56.c @@ -102,6 +102,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/57.c b/mps/test/function/57.c index 5e0177b10b4..dbaab342bd9 100644 --- a/mps/test/function/57.c +++ b/mps/test/function/57.c @@ -99,6 +99,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/6.c b/mps/test/function/6.c index 7e56e09317a..bbbe1217b3e 100644 --- a/mps/test/function/6.c +++ b/mps/test/function/6.c @@ -79,6 +79,8 @@ static void test(void) } } + mps_arena_park(arena); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/60.c b/mps/test/function/60.c index 51008852af2..b075e0b938e 100644 --- a/mps/test/function/60.c +++ b/mps/test/function/60.c @@ -68,11 +68,11 @@ static void test(void) mps_ap_create(&ap2, poolawl2, mps_rank_exact()), "create ap"); - for (j=1; j<100; j++) + for (j=1; j<=10; j++) { - comment("%i of 100.", j); + comment("%i of 10.", j); - for (i=1; i<10000; i++) + for (i=1; i<=1000; i++) { UC; a = allocone(ap1, 100, 1); @@ -85,6 +85,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(ap1); mps_ap_destroy(ap2); comment("Destroyed aps."); diff --git a/mps/test/function/61.c b/mps/test/function/61.c index 1d3df5e90e2..9ccd97d77de 100644 --- a/mps/test/function/61.c +++ b/mps/test/function/61.c @@ -79,6 +79,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(ap1); mps_ap_destroy(ap2); mps_pool_destroy(poolamc1); diff --git a/mps/test/function/62.c b/mps/test/function/62.c index cc99e36c7c9..1ea9ff432b3 100644 --- a/mps/test/function/62.c +++ b/mps/test/function/62.c @@ -79,6 +79,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(ap1); mps_ap_destroy(ap2); mps_pool_destroy(poolamc1); diff --git a/mps/test/function/63.c b/mps/test/function/63.c index a46c993b3f6..1e9b63693e3 100644 --- a/mps/test/function/63.c +++ b/mps/test/function/63.c @@ -73,6 +73,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(ap1); mps_pool_destroy(poolamc1); mps_chain_destroy(chain); diff --git a/mps/test/function/64.c b/mps/test/function/64.c index 7e9bb633d95..390567b7117 100644 --- a/mps/test/function/64.c +++ b/mps/test/function/64.c @@ -104,6 +104,7 @@ static void test(void) DMC; } + mps_arena_park(arena); mps_ap_destroy(apamc); mps_ap_destroy(aplo); mps_pool_destroy(poolamc); diff --git a/mps/test/function/65.c b/mps/test/function/65.c index 3300ca895ff..3305d96cd72 100644 --- a/mps/test/function/65.c +++ b/mps/test/function/65.c @@ -179,6 +179,7 @@ static void test(void) mps_arena_release(arena); comment("released."); + mps_arena_park(arena); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); mps_chain_destroy(chain); diff --git a/mps/test/function/66.c b/mps/test/function/66.c index 069a4b99358..d395dbb3637 100644 --- a/mps/test/function/66.c +++ b/mps/test/function/66.c @@ -155,6 +155,7 @@ static void test(void) { } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); comment("Destroyed aps."); diff --git a/mps/test/function/69.c b/mps/test/function/69.c index c86abc37fe4..bbc758b7f42 100644 --- a/mps/test/function/69.c +++ b/mps/test/function/69.c @@ -94,6 +94,7 @@ static void test(void) { mps_message_discard(arena, message); + mps_arena_park(arena); mps_root_destroy(root); mps_ap_destroy(ap); mps_pool_destroy(pool); diff --git a/mps/test/function/72.c b/mps/test/function/72.c index 2eb6b178529..946844d9492 100644 --- a/mps/test/function/72.c +++ b/mps/test/function/72.c @@ -80,6 +80,7 @@ static void test(void) fail(); + mps_arena_park(arena); mps_ap_destroy(ap); comment("Destroyed ap."); diff --git a/mps/test/function/73.c b/mps/test/function/73.c index 492aa6cd919..f38e6d1847a 100644 --- a/mps/test/function/73.c +++ b/mps/test/function/73.c @@ -60,6 +60,7 @@ static void test(void) { /* (total allocated is 1000 M) */ + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); diff --git a/mps/test/function/74.c b/mps/test/function/74.c index 40f86f09e14..58e280b544f 100644 --- a/mps/test/function/74.c +++ b/mps/test/function/74.c @@ -60,6 +60,7 @@ static void test(void) { /* (total allocated is 1000 M) */ + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); diff --git a/mps/test/function/75.c b/mps/test/function/75.c index d6e4a38e870..859471cfbbc 100644 --- a/mps/test/function/75.c +++ b/mps/test/function/75.c @@ -69,6 +69,7 @@ static void test(void) /* (total allocated is 1000 M) */ + mps_arena_park(arena); mps_root_destroy(root0); mps_root_destroy(root1); comment("Destroyed roots."); diff --git a/mps/test/function/76.c b/mps/test/function/76.c index 89120d6aa97..72f2977f80c 100644 --- a/mps/test/function/76.c +++ b/mps/test/function/76.c @@ -121,6 +121,7 @@ static void test(void) /* now to test leaving messages open for a long time! */ + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_ap_destroy(aplo); diff --git a/mps/test/function/77.c b/mps/test/function/77.c index 7a32973ecd2..e2cae02611b 100644 --- a/mps/test/function/77.c +++ b/mps/test/function/77.c @@ -94,6 +94,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/78.c b/mps/test/function/78.c index 75c371f7395..331c0f2b2be 100644 --- a/mps/test/function/78.c +++ b/mps/test/function/78.c @@ -97,6 +97,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/79.c b/mps/test/function/79.c index 42163242b73..78857b4c3be 100644 --- a/mps/test/function/79.c +++ b/mps/test/function/79.c @@ -94,6 +94,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/80.c b/mps/test/function/80.c index bdc5843fcc8..2d373206f73 100644 --- a/mps/test/function/80.c +++ b/mps/test/function/80.c @@ -94,6 +94,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apawl); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/function/81.c b/mps/test/function/81.c index ccaad2111bb..4443612896a 100644 --- a/mps/test/function/81.c +++ b/mps/test/function/81.c @@ -78,6 +78,7 @@ static void test(void) mps_arena_collect(arena); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/83.c b/mps/test/function/83.c index 5524e4ebd26..baad036e364 100644 --- a/mps/test/function/83.c +++ b/mps/test/function/83.c @@ -107,6 +107,7 @@ static void test(void) report("d", "%p", d); + mps_arena_park(arena); mps_ap_destroy(ap1); mps_ap_destroy(ap2); mps_pool_destroy(pool1); diff --git a/mps/test/function/9.c b/mps/test/function/9.c index 9f205a1654a..6f124f5609c 100644 --- a/mps/test/function/9.c +++ b/mps/test/function/9.c @@ -58,6 +58,7 @@ static void test(void) a = allocdumb(ap, 1024*1024*80); + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/96.c b/mps/test/function/96.c index 3ccdb838495..210fbf46542 100644 --- a/mps/test/function/96.c +++ b/mps/test/function/96.c @@ -128,6 +128,7 @@ static void test(void) mps_arena_collect(arena); } + mps_arena_park(arena); mps_ap_destroy(ap); mps_pool_destroy(pool); mps_chain_destroy(chain); diff --git a/mps/test/function/97.c b/mps/test/function/97.c index cc7f49ef433..fabbc1136ab 100644 --- a/mps/test/function/97.c +++ b/mps/test/function/97.c @@ -222,6 +222,7 @@ static void test(void) comment("ok"); } + mps_arena_park(arena); mps_ap_destroy(apamc); mps_ap_destroy(aplo); mps_ap_destroy(apawl); diff --git a/mps/test/function/99.c b/mps/test/function/99.c index d2594f1a5e7..939991c1551 100644 --- a/mps/test/function/99.c +++ b/mps/test/function/99.c @@ -94,6 +94,7 @@ static void test(void) } } + mps_arena_park(arena); mps_ap_destroy(apamcz); mps_ap_destroy(apamc); mps_pool_destroy(poolamc); diff --git a/mps/test/testsets/passing b/mps/test/testsets/passing index fc00f37feb0..b77e04ddd82 100644 --- a/mps/test/testsets/passing +++ b/mps/test/testsets/passing @@ -47,7 +47,7 @@ function/41.c function/42.c function/43.c function/44.c -function/45.c +% function/45.c -- setref: to non-data object @@@@ function/46.c function/47.c function/48.c @@ -60,7 +60,7 @@ function/55.c function/56.c function/57.c % 58-59 -- no such test -% function/60.c -- slow +function/60.c function/61.c function/62.c function/63.c @@ -87,7 +87,7 @@ function/83.c % 84-95 -- no such test function/96.c function/97.c -function/98.c +% function/98.c -- tries to exhaust memory by mps_arena_create function/99.c function/100.c function/101.c From 77a107dd22adca6d58bcf7374393e8b818766688 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 15:58:36 +0100 Subject: [PATCH 69/93] Add instructions for running the test suite on os x. Copied from Perforce Change: 186031 ServerID: perforce.ravenbrook.com --- mps/test/test/README | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mps/test/test/README b/mps/test/test/README index 78ac29bdbe7..f9759c09bef 100644 --- a/mps/test/test/README +++ b/mps/test/test/README @@ -5,6 +5,20 @@ perl 5 (or higher). Go "perl qa help" for help, "perl qa options" to see what version of the harness you have (or look at the file "test/version"). -Some brief instructions are in guide.mm-qa in MM Information; ask - (ext 3822) if you need help, want to complain, &c. +Running on OS X +--------------- + +On OS X you can invoke the test suite like this:: + + $ cd test + $ alias qa="perl test/qa -i ../code -l ../code/xc/mps.build/Debug/mps.build/Objects-normal/x86_64/mps.o" + $ qa clib + $ qa run function/5.c + $ qa runset testsets/passing + +Each test case is compiled in its turn to the file +``test/obj/Darwin_12.3.0_i386__unix/tmp_test`` so you can debug it +with:: + + $ lldb test/obj/Darwin_12.3.0_i386__unix/tmp_test From 7d539cd4bc14a95c8576cd1dc5e3667916a5ba9d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 15:59:21 +0100 Subject: [PATCH 70/93] Improve the assertion output so that it is less suggestive of a bug in the mps and more suggestive of a problem that needs investigation. Copied from Perforce Change: 186032 ServerID: perforce.ravenbrook.com --- mps/code/mpsliban.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mps/code/mpsliban.c b/mps/code/mpsliban.c index 75a3d48d518..5e7cfdddc8b 100644 --- a/mps/code/mpsliban.c +++ b/mps/code/mpsliban.c @@ -61,13 +61,19 @@ int mps_lib_fputs(const char *s, mps_lib_FILE *stream) } -static void mps_lib_assert_fail_default(const char *file, - unsigned line, +static void mps_lib_assert_fail_default(const char *file, unsigned line, const char *condition) { - (void)fflush(stdout); /* synchronize */ - (void)fprintf(stderr, "%s:%u: MPS ASSERTION FAILED: %s\n", file, line, condition); - (void)fflush(stderr); /* make sure the message is output */ + /* Synchronize with stdout. */ + (void)fflush(stdout); + (void)fprintf(stderr, + "The MPS detected a problem!\n" + "%s:%u: MPS ASSERTION FAILED: %s\n" + "See the \"Assertions\" section in the reference manual:\n" + "http://ravenbrook.com/project/mps/master/manual/html/topic/error.html#assertions\n", + file, line, condition); + /* Ensure the message is output even if stderr is buffered. */ + (void)fflush(stderr); ASSERT_ABORT(); /* see config.h */ } From 97fd4f2d855145b3ef2e5457ad2688149343a783 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 17:13:00 +0100 Subject: [PATCH 71/93] Fix many mmqa test cases: * Use commit limit to test exhaustion instead of trying to exhaust virtual memory. * Use exact roots where possible so that we don't have to worry about local variables pinning down memory. * Reduce sizes and iterations so that tests complete in a reasonable amount of time. * Use "MVT" instead of "MV2". Update the list of passing test cases. Copied from Perforce Change: 186035 ServerID: perforce.ravenbrook.com --- mps/test/function/116.c | 1 + mps/test/function/130.c | 36 +++++++------------- mps/test/function/131.c | 38 +++++++-------------- mps/test/function/132.c | 4 +-- mps/test/function/133.c | 2 +- mps/test/function/149.c | 4 +-- mps/test/function/18.c | 3 +- mps/test/function/19.c | 3 +- mps/test/function/20.c | 3 +- mps/test/function/203.c | 69 +++++++++++++++++++-------------------- mps/test/function/204.c | 67 ++++++++++++++++++------------------- mps/test/function/205.c | 67 ++++++++++++++++++------------------- mps/test/function/214.c | 18 ++++------ mps/test/function/223.c | 15 ++++----- mps/test/function/224.c | 8 +++-- mps/test/function/77.c | 4 +-- mps/test/testsets/passing | 32 +++++++++--------- 17 files changed, 169 insertions(+), 205 deletions(-) diff --git a/mps/test/function/116.c b/mps/test/function/116.c index d843e2b4691..8c87bae4458 100644 --- a/mps/test/function/116.c +++ b/mps/test/function/116.c @@ -42,6 +42,7 @@ static void test(void) cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*30)), "create arena"); + die(mps_arena_commit_limit_set(arena, 1ul << 20), "commit_limit_set"); cdie(mps_thread_reg(&thread, arena), "register thread"); diff --git a/mps/test/function/130.c b/mps/test/function/130.c index 4809d7bc74e..f871d5944f8 100644 --- a/mps/test/function/130.c +++ b/mps/test/function/130.c @@ -19,8 +19,6 @@ static mps_gen_param_s testChain[genCOUNT] = { { 6000, 0.90 }, { 8000, 0.65 }, { 16000, 0.50 } }; -void *stackpointer; - mps_pool_t poolmv; mps_arena_t arena; @@ -28,28 +26,18 @@ mps_arena_t arena; static void test(void) { mps_pool_t pool; - mps_thr_t thread; - mps_root_t root; - mps_fmt_t format; mps_chain_t chain; mps_ap_t ap, ap2; - - mycell *a, *b; - + mycell *a[2]; mps_res_t res; int i; /* create an arena that can't grow beyond 30 M */ cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*30)), "create arena"); - mps_arena_commit_limit_set(arena, (size_t) (1024*1024*40)); - - cdie(mps_thread_reg(&thread, arena), "register thread"); - cdie(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread, - mps_stack_scan_ambig, stackpointer, 0), - "create root"); + die(mps_arena_commit_limit_set(arena, 1u << 20), "commit_limit_set"); cdie(mps_fmt_create_A(&format, arena, &fmtA), "create format"); @@ -64,12 +52,14 @@ static void test(void) /* allocate until full */ i = 0; - b = NULL; + a[0] = a[1] = NULL; + cdie(mps_root_create_table(&root, arena, mps_rank_ambig(), 0, (void *)&a, 2), + "create root"); - while (allocrone(&a, ap, 128, mps_rank_exact()) == MPS_RES_OK) { + while (allocrone(&a[0], ap, 128, mps_rank_exact()) == MPS_RES_OK) { i++; - setref(a, 0, b); - b = a; + setref(a[0], 0, a[1]); + a[1] = a[0]; } comment("%d objs allocated.", i); @@ -81,7 +71,7 @@ static void test(void) mps_ap_destroy(ap); for (i = 0; i < 10; i++) { - res = allocrone(&a, ap2, 128, mps_rank_exact()); + res = allocrone(&a[0], ap2, 128, mps_rank_exact()); report("predie", "%s", err_text(res)); } @@ -90,18 +80,17 @@ static void test(void) mps_root_destroy(root); for (i = 0; i < 10; i++) { - res = allocrone(&a, ap2, 128, mps_rank_exact()); + res = allocrone(&a[0], ap2, 128, mps_rank_exact()); report("postdie", "%s", err_text(res)); } - die(allocrone(&a, ap2, 128, mps_rank_exact()), "alloc failed"); + die(allocrone(&a[0], ap2, 128, mps_rank_exact()), "alloc failed"); mps_arena_park(arena); mps_ap_destroy(ap2); mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); - mps_thread_dereg(thread); mps_arena_destroy(arena); comment("Destroyed arena."); } @@ -109,9 +98,6 @@ static void test(void) int main(void) { - void *m; - stackpointer=&m; /* hack to get stack pointer */ - easy_tramp(test); pass(); return 0; diff --git a/mps/test/function/131.c b/mps/test/function/131.c index 06495ced080..0b0ae7be024 100644 --- a/mps/test/function/131.c +++ b/mps/test/function/131.c @@ -24,8 +24,6 @@ static mps_gen_param_s testChain[genCOUNT] = { { 6000, 0.90 }, { 8000, 0.65 }, { 16000, 0.50 } }; -void *stackpointer; - mps_pool_t poolmv; mps_arena_t arena; @@ -33,28 +31,18 @@ mps_arena_t arena; static void test(void) { mps_pool_t pool; - mps_thr_t thread; - mps_root_t root; - mps_fmt_t format; mps_chain_t chain; mps_ap_t ap, ap2; - - mycell *a, *b; - + mycell *a[2]; mps_res_t res; int i; - /* create an arena that can't grow beyond 30 M */ - cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*40)), + /* create an arena that can't grow beyond 1 M */ + cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*4)), "create arena"); - mps_arena_commit_limit_set(arena, (size_t) (1024*1024*30)); - - cdie(mps_thread_reg(&thread, arena), "register thread"); - cdie(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread, - mps_stack_scan_ambig, stackpointer, 0), - "create root"); + mps_arena_commit_limit_set(arena, (size_t) (1024*1024*1)); cdie( mps_fmt_create_A(&format, arena, &fmtA), @@ -71,12 +59,14 @@ static void test(void) /* allocate until full */ i = 0; - b = NULL; + a[0] = a[1] = NULL; + cdie(mps_root_create_table(&root, arena, mps_rank_ambig(), 0, (void *)&a, 2), + "create root"); - while (allocrone(&a, ap, 128, mps_rank_exact()) == MPS_RES_OK) { + while (allocrone(&a[0], ap, 128, mps_rank_exact()) == MPS_RES_OK) { i++; - setref(a, 0, b); - b = a; + setref(a[0], 0, a[1]); + a[1] = a[0]; } comment("%d objs allocated.", i); @@ -88,7 +78,7 @@ static void test(void) mps_ap_destroy(ap); for (i = 0; i < 10; i++) { - res = allocrone(&a, ap2, 128, mps_rank_exact()); + res = allocrone(&a[0], ap2, 128, mps_rank_exact()); report("predie", "%s", err_text(res)); } @@ -97,7 +87,7 @@ static void test(void) mps_root_destroy(root); for (i = 0; i < 10; i++) { - res = allocrone(&a, ap2, 128, mps_rank_exact()); + res = allocrone(&a[0], ap2, 128, mps_rank_exact()); report("postdie", "%s", err_text(res)); } @@ -106,7 +96,6 @@ static void test(void) mps_pool_destroy(pool); mps_chain_destroy(chain); mps_fmt_destroy(format); - mps_thread_dereg(thread); mps_arena_destroy(arena); comment("Destroyed arena."); } @@ -114,9 +103,6 @@ static void test(void) int main(void) { - void *m; - stackpointer=&m; /* hack to get stack pointer */ - easy_tramp(test); pass(); return 0; diff --git a/mps/test/function/132.c b/mps/test/function/132.c index b617427cdfa..b69e6cbcecf 100644 --- a/mps/test/function/132.c +++ b/mps/test/function/132.c @@ -23,8 +23,8 @@ OUTPUT_SPEC spill5 <= 0 grow5 = 0 avail5 > 1500000 - allocfail2 > 10000 - failres2 = MEMORY + allocfail2 > 5000 + failres2 = COMMIT_LIMIT shrink6 > 1000000 spill6 <= 0 completed = yes diff --git a/mps/test/function/133.c b/mps/test/function/133.c index d0ca1297af6..1f717b11660 100644 --- a/mps/test/function/133.c +++ b/mps/test/function/133.c @@ -5,7 +5,7 @@ TEST_HEADER language = c link = testlib.o rankfmt.o OUTPUT_SPEC - allocfail3 > 8000 + allocfail3 > 3000 failres3 = COMMIT_LIMIT spill8 <= 0 spill9 <= 0 diff --git a/mps/test/function/149.c b/mps/test/function/149.c index 0792068fd28..a26f510ebdc 100644 --- a/mps/test/function/149.c +++ b/mps/test/function/149.c @@ -23,8 +23,8 @@ OUTPUT_SPEC spill5 <= 0 grow5 = 0 avail5 > 1500000 - allocfail2 > 10000 - failres2 = MEMORY + allocfail2 > 5000 + failres2 = COMMIT_LIMIT shrink6 > 1000000 spill6 <= 0 completed = yes diff --git a/mps/test/function/18.c b/mps/test/function/18.c index 21f2c38e696..60a17e52d57 100644 --- a/mps/test/function/18.c +++ b/mps/test/function/18.c @@ -5,7 +5,7 @@ TEST_HEADER language = c link = testlib.o newfmt.o OUTPUT_SPEC - errtext = create pool: MEMORY + errtext = create pool: COMMIT_LIMIT END_HEADER */ @@ -39,6 +39,7 @@ static void test(void) cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena"); + die(mps_arena_commit_limit_set(arena, 1ul << 30), "commit_limit_set"); die(mps_thread_reg(&thread, arena), "register thread"); die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread, mps_stack_scan_ambig, stackpointer, 0), diff --git a/mps/test/function/19.c b/mps/test/function/19.c index 7727f45310b..bdbe02f88f8 100644 --- a/mps/test/function/19.c +++ b/mps/test/function/19.c @@ -5,7 +5,7 @@ TEST_HEADER language = c link = testlib.o newfmt.o OUTPUT_SPEC - errtext = create ap: MEMORY + errtext = create ap: COMMIT_LIMIT END_HEADER */ @@ -40,6 +40,7 @@ static void test(void) cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena"); + die(mps_arena_commit_limit_set(arena, 1ul << 30), "commit_limit_set"); die(mps_thread_reg(&thread, arena), "register thread"); die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread, mps_stack_scan_ambig, stackpointer, 0), diff --git a/mps/test/function/20.c b/mps/test/function/20.c index 5a95e314397..b66f96d4e67 100644 --- a/mps/test/function/20.c +++ b/mps/test/function/20.c @@ -5,7 +5,7 @@ TEST_HEADER language = c link = testlib.o newfmt.o OUTPUT_SPEC - errtext = create format: MEMORY + errtext = create format: COMMIT_LIMIT END_HEADER */ @@ -27,6 +27,7 @@ static void test(void) { int p; die(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create"); + die(mps_arena_commit_limit_set(arena, 1ul << 30), "commit_limit_set"); die(mps_thread_reg(&thread, arena), "register thread"); die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread, mps_stack_scan_ambig, stackpointer, 0), "create root"); diff --git a/mps/test/function/203.c b/mps/test/function/203.c index bd3cf8d92e2..207937d1d35 100644 --- a/mps/test/function/203.c +++ b/mps/test/function/203.c @@ -1,7 +1,7 @@ /* TEST_HEADER id = $Id$ - summary = new MV2 allocation test + summary = new MVT allocation test language = c link = testlib.o END_HEADER @@ -9,14 +9,10 @@ END_HEADER #include #include "testlib.h" -#include "mpscmv2.h" +#include "mpscmvt.h" #include "mpsavm.h" -#define MAXNUMBER 1000000 - -/* this shouldn't be necessary, but it's not provided anywhere */ - -typedef MPS_T_WORD mps_count_t; +#define MAXNUMBER 100000 void *stackpointer; mps_arena_t arena; @@ -42,7 +38,7 @@ static void setobj(mps_addr_t a, size_t size, unsigned char val) } } -static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { +static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { mps_res_t res; size = ((size+7)/8)*8; @@ -73,7 +69,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val) static void dt(int kind, size_t minSize, size_t avgSize, size_t maxSize, - mps_count_t depth, mps_count_t fragLimit, + mps_word_t depth, mps_word_t fragLimit, size_t mins, size_t maxs, int number, int iter) { mps_pool_t pool; @@ -89,9 +85,9 @@ static void dt(int kind, asserts(time0 != -1, "processor time not available"); die( - mps_pool_create(&pool, arena, mps_class_mv2(), + mps_pool_create(&pool, arena, mps_class_mvt(), minSize, avgSize, maxSize, depth, fragLimit), - "create MV2 pool"); + "create MVT pool"); die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap"); @@ -104,7 +100,7 @@ static void dt(int kind, } else { - die(mv2_alloc(&queue[hd].addr, ap, size), "alloc"); + die(mvt_alloc(&queue[hd].addr, ap, size), "alloc"); setobj(queue[hd].addr, size, (unsigned char) (hd%256)); queue[hd].size = size; } @@ -136,12 +132,13 @@ static void dt(int kind, } else { - die(mv2_alloc(&queue[hd].addr, ap, size),"alloc"); + die(mvt_alloc(&queue[hd].addr, ap, size),"alloc"); setobj(queue[hd].addr, size, (unsigned char) (hd%256)); queue[hd].size = size; } } + mps_ap_destroy(ap); mps_pool_destroy(pool); time1=clock(); @@ -157,7 +154,7 @@ static void test(void) { mps_thr_t thread; size_t mins; - mps_count_t dep, frag; + mps_word_t dep, frag; cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena"); cdie(mps_thread_reg(&thread, arena), "register thread"); @@ -170,34 +167,34 @@ static void test(void) comment("Frag: %i", frag); - dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 1000); - dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 100000); + dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 100); + dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 10000); - dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); + dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); - dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); + dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); - dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); + dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); /* try again using exceptional obj for anything over 16K */ - dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); + dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); } diff --git a/mps/test/function/204.c b/mps/test/function/204.c index 73e40029dff..d1a00731086 100644 --- a/mps/test/function/204.c +++ b/mps/test/function/204.c @@ -1,7 +1,7 @@ /* TEST_HEADER id = $Id$ - summary = new MV2 allocation test, extra shallow + summary = new MVT allocation test, extra shallow language = c link = testlib.o END_HEADER @@ -9,15 +9,11 @@ END_HEADER #include #include "testlib.h" -#include "mpscmv2.h" +#include "mpscmvt.h" #include "mpsavm.h" #define MAXNUMBER 1000000 -/* this shouldn't be necessary, but it's not provided anywhere */ - -typedef MPS_T_WORD mps_count_t; - void *stackpointer; mps_arena_t arena; @@ -42,7 +38,7 @@ static void setobj(mps_addr_t a, size_t size, unsigned char val) } } -static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { +static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { mps_res_t res; size = ((size+7)/8)*8; @@ -73,7 +69,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val) static void dt(int kind, size_t minSize, size_t avgSize, size_t maxSize, - mps_count_t depth, mps_count_t fragLimit, + mps_word_t depth, mps_word_t fragLimit, size_t mins, size_t maxs, int number, int iter) { mps_pool_t pool; @@ -89,9 +85,9 @@ static void dt(int kind, asserts(time0 != -1, "processor time not available"); die( - mps_pool_create(&pool, arena, mps_class_mv2(), + mps_pool_create(&pool, arena, mps_class_mvt(), minSize, avgSize, maxSize, depth, fragLimit), - "create MV2 pool"); + "create MVT pool"); die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap"); @@ -104,7 +100,7 @@ static void dt(int kind, } else { - die(mv2_alloc(&queue[hd].addr, ap, size), "alloc"); + die(mvt_alloc(&queue[hd].addr, ap, size), "alloc"); setobj(queue[hd].addr, size, (unsigned char) (hd%256)); queue[hd].size = size; } @@ -136,12 +132,13 @@ static void dt(int kind, } else { - die(mv2_alloc(&queue[hd].addr, ap, size),"alloc"); + die(mvt_alloc(&queue[hd].addr, ap, size),"alloc"); setobj(queue[hd].addr, size, (unsigned char) (hd%256)); queue[hd].size = size; } } + mps_ap_destroy(ap); mps_pool_destroy(pool); time1=clock(); @@ -157,7 +154,7 @@ static void test(void) { mps_thr_t thread; size_t mins; - mps_count_t dep, frag; + mps_word_t dep, frag; cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena"); cdie(mps_thread_reg(&thread, arena), "register thread"); @@ -170,34 +167,34 @@ static void test(void) comment("Frag: %i", frag); - dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 1000); - dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 100000); + dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 100); + dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 10000); - dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); + dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); - dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); + dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); - dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); + dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); /* try again using exceptional obj for anything over 16K */ - dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); + dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); } diff --git a/mps/test/function/205.c b/mps/test/function/205.c index e7b4e7c812d..d067d6a5ada 100644 --- a/mps/test/function/205.c +++ b/mps/test/function/205.c @@ -1,7 +1,7 @@ /* TEST_HEADER id = $Id$ - summary = new MV2 allocation test, extra deep + summary = new MVT allocation test, extra deep language = c link = testlib.o END_HEADER @@ -9,15 +9,11 @@ END_HEADER #include #include "testlib.h" -#include "mpscmv2.h" +#include "mpscmvt.h" #include "mpsavm.h" #define MAXNUMBER 1000000 -/* this shouldn't be necessary, but it's not provided anywhere */ - -typedef MPS_T_WORD mps_count_t; - void *stackpointer; mps_arena_t arena; @@ -42,7 +38,7 @@ static void setobj(mps_addr_t a, size_t size, unsigned char val) } } -static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { +static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { mps_res_t res; size = ((size+7)/8)*8; @@ -73,7 +69,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val) static void dt(int kind, size_t minSize, size_t avgSize, size_t maxSize, - mps_count_t depth, mps_count_t fragLimit, + mps_word_t depth, mps_word_t fragLimit, size_t mins, size_t maxs, int number, int iter) { mps_pool_t pool; @@ -89,9 +85,9 @@ static void dt(int kind, asserts(time0 != -1, "processor time not available"); die( - mps_pool_create(&pool, arena, mps_class_mv2(), + mps_pool_create(&pool, arena, mps_class_mvt(), minSize, avgSize, maxSize, depth, fragLimit), - "create MV2 pool"); + "create MVT pool"); die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap"); @@ -104,7 +100,7 @@ static void dt(int kind, } else { - die(mv2_alloc(&queue[hd].addr, ap, size), "alloc"); + die(mvt_alloc(&queue[hd].addr, ap, size), "alloc"); setobj(queue[hd].addr, size, (unsigned char) (hd%256)); queue[hd].size = size; } @@ -136,12 +132,13 @@ static void dt(int kind, } else { - die(mv2_alloc(&queue[hd].addr, ap, size),"alloc"); + die(mvt_alloc(&queue[hd].addr, ap, size),"alloc"); setobj(queue[hd].addr, size, (unsigned char) (hd%256)); queue[hd].size = size; } } + mps_ap_destroy(ap); mps_pool_destroy(pool); time1=clock(); @@ -157,7 +154,7 @@ static void test(void) { mps_thr_t thread; size_t mins; - mps_count_t dep, frag; + mps_word_t dep, frag; cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena"); cdie(mps_thread_reg(&thread, arena), "register thread"); @@ -170,34 +167,34 @@ static void test(void) comment("Frag: %i", frag); - dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 1000); - dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 100000); + dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 100); + dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 10000); - dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); - dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000); + dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); + dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000); - dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); - dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000); + dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); + dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000); - dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000); + dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000); /* try again using exceptional obj for anything over 16K */ - dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); - dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000); + dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); + dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000); } diff --git a/mps/test/function/214.c b/mps/test/function/214.c index d84e4b71be4..81fe5c5cfe6 100644 --- a/mps/test/function/214.c +++ b/mps/test/function/214.c @@ -1,7 +1,7 @@ /* TEST_HEADER id = $Id$ - summary = MV2 greed test + summary = MVT greed test language = c link = testlib.o parameters = OBJECTS=1000 OBJSIZE=8192 DEPTH=2 FRAGLIMIT=50 @@ -9,19 +9,15 @@ END_HEADER */ #include "testlib.h" -#include "mpscmv2.h" +#include "mpscmvt.h" #include "mpsavm.h" -/* this shouldn't be necessary, but it's not provided anywhere */ - -typedef MPS_T_WORD mps_count_t; - void *stackpointer; mps_arena_t arena; static mps_addr_t objs[OBJECTS]; -static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { +static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) { mps_res_t res; size = ((size+7)/8)*8; @@ -43,20 +39,20 @@ static void test (void) { cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena"); cdie(mps_thread_reg(&thread, arena), "register thread"); die( - mps_pool_create(&pool, arena, mps_class_mv2(), + mps_pool_create(&pool, arena, mps_class_mvt(), OBJSIZE, OBJSIZE, OBJSIZE, DEPTH, FRAGLIMIT), - "create MV2 pool"); + "create MVT pool"); die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap"); for (i = 0; i < OBJECTS; i++) { - die(mv2_alloc(&objs[i], ap, OBJSIZE), "alloc"); + die(mvt_alloc(&objs[i], ap, OBJSIZE), "alloc"); } report("size1", "%ld", mps_arena_committed(arena)); for (i = 0; i < OBJECTS; i+=2) { mps_free(pool, objs[i], OBJSIZE); - die(mv2_alloc(&objs[i], ap, OBJSIZE), "alloc"); + die(mvt_alloc(&objs[i], ap, OBJSIZE), "alloc"); } report("size2", "%ld", mps_arena_committed(arena)); diff --git a/mps/test/function/223.c b/mps/test/function/223.c index 7418a356518..6a402d1c831 100644 --- a/mps/test/function/223.c +++ b/mps/test/function/223.c @@ -24,7 +24,7 @@ END_HEADER #define BACKITER (32) #define RAMPSIZE (128) -#define ITERATIONS (1000000ul) +#define ITERATIONS (100000ul) #define RAMP_INTERFACE /* @@ -97,7 +97,7 @@ static void test(void) { mps_ap_create(&apamc, poolamc, mps_rank_exact()), "create ap"); - mps_message_type_enable(arena, mps_message_type_collection_stats()); + mps_message_type_enable(arena, mps_message_type_gc()); inramp = 0; @@ -138,14 +138,13 @@ static void test(void) { rsize = 0; } } - if(mps_message_get(&message, arena, mps_message_type_collection_stats())) { + if(mps_message_get(&message, arena, mps_message_type_gc())) { unsigned long live, condemned, notCondemned; - live = mps_message_collection_stats_live_size(arena, message); - condemned = mps_message_collection_stats_condemned_size(arena, message); - notCondemned = - mps_message_collection_stats_not_condemned_size(arena, message); + live = mps_message_gc_live_size(arena, message); + condemned = mps_message_gc_condemned_size(arena, message); + notCondemned = mps_message_gc_not_condemned_size(arena, message); comment("Collection: live=%ld, condemned=%ld, not condemned = %ld", - live, condemned, notCondemned); + live, condemned, notCondemned); mps_message_discard(arena, message); } } diff --git a/mps/test/function/224.c b/mps/test/function/224.c index cd648209bfc..0cec33e1cd8 100644 --- a/mps/test/function/224.c +++ b/mps/test/function/224.c @@ -6,6 +6,8 @@ TEST_HEADER link = testlib.o harness = 2.5 parameters = EXTENDBY=65536 AVGSIZE=32 PROMISE=64 ITERATE=2000 +OUTPUT_SPEC + errtext = alloc: COMMIT_LIMIT END_HEADER This one is supposed to fail, telling us that MV is badly fragmented. @@ -16,7 +18,7 @@ This one is supposed to fail, telling us that MV is badly fragmented. #include "mpsavm.h" -#define VMNZSIZE ((size_t) 30*1024*1024) +#define VMSIZE ((size_t) 30*1024*1024) static void test(void) @@ -26,8 +28,8 @@ static void test(void) mps_addr_t q; int p; - die(mps_arena_create(&arena, mps_arena_class_vmnz(), VMNZSIZE), "create"); - die(mps_arena_commit_limit_set(arena, VMNZSIZE), "commit limit"); + die(mps_arena_create(&arena, mps_arena_class_vm(), VMSIZE), "create"); + die(mps_arena_commit_limit_set(arena, VMSIZE), "commit limit"); die(mps_pool_create(&pool, arena, mps_class_mv(), EXTENDBY, AVGSIZE, EXTENDBY), diff --git a/mps/test/function/77.c b/mps/test/function/77.c index e2cae02611b..f57ea4bc2f6 100644 --- a/mps/test/function/77.c +++ b/mps/test/function/77.c @@ -69,8 +69,8 @@ static void test(void) b = allocone(apamc, 1, mps_rank_exact()); - for (j=1; j<100; j++) { - comment("%i of 100.", j); + for (j=1; j<=10; j++) { + comment("%i of 10.", j); a = allocone(apamc, 5, mps_rank_exact()); b = a; c = a; diff --git a/mps/test/testsets/passing b/mps/test/testsets/passing index b77e04ddd82..4b0a0cbe1b5 100644 --- a/mps/test/testsets/passing +++ b/mps/test/testsets/passing @@ -20,9 +20,9 @@ function/14.c function/15.c function/16.c function/17.c -% function/18.c -- tries to exhaust memory by mps_alloc -% function/19.c -- tries to exhaust memory by mps_alloc -% function/20.c -- tries to exhaust memory by mps_alloc +function/18.c +function/19.c +function/20.c function/21.c function/22.c % function/23.c -- interactive test, can't run unattended @@ -77,7 +77,7 @@ function/73.c function/74.c function/75.c function/76.c -% function/77.c -- slow +function/77.c function/78.c function/79.c function/80.c @@ -104,7 +104,7 @@ function/112.c function/113.c function/114.c % 115 -- no such test -% function/116.c -- tries to exhaust memory by mps_alloc +function/116.c function/117.c function/118.c function/119.c @@ -118,10 +118,10 @@ function/126.c function/127.c function/128.c function/129.c -% function/130.c -- tries to exhaust memory by mps_alloc -% function/131.c -- tries to exhaust memory by mps_alloc -% function/132.c -- failed on allocfail2: wanted > 10000, was 6840 @@@@ -% function/133.c -- failed on allocfail3: wanted > 8000, was 3060 @@@@ +% function/130.c -- job003789 +% function/131.c -- job003789 +function/132.c +function/133.c function/134.c function/135.c function/136.c @@ -134,7 +134,7 @@ function/144.c % 145-146 -- no such test function/147.c % function/148.c -- failed on inc4: wanted = 1, was 0 @@@@ -% function/149.c -- failed on allocfail2: wanted > 10000, was 6858 @@@@ +function/149.c function/150.c function/151.c function/152.c @@ -155,15 +155,15 @@ function/167.c % function/171.c -- job003495 function/200.c % 201-202 -- no such test -% function/203.c -- requires mps_count_t and mps_class_mv2 -% function/204.c -- requires mps_count_t and mps_class_mv2 -% function/205.c -- requires mps_count_t and mps_class_mv2 +function/203.c +function/204.c +function/205.c function/206.c function/207.c % 208-213 -- no such test -% function/214.c -- requires mps_count_t and mps_class_mv2 +function/214.c function/215.c -% function/223.c -- requires mps_message_type_collection_stats -% function/224.c -- COMMIT_LIMIT @@@@ +function/223.c +function/224.c % 225 -- no such test function/226.c From 525095900545c2799cd445e5118204393741c6b6 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 18:22:40 +0100 Subject: [PATCH 72/93] Fix problems identified in nb's review . Copied from Perforce Change: 186038 ServerID: perforce.ravenbrook.com --- mps/Makefile.in | 12 ++++----- mps/code/anangc.gmk | 66 +++++++++++++++++++++++++++++++++++++++++++++ mps/code/ananll.gmk | 66 +++++++++++++++++++++++++++++++++++++++++++++ mps/code/gc.gmk | 2 +- mps/code/ll.gmk | 2 +- mps/code/seg.c | 20 +++++--------- mps/configure | 52 +++++++++++++++++++++++------------ mps/configure.ac | 32 ++++++++++++++++------ 8 files changed, 205 insertions(+), 47 deletions(-) create mode 100644 mps/code/anangc.gmk create mode 100644 mps/code/ananll.gmk diff --git a/mps/Makefile.in b/mps/Makefile.in index aaab5a677f2..37d1d96fb07 100644 --- a/mps/Makefile.in +++ b/mps/Makefile.in @@ -13,7 +13,10 @@ INSTALL=@INSTALL@ INSTALL_DATA=@INSTALL_DATA@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ MAKE=@MAKE@ -MPS_TARGET_NAME=@MPS_TARGET_NAME@ +MPS_OS_NAME=@MPS_OS_NAME@ +MPS_ARCH_NAME=@MPS_ARCH_NAME@ +MPS_BUILD_NAME=@MPS_BUILD_NAME@ +MPS_TARGET_NAME=$(MPS_OS_NAME)$(MPS_ARCH_NAME)$(MPS_BUILD_NAME) EXTRA_TARGETS=@EXTRA_TARGETS@ prefix=$(DESTDIR)@prefix@ TARGET_OPTS=-C code -f $(MPS_TARGET_NAME).gmk EXTRA_TARGETS="$(EXTRA_TARGETS)" @@ -68,12 +71,9 @@ make-install-dirs: install: @INSTALL_TARGET@ test-make-build: - $(MAKE) clean $(MAKE) $(TARGET_OPTS) testci - $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=cool CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE" testansi - $(MAKE) clean - $(MAKE) $(TARGET_OPTS) VARIETY=cool CFLAGS="-DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE -DCONFIG_POLL_NONE" testpoll + $(MAKE) -C code -f anan$(MPS_BUILD_NAME).gmk VARIETY=cool clean testansi + $(MAKE) -C code -f anan$(MPS_BUILD_NAME).gmk VARIETY=cool CFLAGS="-DCONFIG_POLL_NONE" clean testpoll test-xcode-build: $(XCODEBUILD) -config Release -target testci diff --git a/mps/code/anangc.gmk b/mps/code/anangc.gmk new file mode 100644 index 00000000000..7ebccd8b72e --- /dev/null +++ b/mps/code/anangc.gmk @@ -0,0 +1,66 @@ +# -*- makefile -*- +# +# anangc.gmk: BUILD FOR ANSI/ANSI/GCC PLATFORM +# +# $Id$ +# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + +PFM = anangc + +MPMPF = \ + lockan.c \ + prmcan.c \ + protan.c \ + span.c \ + ssan.c \ + than.c \ + vman.c + +LIBS = -lm + +include gc.gmk + +CFLAGSCOMPILER += -DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE + +include comm.gmk + + +# C. COPYRIGHT AND LICENSE +# +# Copyright (C) 2001-2014 Ravenbrook Limited . +# All rights reserved. This is an open source license. Contact +# Ravenbrook for commercial licensing options. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Redistributions in any form must be accompanied by information on how +# to obtain complete source code for this software and any accompanying +# software that uses this software. The source code must either be +# included in the distribution or be available for no more than the cost +# of distribution plus a nominal fee, and must be freely redistributable +# under reasonable conditions. For an executable file, complete source +# code means the source code for all modules it contains. It does not +# include source code for modules or files that typically accompany the +# major components of the operating system on which the executable file +# runs. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/mps/code/ananll.gmk b/mps/code/ananll.gmk new file mode 100644 index 00000000000..cdfda39b300 --- /dev/null +++ b/mps/code/ananll.gmk @@ -0,0 +1,66 @@ +# -*- makefile -*- +# +# ananll.gmk: BUILD FOR ANSI/ANSI/Clang PLATFORM +# +# $Id$ +# Copyright (c) 2014 Ravenbrook Limited. See end of file for license. + +PFM = ananll + +MPMPF = \ + lockan.c \ + prmcan.c \ + protan.c \ + span.c \ + ssan.c \ + than.c \ + vman.c + +LIBS = -lm + +include ll.gmk + +CFLAGSCOMPILER += -DCONFIG_PF_ANSI -DCONFIG_THREAD_SINGLE + +include comm.gmk + + +# C. COPYRIGHT AND LICENSE +# +# Copyright (C) 2001-2014 Ravenbrook Limited . +# All rights reserved. This is an open source license. Contact +# Ravenbrook for commercial licensing options. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Redistributions in any form must be accompanied by information on how +# to obtain complete source code for this software and any accompanying +# software that uses this software. The source code must either be +# included in the distribution or be available for no more than the cost +# of distribution plus a nominal fee, and must be freely redistributable +# under reasonable conditions. For an executable file, complete source +# code means the source code for all modules it contains. It does not +# include source code for modules or files that typically accompany the +# major components of the operating system on which the executable file +# runs. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/mps/code/gc.gmk b/mps/code/gc.gmk index 826cb0ef659..76716dc0785 100644 --- a/mps/code/gc.gmk +++ b/mps/code/gc.gmk @@ -41,7 +41,7 @@ CFLAGSCOMPILERLAX := # If interrupted, this is liable to leave a zero-length file behind. define gendep - $(SHELL) -ec "$(CC) $(CFLAGS) -MM $< | \ + $(SHELL) -ec "$(CC) $(CFLAGSSTRICT) -MM $< | \ sed '/:/s!$*.o!$(@D)/& $(@D)/$*.d!' > $@" [ -s $@ ] || rm -f $@ endef diff --git a/mps/code/ll.gmk b/mps/code/ll.gmk index 55e4b6cff5d..787380fb3ed 100644 --- a/mps/code/ll.gmk +++ b/mps/code/ll.gmk @@ -46,7 +46,7 @@ CFLAGSCOMPILERLAX := # If interrupted, this is liable to leave a zero-length file behind. define gendep - $(SHELL) -ec "$(CC) $(CFLAGS) -MM $< | \ + $(SHELL) -ec "$(CC) $(CFLAGSSTRICT) -MM $< | \ sed '/:/s!$*.o!$(@D)/& $(@D)/$*.d!' > $@" [ -s $@ ] || rm -f $@ endef diff --git a/mps/code/seg.c b/mps/code/seg.c index cfa224a8368..742423383e3 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -309,16 +309,11 @@ void SegSetSummary(Seg seg, RefSet summary) AVERT(Seg, seg); AVER(summary == RefSetEMPTY || SegRankSet(seg) != RankSetEMPTY); -#if defined(REMEMBERED_SET) - /* Nothing to do. */ -#elif defined(REMEMBERED_SET_NONE) +#if defined(REMEMBERED_SET_NONE) /* Without protection, we can't maintain the remembered set because - there are writes we don't know about. TODO: rethink this when - implementating control. */ + there are writes we don't know about. */ summary = RefSetUNIV; -#else -#error "No remembered set configuration." -#endif /* REMEMBERED_SET */ +#endif if (summary != SegSummary(seg)) seg->class->setSummary(seg, summary); @@ -332,15 +327,12 @@ void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary) AVERT(Seg, seg); AVERT(RankSet, rankSet); -#if defined(REMEMBERED_SET) - /* Nothing to do. */ -#elif defined(REMEMBERED_SET_NONE) +#if defined(REMEMBERED_SET_NONE) if (rankSet != RankSetEMPTY) { summary = RefSetUNIV; } -#else -#error "No remembered set configuration." -#endif /* REMEMBERED_SET */ +#endif + seg->class->setRankSummary(seg, rankSet, summary); } diff --git a/mps/configure b/mps/configure index e491a01208f..edbc7320304 100755 --- a/mps/configure +++ b/mps/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Memory Pool System Kit release/1.113.0. +# Generated by GNU Autoconf 2.69 for Memory Pool System Kit release/1.114.0. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Memory Pool System Kit' PACKAGE_TARNAME='mps-kit' -PACKAGE_VERSION='release/1.113.0' -PACKAGE_STRING='Memory Pool System Kit release/1.113.0' +PACKAGE_VERSION='release/1.114.0' +PACKAGE_STRING='Memory Pool System Kit release/1.114.0' PACKAGE_BUGREPORT='mps-questions@ravenbrook.com' PACKAGE_URL='http://www.ravenbrook.com/project/mps/' @@ -629,7 +629,9 @@ TEST_TARGET INSTALL_TARGET CLEAN_TARGET BUILD_TARGET -MPS_TARGET_NAME +MPS_BUILD_NAME +MPS_ARCH_NAME +MPS_OS_NAME MAKE host_os host_vendor @@ -1243,7 +1245,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Memory Pool System Kit release/1.113.0 to adapt to many kinds of systems. +\`configure' configures Memory Pool System Kit release/1.114.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1308,7 +1310,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Memory Pool System Kit release/1.113.0:";; + short | recursive ) echo "Configuration of Memory Pool System Kit release/1.114.0:";; esac cat <<\_ACEOF @@ -1389,7 +1391,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Memory Pool System Kit configure release/1.113.0 +Memory Pool System Kit configure release/1.114.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1691,7 +1693,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Memory Pool System Kit $as_me release/1.113.0, which was +It was created by Memory Pool System Kit $as_me release/1.114.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3455,25 +3457,33 @@ case $host/$CLANG in i*86-*-linux*/no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Linux x86" >&5 $as_echo "Linux x86" >&6; } - MPS_TARGET_NAME=lii3gc + MPS_OS_NAME=li + MPS_ARCH_NAME=i3 + MPS_BUILD_NAME=gc PFMCFLAGS="$CFLAGS_GC" ;; x86_64-*-linux*/no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Linux x86_64" >&5 $as_echo "Linux x86_64" >&6; } - MPS_TARGET_NAME=lii6gc + MPS_OS_NAME=li + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=gc PFMCFLAGS="$CFLAGS_GC" ;; x86_64-*-linux*/yes) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Linux x86_64" >&5 $as_echo "Linux x86_64" >&6; } - MPS_TARGET_NAME=lii6ll + MPS_OS_NAME=li + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=ll PFMCFLAGS="$CFLAGS_LL" ;; i*86-*-darwin*/*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Mac OS X x86" >&5 $as_echo "Mac OS X x86" >&6; } - MPS_TARGET_NAME=xci3ll + MPS_OS_NAME=xc + MPS_ARCH_NAME=i3 + MPS_BUILD_NAME=ll BUILD_TARGET=build-via-xcode CLEAN_TARGET=clean-xcode-build INSTALL_TARGET=install-xcode-build @@ -3483,7 +3493,9 @@ $as_echo "Mac OS X x86" >&6; } x86_64-apple-darwin*/*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Mac OS X x86_64" >&5 $as_echo "Mac OS X x86_64" >&6; } - MPS_TARGET_NAME=xci6ll + MPS_OS_NAME=xc + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=ll BUILD_TARGET=build-via-xcode CLEAN_TARGET=clean-xcode-build INSTALL_TARGET=install-xcode-build @@ -3493,7 +3505,9 @@ $as_echo "Mac OS X x86_64" >&6; } i*86-*-freebsd*/no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: FreeBSD x86" >&5 $as_echo "FreeBSD x86" >&6; } - MPS_TARGET_NAME=fri3gc + MPS_OS_NAME=fr + MPS_ARCH_NAME=i3 + MPS_BUILD_NAME=gc # Need /usr/local/include in order to find sqlite3.h CFLAGS="-I/usr/local/include" CPP="$CC -I/usr/local/include -E" @@ -3502,7 +3516,9 @@ $as_echo "FreeBSD x86" >&6; } amd64-*-freebsd*/no | x86_64-*-freebsd*/no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: FreeBSD x86_64" >&5 $as_echo "FreeBSD x86_64" >&6; } - MPS_TARGET_NAME=fri6gc + MPS_OS_NAME=fr + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=gc # Need /usr/local/include in order to find sqlite3.h CFLAGS="-I/usr/local/include" CPP="$CC -I/usr/local/include -E" @@ -3581,6 +3597,8 @@ CFLAGS="$CFLAGS $PFMCFLAGS" + + ac_config_files="$ac_config_files Makefile example/scheme/Makefile" @@ -4126,7 +4144,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Memory Pool System Kit $as_me release/1.113.0, which was +This file was extended by Memory Pool System Kit $as_me release/1.114.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4180,7 +4198,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Memory Pool System Kit config.status release/1.113.0 +Memory Pool System Kit config.status release/1.114.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/mps/configure.ac b/mps/configure.ac index 6ee47ca05a6..f564f047d5e 100644 --- a/mps/configure.ac +++ b/mps/configure.ac @@ -47,22 +47,30 @@ TEST_TARGET=test-make-build case $host/$CLANG in i*86-*-linux*/no) AC_MSG_RESULT([Linux x86]) - MPS_TARGET_NAME=lii3gc + MPS_OS_NAME=li + MPS_ARCH_NAME=i3 + MPS_BUILD_NAME=gc PFMCFLAGS="$CFLAGS_GC" ;; x86_64-*-linux*/no) AC_MSG_RESULT([Linux x86_64]) - MPS_TARGET_NAME=lii6gc + MPS_OS_NAME=li + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=gc PFMCFLAGS="$CFLAGS_GC" ;; x86_64-*-linux*/yes) AC_MSG_RESULT([Linux x86_64]) - MPS_TARGET_NAME=lii6ll + MPS_OS_NAME=li + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=ll PFMCFLAGS="$CFLAGS_LL" ;; i*86-*-darwin*/*) AC_MSG_RESULT([Mac OS X x86]) - MPS_TARGET_NAME=xci3ll + MPS_OS_NAME=xc + MPS_ARCH_NAME=i3 + MPS_BUILD_NAME=ll BUILD_TARGET=build-via-xcode CLEAN_TARGET=clean-xcode-build INSTALL_TARGET=install-xcode-build @@ -71,7 +79,9 @@ case $host/$CLANG in ;; x86_64-apple-darwin*/*) AC_MSG_RESULT([Mac OS X x86_64]) - MPS_TARGET_NAME=xci6ll + MPS_OS_NAME=xc + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=ll BUILD_TARGET=build-via-xcode CLEAN_TARGET=clean-xcode-build INSTALL_TARGET=install-xcode-build @@ -80,7 +90,9 @@ case $host/$CLANG in ;; i*86-*-freebsd*/no) AC_MSG_RESULT([FreeBSD x86]) - MPS_TARGET_NAME=fri3gc + MPS_OS_NAME=fr + MPS_ARCH_NAME=i3 + MPS_BUILD_NAME=gc # Need /usr/local/include in order to find sqlite3.h CFLAGS="-I/usr/local/include" CPP="$CC -I/usr/local/include -E" @@ -88,7 +100,9 @@ case $host/$CLANG in ;; amd64-*-freebsd*/no | x86_64-*-freebsd*/no) AC_MSG_RESULT([FreeBSD x86_64]) - MPS_TARGET_NAME=fri6gc + MPS_OS_NAME=fr + MPS_ARCH_NAME=i6 + MPS_BUILD_NAME=gc # Need /usr/local/include in order to find sqlite3.h CFLAGS="-I/usr/local/include" CPP="$CC -I/usr/local/include -E" @@ -111,7 +125,9 @@ AC_CHECK_HEADER([sqlite3.h], [EXTRA_TARGETS="$EXTRA_TARGETS mpseventsql"]) # those flags. CFLAGS="$CFLAGS $PFMCFLAGS" -AC_SUBST(MPS_TARGET_NAME) +AC_SUBST(MPS_OS_NAME) +AC_SUBST(MPS_ARCH_NAME) +AC_SUBST(MPS_BUILD_NAME) AC_SUBST(BUILD_TARGET) AC_SUBST(CLEAN_TARGET) AC_SUBST(INSTALL_TARGET) From 36db181d965246043f725d188a579d7aa2b32621 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 18:53:10 +0100 Subject: [PATCH 73/93] Fumbled the merge. Copied from Perforce Change: 186043 ServerID: perforce.ravenbrook.com --- mps/tool/testrun.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mps/tool/testrun.sh b/mps/tool/testrun.sh index f44b74217e2..cdb41ac458b 100755 --- a/mps/tool/testrun.sh +++ b/mps/tool/testrun.sh @@ -24,12 +24,8 @@ # Make a temporary output directory for the test logs. LOGDIR=$(mktemp -d /tmp/mps.log.XXXXXX) -TEST_DIR=$1 echo "MPS test suite" echo "Logging test output to $LOGDIR" -echo "Test directory: $TEST_DIR" -shift -TEST_CASES=${*:-${ALL_TEST_CASES}} # First argument is the directory containing the test cases. TEST_DIR=$1 From c58dbfc37e2d5e906195327051c6b2485cd0c466 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 19:11:07 +0100 Subject: [PATCH 74/93] Steptest uses incremental collection, so can't be run under config_poll_none. Copied from Perforce Change: 186046 ServerID: perforce.ravenbrook.com --- mps/tool/testcases.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mps/tool/testcases.txt b/mps/tool/testcases.txt index 0c536f0a336..3f8e9c7b70d 100644 --- a/mps/tool/testcases.txt +++ b/mps/tool/testcases.txt @@ -37,7 +37,7 @@ poolncv qs sacss segsmss -steptest +steptest =P teletest =N interactive walkt0 zcoll =L @@ -50,7 +50,7 @@ Key to flags B -- known Bad L -- Long runtime N -- Not an automated test case - P -- relies on Polling + P -- relies on Polling or incremental collection T -- multi-Threaded W -- Windows-only X -- Unix-only From 691195da969238c2e214a24ddba5d091504cd268 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 19:48:01 +0100 Subject: [PATCH 75/93] Setenv requires _gnu_source, so get the headers in the right order so that the feature macros are set up in config.h before any system header is included. Don't update _XOPEN_SOURCE if it's already set to a high enough value. Copied from Perforce Change: 186049 ServerID: perforce.ravenbrook.com --- mps/code/config.h | 8 +++++++- mps/code/eventtxt.c | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mps/code/config.h b/mps/code/config.h index 1dd6a2e07f5..1792e8cbaba 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -454,6 +454,7 @@ * * Source Symbols Header Feature * =========== ========================= ============= ==================== + * eventtxt.c setenv _GNU_SOURCE * lockli.c pthread_mutexattr_settype _XOPEN_SOURCE >= 500 * prmci3li.c REG_EAX etc. _GNU_SOURCE * prmci6li.c REG_RAX etc. _GNU_SOURCE @@ -472,9 +473,14 @@ #if defined(MPS_OS_LI) +#if defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 500 +#undef _XOPEN_SOURCE +#endif +#if !defined(_XOPEN_SOURCE) #define _XOPEN_SOURCE 500 +#endif -#ifndef _GNU_SOURCE +#if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif diff --git a/mps/code/eventtxt.c b/mps/code/eventtxt.c index bc0d550d122..01b071aee3a 100644 --- a/mps/code/eventtxt.c +++ b/mps/code/eventtxt.c @@ -29,13 +29,13 @@ * $Id$ */ +#include "check.h" +#include "config.h" +#include "eventcom.h" +#include "eventdef.h" #include "mps.h" #include "mpsavm.h" #include "mpscmvff.h" -#include "check.h" -#include "config.h" -#include "eventdef.h" -#include "eventcom.h" #include "table.h" #include "testlib.h" /* for ulongest_t and associated print formats */ From 0d99d9fcffa7c9401de9e0fc2800517966207213 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 19:48:39 +0100 Subject: [PATCH 76/93] Segsmss needs to park the arena (because otherwise there might be a collection running on the amst pool's chain). Copied from Perforce Change: 186050 ServerID: perforce.ravenbrook.com --- mps/code/segsmss.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 7efac5c64a5..2843b900dfb 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -836,6 +836,8 @@ static void *test(void *arg, size_t s) } (void)mps_commit(busy_ap, busy_init, 64); + + mps_arena_park(arena); mps_ap_destroy(busy_ap); mps_ap_destroy(ap); mps_root_destroy(exactRoot); From 6d3321d525772439a790bf924067c92c4f4dd473 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 19:51:54 +0100 Subject: [PATCH 77/93] Increase the commit limit for exposet0 so that the test always passes. Copied from Perforce Change: 186051 ServerID: perforce.ravenbrook.com --- mps/code/exposet0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/exposet0.c b/mps/code/exposet0.c index a1e8fcdc6e8..7e097d6b034 100644 --- a/mps/code/exposet0.c +++ b/mps/code/exposet0.c @@ -245,7 +245,7 @@ int main(int argc, char *argv[]) die(mps_arena_create(&arena, mps_arena_class_vm(), 2*testArenaSIZE), "arena_create"); mps_message_type_enable(arena, mps_message_type_gc()); - die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit"); + die(mps_arena_commit_limit_set(arena, 2*testArenaSIZE), "set limit"); die(mps_thread_reg(&thread, arena), "thread_reg"); mps_tramp(&r, test, arena, 0); mps_thread_dereg(thread); From 2d7816c24cc07aa96b8d07d6d958f130b836d0a0 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 21:01:58 +0100 Subject: [PATCH 78/93] Fix p4-bisect interface Copied from Perforce Change: 186053 ServerID: perforce.ravenbrook.com --- mps/tool/p4-bisect | 1 - 1 file changed, 1 deletion(-) diff --git a/mps/tool/p4-bisect b/mps/tool/p4-bisect index 2886d823c59..10af68cfc0c 100755 --- a/mps/tool/p4-bisect +++ b/mps/tool/p4-bisect @@ -132,7 +132,6 @@ def run(args): def main(argv): parser = argparse.ArgumentParser( prog='p4-bisect', epilog='For help on CMD, use p4-bisect CMD -h') - parser.set_defaults(func=partial(help, parser)) subparsers = parser.add_subparsers() a = subparsers.add_parser From e332f18190a940f338fcd1b5d50e2c1c3a107081 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 21:54:52 +0100 Subject: [PATCH 79/93] Only link the testthr* module with test cases that use it. Copied from Perforce Change: 186055 ServerID: perforce.ravenbrook.com --- mps/code/comm.gmk | 15 +++++++++------ mps/code/commpost.nmk | 10 +++++----- mps/code/commpre.nmk | 7 ++++++- mps/code/w3i3mv.nmk | 6 ++++++ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 589b6db40ba..4fb69b9ea1e 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -156,7 +156,8 @@ SNC = poolsnc.c POOLN = pooln.c MV2 = poolmv2.c MVFF = poolmvff.c -TESTLIB = testlib.c testthrix.c +TESTLIB = testlib.c +TESTTHR = testthrix.c FMTDY = fmtdy.c fmtno.c FMTDYTST = fmtdy.c fmtno.c fmtdytst.c FMTHETST = fmthe.c fmtdy.c fmtno.c fmtdytst.c @@ -201,6 +202,8 @@ MVFFDEP = $(MVFF:%.c=$(PFM)/$(VARIETY)/%.d) TESTLIBOBJ = $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.o) TESTLIBDEP = $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.d) +TESTTHROBJ = $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.o) +TESTTHRDEP = $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.d) FMTDYOBJ = $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.o) FMTDYDEP = $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.d) FMTDYTSTOBJ = $(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.o) @@ -390,7 +393,7 @@ $(PFM)/$(VARIETY)/amcsshe: $(PFM)/$(VARIETY)/amcsshe.o \ $(FMTHETSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/amcssth: $(PFM)/$(VARIETY)/amcssth.o \ - $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/amsss: $(PFM)/$(VARIETY)/amsss.o \ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -411,7 +414,7 @@ $(PFM)/$(VARIETY)/awluthe: $(PFM)/$(VARIETY)/awluthe.o \ $(FMTHETSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/awlutth: $(PFM)/$(VARIETY)/awlutth.o \ - $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/btcv: $(PFM)/$(VARIETY)/btcv.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -420,7 +423,7 @@ $(PFM)/$(VARIETY)/bttest: $(PFM)/$(VARIETY)/bttest.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/djbench: $(PFM)/$(VARIETY)/djbench.o \ - $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/exposet0: $(PFM)/$(VARIETY)/exposet0.o \ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -441,7 +444,7 @@ $(PFM)/$(VARIETY)/fotest: $(PFM)/$(VARIETY)/fotest.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/gcbench: $(PFM)/$(VARIETY)/gcbench.o \ - $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/locbwcss: $(PFM)/$(VARIETY)/locbwcss.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -450,7 +453,7 @@ $(PFM)/$(VARIETY)/lockcov: $(PFM)/$(VARIETY)/lockcov.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/lockut: $(PFM)/$(VARIETY)/lockut.o \ - $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/locusss: $(PFM)/$(VARIETY)/locusss.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index ca44c8a7db2..47139017626 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -124,7 +124,7 @@ $(PFM)\$(VARIETY)\amcsshe.exe: $(PFM)\$(VARIETY)\amcsshe.obj \ $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) $(PFM)\$(VARIETY)\amcssth.exe: $(PFM)\$(VARIETY)\amcssth.obj \ - $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) + $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)\$(VARIETY)\amsss.exe: $(PFM)\$(VARIETY)\amsss.obj \ $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) @@ -148,7 +148,7 @@ $(PFM)\$(VARIETY)\awluthe.exe: $(PFM)\$(VARIETY)\awluthe.obj \ $(PFM)\$(VARIETY)\awlutth.exe: $(PFM)\$(VARIETY)\awlutth.obj \ $(FMTTESTOBJ) \ - $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) + $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)\$(VARIETY)\btcv.exe: $(PFM)\$(VARIETY)\btcv.obj \ $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) @@ -160,7 +160,7 @@ $(PFM)\$(VARIETY)\cvmicv.exe: $(PFM)\$(VARIETY)\cvmicv.obj \ $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) $(PFM)\$(VARIETY)\djbench.exe: $(PFM)\$(VARIETY)\djbench.obj \ - $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) + $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)\$(VARIETY)\exposet0.exe: $(PFM)\$(VARIETY)\exposet0.obj \ $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) @@ -181,7 +181,7 @@ $(PFM)\$(VARIETY)\fotest.exe: $(PFM)\$(VARIETY)\fotest.obj \ $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) $(PFM)\$(VARIETY)\gcbench.exe: $(PFM)\$(VARIETY)\gcbench.obj \ - $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) + $(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)\$(VARIETY)\locbwcss.exe: $(PFM)\$(VARIETY)\locbwcss.obj \ $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) @@ -190,7 +190,7 @@ $(PFM)\$(VARIETY)\lockcov.exe: $(PFM)\$(VARIETY)\lockcov.obj \ $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) $(PFM)\$(VARIETY)\lockut.exe: $(PFM)\$(VARIETY)\lockut.obj \ - $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) + $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)\$(VARIETY)\locusss.exe: $(PFM)\$(VARIETY)\locusss.obj \ $(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ) diff --git a/mps/code/commpre.nmk b/mps/code/commpre.nmk index 09f4f165207..336bb788d82 100644 --- a/mps/code/commpre.nmk +++ b/mps/code/commpre.nmk @@ -32,6 +32,7 @@ # FMTTEST as above for the "fmttest" part # FMTSCHEME as above for the "fmtscheme" part # TESTLIB as above for the "testlib" part +# TESTTHR as above for the "testthr" part # NOISY if defined, causes command to be emitted # # @@ -180,7 +181,8 @@ SNC = DW = FMTTEST = FMTSCHEME = -TESTLIB = +TESTLIB = +TESTTHR = # CHECK PARAMETERS @@ -228,6 +230,9 @@ TESTLIB = !IFNDEF TESTLIB !ERROR commpre.nmk: TESTLIB not defined !ENDIF +!IFNDEF TESTTHR +!ERROR commpre.nmk: TESTTHR not defined +!ENDIF # DECLARATIONS diff --git a/mps/code/w3i3mv.nmk b/mps/code/w3i3mv.nmk index 97a669700cc..870b520cba0 100644 --- a/mps/code/w3i3mv.nmk +++ b/mps/code/w3i3mv.nmk @@ -44,6 +44,7 @@ FMTTESTOBJ0 = $(FMTTEST:<=w3i3mv\hot\) FMTSCHEMEOBJ0 = $(FMTSCHEME:<=w3i3mv\hot\) POOLNOBJ0 = $(POOLN:<=w3i3mv\hot\) TESTLIBOBJ0 = $(TESTLIB:<=w3i3mv\hot\) +TESTTHROBJ0 = $(TESTTHR:<=w3i3mv\hot\) !ELSEIF "$(VARIETY)" == "cool" CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST) @@ -63,6 +64,7 @@ FMTTESTOBJ0 = $(FMTTEST:<=w3i3mv\cool\) FMTSCHEMEOBJ0 = $(FMTSCHEME:<=w3i3mv\cool\) POOLNOBJ0 = $(POOLN:<=w3i3mv\cool\) TESTLIBOBJ0 = $(TESTLIB:<=w3i3mv\cool\) +TESTTHROBJ0 = $(TESTTHR:<=w3i3mv\cool\) !ELSEIF "$(VARIETY)" == "rash" CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST) @@ -82,6 +84,7 @@ FMTTESTOBJ0 = $(FMTTEST:<=w3i3mv\rash\) FMTSCHEMEOBJ0 = $(FMTSCHEME:<=w3i3mv\rash\) POOLNOBJ0 = $(POOLN:<=w3i3mv\rash\) TESTLIBOBJ0 = $(TESTLIB:<=w3i3mv\rash\) +TESTTHROBJ0 = $(TESTTHR:<=w3i3mv\rash\) #!ELSEIF "$(VARIETY)" == "cv" #CFLAGS=$(CFLAGSCOMMON) $(CFCV) @@ -107,6 +110,8 @@ TESTLIBOBJ0 = $(TESTLIB:<=w3i3mv\rash\) #POOLNOBJ = $(POOLNOBJ0:>=.obj) #TESTLIBOBJ0 = $(TESTLIB:<=w3i3mv\cv\) #TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +#TESTTHROBJ0 = $(TESTTHR:<=w3i3mv\cv\) +#TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !ENDIF @@ -126,6 +131,7 @@ FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj) FMTSCHEMEOBJ = $(FMTSCHEMEOBJ0:>=.obj) POOLNOBJ = $(POOLNOBJ0:>=.obj) TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !INCLUDE commpost.nmk From 278dcb605b6a47ccbc90e051b65e83018262f980 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 12 May 2014 22:18:09 +0100 Subject: [PATCH 80/93] Need -lpthread so that we can compile the threading test cases, even though we aren't going to be able to run them. Copied from Perforce Change: 186057 ServerID: perforce.ravenbrook.com --- mps/code/anangc.gmk | 2 +- mps/code/ananll.gmk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mps/code/anangc.gmk b/mps/code/anangc.gmk index 7ebccd8b72e..f0a7d2ff515 100644 --- a/mps/code/anangc.gmk +++ b/mps/code/anangc.gmk @@ -16,7 +16,7 @@ MPMPF = \ than.c \ vman.c -LIBS = -lm +LIBS = -lm -lpthread include gc.gmk diff --git a/mps/code/ananll.gmk b/mps/code/ananll.gmk index cdfda39b300..cc95645f212 100644 --- a/mps/code/ananll.gmk +++ b/mps/code/ananll.gmk @@ -16,7 +16,7 @@ MPMPF = \ than.c \ vman.c -LIBS = -lm +LIBS = -lm -lpthread include ll.gmk From fce756402499fde2c6071e412f8ca2e19f4f47e3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 13 May 2014 09:32:06 +0100 Subject: [PATCH 81/93] Windows doesn't have setenv, so use _putenv_s. Copied from Perforce Change: 186060 ServerID: perforce.ravenbrook.com --- mps/code/testlib.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mps/code/testlib.h b/mps/code/testlib.h index 9c197cae839..38a4c94bdab 100644 --- a/mps/code/testlib.h +++ b/mps/code/testlib.h @@ -68,6 +68,22 @@ #endif +/* setenv -- set environment variable + * + * Windows lacks setenv(), but _putenv_s() has similar functionality. + * + * + * This macro version may evaluate the name argument twice. + */ + +#if defined(MPS_OS_W3) + +#define setenv(name, value, overwrite) \ + (((overwrite) || !getenv(name)) ? _putenv_s(name, value) : 0) + +#endif + + /* ulongest_t -- longest unsigned integer type * * Define a longest unsigned integer type for testing, scanning, and From 2514a8eb3da25e2c2603781c5710ca8d878aa741 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 13 May 2014 09:33:26 +0100 Subject: [PATCH 82/93] Compile testthrw3.c on all windows build configurations. Copied from Perforce Change: 186061 ServerID: perforce.ravenbrook.com --- mps/code/w3i3pc.nmk | 6 ++++++ mps/code/w3i6mv.nmk | 6 ++++++ mps/code/w3i6pc.nmk | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/mps/code/w3i3pc.nmk b/mps/code/w3i3pc.nmk index d6d424b669d..f9c7bef7e19 100644 --- a/mps/code/w3i3pc.nmk +++ b/mps/code/w3i3pc.nmk @@ -43,6 +43,7 @@ DWOBJ0 = $(DW:<=w3i3pc\hot\) FMTTESTOBJ0 = $(FMTTEST:<=w3i3pc\hot\) POOLNOBJ0 = $(POOLN:<=w3i3pc\hot\) TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\hot\) +TESTTHROBJ0 = $(TESTTHR:<=w3i3pc\hot\) !ELSEIF "$(VARIETY)" == "cool" CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST) @@ -61,6 +62,7 @@ DWOBJ0 = $(DW:<=w3i3pc\cool\) FMTTESTOBJ0 = $(FMTTEST:<=w3i3pc\cool\) POOLNOBJ0 = $(POOLN:<=w3i3pc\cool\) TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\cool\) +TESTTHROBJ0 = $(TESTTHR:<=w3i3pc\cool\) !ELSEIF "$(VARIETY)" == "rash" CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST) @@ -79,6 +81,7 @@ DWOBJ0 = $(DW:<=w3i3pc\rash\) FMTTESTOBJ0 = $(FMTTEST:<=w3i3pc\rash\) POOLNOBJ0 = $(POOLN:<=w3i3pc\rash\) TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\rash\) +TESTTHROBJ0 = $(TESTTHR:<=w3i3pc\rash\) #!ELSEIF "$(VARIETY)" == "cv" #CFLAGS=$(CFLAGSCOMMON) $(CFCV) @@ -104,6 +107,8 @@ TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\rash\) #POOLNOBJ = $(POOLNOBJ0:>=.obj) #TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\cv\) #TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +#TESTTHROBJ0 = $(TESTTHR:<=w3i3pc\cv\) +#TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !ENDIF @@ -122,6 +127,7 @@ DWOBJ = $(DWOBJ0:>=.obj) FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj) POOLNOBJ = $(POOLNOBJ0:>=.obj) TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !INCLUDE commpost.nmk diff --git a/mps/code/w3i6mv.nmk b/mps/code/w3i6mv.nmk index 6d31a81452d..67aab4ea57d 100644 --- a/mps/code/w3i6mv.nmk +++ b/mps/code/w3i6mv.nmk @@ -44,6 +44,7 @@ FMTTESTOBJ0 = $(FMTTEST:<=w3i6mv\hot\) FMTSCHEMEOBJ0 = $(FMTSCHEME:<=w3i6mv\hot\) POOLNOBJ0 = $(POOLN:<=w3i6mv\hot\) TESTLIBOBJ0 = $(TESTLIB:<=w3i6mv\hot\) +TESTTHROBJ0 = $(TESTTHR:<=w3i6mv\hot\) !ELSEIF "$(VARIETY)" == "cool" CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST) @@ -63,6 +64,7 @@ FMTTESTOBJ0 = $(FMTTEST:<=w3i6mv\cool\) FMTSCHEMEOBJ0 = $(FMTSCHEME:<=w3i6mv\cool\) POOLNOBJ0 = $(POOLN:<=w3i6mv\cool\) TESTLIBOBJ0 = $(TESTLIB:<=w3i6mv\cool\) +TESTTHROBJ0 = $(TESTTHR:<=w3i6mv\cool\) !ELSEIF "$(VARIETY)" == "rash" CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST) @@ -82,6 +84,7 @@ FMTTESTOBJ0 = $(FMTTEST:<=w3i6mv\rash\) FMTSCHEMEOBJ0 = $(FMTSCHEME:<=w3i6mv\rash\) POOLNOBJ0 = $(POOLN:<=w3i6mv\rash\) TESTLIBOBJ0 = $(TESTLIB:<=w3i6mv\rash\) +TESTTHROBJ0 = $(TESTTHR:<=w3i6mv\rash\) #!ELSEIF "$(VARIETY)" == "cv" #CFLAGS=$(CFLAGSCOMMON) $(CFCV) @@ -107,6 +110,8 @@ TESTLIBOBJ0 = $(TESTLIB:<=w3i6mv\rash\) #POOLNOBJ = $(POOLNOBJ0:>=.obj) #TESTLIBOBJ0 = $(TESTLIB:<=w3i6mv\cv\) #TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +#TESTTHROBJ0 = $(TESTTHR:<=w3i6mv\cv\) +#TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !ENDIF @@ -126,6 +131,7 @@ FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj) FMTSCHEMEOBJ = $(FMTSCHEMEOBJ0:>=.obj) POOLNOBJ = $(POOLNOBJ0:>=.obj) TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !INCLUDE commpost.nmk diff --git a/mps/code/w3i6pc.nmk b/mps/code/w3i6pc.nmk index 1decdde0083..a7d571257b0 100644 --- a/mps/code/w3i6pc.nmk +++ b/mps/code/w3i6pc.nmk @@ -47,6 +47,7 @@ DWOBJ0 = $(DW:<=w3i6pc\hot\) FMTTESTOBJ0 = $(FMTTEST:<=w3i6pc\hot\) POOLNOBJ0 = $(POOLN:<=w3i6pc\hot\) TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\hot\) +TESTTHROBJ0 = $(TESTTHR:<=w3i6pc\hot\) !ELSEIF "$(VARIETY)" == "cool" CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST) @@ -65,6 +66,7 @@ DWOBJ0 = $(DW:<=w3i6pc\cool\) FMTTESTOBJ0 = $(FMTTEST:<=w3i6pc\cool\) POOLNOBJ0 = $(POOLN:<=w3i6pc\cool\) TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\cool\) +TESTTHROBJ0 = $(TESTTHR:<=w3i6pc\cool\) !ELSEIF "$(VARIETY)" == "rash" CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST) @@ -83,6 +85,7 @@ DWOBJ0 = $(DW:<=w3i6pc\rash\) FMTTESTOBJ0 = $(FMTTEST:<=w3i6pc\rash\) POOLNOBJ0 = $(POOLN:<=w3i6pc\rash\) TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\rash\) +TESTTHROBJ0 = $(TESTTHR:<=w3i6pc\rash\) #!ELSEIF "$(VARIETY)" == "cv" #CFLAGS=$(CFLAGSCOMMON) $(CFCV) @@ -108,6 +111,8 @@ TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\rash\) #POOLNOBJ = $(POOLNOBJ0:>=.obj) #TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\cv\) #TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +#TESTTHROBJ0 = $(TESTTHR:<=w3i6pc\cv\) +#TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !ENDIF @@ -126,6 +131,7 @@ DWOBJ = $(DWOBJ0:>=.obj) FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj) POOLNOBJ = $(POOLNOBJ0:>=.obj) TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +TESTTHROBJ = $(TESTTHROBJ0:>=.obj) !INCLUDE commpost.nmk From d44862dcf7de1a9a39234e59389ff884d1646802 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 13 May 2014 10:12:56 +0100 Subject: [PATCH 83/93] Ansi platform compiles and passes tests on windows. in detail: * Move Windows-specific modules like vmw3.c out of commpre.nmk and into the platform-specific Nmake files. * Set StackProbeDEPTH to 0 on the ANSI platform. * New Nmake file ananmv.nmk builds the MPS for the ANSI platform using Microsoft Visual C/C++. Copied from Perforce Change: 186063 ServerID: perforce.ravenbrook.com --- mps/code/ananmv.nmk | 184 +++++++++++++++++++++++++++++++++++++++++++ mps/code/commpre.nmk | 5 -- mps/code/config.h | 4 +- mps/code/w3i3mv.nmk | 13 ++- mps/code/w3i3pc.nmk | 13 ++- mps/code/w3i6mv.nmk | 22 ++++-- mps/code/w3i6pc.nmk | 13 ++- 7 files changed, 236 insertions(+), 18 deletions(-) create mode 100644 mps/code/ananmv.nmk diff --git a/mps/code/ananmv.nmk b/mps/code/ananmv.nmk new file mode 100644 index 00000000000..ecf97540ece --- /dev/null +++ b/mps/code/ananmv.nmk @@ -0,0 +1,184 @@ +# ananmv.nmk: ANSI/ANSI/MICROSOFT VISUAL C/C++ NMAKE FILE -*- makefile -*- +# +# $Id$ +# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + +PFM = ananmv + +PFMDEFS = /DCONFIG_PF_ANSI /DCONFIG_THREAD_SINGLE + +!INCLUDE commpre.nmk +!INCLUDE mv.nmk + +# MPM sources: core plus platform-specific. +MPM = $(MPMCOMMON) \ + \ + \ + \ + \ + \ + \ + + + +# Source to object file mappings and CFLAGS amalgamation +# +# %%VARIETY %%PART: When adding a new variety or part, add new macros which +# expand to the files included in the part for each variety +# +# %%VARIETY: When adding a new variety, add a CFLAGS macro which expands to +# the flags that that variety should use when compiling C. And a LINKFLAGS +# macro which expands to the flags that the variety should use when building +# executables. And a LIBFLAGS macro which expands to the flags that the +# variety should use when building libraries + +!IF "$(VARIETY)" == "hot" +CFLAGS=$(CFLAGSCOMMONPRE) $(CFHOT) $(CFLAGSCOMMONPOST) +CFLAGSSQL=$(CFLAGSSQLPRE) $(CFHOT) $(CFLAGSSQLPOST) +LINKFLAGS=$(LINKFLAGSCOMMON) $(LFHOT) +LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSHOT) +MPMOBJ0 = $(MPM:<=ananmv\hot\) +PLINTHOBJ0 = $(PLINTH:<=ananmv\hot\) +AMSOBJ0 = $(AMS:<=ananmv\hot\) +AMCOBJ0 = $(AMC:<=ananmv\hot\) +AWLOBJ0 = $(AWL:<=ananmv\hot\) +LOOBJ0 = $(LO:<=ananmv\hot\) +SNCOBJ0 = $(SNC:<=ananmv\hot\) +MVFFOBJ0 = $(MVFF:<=ananmv\hot\) +DWOBJ0 = $(DW:<=ananmv\hot\) +FMTTESTOBJ0 = $(FMTTEST:<=ananmv\hot\) +FMTSCHEMEOBJ0 = $(FMTSCHEME:<=ananmv\hot\) +POOLNOBJ0 = $(POOLN:<=ananmv\hot\) +TESTLIBOBJ0 = $(TESTLIB:<=ananmv\hot\) +TESTTHROBJ0 = $(TESTTHR:<=ananmv\hot\) + +!ELSEIF "$(VARIETY)" == "cool" +CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST) +CFLAGSSQL=$(CFLAGSSQLPRE) $(CFCOOL) $(CFLAGSSQLPOST) +LINKFLAGS=$(LINKFLAGSCOMMON) $(LFCOOL) +LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSCOOL) +MPMOBJ0 = $(MPM:<=ananmv\cool\) +PLINTHOBJ0 = $(PLINTH:<=ananmv\cool\) +AMSOBJ0 = $(AMS:<=ananmv\cool\) +AMCOBJ0 = $(AMC:<=ananmv\cool\) +AWLOBJ0 = $(AWL:<=ananmv\cool\) +LOOBJ0 = $(LO:<=ananmv\cool\) +SNCOBJ0 = $(SNC:<=ananmv\cool\) +MVFFOBJ0 = $(MVFF:<=ananmv\cool\) +DWOBJ0 = $(DW:<=ananmv\cool\) +FMTTESTOBJ0 = $(FMTTEST:<=ananmv\cool\) +FMTSCHEMEOBJ0 = $(FMTSCHEME:<=ananmv\cool\) +POOLNOBJ0 = $(POOLN:<=ananmv\cool\) +TESTLIBOBJ0 = $(TESTLIB:<=ananmv\cool\) +TESTTHROBJ0 = $(TESTTHR:<=ananmv\cool\) + +!ELSEIF "$(VARIETY)" == "rash" +CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST) +CFLAGSSQL=$(CFLAGSSQLPRE) $(CFRASH) $(CFLAGSSQLPOST) +LINKFLAGS=$(LINKFLAGSCOMMON) $(LFRASH) +LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSRASH) +MPMOBJ0 = $(MPM:<=ananmv\rash\) +PLINTHOBJ0 = $(PLINTH:<=ananmv\rash\) +AMSOBJ0 = $(AMS:<=ananmv\rash\) +AMCOBJ0 = $(AMC:<=ananmv\rash\) +AWLOBJ0 = $(AWL:<=ananmv\rash\) +LOOBJ0 = $(LO:<=ananmv\rash\) +SNCOBJ0 = $(SNC:<=ananmv\rash\) +MVFFOBJ0 = $(MVFF:<=ananmv\rash\) +DWOBJ0 = $(DW:<=ananmv\rash\) +FMTTESTOBJ0 = $(FMTTEST:<=ananmv\rash\) +FMTSCHEMEOBJ0 = $(FMTSCHEME:<=ananmv\rash\) +POOLNOBJ0 = $(POOLN:<=ananmv\rash\) +TESTLIBOBJ0 = $(TESTLIB:<=ananmv\rash\) +TESTTHROBJ0 = $(TESTTHR:<=ananmv\rash\) + +#!ELSEIF "$(VARIETY)" == "cv" +#CFLAGS=$(CFLAGSCOMMON) $(CFCV) +#LINKFLAGS=$(LINKFLAGSCOMMON) $(LFCV) +#LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSCV) +#MPMOBJ0 = $(MPM:<=ananmv\cv\) +#MPMOBJ = $(MPMOBJ0:>=.obj) +#PLINTHOBJ0 = $(PLINTH:<=ananmv\cv\) +#PLINTHOBJ = $(PLINTHOBJ0:>=.obj) +#AMSOBJ0 = $(AMS:<=ananmv\cv\) +#AMSOBJ = $(AMSOBJ0:>=.obj) +#AMCOBJ0 = $(AMC:<=ananmv\cv\) +#AMCOBJ = $(AMCOBJ0:>=.obj) +#AWLOBJ0 = $(AWL:<=ananmv\cv\) +#AWLOBJ = $(AWLOBJ0:>=.obj) +#LOOBJ0 = $(LO:<=ananmv\cv\) +#LOOBJ = $(LOOBJ0:>=.obj) +#SNCOBJ0 = $(SNC:<=ananmv\cv\) +#SNCOBJ = $(SNCOBJ0:>=.obj) +#DWOBJ0 = $(DW:<=ananmv\cv\) +#DWOBJ = $(DWOBJ0:>=.obj) +#POOLNOBJ0 = $(POOLN:<=ananmv\cv\) +#POOLNOBJ = $(POOLNOBJ0:>=.obj) +#TESTLIBOBJ0 = $(TESTLIB:<=ananmv\cv\) +#TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +#TESTTHROBJ0 = $(TESTTHR:<=ananmv\cv\) +#TESTTHROBJ = $(TESTTHROBJ0:>=.obj) + +!ENDIF + +# %%PART: When adding a new part, add new macros which expand to the object +# files included in the part + +MPMOBJ = $(MPMOBJ0:>=.obj) +PLINTHOBJ = $(PLINTHOBJ0:>=.obj) +AMSOBJ = $(AMSOBJ0:>=.obj) +AMCOBJ = $(AMCOBJ0:>=.obj) +AWLOBJ = $(AWLOBJ0:>=.obj) +LOOBJ = $(LOOBJ0:>=.obj) +SNCOBJ = $(SNCOBJ0:>=.obj) +MVFFOBJ = $(MVFFOBJ0:>=.obj) +DWOBJ = $(DWOBJ0:>=.obj) +FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj) +FMTSCHEMEOBJ = $(FMTSCHEMEOBJ0:>=.obj) +POOLNOBJ = $(POOLNOBJ0:>=.obj) +TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj) +TESTTHROBJ = $(TESTTHROBJ0:>=.obj) + + +!INCLUDE commpost.nmk + + +# C. COPYRIGHT AND LICENSE +# +# Copyright (C) 2001-2014 Ravenbrook Limited . +# All rights reserved. This is an open source license. Contact +# Ravenbrook for commercial licensing options. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Redistributions in any form must be accompanied by information on how +# to obtain complete source code for this software and any accompanying +# software that uses this software. The source code must either be +# included in the distribution or be available for no more than the cost +# of distribution plus a nominal fee, and must be freely redistributable +# under reasonable conditions. For an executable file, complete source +# code means the source code for all modules it contains. It does not +# include source code for modules or files that typically accompany the +# major components of the operating system on which the executable file +# runs. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/mps/code/commpre.nmk b/mps/code/commpre.nmk index 336bb788d82..88ed5565270 100644 --- a/mps/code/commpre.nmk +++ b/mps/code/commpre.nmk @@ -135,13 +135,11 @@ MPMCOMMON=\ \ \ \ - \ \ \ \ \ \ - \ \ \ \ @@ -150,7 +148,6 @@ MPMCOMMON=\ \ \ \ - \ \ \ \ @@ -163,12 +160,10 @@ MPMCOMMON=\ \ \ \ - \ \ \ \ \ - \ PLINTH = AMC = diff --git a/mps/code/config.h b/mps/code/config.h index 1792e8cbaba..0a1eb1a862b 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -425,7 +425,9 @@ /* Stack configuration */ /* Currently StackProbe has a useful implementation only on Windows. */ -#if defined(MPS_OS_W3) && defined(MPS_ARCH_I3) +#if defined(PLATFORM_ANSI) +#define StackProbeDEPTH ((Size)0) +#elif defined(MPS_OS_W3) && defined(MPS_ARCH_I3) #define StackProbeDEPTH ((Size)500) #elif defined(MPS_OS_W3) && defined(MPS_ARCH_I6) #define StackProbeDEPTH ((Size)500) diff --git a/mps/code/w3i3mv.nmk b/mps/code/w3i3mv.nmk index 870b520cba0..a0f919335b1 100644 --- a/mps/code/w3i3mv.nmk +++ b/mps/code/w3i3mv.nmk @@ -11,8 +11,17 @@ PFMDEFS = /DCONFIG_PF_STRING="w3i3mv" /DCONFIG_PF_W3I3MV /DWIN32 /D_WINDOWS !INCLUDE mv.nmk # MPM sources: core plus platform-specific. -MPM = $(MPMCOMMON) - +MPM = $(MPMCOMMON) \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + # Source to object file mappings and CFLAGS amalgamation diff --git a/mps/code/w3i3pc.nmk b/mps/code/w3i3pc.nmk index f9c7bef7e19..ad56deca83a 100644 --- a/mps/code/w3i3pc.nmk +++ b/mps/code/w3i3pc.nmk @@ -11,8 +11,17 @@ PFMDEFS = /DCONFIG_PF_STRING="w3i3pc" /DCONFIG_PF_W3I3PC /DWIN32 /D_WINDOWS !INCLUDE pc.nmk # MPM sources: core plus platform-specific. -MPM = $(MPMCOMMON) - +MPM = $(MPMCOMMON) \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + # Source to object file mappings and CFLAGS amalgamation diff --git a/mps/code/w3i6mv.nmk b/mps/code/w3i6mv.nmk index 67aab4ea57d..9d20b498525 100644 --- a/mps/code/w3i6mv.nmk +++ b/mps/code/w3i6mv.nmk @@ -1,18 +1,28 @@ # w3i6mv.nmk: WINDOWS (x86-64) NMAKE FILE -*- makefile -*- # # $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. PFM = w3i6mv PFMDEFS = /DCONFIG_PF_STRING="w3i6mv" /DCONFIG_PF_W3I6MV /DWIN32 /D_WINDOWS MASM = ml64 -# MPM sources: core plus platform-specific. -MPM = $(MPMCOMMON) - - !INCLUDE commpre.nmk +!INCLUDE mv.nmk + +# MPM sources: core plus platform-specific. +MPM = $(MPMCOMMON) \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + # Source to object file mappings and CFLAGS amalgamation @@ -139,7 +149,7 @@ TESTTHROBJ = $(TESTTHROBJ0:>=.obj) # 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/w3i6pc.nmk b/mps/code/w3i6pc.nmk index a7d571257b0..687a0a6f204 100644 --- a/mps/code/w3i6pc.nmk +++ b/mps/code/w3i6pc.nmk @@ -15,8 +15,17 @@ PFMDEFS = /DCONFIG_PF_STRING="w3i6pc" /DCONFIG_PF_W3I6PC /DWIN32 /D_WINDOWS CFLAGSCOMMONPRE = $(CFLAGSCOMMONPRE) /Tamd64-coff # MPM sources: core plus platform-specific. -MPM = $(MPMCOMMON) - +MPM = $(MPMCOMMON) \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + # Source to object file mappings and CFLAGS amalgamation From 4251c1e1db21164206a936f787e10ee9510076d5 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 13 May 2014 10:48:51 +0100 Subject: [PATCH 84/93] Fix typo: the general root scanning function type is mps_root_scan_t, not mps_reg_scan_t. Copied from Perforce Change: 186065 ServerID: perforce.ravenbrook.com --- mps/manual/source/guide/lang.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mps/manual/source/guide/lang.rst b/mps/manual/source/guide/lang.rst index 916782424d5..ca57e81a2ec 100644 --- a/mps/manual/source/guide/lang.rst +++ b/mps/manual/source/guide/lang.rst @@ -748,7 +748,7 @@ And third, the global symbol table:: static size_t symtab_size; You tell the MPS how to scan these by writing root scanning functions -of type :c:type:`mps_reg_scan_t`. These functions are similar to the +of type :c:type:`mps_root_scan_t`. These functions are similar to the :ref:`scan method ` in an :term:`object format`, described above. @@ -823,7 +823,7 @@ after the rehash has completed, de-registering the old root by calling :c:func:`mps_root_destroy`. It would be possible to write a root scanning function of type -:c:type:`mps_reg_scan_t`, as described above, to fix the references in +:c:type:`mps_root_scan_t`, as described above, to fix the references in the global symbol table, but the case of a table of references is sufficiently common that the MPS provides a convenient (and optimized) function, :c:func:`mps_root_create_table`, for registering it:: From 19fb3a41dca6bcd05a8e920e8c3170f0afc5e7ca Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 13 May 2014 10:57:35 +0100 Subject: [PATCH 85/93] Strength the tear-down advice: you "should" park the arena (not just "good practice"). Copied from Perforce Change: 186066 ServerID: perforce.ravenbrook.com --- mps/manual/source/guide/debug.rst | 7 ++++--- mps/manual/source/guide/lang.rst | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/mps/manual/source/guide/debug.rst b/mps/manual/source/guide/debug.rst index 678cc398593..daf3fb63ae5 100644 --- a/mps/manual/source/guide/debug.rst +++ b/mps/manual/source/guide/debug.rst @@ -86,10 +86,11 @@ General debugging advice handle SIGSEGV pass nostop noprint - On OS X barrier hits do not use signals and so do not enter the debugger. + On these operating systems, you can add this commands to your + ``.gdbinit`` if you always want them to be run. - (On these operating systems, you can add these commands to your - ``.gdbinit`` if you always want them to be run.) + On OS X barrier hits do not use signals and so do not enter the + debugger. .. index:: diff --git a/mps/manual/source/guide/lang.rst b/mps/manual/source/guide/lang.rst index ca57e81a2ec..68473613ba2 100644 --- a/mps/manual/source/guide/lang.rst +++ b/mps/manual/source/guide/lang.rst @@ -1142,28 +1142,28 @@ tracking down the causes, appear in the chapter :ref:`guide-debug`. Tidying up ---------- -When your program is done with the MPS, it's good practice to -:term:`park ` the arena (by calling -:c:func:`mps_arena_park`) and then tear down all the MPS data -structures. This causes the MPS to check the consistency of its data -structures and report any problems it detects. It also causes the MPS -to flush its :term:`telemetry stream`. +When your program is done with the MPS, you should :term:`park ` the arena (by calling :c:func:`mps_arena_park`) to ensure that +no incremental garbage collection is in progress, and then tear down +all the MPS data structures. This causes the MPS to check the +consistency of its data structures and report any problems it detects. +It also causes the MPS to flush its :term:`telemetry stream`. MPS data structures must be destroyed or deregistered in the reverse order to that in which they were registered or created. So you must -destroy all :term:`allocation points` created in a -:term:`pool` before destroying the pool; destroy all :term:`roots` and pools, and deregister all :term:`threads`, that -were created in an :term:`arena` before destroying the arena, and so -on. +destroy all :term:`allocation points` created in a :term:`pool` before +destroying the pool; destroy all :term:`roots` and pools, and +deregister all :term:`threads`, that were created in an :term:`arena` +before destroying the arena, and so on. For example:: mps_arena_park(arena); /* ensure no collection is running */ mps_ap_destroy(obj_ap); /* destroy ap before pool */ mps_pool_destroy(obj_pool); /* destroy pool before fmt */ - mps_fmt_destroy(obj_fmt); /* destroy fmt before arena */ - mps_root_destroy(reg_root); /* destroy root before arena */ + mps_root_destroy(reg_root); /* destroy root before thread */ mps_thread_dereg(thread); /* deregister thread before arena */ + mps_fmt_destroy(obj_fmt); /* destroy fmt before arena */ mps_arena_destroy(arena); /* last of all */ From 4638be32ad2fc3458aa630cae0c992db97be374f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 15 May 2014 17:35:27 +0100 Subject: [PATCH 86/93] Remove unused macros ("unless" and "when"). Copied from Perforce Change: 186120 ServerID: perforce.ravenbrook.com --- mps/code/poolmv2.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index b4ac6913fdf..72774063ed2 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -149,12 +149,6 @@ DEFINE_POOL_CLASS(MVTPoolClass, this) /* Macros */ - -/* .trans.something: the C language sucks */ -#define unless(cond) if (!(cond)) -#define when(cond) if (cond) - - #define Pool2MVT(pool) PARENT(MVTStruct, poolStruct, pool) #define MVT2Pool(mvt) (&(mvt)->poolStruct) From 86b334b7dab9cfbccb36ded3587b5bb6c011ead7 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 16 May 2014 11:17:29 +0100 Subject: [PATCH 87/93] Check for performance regressions before making a release. Copied from Perforce Change: 186127 ServerID: perforce.ravenbrook.com --- mps/procedure/release-build.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mps/procedure/release-build.rst b/mps/procedure/release-build.rst index ee65b5f645d..6624e0b8341 100644 --- a/mps/procedure/release-build.rst +++ b/mps/procedure/release-build.rst @@ -102,6 +102,10 @@ All relative paths are relative to On other platforms they are as shown above. +#. Check that there are no performance regressions by comparing the + benchmarks (``djbench`` and ``gcbench``) for the last release and + this one. + 5. Making the release (automated procedure) ------------------------------------------- From e6a9f19c6d31b80d4c524c81436a28f19a4ceac0 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 16 May 2014 12:31:47 +0100 Subject: [PATCH 88/93] Add note about consequences of running frequent collections. Copied from Perforce Change: 186134 ServerID: perforce.ravenbrook.com --- mps/manual/source/guide/debug.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mps/manual/source/guide/debug.rst b/mps/manual/source/guide/debug.rst index daf3fb63ae5..ddc46244c09 100644 --- a/mps/manual/source/guide/debug.rst +++ b/mps/manual/source/guide/debug.rst @@ -66,7 +66,10 @@ General debugging advice result, by having a mode for testing in which you run frequent collections (by calling :c:func:`mps_arena_collect` followed by :c:func:`mps_arena_release`), perhaps as frequently as every - allocation. + allocation. (This will of course make the system run very slowly, + but it ensures that if there are roots or references that are not + being scanned then the failure will occur close in time to the cause, + making it easier to diagnose.) #. .. index:: single: debugger From 3d9f137e7772e01c22c87ddd7b4b8994062f3cee Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 16 May 2014 13:36:52 +0100 Subject: [PATCH 89/93] Be more forceful about the requirement to update the fixed reference. Copied from Perforce Change: 186136 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/scanning.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mps/manual/source/topic/scanning.rst b/mps/manual/source/topic/scanning.rst index 474ec637dd8..a36da60bf0c 100644 --- a/mps/manual/source/topic/scanning.rst +++ b/mps/manual/source/topic/scanning.rst @@ -60,8 +60,8 @@ region to be scanned. They must carry out the following steps: function as soon as practicable. #. If :c:func:`MPS_FIX2` returns :c:macro:`MPS_RES_OK`, it may have - updated the reference. If necessary, make sure that the updated - reference is stored back to the region being scanned. + updated the reference. Make sure that the updated reference is + stored back into the region being scanned. #. Call the macro :c:func:`MPS_SCAN_END` on the scan state. @@ -463,15 +463,18 @@ Fixing interface :term:`Fix` a :term:`reference`. - ``ss`` is the :term:`scan state` that was passed to the scan method. + ``ss`` is the :term:`scan state` that was passed to the + :term:`scan method`. ``ref_io`` points to the reference. - Returns :c:macro:`MPS_RES_OK` if successful: in this case the - reference may have been updated, and the scan method must continue - to scan the :term:`block`. If it returns any other result, the - :term:`scan method` must return that result as soon as possible, - without fixing any further references. + Returns :c:macro:`MPS_RES_OK` if successful. In this case the + reference may have been updated, and so the scan method must store + the updated reference back to the region being scanned. The scan + method must continue to scan the :term:`block`. + + If it returns any other result, the scan method must return that + result as soon as possible, without fixing any further references. This macro must only be used within a :term:`scan method`, between :c:func:`MPS_SCAN_BEGIN` and :c:func:`MPS_SCAN_END`. From 6e7852e9a528295573e10f953557f0950b78e331 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 17 May 2014 00:26:34 +0100 Subject: [PATCH 90/93] Check meaning of extend_by and remove fixme. Copied from Perforce Change: 186148 ServerID: perforce.ravenbrook.com --- mps/code/dbgpool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c index 77c1d6eaf40..75cd14feddc 100644 --- a/mps/code/dbgpool.c +++ b/mps/code/dbgpool.c @@ -190,7 +190,10 @@ static Res DebugPoolInit(Pool pool, ArgList args) /* This pool has to be like the arena control pool: the blocks */ /* allocated must be accessible using void*. */ MPS_ARGS_BEGIN(pcArgs) { - MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, debug->tagSize); /* FIXME: Check this */ + /* By setting EXTEND_BY to debug->tagSize we get the smallest + possible extensions compatible with the tags, and so the + least amount of wasted space. */ + MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, debug->tagSize); MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, debug->tagSize); res = PoolCreate(&debug->tagPool, PoolArena(pool), PoolClassMFS(), pcArgs); } MPS_ARGS_END(pcArgs); From cc2dc227db5d58f3f1aa2f2bf31d70b336c497cf Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 17 May 2014 09:30:45 +0100 Subject: [PATCH 91/93] Documentation improvements suggests by bruce mitchener: * Fix cross-references to mps_pool_debug_option_s * Link pool classes in the header of the table of pool class properties Copied from Perforce Change: 186150 ServerID: perforce.ravenbrook.com --- mps/manual/source/pool/ams.rst | 8 ++--- mps/manual/source/pool/intro.rst | 58 ++++++++++++++++---------------- mps/manual/source/pool/mv.rst | 9 ++--- mps/manual/source/pool/mvff.rst | 8 ++--- 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/mps/manual/source/pool/ams.rst b/mps/manual/source/pool/ams.rst index ae1d43f8bed..9fb1f9a9103 100644 --- a/mps/manual/source/pool/ams.rst +++ b/mps/manual/source/pool/ams.rst @@ -183,16 +183,16 @@ AMS interface 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`. + options. See :c:type:`mps_pool_debug_option_s`. .. deprecated:: starting with version 1.112. - When using :c:func:`mps_pool_create`, pass the format, - chain, and debugging options like this:: + When using :c:func:`mps_pool_create`, pass the arguments like + this:: mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena, mps_class_t mps_class_ams_debug(), - mps_debug_option_s debug_option, + mps_pool_debug_option_s debug_option, mps_fmt_t fmt, mps_chain_t chain, mps_bool_t support_ambiguous) diff --git a/mps/manual/source/pool/intro.rst b/mps/manual/source/pool/intro.rst index ed8f83b8d4a..7abe7480e9b 100644 --- a/mps/manual/source/pool/intro.rst +++ b/mps/manual/source/pool/intro.rst @@ -100,35 +100,35 @@ it makes no sense to ask whether they may contain :term:`weak references (1)`. -============================================= ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== -Property AMC AMCZ AMS AWL LO MFS MV MVFF MVT SNC -============================================= ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== -Supports :c:func:`mps_alloc`? no no no no no yes yes yes no no -Supports :c:func:`mps_free`? no no no no no yes yes yes yes no -Supports allocation points? yes yes yes yes yes no yes yes yes yes -Supports allocation frames? yes yes yes yes yes no no yes yes yes -Supports segregated allocation caches? no no no no no yes yes yes no no -Timing of collections? [2]_ auto auto auto auto auto --- --- --- --- --- -May contain references? [3]_ yes no yes yes no no no no no yes -May contain exact references? [4]_ yes --- yes yes --- --- --- --- --- yes -May contain ambiguous references? [4]_ no --- no no --- --- --- --- --- no -May contain weak references? [4]_ no --- no yes --- --- --- --- --- no -Allocations fixed or variable in size? var var var var var fixed var var var var -Alignment? [5]_ conf conf conf conf conf [6]_ [6]_ [7]_ [7]_ conf -Dependent objects? [8]_ no --- no yes --- --- --- --- --- no -May use remote references? [9]_ no --- no no --- --- --- --- --- no -Blocks are automatically managed? [10]_ yes yes yes yes yes no no no no no -Blocks are promoted between generations yes yes no no no --- --- --- --- --- -Blocks are manually managed? [10]_ no no no no no yes yes yes yes yes -Blocks are scanned? [11]_ yes no yes yes no no no no no yes -Blocks support base pointers only? [12]_ no no yes yes yes --- --- --- --- yes -Blocks support internal pointers? [12]_ yes yes no no no --- --- --- --- no -Blocks may be protected by barriers? yes no yes yes yes no no no no yes -Blocks may move? yes yes no no no no no no no no -Blocks may be finalized? yes yes yes yes yes no no no no no -Blocks must be formatted? [11]_ yes yes yes yes yes no no no no yes -Blocks may use :term:`in-band headers`? yes yes yes yes yes --- --- --- --- no -============================================= ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== +.. csv-table:: + :header: "Property", ":ref:`AMC `", ":ref:`AMCZ `", ":ref:`AMS `", ":ref:`AWL `", ":ref:`LO `", ":ref:`MFS `", ":ref:`MV `", ":ref:`MVFF `", ":ref:`MVT `", ":ref:`SNC `" + :widths: 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + + Supports :c:func:`mps_alloc`?, no, no, no, no, no, yes, yes, yes, no, no + Supports :c:func:`mps_free`?, no, no, no, no, no, yes, yes, yes, yes, no + Supports allocation points?, yes, yes, yes, yes, yes, no, yes, yes, yes, yes + Supports allocation frames?, yes, yes, yes, yes, yes, no, no, yes, yes, yes + Supports segregated allocation caches?, no, no, no, no, no, yes, yes, yes, no, no + Timing of collections? [2]_, auto, auto, auto, auto, auto, ---, ---, ---, ---, --- + May contain references? [3]_, yes, no, yes, yes, no, no, no, no, no, yes + May contain exact references? [4]_, yes, ---, yes, yes, ---, ---, ---, ---, ---, yes + May contain ambiguous references? [4]_, no, ---, no, no, ---, ---, ---, ---, ---, no + May contain weak references? [4]_, no, ---, no, yes, ---, ---, ---, ---, ---, no + Allocations fixed or variable in size?, var, var, var, var, var, fixed, var, var, var, var + Alignment? [5]_, conf, conf, conf, conf, conf, [6]_, [6]_, [7]_, [7]_, conf + Dependent objects? [8]_, no, ---, no, yes, ---, ---, ---, ---, ---, no + May use remote references? [9]_, no, ---, no, no, ---, ---, ---, ---, ---, no + Blocks are automatically managed? [10]_, yes, yes, yes, yes, yes, no, no, no, no, no + Blocks are promoted between generations, yes, yes, no, no, no, ---, ---, ---, ---, --- + Blocks are manually managed? [10]_, no, no, no, no, no, yes, yes, yes, yes, yes + Blocks are scanned? [11]_, yes, no, yes, yes, no, no, no, no, no, yes + Blocks support base pointers only? [12]_, no, no, yes, yes, yes, ---, ---, ---, ---, yes + Blocks support internal pointers? [12]_, yes, yes, no, no, no, ---, ---, ---, ---, no + Blocks may be protected by barriers?, yes, no, yes, yes, yes, no, no, no, no, yes + Blocks may move?, yes, yes, no, no, no, no, no, no, no, no + Blocks may be finalized?, yes, yes, yes, yes, yes, no, no, no, no, no + Blocks must be formatted? [11]_, yes, yes, yes, yes, yes, no, no, no, no, yes + Blocks may use :term:`in-band headers`?, yes, yes, yes, yes, yes, ---, ---, ---, ---, no .. note:: diff --git a/mps/manual/source/pool/mv.rst b/mps/manual/source/pool/mv.rst index 361cd41c0b5..d24ce3f273f 100644 --- a/mps/manual/source/pool/mv.rst +++ b/mps/manual/source/pool/mv.rst @@ -122,16 +122,17 @@ MV interface 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`. + specifies the debugging options. See + :c:type:`mps_pool_debug_option_s`. .. deprecated:: starting with version 1.112. - When using :c:func:`mps_pool_create`, pass the debugging - options, segment size, mean size, and maximum size like this:: + When using :c:func:`mps_pool_create`, pass the arguments like + this:: mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena, mps_class_t mps_class_mv_debug(), - mps_debug_option_s debug_option, + mps_pool_debug_option_s debug_option, mps_size_t extend_size, mps_size_t average_size, mps_size_t maximum_size) diff --git a/mps/manual/source/pool/mvff.rst b/mps/manual/source/pool/mvff.rst index e688a00d09d..954a860fc63 100644 --- a/mps/manual/source/pool/mvff.rst +++ b/mps/manual/source/pool/mvff.rst @@ -201,16 +201,16 @@ MVFF interface :c:macro:`MPS_KEY_MVFF_SLOT_HIGH`, and :c:macro:`MPS_KEY_MVFF_FIRST_FIT` are as described above, and :c:macro:`MPS_KEY_POOL_DEBUG_OPTIONS` specifies the debugging - options. See :c:type:`mps_debug_option_s`. + options. See :c:type:`mps_pool_debug_option_s`. .. deprecated:: starting with version 1.112. - When using :c:func:`mps_pool_create`, pass the debugging - options, and other arguments like this:: + When using :c:func:`mps_pool_create`, pass the arguments like + this:: mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena, mps_class_t mps_class_mvff_debug(), - mps_debug_option_s debug_option, + mps_pool_debug_option_s debug_option, size_t extend_size, size_t average_size, mps_align_t alignment, From 2cf1859759ddd085c3e07fa6371e89a9e3a7ae5d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 19 May 2014 10:55:48 +0100 Subject: [PATCH 92/93] Correct dependencies for benchmarks and event tools. Copied from Perforce Change: 186171 ServerID: perforce.ravenbrook.com --- mps/code/comm.gmk | 60 ++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 4fb69b9ea1e..c90473c5eb8 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -163,12 +163,11 @@ FMTDYTST = fmtdy.c fmtno.c fmtdytst.c FMTHETST = fmthe.c fmtdy.c fmtno.c fmtdytst.c FMTSCM = fmtscheme.c PLINTH = mpsliban.c mpsioan.c -EVENTPROC = eventcnv.c table.c MPMCOMMON = abq.c arena.c arenacl.c arenavm.c arg.c boot.c bt.c \ buffer.c cbs.c dbgpool.c dbgpooli.c event.c format.c freelist.c \ global.c ld.c locus.c message.c meter.c mpm.c mpsi.c nailboard.c \ pool.c poolabs.c poolmfs.c poolmrg.c poolmv.c protocol.c range.c \ - ref.c reserv.c ring.c root.c sa.c sac.c seg.c shield.c splay.c ss.c \ + ref.c reserv.c ring.c root.c sa.c sac.c seg.c shield.c splay.c ss.c \ table.c trace.c traceanc.c tract.c tree.c walk.c MPM = $(MPMCOMMON) $(MPMPF) @@ -182,40 +181,22 @@ MPM = $(MPMCOMMON) $(MPMPF) ifdef VARIETY MPMOBJ = $(MPM:%.c=$(PFM)/$(VARIETY)/%.o) \ $(MPMS:%.s=$(PFM)/$(VARIETY)/%.o) -MPMDEP = $(MPM:%.c=$(PFM)/$(VARIETY)/%.d) AMCOBJ = $(AMC:%.c=$(PFM)/$(VARIETY)/%.o) -AMCDEP = $(AMC:%.c=$(PFM)/$(VARIETY)/%.d) AMSOBJ = $(AMS:%.c=$(PFM)/$(VARIETY)/%.o) -AMSDEP = $(AMS:%.c=$(PFM)/$(VARIETY)/%.d) AWLOBJ = $(AWL:%.c=$(PFM)/$(VARIETY)/%.o) -AWLDEP = $(AWL:%.c=$(PFM)/$(VARIETY)/%.d) LOOBJ = $(LO:%.c=$(PFM)/$(VARIETY)/%.o) -LODEP = $(LO:%.c=$(PFM)/$(VARIETY)/%.d) SNCOBJ = $(SNC:%.c=$(PFM)/$(VARIETY)/%.o) -SNCDEP = $(SNC:%.c=$(PFM)/$(VARIETY)/%.d) POOLNOBJ = $(POOLN:%.c=$(PFM)/$(VARIETY)/%.o) -POOLNDEP = $(POOLN:%.c=$(PFM)/$(VARIETY)/%.d) MV2OBJ = $(MV2:%.c=$(PFM)/$(VARIETY)/%.o) -MV2DEP = $(MV2:%.c=$(PFM)/$(VARIETY)/%.d) MVFFOBJ = $(MVFF:%.c=$(PFM)/$(VARIETY)/%.o) -MVFFDEP = $(MVFF:%.c=$(PFM)/$(VARIETY)/%.d) TESTLIBOBJ = $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.o) -TESTLIBDEP = $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.d) TESTTHROBJ = $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.o) -TESTTHRDEP = $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.d) FMTDYOBJ = $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.o) -FMTDYDEP = $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.d) FMTDYTSTOBJ = $(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.o) -FMTDYTSTDEP = $(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.d) FMTHETSTOBJ = $(FMTHETST:%.c=$(PFM)/$(VARIETY)/%.o) -FMTHETSTDEP = $(FMTHETST:%.c=$(PFM)/$(VARIETY)/%.d) FMTSCMOBJ = $(FMTSCM:%.c=$(PFM)/$(VARIETY)/%.o) -FMTSCMDEP = $(FMTSCM:%.c=$(PFM)/$(VARIETY)/%.d) PLINTHOBJ = $(PLINTH:%.c=$(PFM)/$(VARIETY)/%.o) -PLINTHDEP = $(PLINTH:%.c=$(PFM)/$(VARIETY)/%.d) -EVENTPROCOBJ = $(EVENTPROC:%.c=$(PFM)/$(VARIETY)/%.o) -EVENTPROCDEP = $(EVENTPROC:%.c=$(PFM)/$(VARIETY)/%.d) endif @@ -423,7 +404,7 @@ $(PFM)/$(VARIETY)/bttest: $(PFM)/$(VARIETY)/bttest.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/djbench: $(PFM)/$(VARIETY)/djbench.o \ - $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a + $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/exposet0: $(PFM)/$(VARIETY)/exposet0.o \ $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -444,7 +425,7 @@ $(PFM)/$(VARIETY)/fotest: $(PFM)/$(VARIETY)/fotest.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/gcbench: $(PFM)/$(VARIETY)/gcbench.o \ - $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a + $(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/locbwcss: $(PFM)/$(VARIETY)/locbwcss.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -580,22 +561,27 @@ else ifeq ($(VARIETY),hot) include $(PFM)/$(VARIETY)/mps.d else -# %%PART: When adding a new part, add the dependency file macro for the new -# part here. +# %%PART: When adding a new part, add the dependencies file for the +# new part here. include \ - $(MPMDEP) \ - $(AMCDEP) \ - $(AMSDEP) \ - $(AWLDEP) \ - $(EVENTPROCDEP) \ - $(FMTDYDEP) \ - $(FMTDYTSTDEP) \ - $(FMTHETSTDEP) \ - $(FMTSCMDEP) \ - $(LODEP) \ - $(PLINTHDEP) \ - $(POOLNDEP) \ - $(TESTLIBDEP) + $(AMC:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(AMS:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(AWL:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(FMTHETST:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(FMTSCM:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(LO:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(MPM:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(MV2:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(MVFF:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(PLINTH:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(POOLN:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(SNC:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.d) \ + $(EXTRA_TARGETS:mps%=$(PFM)/$(VARIETY)/%.d) \ + $(TEST_TARGETS:%=$(PFM)/$(VARIETY)/%.d) endif endif From 06288300bf48ab38f91c5e7f8c5e095c11157dfd Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 19 May 2014 11:39:05 +0100 Subject: [PATCH 93/93] Don't include pooln.c in mps.c -- only used by test case poolncv. Include dependencies in all varieties, not just in COOL. Copied from Perforce Change: 186174 ServerID: perforce.ravenbrook.com --- mps/code/comm.gmk | 45 +++++++++++++++------------------------------ mps/code/mps.c | 1 - 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index c90473c5eb8..af5718c6caf 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -169,7 +169,7 @@ MPMCOMMON = abq.c arena.c arenacl.c arenavm.c arg.c boot.c bt.c \ pool.c poolabs.c poolmfs.c poolmrg.c poolmv.c protocol.c range.c \ ref.c reserv.c ring.c root.c sa.c sac.c seg.c shield.c splay.c ss.c \ table.c trace.c traceanc.c tract.c tree.c walk.c -MPM = $(MPMCOMMON) $(MPMPF) +MPM = $(MPMCOMMON) $(MPMPF) $(AMC) $(AMS) $(AWL) $(LO) $(MV2) $(MVFF) $(PLINTH) # These map the source file lists onto object files and dependency files @@ -181,22 +181,16 @@ MPM = $(MPMCOMMON) $(MPMPF) ifdef VARIETY MPMOBJ = $(MPM:%.c=$(PFM)/$(VARIETY)/%.o) \ $(MPMS:%.s=$(PFM)/$(VARIETY)/%.o) -AMCOBJ = $(AMC:%.c=$(PFM)/$(VARIETY)/%.o) -AMSOBJ = $(AMS:%.c=$(PFM)/$(VARIETY)/%.o) -AWLOBJ = $(AWL:%.c=$(PFM)/$(VARIETY)/%.o) -LOOBJ = $(LO:%.c=$(PFM)/$(VARIETY)/%.o) -SNCOBJ = $(SNC:%.c=$(PFM)/$(VARIETY)/%.o) -POOLNOBJ = $(POOLN:%.c=$(PFM)/$(VARIETY)/%.o) -MV2OBJ = $(MV2:%.c=$(PFM)/$(VARIETY)/%.o) -MVFFOBJ = $(MVFF:%.c=$(PFM)/$(VARIETY)/%.o) - -TESTLIBOBJ = $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.o) -TESTTHROBJ = $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.o) FMTDYOBJ = $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.o) FMTDYTSTOBJ = $(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.o) FMTHETSTOBJ = $(FMTHETST:%.c=$(PFM)/$(VARIETY)/%.o) FMTSCMOBJ = $(FMTSCM:%.c=$(PFM)/$(VARIETY)/%.o) +MV2OBJ = $(MV2:%.c=$(PFM)/$(VARIETY)/%.o) +MVFFOBJ = $(MVFF:%.c=$(PFM)/$(VARIETY)/%.o) PLINTHOBJ = $(PLINTH:%.c=$(PFM)/$(VARIETY)/%.o) +POOLNOBJ = $(POOLN:%.c=$(PFM)/$(VARIETY)/%.o) +TESTLIBOBJ = $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.o) +TESTTHROBJ = $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.o) endif @@ -344,10 +338,7 @@ endif $(PFM)/rash/mps.a: $(PFM)/rash/mps.o $(PFM)/hot/mps.a: $(PFM)/hot/mps.o - -$(PFM)/cool/mps.a: \ - $(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \ - $(MV2OBJ) $(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ) +$(PFM)/cool/mps.a: $(MPMOBJ) # OTHER GENUINE TARGETS @@ -458,7 +449,7 @@ $(PFM)/$(VARIETY)/nailboardtest: $(PFM)/$(VARIETY)/nailboardtest.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/poolncv: $(PFM)/$(VARIETY)/poolncv.o \ - $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a + $(POOLNOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a $(PFM)/$(VARIETY)/qs: $(PFM)/$(VARIETY)/qs.o \ $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a @@ -561,34 +552,28 @@ else ifeq ($(VARIETY),hot) include $(PFM)/$(VARIETY)/mps.d else +include $(MPM:%.c=$(PFM)/$(VARIETY)/%.d) +endif # VARIETY != hot +endif # VARIETY != rash + # %%PART: When adding a new part, add the dependencies file for the # new part here. include \ - $(AMC:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(AMS:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(AWL:%.c=$(PFM)/$(VARIETY)/%.d) \ $(FMTDY:%.c=$(PFM)/$(VARIETY)/%.d) \ $(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.d) \ $(FMTHETST:%.c=$(PFM)/$(VARIETY)/%.d) \ $(FMTSCM:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(LO:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(MPM:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(MV2:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(MVFF:%.c=$(PFM)/$(VARIETY)/%.d) \ $(PLINTH:%.c=$(PFM)/$(VARIETY)/%.d) \ $(POOLN:%.c=$(PFM)/$(VARIETY)/%.d) \ - $(SNC:%.c=$(PFM)/$(VARIETY)/%.d) \ $(TESTLIB:%.c=$(PFM)/$(VARIETY)/%.d) \ $(TESTTHR:%.c=$(PFM)/$(VARIETY)/%.d) \ $(EXTRA_TARGETS:mps%=$(PFM)/$(VARIETY)/%.d) \ $(TEST_TARGETS:%=$(PFM)/$(VARIETY)/%.d) -endif -endif -endif -endif +endif # !defined TARGET +endif # !defined VARIETY -endif +endif # !defined gendep # Library diff --git a/mps/code/mps.c b/mps/code/mps.c index 200f63e894c..9f217c15791 100644 --- a/mps/code/mps.c +++ b/mps/code/mps.c @@ -85,7 +85,6 @@ #include "poolawl.c" #include "poollo.c" #include "poolsnc.c" -#include "pooln.c" #include "poolmv2.c" #include "poolmvff.c"