From 55adbe705d50553cdc56c229487fbb7bcdb22cca Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 2 Sep 2016 14:11:08 +0100 Subject: [PATCH] Fix assertion text in the manual. Place a cross-reference by each assertion the appears in the manual, to assist in keeping the manual up to date. Copied from Perforce Change: 192097 ServerID: perforce.ravenbrook.com --- mps/code/buffer.c | 2 +- mps/code/dbgpool.c | 8 ++++---- mps/code/format.c | 6 +++--- mps/code/global.c | 10 +++++----- mps/code/lockix.c | 6 +++--- mps/code/lockli.c | 6 +++--- mps/code/lockw3.c | 6 +++--- mps/code/locus.c | 2 +- mps/code/mpsi.c | 6 +++--- mps/code/poolams.c | 2 +- mps/code/poolsnc.c | 2 +- mps/code/seg.c | 2 +- mps/code/trace.c | 4 ++-- mps/design/check.txt | 14 +++++++++++++- mps/manual/source/topic/error.rst | 4 ++-- 15 files changed, 46 insertions(+), 34 deletions(-) diff --git a/mps/code/buffer.c b/mps/code/buffer.c index a35b7b55a12..1c9cca6b7da 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -485,7 +485,7 @@ Res BufferReserve(Addr *pReturn, Buffer buffer, Size size) AVERT(Buffer, buffer); AVER(size > 0); AVER(SizeIsAligned(size, BufferPool(buffer)->alignment)); - AVER(BufferIsReady(buffer)); + AVER(BufferIsReady(buffer)); /* */ /* Is there enough room in the unallocated portion of the buffer to */ /* satisfy the request? If so, just increase the alloc marker and */ diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c index 8068dc64b97..69b39650034 100644 --- a/mps/code/dbgpool.c +++ b/mps/code/dbgpool.c @@ -1,7 +1,7 @@ /* dbgpool.c: POOL DEBUG MIXIN * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * .source: design.mps.object-debug @@ -523,7 +523,7 @@ static void fenceFree(PoolDebugMixin debug, { Size alignedFenceSize, alignedSize; - ASSERT(fenceCheck(debug, pool, old, size), "fencepost check on free"); + ASSERT(fenceCheck(debug, pool, old, size), "fencepost check on free"); /* */ alignedFenceSize = SizeAlignUp(debug->fenceSize, PoolAlignment(pool)); alignedSize = SizeAlignUp(size, PoolAlignment(pool)); @@ -738,7 +738,7 @@ void DebugPoolFreeCheck(Pool pool, Addr base, Addr limit) AVERT(PoolDebugMixin, debug); if (debug->freeSize != 0) ASSERT(freeCheck(debug, pool, base, limit), - "free space corrupted on release"); + "free space corrupted on release"); /* */ } } @@ -784,7 +784,7 @@ void PoolClassMixInDebug(PoolClass klass) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2016 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/format.c b/mps/code/format.c index fadeadce489..b9c4a59fb14 100644 --- a/mps/code/format.c +++ b/mps/code/format.c @@ -1,7 +1,7 @@ /* format.c: OBJECT FORMATS * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. * * DESIGN @@ -168,7 +168,7 @@ Res FormatCreate(Format *formatReturn, Arena arena, ArgList args) void FormatDestroy(Format format) { AVERT(Format, format); - AVER(format->poolCount == 0); + AVER(format->poolCount == 0); /* */ RingRemove(&format->arenaRing); @@ -250,7 +250,7 @@ Res FormatDescribe(Format format, mps_lib_FILE *stream, Count depth) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2016 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/global.c b/mps/code/global.c index 9fd8d7aeed8..02b2f04928e 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -464,12 +464,12 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals) * and so RingCheck dereferences a pointer into that unmapped memory * and we get a crash instead of an assertion. See job000652. */ - AVER(RingIsSingle(&arena->formatRing)); - AVER(RingIsSingle(&arena->chainRing)); + AVER(RingIsSingle(&arena->formatRing)); /* */ + AVER(RingIsSingle(&arena->chainRing)); /* */ AVER(RingIsSingle(&arena->messageRing)); - AVER(RingIsSingle(&arena->threadRing)); + AVER(RingIsSingle(&arena->threadRing)); /* */ AVER(RingIsSingle(&arena->deadRing)); - AVER(RingIsSingle(&arenaGlobals->rootRing)); + AVER(RingIsSingle(&arenaGlobals->rootRing)); /* */ for(rank = RankMIN; rank < RankLIMIT; ++rank) AVER(RingIsSingle(&arena->greyRing[rank])); @@ -479,7 +479,7 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals) * 2. arena->controlPoolStruct.blockPoolStruct * 3. arena->controlPoolStruct.spanPoolStruct */ - AVER(RingLength(&arenaGlobals->poolRing) == 4); + AVER(RingLength(&arenaGlobals->poolRing) == 4); /* */ } diff --git a/mps/code/lockix.c b/mps/code/lockix.c index c982bf0cb17..d43e458f430 100644 --- a/mps/code/lockix.c +++ b/mps/code/lockix.c @@ -1,7 +1,7 @@ /* lockix.c: RECURSIVE LOCKS FOR POSIX SYSTEMS * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. * * .posix: The implementation uses a POSIX interface, and should be reusable * for many Unix-like operating systems. @@ -122,7 +122,7 @@ void (LockClaim)(Lock lock) res = pthread_mutex_lock(&lock->mut); /* pthread_mutex_lock will error if we own the lock already. */ - AVER(res == 0); + AVER(res == 0); /* */ /* This should be the first claim. Now we own the mutex */ /* it is ok to check this. */ @@ -245,7 +245,7 @@ void (LockReleaseGlobal)(void) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2016 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/lockli.c b/mps/code/lockli.c index 0dc98fb8a25..a3369abda90 100644 --- a/mps/code/lockli.c +++ b/mps/code/lockli.c @@ -1,7 +1,7 @@ /* lockli.c: RECURSIVE LOCKS FOR POSIX SYSTEMS * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. * * .linux: This implementation currently just supports LinuxThreads * (platform MPS_OS_LI), Single Unix i/f. @@ -136,7 +136,7 @@ void (LockClaim)(Lock lock) res = pthread_mutex_lock(&lock->mut); /* pthread_mutex_lock will error if we own the lock already. */ - AVER(res == 0); + AVER(res == 0); /* */ /* This should be the first claim. Now we own the mutex */ /* it is ok to check this. */ @@ -259,7 +259,7 @@ void (LockReleaseGlobal)(void) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2016 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/lockw3.c b/mps/code/lockw3.c index 53da970aed2..daf2473d4e3 100644 --- a/mps/code/lockw3.c +++ b/mps/code/lockw3.c @@ -1,7 +1,7 @@ /* lockw3.c: RECURSIVE LOCKS IN WIN32 * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. * * .design: These are implemented using critical sections. * See the section titled "Synchronization functions" in the Groups @@ -75,7 +75,7 @@ void (LockClaim)(Lock lock) EnterCriticalSection(&lock->cs); /* This should be the first claim. Now we are inside the * critical section it is ok to check this. */ - AVER(lock->claims == 0); + AVER(lock->claims == 0); /* */ lock->claims = 1; } @@ -158,7 +158,7 @@ void (LockReleaseGlobal)(void) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2016 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 4e68cbcb8c8..30f8e4a5076 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -269,7 +269,7 @@ void ChainDestroy(Chain chain) size_t i; AVERT(Chain, chain); - AVER(chain->activeTraces == TraceSetEMPTY); + AVER(chain->activeTraces == TraceSetEMPTY); /* */ arena = chain->arena; genCount = chain->genCount; diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 2bc48179b3a..080b660fac3 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -1,7 +1,7 @@ /* mpsi.c: MEMORY POOL SYSTEM C INTERFACE LAYER * * $Id$ - * Copyright (c) 2001-2015 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. * * .purpose: This code bridges between the MPS interface to C, @@ -1060,7 +1060,7 @@ mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size) AVER(p_o != NULL); AVERT(Buffer, buf); AVER(size > 0); - AVER(SizeIsAligned(size, BufferPool(buf)->alignment)); + AVER(SizeIsAligned(size, BufferPool(buf)->alignment)); /* */ res = BufferFill(&p, buf, size); @@ -2141,7 +2141,7 @@ void _mps_args_set_key(mps_arg_s args[MPS_ARGS_MAX], unsigned i, /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2015 Ravenbrook Limited . + * Copyright (C) 2001-2016 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/poolams.c b/mps/code/poolams.c index 8218fa53f81..96a82628d60 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -1491,7 +1491,7 @@ static Res AMSFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) case RankFINAL: case RankWEAK: AVER_CRITICAL(AddrIsAligned(base, PoolAlignment(pool))); - AVER_CRITICAL(AMS_ALLOCED(seg, i)); + AVER_CRITICAL(AMS_ALLOCED(seg, i)); /* */ if (AMS_IS_WHITE(seg, i)) { ss->wasMarked = FALSE; if (ss->rank == RankWEAK) { /* then splat the reference */ diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c index db0cb5f6173..ae8f11d64aa 100644 --- a/mps/code/poolsnc.c +++ b/mps/code/poolsnc.c @@ -564,7 +564,7 @@ static Res SNCFramePop(Pool pool, Buffer buf, AllocFrame frame) arena = PoolArena(pool); addr = (Addr)frame; foundSeg = SegOfAddr(&seg, arena, addr); - AVER(foundSeg); + AVER(foundSeg); /* */ AVER(SegPool(seg) == pool); if (SegBuffer(seg) == buf) { diff --git a/mps/code/seg.c b/mps/code/seg.c index 88b34fe6e55..fe52b961898 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -1086,7 +1086,7 @@ static void gcSegFinish(Seg seg) gcseg->sig = SigInvalid; /* Don't leave a dangling buffer allocating into hyperspace. */ - AVER(gcseg->buffer == NULL); + AVER(gcseg->buffer == NULL); /* */ RingFinish(&gcseg->greyRing); diff --git a/mps/code/trace.c b/mps/code/trace.c index 02c04e4b841..cd056b1a178 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1178,7 +1178,7 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg) /* .verify.segsummary: were the seg contents, as found by this * scan, consistent with the recorded SegSummary? */ - AVER(RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg))); + AVER(RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg))); /* */ /* Write barrier deferral -- see design.mps.write-barrier.deferral. */ /* Did the segment refer to the white set? */ @@ -1373,7 +1373,7 @@ mps_res_t _mps_fix2(mps_ss_t mps_ss, mps_addr_t *mps_ref_io) if (!BTGet(chunk->allocTable, i)) { /* Reference points into a chunk but not to an allocated tract. * See */ - AVER_CRITICAL(ss->rank < RankEXACT); + AVER_CRITICAL(ss->rank < RankEXACT); /* */ goto done; } diff --git a/mps/design/check.txt b/mps/design/check.txt index 2cf5bf091c6..7f89027c5b4 100644 --- a/mps/design/check.txt +++ b/mps/design/check.txt @@ -122,6 +122,18 @@ reference this tag. The structure could be considered for addition to ``mpmst.h``. +Common assertions +----------------- + +_`.common`: Some assertions are commonly triggered by mistakes in the +:term:`client program`. These are listed in the section "Common +assertions and their causes" in the MPS Reference, together with an +explanation of their likely cause, and advice for fixing the problem. +To assist with keeping the MPS Reference up to date, these assertions +are marked with a cross-reference to this tag. When you update the +assertion, you must also update the MPS Reference. + + Document History ---------------- @@ -138,7 +150,7 @@ Document History Copyright and License --------------------- -Copyright © 2013-2014 Ravenbrook Limited . +Copyright © 2013-2016 Ravenbrook Limited . All rights reserved. This is an open source license. Contact Ravenbrook for commercial licensing options. diff --git a/mps/manual/source/topic/error.rst b/mps/manual/source/topic/error.rst index 796edda1699..b47e24858e5 100644 --- a/mps/manual/source/topic/error.rst +++ b/mps/manual/source/topic/error.rst @@ -286,7 +286,7 @@ this documentation. It is necessary to call :c:func:`mps_fmt_destroy` first. -``global.c: RingIsSingle(&arena->rootRing)`` +``global.c: RingIsSingle(&arenaGlobals->rootRing)`` The client program called :c:func:`mps_arena_destroy` without destroying all the :term:`roots` belonging to the arena. @@ -300,7 +300,7 @@ this documentation. It is necessary to call :c:func:`mps_thread_dereg` first. -``global.c: RingLength(&arenaGlobals->poolRing) == 5`` +``global.c: RingLength(&arenaGlobals->poolRing) == 4`` The client program called :c:func:`mps_arena_destroy` without destroying all the :term:`pools` belonging to the arena.