From d3d2795fceef542323e04efe5531de38bcf00d90 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sun, 6 Apr 2014 22:51:05 +0100 Subject: [PATCH] Improve control over checking: 1. Where Type is a pointer type with a signature, replace CHECKL(TypeCheck(val)) with CHECKD(Type, val). 2. Where Type is a pointer type with no signature, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val). 3. Where Type is a pointer type with a signature, but the structure is not visible at point of checking, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val). Reference 4. Make BTCheck extern and use it where possible. 5. Replace AVER(TypeCheck(val)) with AVERT(Type, val). Copied from Perforce Change: 185263 ServerID: perforce.ravenbrook.com --- mps/code/arena.c | 16 ++++++----- mps/code/arenacl.c | 6 ++-- mps/code/arenavm.c | 10 +++---- mps/code/arg.c | 12 ++++---- mps/code/boot.c | 6 ++-- mps/code/bt.c | 38 ++++++++++++------------- mps/code/bt.h | 5 ++-- mps/code/buffer.c | 16 +++++------ mps/code/cbs.c | 16 +++++------ mps/code/dbgpool.c | 4 +-- mps/code/format.c | 8 +++--- mps/code/global.c | 24 ++++++++-------- mps/code/locus.c | 8 +++--- mps/code/message.c | 14 +++++----- mps/code/mpm.c | 12 ++++---- mps/code/mpsi.c | 4 +-- mps/code/pool.c | 10 +++---- mps/code/poolabs.c | 10 +++---- mps/code/poolamc.c | 10 +++---- mps/code/poolams.c | 32 ++++++++++----------- mps/code/poolawl.c | 12 ++++---- mps/code/poollo.c | 10 +++---- mps/code/poolmfs.c | 10 +++---- mps/code/poolmrg.c | 18 ++++++------ mps/code/poolmv.c | 10 +++---- mps/code/poolmv2.c | 9 ++---- mps/code/poolmvff.c | 12 ++++---- mps/code/pooln.c | 4 +-- mps/code/poolsnc.c | 14 +++++----- mps/code/protocol.c | 2 +- mps/code/pthrdext.c | 8 +++--- mps/code/reserv.c | 4 +-- mps/code/root.c | 18 ++++++------ mps/code/sa.c | 8 ++---- mps/code/sac.c | 6 ++-- mps/code/seg.c | 66 ++++++++++++++++++++++---------------------- mps/code/segsmss.c | 8 +++--- mps/code/splay.c | 2 +- mps/code/than.c | 6 ++-- mps/code/thix.c | 6 ++-- mps/code/thw3.c | 6 ++-- mps/code/thxc.c | 6 ++-- mps/code/trace.c | 16 +++++------ mps/code/tract.c | 8 +++--- mps/code/walk.c | 2 +- mps/design/check.txt | 33 +++++++++++++++------- 46 files changed, 287 insertions(+), 278 deletions(-) diff --git a/mps/code/arena.c b/mps/code/arena.c index 749208aeee2..30f7687ce81 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -86,7 +86,7 @@ DEFINE_CLASS(AbstractArenaClass, class) Bool ArenaClassCheck(ArenaClass class) { - CHECKL(ProtocolClassCheck(&class->protocol)); + CHECKD(ProtocolClass, &class->protocol); CHECKL(class->name != NULL); /* Should be <=6 char C identifier */ CHECKL(class->size >= sizeof(ArenaStruct)); /* Offset of generic Pool within class-specific instance cannot be */ @@ -147,7 +147,7 @@ Bool ArenaCheck(Arena arena) if (arena->primary != NULL) { CHECKD(Chunk, arena->primary); } - CHECKL(RingCheck(&arena->chunkRing)); + CHECKD_NOSIG(Ring, &arena->chunkRing); /* nothing to check for chunkSerial */ CHECKD(ChunkCacheEntry, &arena->chunkCache); @@ -155,7 +155,9 @@ Bool ArenaCheck(Arena arena) CHECKL(BoolCheck(arena->hasFreeCBS)); if (arena->hasFreeCBS) - CHECKL(CBSCheck(ArenaFreeCBS(arena))); + CHECKD(CBS, ArenaFreeCBS(arena)); + + CHECKL(BoolCheck(arena->zoned)); return TRUE; } @@ -179,7 +181,7 @@ Res ArenaInit(Arena arena, ArenaClass class, Align alignment, ArgList args) AVER(arena != NULL); AVERT(ArenaClass, class); - AVER(AlignCheck(alignment)); + AVERT(Align, alignment); if (ArgPick(&arg, args, MPS_KEY_ARENA_ZONED)) zoned = arg.val.b; @@ -284,7 +286,7 @@ Res ArenaCreate(Arena *arenaReturn, ArenaClass class, ArgList args) AVER(arenaReturn != NULL); AVERT(ArenaClass, class); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); /* We must initialise the event subsystem very early, because event logging will start as soon as anything interesting happens and expect to write @@ -556,7 +558,7 @@ Res ControlAlloc(void **baseReturn, Arena arena, size_t size, AVERT(Arena, arena); AVER(baseReturn != NULL); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); AVER(arena->poolReady); res = PoolAlloc(&base, ArenaControlPool(arena), (Size)size, @@ -1021,7 +1023,7 @@ Res ArenaAlloc(Addr *baseReturn, SegPref pref, Size size, Pool pool, AVERT(SegPref, pref); AVER(size > (Size)0); AVERT(Pool, pool); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); arena = PoolArena(pool); AVERT(Arena, arena); diff --git a/mps/code/arenacl.c b/mps/code/arenacl.c index 2f954032203..3d07f529779 100644 --- a/mps/code/arenacl.c +++ b/mps/code/arenacl.c @@ -67,7 +67,7 @@ static Bool ClientChunkCheck(ClientChunk clChunk) CHECKS(ClientChunk, clChunk); chunk = ClientChunk2Chunk(clChunk); - CHECKL(ChunkCheck(chunk)); + CHECKD(Chunk, chunk); CHECKL(clChunk->freePages <= chunk->pages); /* check they don't overlap (knowing the order) */ CHECKL((Addr)(chunk + 1) < (Addr)chunk->allocTable); @@ -201,7 +201,7 @@ static void ClientArenaVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[1].key = MPS_KEY_ARENA_CL_BASE; args[1].val.addr = va_arg(varargs, Addr); args[2].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -228,7 +228,7 @@ static Res ClientArenaInit(Arena *arenaReturn, ArenaClass class, ArgList args) AVER(arenaReturn != NULL); AVER((ArenaClass)mps_arena_class_cl() == class); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); ArgRequire(&arg, args, MPS_KEY_ARENA_SIZE); size = arg.val.size; diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c index 03a3af2f3a2..1bcc6272f35 100644 --- a/mps/code/arenavm.c +++ b/mps/code/arenavm.c @@ -99,8 +99,8 @@ static Bool VMChunkCheck(VMChunk vmchunk) CHECKS(VMChunk, vmchunk); chunk = VMChunk2Chunk(vmchunk); - CHECKL(ChunkCheck(chunk)); - CHECKL(VMCheck(vmchunk->vm)); + CHECKD(Chunk, chunk); + CHECKD_NOSIG(VM, vmchunk->vm); /* */ CHECKL(VMAlign(vmchunk->vm) == ChunkPageSize(chunk)); CHECKL(vmchunk->overheadMappedLimit <= (Addr)chunk->pageTable); CHECKD(SparseArray, &vmchunk->pages); @@ -174,7 +174,7 @@ static Bool VMArenaCheck(VMArena vmArena) CHECKL(VMMapped(primary->vm) <= arena->committed); } - CHECKL(RingCheck(&vmArena->spareRing)); + CHECKD_NOSIG(Ring, &vmArena->spareRing); /* FIXME: Can't check VMParams */ @@ -438,7 +438,7 @@ static void VMArenaVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[0].key = MPS_KEY_ARENA_SIZE; args[0].val.size = va_arg(varargs, Size); args[1].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -493,7 +493,7 @@ static Res VMArenaInit(Arena *arenaReturn, ArenaClass class, ArgList args) AVER(arenaReturn != NULL); AVER(class == VMArenaClassGet()); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); ArgRequire(&arg, args, MPS_KEY_ARENA_SIZE); userSize = arg.val.size; diff --git a/mps/code/arg.c b/mps/code/arg.c index 442066824ad..e3fea68754d 100644 --- a/mps/code/arg.c +++ b/mps/code/arg.c @@ -1,7 +1,7 @@ /* arg.c: ARGUMENT LISTS * * $Id$ - * Copyright (c) 2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2013-2014 Ravenbrook Limited. See end of file for license. * * .source: See . */ @@ -52,7 +52,7 @@ Bool ArgCheckAddr(Arg arg) { } Bool ArgCheckPoolDebugOptions(Arg arg) { - CHECKL(PoolDebugOptionsCheck((PoolDebugOptions)arg->val.pool_debug_options)); + CHECKD_NOSIG(PoolDebugOptions, (PoolDebugOptions)arg->val.pool_debug_options); return TRUE; } @@ -138,7 +138,7 @@ Bool ArgListCheck(ArgList args) CHECKL(args != NULL); for (i = 0; args[i].key != MPS_KEY_ARGS_END; ++i) { CHECKL(i < MPS_ARGS_MAX); - CHECKL(ArgCheck(&args[i])); + CHECKD_NOSIG(Arg, &args[i]); } return TRUE; } @@ -150,7 +150,7 @@ Bool ArgPick(ArgStruct *argOut, ArgList args, Key key) { Index i; AVER(argOut != NULL); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); AVERT(Key, key); for (i = 0; args[i].key != MPS_KEY_ARGS_END; ++i) @@ -185,14 +185,14 @@ void ArgTrivVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) { UNUSED(varargs); args[0].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } /* 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/boot.c b/mps/code/boot.c index f42d5ded7cc..eff8409fc1e 100644 --- a/mps/code/boot.c +++ b/mps/code/boot.c @@ -1,7 +1,7 @@ /* boot.c: BOOTSTRAP ALLOCATOR * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .overview: A structure and protocols for allocating memory from a * given block. Very simple, it basically just increments a pointer. @@ -101,7 +101,7 @@ Res BootAlloc(void **pReturn, BootBlock boot, size_t size, size_t align) AVER(pReturn != NULL); AVERT(BootBlock, boot); AVER(size > 0); - AVER(AlignCheck((Align)align)); + AVERT(Align, (Align)align); /* Align alloc pointer up and bounds check. */ blockBase = PointerAlignUp(boot->alloc, align); @@ -127,7 +127,7 @@ Res BootAlloc(void **pReturn, BootBlock boot, size_t size, size_t align) /* 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/bt.c b/mps/code/bt.c index a58e501ee52..8535d09e995 100644 --- a/mps/code/bt.c +++ b/mps/code/bt.c @@ -1,7 +1,7 @@ /* bt.c: BIT TABLES * * $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. * * READERSHIP * @@ -215,7 +215,7 @@ void BTDestroy(BT bt, Arena arena, Count length) * discussed in review.impl.c.bt.4. */ -static Bool BTCheck(BT bt) +Bool BTCheck(BT bt) { AVER(bt != NULL); AVER(AddrIsAligned((Addr)bt, sizeof(Word))); @@ -244,7 +244,7 @@ Size (BTSize)(Count n) Bool (BTGet)(BT t, Index i) { - AVER(BTCheck(t)); + AVERT(BT, t); /* Can't check i */ /* see macro in */ @@ -259,7 +259,7 @@ Bool (BTGet)(BT t, Index i) void (BTSet)(BT t, Index i) { - AVER(BTCheck(t)); + AVERT(BT, t); /* Can't check i */ /* see macro in */ @@ -274,7 +274,7 @@ void (BTSet)(BT t, Index i) void (BTRes)(BT t, Index i) { - AVER(BTCheck(t)); + AVERT(BT, t); /* Can't check i */ /* see macro in */ @@ -289,7 +289,7 @@ void (BTRes)(BT t, Index i) void BTSetRange(BT t, Index base, Index limit) { - AVER(BTCheck(t)); + AVERT(BT, t); AVER(base < limit); #define SINGLE_SET_RANGE(i) \ @@ -311,7 +311,7 @@ void BTSetRange(BT t, Index base, Index limit) Bool BTIsResRange(BT bt, Index base, Index limit) { - AVER(BTCheck(bt)); + AVERT(BT, bt); AVER(base < limit); /* Can't check range of base or limit */ @@ -335,7 +335,7 @@ Bool BTIsResRange(BT bt, Index base, Index limit) Bool BTIsSetRange(BT bt, Index base, Index limit) { - AVER(BTCheck(bt)); + AVERT(BT, bt); AVER(base < limit); /* Can't check range of base or limit */ @@ -363,7 +363,7 @@ Bool BTIsSetRange(BT bt, Index base, Index limit) void BTResRange(BT t, Index base, Index limit) { - AVER(BTCheck(t)); + AVERT(BT, t); AVER(base < limit); #define SINGLE_RES_RANGE(i) \ @@ -876,8 +876,8 @@ Bool BTFindShortResRangeHigh(Index *baseReturn, Index *limitReturn, Bool BTRangesSame(BT comparand, BT comparator, Index base, Index limit) { - AVER(BTCheck(comparand)); - AVER(BTCheck(comparator)); + AVERT(BT, comparand); + AVERT(BT, comparator); AVER(base < limit); #define SINGLE_RANGES_SAME(i) \ @@ -912,8 +912,8 @@ Bool BTRangesSame(BT comparand, BT comparator, Index base, Index limit) void BTCopyInvertRange(BT fromBT, BT toBT, Index base, Index limit) { - AVER(BTCheck(fromBT)); - AVER(BTCheck(toBT)); + AVERT(BT, fromBT); + AVERT(BT, toBT); AVER(fromBT != toBT); AVER(base < limit); @@ -947,8 +947,8 @@ void BTCopyInvertRange(BT fromBT, BT toBT, Index base, Index limit) void BTCopyRange(BT fromBT, BT toBT, Index base, Index limit) { - AVER(BTCheck(fromBT)); - AVER(BTCheck(toBT)); + AVERT(BT, fromBT); + AVERT(BT, toBT); AVER(fromBT != toBT); AVER(base < limit); @@ -991,8 +991,8 @@ void BTCopyOffsetRange(BT fromBT, BT toBT, { Index fromBit, toBit; - AVER(BTCheck(fromBT)); - AVER(BTCheck(toBT)); + AVERT(BT, fromBT); + AVERT(BT, toBT); AVER(fromBT != toBT); AVER(fromBase < fromLimit); AVER(toBase < toLimit); @@ -1016,7 +1016,7 @@ Count BTCountResRange(BT bt, Index base, Index limit) Count c = 0; Index bit; - AVER(BTCheck(bt)); + AVERT(BT, bt); AVER(base < limit); for (bit = base; bit < limit; ++bit) @@ -1027,7 +1027,7 @@ Count BTCountResRange(BT bt, Index base, Index limit) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2013 Ravenbrook Limited . + * Copyright (C) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/bt.h b/mps/code/bt.h index 29000b957b8..4876f66715a 100644 --- a/mps/code/bt.h +++ b/mps/code/bt.h @@ -1,7 +1,7 @@ /* bt.h: Bit Table Interface * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .source: */ @@ -39,6 +39,7 @@ extern void (BTRes)(BT bt, Index index); END +extern Bool BTCheck(BT bt); extern Res BTCreate(BT *btReturn, Arena arena, Count length); extern void BTDestroy(BT bt, Arena arena, Count length); @@ -76,7 +77,7 @@ extern Count BTCountResRange(BT bt, Index base, Index limit); /* 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/buffer.c b/mps/code/buffer.c index 1e8b0b7b614..baa553a19a2 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -45,7 +45,7 @@ Bool BufferCheck(Buffer buffer) CHECKU(Arena, buffer->arena); CHECKU(Pool, buffer->pool); CHECKL(buffer->arena == buffer->pool->arena); - CHECKL(RingCheck(&buffer->poolRing)); /* */ + CHECKD_NOSIG(Ring, &buffer->poolRing); CHECKL(BoolCheck(buffer->isMutator)); CHECKL(buffer->fillSize >= 0.0); CHECKL(buffer->emptySize >= 0.0); @@ -605,7 +605,7 @@ Res BufferReserve(Addr *pReturn, Buffer buffer, Size size, AVER(size > 0); AVER(SizeIsAligned(size, BufferPool(buffer)->alignment)); AVER(BufferIsReady(buffer)); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* Is there enough room in the unallocated portion of the buffer to */ /* satisfy the request? If so, just increase the alloc marker and */ @@ -1182,7 +1182,7 @@ static Res bufferTrivDescribe(Buffer buffer, mps_lib_FILE *stream) Bool BufferClassCheck(BufferClass class) { - CHECKL(ProtocolClassCheck(&class->protocol)); + CHECKD(ProtocolClass, &class->protocol); CHECKL(class->name != NULL); /* Should be <=6 char C identifier */ CHECKL(class->size >= sizeof(BufferStruct)); CHECKL(FUNCHECK(class->varargs)); @@ -1241,7 +1241,7 @@ Bool SegBufCheck(SegBuf segbuf) CHECKS(SegBuf, segbuf); buffer = &segbuf->bufferStruct; - CHECKL(BufferCheck(buffer)); + CHECKD(Buffer, buffer); CHECKL(RankSetCheck(segbuf->rankSet)); if (buffer->mode & BufferModeTRANSITION) { @@ -1251,7 +1251,7 @@ Bool SegBufCheck(SegBuf segbuf) } else { /* The buffer is attached to a segment. */ CHECKL(segbuf->seg != NULL); - CHECKL(SegCheck(segbuf->seg)); + CHECKD(Seg, segbuf->seg); /* To avoid recursive checking, leave it to SegCheck to make */ /* sure the buffer and segment fields tally. */ @@ -1487,7 +1487,7 @@ static void rankBufVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[0].key = MPS_KEY_RANK; args[0].val.rank = va_arg(varargs, Rank); args[1].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } /* rankBufInit -- RankBufClass init method */ @@ -1501,10 +1501,10 @@ static Res rankBufInit(Buffer buffer, Pool pool, ArgList args) AVERT(Buffer, buffer); AVERT(Pool, pool); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); if (ArgPick(&arg, args, MPS_KEY_RANK)) rank = arg.val.rank; - AVER(RankCheck(rank)); + AVERT(Rank, rank); /* Initialize the superclass fields first via next-method call */ super = BUFFER_SUPERCLASS(RankBufClass); diff --git a/mps/code/cbs.c b/mps/code/cbs.c index c57c322d267..456271a9e9b 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -1,7 +1,7 @@ /* cbs.c: COALESCING BLOCK STRUCTURE IMPLEMENTATION * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .intro: This is a portable implementation of coalescing block * structures. @@ -85,7 +85,7 @@ static Bool CBSBlockCheck(CBSBlock block) /* See .enter-leave.simple. */ UNUSED(block); /* Required because there is no signature */ CHECKL(block != NULL); - CHECKL(TreeCheck(cbsBlockTree(block))); + CHECKD_NOSIG(Tree, cbsBlockTree(block)); /* If the block is in the middle of being deleted, */ /* the pointers will be equal. */ @@ -245,9 +245,9 @@ Res CBSInit(CBS cbs, Arena arena, void *owner, Align alignment, AVERT(Arena, arena); AVER(cbs != NULL); - AVER(AlignCheck(alignment)); - AVER(BoolCheck(fastFind)); - AVER(BoolCheck(zoned)); + AVERT(Align, alignment); + AVERT(Bool, fastFind); + AVERT(Bool, zoned); if (ArgPick(&arg, args, CBSBlockPool)) blockPool = arg.val.pool; @@ -915,8 +915,8 @@ Res CBSFindInZones(Range rangeReturn, Range oldRangeReturn, AVER(rangeReturn != NULL); AVER(oldRangeReturn != NULL); AVERT(CBS, cbs); - /* AVER(ZoneSetCheck(zoneSet)); */ - AVER(BoolCheck(high)); + /* AVERT(ZoneSet, zoneSet); */ + AVERT(Bool, high); cbsFind = high ? CBSFindLast : CBSFindFirst; splayFind = high ? SplayFindLast : SplayFindFirst; @@ -1086,7 +1086,7 @@ Res CBSDescribe(CBS cbs, mps_lib_FILE *stream) /* 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/dbgpool.c b/mps/code/dbgpool.c index 5edeae45035..77c1d6eaf40 100644 --- a/mps/code/dbgpool.c +++ b/mps/code/dbgpool.c @@ -34,8 +34,6 @@ typedef tagStruct *Tag; /* tag init methods: copying the user-supplied data into the tag */ -#define TagInitMethodCheck(f) FUNCHECK(f) - static void TagTrivInit(void* tag, va_list args) { UNUSED(tag); UNUSED(args); @@ -75,7 +73,7 @@ Bool PoolDebugMixinCheck(PoolDebugMixin debug) /* Nothing to check about freeTemplate */ /* Nothing to check about freeSize */ if (debug->tagInit != NULL) { - CHECKL(TagInitMethodCheck(debug->tagInit)); + CHECKL(FUNCHECK(debug->tagInit)); /* Nothing to check about tagSize */ CHECKD(Pool, debug->tagPool); CHECKL(COMPATTYPE(Addr, void*)); /* tagPool relies on this */ diff --git a/mps/code/format.c b/mps/code/format.c index fb72680535b..88a86283ef8 100644 --- a/mps/code/format.c +++ b/mps/code/format.c @@ -1,7 +1,7 @@ /* format.c: OBJECT FORMATS * * $Id$ - * Copyright (c) 2001 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. * * DESIGN @@ -21,7 +21,7 @@ Bool FormatCheck(Format format) CHECKS(Format, format); CHECKU(Arena, format->arena); CHECKL(format->serial < format->arena->formatSerial); - CHECKL(RingCheck(&format->arenaRing)); + CHECKD_NOSIG(Ring, &format->arenaRing); CHECKL(AlignCheck(format->alignment)); /* TODO: Define the concept of the maximum alignment it is possible to request from the MPS, document and provide an interface to it, and then @@ -114,7 +114,7 @@ Res FormatCreate(Format *formatReturn, Arena arena, ArgList args) AVER(formatReturn != NULL); AVERT(Arena, arena); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); if (ArgPick(&arg, args, MPS_KEY_FMT_ALIGN)) fmtAlign = arg.val.align; @@ -217,7 +217,7 @@ Res FormatDescribe(Format format, mps_lib_FILE *stream) /* 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/global.c b/mps/code/global.c index 0bf481cb136..072b21253ac 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -119,7 +119,7 @@ Bool GlobalsCheck(Globals arenaGlobals) CHECKS(Globals, arenaGlobals); arena = GlobalsArena(arenaGlobals); CHECKL(arena->serial < arenaSerial); - CHECKL(RingCheck(&arenaGlobals->globalRing)); + CHECKD_NOSIG(Ring, &arenaGlobals->globalRing); CHECKL(MPSVersion() == arenaGlobals->mpsVersionString); @@ -138,16 +138,16 @@ Bool GlobalsCheck(Globals arenaGlobals) CHECKL(arenaGlobals->emptyInternalSize >= 0.0); CHECKL(BoolCheck(arenaGlobals->bufferLogging)); - CHECKL(RingCheck(&arenaGlobals->poolRing)); - CHECKL(RingCheck(&arenaGlobals->rootRing)); - CHECKL(RingCheck(&arenaGlobals->rememberedSummaryRing)); + CHECKD_NOSIG(Ring, &arenaGlobals->poolRing); + CHECKD_NOSIG(Ring, &arenaGlobals->rootRing); + CHECKD_NOSIG(Ring, &arenaGlobals->rememberedSummaryRing); CHECKL(arenaGlobals->rememberedSummaryIndex < RememberedSummaryBLOCK); /* RingIsSingle imples index == 0 */ CHECKL(!RingIsSingle(&arenaGlobals->rememberedSummaryRing) || arenaGlobals->rememberedSummaryIndex == 0); - CHECKL(RingCheck(&arena->formatRing)); - CHECKL(RingCheck(&arena->messageRing)); - /* Don't check enabledMessageTypes */ + CHECKD_NOSIG(Ring, &arena->formatRing); + CHECKD_NOSIG(Ring, &arena->messageRing); + CHECKD_NOSIG(BT, arena->enabledMessageTypes); CHECKL(BoolCheck(arena->isFinalPool)); if (arena->isFinalPool) { CHECKD(Pool, arena->finalPool); @@ -155,7 +155,7 @@ Bool GlobalsCheck(Globals arenaGlobals) CHECKL(arena->finalPool == NULL); } - CHECKL(RingCheck(&arena->threadRing)); + CHECKD_NOSIG(Ring, &arena->threadRing); CHECKL(BoolCheck(arena->insideShield)); CHECKL(arena->shCacheLimit <= ShieldCacheSIZE); @@ -189,8 +189,8 @@ Bool GlobalsCheck(Globals arenaGlobals) TRACE_SET_ITER_END(ti, trace, TraceSetUNIV, arena); for(rank = 0; rank < RankLIMIT; ++rank) - CHECKL(RingCheck(&arena->greyRing[rank])); - CHECKL(RingCheck(&arena->chainRing)); + CHECKD_NOSIG(Ring, &arena->greyRing[rank]); + CHECKD_NOSIG(Ring, &arena->chainRing); CHECKL(arena->tracedSize >= 0.0); CHECKL(arena->tracedTime >= 0.0); @@ -212,7 +212,7 @@ Bool GlobalsCheck(Globals arenaGlobals) /* we also check the statics now. */ CHECKL(BoolCheck(arenaRingInit)); - CHECKL(RingCheck(&arenaRing)); + CHECKD_NOSIG(Ring, &arenaRing); CHECKL(BoolCheck(arena->emergency)); @@ -632,7 +632,7 @@ Bool ArenaAccess(Addr addr, AccessSet mode, MutatorFaultContext context) arenaClaimRingLock(); /* */ mps_exception_info = context; - AVER(RingCheck(&arenaRing)); + AVERT(Ring, &arenaRing); RING_FOR(node, &arenaRing, nextNode) { Globals arenaGlobals = RING_ELT(Globals, globalRing, node); diff --git a/mps/code/locus.c b/mps/code/locus.c index 24f401c2c4f..a704c8b820b 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -89,7 +89,7 @@ static Bool GenDescCheck(GenDesc gen) CHECKL(gen->mortality <= 1.0); CHECKL(gen->proflow >= 0.0); CHECKL(gen->proflow <= 1.0); - CHECKL(RingCheck(&gen->locusRing)); + CHECKD_NOSIG(Ring, &gen->locusRing); return TRUE; } @@ -192,7 +192,7 @@ Bool ChainCheck(Chain chain) CHECKS(Chain, chain); CHECKU(Arena, chain->arena); - CHECKL(RingCheck(&chain->chainRing)); + CHECKD_NOSIG(Ring, &chain->chainRing); CHECKL(TraceSetCheck(chain->activeTraces)); CHECKL(chain->genCount > 0); for (i = 0; i < chain->genCount; ++i) { @@ -458,7 +458,7 @@ Bool PoolGenCheck(PoolGen gen) /* nothing to check about serial */ CHECKU(Pool, gen->pool); CHECKU(Chain, gen->chain); - CHECKL(RingCheck(&gen->genRing)); + CHECKD_NOSIG(Ring, &gen->genRing); CHECKL(gen->newSize <= gen->totalSize); return TRUE; } @@ -501,7 +501,7 @@ void LocusFinish(Arena arena) Bool LocusCheck(Arena arena) { /* Can't check arena, because this is part of ArenaCheck. */ - CHECKL(GenDescCheck(&arena->topGen)); + CHECKD(GenDesc, &arena->topGen); return TRUE; } diff --git a/mps/code/message.c b/mps/code/message.c index 75b01d328d8..eba94182837 100644 --- a/mps/code/message.c +++ b/mps/code/message.c @@ -1,7 +1,7 @@ /* message.c: MPS/CLIENT MESSAGES * * $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 * @@ -53,7 +53,7 @@ Bool MessageCheck(Message message) CHECKS(Message, message); CHECKU(Arena, message->arena); CHECKD(MessageClass, message->class); - CHECKL(RingCheck(&message->queueRing)); + CHECKD_NOSIG(Ring, &message->queueRing); /* postedClock is uncheckable for clocked message types, */ /* but must be 0 for unclocked message types: */ CHECKL(MessageIsClocked(message) || (message->postedClock == 0)); @@ -186,7 +186,7 @@ void MessageEmpty(Arena arena) static Bool MessageTypeEnabled(Arena arena, MessageType type) { AVERT(Arena, arena); - AVER(MessageTypeCheck(type)); + AVERT(MessageType, type); return BTGet(arena->enabledMessageTypes, type); } @@ -194,7 +194,7 @@ static Bool MessageTypeEnabled(Arena arena, MessageType type) void MessageTypeEnable(Arena arena, MessageType type) { AVERT(Arena, arena); - AVER(MessageTypeCheck(type)); + AVERT(MessageType, type); BTSet(arena->enabledMessageTypes, type); } @@ -204,7 +204,7 @@ void MessageTypeDisable(Arena arena, MessageType type) Message message; AVERT(Arena, arena); - AVER(MessageTypeCheck(type)); + AVERT(MessageType, type); /* Flush existing messages of this type */ while(MessageGet(&message, arena, type)) { @@ -252,7 +252,7 @@ Bool MessageGet(Message *messageReturn, Arena arena, MessageType type) AVER(messageReturn != NULL); AVERT(Arena, arena); - AVER(MessageTypeCheck(type)); + AVERT(MessageType, type); RING_FOR(node, &arena->messageRing, next) { Message message = RING_ELT(Message, queueRing, node); @@ -427,7 +427,7 @@ const char *MessageNoGCStartWhy(Message message) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2002, 2008 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/mpm.c b/mps/code/mpm.c index 5436327c7ef..f544acca401 100644 --- a/mps/code/mpm.c +++ b/mps/code/mpm.c @@ -1,7 +1,7 @@ /* mpm.c: GENERAL MPM SUPPORT * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .purpose: Miscellaneous support for the implementation of the MPM * and pool classes. @@ -132,7 +132,7 @@ Bool AlignCheck(Align align) Bool (WordIsAligned)(Word word, Align align) { - AVER(AlignCheck(align)); + AVERT(Align, align); return WordIsAligned(word, align); } @@ -141,7 +141,7 @@ Bool (WordIsAligned)(Word word, Align align) Word (WordAlignUp)(Word word, Align align) { - AVER(AlignCheck(align)); + AVERT(Align, align); return WordAlignUp(word, align); } @@ -167,7 +167,7 @@ Word (WordRoundUp)(Word word, Size modulus) Word (WordAlignDown)(Word word, Align alignment) { - AVER(AlignCheck(alignment)); + AVERT(Align, alignment); return WordAlignDown(word, alignment); } @@ -212,7 +212,7 @@ Shift SizeLog2(Size size) Addr (AddrAlignDown)(Addr addr, Align alignment) { - AVER(AlignCheck(alignment)); + AVERT(Align, alignment); return AddrAlignDown(addr, alignment); } @@ -604,7 +604,7 @@ Bool StringEqual(const char *s1, const char *s2) /* 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/mpsi.c b/mps/code/mpsi.c index 297fae64732..3df0913df83 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -454,7 +454,7 @@ mps_res_t mps_fmt_create_k(mps_fmt_t *mps_fmt_o, AVER(mps_fmt_o != NULL); AVERT(Arena, arena); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); res = FormatCreate(&format, arena, args); @@ -652,7 +652,7 @@ mps_res_t mps_pool_create_k(mps_pool_t *mps_pool_o, mps_arena_t arena, AVER(mps_pool_o != NULL); AVERT(Arena, arena); AVERT(PoolClass, class); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); res = PoolCreate(&pool, arena, class, args); diff --git a/mps/code/pool.c b/mps/code/pool.c index 75f5dc959d5..87b627400e2 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -37,7 +37,7 @@ SRCID(pool, "$Id$"); Bool PoolClassCheck(PoolClass class) { - CHECKL(ProtocolClassCheck(&class->protocol)); + CHECKD(ProtocolClass, &class->protocol); CHECKL(class->name != NULL); /* Should be <=6 char C identifier */ CHECKL(class->size >= sizeof(PoolStruct)); /* Offset of generic Pool within class-specific instance cannot be */ @@ -87,10 +87,10 @@ Bool PoolCheck(Pool pool) CHECKL(pool->serial < ArenaGlobals(pool->arena)->poolSerial); CHECKD(PoolClass, pool->class); CHECKU(Arena, pool->arena); - CHECKL(RingCheck(&pool->arenaRing)); - CHECKL(RingCheck(&pool->bufferRing)); + CHECKD_NOSIG(Ring, &pool->arenaRing); + CHECKD_NOSIG(Ring, &pool->bufferRing); /* Cannot check pool->bufferSerial */ - CHECKL(RingCheck(&pool->segRing)); + CHECKD_NOSIG(Ring, &pool->segRing); CHECKL(AlignCheck(pool->alignment)); /* normally pool->format iff PoolHasAttr(pool, AttrFMT), but during * pool initialization pool->format may not yet be set. */ @@ -286,7 +286,7 @@ Res PoolAlloc(Addr *pReturn, Pool pool, Size size, AVERT(Pool, pool); AVER(PoolHasAttr(pool, AttrALLOC)); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); res = (*pool->class->alloc)(pReturn, pool, size, withReservoirPermit); if (res != ResOK) diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index cb6f49debb9..aa2ee5adcbd 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c @@ -210,7 +210,7 @@ void PoolTrivFinish(Pool pool) Res PoolTrivInit(Pool pool, ArgList args) { AVERT(Pool, pool); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); UNUSED(args); return ResOK; } @@ -221,7 +221,7 @@ Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size, AVER(pReturn != NULL); AVERT(Pool, pool); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); NOTREACHED; return ResUNIMPL; } @@ -232,7 +232,7 @@ Res PoolTrivAlloc(Addr *pReturn, Pool pool, Size size, AVER(pReturn != NULL); AVERT(Pool, pool); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); return ResLIMIT; } @@ -262,7 +262,7 @@ Res PoolNoBufferFill(Addr *baseReturn, Addr *limitReturn, AVERT(Pool, pool); AVERT(Buffer, buffer); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); NOTREACHED; return ResUNIMPL; } @@ -279,7 +279,7 @@ Res PoolTrivBufferFill(Addr *baseReturn, Addr *limitReturn, AVERT(Pool, pool); AVERT(Buffer, buffer); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); res = PoolAlloc(&p, pool, size, withReservoirPermit); if(res != ResOK) return res; diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index fd74778c9c3..f3e56b3803e 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -525,7 +525,7 @@ static Bool amcGenCheck(amcGen gen) CHECKU(AMC, amc); CHECKL(gen->type == AMCPTypeGen); CHECKD(Buffer, gen->forward); - CHECKL(RingCheck(&gen->amcRing)); + CHECKD_NOSIG(Ring, &gen->amcRing); CHECKL((gen->pgen.totalSize == 0) == (gen->segs == 0)); arena = amc->poolStruct.arena; CHECKL(gen->pgen.totalSize >= gen->segs * ArenaAlign(arena)); @@ -586,7 +586,7 @@ typedef struct amcBufStruct { static Bool amcBufCheck(amcBuf amcbuf) { CHECKS(amcBuf, amcbuf); - CHECKL(SegBufCheck(&amcbuf->segbufStruct)); + CHECKD(SegBuf, &amcbuf->segbufStruct); if(amcbuf->gen != NULL) CHECKD(amcGen, amcbuf->gen); CHECKL(BoolCheck(amcbuf->forHashArrays)); @@ -963,7 +963,7 @@ static void AMCVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[1].key = MPS_KEY_CHAIN; args[1].val.chain = va_arg(varargs, Chain); args[2].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -2242,7 +2242,7 @@ static void AMCTraceEnd(Pool pool, Trace trace) amc = Pool2AMC(pool); AVERT(AMC, amc); ti = trace->ti; - AVER(TraceIdCheck(ti)); + AVERT(TraceId, ti); STATISTIC_STAT ({ Count pRetMin = 100; @@ -2604,7 +2604,7 @@ static Bool AMCCheck(AMC amc) CHECKD(Pool, &amc->poolStruct); CHECKL(IsSubclassPoly(amc->poolStruct.class, EnsureAMCPoolClass())); CHECKL(RankSetCheck(amc->rankSet)); - CHECKL(RingCheck(&amc->genRing)); + CHECKD_NOSIG(Ring, &amc->genRing); CHECKL(BoolCheck(amc->gensBooted)); if(amc->gensBooted) { CHECKD(amcGen, amc->nursery); diff --git a/mps/code/poolams.c b/mps/code/poolams.c index 96df165896a..c67a2efd684 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -48,7 +48,7 @@ Bool AMSSegCheck(AMSSeg amsseg) { Seg seg = AMSSeg2Seg(amsseg); CHECKS(AMSSeg, amsseg); - CHECKL(GCSegCheck(&amsseg->gcSegStruct)); + CHECKD(GCSeg, &amsseg->gcSegStruct); CHECKU(AMS, amsseg->ams); CHECKL(AMS2Pool(amsseg->ams) == SegPool(seg)); CHECKD_NOSIG(Ring, &amsseg->segRing); @@ -60,7 +60,7 @@ Bool AMSSegCheck(AMSSeg amsseg) CHECKL(BoolCheck(amsseg->allocTableInUse)); if (!amsseg->allocTableInUse) CHECKL(amsseg->firstFree <= amsseg->grains); - CHECKL(amsseg->allocTable != NULL); + CHECKD_NOSIG(BT, amsseg->allocTable); if (SegWhite(seg) != TraceSetEMPTY) { /* */ @@ -71,8 +71,8 @@ Bool AMSSegCheck(AMSSeg amsseg) CHECKL(BoolCheck(amsseg->marksChanged)); CHECKL(BoolCheck(amsseg->ambiguousFixes)); CHECKL(BoolCheck(amsseg->colourTablesInUse)); - CHECKL(amsseg->nongreyTable != NULL); - CHECKL(amsseg->nonwhiteTable != NULL); + CHECKD_NOSIG(BT, amsseg->nongreyTable); + CHECKD_NOSIG(BT, amsseg->nonwhiteTable); return TRUE; } @@ -218,7 +218,7 @@ static Res AMSSegInit(Seg seg, Pool pool, Addr base, Size size, AVERT(AMS, ams); arena = PoolArena(pool); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); /* Initialize the superclass fields first via next-method call */ super = SEG_SUPERCLASS(AMSSegClass); @@ -638,7 +638,7 @@ static Res AMSSegSizePolicy(Size *sizeReturn, AVER(sizeReturn != NULL); AVERT(Pool, pool); AVER(size > 0); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); arena = PoolArena(pool); @@ -667,7 +667,7 @@ static Res AMSSegCreate(Seg *segReturn, Pool pool, Size size, AVERT(Pool, pool); AVER(size > 0); AVERT(RankSet, rankSet); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); ams = Pool2AMS(pool); AVERT(AMS,ams); @@ -735,7 +735,7 @@ static void AMSVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[2].key = MPS_KEY_AMS_SUPPORT_AMBIGUOUS; args[2].val.b = va_arg(varargs, Bool); args[3].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } static void AMSDebugVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) @@ -764,7 +764,7 @@ static Res AMSInit(Pool pool, ArgList args) ArgStruct arg; AVERT(Pool, pool); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); if (ArgPick(&arg, args, MPS_KEY_CHAIN)) chain = arg.val.chain; @@ -933,7 +933,7 @@ static Res AMSBufferFill(Addr *baseReturn, Addr *limitReturn, AVERT(Buffer, buffer); AVER(size > 0); AVER(SizeIsAligned(size, PoolAlignment(pool))); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* Check that we're not in the grey mutator phase (see */ /* ). */ @@ -997,7 +997,7 @@ static void AMSBufferEmpty(Pool pool, Buffer buffer, Addr init, Addr limit) AVERT(Buffer,buffer); AVER(BufferIsReady(buffer)); seg = BufferSeg(buffer); - AVER(SegCheck(seg)); + AVERT(Seg, seg); AVER(init <= limit); AVER(AddrIsAligned(init, PoolAlignment(pool))); AVER(AddrIsAligned(limit, PoolAlignment(pool))); @@ -1075,7 +1075,7 @@ static Res AMSCondemn(Pool pool, Trace trace, Seg seg) AVERT(AMS, ams); AVERT(Trace, trace); - AVER(SegCheck(seg)); + AVERT(Seg, seg); amsseg = Seg2AMSSeg(seg); AVERT(AMSSeg, amsseg); @@ -1261,7 +1261,7 @@ static Res amsScanObject(Seg seg, Index i, Addr p, Addr next, void *clos) AVER(clos != NULL); closure = (amsScanClosure)clos; AVERT(ScanState, closure->ss); - AVER(BoolCheck(closure->scanAllObjects)); + AVERT(Bool, closure->scanAllObjects); format = AMS2Pool(amsseg->ams)->format; AVERT(Format, format); @@ -1307,7 +1307,7 @@ Res AMSScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg) ams = Pool2AMS(pool); AVERT(AMS, ams); arena = PoolArena(pool); - AVER(SegCheck(seg)); + AVERT(Seg, seg); amsseg = Seg2AMSSeg(seg); AVERT(AMSSeg, amsseg); @@ -1725,7 +1725,7 @@ DEFINE_POOL_CLASS(AMSDebugPoolClass, this) Bool AMSCheck(AMS ams) { CHECKS(AMS, ams); - CHECKL(PoolCheck(AMS2Pool(ams))); + CHECKD(Pool, AMS2Pool(ams)); CHECKL(IsSubclassPoly(AMS2Pool(ams)->class, AMSPoolClassGet())); CHECKL(PoolAlignment(AMS2Pool(ams)) == ((Size)1 << ams->grainShift)); CHECKL(PoolAlignment(AMS2Pool(ams)) == AMS2Pool(ams)->format->alignment); @@ -1733,7 +1733,7 @@ Bool AMSCheck(AMS ams) CHECKD(PoolGen, &ams->pgen); CHECKL(SizeIsAligned(ams->size, ArenaAlign(PoolArena(AMS2Pool(ams))))); CHECKL(FUNCHECK(ams->segSize)); - CHECKL(RingCheck(&ams->segRing)); + CHECKD_NOSIG(Ring, &ams->segRing); CHECKL(FUNCHECK(ams->allocRing)); CHECKL(FUNCHECK(ams->segsDestroy)); CHECKL(FUNCHECK(ams->segClass)); diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 1ca13d5346f..6332a91b7cd 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -187,7 +187,7 @@ static Res AWLSegInit(Seg seg, Pool pool, Addr base, Size size, AVERT(Pool, pool); arena = PoolArena(pool); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); ArgRequire(&arg, args, awlKeySegRankSet); rankSet = arg.val.u; AVERT(RankSet, rankSet); @@ -451,10 +451,10 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn, Arena arena; AVER(awlsegReturn != NULL); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); AVERT(Pool, pool); AVER(size > 0); - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); awl = Pool2AWL(pool); AVERT(AWL, awl); @@ -520,7 +520,7 @@ static void AWLVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[1].key = MPS_KEY_AWL_FIND_DEPENDENT; args[1].val.addr_method = va_arg(varargs, mps_awl_find_dependent_t); args[2].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -627,7 +627,7 @@ static Res AWLBufferFill(Addr *baseReturn, Addr *limitReturn, AVERT(Pool, pool); AVERT(Buffer, buffer); AVER(size > 0); - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); awl = Pool2AWL(pool); AVERT(AWL, awl); @@ -835,7 +835,7 @@ static void AWLBlacken(Pool pool, TraceSet traceSet, Seg seg) AWLSeg awlseg; AVERT(Pool, pool); - AVER(TraceSetCheck(traceSet)); + AVERT(TraceSet, traceSet); AVERT(Seg, seg); awl = Pool2AWL(pool); diff --git a/mps/code/poollo.c b/mps/code/poollo.c index 08aa146d656..d8f23584fba 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -82,7 +82,7 @@ DEFINE_SEG_CLASS(LOSegClass, class) static Bool LOSegCheck(LOSeg loseg) { CHECKS(LOSeg, loseg); - CHECKL(GCSegCheck(&loseg->gcSegStruct)); + CHECKD(GCSeg, &loseg->gcSegStruct); CHECKU(LO, loseg->lo); CHECKL(loseg->mark != NULL); CHECKL(loseg->alloc != NULL); @@ -113,7 +113,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size, AVERT(Pool, pool); arena = PoolArena(pool); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); lo = PoolPoolLO(pool); AVERT(LO, lo); @@ -287,7 +287,7 @@ static Res loSegCreate(LOSeg *loSegReturn, Pool pool, Size size, AVER(loSegReturn != NULL); AVERT(Pool, pool); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); lo = PoolPoolLO(pool); AVERT(LO, lo); @@ -461,7 +461,7 @@ static void LOVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[0].key = MPS_KEY_FORMAT; args[0].val.format = va_arg(varargs, Format); args[1].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -559,7 +559,7 @@ static Res LOBufferFill(Addr *baseReturn, Addr *limitReturn, AVER(BufferRankSet(buffer) == RankSetEMPTY); AVER(size > 0); AVER(SizeIsAligned(size, PoolAlignment(pool))); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* Try to find a segment with enough space already. */ RING_FOR(node, &pool->segRing, nextNode) { diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c index 6bf29c15873..fbb125a71f2 100644 --- a/mps/code/poolmfs.c +++ b/mps/code/poolmfs.c @@ -86,7 +86,7 @@ static void MFSVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[1].key = MPS_KEY_MFS_UNIT_SIZE; args[1].val.size = va_arg(varargs, Size); args[2].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } ARG_DEFINE_KEY(mfs_unit_size, Size); @@ -102,7 +102,7 @@ static Res MFSInit(Pool pool, ArgList args) ArgStruct arg; AVER(pool != NULL); - AVER(ArgListCheck(args)); + AVERT(ArgList, args); ArgRequire(&arg, args, MPS_KEY_MFS_UNIT_SIZE); unitSize = arg.val.size; @@ -116,7 +116,7 @@ static Res MFSInit(Pool pool, ArgList args) extendSelf = arg.val.b; AVER(extendBy >= unitSize); - AVER(BoolCheck(extendSelf)); + AVERT(Bool, extendSelf); mfs = PoolPoolMFS(pool); arena = PoolArena(pool); @@ -250,7 +250,7 @@ static Res MFSAlloc(Addr *pReturn, Pool pool, Size size, AVER(pReturn != NULL); AVER(size == mfs->unroundedUnitSize); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); f = mfs->freeList; @@ -378,7 +378,7 @@ Bool MFSCheck(MFS mfs) CHECKL(SizeAlignUp(mfs->unroundedUnitSize, mfs->poolStruct.alignment) == mfs->unitSize); if(mfs->tractList != NULL) { - CHECKL(TractCheck(mfs->tractList)); + CHECKD_NOSIG(Tract, mfs->tractList); } return TRUE; } diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index aebb22595ea..93d9f8bd25e 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -130,9 +130,9 @@ static Bool MRGCheck(MRG mrg) CHECKS(MRG, mrg); CHECKD(Pool, &mrg->poolStruct); CHECKL(MRG2Pool(mrg)->class == PoolClassMRG()); - CHECKL(RingCheck(&mrg->entryRing)); - CHECKL(RingCheck(&mrg->freeRing)); - CHECKL(RingCheck(&mrg->refRing)); + CHECKD_NOSIG(Ring, &mrg->entryRing); + CHECKD_NOSIG(Ring, &mrg->freeRing); + CHECKD_NOSIG(Ring, &mrg->refRing); CHECKL(mrg->extendBy == ArenaAlign(PoolArena(MRG2Pool(mrg)))); return TRUE; } @@ -183,7 +183,7 @@ static Bool MRGLinkSegCheck(MRGLinkSeg linkseg) Seg seg; CHECKS(MRGLinkSeg, linkseg); - CHECKL(SegCheck(&linkseg->segStruct)); + CHECKD(Seg, &linkseg->segStruct); seg = LinkSeg2Seg(linkseg); if (NULL != linkseg->refSeg) { /* see .link.nullref */ CHECKL(SegPool(seg) == SegPool(RefSeg2Seg(linkseg->refSeg))); @@ -198,10 +198,10 @@ static Bool MRGRefSegCheck(MRGRefSeg refseg) Seg seg; CHECKS(MRGRefSeg, refseg); - CHECKL(GCSegCheck(&refseg->gcSegStruct)); + CHECKD(GCSeg, &refseg->gcSegStruct); seg = RefSeg2Seg(refseg); CHECKL(SegPool(seg) == SegPool(LinkSeg2Seg(refseg->linkSeg))); - CHECKL(RingCheck(&refseg->mrgRing)); + CHECKD_NOSIG(Ring, &refseg->mrgRing); CHECKD(MRGLinkSeg, refseg->linkSeg); CHECKL(refseg->linkSeg->refSeg == refseg); return TRUE; @@ -224,7 +224,7 @@ static Res MRGLinkSegInit(Seg seg, Pool pool, Addr base, Size size, mrg = Pool2MRG(pool); AVERT(MRG, mrg); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); /* Initialize the superclass fields first via next-method call */ super = SEG_SUPERCLASS(MRGLinkSegClass); @@ -267,7 +267,7 @@ static Res MRGRefSegInit(Seg seg, Pool pool, Addr base, Size size, mrg = Pool2MRG(pool); AVERT(MRG, mrg); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); AVERT(MRGLinkSeg, linkseg); /* Initialize the superclass fields first via next-method call */ @@ -631,7 +631,7 @@ static Res MRGInit(Pool pool, ArgList args) MRG mrg; AVER(pool != NULL); /* Can't check more; see pool contract @@@@ */ - AVER(ArgListCheck(args)); + AVERT(ArgList, args); UNUSED(args); mrg = Pool2MRG(pool); diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 88d96cf950e..0ce4f28c95d 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -138,11 +138,11 @@ static Bool MVSpanCheck(MVSpan span) CHECKS(MVSpan, span); - CHECKL(RingCheck(&span->spans)); + CHECKD_NOSIG(Ring, &span->spans); CHECKU(MV, span->mv); CHECKD_NOSIG(Tract, span->tract); - CHECKL(MVBlockCheck(&span->base)); - CHECKL(MVBlockCheck(&span->limit)); + CHECKD_NOSIG(MVBlock, &span->base); + CHECKD_NOSIG(MVBlock, &span->limit); /* The block chain starts with the base sentinel. */ CHECKL(span->blocks == &span->base); /* Since there is a limit sentinel, the chain can't end just after the */ @@ -193,7 +193,7 @@ static void MVVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[2].key = MPS_KEY_MAX_SIZE; args[2].val.size = va_arg(varargs, Size); args[3].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } static void MVDebugVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) @@ -570,7 +570,7 @@ static Res MVAlloc(Addr *pReturn, Pool pool, Size size, span->mv = mv; /* Set the p field for each tract of the span */ TRACT_FOR(tract, addr, arena, base, limit) { - AVER(TractCheck(tract)); + AVERT(Tract, tract); AVER(TractP(tract) == NULL); AVER(TractPool(tract) == pool); TractSetP(tract, (void *)span); diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index c98dab21459..b2903481b45 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -200,7 +200,7 @@ static void MVTVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[4].key = MPS_KEY_MVT_FRAG_LIMIT; args[4].val.d = (double)va_arg(varargs, Count) / 100.0; args[5].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -364,9 +364,7 @@ static Bool MVTCheck(MVT mvt) CHECKD(Pool, &mvt->poolStruct); CHECKL(mvt->poolStruct.class == MVTPoolClassGet()); CHECKD(CBS, &mvt->cbsStruct); - /* CHECKL(CBSCheck(MVTCBS(mvt))); */ CHECKD(ABQ, &mvt->abqStruct); - /* CHECKL(ABQCheck(MVTABQ(mvt))); */ CHECKD(Freelist, &mvt->flStruct); CHECKL(mvt->reuseSize >= 2 * mvt->fillSize); CHECKL(mvt->fillSize >= mvt->maxSize); @@ -380,8 +378,7 @@ static Bool MVTCheck(MVT mvt) if (mvt->splinter) { CHECKL(AddrOffset(mvt->splinterBase, mvt->splinterLimit) >= mvt->minSize); - /* CHECKD(Seg, mvt->splinterSeg); */ - CHECKL(SegCheck(mvt->splinterSeg)); + CHECKD(Seg, mvt->splinterSeg); CHECKL(mvt->splinterBase >= SegBase(mvt->splinterSeg)); CHECKL(mvt->splinterLimit <= SegLimit(mvt->splinterSeg)); } @@ -688,7 +685,7 @@ static Res MVTBufferFill(Addr *baseReturn, Addr *limitReturn, AVER(BufferIsReset(buffer)); AVER(minSize > 0); AVER(SizeIsAligned(minSize, pool->alignment)); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* Allocate oversize blocks exactly, directly from the arena. */ diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index b218e687440..201d2047104 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c @@ -228,7 +228,7 @@ static Res MVFFAddSeg(Seg *segReturn, AVERT(MVFF, mvff); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); pool = MVFF2Pool(mvff); arena = PoolArena(pool); @@ -339,7 +339,7 @@ static Res MVFFAlloc(Addr *aReturn, Pool pool, Size size, AVER(aReturn != NULL); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); size = SizeAlignUp(size, PoolAlignment(pool)); @@ -510,7 +510,7 @@ static void MVFFVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[5].key = MPS_KEY_MVFF_FIRST_FIT; args[5].val.b = va_arg(varargs, Bool); args[6].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } static void MVFFDebugVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) @@ -571,9 +571,9 @@ static Res MVFFInit(Pool pool, ArgList args) AVER(avgSize > 0); /* .arg.check */ AVER(avgSize <= extendBy); /* .arg.check */ AVER(SizeIsAligned(align, MPS_PF_ALIGN)); - AVER(BoolCheck(slotHigh)); - AVER(BoolCheck(arenaHigh)); - AVER(BoolCheck(firstFit)); + AVERT(Bool, slotHigh); + AVERT(Bool, arenaHigh); + AVERT(Bool, firstFit); mvff = Pool2MVFF(pool); diff --git a/mps/code/pooln.c b/mps/code/pooln.c index 6840c1417f8..3a7e26df34c 100644 --- a/mps/code/pooln.c +++ b/mps/code/pooln.c @@ -71,7 +71,7 @@ static Res NAlloc(Addr *pReturn, Pool pool, Size size, AVER(pReturn != NULL); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); return ResLIMIT; /* limit of nil blocks exceeded */ } @@ -110,7 +110,7 @@ static Res NBufferFill(Addr *baseReturn, Addr *limitReturn, AVERT(Buffer, buffer); AVER(BufferIsReset(buffer)); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); NOTREACHED; /* can't create buffers, so shouldn't fill them */ return ResUNIMPL; diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c index 1ac5e408dce..e9afe98a96b 100644 --- a/mps/code/poolsnc.c +++ b/mps/code/poolsnc.c @@ -90,9 +90,9 @@ static Bool SNCBufCheck(SNCBuf sncbuf) CHECKS(SNCBuf, sncbuf); segbuf = &sncbuf->segBufStruct; - CHECKL(SegBufCheck(segbuf)); + CHECKD(SegBuf, segbuf); if (sncbuf->topseg != NULL) { - CHECKL(SegCheck(sncbuf->topseg)); + CHECKD(Seg, sncbuf->topseg); } return TRUE; } @@ -217,7 +217,7 @@ typedef struct SNCSegStruct { static Bool SNCSegCheck(SNCSeg sncseg) { CHECKS(SNCSeg, sncseg); - CHECKL(GCSegCheck(&sncseg->gcSegStruct)); + CHECKD(GCSeg, &sncseg->gcSegStruct); if (NULL != sncseg->next) { CHECKS(SNCSeg, sncseg->next); } @@ -238,7 +238,7 @@ static Res sncSegInit(Seg seg, Pool pool, Addr base, Size size, sncseg = SegSNCSeg(seg); AVERT(Pool, pool); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); /* Initialize the superclass fields first via next-method call */ super = SEG_SUPERCLASS(SNCSegClass); @@ -367,7 +367,7 @@ static void SNCVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[0].key = MPS_KEY_FORMAT; args[0].val.format = va_arg(varargs, Format); args[1].key = MPS_KEY_ARGS_END; - AVER(ArgListCheck(args)); + AVERT(ArgList, args); } @@ -433,7 +433,7 @@ static Res SNCBufferFill(Addr *baseReturn, Addr *limitReturn, AVERT(Pool, pool); AVERT(Buffer, buffer); AVER(size > 0); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); AVER(BufferIsReset(buffer)); snc = Pool2SNC(pool); @@ -702,7 +702,7 @@ static Bool SNCCheck(SNC snc) CHECKD(Pool, &snc->poolStruct); CHECKL(snc->poolStruct.class == SNCPoolClassGet()); if (snc->freeSegs != NULL) { - CHECKL(SegCheck(snc->freeSegs)); + CHECKD(Seg, snc->freeSegs); } return TRUE; } diff --git a/mps/code/protocol.c b/mps/code/protocol.c index af7ac26e8c3..bcc8ae56863 100644 --- a/mps/code/protocol.c +++ b/mps/code/protocol.c @@ -30,7 +30,7 @@ Bool ProtocolClassCheck(ProtocolClass class) Bool ProtocolInstCheck(ProtocolInst inst) { CHECKS(ProtocolInst, inst); - CHECKL(ProtocolClassCheck(inst->class)); + CHECKD(ProtocolClass, inst->class); return TRUE; } diff --git a/mps/code/pthrdext.c b/mps/code/pthrdext.c index 7185a0ff441..59d5899c326 100644 --- a/mps/code/pthrdext.c +++ b/mps/code/pthrdext.c @@ -1,7 +1,7 @@ /* pthreadext.c: POSIX THREAD EXTENSIONS * * $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. * * .purpose: Provides extension to Pthreads. * @@ -178,8 +178,8 @@ extern Bool PThreadextCheck(PThreadext pthreadext) CHECKS(PThreadext, pthreadext); /* can't check ID */ - CHECKL(RingCheck(&pthreadext->threadRing)); - CHECKL(RingCheck(&pthreadext->idRing)); + CHECKD_NOSIG(Ring, &pthreadext->threadRing); + CHECKD_NOSIG(Ring, &pthreadext->idRing); if (pthreadext->suspendedMFC == NULL) { /* not suspended */ CHECKL(RingIsSingle(&pthreadext->threadRing)); @@ -366,7 +366,7 @@ unlock: /* 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/reserv.c b/mps/code/reserv.c index eae0140f108..02b18d66d88 100644 --- a/mps/code/reserv.c +++ b/mps/code/reserv.c @@ -95,7 +95,7 @@ Bool ReservoirCheck(Reservoir reservoir) /* could call ReservoirIsConsistent, but it's costly. */ tract = reservoir->reserve; if (tract != NULL) { - CHECKL(TractCheck(tract)); + CHECKD_NOSIG(Tract, tract); CHECKL(TractPool(tract) == ReservoirPool(reservoir)); } CHECKL(SizeIsAligned(reservoir->reservoirLimit, ArenaAlign(arena))); @@ -282,7 +282,7 @@ Bool ReservoirDeposit(Reservoir reservoir, Addr *baseIO, Size *sizeIO) /* put as many pages as necessary into the reserve & free the rest */ TRACT_FOR(tract, addr, arena, base, limit) { - AVER(TractCheck(tract)); + AVERT(Tract, tract); if (reservoir->reservoirSize < reslimit) { /* Reassign the tract to the reservoir pool */ TractFinish(tract); diff --git a/mps/code/root.c b/mps/code/root.c index edb932f800a..4277550a7fb 100644 --- a/mps/code/root.c +++ b/mps/code/root.c @@ -1,7 +1,7 @@ /* root.c: ROOT IMPLEMENTATION * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .purpose: This is the implementation of the root datatype. * @@ -98,7 +98,7 @@ Bool RootCheck(Root root) CHECKS(Root, root); CHECKU(Arena, root->arena); CHECKL(root->serial < ArenaGlobals(root->arena)->rootSerial); - CHECKL(RingCheck(&root->arenaRing)); + CHECKD_NOSIG(Ring, &root->arenaRing); CHECKL(RankCheck(root->rank)); CHECKL(TraceSetCheck(root->grey)); /* Don't need to check var here, because of the switch below */ @@ -121,7 +121,7 @@ Bool RootCheck(Root root) case RootREG: CHECKL(root->the.reg.scan != NULL); - CHECKL(ThreadCheck(root->the.reg.thread)); + CHECKD_NOSIG(Thread, root->the.reg.thread); /* */ break; case RootFMT: @@ -261,7 +261,7 @@ Res RootCreateTable(Root *rootReturn, Arena arena, AVER(rootReturn != NULL); AVERT(Arena, arena); - AVER(RankCheck(rank)); + AVERT(Rank, rank); AVER(base != 0); AVER(base < limit); @@ -281,7 +281,7 @@ Res RootCreateTableMasked(Root *rootReturn, Arena arena, AVER(rootReturn != NULL); AVERT(Arena, arena); - AVER(RankCheck(rank)); + AVERT(Rank, rank); AVER(base != 0); AVER(base < limit); /* Can't check anything about mask. */ @@ -302,7 +302,7 @@ Res RootCreateReg(Root *rootReturn, Arena arena, AVER(rootReturn != NULL); AVERT(Arena, arena); - AVER(RankCheck(rank)); + AVERT(Rank, rank); AVERT(Thread, thread); AVER(scan != NULL); @@ -322,7 +322,7 @@ Res RootCreateFmt(Root *rootReturn, Arena arena, AVER(rootReturn != NULL); AVERT(Arena, arena); - AVER(RankCheck(rank)); + AVERT(Rank, rank); AVER(FUNCHECK(scan)); AVER(base != 0); AVER(base < limit); @@ -342,7 +342,7 @@ Res RootCreateFun(Root *rootReturn, Arena arena, Rank rank, AVER(rootReturn != NULL); AVERT(Arena, arena); - AVER(RankCheck(rank)); + AVERT(Rank, rank); AVER(FUNCHECK(scan)); theUnion.fun.scan = scan; @@ -671,7 +671,7 @@ Res RootsDescribe(Globals arenaGlobals, mps_lib_FILE *stream) /* 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/sa.c b/mps/code/sa.c index 59ddd4be178..e8bddfa5bbc 100644 --- a/mps/code/sa.c +++ b/mps/code/sa.c @@ -48,13 +48,11 @@ Bool SparseArrayCheck(SparseArray sa) CHECKS(SparseArray, sa); CHECKL(sa->base != NULL); CHECKL(sa->elementSize >= 1); - /* TODO: CHECKD(VM, sa->vm); once VMStruct becomes visible */ - CHECKL(VMCheck(sa->vm)); + CHECKD_NOSIG(VM, sa->vm); /* */ CHECKL(sa->elementSize <= VMAlign(sa->vm)); CHECKL(sa->length > 0); - /* TODO: Make BTCheck extern and use everywhere. */ - /* CHECKL(BTCheck(sa->mapped)); */ - /* CHECKL(BTCheck(sa->pages)); */ + CHECKD_NOSIG(BT, sa->mapped); + CHECKD_NOSIG(BT, sa->pages); CHECKL(sa->shift == SizeLog2(VMAlign(sa->vm))); return TRUE; } diff --git a/mps/code/sac.c b/mps/code/sac.c index 2a87f9a2810..435988cf867 100644 --- a/mps/code/sac.c +++ b/mps/code/sac.c @@ -1,7 +1,7 @@ /* sac.c: SEGREGATED ALLOCATION CACHES * * $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" @@ -249,7 +249,7 @@ Res SACFill(Addr *p_o, SAC sac, Size size, Bool hasReservoirPermit) AVER(p_o != NULL); AVERT(SAC, sac); AVER(size != 0); - AVER(BoolCheck(hasReservoirPermit)); + AVERT(Bool, hasReservoirPermit); esac = ExternalSACOfSAC(sac); sacFind(&i, &blockSize, sac, size); @@ -384,7 +384,7 @@ void SACFlush(SAC sac) /* 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/seg.c b/mps/code/seg.c index 98864fb450f..069b2c50049 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -68,7 +68,7 @@ Res SegAlloc(Seg *segReturn, SegClass class, SegPref pref, AVERT(SegPref, pref); AVER(size > (Size)0); AVERT(Pool, pool); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); arena = PoolArena(pool); AVERT(Arena, arena); @@ -152,7 +152,7 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size, AVER(SizeIsAligned(size, align)); class = seg->class; AVERT(SegClass, class); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); limit = AddrAdd(base, size); seg->limit = limit; @@ -168,7 +168,7 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size, seg->sig = SegSig; /* set sig now so tract checks will see it */ TRACT_FOR(tract, addr, arena, base, limit) { - AVER(TractCheck(tract)); /* */ + AVERT(Tract, tract); AVER(TractP(tract) == NULL); AVER(!TractHasSeg(tract)); AVER(TractPool(tract) == pool); @@ -196,7 +196,7 @@ static Res SegInit(Seg seg, Pool pool, Addr base, Size size, failInit: RingFinish(SegPoolRing(seg)); TRACT_FOR(tract, addr, arena, base, limit) { - AVER(TractCheck(tract)); /* */ + AVERT(Tract, tract); TRACT_UNSET_SEG(tract); } seg->sig = SigInvalid; @@ -233,7 +233,7 @@ static void SegFinish(Seg seg) limit = SegLimit(seg); TRACT_TRACT_FOR(tract, addr, arena, seg->firstTract, limit) { - AVER(TractCheck(tract)); /* */ + AVERT(Tract, tract); TractSetWhite(tract, TraceSetEMPTY); TRACT_UNSET_SEG(tract); } @@ -263,7 +263,7 @@ static void SegFinish(Seg seg) void SegSetGrey(Seg seg, TraceSet grey) { AVERT(Seg, seg); - AVER(TraceSetCheck(grey)); + AVERT(TraceSet, grey); AVER(grey == TraceSetEMPTY || SegRankSet(seg) != RankSetEMPTY); /* Don't dispatch to the class method if there's no actual change in @@ -281,7 +281,7 @@ void SegSetGrey(Seg seg, TraceSet grey) void SegSetWhite(Seg seg, TraceSet white) { AVERT(Seg, seg); - AVER(TraceSetCheck(white)); + AVERT(TraceSet, white); seg->class->setWhite(seg, white); } @@ -296,7 +296,7 @@ void SegSetWhite(Seg seg, TraceSet white) void SegSetRankSet(Seg seg, RankSet rankSet) { AVERT(Seg, seg); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); AVER(rankSet != RankSetEMPTY || SegSummary(seg) == RefSetEMPTY); seg->class->setRankSet(seg, rankSet); } @@ -322,7 +322,7 @@ void SegSetSummary(Seg seg, RefSet summary) void SegSetRankAndSummary(Seg seg, RankSet rankSet, RefSet summary) { AVERT(Seg, seg); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); #ifdef PROTECTION_NONE if (rankSet != RankSetEMPTY) { @@ -582,7 +582,7 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi, mid = SegLimit(segLo); limit = SegLimit(segHi); AVER(SegBase(segHi) == SegLimit(segLo)); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); arena = PoolArena(SegPool(segLo)); ShieldFlush(arena); /* see */ @@ -634,7 +634,7 @@ Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at, AVER(AddrIsAligned(at, arena->alignment)); AVER(at > base); AVER(at < limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); ShieldFlush(arena); /* see */ @@ -690,7 +690,7 @@ Bool SegCheck(Seg seg) /* can't assume nailed is subset of white - mightn't be during whiten */ /* CHECKL(TraceSetSub(seg->nailed, seg->white)); */ CHECKL(TraceSetCheck(seg->grey)); - CHECKL(TractCheck(seg->firstTract)); /* */ + CHECKD_NOSIG(Tract, seg->firstTract); pool = SegPool(seg); CHECKU(Pool, pool); arena = PoolArena(pool); @@ -704,7 +704,7 @@ Bool SegCheck(Seg seg) TRACT_TRACT_FOR(tract, addr, arena, seg->firstTract, seg->limit) { Seg trseg = NULL; /* suppress compiler warning */ - CHECKL(TractCheck(tract)); /* */ + CHECKD_NOSIG(Tract, tract); CHECKL(TRACT_SEG(&trseg, tract) && (trseg == seg)); CHECKL(TractWhite(tract) == seg->white); CHECKL(TractPool(tract) == pool); @@ -716,7 +716,7 @@ Bool SegCheck(Seg seg) /* the segment is initialized.) */ /* CHECKL(RingNext(&seg->poolRing) != &seg->poolRing); */ - CHECKL(RingCheck(&seg->poolRing)); + CHECKD_NOSIG(Ring, &seg->poolRing); /* "pm", "sm", and "depth" not checked. See .check.shield. */ CHECKL(RankSetCheck(seg->rankSet)); @@ -762,8 +762,8 @@ static Res segTrivInit(Seg seg, Pool pool, Addr base, Size size, AVER(SegBase(seg) == base); AVER(SegSize(seg) == size); AVER(SegPool(seg) == pool); - AVER(BoolCheck(reservoirPermit)); - AVER(ArgListCheck(args)); + AVERT(Bool, reservoirPermit); + AVERT(ArgList, args); UNUSED(args); return ResOK; } @@ -783,7 +783,7 @@ static void segTrivFinish(Seg seg) static void segNoSetGrey(Seg seg, TraceSet grey) { AVERT(Seg, seg); - AVER(TraceSetCheck(grey)); + AVERT(TraceSet, grey); AVER(seg->rankSet != RankSetEMPTY); NOTREACHED; } @@ -794,7 +794,7 @@ static void segNoSetGrey(Seg seg, TraceSet grey) static void segNoSetWhite(Seg seg, TraceSet white) { AVERT(Seg, seg); - AVER(TraceSetCheck(white)); + AVERT(TraceSet, white); NOTREACHED; } @@ -804,7 +804,7 @@ static void segNoSetWhite(Seg seg, TraceSet white) static void segNoSetRankSet(Seg seg, RankSet rankSet) { AVERT(Seg, seg); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); NOTREACHED; } @@ -824,7 +824,7 @@ static void segNoSetSummary(Seg seg, RefSet summary) static void segNoSetRankSummary(Seg seg, RankSet rankSet, RefSet summary) { AVERT(Seg, seg); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); UNUSED(summary); NOTREACHED; } @@ -864,7 +864,7 @@ static Res segNoMerge(Seg seg, Seg segHi, AVER(SegLimit(seg) == mid); AVER(SegBase(segHi) == mid); AVER(SegLimit(segHi) == limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); NOTREACHED; return ResFAIL; } @@ -900,7 +900,7 @@ static Res segTrivMerge(Seg seg, Seg segHi, AVER(SegLimit(seg) == mid); AVER(SegBase(segHi) == mid); AVER(SegLimit(segHi) == limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* .similar. */ AVER(seg->rankSet == segHi->rankSet); @@ -918,7 +918,7 @@ static Res segTrivMerge(Seg seg, Seg segHi, seg->limit = limit; TRACT_FOR(tract, addr, arena, mid, limit) { - AVER(TractCheck(tract)); /* */ + AVERT(Tract, tract); AVER(TractHasSeg(tract)); AVER(segHi == TractP(tract)); AVER(TractPool(tract) == pool); @@ -948,7 +948,7 @@ static Res segNoSplit(Seg seg, Seg segHi, AVER(mid < limit); AVER(SegBase(seg) == base); AVER(SegLimit(seg) == limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); NOTREACHED; return ResFAIL; @@ -979,7 +979,7 @@ static Res segTrivSplit(Seg seg, Seg segHi, AVER(mid < limit); AVER(SegBase(seg) == base); AVER(SegLimit(seg) == limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* Segment may not be exposed, or in the shield cache */ /* See & */ @@ -1001,7 +1001,7 @@ static Res segTrivSplit(Seg seg, Seg segHi, RingInit(SegPoolRing(segHi)); TRACT_FOR(tract, addr, arena, mid, limit) { - AVER(TractCheck(tract)); /* */ + AVERT(Tract, tract); AVER(TractHasSeg(tract)); AVER(seg == TractP(tract)); AVER(TractPool(tract) == pool); @@ -1092,7 +1092,7 @@ Bool GCSegCheck(GCSeg gcseg) Seg seg; CHECKS(GCSeg, gcseg); seg = &gcseg->segStruct; - CHECKL(SegCheck(seg)); + CHECKD(Seg, seg); if (gcseg->buffer != NULL) { CHECKU(Buffer, gcseg->buffer); @@ -1102,7 +1102,7 @@ Bool GCSegCheck(GCSeg gcseg) } /* The segment should be on a grey ring if and only if it is grey. */ - CHECKL(RingCheck(&gcseg->greyRing)); + CHECKD_NOSIG(Ring, &gcseg->greyRing); CHECKL((seg->grey == TraceSetEMPTY) == RingIsSingle(&gcseg->greyRing)); @@ -1134,7 +1134,7 @@ static Res gcSegInit(Seg seg, Pool pool, Addr base, Size size, AVER(SizeIsAligned(size, align)); gcseg = SegGCSeg(seg); AVER(&gcseg->segStruct == seg); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); /* Initialize the superclass fields first via next-method call */ super = SEG_SUPERCLASS(GCSegClass); @@ -1311,7 +1311,7 @@ static void gcSegSetWhite(Seg seg, TraceSet white) TRACT_TRACT_FOR(tract, addr, arena, seg->firstTract, limit) { Seg trseg = NULL; /* suppress compiler warning */ - AVER_CRITICAL(TractCheck(tract)); /* */ + AVERT_CRITICAL(Tract, tract); AVER_CRITICAL(TRACT_SEG(&trseg, tract) && (trseg == seg)); TractSetWhite(tract, white); } @@ -1499,7 +1499,7 @@ static Res gcSegMerge(Seg seg, Seg segHi, AVER(SegLimit(seg) == mid); AVER(SegBase(segHi) == mid); AVER(SegLimit(segHi) == limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); buf = gcsegHi->buffer; /* any buffer on segHi must be reassigned */ AVER(buf == NULL || gcseg->buffer == NULL); /* See .buffer */ @@ -1565,7 +1565,7 @@ static Res gcSegSplit(Seg seg, Seg segHi, AVER(mid < limit); AVER(SegBase(seg) == base); AVER(SegLimit(seg) == limit); - AVER(BoolCheck(withReservoirPermit)); + AVERT(Bool, withReservoirPermit); grey = SegGrey(seg); buf = gcseg->buffer; /* Look for buffer to reassign to segHi */ @@ -1648,7 +1648,7 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream) Bool SegClassCheck(SegClass class) { - CHECKL(ProtocolClassCheck(&class->protocol)); + CHECKD(ProtocolClass, &class->protocol); CHECKL(class->name != NULL); /* Should be <= 6 char C identifier */ CHECKL(class->size >= sizeof(SegStruct)); CHECKL(FUNCHECK(class->init)); diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index d5ef0ca2491..21a8b8846ed 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -67,7 +67,7 @@ typedef struct AMSTStruct *AMST; static Bool AMSTCheck(AMST amst) { CHECKS(AMST, amst); - CHECKL(AMSCheck(AMST2AMS(amst))); + CHECKD_NOSIG(AMS, AMST2AMS(amst)); /* */ return TRUE; } @@ -104,7 +104,7 @@ typedef struct AMSTSegStruct { static Bool AMSTSegCheck(AMSTSeg amstseg) { CHECKS(AMSTSeg, amstseg); - CHECKL(AMSSegCheck(&amstseg->amsSegStruct)); + CHECKD_NOSIG(AMSSeg, &amstseg->amsSegStruct); /* */ /* don't bother to do other checks - this is a stress test */ return TRUE; } @@ -129,7 +129,7 @@ static Res amstSegInit(Seg seg, Pool pool, Addr base, Size size, amst = Pool2AMST(pool); AVERT(AMST, amst); /* no useful checks for base and size */ - AVER(BoolCheck(reservoirPermit)); + AVERT(Bool, reservoirPermit); /* Initialize the superclass fields first via next-method call */ super = SEG_SUPERCLASS(AMSTSegClass); @@ -311,7 +311,7 @@ static Res AMSTSegSizePolicy(Size *sizeReturn, AVER(sizeReturn != NULL); AVERT(Pool, pool); AVER(size > 0); - AVER(RankSetCheck(rankSet)); + AVERT(RankSet, rankSet); arena = PoolArena(pool); diff --git a/mps/code/splay.c b/mps/code/splay.c index 53e21db9fa8..610822fc74a 100644 --- a/mps/code/splay.c +++ b/mps/code/splay.c @@ -48,7 +48,7 @@ Bool SplayTreeCheck(SplayTree splay) CHECKL(FUNCHECK(splay->compare)); CHECKL(FUNCHECK(splay->nodeKey)); CHECKL(FUNCHECK(splay->updateNode)); - CHECKL(TreeCheck(splay->root)); + CHECKD_NOSIG(Tree, splay->root); return TRUE; } diff --git a/mps/code/than.c b/mps/code/than.c index 752ef3ed64c..a1dab12adc8 100644 --- a/mps/code/than.c +++ b/mps/code/than.c @@ -1,7 +1,7 @@ /* than.c: ANSI THREADS MANAGER * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * This is a single-threaded implementation of the threads manager. * Has stubs for thread suspension. @@ -30,7 +30,7 @@ Bool ThreadCheck(Thread thread) CHECKS(Thread, thread); CHECKU(Arena, thread->arena); CHECKL(thread->serial < thread->arena->threadSerial); - CHECKL(RingCheck(&thread->arenaRing)); + CHECKD_NOSIG(Ring, &thread->arenaRing); return TRUE; } @@ -146,7 +146,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream) /* 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/thix.c b/mps/code/thix.c index 7760a5e1349..cc380dd040f 100644 --- a/mps/code/thix.c +++ b/mps/code/thix.c @@ -1,7 +1,7 @@ /* thix.c: Threads Manager for Posix threads * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .purpose: This is a pthreads implementation of the threads manager. * This implements . @@ -61,7 +61,7 @@ Bool ThreadCheck(Thread thread) CHECKS(Thread, thread); CHECKU(Arena, thread->arena); CHECKL(thread->serial < thread->arena->threadSerial); - CHECKL(RingCheck(&thread->arenaRing)); + CHECKD_NOSIG(Ring, &thread->arenaRing); CHECKD(PThreadext, &thread->thrextStruct); return TRUE; } @@ -292,7 +292,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream) /* 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/thw3.c b/mps/code/thw3.c index e1e5c97841b..701ffc53cdd 100644 --- a/mps/code/thw3.c +++ b/mps/code/thw3.c @@ -1,7 +1,7 @@ /* thw3i3.c: WIN32 THREAD MANAGER * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * Implements thread registration, suspension, and stack * scanning. See . @@ -60,7 +60,7 @@ Bool ThreadCheck(Thread thread) CHECKS(Thread, thread); CHECKU(Arena, thread->arena); CHECKL(thread->serial < thread->arena->threadSerial); - CHECKL(RingCheck(&thread->arenaRing)); + CHECKD_NOSIG(Ring, &thread->arenaRing); return TRUE; } @@ -233,7 +233,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream) /* 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/thxc.c b/mps/code/thxc.c index 745669cfc47..9e6a6bd325c 100644 --- a/mps/code/thxc.c +++ b/mps/code/thxc.c @@ -1,7 +1,7 @@ /* thxc.c: OS X MACH THREADS MANAGER * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .design: See . * @@ -45,7 +45,7 @@ Bool ThreadCheck(Thread thread) CHECKS(Thread, thread); CHECKU(Arena, thread->arena); CHECKL(thread->serial < thread->arena->threadSerial); - CHECKL(RingCheck(&thread->arenaRing)); + CHECKD_NOSIG(Ring, &thread->arenaRing); CHECKL(MACH_PORT_VALID(thread->port)); return TRUE; } @@ -267,7 +267,7 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream) /* 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/trace.c b/mps/code/trace.c index df258df17dc..924badcd541 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -64,9 +64,9 @@ void ScanStateInit(ScanState ss, TraceSet ts, Arena arena, TraceId ti; Trace trace; - AVER(TraceSetCheck(ts)); + AVERT(TraceSet, ts); AVERT(Arena, arena); - AVER(RankCheck(rank)); + AVERT(Rank, rank); /* white is arbitrary and can't be checked */ /* NOTE: We can only currently support scanning for a set of traces with @@ -504,9 +504,9 @@ static Res rootFlip(Root root, void *p) AVERT(Root, root); AVER(p != NULL); - AVER(TraceSetCheck(rf->ts)); + AVERT(TraceSet, rf->ts); AVERT(Arena, rf->arena); - AVER(RankCheck(rf->rank)); + AVERT(Rank, rf->rank); AVER(RootRank(root) <= RankEXACT); /* see .root.rank */ @@ -989,7 +989,7 @@ static Bool traceFindGrey(Seg *segReturn, Rank *rankReturn, Ring node, nextNode; AVER(segReturn != NULL); - AVER(TraceIdCheck(ti)); + AVERT(TraceId, ti); trace = ArenaTrace(arena, ti); @@ -1377,10 +1377,10 @@ void TraceScanSingleRef(TraceSet ts, Rank rank, Arena arena, { Res res; - AVER(TraceSetCheck(ts)); - AVER(RankCheck(rank)); + AVERT(TraceSet, ts); + AVERT(Rank, rank); AVERT(Arena, arena); - AVER(SegCheck(seg)); + AVERT(Seg, seg); AVER(refIO != NULL); res = traceScanSingleRefRes(ts, rank, arena, seg, refIO); diff --git a/mps/code/tract.c b/mps/code/tract.c index 69ae479cf1a..2468887bc17 100644 --- a/mps/code/tract.c +++ b/mps/code/tract.c @@ -1,7 +1,7 @@ /* tract.c: PAGE TABLES * * $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. * * .ullagepages: Pages whose page index is < allocBase are recorded as * free but never allocated as alloc starts searching after the tables. @@ -113,7 +113,7 @@ Bool ChunkCheck(Chunk chunk) CHECKS(Chunk, chunk); CHECKU(Arena, chunk->arena); CHECKL(chunk->serial < chunk->arena->chunkSerial); - CHECKL(RingCheck(&chunk->chunkRing)); + CHECKD_NOSIG(Ring, &chunk->chunkRing); CHECKL(ChunkPagesToSize(chunk, 1) == ChunkPageSize(chunk)); CHECKL(ShiftCheck(ChunkPageShift(chunk))); @@ -128,7 +128,7 @@ Bool ChunkCheck(Chunk chunk) CHECKL(chunk->allocBase <= chunk->pages); CHECKL(chunk->allocBase >= chunk->pageTablePages); - CHECKL(chunk->allocTable != NULL); + CHECKD_NOSIG(BT, chunk->allocTable); /* check that allocTable is in the chunk overhead */ CHECKL((Addr)chunk->allocTable >= chunk->base); CHECKL(AddrAdd((Addr)chunk->allocTable, BTSize(chunk->pages)) @@ -671,7 +671,7 @@ void PageFree(Chunk chunk, Index pi) /* 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/walk.c b/mps/code/walk.c index 0fcc37a151c..3f7f67f99e1 100644 --- a/mps/code/walk.c +++ b/mps/code/walk.c @@ -171,7 +171,7 @@ static Bool rootsStepClosureCheck(rootsStepClosure rsc) CHECKL(FUNCHECK(rsc->f)); /* p and s fields are arbitrary closures which cannot be checked */ if (rsc->root != NULL) { - CHECKL(RootCheck(rsc->root)); + CHECKD_NOSIG(Root, rsc->root); /* */ } return TRUE; } diff --git a/mps/design/check.txt b/mps/design/check.txt index c0d2a8a97b3..47d757d3945 100644 --- a/mps/design/check.txt +++ b/mps/design/check.txt @@ -95,17 +95,30 @@ type structure pointer, possibly invoking ``Check`` (depending on level; see `.level`_). It should be called with the child type and pointer. -_`.full-type`: ``CHECKS()``, ``CHECKD()``, ``CHECKU()``, all operate -only on fully fledged types. This means the type has to provide a -function ``Bool TypeCheck(Type type)`` where ``Type`` is substituted -for the name of the type (for example, ``PoolCheck()``), and the -expression ``obj->sig`` must be a valid value of type ``Sig`` whenever -``obj`` is a valid value of type ``Type``. +_`.full-type`: Use ``CHECKS()``, ``CHECKD()`` or ``CHECKU()`` on all +types that satisfy these three requirements: -_`.type.no-sig`: This tag is to be referenced in implementations -whenever the form ``CHECKL(ThingCheck(thing))`` is used instead of -``CHECK{U,D}(Thing, thing)`` because ``Thing`` is not a fully fledged -type (`.full-type`_). +_`.full-type.pointer`: The type is a pointer type. + +_`.full-type.check`: The type provides a function ``Bool TypeCheck(Type +type)`` where ``Type`` is substituted for the name of the type (for +example, ``PoolCheck()``). + +_`.full-type.sig`: The expression ``obj->sig`` is a valid value of +type ``Sig`` whenever ``obj`` is a valid value of type ``Type``. + +_`.partial-type`: Where the type satisfies `.full-type.pointer`_ and +`.full-type.check`_ but not `.full-type.sig`_ because the type lacks a +signature in order to save space (this applies to small structures +that are embedded many times in other structures, for example +``Ring``), use ``CHECKD_NOSIG()``. + +_`.hidden-type`: Where the type satisfies `.full-type.pointer`_ and +`.full-type.check`_ but not `.full-type.sig`_ because the structure +has a signature but the structure definition is not visible at point +of checking (for example ``Root``), use ``CHECKD_NOSIG()`` and +reference this tag. The structure could be considered for addition to +``mpmst.h``. Document History