mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
Catch-up merge from master sources to branch/2014-03-25/ansi.
Copied from Perforce Change: 185305 ServerID: perforce.ravenbrook.com
This commit is contained in:
commit
a76ab7ce6b
160 changed files with 3203 additions and 1937 deletions
|
|
@ -16,3 +16,5 @@ TAGS
|
|||
*.dSYM
|
||||
code/*/*/*.d
|
||||
*.pyc
|
||||
test/test/log
|
||||
test/test/obj
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ lii6ll
|
|||
w3i3mv
|
||||
w3i6mv
|
||||
xci3gc
|
||||
xci6ll
|
||||
# Visual Studio junk
|
||||
Debug
|
||||
Release
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ Bool ABQPush(ABQ abq, void *element)
|
|||
if (ABQIsFull(abq))
|
||||
return FALSE;
|
||||
|
||||
mps_lib_memcpy(ABQElement(abq, abq->in), element, abq->elementSize);
|
||||
(void)mps_lib_memcpy(ABQElement(abq, abq->in), element, abq->elementSize);
|
||||
abq->in = ABQNextIndex(abq, abq->in);
|
||||
|
||||
AVERT(ABQ, abq);
|
||||
|
|
@ -126,7 +126,7 @@ Bool ABQPop(ABQ abq, void *elementReturn)
|
|||
if (ABQIsEmpty(abq))
|
||||
return FALSE;
|
||||
|
||||
mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
|
||||
(void)mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
|
||||
|
||||
abq->out = ABQNextIndex(abq, abq->out);
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ Bool ABQPeek(ABQ abq, void *elementReturn)
|
|||
if (ABQIsEmpty(abq))
|
||||
return FALSE;
|
||||
|
||||
mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
|
||||
(void)mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
|
||||
|
||||
/* Identical to pop, but don't increment out */
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS
|
|||
AVERT(Bool, delete);
|
||||
if (!delete) {
|
||||
if (copy != index)
|
||||
mps_lib_memcpy(ABQElement(abq, copy), element, abq->elementSize);
|
||||
(void)mps_lib_memcpy(ABQElement(abq, copy), element, abq->elementSize);
|
||||
copy = ABQNextIndex(abq, copy);
|
||||
}
|
||||
index = ABQNextIndex(abq, index);
|
||||
|
|
@ -272,8 +272,8 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS
|
|||
/* If any elements were deleted, need to copy remainder of queue. */
|
||||
if (copy != index) {
|
||||
while (index != in) {
|
||||
mps_lib_memcpy(ABQElement(abq, copy), ABQElement(abq, index),
|
||||
abq->elementSize);
|
||||
(void)mps_lib_memcpy(ABQElement(abq, copy), ABQElement(abq, index),
|
||||
abq->elementSize);
|
||||
copy = ABQNextIndex(abq, copy);
|
||||
index = ABQNextIndex(abq, index);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ static void step(void)
|
|||
DestroyTestBlock(a);
|
||||
break;
|
||||
default:
|
||||
if (!deleted & (pushee > popee)) {
|
||||
if (!deleted && (pushee > popee)) {
|
||||
TestBlock b;
|
||||
TestClosureStruct cl;
|
||||
deleted = (unsigned)abqRnd (pushee - popee) + popee;
|
||||
|
|
|
|||
|
|
@ -3,26 +3,51 @@
|
|||
* $Id: //info.ravenbrook.com/project/mps/branch/2014-01-15/nailboard/code/fotest.c#1 $
|
||||
* Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* This test case creates a bunch of vectors, registers them for
|
||||
* finalization, and then discards the base pointers to those objects,
|
||||
* keeping only ambiguous interior references to the vector entries in
|
||||
* the stack-allocated table s.
|
||||
* .overview: This test case creates a bunch of vectors, registers
|
||||
* them for finalization, and then discards the base pointers to those
|
||||
* objects, keeping only ambiguous interior references to the vector
|
||||
* entries in the stack-allocated table s.
|
||||
*
|
||||
* If any of these objects are finalized, then this means that the
|
||||
* ambiguous interior references has failed to keep the object alive.
|
||||
* .options: The test has two options:
|
||||
*
|
||||
* 'interior' is the value passed as MPS_KEY_INTERIOR when creating
|
||||
* the AMC pool. If TRUE, interior pointers must keep objects alive,
|
||||
* and so if any of these objects are finalized, the test fails. If
|
||||
* FALSE, interior pointers do not keep objects alive, so it is likely
|
||||
* that all the objects will be finalized.
|
||||
*
|
||||
* 'stack' is TRUE if the C stack is registered as a root. (If FALSE,
|
||||
* we register the table of interior pointers as an ambiguous root.)
|
||||
*
|
||||
* .fail.lii6ll: The test case passes on most platforms with
|
||||
* interior=FALSE and stack=TRUE (that is, all vectors get finalized),
|
||||
* but fails on lii6ll in variety HOT. Rather than struggle to defeat
|
||||
* the Clang optimizer, we choose not to test in this configuration.
|
||||
* In any case, the MPS does not guarantee anything about timely
|
||||
* finalization (see <manual/html/topic/finalization.html#cautions>).
|
||||
*/
|
||||
|
||||
#include "mps.h"
|
||||
#include "fmtscheme.h"
|
||||
#include "mpsavm.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpslib.h"
|
||||
#include "testlib.h"
|
||||
#include "fmtscheme.h"
|
||||
|
||||
#define OBJ_LEN (1u << 4)
|
||||
#define OBJ_COUNT 10
|
||||
#define OBJ_COUNT 1
|
||||
|
||||
void test_main(void)
|
||||
static void test_air(int interior, int stack)
|
||||
{
|
||||
size_t n_finalized = 0;
|
||||
size_t i, j;
|
||||
obj_t *s[OBJ_COUNT];
|
||||
obj_t *s[OBJ_COUNT] = {0};
|
||||
mps_root_t root;
|
||||
if (!stack) {
|
||||
mps_addr_t *p = (void *)s;
|
||||
die(mps_root_create_table(&root, scheme_arena, mps_rank_ambig(), 0, p,
|
||||
OBJ_COUNT), "mps_root_create_table");
|
||||
}
|
||||
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);
|
||||
|
|
@ -41,12 +66,98 @@ void test_main(void)
|
|||
mps_arena_release(scheme_arena);
|
||||
if (mps_message_get(&msg, scheme_arena, mps_message_type_finalization())) {
|
||||
mps_addr_t ref;
|
||||
obj_t o;
|
||||
mps_message_finalization_ref(&ref, scheme_arena, msg);
|
||||
o = ref;
|
||||
error("wrongly finalized vector %ld at %p", o->vector.vector[0]->integer.integer, o);
|
||||
++ n_finalized;
|
||||
if (interior) {
|
||||
obj_t o;
|
||||
o = ref;
|
||||
error("wrongly finalized vector %ld at %p",
|
||||
o->vector.vector[0]->integer.integer, (void *)o);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!interior && n_finalized < OBJ_COUNT) {
|
||||
error("only finalized %"PRIuLONGEST" out of %"PRIuLONGEST" vectors.",
|
||||
(ulongest_t)n_finalized, (ulongest_t)OBJ_COUNT);
|
||||
}
|
||||
if (!stack) {
|
||||
mps_root_destroy(root);
|
||||
}
|
||||
}
|
||||
|
||||
static mps_gen_param_s obj_gen_params[] = {
|
||||
{ 150, 0.85 },
|
||||
{ 170, 0.45 }
|
||||
};
|
||||
|
||||
static void test_main(int interior, int stack)
|
||||
{
|
||||
mps_res_t res;
|
||||
mps_chain_t obj_chain;
|
||||
mps_fmt_t obj_fmt;
|
||||
mps_thr_t thread;
|
||||
mps_root_t reg_root;
|
||||
void *marker = ▮
|
||||
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 1 << 20);
|
||||
MPS_ARGS_DONE(args);
|
||||
res = mps_arena_create_k(&scheme_arena, mps_arena_class_vm(), args);
|
||||
} MPS_ARGS_END(args);
|
||||
if (res != MPS_RES_OK) error("Couldn't create arena");
|
||||
|
||||
res = mps_chain_create(&obj_chain, scheme_arena,
|
||||
sizeof(obj_gen_params) / sizeof(*obj_gen_params),
|
||||
obj_gen_params);
|
||||
if (res != MPS_RES_OK) error("Couldn't create obj chain");
|
||||
|
||||
scheme_fmt(&obj_fmt);
|
||||
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
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);
|
||||
|
||||
res = mps_ap_create_k(&obj_ap, obj_pool, mps_args_none);
|
||||
if (res != MPS_RES_OK) error("Couldn't create obj allocation point");
|
||||
|
||||
res = mps_thread_reg(&thread, scheme_arena);
|
||||
if (res != MPS_RES_OK) error("Couldn't register thread");
|
||||
|
||||
if (stack) {
|
||||
res = mps_root_create_reg(®_root, scheme_arena, mps_rank_ambig(), 0,
|
||||
thread, mps_stack_scan_ambig, marker, 0);
|
||||
if (res != MPS_RES_OK) error("Couldn't create root");
|
||||
}
|
||||
|
||||
test_air(interior, stack);
|
||||
|
||||
mps_arena_park(scheme_arena);
|
||||
if (stack)
|
||||
mps_root_destroy(reg_root);
|
||||
mps_thread_dereg(thread);
|
||||
mps_ap_destroy(obj_ap);
|
||||
mps_pool_destroy(obj_pool);
|
||||
mps_chain_destroy(obj_chain);
|
||||
mps_fmt_destroy(obj_fmt);
|
||||
mps_arena_destroy(scheme_arena);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
testlib_init(argc, argv);
|
||||
|
||||
test_main(TRUE, TRUE);
|
||||
test_main(TRUE, FALSE);
|
||||
/* not test_main(FALSE, TRUE) -- see .fail.lii6ll. */
|
||||
test_main(FALSE, FALSE);
|
||||
|
||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -90,4 +201,3 @@ void test_main(void)
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ static void test(mps_arena_t arena)
|
|||
collections = c;
|
||||
report(arena);
|
||||
|
||||
printf("%lu objects (mps_collections says: %lu)\n", objs, c);
|
||||
printf("%lu objects (mps_collections says: %"PRIuLONGEST")\n", objs,
|
||||
(ulongest_t)c);
|
||||
|
||||
/* test mps_arena_has_addr */
|
||||
{
|
||||
|
|
@ -285,7 +286,7 @@ static void test(mps_arena_t arena)
|
|||
if (objs % 1024 == 0) {
|
||||
report(arena);
|
||||
putchar('.');
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
}
|
||||
|
||||
++objs;
|
||||
|
|
|
|||
|
|
@ -173,7 +173,8 @@ static void *test(void *arg, size_t s)
|
|||
|
||||
if (collections != c) {
|
||||
collections = c;
|
||||
printf("\nCollection %lu, %lu objects.\n", c, objs);
|
||||
printf("\nCollection %"PRIuLONGEST", %lu objects.\n",
|
||||
(ulongest_t)c, objs);
|
||||
report(arena);
|
||||
for (r = 0; r < exactRootsCOUNT; ++r) {
|
||||
if (exactRoots[r] != objNULL)
|
||||
|
|
@ -236,7 +237,7 @@ static void *test(void *arg, size_t s)
|
|||
if (objs % 1024 == 0) {
|
||||
report(arena);
|
||||
putchar('.');
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
}
|
||||
|
||||
++objs;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ static void *test(void *arg, size_t haveAmbigous)
|
|||
lastStep = totalSize;
|
||||
printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
|
||||
(ulongest_t)totalSize, objs);
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
for(i = 0; i < exactRootsCOUNT; ++i)
|
||||
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
|
||||
"all roots check");
|
||||
|
|
@ -184,7 +184,7 @@ static void *test(void *arg, size_t haveAmbigous)
|
|||
if (objs % 256 == 0) {
|
||||
printf(".");
|
||||
report();
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static void *test(void *arg, size_t s)
|
|||
lastStep = totalSize;
|
||||
printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
|
||||
(ulongest_t)totalSize, objs);
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
for(i = 0; i < exactRootsCOUNT; ++i)
|
||||
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
|
||||
"all roots check");
|
||||
|
|
@ -139,7 +139,7 @@ static void *test(void *arg, size_t s)
|
|||
++objs;
|
||||
if (objs % 256 == 0) {
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ static mps_res_t make(mps_addr_t *p, mps_ap_t ap, size_t size)
|
|||
|
||||
/* stress -- create a pool of the requested type and allocate in it */
|
||||
|
||||
static mps_res_t stress(mps_class_t class, size_t (*size)(unsigned long i),
|
||||
static mps_res_t stress(mps_class_t class, size_t (*size)(size_t i),
|
||||
mps_arena_t arena, ...)
|
||||
{
|
||||
mps_res_t res = MPS_RES_OK;
|
||||
mps_pool_t pool;
|
||||
mps_ap_t ap;
|
||||
va_list arg;
|
||||
unsigned long i, k;
|
||||
size_t i, k;
|
||||
int *ps[testSetSIZE];
|
||||
size_t ss[testSetSIZE];
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(unsigned long i),
|
|||
for (k=0; k<testLOOPS; ++k) {
|
||||
/* shuffle all the objects */
|
||||
for (i=0; i<testSetSIZE; ++i) {
|
||||
unsigned long j = rnd()%(testSetSIZE-i);
|
||||
size_t j = rnd()%(testSetSIZE-i);
|
||||
void *tp;
|
||||
size_t ts;
|
||||
|
||||
|
|
@ -111,15 +111,10 @@ allocFail:
|
|||
}
|
||||
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
|
||||
|
||||
|
||||
/* randomSizeAligned -- produce sizes both large and small,
|
||||
* aligned by platform alignment */
|
||||
|
||||
static size_t randomSizeAligned(unsigned long i)
|
||||
static size_t randomSizeAligned(size_t i)
|
||||
{
|
||||
size_t maxSize = 2 * 160 * 0x2000;
|
||||
/* Reduce by a factor of 2 every 10 cycles. Total allocation about 40 MB. */
|
||||
|
|
@ -127,16 +122,9 @@ static size_t randomSizeAligned(unsigned long i)
|
|||
}
|
||||
|
||||
|
||||
static mps_pool_debug_option_s bothOptions8 = {
|
||||
/* .fence_template = */ (const void *)"postpost",
|
||||
/* .fence_size = */ 8,
|
||||
/* .free_template = */ (const void *)"DEAD",
|
||||
/* .free_size = */ 4
|
||||
};
|
||||
|
||||
static mps_pool_debug_option_s bothOptions16 = {
|
||||
static mps_pool_debug_option_s bothOptions = {
|
||||
/* .fence_template = */ (const void *)"postpostpostpost",
|
||||
/* .fence_size = */ 16,
|
||||
/* .fence_size = */ MPS_PF_ALIGN,
|
||||
/* .free_template = */ (const void *)"DEAD",
|
||||
/* .free_size = */ 4
|
||||
};
|
||||
|
|
@ -186,9 +174,6 @@ static void testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
mps_arena_t arena;
|
||||
mps_pool_debug_option_s *bothOptions;
|
||||
|
||||
bothOptions = MPS_PF_ALIGN == 8 ? &bothOptions8 : &bothOptions16;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
|
|
@ -201,11 +186,10 @@ int main(int argc, char *argv[])
|
|||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 2 * testArenaSIZE);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_ZONED, FALSE);
|
||||
MPS_ARGS_DONE(args);
|
||||
die(mps_arena_create_k(&arena, mps_arena_class_vm(), args),
|
||||
"mps_arena_create");
|
||||
} MPS_ARGS_END(args);
|
||||
testInArena(arena, bothOptions);
|
||||
testInArena(arena, &bothOptions);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
|
|
@ -215,7 +199,7 @@ int main(int argc, char *argv[])
|
|||
die(mps_arena_create_k(&arena, mps_arena_class_cl(), args),
|
||||
"mps_arena_create");
|
||||
} MPS_ARGS_END(args);
|
||||
testInArena(arena, bothOptions);
|
||||
testInArena(arena, &bothOptions);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* arena.c: ARENA ALLOCATION FEATURES
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* .sources: <design/arena/> is the main design document. */
|
||||
|
||||
|
|
@ -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)
|
||||
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;
|
||||
|
|
@ -224,7 +226,6 @@ Res ArenaInit(Arena arena, ArenaClass class, Align alignment, ArgList args)
|
|||
MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct));
|
||||
MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, arena->alignment);
|
||||
MPS_ARGS_ADD(piArgs, MFSExtendSelf, FALSE);
|
||||
MPS_ARGS_DONE(piArgs);
|
||||
res = PoolInit(ArenaCBSBlockPool(arena), arena, PoolClassMFS(), piArgs);
|
||||
} MPS_ARGS_END(piArgs);
|
||||
AVER(res == ResOK); /* no allocation, no failure expected */
|
||||
|
|
@ -234,7 +235,6 @@ Res ArenaInit(Arena arena, ArenaClass class, Align alignment, ArgList args)
|
|||
/* Initialise the freeCBS. */
|
||||
MPS_ARGS_BEGIN(cbsiArgs) {
|
||||
MPS_ARGS_ADD(cbsiArgs, CBSBlockPool, ArenaCBSBlockPool(arena));
|
||||
MPS_ARGS_DONE(cbsiArgs);
|
||||
res = CBSInit(ArenaFreeCBS(arena), arena, arena, alignment,
|
||||
/* fastFind */ TRUE, arena->zoned, cbsiArgs);
|
||||
} MPS_ARGS_END(cbsiArgs);
|
||||
|
|
@ -286,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
|
||||
|
|
@ -558,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,
|
||||
|
|
@ -1023,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);
|
||||
|
|
@ -1321,7 +1321,7 @@ Res ArenaAddrObject(Addr *pReturn, Arena arena, Addr addr)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* arenacl.c: ARENA CLASS USING CLIENT MEMORY
|
||||
*
|
||||
* $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 <design/arena/#client>.
|
||||
*
|
||||
|
|
@ -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;
|
||||
|
|
@ -434,6 +434,7 @@ DEFINE_ARENA_CLASS(ClientArenaClass, this)
|
|||
this->free = ClientFree;
|
||||
this->chunkInit = ClientChunkInit;
|
||||
this->chunkFinish = ClientChunkFinish;
|
||||
AVERT(ArenaClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -447,7 +448,7 @@ mps_arena_class_t mps_arena_class_cl(void)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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); /* <design/check/#hidden-type> */
|
||||
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;
|
||||
|
|
@ -530,7 +530,7 @@ static Res VMArenaInit(Arena *arenaReturn, ArenaClass class, ArgList args)
|
|||
|
||||
/* Copy the stack-allocated VM parameters into their home in the VMArena. */
|
||||
AVER(sizeof(vmArena->vmParams) == sizeof(vmParams));
|
||||
mps_lib_memcpy(vmArena->vmParams, vmParams, sizeof(vmArena->vmParams));
|
||||
(void)mps_lib_memcpy(vmArena->vmParams, vmParams, sizeof(vmArena->vmParams));
|
||||
|
||||
/* <design/arena/#coop-vm.struct.vmarena.extendby.init> */
|
||||
vmArena->extendBy = userSize;
|
||||
|
|
@ -1159,6 +1159,7 @@ DEFINE_ARENA_CLASS(VMArenaClass, this)
|
|||
this->compact = VMCompact;
|
||||
this->describe = VMArenaDescribe;
|
||||
this->pagesMarkAllocated = VMPagesMarkAllocated;
|
||||
AVERT(ArenaClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <design/keyword-arguments.rst>.
|
||||
*/
|
||||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static mps_word_t *alloc_string(const char *s, mps_ap_t ap)
|
|||
* .assume.dylan-obj
|
||||
*/
|
||||
|
||||
static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
|
||||
static mps_word_t *alloc_table(size_t n, mps_ap_t ap)
|
||||
{
|
||||
size_t objsize;
|
||||
void *p;
|
||||
|
|
@ -127,7 +127,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
|
|||
objsize = (3 + n) * sizeof(mps_word_t);
|
||||
objsize = size_tAlignUp(objsize, MPS_PF_ALIGN);
|
||||
do {
|
||||
unsigned long i;
|
||||
size_t i;
|
||||
|
||||
die(mps_reserve(&p, ap, objsize), "Reserve Table\n");
|
||||
object = p;
|
||||
|
|
@ -145,7 +145,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
|
|||
/* gets the nth slot from a table
|
||||
* .assume.dylan-obj
|
||||
*/
|
||||
static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
|
||||
static mps_word_t *table_slot(mps_word_t *table, size_t n)
|
||||
{
|
||||
return (mps_word_t *)table[3+n];
|
||||
}
|
||||
|
|
@ -154,8 +154,7 @@ static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
|
|||
/* sets the nth slot in a table
|
||||
* .assume.dylan-obj
|
||||
*/
|
||||
static void set_table_slot(mps_word_t *table,
|
||||
unsigned long n, mps_word_t *p)
|
||||
static void set_table_slot(mps_word_t *table, size_t n, mps_word_t *p)
|
||||
{
|
||||
cdie(table[0] == (mps_word_t)table_wrapper, "set_table_slot");
|
||||
table[3+n] = (mps_word_t)p;
|
||||
|
|
@ -182,7 +181,7 @@ static void test(mps_arena_t arena,
|
|||
mps_word_t *exacttable;
|
||||
mps_word_t *preserve[TABLE_SLOTS]; /* preserves objects in the weak */
|
||||
/* table by referring to them */
|
||||
unsigned long i, j;
|
||||
size_t i, j;
|
||||
void *p;
|
||||
|
||||
exacttable = alloc_table(TABLE_SLOTS, exactap);
|
||||
|
|
@ -194,11 +193,12 @@ static void test(mps_arena_t arena,
|
|||
|
||||
for(i = 0; i < TABLE_SLOTS; ++i) {
|
||||
mps_word_t *string;
|
||||
/* Ensure that the last entry in the table is preserved, so that
|
||||
* we don't get a false positive due to the local variable
|
||||
* 'string' keeping this entry alive (see job003436).
|
||||
/* Ensure that the first and last entries in the table are
|
||||
* preserved, so that we don't get false positives due to the
|
||||
* local variables 'weak_table' and 'string' keeping these entries
|
||||
* alive (see job003436).
|
||||
*/
|
||||
if (rnd() % 2 == 0 || i + 1 == TABLE_SLOTS) {
|
||||
if (rnd() % 2 == 0 || i == 0 || i + 1 == TABLE_SLOTS) {
|
||||
string = alloc_string("iamalive", leafap);
|
||||
preserve[i] = string;
|
||||
} else {
|
||||
|
|
@ -216,17 +216,19 @@ static void test(mps_arena_t arena,
|
|||
}
|
||||
}
|
||||
|
||||
mps_arena_collect(arena);
|
||||
die(mps_arena_collect(arena), "mps_arena_collect");
|
||||
mps_arena_release(arena);
|
||||
|
||||
for(i = 0; i < TABLE_SLOTS; ++i) {
|
||||
if (preserve[i] == 0) {
|
||||
if (table_slot(weaktable, i)) {
|
||||
error("Strongly unreachable weak table entry found, slot %lu.\n", i);
|
||||
error("Strongly unreachable weak table entry found, "
|
||||
"slot %"PRIuLONGEST".\n", (ulongest_t)i);
|
||||
} else {
|
||||
if (table_slot(exacttable, i) != 0) {
|
||||
error("Weak table entry deleted, but corresponding "
|
||||
"exact table entry not deleted, slot %lu.\n", i);
|
||||
"exact table entry not deleted, slot %"PRIuLONGEST".\n",
|
||||
(ulongest_t)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static mps_word_t *alloc_string(const char *s, mps_ap_t ap)
|
|||
* .assume.dylan-obj
|
||||
*/
|
||||
|
||||
static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
|
||||
static mps_word_t *alloc_table(size_t n, mps_ap_t ap)
|
||||
{
|
||||
size_t objsize;
|
||||
void *p;
|
||||
|
|
@ -130,7 +130,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
|
|||
objsize = (3 + n) * sizeof(mps_word_t);
|
||||
objsize = size_tAlignUp(objsize, MPS_PF_ALIGN);
|
||||
do {
|
||||
unsigned long i;
|
||||
size_t i;
|
||||
|
||||
die(mps_reserve(&p, ap, objsize + headerSIZE), "Reserve Table\n");
|
||||
object = (mps_word_t *)((char *)p + headerSIZE);
|
||||
|
|
@ -150,7 +150,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
|
|||
/* gets the nth slot from a table
|
||||
* .assume.dylan-obj
|
||||
*/
|
||||
static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
|
||||
static mps_word_t *table_slot(mps_word_t *table, size_t n)
|
||||
{
|
||||
return (mps_word_t *)table[3+n];
|
||||
}
|
||||
|
|
@ -159,8 +159,7 @@ static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
|
|||
/* sets the nth slot in a table
|
||||
* .assume.dylan-obj
|
||||
*/
|
||||
static void set_table_slot(mps_word_t *table,
|
||||
unsigned long n, mps_word_t *p)
|
||||
static void set_table_slot(mps_word_t *table, size_t n, mps_word_t *p)
|
||||
{
|
||||
cdie(table[0] == (mps_word_t)table_wrapper, "set_table_slot");
|
||||
table[3+n] = (mps_word_t)p;
|
||||
|
|
@ -187,7 +186,7 @@ static void test(mps_arena_t arena,
|
|||
mps_word_t *exacttable;
|
||||
mps_word_t *preserve[TABLE_SLOTS]; /* preserves objects in the weak */
|
||||
/* table by referring to them */
|
||||
unsigned long i, j;
|
||||
size_t i, j;
|
||||
void *p;
|
||||
|
||||
exacttable = alloc_table(TABLE_SLOTS, exactap);
|
||||
|
|
@ -221,17 +220,19 @@ static void test(mps_arena_t arena,
|
|||
}
|
||||
}
|
||||
|
||||
mps_arena_collect(arena);
|
||||
die(mps_arena_collect(arena), "mps_arena_collect");
|
||||
mps_arena_release(arena);
|
||||
|
||||
for(i = 0; i < TABLE_SLOTS; ++i) {
|
||||
if (preserve[i] == 0) {
|
||||
if (table_slot(weaktable, i)) {
|
||||
error("Strongly unreachable weak table entry found, slot %lu.\n", i);
|
||||
error("Strongly unreachable weak table entry found, "
|
||||
"slot %"PRIuLONGEST".\n", (ulongest_t)i);
|
||||
} else {
|
||||
if (table_slot(exacttable, i) != 0) {
|
||||
error("Weak table entry deleted, but corresponding "
|
||||
"exact table entry not deleted, slot %lu.\n", i);
|
||||
"exact table entry not deleted, slot %"PRIuLONGEST".\n",
|
||||
(ulongest_t)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -274,8 +275,8 @@ static void *setup(void *v, size_t s)
|
|||
die(mps_root_create_reg(&stack, arena, mps_rank_ambig(), 0, thr,
|
||||
mps_stack_scan_ambig, v, 0),
|
||||
"Root Create\n");
|
||||
EnsureHeaderFormat(&dylanfmt, arena);
|
||||
EnsureHeaderWeakFormat(&dylanweakfmt, arena);
|
||||
die(EnsureHeaderFormat(&dylanfmt, arena), "EnsureHeaderFormat");
|
||||
die(EnsureHeaderWeakFormat(&dylanweakfmt, arena), "EnsureHeaderWeakFormat");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
/* Ask the leafpool to allocate in the nursery, as we're using it to test
|
||||
weaknesss and want things to die in it promptly. */
|
||||
|
|
|
|||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
@ -10,6 +10,12 @@
|
|||
* DESIGN
|
||||
*
|
||||
* .design: see <design/bt/>
|
||||
*
|
||||
* .aver.critical: The function BTIsResRange (and anything it calls)
|
||||
* is on the critical path <design/critical-path/> because it is
|
||||
* called by NailboardIsResRange, which is called for every object in
|
||||
* a nailboarded segment when the segment is scanned or reclaimed; see
|
||||
* <design/nailboard/#impl.isresrange>.
|
||||
*/
|
||||
|
||||
#include "bt.h"
|
||||
|
|
@ -90,7 +96,9 @@ SRCID(bt, "$Id$");
|
|||
} else { \
|
||||
Index actInnerBase = BTIndexAlignUp((base)); \
|
||||
if (actInnerBase > (limit)) { /* no inner range */ \
|
||||
AVER((base) < (limit)); /* caught by small range case */ \
|
||||
/* Must have base < limit otherwise caught by small range case */ \
|
||||
/* And see .aver.critical. */ \
|
||||
AVER_CRITICAL((base) < (limit)); \
|
||||
bits_action(BTWordIndex((base)), \
|
||||
BTBitIndex((base)), \
|
||||
BTBitIndex((limit))); \
|
||||
|
|
@ -215,7 +223,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 +252,7 @@ Size (BTSize)(Count n)
|
|||
|
||||
Bool (BTGet)(BT t, Index i)
|
||||
{
|
||||
AVER(BTCheck(t));
|
||||
AVERT(BT, t);
|
||||
/* Can't check i */
|
||||
|
||||
/* see macro in <code/mpm.h> */
|
||||
|
|
@ -259,7 +267,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 <code/mpm.h> */
|
||||
|
|
@ -274,7 +282,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 <code/mpm.h> */
|
||||
|
|
@ -289,7 +297,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,8 +319,8 @@ void BTSetRange(BT t, Index base, Index limit)
|
|||
|
||||
Bool BTIsResRange(BT bt, Index base, Index limit)
|
||||
{
|
||||
AVER(BTCheck(bt));
|
||||
AVER(base < limit);
|
||||
AVERT_CRITICAL(BT, bt); /* See .aver.critical */
|
||||
AVER_CRITICAL(base < limit);
|
||||
/* Can't check range of base or limit */
|
||||
|
||||
#define SINGLE_IS_RES_RANGE(i) \
|
||||
|
|
@ -335,7 +343,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 +371,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 +884,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 +920,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 +955,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 +999,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 +1024,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 +1035,7 @@ Count BTCountResRange(BT bt, Index base, Index limit)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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: <design/bt/>
|
||||
*/
|
||||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ static void get(void)
|
|||
{
|
||||
if (argInRange(0)) {
|
||||
Bool b = (BTGet)(bt, args[0]);
|
||||
printf(b ? "TRUE\n" : "FALSE\n");
|
||||
puts(b ? "TRUE" : "FALSE");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ static void isSetRange(void)
|
|||
{
|
||||
if (checkDefaultRange(0)) {
|
||||
Bool b = BTIsSetRange(bt, args[0], args[1]);
|
||||
printf(b ? "TRUE\n" : "FALSE\n");
|
||||
puts(b ? "TRUE" : "FALSE");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ static void isResRange(void)
|
|||
{
|
||||
if (checkDefaultRange(0)) {
|
||||
Bool b = BTIsResRange(bt, args[0], args[1]);
|
||||
printf(b ? "TRUE\n" : "FALSE\n");
|
||||
puts(b ? "TRUE" : "FALSE");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -312,11 +312,6 @@ static void obeyCommand(const char *command)
|
|||
}
|
||||
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
/* disable "conversion from int to char" */
|
||||
#pragma warning(disable: 4244)
|
||||
#endif
|
||||
|
||||
static void showBT(void) {
|
||||
Index i;
|
||||
char c;
|
||||
|
|
@ -325,7 +320,7 @@ static void showBT(void) {
|
|||
i = 0;
|
||||
while((i < btSize) && (i < 50)) {
|
||||
if (i % 10 == 0)
|
||||
c = (char)((i / 10) % 10) + '0';
|
||||
c = (char)(((i / 10) % 10) + '0');
|
||||
else
|
||||
c = ' ';
|
||||
putchar(c);
|
||||
|
|
@ -334,7 +329,7 @@ static void showBT(void) {
|
|||
putchar('\n');
|
||||
i = 0;
|
||||
while((i < btSize) && (i < 50)) {
|
||||
c = (char)(i % 10) +'0';
|
||||
c = (char)((i % 10) +'0');
|
||||
putchar(c);
|
||||
++ i;
|
||||
}
|
||||
|
|
@ -353,11 +348,6 @@ static void showBT(void) {
|
|||
putchar('\n');
|
||||
}
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
/* disable "conversion from int to char" */
|
||||
#pragma warning(default: 4244)
|
||||
#endif
|
||||
|
||||
|
||||
#define testArenaSIZE (((size_t)64)<<20)
|
||||
|
||||
|
|
@ -374,7 +364,7 @@ extern int main(int argc, char *argv[])
|
|||
while(1) {
|
||||
char input[100];
|
||||
printf("bt test> ");
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
if (fgets(input, 100, stdin)) {
|
||||
obeyCommand(input);
|
||||
showBT();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* buffer.c: ALLOCATION BUFFER 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.
|
||||
*
|
||||
* .purpose: This is (part of) the implementation of allocation buffers.
|
||||
* Several macros which also form part of the implementation are in
|
||||
|
|
@ -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)); /* <design/check/#type.no-sig> */
|
||||
CHECKD_NOSIG(Ring, &buffer->poolRing);
|
||||
CHECKL(BoolCheck(buffer->isMutator));
|
||||
CHECKL(buffer->fillSize >= 0.0);
|
||||
CHECKL(buffer->emptySize >= 0.0);
|
||||
|
|
@ -205,7 +205,7 @@ static Res BufferInit(Buffer buffer, BufferClass class,
|
|||
AVERT(BufferClass, class);
|
||||
AVERT(Pool, pool);
|
||||
/* The PoolClass should support buffer protocols */
|
||||
AVER((pool->class->attr & AttrBUF)); /* .trans.mod */
|
||||
AVER(PoolHasAttr(pool, AttrBUF));
|
||||
|
||||
arena = PoolArena(pool);
|
||||
/* Initialize the buffer. See <code/mpmst.h> for a definition of */
|
||||
|
|
@ -383,7 +383,7 @@ void BufferFinish(Buffer buffer)
|
|||
pool = BufferPool(buffer);
|
||||
|
||||
/* The PoolClass should support buffer protocols */
|
||||
AVER((pool->class->attr & AttrBUF)); /* .trans.mod */
|
||||
AVER(PoolHasAttr(pool, AttrBUF));
|
||||
AVER(BufferIsReady(buffer));
|
||||
|
||||
/* <design/alloc-frame/#lw-frame.sync.trip> */
|
||||
|
|
@ -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));
|
||||
|
|
@ -1220,6 +1220,7 @@ DEFINE_CLASS(BufferClass, class)
|
|||
class->setRankSet = bufferNoSetRankSet;
|
||||
class->reassignSeg = bufferNoReassignSeg;
|
||||
class->sig = BufferClassSig;
|
||||
AVERT(BufferClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1240,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) {
|
||||
|
|
@ -1250,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. */
|
||||
|
||||
|
|
@ -1472,6 +1473,7 @@ DEFINE_CLASS(SegBufClass, class)
|
|||
class->rankSet = segBufRankSet;
|
||||
class->setRankSet = segBufSetRankSet;
|
||||
class->reassignSeg = segBufReassignSeg;
|
||||
AVERT(BufferClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1485,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 */
|
||||
|
|
@ -1499,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);
|
||||
|
|
@ -1532,12 +1534,13 @@ DEFINE_CLASS(RankBufClass, class)
|
|||
class->name = "RANKBUF";
|
||||
class->varargs = rankBufVarargs;
|
||||
class->init = rankBufInit;
|
||||
AVERT(BufferClass, class);
|
||||
}
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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,6 +85,7 @@ static Bool CBSBlockCheck(CBSBlock block)
|
|||
/* See .enter-leave.simple. */
|
||||
UNUSED(block); /* Required because there is no signature */
|
||||
CHECKL(block != NULL);
|
||||
/* Can't use CHECKD_NOSIG because TreeEMPTY is NULL. */
|
||||
CHECKL(TreeCheck(cbsBlockTree(block)));
|
||||
|
||||
/* If the block is in the middle of being deleted, */
|
||||
|
|
@ -245,9 +246,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 +916,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 +1087,7 @@ Res CBSDescribe(CBS cbs, mps_lib_FILE *stream)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* check.h: ASSERTION 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.
|
||||
*
|
||||
* .aver: This header defines a family of AVER and NOTREACHED macros.
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
#define ASSERT(cond, condstring) \
|
||||
BEGIN \
|
||||
if (cond) NOOP; else \
|
||||
mps_lib_assert_fail(__FILE__ , __LINE__, (condstring)); \
|
||||
mps_lib_assert_fail(MPS_FILE, __LINE__, (condstring)); \
|
||||
END
|
||||
|
||||
#define ASSERT_TYPECHECK(type, val) \
|
||||
|
|
@ -85,9 +85,6 @@
|
|||
*
|
||||
* TODO: Should also allow the check level variable to come from an
|
||||
* environment variable.
|
||||
*
|
||||
* TODO: CheckLevelDEEP asserts on arena creation with bootstrapping
|
||||
* problems. It clearly hasn't been tried for a while. RB 2012-09-01
|
||||
*/
|
||||
|
||||
enum {
|
||||
|
|
@ -327,7 +324,7 @@ extern unsigned CheckLevel;
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* clock.h -- Fast clocks and timers
|
||||
*
|
||||
* Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
|
@ -15,10 +15,6 @@
|
|||
*
|
||||
* On platforms that support it, we want to stamp events with a very cheap
|
||||
* and fast high-resolution timer.
|
||||
*
|
||||
* TODO: This is a sufficiently complicated nest of ifdefs that it should
|
||||
* be quarantined in its own header with KEEP OUT signs attached.
|
||||
* RB 2012-09-11
|
||||
*/
|
||||
|
||||
/* Microsoft C provides an intrinsic for the Intel rdtsc instruction.
|
||||
|
|
@ -49,7 +45,7 @@ typedef union EventClockUnion {
|
|||
using Microsoft Visual Studio 6 because of support for CodeView debugging
|
||||
information. */
|
||||
|
||||
#include <windows.h> /* KILL IT WITH FIRE! */
|
||||
#include "mpswin.h" /* KILL IT WITH FIRE! */
|
||||
|
||||
#define EVENT_CLOCK(lvalue) \
|
||||
BEGIN \
|
||||
|
|
@ -169,7 +165,7 @@ typedef mps_clock_t EventClock;
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -204,9 +204,11 @@ TESTLIBDEP = $(TESTLIB:%.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)
|
||||
FMTSCMTSTOBJ = $(FMTSCM:%.c=$(PFM)/$(VARIETY)/%.o)
|
||||
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)
|
||||
|
|
@ -377,7 +379,7 @@ $(PFM)/$(VARIETY)/abqtest: $(PFM)/$(VARIETY)/abqtest.o \
|
|||
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
|
||||
$(PFM)/$(VARIETY)/airtest: $(PFM)/$(VARIETY)/airtest.o \
|
||||
$(FMTSCMTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
$(FMTSCMOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
|
||||
$(PFM)/$(VARIETY)/amcss: $(PFM)/$(VARIETY)/amcss.o \
|
||||
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
|
|
@ -572,9 +574,20 @@ include $(PFM)/$(VARIETY)/mps.d
|
|||
else
|
||||
# %%PART: When adding a new part, add the dependency file macro for the new
|
||||
# part here.
|
||||
include $(MPMDEP) $(AMSDEP) $(AMCDEP) $(LODEP) \
|
||||
$(AWLDEP) $(POOLNDEP) $(TESTLIBDEP) $(FMTDYDEP) $(FMTHETSTDEP) \
|
||||
$(PLINTHDEP) $(EVENTPROCDEP)
|
||||
include \
|
||||
$(MPMDEP) \
|
||||
$(AMCDEP) \
|
||||
$(AMSDEP) \
|
||||
$(AWLDEP) \
|
||||
$(EVENTPROCDEP) \
|
||||
$(FMTDYDEP) \
|
||||
$(FMTDYTSTDEP) \
|
||||
$(FMTHETSTDEP) \
|
||||
$(FMTSCMDEP) \
|
||||
$(LODEP) \
|
||||
$(PLINTHDEP) \
|
||||
$(POOLNDEP) \
|
||||
$(TESTLIBDEP)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ $(ALL_TARGETS) $(OPTIONAL_TARGETS):
|
|||
|
||||
clean:
|
||||
$(ECHO) $(PFM): $@
|
||||
-echo y | rmdir/s $(PFM)
|
||||
if exist $(PFM) rmdir /q /s $(PFM)
|
||||
|
||||
# target target
|
||||
# %%VARIETY: When adding a new variety, optionally, add a recursive make
|
||||
|
|
@ -96,8 +96,8 @@ $(PFM)\cool\mps.lib: \
|
|||
$(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \
|
||||
$(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ)
|
||||
$(ECHO) $@
|
||||
cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$(PFM)\$(VARIETY)\version.o version.c
|
||||
$(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.o
|
||||
$(CC) /c $(CFLAGS) /Fo$(PFM)\$(VARIETY)\version.obj version.c
|
||||
$(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.obj
|
||||
|
||||
|
||||
# OTHER GENUINE TARGETS
|
||||
|
|
@ -273,13 +273,13 @@ $(PFM)\$(VARIETY)\mpseventsql.obj: $(PFM)\$(VARIETY)\eventsql.obj
|
|||
$(ECHO) $@
|
||||
@if not exist $(PFM) mkdir $(PFM)
|
||||
@if not exist $(PFM)\$(VARIETY) mkdir $(PFM)\$(VARIETY)
|
||||
cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$@ $<
|
||||
$(CC) /c $(CFLAGS) /Fo$@ $<
|
||||
|
||||
$(PFM)\$(VARIETY)\sqlite3.obj:
|
||||
$(ECHO) $@
|
||||
@if not exist $(PFM) mkdir $(PFM)
|
||||
@if not exist $(PFM)\$(VARIETY) mkdir $(PFM)\$(VARIETY)
|
||||
cl /c $(CFLAGSSQL) /Fd$(PFM)\$(VARIETY)\ /Fo$@ sqlite3.c
|
||||
$(CC) /c $(CFLAGSSQL) /Fo$@ sqlite3.c
|
||||
|
||||
{}.asm{$(PFM)\$(VARIETY)}.obj:
|
||||
$(ECHO) $@
|
||||
|
|
@ -301,7 +301,7 @@ $(PFM)\$(VARIETY)\sqlite3.obj:
|
|||
|
||||
{$(PFM)\$(VARIETY)}.obj{$(PFM)\$(VARIETY)}.exe:
|
||||
$(ECHO) $@
|
||||
$(LINKER) $(LINKFLAGS) /PDB:$*.pdb /OUT:$@ $(**)
|
||||
$(LINKER) $(LINKFLAGS) /OUT:$@ $(**)
|
||||
|
||||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# commpre.nmk: FIRST COMMON FRAGMENT FOR PLATFORMS USING NMAKE -*- makefile -*-1
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
|
||||
# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
|
|
@ -242,20 +242,15 @@ ECHO = echo
|
|||
|
||||
# C FLAGS
|
||||
|
||||
# /MD means compile for multi-threaded environment with separate C library DLL.
|
||||
# /MT means compile for multi-threaded environment.
|
||||
# /ML means compile for single-threaded environment.
|
||||
# A 'd' at the end means compile for debugging.
|
||||
|
||||
CFLAGSTARGETPRE =
|
||||
CFLAGSTARGETPOST =
|
||||
CRTFLAGSHOT = /MT
|
||||
CRTFLAGSCOOL = /MTd
|
||||
LINKFLAGSHOT = libcmt.lib
|
||||
LINKFLAGSCOOL = libcmtd.lib
|
||||
CRTFLAGSHOT =
|
||||
CRTFLAGSCOOL =
|
||||
LINKFLAGSHOT =
|
||||
LINKFLAGSCOOL =
|
||||
|
||||
CFLAGSSQLPRE = /nologo $(PFMDEFS)
|
||||
CFLAGSCOMMONPRE = /nologo /W4 /WX $(PFMDEFS) $(CFLAGSTARGETPRE)
|
||||
CFLAGSCOMMONPRE = /nologo $(PFMDEFS) $(CFLAGSTARGETPRE)
|
||||
CFLAGSSQLPOST =
|
||||
CFLAGSCOMMONPOST = $(CFLAGSTARGETPOST)
|
||||
|
||||
|
|
@ -270,7 +265,7 @@ CFLAGSHOT = /O2 /DNDEBUG
|
|||
# building a DLL, mpsdy.dll, the linker step will fail (error LNK2001:
|
||||
# unresolved external symbol __chkesp). See
|
||||
# http://support.microsoft.com/kb/q191669/
|
||||
CFLAGSCOOL = /Od
|
||||
CFLAGSCOOL =
|
||||
CFLAGSINTERNAL = /Zi
|
||||
CFLAGSEXTERNAL =
|
||||
|
||||
|
|
@ -303,7 +298,7 @@ LFCOOL = $(LINKFLAGSCOOL) $(LINKFLAGSINTERNAL)
|
|||
# %%VARIETY: When adding a new variety, define a macro containing the flags
|
||||
# for the new variety
|
||||
LIBMAN = lib # can't call this LIB - it screws the environment
|
||||
LIBFLAGSCOMMON = /nologo
|
||||
LIBFLAGSCOMMON =
|
||||
|
||||
LIBFLAGSRASH =
|
||||
LIBFLAGSHOT =
|
||||
|
|
@ -322,7 +317,7 @@ LIBFLAGSCOOL =
|
|||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
#
|
||||
# Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# All rights reserved. This is an open source license. Contact
|
||||
# Ravenbrook for commercial licensing options.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* config.h: MPS CONFIGURATION
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* PURPOSE
|
||||
|
|
@ -204,56 +204,77 @@
|
|||
#include "mpstd.h"
|
||||
|
||||
/* Suppress Visual C warnings at warning level 4, */
|
||||
/* see mail.richard.1997-09-25.13-26. */
|
||||
/* see mail.richard.1997-09-25.13-26 and job003715. */
|
||||
/* Essentially the same settings are done in testlib.h. */
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
|
||||
/* "unreferenced inline function has been removed" (windows.h) */
|
||||
#pragma warning(disable: 4514)
|
||||
|
||||
/* "constant conditional" (MPS_END) */
|
||||
#pragma warning(disable: 4127)
|
||||
|
||||
/* "unreachable code" (ASSERT, if cond is constantly true). */
|
||||
#pragma warning(disable: 4702)
|
||||
|
||||
/* "expression evaluates to a function which is missing an argument list" */
|
||||
#pragma warning(disable: 4550)
|
||||
|
||||
/* "local variable is initialized but not referenced" */
|
||||
#pragma warning(disable: 4189)
|
||||
|
||||
/* "not all control paths return a value" */
|
||||
#pragma warning(disable: 4715)
|
||||
|
||||
/* MSVC 2.0 generates a warning when using NOCHECK or UNUSED */
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER < 1000
|
||||
#pragma warning(disable: 4705)
|
||||
#endif
|
||||
#else /* _MSC_VER */
|
||||
#error "Expected _MSC_VER to be defined for builder.mv"
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
||||
/* Non-checking varieties give many spurious warnings because parameters
|
||||
* are suddenly unused, etc. We aren't interested in these
|
||||
*/
|
||||
|
||||
#if defined(AVER_AND_CHECK_NONE)
|
||||
|
||||
/* "unreferenced formal parameter" */
|
||||
#pragma warning(disable: 4100)
|
||||
|
||||
/* "unreferenced local function has been removed" */
|
||||
#pragma warning(disable: 4505)
|
||||
|
||||
#endif /* AVER_AND_CHECK_NONE */
|
||||
|
||||
#endif /* MPS_BUILD_MV */
|
||||
|
||||
|
||||
/* Suppress Pelles C warnings at warning level 2 */
|
||||
/* Some of the same settings are done in testlib.h. */
|
||||
|
||||
#ifdef MPS_BUILD_PC
|
||||
|
||||
/* "Unreachable code" (AVER, if condition is constantly true). */
|
||||
#pragma warn(disable: 2154)
|
||||
|
||||
/* "Consider changing type to 'size_t' for loop variable" */
|
||||
#pragma warn(disable: 2804)
|
||||
|
||||
#endif /* MPS_BUILD_PC */
|
||||
|
||||
|
||||
/* MPS_FILE -- expands to __FILE__ in nested macros */
|
||||
|
||||
#ifdef MPS_BUILD_PC
|
||||
|
||||
/* Pelles C loses definition of __FILE__ in deeply nested macro
|
||||
* expansions. See <http://forum.pellesc.de/index.php?topic=5474.0>
|
||||
*/
|
||||
#define MPS_FILE "<__FILE__ unavailable in " MPS_PF_STRING ">"
|
||||
|
||||
#else
|
||||
|
||||
#define MPS_FILE __FILE__
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Function attributes */
|
||||
/* Some of these are also defined in testlib.h */
|
||||
|
||||
/* Attribute for functions that take a printf-like format argument, so
|
||||
* that the compiler can check the format specifiers against the types
|
||||
* of the arguments.
|
||||
* GCC: <http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-Wformat-2850>
|
||||
* Clang: <http://clang.llvm.org/docs/AttributeReference.html#format-gnu-format>
|
||||
*/
|
||||
#if defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL)
|
||||
#define ATTRIBUTE_FORMAT(ARGLIST) __attribute__((__format__ ARGLIST))
|
||||
#else
|
||||
#define ATTRIBUTE_FORMAT(ARGLIST)
|
||||
#endif
|
||||
|
||||
/* Attribute for functions that should not be instrumented by Clang's
|
||||
* address sanitizer.
|
||||
* <http://clang.llvm.org/docs/AddressSanitizer.html#attribute-no-sanitize-address>
|
||||
*/
|
||||
#if defined(MPS_BUILD_LL)
|
||||
#if __has_feature(address_sanitizer)
|
||||
#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((__no_sanitize_address__))
|
||||
#else
|
||||
#define ATTRIBUTE_NO_SANITIZE_ADDRESS
|
||||
#endif
|
||||
#else
|
||||
#define ATTRIBUTE_NO_SANITIZE_ADDRESS
|
||||
#endif
|
||||
|
||||
|
||||
/* EPVMDefaultSubsequentSegSIZE is a default for the alignment of
|
||||
* subsequent segments (non-initial at each save level) in EPVM. See
|
||||
* design.mps.poolepvm.arch.segment.size.
|
||||
|
|
@ -284,6 +305,13 @@
|
|||
#define FMT_CLASS_DEFAULT (&FormatDefaultClass)
|
||||
|
||||
|
||||
/* Pool AMC Configuration -- see <code/poolamc.c> */
|
||||
|
||||
#define AMC_INTERIOR_DEFAULT TRUE
|
||||
/* AMC treats segments of this many pages (or more) as "Large" */
|
||||
#define AMCLargeSegPAGES ((Count)8)
|
||||
|
||||
|
||||
/* Pool AMS Configuration -- see <code/poolams.c> */
|
||||
|
||||
#define AMS_SUPPORT_AMBIGUOUS_DEFAULT FALSE
|
||||
|
|
@ -293,6 +321,10 @@
|
|||
/* Pool AWL Configuration -- see <code/poolawl.c> */
|
||||
|
||||
#define AWL_GEN_DEFAULT 0
|
||||
#define AWL_HAVE_SEG_SA_LIMIT TRUE
|
||||
#define AWL_SEG_SA_LIMIT 200 /* TODO: Improve guesswork with measurements */
|
||||
#define AWL_HAVE_TOTAL_SA_LIMIT FALSE
|
||||
#define AWL_TOTAL_SA_LIMIT 0
|
||||
|
||||
|
||||
/* Pool LO Configuration -- see <code/poollo.c> */
|
||||
|
|
@ -370,12 +402,10 @@
|
|||
|
||||
/* Stack configuration */
|
||||
|
||||
/* Currently StackProbe has a useful implementation only on
|
||||
* Intel platforms and only when using Microsoft build tools (builder.mv)
|
||||
*/
|
||||
#if defined(MPS_ARCH_I3) && defined(MPS_BUILD_MV)
|
||||
/* Currently StackProbe has a useful implementation only on Windows. */
|
||||
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I3)
|
||||
#define StackProbeDEPTH ((Size)500)
|
||||
#elif defined(MPS_PF_W3I6MV)
|
||||
#elif defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
|
||||
#define StackProbeDEPTH ((Size)500)
|
||||
#else
|
||||
#define StackProbeDEPTH ((Size)0)
|
||||
|
|
@ -556,20 +586,6 @@
|
|||
#define ARENA_INIT_SPARE_COMMIT_LIMIT ((Size)10uL*1024uL*1024uL)
|
||||
|
||||
|
||||
/* Pool Class AMC configuration */
|
||||
|
||||
/* AMC treats segments of this many pages (or more) as "Large" */
|
||||
#define AMCLargeSegPAGES ((Count)8)
|
||||
|
||||
|
||||
/* Pool Class AWL configuration -- see poolawl.c for usage */
|
||||
|
||||
#define AWL_HAVE_SEG_SA_LIMIT TRUE
|
||||
#define AWL_SEG_SA_LIMIT 200 /* TODO: Improve guesswork with measurements */
|
||||
#define AWL_HAVE_TOTAL_SA_LIMIT FALSE
|
||||
#define AWL_TOTAL_SA_LIMIT 0
|
||||
|
||||
|
||||
/* Default chain for GC pools
|
||||
*
|
||||
* TODO: The default should be to measure liveness and make sensible
|
||||
|
|
@ -588,7 +604,7 @@
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* dbgpool.c: POOL DEBUG MIXIN
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* .source: design.mps.object-debug
|
||||
|
|
@ -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 */
|
||||
|
|
@ -573,7 +571,7 @@ static void TagWalk(Pool pool, ObjectsStepMethod step, void *p)
|
|||
AVERT(PoolDebugMixin, debug);
|
||||
|
||||
node = SplayTreeFirst(&debug->index);
|
||||
while (node != NULL) {
|
||||
while (node != TreeEMPTY) {
|
||||
Tag tag = TagOfTree(node);
|
||||
|
||||
step(tag->addr, tag->size, NULL, pool, &tag->userdata, p);
|
||||
|
|
@ -691,7 +689,7 @@ void PoolClassMixInDebug(PoolClass class)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ void EventInit(void)
|
|||
AVER((EventKind)Event##name##Kind < EventKindLIMIT); \
|
||||
EVENT_##name##_PARAMS(EVENT_PARAM_CHECK, name)
|
||||
|
||||
EVENT_LIST(EVENT_CHECK, X)
|
||||
EVENT_LIST(EVENT_CHECK, X);
|
||||
|
||||
/* Ensure that no event can be larger than the maximum event size. */
|
||||
AVER(EventBufferSIZE <= EventSizeMAX);
|
||||
|
|
@ -416,7 +416,7 @@ void EventDump(mps_lib_FILE *stream)
|
|||
/* This can happen if there's a backtrace very early in the life of
|
||||
the MPS, and will cause an access violation if we continue. */
|
||||
if (!eventInited) {
|
||||
WriteF(stream, "No events\n", NULL);
|
||||
(void)WriteF(stream, "No events\n", NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ extern Word EventKindControl;
|
|||
size = offsetof(Event##name##Struct, f1) + _string_len + sizeof('\0'); \
|
||||
EVENT_BEGIN(name, size) \
|
||||
_event->f0 = (p0); \
|
||||
mps_lib_memcpy(_event->f1, (string), _string_len); \
|
||||
(void)mps_lib_memcpy(_event->f1, (string), _string_len); \
|
||||
_event->f1[_string_len] = '\0'; \
|
||||
EVENT_END(name, size); \
|
||||
END
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* eventcnv.c: Simple event log converter
|
||||
* Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* This is a command-line tool that converts a binary format telemetry output
|
||||
* stream from the MPS into a more-portable textual format.
|
||||
|
|
@ -46,12 +46,6 @@
|
|||
#include <string.h> /* for strcmp */
|
||||
#include "mpstd.h"
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
/* MSVC warning 4996 = stdio / C runtime 'unsafe' */
|
||||
/* Objects to: strncpy, sscanf, fopen. See job001934. */
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
#define DEFAULT_TELEMETRY_FILENAME "mpsio.log"
|
||||
#define TELEMETRY_FILENAME_ENVAR "MPS_TELEMETRY_FILENAME"
|
||||
|
||||
|
|
@ -62,18 +56,20 @@ static const char *prog; /* program name */
|
|||
|
||||
/* fevwarn -- flush stdout, write message to stderr */
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 2, 0))
|
||||
static void fevwarn(const char *prefix, const char *format, va_list args)
|
||||
{
|
||||
fflush(stdout); /* sync */
|
||||
fprintf(stderr, "%s: %s @", prog, prefix);
|
||||
EVENT_CLOCK_PRINT(stderr, eventTime);
|
||||
fprintf(stderr, " ");
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
(void)fflush(stdout); /* sync */
|
||||
(void)fprintf(stderr, "%s: %s @", prog, prefix);
|
||||
(void)EVENT_CLOCK_PRINT(stderr, eventTime);
|
||||
(void)fprintf(stderr, " ");
|
||||
(void)vfprintf(stderr, format, args);
|
||||
(void)fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* evwarn -- flush stdout, warn to stderr */
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2))
|
||||
static void evwarn(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
@ -85,6 +81,7 @@ static void evwarn(const char *format, ...)
|
|||
|
||||
/* everror -- flush stdout, message to stderr, exit */
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2))
|
||||
static void everror(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
@ -100,10 +97,9 @@ static void everror(const char *format, ...)
|
|||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-f logfile] [-h]\n"
|
||||
"See \"Telemetry\" in the reference manual for instructions.\n",
|
||||
prog);
|
||||
(void)fprintf(stderr, "Usage: %s [-f logfile] [-h]\n"
|
||||
"See \"Telemetry\" in the reference manual for instructions.\n",
|
||||
prog);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -268,9 +264,12 @@ static void readLog(FILE *stream)
|
|||
event->EventInit.f5,
|
||||
MPS_WORD_WIDTH);
|
||||
break;
|
||||
default:
|
||||
/* No special treatment needed. */
|
||||
break;
|
||||
}
|
||||
|
||||
EVENT_CLOCK_PRINT(stdout, eventTime);
|
||||
(void)EVENT_CLOCK_PRINT(stdout, eventTime);
|
||||
printf(" %4X", (unsigned)code);
|
||||
|
||||
switch (code) {
|
||||
|
|
@ -286,7 +285,7 @@ static void readLog(FILE *stream)
|
|||
}
|
||||
|
||||
putchar('\n');
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
} /* while(!feof(input)) */
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +331,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* <code/eventdef.h> -- Event Logging Definitions
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* .source: <design/telemetry/>
|
||||
*
|
||||
|
|
@ -31,14 +31,13 @@
|
|||
* the median version when changing an existing event,
|
||||
* and the major version when changing the format of the event file.
|
||||
*
|
||||
* TODO: These should go into a header that appears at the start of a
|
||||
* telemetry stream, but they aren't currently used. Keep updating them
|
||||
* anyway. RB 2012-09-07
|
||||
* These are passed as parameters to the EventInit event at the start
|
||||
* of a telemetry stream, allowing that stream to be identified.
|
||||
*/
|
||||
|
||||
#define EVENT_VERSION_MAJOR ((unsigned)1)
|
||||
#define EVENT_VERSION_MEDIAN ((unsigned)1)
|
||||
#define EVENT_VERSION_MINOR ((unsigned)6)
|
||||
#define EVENT_VERSION_MINOR ((unsigned)7)
|
||||
|
||||
|
||||
/* EVENT_LIST -- list of event types and general properties
|
||||
|
|
@ -192,7 +191,8 @@
|
|||
/* new events for performance analysis of large heaps. */ \
|
||||
EVENT(X, TraceCondemnZones , 0x0083, TRUE, Trace) \
|
||||
EVENT(X, ArenaGenZoneAdd , 0x0084, TRUE, Arena) \
|
||||
EVENT(X, ArenaUseFreeZone , 0x0085, TRUE, Arena)
|
||||
EVENT(X, ArenaUseFreeZone , 0x0085, TRUE, Arena) \
|
||||
/* EVENT(X, ArenaBlacklistZone , 0x0086, TRUE, Arena) */
|
||||
|
||||
|
||||
/* Remember to update EventNameMAX and EventCodeMAX above!
|
||||
|
|
@ -745,7 +745,7 @@
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "mpstd.h"
|
||||
|
||||
|
||||
#ifdef MPS_PF_W3I6MV
|
||||
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
|
||||
#define PRIuLONGEST "llu"
|
||||
#define PRIXPTR "016llX"
|
||||
typedef unsigned long long ulongest_t;
|
||||
|
|
@ -116,6 +116,7 @@ typedef struct apRepStruct *apRep;
|
|||
|
||||
/* error -- error signalling */
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2))
|
||||
static void error(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* $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.
|
||||
*
|
||||
* This is a command-line tool that imports events from a text-format
|
||||
* MPS telemetry file into a SQLite database file.
|
||||
|
|
@ -86,9 +86,6 @@
|
|||
#define DEFAULT_DATABASE_NAME "mpsevent.db"
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
/* MSVC warning 4996 = stdio / C runtime 'unsafe' */
|
||||
/* Objects to: getenv, sprintf. See job001934. */
|
||||
#pragma warning( disable : 4996 )
|
||||
#define strtoll _strtoi64
|
||||
#endif
|
||||
|
||||
|
|
@ -113,6 +110,7 @@ unsigned int verbosity = 0;
|
|||
#define LOG_SELDOM 3
|
||||
#define LOG_RARELY 4
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 2, 0))
|
||||
static void vlog(unsigned int level, const char *format, va_list args)
|
||||
{
|
||||
if (level <= verbosity) {
|
||||
|
|
@ -123,6 +121,7 @@ static void vlog(unsigned int level, const char *format, va_list args)
|
|||
}
|
||||
}
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 2, 3))
|
||||
static void evlog(unsigned int level, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
@ -131,6 +130,7 @@ static void evlog(unsigned int level, const char *format, ...)
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2))
|
||||
static void error(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
@ -452,7 +452,7 @@ static void registerLogFile(sqlite3 *db,
|
|||
name = sqlite3_column_text(statement, 0);
|
||||
logSerial = sqlite3_column_int64(statement, 1);
|
||||
completed = sqlite3_column_int64(statement, 2);
|
||||
evlog(force ? LOG_OFTEN : LOG_ALWAYS, "Log file matching '%s' already in event_log, named \"%s\" (serial %lu, completed %lu).",
|
||||
evlog(force ? LOG_OFTEN : LOG_ALWAYS, "Log file matching '%s' already in event_log, named \"%s\" (serial %llu, completed %llu).",
|
||||
filename, name, logSerial, completed);
|
||||
if (force) {
|
||||
evlog(LOG_OFTEN, "Continuing anyway because -f specified.");
|
||||
|
|
@ -486,7 +486,7 @@ static void registerLogFile(sqlite3 *db,
|
|||
if (res != SQLITE_DONE)
|
||||
sqlite_error(res, db, "insert into event_log failed.");
|
||||
logSerial = sqlite3_last_insert_rowid(db);
|
||||
evlog(LOG_SOMETIMES, "Log file %s added to event_log with serial %lu",
|
||||
evlog(LOG_SOMETIMES, "Log file %s added to event_log with serial %llu",
|
||||
filename, logSerial);
|
||||
finalizeStatement(db, statement);
|
||||
}
|
||||
|
|
@ -508,7 +508,7 @@ static void logFileCompleted(sqlite3 *db,
|
|||
res = sqlite3_step(statement);
|
||||
if (res != SQLITE_DONE)
|
||||
sqlite_error(res, db, "insert into event_log failed.");
|
||||
evlog(LOG_SOMETIMES, "Marked in event_log: %lu events", completed);
|
||||
evlog(LOG_SOMETIMES, "Marked in event_log: %llu events", completed);
|
||||
finalizeStatement(db, statement);
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +864,7 @@ static int64 readLog(FILE *input,
|
|||
/* this macro sets statement and last_index */
|
||||
EVENT_LIST(EVENT_TYPE_WRITE_SQL, X);
|
||||
default:
|
||||
error("Event %llu has Unknown event code %d", eventCount, code);
|
||||
error("Event %llu has Unknown event code %ld", eventCount, code);
|
||||
}
|
||||
/* bind the fields we store for every event */ \
|
||||
res = sqlite3_bind_int64(statement, last_index+1, logSerial);
|
||||
|
|
@ -951,7 +951,7 @@ int main(int argc, char *argv[])
|
|||
makeTables(db);
|
||||
fillGlueTables(db);
|
||||
count = writeEventsToSQL(db);
|
||||
evlog(LOG_ALWAYS, "Imported %llu events from %s to %s, serial %lu.",
|
||||
evlog(LOG_ALWAYS, "Imported %llu events from %s to %s, serial %llu.",
|
||||
count, logFileName, databaseName, logSerial);
|
||||
|
||||
if (runTests) {
|
||||
|
|
@ -965,7 +965,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (c) 2012-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (c) 2012-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* $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.
|
||||
*
|
||||
* This is a command-line tool that converts events from a text-format
|
||||
* MPS telemetry file into a more human-readable format.
|
||||
|
|
@ -39,41 +39,34 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
/* MSVC warning 4996 = stdio / C runtime 'unsafe' */
|
||||
/* Objects to: strncpy, sscanf, fopen. See job001934. */
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
static const char *prog; /* program name */
|
||||
static const char *logFileName = NULL;
|
||||
|
||||
/* everror -- error signalling */
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2))
|
||||
static void everror(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
fflush(stdout); /* sync */
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
(void)fflush(stdout); /* sync */
|
||||
(void)fprintf(stderr, "%s: ", prog);
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
(void)vfprintf(stderr, format, args);
|
||||
(void)fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-l <logfile>]\n",
|
||||
prog);
|
||||
(void)fprintf(stderr, "Usage: %s [-l <logfile>]\n", prog);
|
||||
}
|
||||
|
||||
static void usageError(void)
|
||||
{
|
||||
usage();
|
||||
everror("Bad usage");
|
||||
usage();
|
||||
everror("Bad usage");
|
||||
}
|
||||
|
||||
/* parseArgs -- parse command line arguments */
|
||||
|
|
@ -289,7 +282,7 @@ static void recordLabel(char *p)
|
|||
|
||||
address = parseHex(&p);
|
||||
if (address > (Word)-1) {
|
||||
printf("label address too large!");
|
||||
(void)printf("label address too large!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -440,24 +433,27 @@ static void readLog(FILE *input)
|
|||
if ((major != EVENT_VERSION_MAJOR) ||
|
||||
(median != EVENT_VERSION_MEDIAN) ||
|
||||
(minor != EVENT_VERSION_MINOR)) {
|
||||
fprintf(stderr, "Event log version does not match: %d.%d.%d vs %d.%d.%d\n",
|
||||
(int)major, (int)median, (int)minor,
|
||||
EVENT_VERSION_MAJOR,
|
||||
EVENT_VERSION_MEDIAN,
|
||||
EVENT_VERSION_MINOR);
|
||||
(void)fprintf(stderr, "Event log version does not match: "
|
||||
"%d.%d.%d vs %d.%d.%d\n",
|
||||
(int)major, (int)median, (int)minor,
|
||||
EVENT_VERSION_MAJOR,
|
||||
EVENT_VERSION_MEDIAN,
|
||||
EVENT_VERSION_MINOR);
|
||||
}
|
||||
|
||||
if (maxCode > EventCodeMAX) {
|
||||
fprintf(stderr, "Event log may contain unknown events with codes from %d to %d\n",
|
||||
EventCodeMAX+1, (int)maxCode);
|
||||
(void)fprintf(stderr, "Event log may contain unknown events "
|
||||
"with codes from %d to %d\n",
|
||||
EventCodeMAX+1, (int)maxCode);
|
||||
}
|
||||
|
||||
if (wordWidth > MPS_WORD_WIDTH) {
|
||||
int newHexWordWidth = (int)((wordWidth + 3) / 4);
|
||||
if (newHexWordWidth > hexWordWidth) {
|
||||
fprintf(stderr,
|
||||
"Event log word width is greater than on current platform;"
|
||||
"previous values may be printed too narrowly.\n");
|
||||
(void)fprintf(stderr,
|
||||
"Event log word width is greater than on current "
|
||||
"platform; previous values may be printed too "
|
||||
"narrowly.\n");
|
||||
}
|
||||
hexWordWidth = newHexWordWidth;
|
||||
}
|
||||
|
|
@ -500,7 +496,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2012-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2012-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -185,7 +185,8 @@ static void *test(void *arg, size_t s)
|
|||
|
||||
if (collections != c) {
|
||||
collections = c;
|
||||
printf("\nCollection %lu started, %lu objects.\n", c, objs);
|
||||
printf("\nCollection %"PRIuLONGEST" started, %lu objects.\n",
|
||||
(ulongest_t)c, objs);
|
||||
|
||||
report(arena);
|
||||
for (i = 0; i < exactRootsCOUNT; ++i) {
|
||||
|
|
@ -231,7 +232,7 @@ static void *test(void *arg, size_t s)
|
|||
if (objs % 1024 == 0) {
|
||||
report(arena);
|
||||
putchar('.');
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
}
|
||||
|
||||
++objs;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ static void register_numbered_tree(mps_word_t tree, mps_arena_t arena)
|
|||
{
|
||||
/* don't finalize ints */
|
||||
if ((tree & 1) == 0) {
|
||||
mps_finalize(arena, (mps_addr_t *)&tree);
|
||||
mps_addr_t addr = (void *)tree;
|
||||
die(mps_finalize(arena, &addr), "mps_finalize");
|
||||
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
|
||||
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
|
||||
}
|
||||
|
|
@ -124,8 +125,8 @@ static void register_indirect_tree(mps_word_t tree, mps_arena_t arena)
|
|||
{
|
||||
/* don't finalize ints */
|
||||
if ((tree & 1) == 0) {
|
||||
mps_word_t indirect = DYLAN_VECTOR_SLOT(tree,2);
|
||||
mps_finalize(arena, (mps_addr_t *)&indirect);
|
||||
mps_addr_t indirect = (void *)DYLAN_VECTOR_SLOT(tree,2);
|
||||
die(mps_finalize(arena, &indirect), "mps_finalize");
|
||||
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
|
||||
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
|
||||
}
|
||||
|
|
@ -186,7 +187,7 @@ static void *test(void *arg, size_t s)
|
|||
(mps_collections(arena) < collectionCOUNT)) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
while (mps_message_poll(arena)) {
|
||||
|
|
@ -202,8 +203,10 @@ static void *test(void *arg, size_t s)
|
|||
testlib_unused(obj);
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%lu objects finalized: total %lu of %lu\n",
|
||||
final_this_time, finals, object_count);
|
||||
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
|
||||
" of %"PRIuLONGEST"\n",
|
||||
(ulongest_t)final_this_time, (ulongest_t)finals,
|
||||
(ulongest_t)object_count);
|
||||
}
|
||||
|
||||
object_count = 0;
|
||||
|
|
@ -227,7 +230,7 @@ static void *test(void *arg, size_t s)
|
|||
(mps_collections(arena) < collectionCOUNT)) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
fflush(stdout);
|
||||
(void)fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
while (mps_message_poll(arena)) {
|
||||
|
|
@ -243,8 +246,10 @@ static void *test(void *arg, size_t s)
|
|||
testlib_unused(obj);
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%lu objects finalized: total %lu of %lu\n",
|
||||
final_this_time, finals, object_count);
|
||||
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
|
||||
" of %"PRIuLONGEST"\n",
|
||||
(ulongest_t)final_this_time, (ulongest_t)finals,
|
||||
(ulongest_t)object_count);
|
||||
}
|
||||
|
||||
mps_ap_destroy(ap);
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ static Index (indexOfAddr)(FBMState state, Addr a)
|
|||
static void describe(FBMState state) {
|
||||
switch (state->type) {
|
||||
case FBMTypeCBS:
|
||||
CBSDescribe(state->the.cbs, mps_lib_get_stdout());
|
||||
die(CBSDescribe(state->the.cbs, mps_lib_get_stdout()), "CBSDescribe");
|
||||
break;
|
||||
case FBMTypeFreelist:
|
||||
FreelistDescribe(state->the.fl, mps_lib_get_stdout());
|
||||
die(FreelistDescribe(state->the.fl, mps_lib_get_stdout()), "FreelistDescribe");
|
||||
break;
|
||||
default:
|
||||
fail();
|
||||
cdie(0, "invalid state->type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ static void check(FBMState state)
|
|||
FreelistIterate(state->the.fl, checkFLCallback, (void *)&closure, 0);
|
||||
break;
|
||||
default:
|
||||
fail();
|
||||
cdie(0, "invalid state->type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ static void allocate(FBMState state, Addr base, Addr limit)
|
|||
res = FreelistDelete(&oldRange, state->the.fl, &range);
|
||||
break;
|
||||
default:
|
||||
fail();
|
||||
cdie(0, "invalid state->type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ static void deallocate(FBMState state, Addr base, Addr limit)
|
|||
res = FreelistInsert(&freeRange, state->the.fl, &range);
|
||||
break;
|
||||
default:
|
||||
fail();
|
||||
cdie(0, "invalid state->type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -432,20 +432,23 @@ static void find(FBMState state, Size size, Bool high, FindDelete findDelete)
|
|||
remainderLimit = origLimit = addrOfIndex(state, expectedLimit);
|
||||
|
||||
switch(findDelete) {
|
||||
case FindDeleteNONE: {
|
||||
case FindDeleteNONE:
|
||||
/* do nothing */
|
||||
} break;
|
||||
case FindDeleteENTIRE: {
|
||||
break;
|
||||
case FindDeleteENTIRE:
|
||||
remainderBase = remainderLimit;
|
||||
} break;
|
||||
case FindDeleteLOW: {
|
||||
break;
|
||||
case FindDeleteLOW:
|
||||
expectedLimit = expectedBase + size;
|
||||
remainderBase = addrOfIndex(state, expectedLimit);
|
||||
} break;
|
||||
case FindDeleteHIGH: {
|
||||
break;
|
||||
case FindDeleteHIGH:
|
||||
expectedBase = expectedLimit - size;
|
||||
remainderLimit = addrOfIndex(state, expectedBase);
|
||||
} break;
|
||||
break;
|
||||
default:
|
||||
cdie(0, "invalid findDelete");
|
||||
break;
|
||||
}
|
||||
|
||||
if (findDelete != FindDeleteNONE) {
|
||||
|
|
@ -467,7 +470,7 @@ static void find(FBMState state, Size size, Bool high, FindDelete findDelete)
|
|||
(&foundRange, &oldRange, state->the.fl, size * state->align, findDelete);
|
||||
break;
|
||||
default:
|
||||
fail();
|
||||
cdie(0, "invalid state->type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -528,9 +531,7 @@ static void test(FBMState state, unsigned n) {
|
|||
size = fbmRnd(ArraySize / 10) + 1;
|
||||
high = fbmRnd(2) ? TRUE : FALSE;
|
||||
switch(fbmRnd(6)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2: findDelete = FindDeleteNONE; break;
|
||||
default: findDelete = FindDeleteNONE; break;
|
||||
case 3: findDelete = FindDeleteLOW; break;
|
||||
case 4: findDelete = FindDeleteHIGH; break;
|
||||
case 5: findDelete = FindDeleteENTIRE; break;
|
||||
|
|
@ -538,7 +539,7 @@ static void test(FBMState state, unsigned n) {
|
|||
find(state, size, high, findDelete);
|
||||
break;
|
||||
default:
|
||||
fail();
|
||||
cdie(0, "invalid state->type");
|
||||
return;
|
||||
}
|
||||
if ((i + 1) % 1000 == 0)
|
||||
|
|
@ -605,10 +606,14 @@ extern int main(int argc, char *argv[])
|
|||
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
printf("\nNumber of allocations attempted: %ld\n", NAllocateTried);
|
||||
printf("Number of allocations succeeded: %ld\n", NAllocateSucceeded);
|
||||
printf("Number of deallocations attempted: %ld\n", NDeallocateTried);
|
||||
printf("Number of deallocations succeeded: %ld\n", NDeallocateSucceeded);
|
||||
printf("\nNumber of allocations attempted: %"PRIuLONGEST"\n",
|
||||
(ulongest_t)NAllocateTried);
|
||||
printf("Number of allocations succeeded: %"PRIuLONGEST"\n",
|
||||
(ulongest_t)NAllocateSucceeded);
|
||||
printf("Number of deallocations attempted: %"PRIuLONGEST"\n",
|
||||
(ulongest_t)NDeallocateTried);
|
||||
printf("Number of deallocations succeeded: %"PRIuLONGEST"\n",
|
||||
(ulongest_t)NDeallocateSucceeded);
|
||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,8 @@ static void *test(void *arg, size_t s)
|
|||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
obj = objaddr;
|
||||
objind = dylan_int_int(obj[vectorSLOT]);
|
||||
printf("Finalizing: object %lu at %p\n", objind, objaddr);
|
||||
printf("Finalizing: object %"PRIuLONGEST" at %p\n",
|
||||
(ulongest_t)objind, objaddr);
|
||||
/* <design/poolmrg/#test.promise.ut.final.check> */
|
||||
cdie(root[objind] == NULL, "finalized live");
|
||||
cdie(state[objind] == finalizableSTATE, "finalized dead");
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#include "mpslib.h"
|
||||
#include "mps.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpscams.h"
|
||||
#include "mpscawl.h"
|
||||
#include "mpsavm.h"
|
||||
#include "fmtdy.h"
|
||||
#include "fmtdytst.h"
|
||||
|
|
@ -32,14 +34,8 @@
|
|||
|
||||
#define testArenaSIZE ((size_t)16<<20)
|
||||
#define rootCOUNT 20
|
||||
#define maxtreeDEPTH 12
|
||||
#define maxtreeDEPTH 10
|
||||
#define collectionCOUNT 10
|
||||
#define genCOUNT 2
|
||||
|
||||
/* testChain -- generation parameters for the test */
|
||||
|
||||
static mps_gen_param_s testChain[genCOUNT] = {
|
||||
{ 150, 0.85 }, { 170, 0.45 } };
|
||||
|
||||
|
||||
/* global object counter */
|
||||
|
|
@ -77,7 +73,7 @@ static void register_numbered_tree(mps_word_t tree, mps_arena_t arena)
|
|||
/* don't finalize ints */
|
||||
if ((tree & 1) == 0) {
|
||||
mps_addr_t tree_ref = (mps_addr_t)tree;
|
||||
mps_finalize(arena, &tree_ref);
|
||||
die(mps_finalize(arena, &tree_ref), "mps_finalize");
|
||||
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
|
||||
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
|
||||
}
|
||||
|
|
@ -117,123 +113,96 @@ static void register_indirect_tree(mps_word_t tree, mps_arena_t arena)
|
|||
if ((tree & 1) == 0) {
|
||||
mps_word_t indirect = DYLAN_VECTOR_SLOT(tree,2);
|
||||
mps_addr_t indirect_ref = (mps_addr_t)indirect;
|
||||
mps_finalize(arena, &indirect_ref);
|
||||
die(mps_finalize(arena, &indirect_ref), "mps_finalize");
|
||||
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
|
||||
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
|
||||
}
|
||||
}
|
||||
|
||||
static mps_addr_t test_awl_find_dependent(mps_addr_t addr)
|
||||
{
|
||||
testlib_unused(addr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *root[rootCOUNT];
|
||||
|
||||
static void *test(void *arg, size_t s)
|
||||
static void test_trees(const char *name, mps_arena_t arena, mps_ap_t ap,
|
||||
mps_word_t (*make)(mps_word_t, mps_ap_t),
|
||||
void (*reg)(mps_word_t, mps_arena_t))
|
||||
{
|
||||
size_t collections = 0;
|
||||
size_t finals = 0;
|
||||
size_t i;
|
||||
|
||||
object_count = 0;
|
||||
|
||||
printf("Making some %s finalized trees of objects.\n", name);
|
||||
/* make some trees */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = (void *)(*make)(maxtreeDEPTH, ap);
|
||||
(*reg)((mps_word_t)root[i], arena);
|
||||
}
|
||||
|
||||
printf("Losing all pointers to the trees.\n");
|
||||
/* clean out the roots */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = 0;
|
||||
}
|
||||
|
||||
while (finals < object_count && collections < collectionCOUNT) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
(void)fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
++ collections;
|
||||
while (mps_message_poll(arena)) {
|
||||
mps_message_t message;
|
||||
mps_addr_t objaddr;
|
||||
cdie(mps_message_get(&message, arena,
|
||||
mps_message_type_finalization()),
|
||||
"get");
|
||||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
mps_message_discard(arena, message);
|
||||
++ final_this_time;
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
|
||||
" of %"PRIuLONGEST"\n", final_this_time, finals, object_count);
|
||||
}
|
||||
cdie(finals == object_count, "Not all objects were finalized.");
|
||||
}
|
||||
|
||||
static void *test(mps_arena_t arena, mps_class_t pool_class)
|
||||
{
|
||||
mps_ap_t ap;
|
||||
mps_fmt_t fmt;
|
||||
mps_chain_t chain;
|
||||
mps_word_t finals;
|
||||
mps_pool_t amc;
|
||||
mps_pool_t pool;
|
||||
mps_root_t mps_root;
|
||||
mps_arena_t arena;
|
||||
mps_message_t message;
|
||||
size_t i;
|
||||
|
||||
arena = (mps_arena_t)arg;
|
||||
(void)s;
|
||||
|
||||
die(mps_fmt_create_A(&fmt, arena, dylan_fmt_A()), "fmt_create\n");
|
||||
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
|
||||
die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain),
|
||||
"pool_create amc\n");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, test_awl_find_dependent);
|
||||
die(mps_pool_create_k(&pool, arena, pool_class, args),
|
||||
"pool_create\n");
|
||||
} MPS_ARGS_END(args);
|
||||
die(mps_root_create_table(&mps_root, arena, mps_rank_exact(), (mps_rm_t)0,
|
||||
root, (size_t)rootCOUNT),
|
||||
"root_create\n");
|
||||
die(mps_ap_create(&ap, amc, mps_rank_exact()), "ap_create\n");
|
||||
die(mps_ap_create(&ap, pool, mps_rank_exact()), "ap_create\n");
|
||||
|
||||
mps_message_type_enable(arena, mps_message_type_finalization());
|
||||
|
||||
mps_arena_park(arena);
|
||||
|
||||
object_count = 0;
|
||||
|
||||
printf("Making some finalized trees of objects.\n");
|
||||
/* make some trees */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = (void *)make_numbered_tree(maxtreeDEPTH, ap);
|
||||
register_numbered_tree((mps_word_t)root[i], arena);
|
||||
}
|
||||
|
||||
printf("Losing all pointers to the trees.\n");
|
||||
/* clean out the roots */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = 0;
|
||||
}
|
||||
|
||||
finals = 0;
|
||||
|
||||
while ((finals < object_count) &&
|
||||
(mps_collections(arena) < collectionCOUNT)) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
while (mps_message_poll(arena)) {
|
||||
mps_addr_t objaddr;
|
||||
cdie(mps_message_get(&message, arena,
|
||||
mps_message_type_finalization()),
|
||||
"get");
|
||||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
mps_message_discard(arena, message);
|
||||
++ final_this_time;
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%lu objects finalized: total %lu of %lu\n",
|
||||
final_this_time, finals, object_count);
|
||||
}
|
||||
|
||||
object_count = 0;
|
||||
|
||||
printf("Making some indirectly finalized trees of objects.\n");
|
||||
/* make some trees */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = (void *)make_indirect_tree(maxtreeDEPTH, ap);
|
||||
register_indirect_tree((mps_word_t)root[i], arena);
|
||||
}
|
||||
|
||||
printf("Losing all pointers to the trees.\n");
|
||||
/* clean out the roots */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = 0;
|
||||
}
|
||||
|
||||
finals = 0;
|
||||
|
||||
while ((finals < object_count) &&
|
||||
(mps_collections(arena) < collectionCOUNT)) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
while (mps_message_poll(arena)) {
|
||||
mps_addr_t objaddr;
|
||||
cdie(mps_message_get(&message, arena,
|
||||
mps_message_type_finalization()),
|
||||
"get");
|
||||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
mps_message_discard(arena, message);
|
||||
++ final_this_time;
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%lu objects finalized: total %lu of %lu\n",
|
||||
final_this_time, finals, object_count);
|
||||
}
|
||||
test_trees("numbered", arena, ap, make_numbered_tree, register_numbered_tree);
|
||||
test_trees("indirect", arena, ap, make_indirect_tree, register_indirect_tree);
|
||||
|
||||
mps_ap_destroy(ap);
|
||||
mps_root_destroy(mps_root);
|
||||
mps_pool_destroy(amc);
|
||||
mps_chain_destroy(chain);
|
||||
mps_pool_destroy(pool);
|
||||
mps_fmt_destroy(fmt);
|
||||
|
||||
return NULL;
|
||||
|
|
@ -244,14 +213,17 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
mps_arena_t arena;
|
||||
mps_thr_t thread;
|
||||
void *r;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
|
||||
"arena_create\n");
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg\n");
|
||||
mps_tramp(&r, test, arena, 0);
|
||||
|
||||
test(arena, mps_class_amc());
|
||||
/* TODO: test(arena, mps_class_ams()); */
|
||||
/* TODO: test(arena, mps_class_awl()); */
|
||||
|
||||
mps_thread_dereg(thread);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* fmtdy.c: DYLAN OBJECT FORMAT 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.
|
||||
* Portions copyright (c) 2002 Global Graphics Software.
|
||||
*
|
||||
* .readership: MPS developers, Dylan developers
|
||||
|
|
@ -69,10 +69,6 @@
|
|||
/* MPS_END causes "constant conditional" warnings. */
|
||||
#pragma warning(disable: 4127)
|
||||
|
||||
/* windows.h causes warnings about "unreferenced inline function */
|
||||
/* has been removed". */
|
||||
#pragma warning(disable: 4514)
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
||||
|
|
@ -470,8 +466,8 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
|
|||
break;
|
||||
|
||||
case 1: /* stretchy non-traceable */
|
||||
notreached(); /* Not used by DylanWorks yet */
|
||||
p += vt + 1;
|
||||
notreached(); /* Not used by DylanWorks yet */
|
||||
break;
|
||||
|
||||
case 2: /* non-stretchy traceable */
|
||||
|
|
@ -482,7 +478,6 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
|
|||
break;
|
||||
|
||||
case 3: /* stretchy traceable */
|
||||
notreached(); /* DW doesn't create them yet */
|
||||
vl = *(mps_word_t *)p; /* vector length */
|
||||
assert((vl & 3) == 1); /* check Dylan integer tag */
|
||||
vl >>= 2; /* untag it */
|
||||
|
|
@ -490,21 +485,22 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
|
|||
res = dylan_scan_contig(mps_ss, p, p + vl);
|
||||
if(res) return res;
|
||||
p += vt; /* skip to end of whole vector */
|
||||
notreached(); /* DW doesn't create them yet */
|
||||
break;
|
||||
|
||||
case 4: /* non-word */
|
||||
es = (vh & 0xff) >> 3;
|
||||
vb = (vh >> 16) & 0xff;
|
||||
es = (unsigned)(vh & 0xff) >> 3;
|
||||
vb = (unsigned)((vh >> 16) & 0xff);
|
||||
vt += vb;
|
||||
p += NONWORD_LENGTH(vt, es);
|
||||
break;
|
||||
|
||||
case 5: /* stretchy non-word */
|
||||
notreached(); /* DW doesn't create them yet */
|
||||
es = (vh & 0xff) >> 3;
|
||||
vb = (vh >> 16) & 0xff;
|
||||
es = (unsigned)(vh & 0xff) >> 3;
|
||||
vb = (unsigned)((vh >> 16) & 0xff);
|
||||
vt += vb;
|
||||
p += NONWORD_LENGTH(vt, es) + 1;
|
||||
notreached(); /* DW doesn't create them yet */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -678,8 +674,8 @@ static mps_addr_t dylan_skip(mps_addr_t object)
|
|||
|
||||
if((vf & 6) == 4) /* non-word */
|
||||
{
|
||||
es = (vh & 0xff) >> 3;
|
||||
vb = (vh >> 16) & 0xff;
|
||||
es = (unsigned)(vh & 0xff) >> 3;
|
||||
vb = (unsigned)((vh >> 16) & 0xff);
|
||||
vt += vb;
|
||||
p += NONWORD_LENGTH(vt, es);
|
||||
}
|
||||
|
|
@ -844,7 +840,7 @@ mps_res_t dylan_fmt_weak(mps_fmt_t *mps_fmt_o, mps_arena_t arena)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* fmtdytst.c: DYLAN FORMAT TEST CODE
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* .readership: MPS developers, Dylan developers.
|
||||
*/
|
||||
|
|
@ -17,12 +17,6 @@
|
|||
|
||||
#define unused(param) ((void)param)
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
/* windows.h causes warnings about "unreferenced inline function */
|
||||
/* has been removed". */
|
||||
#pragma warning(disable: 4514)
|
||||
#endif /* MPS_BUILD_MV */
|
||||
|
||||
|
||||
static mps_word_t *ww = NULL;
|
||||
static mps_word_t *tvw;
|
||||
|
|
@ -222,7 +216,7 @@ mps_bool_t dylan_check(mps_addr_t addr)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* fmtno.c: NULL OBJECT FORMAT 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.
|
||||
*
|
||||
* .readership: MPS developers
|
||||
*/
|
||||
|
|
@ -17,22 +17,6 @@
|
|||
#define notreached() assert(0)
|
||||
#define unused(param) ((void)param)
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
|
||||
/* MSVC 2.0 generates a warning for unused(). */
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER < 1000
|
||||
#pragma warning(disable: 4705)
|
||||
#endif
|
||||
#else /* _MSC_VER */
|
||||
#error "Expected _MSC_VER to be defined for builder.mv"
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* windows.h causes warnings about "unreferenced inline function */
|
||||
/* has been removed". */
|
||||
#pragma warning(disable: 4514)
|
||||
|
||||
#endif /* MPS_BUILD_MV */
|
||||
|
||||
#define ALIGN sizeof(mps_word_t)
|
||||
|
||||
|
|
@ -137,7 +121,7 @@ mps_res_t no_fmt(mps_fmt_t *mps_fmt_o, mps_arena_t arena)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "mpsavm.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpslib.h"
|
||||
|
||||
#include "fmtscheme.h"
|
||||
#include "testlib.h"
|
||||
|
||||
|
|
@ -419,8 +415,9 @@ static mps_addr_t obj_isfwd(mps_addr_t addr)
|
|||
return obj->fwd2.fwd;
|
||||
case TYPE_FWD:
|
||||
return obj->fwd.fwd;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void obj_fwd(mps_addr_t old, mps_addr_t new)
|
||||
|
|
@ -467,70 +464,6 @@ void scheme_fmt(mps_fmt_t *fmt)
|
|||
if (res != MPS_RES_OK) error("Couldn't create obj format");
|
||||
}
|
||||
|
||||
static mps_gen_param_s obj_gen_params[] = {
|
||||
{ 150, 0.85 },
|
||||
{ 170, 0.45 }
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mps_res_t res;
|
||||
mps_chain_t obj_chain;
|
||||
mps_fmt_t obj_fmt;
|
||||
mps_thr_t thread;
|
||||
mps_root_t reg_root;
|
||||
void *marker = ▮
|
||||
|
||||
randomize(argc, argv);
|
||||
mps_lib_assert_fail_install(assert_die);
|
||||
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 1 << 20);
|
||||
MPS_ARGS_DONE(args);
|
||||
res = mps_arena_create_k(&scheme_arena, mps_arena_class_vm(), args);
|
||||
} MPS_ARGS_END(args);
|
||||
if (res != MPS_RES_OK) error("Couldn't create arena");
|
||||
|
||||
res = mps_chain_create(&obj_chain, scheme_arena,
|
||||
sizeof(obj_gen_params) / sizeof(*obj_gen_params),
|
||||
obj_gen_params);
|
||||
if (res != MPS_RES_OK) error("Couldn't create obj chain");
|
||||
|
||||
scheme_fmt(&obj_fmt);
|
||||
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt);
|
||||
MPS_ARGS_DONE(args);
|
||||
die(mps_pool_create_k(&obj_pool, scheme_arena, mps_class_amc(), args),
|
||||
"mps_pool_create_k");
|
||||
} MPS_ARGS_END(args);
|
||||
|
||||
res = mps_ap_create_k(&obj_ap, obj_pool, mps_args_none);
|
||||
if (res != MPS_RES_OK) error("Couldn't create obj allocation point");
|
||||
|
||||
res = mps_thread_reg(&thread, scheme_arena);
|
||||
if (res != MPS_RES_OK) error("Couldn't register thread");
|
||||
|
||||
res = mps_root_create_reg(®_root, scheme_arena, mps_rank_ambig(), 0,
|
||||
thread, mps_stack_scan_ambig, marker, 0);
|
||||
if (res != MPS_RES_OK) error("Couldn't create root");
|
||||
|
||||
test_main();
|
||||
|
||||
mps_arena_park(scheme_arena);
|
||||
mps_root_destroy(reg_root);
|
||||
mps_thread_dereg(thread);
|
||||
mps_ap_destroy(obj_ap);
|
||||
mps_pool_destroy(obj_pool);
|
||||
mps_chain_destroy(obj_chain);
|
||||
mps_fmt_destroy(obj_fmt);
|
||||
mps_arena_destroy(scheme_arena);
|
||||
|
||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
|
|
|
|||
|
|
@ -183,7 +183,8 @@ extern obj_t scheme_make_table(size_t length, hash_t hashf, cmp_t cmpf);
|
|||
extern void scheme_fmt(mps_fmt_t *fmt);
|
||||
|
||||
extern mps_arena_t scheme_arena;
|
||||
extern void test_main(void);
|
||||
extern mps_pool_t obj_pool;
|
||||
extern mps_ap_t obj_ap;
|
||||
|
||||
#endif /* fmtscheme_h */
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ DEFINE_POOL_CLASS(OOMPoolClass, this)
|
|||
{
|
||||
INHERIT_CLASS(this, AbstractAllocFreePoolClass);
|
||||
this->alloc = OOMAlloc;
|
||||
this->size = sizeof(PoolStruct);
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -149,11 +151,6 @@ allocFail:
|
|||
}
|
||||
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
|
||||
|
||||
|
||||
/* randomSizeAligned -- produce sizes both large and small,
|
||||
* aligned by platform alignment */
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# gc.gmk: GNUMAKEFILE FRAGMENT FOR GNU CC
|
||||
#
|
||||
# $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.
|
||||
#
|
||||
# This file is included by platform makefiles that use the GNU CC
|
||||
# compiler. It defines the compiler-specific variables that the
|
||||
|
|
@ -12,11 +12,22 @@
|
|||
CC = gcc
|
||||
CFLAGSDEBUG = -O -g3
|
||||
CFLAGSOPT = -O2 -g3
|
||||
CFLAGSCOMPILER := -Wall -Wextra -Werror -Wpointer-arith \
|
||||
-Wstrict-prototypes -Wmissing-prototypes \
|
||||
-Winline -Waggregate-return -Wnested-externs \
|
||||
-Wcast-qual -Wshadow -Wwrite-strings # -Wstrict-aliasing=2
|
||||
CFLAGSCOMPILERSTRICT := -ansi -pedantic -Wshadow
|
||||
CFLAGSCOMPILER := \
|
||||
-Waggregate-return \
|
||||
-Wall \
|
||||
-Wcast-qual \
|
||||
-Werror \
|
||||
-Wextra \
|
||||
-Winline \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs \
|
||||
-Wpointer-arith \
|
||||
-Wshadow \
|
||||
-Wstrict-aliasing=2 \
|
||||
-Wstrict-prototypes \
|
||||
-Wswitch-default \
|
||||
-Wwrite-strings
|
||||
CFLAGSCOMPILERSTRICT := -ansi -pedantic
|
||||
|
||||
# A different set of compiler flags for less strict compilation, for
|
||||
# instance when we need to #include a third-party header file that
|
||||
|
|
@ -38,7 +49,7 @@ endef
|
|||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
#
|
||||
# Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# All rights reserved. This is an open source license. Contact
|
||||
# Ravenbrook for commercial licensing options.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -331,8 +331,8 @@ int main(int argc, char *argv[]) {
|
|||
double mort = 0.0;
|
||||
cap = (size_t)strtoul(optarg, &p, 10);
|
||||
switch(toupper(*p)) {
|
||||
case 'G': cap *= 1024;
|
||||
case 'M': cap *= 1024;
|
||||
case 'G': cap *= 1024; /* fall through */
|
||||
case 'M': cap *= 1024; /* fall through */
|
||||
case 'K': p++; break;
|
||||
default: cap = 0; break;
|
||||
}
|
||||
|
|
@ -356,6 +356,10 @@ int main(int argc, char *argv[]) {
|
|||
case 'G': arenasize *= 1024;
|
||||
case 'M': arenasize *= 1024;
|
||||
case 'K': arenasize *= 1024; break;
|
||||
case '\0': break;
|
||||
default:
|
||||
fprintf(stderr, "Bad arena size %s\n", optarg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,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);
|
||||
|
||||
|
|
@ -134,16 +134,17 @@ 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);
|
||||
/* <code/global.c#remembered.summary> 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);
|
||||
if (arena->enabledMessageTypes != NULL)
|
||||
CHECKD_NOSIG(BT, arena->enabledMessageTypes);
|
||||
CHECKL(BoolCheck(arena->isFinalPool));
|
||||
if (arena->isFinalPool) {
|
||||
CHECKD(Pool, arena->finalPool);
|
||||
|
|
@ -151,7 +152,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);
|
||||
|
|
@ -185,8 +186,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);
|
||||
|
|
@ -208,6 +209,8 @@ Bool GlobalsCheck(Globals arenaGlobals)
|
|||
|
||||
/* we also check the statics now. <design/arena/#static.check> */
|
||||
CHECKL(BoolCheck(arenaRingInit));
|
||||
/* Can't CHECKD_NOSIG here because &arenaRing is never NULL and GCC
|
||||
* will warn about a constant comparison. */
|
||||
CHECKL(RingCheck(&arenaRing));
|
||||
|
||||
CHECKL(BoolCheck(arena->emergency));
|
||||
|
|
@ -610,7 +613,7 @@ Bool ArenaAccess(Addr addr, AccessSet mode, MutatorFaultContext context)
|
|||
|
||||
arenaClaimRingLock(); /* <design/arena/#lock.ring> */
|
||||
mps_exception_info = context;
|
||||
AVER(RingCheck(&arenaRing));
|
||||
AVERT(Ring, &arenaRing);
|
||||
|
||||
RING_FOR(node, &arenaRing, nextNode) {
|
||||
Globals arenaGlobals = RING_ELT(Globals, globalRing, node);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# ll.gmk: GNUMAKEFILE FRAGMENT FOR CLANG/LLVM
|
||||
#
|
||||
# $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.
|
||||
#
|
||||
# This file is included by platform makefiles that use the Clang/LLVM
|
||||
# compiler. It defines the compiler-specific variables that the
|
||||
|
|
@ -12,11 +12,24 @@
|
|||
CC = clang
|
||||
CFLAGSDEBUG = -O -g3
|
||||
CFLAGSOPT = -O2 -g3
|
||||
CFLAGSCOMPILER := -Wall -Werror -Wpointer-arith \
|
||||
-Wstrict-prototypes -Wmissing-prototypes \
|
||||
-Winline -Waggregate-return -Wnested-externs \
|
||||
-Wcast-qual -Wshadow # -Wstrict-aliasing=2
|
||||
CFLAGSCOMPILERSTRICT := -pedantic -Wno-extended-offsetof
|
||||
CFLAGSCOMPILER := \
|
||||
-pedantic \
|
||||
-Waggregate-return \
|
||||
-Wall \
|
||||
-Wcast-qual \
|
||||
-Werror \
|
||||
-Wextra \
|
||||
-Winline \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs \
|
||||
-Wno-extended-offsetof \
|
||||
-Wpointer-arith \
|
||||
-Wshadow \
|
||||
-Wstrict-aliasing=2 \
|
||||
-Wstrict-prototypes \
|
||||
-Wunreachable-code \
|
||||
-Wwrite-strings
|
||||
CFLAGSCOMPILERSTRICT :=
|
||||
|
||||
# A different set of compiler flags for less strict compilation, for
|
||||
# instance when we need to #include a third-party header file that
|
||||
|
|
@ -38,7 +51,7 @@ endef
|
|||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
#
|
||||
# Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# All rights reserved. This is an open source license. Contact
|
||||
# Ravenbrook for commercial licensing options.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ static void poolStatInit(PoolStat stat, mps_pool_t pool, size_t objSize)
|
|||
static void allocMultiple(PoolStat stat)
|
||||
{
|
||||
mps_addr_t objects[allocsPerIteration];
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* allocate a few objects, and record stats for them */
|
||||
for (i = 0; i < allocsPerIteration; i++) {
|
||||
|
|
@ -131,8 +131,7 @@ static void allocMultiple(PoolStat stat)
|
|||
|
||||
static void reportResults(PoolStat stat, const char *name)
|
||||
{
|
||||
printf("\nResults for ");
|
||||
fputs(name, stdout);
|
||||
printf("\nResults for %s\n", name);
|
||||
printf("\n");
|
||||
printf(" Allocated %"PRIuLONGEST" objects\n", (ulongest_t)stat->aCount);
|
||||
printf(" Freed %"PRIuLONGEST" objects\n", (ulongest_t)stat->fCount);
|
||||
|
|
@ -198,7 +197,6 @@ int main(int argc, char *argv[])
|
|||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, testArenaSIZE);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_ZONED, FALSE);
|
||||
MPS_ARGS_DONE(args);
|
||||
die(mps_arena_create_k(&arena, mps_arena_class_vm(), args),
|
||||
"mps_arena_create");
|
||||
} MPS_ARGS_END(args);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
*/
|
||||
|
||||
#include <stdlib.h> /* malloc */
|
||||
|
||||
#include "mpm.h"
|
||||
#include "testlib.h"
|
||||
#include "mpslib.h"
|
||||
|
|
@ -84,8 +86,10 @@ int main(int argc, char *argv[])
|
|||
for(i = 0; i < nTHREADS; i++)
|
||||
t[i] = CreateThread(NULL, 0, thread0, NULL, 0, &id);
|
||||
|
||||
for(i = 0; i < nTHREADS; i++)
|
||||
WaitForSingleObject(t[i], INFINITE);
|
||||
for(i = 0; i < nTHREADS; i++) {
|
||||
cdie(WaitForSingleObject(t[i], INFINITE) == WAIT_OBJECT_0,
|
||||
"WaitForSingleObject");
|
||||
}
|
||||
|
||||
Insist(shared == nTHREADS*COUNT);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* locus.c: LOCUS 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
|
||||
*
|
||||
|
|
@ -43,7 +43,7 @@ SegPref SegPrefDefault(void)
|
|||
|
||||
void SegPrefInit(SegPref pref)
|
||||
{
|
||||
mps_lib_memcpy(pref, &segPrefDefault, sizeof(SegPrefStruct));
|
||||
(void)mps_lib_memcpy(pref, &segPrefDefault, sizeof(SegPrefStruct));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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) {
|
||||
|
|
@ -370,7 +370,7 @@ Res ChainCondemnAll(Chain chain, Trace trace)
|
|||
Ring segNode, nextSegNode;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
AVER((pool->class->attr & AttrGC) != 0);
|
||||
AVER(PoolHasAttr(pool, AttrGC));
|
||||
RING_FOR(segNode, PoolSegRing(pool), nextSegNode) {
|
||||
Seg seg = SegOfPoolRing(segNode);
|
||||
|
||||
|
|
@ -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,14 +501,14 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ static void poolStatInit(PoolStat stat, mps_pool_t pool, size_t objSize)
|
|||
static mps_res_t allocMultiple(PoolStat stat)
|
||||
{
|
||||
mps_addr_t objects[contigAllocs];
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* allocate a few objects, and record stats for them */
|
||||
for (i = 0; i < contigAllocs; i++) {
|
||||
|
|
@ -220,7 +220,6 @@ static void runArenaTest(size_t size,
|
|||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_ZONED, FALSE);
|
||||
MPS_ARGS_DONE(args);
|
||||
die(mps_arena_create_k(&arena, mps_arena_class_vm(), args),
|
||||
"mps_arena_create");
|
||||
} MPS_ARGS_END(args);
|
||||
|
|
|
|||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -178,11 +178,13 @@ extern Bool PoolClassCheck(PoolClass class);
|
|||
extern Bool PoolCheck(Pool pool);
|
||||
extern Res PoolDescribe(Pool pool, mps_lib_FILE *stream);
|
||||
|
||||
/* Must be thread-safe. See <design/interface-c/#thread-safety>. */
|
||||
#define PoolArena(pool) ((pool)->arena)
|
||||
#define PoolAlignment(pool) ((pool)->alignment)
|
||||
#define PoolSegRing(pool) (&(pool)->segRing)
|
||||
#define PoolArenaRing(pool) (&(pool)->arenaRing)
|
||||
#define PoolOfArenaRing(node) RING_ELT(Pool, arenaRing, node)
|
||||
#define PoolHasAttr(pool, Attr) (((pool)->class->attr & (Attr)) != 0)
|
||||
|
||||
extern Bool PoolFormat(Format *formatReturn, Pool pool);
|
||||
|
||||
|
|
@ -263,10 +265,11 @@ extern Res PoolTrivFramePush(AllocFrame *frameReturn, Pool pool, Buffer buf);
|
|||
extern Res PoolNoFramePop(Pool pool, Buffer buf, AllocFrame frame);
|
||||
extern Res PoolTrivFramePop(Pool pool, Buffer buf, AllocFrame frame);
|
||||
extern void PoolNoFramePopPending(Pool pool, Buffer buf, AllocFrame frame);
|
||||
extern void PoolTrivFramePopPending(Pool pool, Buffer buf, AllocFrame frame);
|
||||
extern Res PoolNoAddrObject(Addr *pReturn, Pool pool, Seg seg, Addr addr);
|
||||
extern void PoolNoWalk(Pool pool, Seg seg, FormattedObjectsStepMethod step,
|
||||
void *p, size_t s);
|
||||
extern void PoolNoFreeWalk(Pool pool, FreeBlockStepMethod f, void *p);
|
||||
extern void PoolTrivFreeWalk(Pool pool, FreeBlockStepMethod f, void *p);
|
||||
extern PoolDebugMixin PoolNoDebugMixin(Pool pool);
|
||||
extern BufferClass PoolNoBufferClass(void);
|
||||
|
||||
|
|
@ -1009,9 +1012,6 @@ extern void StackProbe(Size depth);
|
|||
* STATISTIC_WRITE is inserted in WriteF arguments to output the values
|
||||
* of statistic fields.
|
||||
*
|
||||
* STATISTIC_BEGIN and STATISTIC_END can be used around a block of
|
||||
* statements.
|
||||
*
|
||||
* .statistic.whitehot: The implementation of STATISTIC for
|
||||
* non-statistical varieties passes the parameter to DISCARD to ensure
|
||||
* the parameter is syntactically an expression. The parameter is
|
||||
|
|
@ -1023,16 +1023,12 @@ extern void StackProbe(Size depth);
|
|||
#define STATISTIC(gather) BEGIN (gather); END
|
||||
#define STATISTIC_STAT(gather) BEGIN gather; END
|
||||
#define STATISTIC_WRITE(format, arg) (format), (arg),
|
||||
#define STATISTIC_BEGIN BEGIN
|
||||
#define STATISTIC_END END
|
||||
|
||||
#elif defined(STATISTICS_NONE)
|
||||
|
||||
#define STATISTIC(gather) DISCARD(((gather), 0))
|
||||
#define STATISTIC_STAT DISCARD_STAT
|
||||
#define STATISTIC_WRITE(format, arg)
|
||||
#define STATISTIC_BEGIN BEGIN if (0) {
|
||||
#define STATISTIC_END } END
|
||||
|
||||
#else /* !defined(STATISTICS) && !defined(STATISTICS_NONE) */
|
||||
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ extern mps_class_t PoolClassMFS(void);
|
|||
|
||||
/* stress -- create a pool of the requested type and allocate in it */
|
||||
|
||||
static mps_res_t stress(mps_class_t class, size_t (*size)(int i),
|
||||
static mps_res_t stress(mps_class_t class, size_t (*size)(size_t i),
|
||||
mps_arena_t arena, ...)
|
||||
{
|
||||
mps_res_t res;
|
||||
mps_pool_t pool;
|
||||
va_list arg;
|
||||
int i, k;
|
||||
size_t i, k;
|
||||
int *ps[testSetSIZE];
|
||||
size_t ss[testSetSIZE];
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(int i),
|
|||
for (k=0; k<testLOOPS; ++k) {
|
||||
/* shuffle all the objects */
|
||||
for (i=0; i<testSetSIZE; ++i) {
|
||||
unsigned j = rnd()%(unsigned)(testSetSIZE-i);
|
||||
size_t j = rnd()%(testSetSIZE-i);
|
||||
void *tp;
|
||||
size_t ts;
|
||||
|
||||
|
|
@ -92,14 +92,9 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(int i),
|
|||
}
|
||||
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
|
||||
|
||||
|
||||
/* randomSize -- produce sizes both latge and small */
|
||||
|
||||
static size_t randomSize(int i)
|
||||
static size_t randomSize(size_t i)
|
||||
{
|
||||
/* Make the range large enough to span three pages in the segment table: */
|
||||
/* 160 segments/page, page size max 0x2000. */
|
||||
|
|
@ -111,7 +106,7 @@ static size_t randomSize(int i)
|
|||
|
||||
/* randomSize8 -- produce sizes both latge and small, 8-byte aligned */
|
||||
|
||||
static size_t randomSize8(int i)
|
||||
static size_t randomSize8(size_t i)
|
||||
{
|
||||
size_t maxSize = 2 * 160 * 0x2000;
|
||||
/* Reduce by a factor of 2 every 10 cycles. Total allocation about 40 MB. */
|
||||
|
|
@ -123,23 +118,16 @@ static size_t randomSize8(int i)
|
|||
|
||||
static size_t fixedSizeSize = 0;
|
||||
|
||||
static size_t fixedSize(int i)
|
||||
static size_t fixedSize(size_t i)
|
||||
{
|
||||
testlib_unused(i);
|
||||
return fixedSizeSize;
|
||||
}
|
||||
|
||||
|
||||
static mps_pool_debug_option_s bothOptions8 = {
|
||||
/* .fence_template = */ (const void *)"postpost",
|
||||
/* .fence_size = */ 8,
|
||||
/* .free_template = */ (const void *)"DEAD",
|
||||
/* .free_size = */ 4
|
||||
};
|
||||
|
||||
static mps_pool_debug_option_s bothOptions16 = {
|
||||
static mps_pool_debug_option_s bothOptions = {
|
||||
/* .fence_template = */ (const void *)"postpostpostpost",
|
||||
/* .fence_size = */ 16,
|
||||
/* .fence_size = */ MPS_PF_ALIGN,
|
||||
/* .free_template = */ (const void *)"DEAD",
|
||||
/* .free_size = */ 4
|
||||
};
|
||||
|
|
@ -153,7 +141,7 @@ static mps_pool_debug_option_s fenceOptions = {
|
|||
|
||||
/* testInArena -- test all the pool classes in the given arena */
|
||||
|
||||
static int testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
|
||||
static void testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
|
||||
{
|
||||
/* IWBN to test MVFFDebug, but the MPS doesn't support debugging */
|
||||
/* cross-segment allocation (possibly MVFF ought not to). */
|
||||
|
|
@ -176,23 +164,18 @@ static int testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
|
|||
die(stress(mps_class_mv(), randomSize, arena,
|
||||
(size_t)65536, (size_t)32, (size_t)65536),
|
||||
"stress MV");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mps_arena_t arena;
|
||||
mps_pool_debug_option_s *bothOptions;
|
||||
|
||||
bothOptions = MPS_PF_ALIGN == 8 ? &bothOptions8 : &bothOptions16;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
|
||||
"mps_arena_create");
|
||||
testInArena(arena, bothOptions);
|
||||
testInArena(arena, &bothOptions);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), smallArenaSIZE),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* mpmtypes.h: MEMORY POOL MANAGER TYPES
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2002, 2006 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
* Portions copyright (c) 2001 Global Graphics Software.
|
||||
*
|
||||
* .design: <design/type/>
|
||||
|
|
@ -41,7 +41,7 @@ typedef unsigned Shift; /* <design/type/#shift> */
|
|||
typedef unsigned Serial; /* <design/type/#serial> */
|
||||
typedef Addr Ref; /* <design/type/#ref> */
|
||||
typedef void *Pointer; /* <design/type/#pointer> */
|
||||
typedef Word Clock; /* processor time */
|
||||
typedef Word Clock; /* <design/type/#clock> */
|
||||
typedef MPS_T_ULONGEST ULongest; /* <design/type/#ulongest> */
|
||||
|
||||
typedef mps_arg_s ArgStruct;
|
||||
|
|
@ -60,7 +60,6 @@ typedef unsigned TraceSet; /* <design/trace/> */
|
|||
typedef unsigned TraceState; /* <design/trace/> */
|
||||
typedef unsigned AccessSet; /* <design/type/#access-set> */
|
||||
typedef unsigned Attr; /* <design/type/#attr> */
|
||||
typedef unsigned FormatVariety;
|
||||
typedef int RootVar; /* <design/type/#rootvar> */
|
||||
|
||||
typedef Word *BT; /* <design/bt/> */
|
||||
|
|
@ -300,16 +299,6 @@ typedef struct TraceMessageStruct *TraceMessage; /* trace end */
|
|||
AttrGC | AttrINCR_RB | AttrINCR_WB | AttrMOVINGGC)
|
||||
|
||||
|
||||
/* Format varieties */
|
||||
enum {
|
||||
FormatVarietyA = 1,
|
||||
FormatVarietyB,
|
||||
FormatVarietyAutoHeader,
|
||||
FormatVarietyFixed,
|
||||
FormatVarietyLIMIT
|
||||
};
|
||||
|
||||
|
||||
/* Segment preferences */
|
||||
enum {
|
||||
SegPrefHigh = 1,
|
||||
|
|
@ -465,7 +454,7 @@ typedef double WriteFD;
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002, 2006 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -207,8 +207,8 @@
|
|||
#include "protw3.c" /* Windows protection */
|
||||
#include "proti3.c" /* 32-bit Intel mutator context decoding */
|
||||
#include "prmci3w3.c" /* Windows on 32-bit Intel mutator context */
|
||||
#include "ssw3i3mv.c" /* Windows on 32-bit stack scan for Microsoft C */
|
||||
#include "spw3i3mv.c" /* Windows on 32-bit stack probe for Microsoft C */
|
||||
#include "ssw3i3mv.c" /* Windows on 32-bit Intel stack scan for Microsoft C */
|
||||
#include "spw3i3.c" /* Windows on 32-bit Intel stack probe */
|
||||
#include "mpsiw3.c" /* Windows interface layer extras */
|
||||
|
||||
/* Windows on 64-bit Intel with Microsoft Visual Studio */
|
||||
|
|
@ -223,8 +223,38 @@
|
|||
#include "protw3.c" /* Windows protection */
|
||||
#include "proti6.c" /* 64-bit Intel mutator context decoding */
|
||||
#include "prmci6w3.c" /* Windows on 64-bit Intel mutator context */
|
||||
#include "ssw3i6mv.c" /* Windows on 64-bit stack scan for Microsoft C */
|
||||
#include "spw3i6mv.c" /* Windows on 64-bit stack probe for Microsoft C */
|
||||
#include "ssw3i6mv.c" /* Windows on 64-bit Intel stack scan for Microsoft C */
|
||||
#include "spw3i6.c" /* Windows on 64-bit Intel stack probe */
|
||||
#include "mpsiw3.c" /* Windows interface layer extras */
|
||||
|
||||
/* Windows on 32-bit Intel with Pelles C */
|
||||
|
||||
#elif defined(MPS_PF_W3I3PC)
|
||||
|
||||
#include "lockw3.c" /* Windows locks */
|
||||
#include "thw3.c" /* Windows threading */
|
||||
#include "thw3i3.c" /* Windows on 32-bit Intel thread stack scan */
|
||||
#include "vmw3.c" /* Windows virtual memory */
|
||||
#include "protw3.c" /* Windows protection */
|
||||
#include "proti3.c" /* 32-bit Intel mutator context decoding */
|
||||
#include "prmci3w3.c" /* Windows on 32-bit Intel mutator context */
|
||||
#include "ssw3i3pc.c" /* Windows on 32-bit stack scan for Pelles C */
|
||||
#include "spw3i3.c" /* 32-bit Intel stack probe */
|
||||
#include "mpsiw3.c" /* Windows interface layer extras */
|
||||
|
||||
/* Windows on 64-bit Intel with Pelles C */
|
||||
|
||||
#elif defined(MPS_PF_W3I6PC)
|
||||
|
||||
#include "lockw3.c" /* Windows locks */
|
||||
#include "thw3.c" /* Windows threading */
|
||||
#include "thw3i6.c" /* Windows on 64-bit Intel thread stack scan */
|
||||
#include "vmw3.c" /* Windows virtual memory */
|
||||
#include "protw3.c" /* Windows protection */
|
||||
#include "proti6.c" /* 64-bit Intel mutator context decoding */
|
||||
#include "prmci6w3.c" /* Windows on 64-bit Intel mutator context */
|
||||
#include "ssw3i6pc.c" /* Windows on 64-bit stack scan for Pelles C */
|
||||
#include "spw3i6.c" /* 64-bit Intel stack probe */
|
||||
#include "mpsiw3.c" /* Windows interface layer extras */
|
||||
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -191,6 +191,9 @@ extern const struct mps_key_s _mps_key_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
|
||||
|
||||
extern const struct mps_key_s _mps_key_vmw3_top_down;
|
||||
#define MPS_KEY_VMW3_TOP_DOWN (&_mps_key_vmw3_top_down)
|
||||
|
|
|
|||
|
|
@ -5026,29 +5026,24 @@
|
|||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.4;
|
||||
OTHER_CFLAGS = (
|
||||
"-pedantic",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wwrite-strings",
|
||||
"-Wno-extended-offsetof",
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
SYMROOT = xc;
|
||||
WARNING_CFLAGS = (
|
||||
"-pedantic",
|
||||
"-Wpointer-arith",
|
||||
"-Wstrict-prototypes",
|
||||
"-Wmissing-prototypes",
|
||||
"-Winline",
|
||||
"-Waggregate-return",
|
||||
"-Wnested-externs",
|
||||
"-Wcast-qual",
|
||||
"-Wshadow",
|
||||
"-Wall",
|
||||
"-Wcast-qual",
|
||||
"-Wextra",
|
||||
"-Wwrite-strings",
|
||||
"-Winline",
|
||||
"-Wmissing-prototypes",
|
||||
"-Wnested-externs",
|
||||
"-Wno-extended-offsetof",
|
||||
"-Wpointer-arith",
|
||||
"-Wshadow",
|
||||
"-Wstrict-aliasing=2",
|
||||
"-Wstrict-prototypes",
|
||||
"-Wunreachable-code",
|
||||
"-Wwrite-strings",
|
||||
);
|
||||
};
|
||||
name = RASH;
|
||||
|
|
@ -5470,29 +5465,24 @@
|
|||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.4;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-pedantic",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wwrite-strings",
|
||||
"-Wno-extended-offsetof",
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
SYMROOT = xc;
|
||||
WARNING_CFLAGS = (
|
||||
"-pedantic",
|
||||
"-Wpointer-arith",
|
||||
"-Wstrict-prototypes",
|
||||
"-Wmissing-prototypes",
|
||||
"-Winline",
|
||||
"-Waggregate-return",
|
||||
"-Wnested-externs",
|
||||
"-Wcast-qual",
|
||||
"-Wshadow",
|
||||
"-Wall",
|
||||
"-Wcast-qual",
|
||||
"-Wextra",
|
||||
"-Wwrite-strings",
|
||||
"-Winline",
|
||||
"-Wmissing-prototypes",
|
||||
"-Wnested-externs",
|
||||
"-Wno-extended-offsetof",
|
||||
"-Wpointer-arith",
|
||||
"-Wshadow",
|
||||
"-Wstrict-aliasing=2",
|
||||
"-Wstrict-prototypes",
|
||||
"-Wunreachable-code",
|
||||
"-Wwrite-strings",
|
||||
);
|
||||
};
|
||||
name = Debug;
|
||||
|
|
@ -5528,29 +5518,24 @@
|
|||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.4;
|
||||
OTHER_CFLAGS = (
|
||||
"-pedantic",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wwrite-strings",
|
||||
"-Wno-extended-offsetof",
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
SYMROOT = xc;
|
||||
WARNING_CFLAGS = (
|
||||
"-pedantic",
|
||||
"-Wpointer-arith",
|
||||
"-Wstrict-prototypes",
|
||||
"-Wmissing-prototypes",
|
||||
"-Winline",
|
||||
"-Waggregate-return",
|
||||
"-Wnested-externs",
|
||||
"-Wcast-qual",
|
||||
"-Wshadow",
|
||||
"-Wall",
|
||||
"-Wcast-qual",
|
||||
"-Wextra",
|
||||
"-Wwrite-strings",
|
||||
"-Winline",
|
||||
"-Wmissing-prototypes",
|
||||
"-Wnested-externs",
|
||||
"-Wno-extended-offsetof",
|
||||
"-Wpointer-arith",
|
||||
"-Wshadow",
|
||||
"-Wstrict-aliasing=2",
|
||||
"-Wstrict-prototypes",
|
||||
"-Wunreachable-code",
|
||||
"-Wwrite-strings",
|
||||
);
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* mpsi.c: MEMORY POOL SYSTEM C INTERFACE LAYER
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* .purpose: This code bridges between the MPS interface to C,
|
||||
|
|
@ -46,11 +46,6 @@
|
|||
#include "mpm.h"
|
||||
#include "mps.h"
|
||||
#include "sac.h"
|
||||
#include "chain.h"
|
||||
|
||||
/* TODO: Remove these includes when varargs support is removed. */
|
||||
#include "mpsacl.h"
|
||||
#include "mpsavm.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
|
@ -459,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);
|
||||
|
||||
|
|
@ -657,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);
|
||||
|
||||
|
|
@ -1737,12 +1732,12 @@ mps_word_t mps_telemetry_control(mps_word_t resetMask, mps_word_t flipMask)
|
|||
|
||||
void mps_telemetry_set(mps_word_t setMask)
|
||||
{
|
||||
EventControl((Word)setMask, (Word)setMask);
|
||||
(void)EventControl((Word)setMask, (Word)setMask);
|
||||
}
|
||||
|
||||
void mps_telemetry_reset(mps_word_t resetMask)
|
||||
{
|
||||
EventControl((Word)resetMask, 0);
|
||||
(void)EventControl((Word)resetMask, 0);
|
||||
}
|
||||
|
||||
mps_word_t mps_telemetry_get(void)
|
||||
|
|
@ -1935,7 +1930,7 @@ void mps_chain_destroy(mps_chain_t chain)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -94,8 +94,6 @@ struct tlonglong {
|
|||
|
||||
/* alignmentTest -- test default alignment is acceptable */
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
static void alignmentTest(mps_arena_t arena)
|
||||
{
|
||||
mps_pool_t pool;
|
||||
|
|
@ -404,7 +402,7 @@ static void *test(void *arg, size_t s)
|
|||
|
||||
if (rnd() & 1) {
|
||||
printf("Using auto_header format.\n");
|
||||
EnsureHeaderFormat(&format, arena);
|
||||
die(EnsureHeaderFormat(&format, arena), "EnsureHeaderFormat");
|
||||
ap_headerSIZE = headerSIZE; /* from fmthe.h */
|
||||
} else {
|
||||
printf("Using normal format (no implicit object header: client pointers point at start of storage).\n");
|
||||
|
|
@ -518,7 +516,8 @@ static void *test(void *arg, size_t s)
|
|||
|
||||
if (rnd() % patternFREQ == 0) {
|
||||
switch(rnd() % 4) {
|
||||
case 0: case 1:
|
||||
case 0: /* fall through */
|
||||
case 1:
|
||||
die(mps_ap_alloc_pattern_begin(ap, ramp), "alloc_pattern_begin");
|
||||
++rampCount;
|
||||
break;
|
||||
|
|
@ -530,7 +529,7 @@ static void *test(void *arg, size_t s)
|
|||
--rampCount;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
die(mps_ap_alloc_pattern_reset(ap), "alloc_pattern_reset");
|
||||
rampCount = 0;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ static void mps_lib_assert_fail_default(const char *file,
|
|||
unsigned line,
|
||||
const char *condition)
|
||||
{
|
||||
fflush(stdout); /* synchronize */
|
||||
fprintf(stderr, "%s:%u: MPS ASSERTION FAILED: %s\n", file, line, condition);
|
||||
fflush(stderr); /* make sure the message is output */
|
||||
(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 */
|
||||
ASSERT_ABORT(); /* see config.h */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,12 @@
|
|||
* Alignment of 4 would work, but the MS library uses 8 bytes for
|
||||
* doubles and __int64, so we choose that. The actual granularity of
|
||||
* VC malloc is 16!
|
||||
*
|
||||
* PellesC /Ze (Microsoft compatibility mode) defines _MSC_VER but
|
||||
* isn't compatible enough for MPS purposes.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) && defined(_WIN32) && defined(_M_IX86)
|
||||
#if defined(_MSC_VER) && defined(_WIN32) && defined(_M_IX86) && !defined(__POCC__)
|
||||
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3MV)
|
||||
#error "specified CONFIG_PF_... inconsistent with detected w3i3mv"
|
||||
#endif
|
||||
|
|
@ -58,7 +61,7 @@
|
|||
* <http://msdn.microsoft.com/en-us/library/ms235286>
|
||||
*/
|
||||
|
||||
#elif defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64)
|
||||
#elif defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64) && !defined(__POCC__)
|
||||
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I6MV)
|
||||
#error "specified CONFIG_PF_... inconsistent with detected w3i6mv"
|
||||
#endif
|
||||
|
|
@ -74,6 +77,47 @@
|
|||
#define MPS_PF_ALIGN 16
|
||||
|
||||
|
||||
/* PellesC version 7.00.25 with /Ze option (Microsoft compatibility mode)
|
||||
* Help node "Predefined preprocessor symbols (POCC)"
|
||||
*/
|
||||
|
||||
#elif defined(__POCC__) && defined(_WIN32) && defined(_M_IX86)
|
||||
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3PC)
|
||||
#error "specified CONFIG_PF_... inconsistent with detected w3i3pc"
|
||||
#endif
|
||||
#define MPS_PF_W3I3PC
|
||||
#define MPS_PF_STRING "w3i3pc"
|
||||
#define MPS_OS_W3
|
||||
#define MPS_ARCH_I3
|
||||
#define MPS_BUILD_PC
|
||||
#define MPS_T_WORD unsigned long
|
||||
#define MPS_T_ULONGEST unsigned long
|
||||
#define MPS_WORD_WIDTH 32
|
||||
#define MPS_WORD_SHIFT 5
|
||||
#define MPS_PF_ALIGN 8
|
||||
|
||||
|
||||
/* PellesC version 7.00.25 with /Ze option (Microsoft compatibility mode)
|
||||
* and /Tarm64-coff (Create a COFF object file for a X64 processor).
|
||||
* Help node "Predefined preprocessor symbols (POCC)"
|
||||
*/
|
||||
|
||||
#elif defined(__POCC__) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64)
|
||||
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I6PC)
|
||||
#error "specified CONFIG_PF_... inconsistent with detected w3i6pc"
|
||||
#endif
|
||||
#define MPS_PF_W3I6PC
|
||||
#define MPS_PF_STRING "w3i6pc"
|
||||
#define MPS_OS_W3
|
||||
#define MPS_ARCH_I6
|
||||
#define MPS_BUILD_PC
|
||||
#define MPS_T_WORD unsigned __int64
|
||||
#define MPS_T_ULONGEST unsigned __int64
|
||||
#define MPS_WORD_WIDTH 64
|
||||
#define MPS_WORD_SHIFT 6
|
||||
#define MPS_PF_ALIGN 16
|
||||
|
||||
|
||||
/* GCC 4.0.1 (As supplied by Apple on Mac OS X 10.4.8 on an Intel Mac),
|
||||
* gcc -E -dM
|
||||
* And above for xcppgc.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#define mpsw3_h
|
||||
|
||||
#include "mps.h" /* needed for mps_tramp_t */
|
||||
#include <windows.h> /* needed for SEH filter */
|
||||
#include "mpswin.h" /* needed for SEH filter */
|
||||
|
||||
|
||||
extern LONG mps_SEH_filter(LPEXCEPTION_POINTERS, void **, size_t *);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* mpswin.h: RAVENBROOK MEMORY POOL SYSTEM WINDOWS.H 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.
|
||||
*
|
||||
* .readership: For MPS client application developers, MPS developers.
|
||||
*
|
||||
|
|
@ -11,29 +11,18 @@
|
|||
#ifndef mpswin_h
|
||||
#define mpswin_h
|
||||
|
||||
/* Suppress Visual C warnings from windows.h at warning level 4. */
|
||||
#ifdef MPS_BUILD_MV
|
||||
#pragma warning(disable: 4115 4201 4209 4214)
|
||||
#endif
|
||||
|
||||
/* Speed up the build process by excluding parts of windows.h that we
|
||||
* don't use. See <http://support.microsoft.com/kb/166474> */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
#pragma warning(default: 4115 4201 4209 4214)
|
||||
/* windows.h might also cause warnings about "unreferenced inline
|
||||
* function has been removed". In Visual C, these can be turned off:
|
||||
* #pragma warning(disable: 4514)
|
||||
* But they are generated at the end of the compilation, so you have
|
||||
* to turn them off permanently.
|
||||
*/
|
||||
#endif
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#endif /* mpswin_h */
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
78
mps/code/mv.nmk
Normal file
78
mps/code/mv.nmk
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# -*- makefile -*-
|
||||
#
|
||||
# mv.nmk: NMAKE FRAGMENT FOR MICROSOFT VISUAL C/C++
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||
#
|
||||
# This file is included by platform nmake files that use the Microsoft
|
||||
# Visual C/C+ compiler. It defines the compiler-specific variables
|
||||
# that the common nmake file fragment (<code/commpost.nmk>) requires.
|
||||
|
||||
CC = cl
|
||||
LIBMAN = lib
|
||||
LINKER = link
|
||||
|
||||
# /D_CRT_SECURE_NO_WARNINGS suppresses "This function or variable may
|
||||
# be unsafe" warnings for standard C library functions fopen, getenv,
|
||||
# snprintf, sscanf, strcpy, and so on.
|
||||
#
|
||||
# /Gs appears to be necessary to suppress stack checks. Stack checks
|
||||
# (if not suppressed) generate a dependency on the C library, __chkesp,
|
||||
# which causes the linker step to fail when building the DLL, mpsdy.dll.
|
||||
CFLAGSCOMMONPRE = $(CFLAGSCOMMONPRE) /D_CRT_SECURE_NO_WARNINGS /W4 /WX /Gs /Fd$(PFM)\$(VARIETY)
|
||||
LIBFLAGSCOMMON = $(LIBFLAGSCOMMON) /nologo
|
||||
|
||||
# /MD means compile for multi-threaded environment with separate C library DLL.
|
||||
# /MT means compile for multi-threaded environment.
|
||||
# /ML means compile for single-threaded environment.
|
||||
# A 'd' at the end means compile for debugging.
|
||||
CRTFLAGSHOT = $(CRTFLAGSHOT) /MT
|
||||
CRTFLAGSCOOL = $(CRTFLAGSCOOL) /MTd
|
||||
|
||||
CFLAGSCOOL = $(CFLAGSCOOL) /Od
|
||||
|
||||
LINKFLAGSCOMMON = $(LINKFLAGSCOMMON) /PDB:$*.pdb
|
||||
LINKFLAGSHOT = $(LINKFLAGSHOT) libcmt.lib
|
||||
LINKFLAGSCOOL = $(LINKFLAGSCOOL) libcmtd.lib
|
||||
|
||||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
#
|
||||
# Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# 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.
|
||||
|
|
@ -38,11 +38,9 @@ static double expdev(void)
|
|||
}
|
||||
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
static size_t min;
|
||||
static size_t mean;
|
||||
static size_t max;
|
||||
static size_t size_min;
|
||||
static size_t size_mean;
|
||||
static size_t size_max;
|
||||
static int verbose = 0;
|
||||
static mps_pool_t pool;
|
||||
|
||||
|
|
@ -50,8 +48,8 @@ static size_t randomSize(unsigned long i)
|
|||
{
|
||||
/* Distribution centered on mean. Verify that allocations
|
||||
below min and above max are handled correctly */
|
||||
size_t s = (max - mean)/4;
|
||||
size_t m = mean;
|
||||
size_t s = (size_max - size_mean)/4;
|
||||
size_t m = size_mean;
|
||||
double r;
|
||||
double x;
|
||||
|
||||
|
|
@ -73,8 +71,6 @@ static size_t randomSize(unsigned long i)
|
|||
#define TEST_SET_SIZE 1234
|
||||
#define TEST_LOOPS 27
|
||||
|
||||
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
|
||||
|
||||
static mps_res_t make(mps_addr_t *p, mps_ap_t ap, size_t size)
|
||||
{
|
||||
mps_res_t res;
|
||||
|
|
@ -177,19 +173,18 @@ static void stress_with_arena_class(mps_arena_class_t aclass, Bool zoned)
|
|||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, testArenaSIZE);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_ARENA_ZONED, zoned);
|
||||
MPS_ARGS_DONE(args);
|
||||
die(mps_arena_create_k(&arena, aclass, args),
|
||||
"mps_arena_create");
|
||||
} MPS_ARGS_END(args);
|
||||
|
||||
min = MPS_PF_ALIGN;
|
||||
mean = 42;
|
||||
max = 8192;
|
||||
size_min = MPS_PF_ALIGN;
|
||||
size_mean = 42;
|
||||
size_max = 8192;
|
||||
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MIN_SIZE, min);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, mean);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, max);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MIN_SIZE, size_min);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, size_mean);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, size_max);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, TEST_SET_SIZE/2);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, 0.3);
|
||||
die(stress(mps_class_mvt(), arena, randomSize, args), "stress MVT");
|
||||
|
|
|
|||
|
|
@ -13,22 +13,31 @@
|
|||
|
||||
SRCID(nailboard, "$Id$");
|
||||
|
||||
|
||||
/* Log2 of scale factor between levels. See <design/nailboard/#impl.scale>. */
|
||||
#define LEVEL_SHIFT MPS_WORD_SHIFT
|
||||
|
||||
|
||||
/* nailboardLevels -- return the number of levels in a nailboard with
|
||||
* the given number of nails.
|
||||
*
|
||||
* See <design/nailboard/#impl.table.last>
|
||||
*/
|
||||
|
||||
static Count nailboardLevels(Count nails)
|
||||
{
|
||||
return SizeRoundUp(SizeFloorLog2(nails) + 1, LEVEL_SHIFT) / LEVEL_SHIFT;
|
||||
return (SizeFloorLog2((Size)nails) + LEVEL_SHIFT) / LEVEL_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* nailboardLevelBits -- return the number of bits in the bit table
|
||||
* for the given level.
|
||||
*/
|
||||
|
||||
static Count nailboardLevelBits(Nailboard board, Index level)
|
||||
{
|
||||
/* Don't AVER(level < board->levels): see .check.levels */
|
||||
/* Use <= rather than < because of .check.levels. */
|
||||
AVER(level <= board->levels);
|
||||
return RangeSize(&board->range) >> (board->alignShift + level * LEVEL_SHIFT);
|
||||
}
|
||||
|
||||
|
|
@ -48,19 +57,23 @@ Bool NailboardCheck(Nailboard board)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* nailboardStructSize -- return the size of the nailboard structure,
|
||||
* plus the array of pointers to levels.
|
||||
*/
|
||||
|
||||
static Size nailboardStructSize(Count levels)
|
||||
{
|
||||
return offsetof(NailboardStruct, level) + sizeof(BT *) * levels;
|
||||
}
|
||||
|
||||
|
||||
/* nailboardSize -- return the total size of the nailboard
|
||||
*
|
||||
* This is the size of the nailboard structure plus the combined sizes
|
||||
* of the bit tables.
|
||||
*/
|
||||
|
||||
static Size nailboardSize(Count nails, Count levels)
|
||||
{
|
||||
Index i;
|
||||
|
|
@ -73,6 +86,7 @@ static Size nailboardSize(Count nails, Count levels)
|
|||
return size;
|
||||
}
|
||||
|
||||
|
||||
/* NailboardCreate -- allocate a nailboard
|
||||
*
|
||||
* Allocate a nailboard in the control pool for arena, to cover the
|
||||
|
|
@ -83,11 +97,13 @@ static Size nailboardSize(Count nails, Count levels)
|
|||
* alignment specifies the granularity of the nails: that is, the
|
||||
* number of bytes covered by each nail.
|
||||
*/
|
||||
|
||||
Res NailboardCreate(Nailboard *boardReturn, Arena arena, Align alignment,
|
||||
Addr base, Addr limit)
|
||||
{
|
||||
void *p;
|
||||
Nailboard board;
|
||||
Shift alignShift;
|
||||
Count nails, levels;
|
||||
Index i;
|
||||
Res res;
|
||||
|
|
@ -99,7 +115,8 @@ Res NailboardCreate(Nailboard *boardReturn, Arena arena, Align alignment,
|
|||
AVER(AddrIsAligned(base, alignment));
|
||||
AVER(AddrIsAligned(limit, alignment));
|
||||
|
||||
nails = AddrOffset(base, limit) / alignment;
|
||||
alignShift = SizeLog2((Size)alignment);
|
||||
nails = AddrOffset(base, limit) >> alignShift;
|
||||
levels = nailboardLevels(nails);
|
||||
res = ControlAlloc(&p, arena, nailboardSize(nails, levels), FALSE);
|
||||
if (res != ResOK)
|
||||
|
|
@ -108,81 +125,94 @@ Res NailboardCreate(Nailboard *boardReturn, Arena arena, Align alignment,
|
|||
board = p;
|
||||
RangeInit(&board->range, base, limit);
|
||||
board->levels = levels;
|
||||
board->alignShift = SizeLog2(alignment);
|
||||
board->alignShift = alignShift;
|
||||
board->newNails = FALSE;
|
||||
|
||||
p = AddrAdd(p, nailboardStructSize(levels));
|
||||
p = PointerAdd(p, nailboardStructSize(levels));
|
||||
for (i = 0; i < levels; ++i) {
|
||||
AVER(nails > 0);
|
||||
board->level[i] = p;
|
||||
BTResRange(board->level[i], 0, nails);
|
||||
p = AddrAdd(p, BTSize(nails));
|
||||
p = PointerAdd(p, BTSize(nails));
|
||||
nails >>= LEVEL_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
board->sig = NailboardSig;
|
||||
AVERT(Nailboard, board);
|
||||
*boardReturn = board;
|
||||
return ResOK;
|
||||
}
|
||||
|
||||
|
||||
/* NailboardDestroy -- destroy a nailboard */
|
||||
|
||||
void NailboardDestroy(Nailboard board, Arena arena)
|
||||
{
|
||||
Count nails;
|
||||
Size size;
|
||||
|
||||
AVERT(Nailboard, board);
|
||||
AVERT(Arena, arena);
|
||||
|
||||
size = nailboardSize(nailboardLevelBits(board, 0), board->levels);
|
||||
nails = nailboardLevelBits(board, 0);
|
||||
size = nailboardSize(nails, board->levels);
|
||||
|
||||
board->sig = SigInvalid;
|
||||
ControlFree(arena, board, size);
|
||||
}
|
||||
|
||||
|
||||
/* NailboardClearNewNails -- clear the "new nails" flag */
|
||||
|
||||
void (NailboardClearNewNails)(Nailboard board)
|
||||
{
|
||||
AVERT(Nailboard, board);
|
||||
board->newNails = FALSE;
|
||||
NailboardClearNewNails(board);
|
||||
}
|
||||
|
||||
|
||||
/* NailboardNewNails -- return the "new nails" flag
|
||||
*
|
||||
* Return TRUE if any new nails have been set in the nailboard since
|
||||
* the last call to NailboardClearNewNails (or since the nailboard was
|
||||
* created, if there have never been any such calls), FALSE otherwise.
|
||||
*/
|
||||
|
||||
Bool (NailboardNewNails)(Nailboard board)
|
||||
{
|
||||
AVERT(Nailboard, board);
|
||||
return board->newNails;
|
||||
return NailboardNewNails(board);
|
||||
}
|
||||
|
||||
|
||||
/* nailboardIndex -- return the index of the nail corresponding to
|
||||
* addr in the given level.
|
||||
*/
|
||||
|
||||
static Index nailboardIndex(Nailboard board, Index level, Addr addr)
|
||||
{
|
||||
return AddrOffset(RangeBase(&board->range), addr)
|
||||
>> (board->alignShift + level * LEVEL_SHIFT);
|
||||
}
|
||||
|
||||
|
||||
/* nailboardAddr -- return the address corresponding to the index in
|
||||
* the given level.
|
||||
*/
|
||||
|
||||
static Addr nailboardAddr(Nailboard board, Index level, Index index)
|
||||
{
|
||||
return AddrAdd(RangeBase(&board->range),
|
||||
index << (board->alignShift + level * LEVEL_SHIFT));
|
||||
}
|
||||
|
||||
|
||||
/* nailboardIndexRange -- update *ibaseReturn and *ilimitReturn to be
|
||||
* the indexes of the nail corresponding to base and limit
|
||||
* respectively, in the given level. See .impl.isresrange.alignment.
|
||||
* the interval of indexes of nails in the given level, corresponding
|
||||
* to the interval of addresses base and limit. See
|
||||
* <design/nailboard/#.impl.isresrange.alignment>.
|
||||
*/
|
||||
|
||||
static void nailboardIndexRange(Index *ibaseReturn, Index *ilimitReturn,
|
||||
Nailboard board, Index level,
|
||||
Addr base, Addr limit)
|
||||
|
|
@ -191,12 +221,14 @@ static void nailboardIndexRange(Index *ibaseReturn, Index *ilimitReturn,
|
|||
*ilimitReturn = nailboardIndex(board, level, AddrSub(limit, 1)) + 1;
|
||||
}
|
||||
|
||||
|
||||
/* NailboardGet -- return nail corresponding to address
|
||||
*
|
||||
* Return the nail in the nailboard corresponding to the address addr.
|
||||
* It is an error if addr does not lie in the range of addresses
|
||||
* covered by the nailboard.
|
||||
*/
|
||||
|
||||
Bool NailboardGet(Nailboard board, Addr addr)
|
||||
{
|
||||
AVERT(Nailboard, board);
|
||||
|
|
@ -204,12 +236,17 @@ Bool NailboardGet(Nailboard board, Addr addr)
|
|||
return BTGet(board->level[0], nailboardIndex(board, 0, addr));
|
||||
}
|
||||
|
||||
|
||||
/* NailboardSet -- set nail corresponding to address
|
||||
*
|
||||
* Set the nail in the nailboard corresponding to the address addr.
|
||||
* Return the old nail at that position. It is an error if addr does
|
||||
* not lie in the range of addresses covered by the nailboard.
|
||||
*
|
||||
* This function is on the critical path because it is called for
|
||||
* every fix of an ambiguous reference to an address in an AMC pool.
|
||||
*/
|
||||
|
||||
Bool NailboardSet(Nailboard board, Addr addr)
|
||||
{
|
||||
Index i, j;
|
||||
|
|
@ -232,12 +269,14 @@ Bool NailboardSet(Nailboard board, Addr addr)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* NailboardSetRange -- set all nails in range
|
||||
*
|
||||
* Set all nails in the nailboard corresponding to the range between
|
||||
* base and limit. It is an error if any part of the range is not
|
||||
* covered by the nailboard, or if any nail in the range is set.
|
||||
*/
|
||||
|
||||
void NailboardSetRange(Nailboard board, Addr base, Addr limit)
|
||||
{
|
||||
Index i, ibase, ilimit;
|
||||
|
|
@ -250,14 +289,18 @@ void NailboardSetRange(Nailboard board, Addr base, Addr limit)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* NailboardIsSetRange -- test if all nails are set in a range
|
||||
*
|
||||
* Return TRUE if all nails are set in the range between base and
|
||||
* limit, or FALSE if any nail is unset. It is an error if any part of
|
||||
* the range is not covered by the nailboard.
|
||||
*
|
||||
* This function is not expected to be efficient.
|
||||
* This function is not expected to be efficient because it is only
|
||||
* used in an AVER in AMCWhiten to check that the unused part of the
|
||||
* buffer for a nailboarded segment has in fact been nailed.
|
||||
*/
|
||||
|
||||
Bool NailboardIsSetRange(Nailboard board, Addr base, Addr limit)
|
||||
{
|
||||
Index ibase, ilimit;
|
||||
|
|
@ -266,6 +309,7 @@ Bool NailboardIsSetRange(Nailboard board, Addr base, Addr limit)
|
|||
return BTIsSetRange(board->level[0], ibase, ilimit);
|
||||
}
|
||||
|
||||
|
||||
/* NailboardIsResRange -- test if all nails are reset in a range
|
||||
*
|
||||
* Return TRUE if no nails are set in the range between base and
|
||||
|
|
@ -276,8 +320,9 @@ Bool NailboardIsSetRange(Nailboard board, Addr base, Addr limit)
|
|||
* object in every nailed segment. It must take time that is no more
|
||||
* than logarithmic in the size of the range.
|
||||
*
|
||||
* See <design/nailboard#impl.isresrange>.
|
||||
* See <design/nailboard/#impl.isresrange>.
|
||||
*/
|
||||
|
||||
Bool NailboardIsResRange(Nailboard board, Addr base, Addr limit)
|
||||
{
|
||||
Index i, ibase, ilimit;
|
||||
|
|
@ -286,19 +331,32 @@ Bool NailboardIsResRange(Nailboard board, Addr base, Addr limit)
|
|||
|
||||
AVERT_CRITICAL(Nailboard, board);
|
||||
|
||||
for (i = board->levels - 1;; --i) {
|
||||
/* Descend levels until ibase and ilimit are two or more bits apart:
|
||||
* that is, until there is an "inner" part to the range. */
|
||||
i = board->levels;
|
||||
do {
|
||||
-- i;
|
||||
nailboardIndexRange(&ibase, &ilimit, board, i, base, limit);
|
||||
if (BTIsResRange(board->level[i], ibase, ilimit))
|
||||
return TRUE; /* <design/nailboard#impl.isresrange.empty> */
|
||||
/* The entire range was clear. This is expected to be the common
|
||||
* case. <design/nailboard/#impl.isresrange.empty> */
|
||||
return TRUE;
|
||||
if (i == 0)
|
||||
return FALSE; /* <design/nailboard#impl.isresrange.level0> */
|
||||
if (ibase + 1 < ilimit - 1) {
|
||||
if (BTIsResRange(board->level[i], ibase + 1, ilimit - 1))
|
||||
break;
|
||||
else
|
||||
return FALSE; /* <design/nailboard#impl.isresrange.inner> */
|
||||
}
|
||||
}
|
||||
/* At level 0 there is only one nail per bit so the set bit is known
|
||||
* to be within the range. <design/nailboard/#impl.isresrange.level0> */
|
||||
return FALSE;
|
||||
} while (ibase + 1 >= ilimit - 1);
|
||||
|
||||
/* At this point we know there is an "inner" part. Are there any
|
||||
* bits set in it? <design/nailboard#impl.isresrange.inner> */
|
||||
if (!BTIsResRange(board->level[i], ibase + 1, ilimit - 1))
|
||||
return FALSE;
|
||||
|
||||
/* At this point we know that in level i, there is is a bit set at
|
||||
* ibase or at ilimit - 1 (or both), and everything between them is
|
||||
* reset. */
|
||||
AVER_CRITICAL(BTGet(board->level[i], ibase)
|
||||
|| BTGet(board->level[i], ilimit - 1));
|
||||
|
||||
/* Left splinter */
|
||||
for (j = i, jbase = ibase;;) {
|
||||
|
|
@ -308,7 +366,7 @@ Bool NailboardIsResRange(Nailboard board, Addr base, Addr limit)
|
|||
-- j;
|
||||
nailboardIndexRange(&jbase, &jlimit, board, j, base, leftLimit);
|
||||
if (jbase + 1 < jlimit && !BTIsResRange(board->level[j], jbase + 1, jlimit))
|
||||
return FALSE; /* <design/nailboard#impl.isresrange.inner> */
|
||||
return FALSE; /* <design/nailboard/#impl.isresrange.inner> */
|
||||
if (!BTGet(board->level[j], jbase))
|
||||
break;
|
||||
if (j == 0)
|
||||
|
|
@ -323,7 +381,7 @@ Bool NailboardIsResRange(Nailboard board, Addr base, Addr limit)
|
|||
-- j;
|
||||
nailboardIndexRange(&jbase, &jlimit, board, j, rightBase, limit);
|
||||
if (jbase < jlimit - 1 && !BTIsResRange(board->level[j], jbase, jlimit - 1))
|
||||
return FALSE; /* <design/nailboard#impl.isresrange.inner> */
|
||||
return FALSE; /* <design/nailboard/#impl.isresrange.inner> */
|
||||
if (!BTGet(board->level[j], jlimit - 1))
|
||||
break;
|
||||
if (j == 0)
|
||||
|
|
@ -333,6 +391,7 @@ Bool NailboardIsResRange(Nailboard board, Addr base, Addr limit)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Res NailboardDescribe(Nailboard board, mps_lib_FILE *stream)
|
||||
{
|
||||
Index i, j;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@
|
|||
|
||||
typedef struct NailboardStruct *Nailboard;
|
||||
|
||||
/* NOTE: we could reduce the size of this structure using bitfields.
|
||||
* levels can be at most MPS_WORD_WIDTH / LEVEL_SHIFT + 1, which is 11
|
||||
* on 64-bit, so it would fit in 4 bits. (Or it could be recalculated
|
||||
* from range each time it's needed.) alignShift is at most
|
||||
* MPS_WORD_SHIFT so would fit in 3 bits. (Or it could be supplied in
|
||||
* each function call by the owner.) newNails would fit in 1 bit.
|
||||
*/
|
||||
typedef struct NailboardStruct {
|
||||
Sig sig;
|
||||
RangeStruct range; /* range of addresses covered by nailboard */
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ int main(int argc, char **argv)
|
|||
{
|
||||
mps_arena_t arena;
|
||||
|
||||
randomize(argc, argv);
|
||||
mps_lib_assert_fail_install(assert_die);
|
||||
testlib_init(argc, argv);
|
||||
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), 1024 * 1024),
|
||||
"mps_arena_create");
|
||||
|
||||
|
|
|
|||
59
mps/code/pc.nmk
Normal file
59
mps/code/pc.nmk
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# -*- makefile -*-
|
||||
#
|
||||
# pc.nmk: NMAKE FRAGMENT FOR PELLES C
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||
#
|
||||
# This file is included by platform nmake files that use the Pelles C
|
||||
# compiler. It defines the compiler-specific variables that the common
|
||||
# nmake file fragment (<code/commpost.nmk>) requires.
|
||||
|
||||
CC = pocc
|
||||
LIBMAN = polib
|
||||
LINKER = polink
|
||||
|
||||
CFLAGSCOMMONPRE = $(CFLAGSCOMMONPRE) /Ze /W2
|
||||
CRTFLAGSHOT = /MT
|
||||
CRTFLAGSCOOL = /MT
|
||||
|
||||
|
||||
# C. COPYRIGHT AND LICENSE
|
||||
#
|
||||
# Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
# 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.
|
||||
|
|
@ -18,9 +18,6 @@
|
|||
* .purpose.dispatch: Dispatch functions that implement the generic
|
||||
* function dispatch mechanism for Pool Classes (PoolAlloc, PoolFix,
|
||||
* etc.).
|
||||
* .purpose.core: A selection of default, trivial, or useful methods
|
||||
* that Pool Classes can use as the implementations for some of their
|
||||
* methods (such as PoolTrivWhiten, PoolNoFix, etc.).
|
||||
*
|
||||
* SOURCES
|
||||
*
|
||||
|
|
@ -40,13 +37,14 @@ 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 */
|
||||
/* greater than the size of the class-specific portion of the instance */
|
||||
CHECKL(class->offset <= (size_t)(class->size - sizeof(PoolStruct)));
|
||||
CHECKL(AttrCheck(class->attr));
|
||||
CHECKL(!(class->attr & AttrMOVINGGC) || (class->attr & AttrGC));
|
||||
CHECKL(FUNCHECK(class->varargs));
|
||||
CHECKL(FUNCHECK(class->init));
|
||||
CHECKL(FUNCHECK(class->finish));
|
||||
|
|
@ -89,16 +87,14 @@ 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 pool->class->attr&AttrFMT, but not */
|
||||
/* during pool initialization */
|
||||
if (pool->format != NULL) {
|
||||
CHECKL((pool->class->attr & AttrFMT) != 0);
|
||||
}
|
||||
/* normally pool->format iff PoolHasAttr(pool, AttrFMT), but during
|
||||
* pool initialization pool->format may not yet be set. */
|
||||
CHECKL(pool->format == NULL || PoolHasAttr(pool, AttrFMT));
|
||||
CHECKL(pool->fillMutatorSize >= 0.0);
|
||||
CHECKL(pool->emptyMutatorSize >= 0.0);
|
||||
CHECKL(pool->fillInternalSize >= 0.0);
|
||||
|
|
@ -118,6 +114,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(interior, Bool);
|
||||
|
||||
|
||||
/* PoolInit -- initialize a pool
|
||||
|
|
@ -288,9 +285,9 @@ Res PoolAlloc(Addr *pReturn, Pool pool, Size size,
|
|||
|
||||
AVER(pReturn != NULL);
|
||||
AVERT(Pool, pool);
|
||||
AVER((pool->class->attr & AttrALLOC) != 0);
|
||||
AVER(PoolHasAttr(pool, AttrALLOC));
|
||||
AVER(size > 0);
|
||||
AVER(BoolCheck(withReservoirPermit));
|
||||
AVERT(Bool, withReservoirPermit);
|
||||
|
||||
res = (*pool->class->alloc)(pReturn, pool, size, withReservoirPermit);
|
||||
if (res != ResOK)
|
||||
|
|
@ -318,7 +315,7 @@ Res PoolAlloc(Addr *pReturn, Pool pool, Size size,
|
|||
void PoolFree(Pool pool, Addr old, Size size)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVER((pool->class->attr & AttrFREE) != 0);
|
||||
AVER(PoolHasAttr(pool, AttrFREE));
|
||||
AVER(old != NULL);
|
||||
/* The pool methods should check that old is in pool. */
|
||||
AVER(size > 0);
|
||||
|
|
@ -383,6 +380,7 @@ Res PoolScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
|
|||
AVER(totalReturn != NULL);
|
||||
AVERT(ScanState, ss);
|
||||
AVERT(Pool, pool);
|
||||
AVER(PoolHasAttr(pool, AttrSCAN));
|
||||
AVERT(Seg, seg);
|
||||
AVER(ss->arena == pool->arena);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolabs.c: ABSTRACT POOL CLASSES
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* PURPOSE
|
||||
|
|
@ -65,12 +65,13 @@ void PoolClassMixInAllocFree(PoolClass class)
|
|||
void PoolClassMixInBuffer(PoolClass class)
|
||||
{
|
||||
/* Can't check class because it's not initialized yet */
|
||||
class->attr |= (AttrBUF | AttrBUF_RESERVE);
|
||||
class->attr |= AttrBUF;
|
||||
class->bufferFill = PoolTrivBufferFill;
|
||||
class->bufferEmpty = PoolTrivBufferEmpty;
|
||||
/* By default, buffered pools treat frame operations as NOOPs */
|
||||
class->framePush = PoolTrivFramePush;
|
||||
class->framePop = PoolTrivFramePop;
|
||||
class->framePopPending = PoolTrivFramePopPending;
|
||||
class->bufferClass = BufferClassGet;
|
||||
}
|
||||
|
||||
|
|
@ -84,8 +85,10 @@ void PoolClassMixInScan(PoolClass class)
|
|||
class->access = PoolSegAccess;
|
||||
class->blacken = PoolTrivBlacken;
|
||||
class->grey = PoolTrivGrey;
|
||||
/* Scan is part of the scanning protocol - but there is */
|
||||
/* no useful default method */
|
||||
/* scan is part of the scanning protocol, but there is no useful
|
||||
* default method.
|
||||
*/
|
||||
class->scan = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -95,6 +98,10 @@ void PoolClassMixInFormat(PoolClass class)
|
|||
{
|
||||
/* Can't check class because it's not initialized yet */
|
||||
class->attr |= AttrFMT;
|
||||
/* walk is part of the format protocol, but there is no useful
|
||||
* default method.
|
||||
*/
|
||||
class->walk = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -103,10 +110,14 @@ void PoolClassMixInFormat(PoolClass class)
|
|||
void PoolClassMixInCollect(PoolClass class)
|
||||
{
|
||||
/* Can't check class because it's not initialized yet */
|
||||
class->attr |= (AttrGC | AttrINCR_RB);
|
||||
class->attr |= AttrGC;
|
||||
class->whiten = PoolTrivWhiten;
|
||||
/* Fix & reclaim are part of the collection protocol - but there */
|
||||
/* are no useful default methods for them. */
|
||||
/* fix, fixEmergency and reclaim are part of the collection
|
||||
* protocol, but there are no useful default methods for them.
|
||||
*/
|
||||
class->fix = NULL;
|
||||
class->fixEmergency = NULL;
|
||||
class->reclaim = NULL;
|
||||
class->rampBegin = PoolTrivRampBegin;
|
||||
class->rampEnd = PoolTrivRampEnd;
|
||||
}
|
||||
|
|
@ -145,7 +156,7 @@ DEFINE_CLASS(AbstractPoolClass, class)
|
|||
class->framePopPending = PoolNoFramePopPending;
|
||||
class->addrObject = PoolNoAddrObject;
|
||||
class->walk = PoolNoWalk;
|
||||
class->freewalk = PoolNoFreeWalk;
|
||||
class->freewalk = PoolTrivFreeWalk;
|
||||
class->bufferClass = PoolNoBufferClass;
|
||||
class->describe = PoolTrivDescribe;
|
||||
class->debugMixin = PoolNoDebugMixin;
|
||||
|
|
@ -199,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;
|
||||
}
|
||||
|
|
@ -210,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;
|
||||
}
|
||||
|
|
@ -221,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;
|
||||
}
|
||||
|
||||
|
|
@ -251,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;
|
||||
}
|
||||
|
|
@ -268,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;
|
||||
|
|
@ -596,7 +607,7 @@ Res PoolNoFramePop(Pool pool, Buffer buf, AllocFrame frame)
|
|||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Buffer, buf);
|
||||
/* frame is of a abstract type & can't be checked */
|
||||
/* frame is of an abstract type & can't be checked */
|
||||
UNUSED(frame);
|
||||
NOTREACHED;
|
||||
return ResUNIMPL;
|
||||
|
|
@ -607,7 +618,7 @@ void PoolNoFramePopPending(Pool pool, Buffer buf, AllocFrame frame)
|
|||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Buffer, buf);
|
||||
/* frame is of a abstract type & can't be checked */
|
||||
/* frame is of an abstract type & can't be checked */
|
||||
UNUSED(frame);
|
||||
NOTREACHED;
|
||||
}
|
||||
|
|
@ -626,12 +637,22 @@ Res PoolTrivFramePop(Pool pool, Buffer buf, AllocFrame frame)
|
|||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Buffer, buf);
|
||||
/* frame is of a abstract type & can't be checked */
|
||||
/* frame is of an abstract type & can't be checked */
|
||||
UNUSED(frame);
|
||||
return ResOK;
|
||||
}
|
||||
|
||||
|
||||
void PoolTrivFramePopPending(Pool pool, Buffer buf, AllocFrame frame)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Buffer, buf);
|
||||
/* frame is of an abstract type & can't be checked */
|
||||
UNUSED(frame);
|
||||
NOOP;
|
||||
}
|
||||
|
||||
|
||||
Res PoolNoAddrObject(Addr *pReturn, Pool pool, Seg seg, Addr addr)
|
||||
{
|
||||
AVER(pReturn != NULL);
|
||||
|
|
@ -656,7 +677,7 @@ void PoolNoWalk(Pool pool, Seg seg,
|
|||
}
|
||||
|
||||
|
||||
void PoolNoFreeWalk(Pool pool, FreeBlockStepMethod f, void *p)
|
||||
void PoolTrivFreeWalk(Pool pool, FreeBlockStepMethod f, void *p)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVER(FUNCHECK(f));
|
||||
|
|
@ -677,7 +698,7 @@ BufferClass PoolNoBufferClass(void)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ typedef struct AMCStruct *AMC;
|
|||
/* amcGen typedef */
|
||||
typedef struct amcGenStruct *amcGen;
|
||||
|
||||
/* Function returning TRUE if block in nailboarded segment is pinned. */
|
||||
typedef Bool (*amcPinnedMethod)(AMC amc, Nailboard board, Addr base, Addr limit);
|
||||
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
static Bool amcSegHasNailboard(Seg seg);
|
||||
|
|
@ -337,6 +341,7 @@ DEFINE_SEG_CLASS(amcSegClass, class)
|
|||
class->size = sizeof(amcSegStruct);
|
||||
class->init = AMCSegInit;
|
||||
class->describe = AMCSegDescribe;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -456,6 +461,7 @@ typedef struct AMCStruct { /* <design/poolamc/#struct> */
|
|||
amcGen afterRampGen; /* the generation after rampGen */
|
||||
unsigned rampCount; /* <design/poolamc/#ramp.count> */
|
||||
int rampMode; /* <design/poolamc/#ramp.mode> */
|
||||
amcPinnedMethod pinned; /* function determining if block is pinned */
|
||||
|
||||
/* page retention in an in-progress trace */
|
||||
STATISTIC_DECL(PageRetStruct pageretstruct[TraceLIMIT]);
|
||||
|
|
@ -479,7 +485,7 @@ static Bool amcGenCheck(amcGen gen)
|
|||
amc = amcGenAMC(gen);
|
||||
CHECKU(AMC, amc);
|
||||
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));
|
||||
|
|
@ -521,7 +527,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));
|
||||
|
|
@ -627,6 +633,7 @@ DEFINE_BUFFER_CLASS(amcBufClass, class)
|
|||
class->size = sizeof(amcBufStruct);
|
||||
class->init = AMCBufInit;
|
||||
class->finish = AMCBufFinish;
|
||||
AVERT(BufferClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -742,6 +749,26 @@ static Res amcSegCreateNailboard(Seg seg, Pool pool)
|
|||
}
|
||||
|
||||
|
||||
/* amcPinnedInterior -- block is pinned by any nail */
|
||||
|
||||
static Bool amcPinnedInterior(AMC amc, Nailboard board, Addr base, Addr limit)
|
||||
{
|
||||
Size headerSize = AMC2Pool(amc)->format->headerSize;
|
||||
return !NailboardIsResRange(board, AddrSub(base, headerSize),
|
||||
AddrSub(limit, headerSize));
|
||||
}
|
||||
|
||||
|
||||
/* amcPinnedBase -- block is pinned only if base is nailed */
|
||||
|
||||
static Bool amcPinnedBase(AMC amc, Nailboard board, Addr base, Addr limit)
|
||||
{
|
||||
UNUSED(amc);
|
||||
UNUSED(limit);
|
||||
return NailboardGet(board, base);
|
||||
}
|
||||
|
||||
|
||||
/* amcVarargs -- decode obsolete varargs */
|
||||
|
||||
static void AMCVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs)
|
||||
|
|
@ -751,7 +778,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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -770,6 +797,7 @@ static Res amcInitComm(Pool pool, RankSet rankSet, ArgList args)
|
|||
Index i;
|
||||
size_t genArraySize;
|
||||
size_t genCount;
|
||||
Bool interior = AMC_INTERIOR_DEFAULT;
|
||||
ArgStruct arg;
|
||||
|
||||
/* Suppress a warning about this structure not being used when there
|
||||
|
|
@ -793,6 +821,8 @@ static Res amcInitComm(Pool pool, RankSet rankSet, ArgList args)
|
|||
amc->chain = arg.val.chain;
|
||||
else
|
||||
amc->chain = ArenaGlobals(arena)->defaultChain;
|
||||
if (ArgPick(&arg, args, MPS_KEY_INTERIOR))
|
||||
interior = arg.val.b;
|
||||
|
||||
AVERT(Format, pool->format);
|
||||
AVERT(Chain, amc->chain);
|
||||
|
|
@ -821,6 +851,12 @@ static Res amcInitComm(Pool pool, RankSet rankSet, ArgList args)
|
|||
pool->fix = AMCHeaderFix;
|
||||
}
|
||||
|
||||
if (interior) {
|
||||
amc->pinned = amcPinnedInterior;
|
||||
} else {
|
||||
amc->pinned = amcPinnedBase;
|
||||
}
|
||||
|
||||
amc->sig = AMCSig;
|
||||
AVERT(AMC, amc);
|
||||
|
||||
|
|
@ -1278,29 +1314,18 @@ static Res AMCWhiten(Pool pool, Trace trace, Seg seg)
|
|||
}
|
||||
|
||||
|
||||
/* amcNailboardIsResClientRange -- wrapper for NailboardIsResRange,
|
||||
* except that the addresses are client addresses for objects with the
|
||||
* given header size.
|
||||
*/
|
||||
static Bool amcNailboardIsResClientRange(Nailboard board, Size headerSize,
|
||||
Addr base, Addr limit)
|
||||
{
|
||||
return NailboardIsResRange(board, AddrSub(base, headerSize),
|
||||
AddrSub(limit, headerSize));
|
||||
}
|
||||
|
||||
|
||||
/* amcScanNailedRange -- make one scanning pass over a range of
|
||||
* addresses in a nailed segment.
|
||||
*/
|
||||
static Res amcScanNailedRange(Bool *totalReturn, Bool *moreReturn,
|
||||
Size *bytesScanned, ScanState ss,
|
||||
Pool pool, Nailboard board,
|
||||
AMC amc, Nailboard board,
|
||||
Addr base, Addr limit)
|
||||
{
|
||||
Format format;
|
||||
Size headerSize;
|
||||
Addr p, clientLimit;
|
||||
Pool pool = AMC2Pool(amc);
|
||||
format = pool->format;
|
||||
headerSize = format->headerSize;
|
||||
p = AddrAdd(base, headerSize);
|
||||
|
|
@ -1308,7 +1333,7 @@ static Res amcScanNailedRange(Bool *totalReturn, Bool *moreReturn,
|
|||
while (p < clientLimit) {
|
||||
Addr q;
|
||||
q = (*format->skip)(p);
|
||||
if (!amcNailboardIsResClientRange(board, headerSize, p, q)) {
|
||||
if ((*amc->pinned)(amc, board, p, q)) {
|
||||
Res res;
|
||||
res = (*format->scan)(&ss->ss_s, p, q);
|
||||
if(res != ResOK) {
|
||||
|
|
@ -1338,7 +1363,7 @@ static Res amcScanNailedRange(Bool *totalReturn, Bool *moreReturn,
|
|||
* nailboard.
|
||||
*/
|
||||
static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
|
||||
ScanState ss, Pool pool, Seg seg, AMC amc)
|
||||
ScanState ss, Seg seg, AMC amc)
|
||||
{
|
||||
Addr p, limit;
|
||||
Size bytesScanned = 0;
|
||||
|
|
@ -1359,7 +1384,7 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
|
|||
goto returnGood;
|
||||
}
|
||||
res = amcScanNailedRange(totalReturn, moreReturn, &bytesScanned,
|
||||
ss, pool, board, p, limit);
|
||||
ss, amc, board, p, limit);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
p = limit;
|
||||
|
|
@ -1368,7 +1393,7 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
|
|||
limit = SegLimit(seg);
|
||||
/* @@@@ Shouldn't p be set to BufferLimit here?! */
|
||||
res = amcScanNailedRange(totalReturn, moreReturn, &bytesScanned,
|
||||
ss, pool, board, p, limit);
|
||||
ss, amc, board, p, limit);
|
||||
if (res != ResOK)
|
||||
return res;
|
||||
|
||||
|
|
@ -1392,7 +1417,7 @@ static Res amcScanNailed(Bool *totalReturn, ScanState ss, Pool pool,
|
|||
|
||||
do {
|
||||
Res res;
|
||||
res = amcScanNailedOnce(&total, &moreScanning, ss, pool, seg, amc);
|
||||
res = amcScanNailedOnce(&total, &moreScanning, ss, seg, amc);
|
||||
if(res != ResOK) {
|
||||
*totalReturn = FALSE;
|
||||
return res;
|
||||
|
|
@ -1653,7 +1678,7 @@ static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
/* If object is nailed already then we mustn't copy it: */
|
||||
if (SegNailed(seg) != TraceSetEMPTY
|
||||
&& !(amcSegHasNailboard(seg)
|
||||
&& NailboardIsResRange(amcSegNailboard(seg), ref, clientQ)))
|
||||
&& !(*amc->pinned)(amc, amcSegNailboard(seg), ref, clientQ)))
|
||||
{
|
||||
/* Segment only needs greying if there are new traces for */
|
||||
/* which we are nailing. */
|
||||
|
|
@ -1800,8 +1825,7 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
/* If object is nailed already then we mustn't copy it: */
|
||||
if (SegNailed(seg) != TraceSetEMPTY
|
||||
&& !(amcSegHasNailboard(seg)
|
||||
&& amcNailboardIsResClientRange(amcSegNailboard(seg),
|
||||
headerSize, ref, clientQ)))
|
||||
&& !(*amc->pinned)(amc, amcSegNailboard(seg), ref, clientQ)))
|
||||
{
|
||||
/* Segment only needs greying if there are new traces for */
|
||||
/* which we are nailing. */
|
||||
|
|
@ -1917,8 +1941,7 @@ static void amcReclaimNailed(Pool pool, Trace trace, Seg seg)
|
|||
q = AddrSub(clientQ, headerSize);
|
||||
length = AddrOffset(p, q);
|
||||
if(amcSegHasNailboard(seg)) {
|
||||
preserve = !amcNailboardIsResClientRange(amcSegNailboard(seg), headerSize,
|
||||
clientP, clientQ);
|
||||
preserve = (*amc->pinned)(amc, amcSegNailboard(seg), clientP, clientQ);
|
||||
} else {
|
||||
/* There's no nailboard, so preserve everything that hasn't been
|
||||
* forwarded. In this case, preservedInPlace* become somewhat
|
||||
|
|
@ -2066,20 +2089,20 @@ static void AMCTraceEnd(Pool pool, Trace trace)
|
|||
amc = Pool2AMC(pool);
|
||||
AVERT(AMC, amc);
|
||||
ti = trace->ti;
|
||||
AVER(TraceIdCheck(ti));
|
||||
AVERT(TraceId, ti);
|
||||
|
||||
STATISTIC_BEGIN {
|
||||
Count pRetMin = 100;
|
||||
PageRetStruct *pr = &amc->pageretstruct[ti];
|
||||
if(pr->pRet >= pRetMin) {
|
||||
EVENT21(AMCTraceEnd, ArenaEpoch(pool->arena), (EventFU)trace->why,
|
||||
ArenaAlign(pool->arena), AMCLargeSegPAGES, pRetMin, pr->pCond,
|
||||
pr->pRet, pr->pCS, pr->pRS, pr->sCM, pr->pCM, pr->sRM, pr->pRM,
|
||||
pr->pRM1, pr->pRMrr, pr->pRMr1, pr->sCL, pr->pCL, pr->sRL,
|
||||
pr->pRL, pr->pRLr);
|
||||
}
|
||||
*pr = pageretstruct_Zero;
|
||||
} STATISTIC_END;
|
||||
STATISTIC_STAT ({
|
||||
Count pRetMin = 100;
|
||||
PageRetStruct *pr = &amc->pageretstruct[ti];
|
||||
if(pr->pRet >= pRetMin) {
|
||||
EVENT21(AMCTraceEnd, ArenaEpoch(pool->arena), (EventFU)trace->why,
|
||||
ArenaAlign(pool->arena), AMCLargeSegPAGES, pRetMin, pr->pCond,
|
||||
pr->pRet, pr->pCS, pr->pRS, pr->sCM, pr->pCM, pr->sRM, pr->pRM,
|
||||
pr->pRM1, pr->pRMrr, pr->pRMr1, pr->sCL, pr->pCL, pr->sRL,
|
||||
pr->pRL, pr->pRLr);
|
||||
}
|
||||
*pr = pageretstruct_Zero;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2308,23 +2331,23 @@ static Res AMCDescribe(Pool pool, mps_lib_FILE *stream)
|
|||
}
|
||||
|
||||
|
||||
/* AMCPoolClass -- the class definition */
|
||||
/* AMCZPoolClass -- the class definition */
|
||||
|
||||
DEFINE_POOL_CLASS(AMCPoolClass, this)
|
||||
DEFINE_POOL_CLASS(AMCZPoolClass, this)
|
||||
{
|
||||
INHERIT_CLASS(this, AbstractCollectPoolClass);
|
||||
INHERIT_CLASS(this, AbstractSegBufPoolClass);
|
||||
PoolClassMixInFormat(this);
|
||||
this->name = "AMC";
|
||||
PoolClassMixInCollect(this);
|
||||
this->name = "AMCZ";
|
||||
this->size = sizeof(AMCStruct);
|
||||
this->offset = offsetof(AMCStruct, poolStruct);
|
||||
this->attr |= AttrMOVINGGC;
|
||||
this->varargs = AMCVarargs;
|
||||
this->init = AMCInit;
|
||||
this->init = AMCZInit;
|
||||
this->finish = AMCFinish;
|
||||
this->bufferFill = AMCBufferFill;
|
||||
this->bufferEmpty = AMCBufferEmpty;
|
||||
this->whiten = AMCWhiten;
|
||||
this->scan = AMCScan;
|
||||
this->fix = AMCFix;
|
||||
this->fixEmergency = AMCFixEmergency;
|
||||
this->reclaim = AMCReclaim;
|
||||
|
|
@ -2335,19 +2358,20 @@ DEFINE_POOL_CLASS(AMCPoolClass, this)
|
|||
this->walk = AMCWalk;
|
||||
this->bufferClass = amcBufClassGet;
|
||||
this->describe = AMCDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
/* AMCZPoolClass -- the class definition */
|
||||
/* AMCPoolClass -- the class definition */
|
||||
|
||||
DEFINE_POOL_CLASS(AMCZPoolClass, this)
|
||||
DEFINE_POOL_CLASS(AMCPoolClass, this)
|
||||
{
|
||||
INHERIT_CLASS(this, AMCPoolClass);
|
||||
this->name = "AMCZ";
|
||||
this->attr &= ~(AttrSCAN | AttrINCR_RB);
|
||||
this->init = AMCZInit;
|
||||
this->grey = PoolNoGrey;
|
||||
this->scan = PoolNoScan;
|
||||
INHERIT_CLASS(this, AMCZPoolClass);
|
||||
PoolClassMixInScan(this);
|
||||
this->name = "AMC";
|
||||
this->init = AMCInit;
|
||||
this->scan = AMCScan;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2427,7 +2451,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);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolams.c: AUTOMATIC MARK & SWEEP POOL CLASS
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
* Portions copyright (c) 2002 Global Graphics Software.
|
||||
*
|
||||
*
|
||||
|
|
@ -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) {
|
||||
/* <design/poolams/#colour.single> */
|
||||
|
|
@ -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);
|
||||
|
|
@ -609,6 +609,7 @@ DEFINE_CLASS(AMSSegClass, class)
|
|||
class->merge = AMSSegMerge;
|
||||
class->split = AMSSegSplit;
|
||||
class->describe = AMSSegDescribe;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -637,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);
|
||||
|
||||
|
|
@ -666,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);
|
||||
|
|
@ -734,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)
|
||||
|
|
@ -763,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;
|
||||
|
|
@ -932,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 */
|
||||
/* <design/poolams/#fill.colour>). */
|
||||
|
|
@ -996,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)));
|
||||
|
|
@ -1074,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);
|
||||
|
|
@ -1260,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);
|
||||
|
|
@ -1306,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);
|
||||
|
||||
|
|
@ -1684,8 +1685,10 @@ DEFINE_CLASS(AMSPoolClass, this)
|
|||
this->fix = AMSFix;
|
||||
this->fixEmergency = AMSFix;
|
||||
this->reclaim = AMSReclaim;
|
||||
this->walk = PoolNoWalk; /* TODO: job003738 */
|
||||
this->freewalk = AMSFreeWalk;
|
||||
this->describe = AMSDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1713,6 +1716,7 @@ DEFINE_POOL_CLASS(AMSDebugPoolClass, this)
|
|||
this->size = sizeof(AMSDebugStruct);
|
||||
this->varargs = AMSDebugVarargs;
|
||||
this->debugMixin = AMSDebugMixin;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1721,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);
|
||||
|
|
@ -1729,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));
|
||||
|
|
@ -1740,7 +1744,7 @@ Bool AMSCheck(AMS ams)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolawl.c: AUTOMATIC WEAK LINKED POOL CLASS
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
*
|
||||
* DESIGN
|
||||
|
|
@ -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);
|
||||
|
|
@ -288,6 +288,7 @@ DEFINE_SEG_CLASS(AWLSegClass, class)
|
|||
class->size = sizeof(AWLSegStruct);
|
||||
class->init = AWLSegInit;
|
||||
class->finish = AWLSegFinish;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -450,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);
|
||||
|
|
@ -519,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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -626,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);
|
||||
|
|
@ -834,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);
|
||||
|
|
@ -1280,6 +1281,7 @@ DEFINE_POOL_CLASS(AWLPoolClass, this)
|
|||
this->fixEmergency = AWLFix;
|
||||
this->reclaim = AWLReclaim;
|
||||
this->walk = AWLWalk;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1307,7 +1309,7 @@ static Bool AWLCheck(AWL awl)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poollo.c: LEAF POOL CLASS
|
||||
*
|
||||
* $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
|
||||
*
|
||||
|
|
@ -73,6 +73,7 @@ DEFINE_SEG_CLASS(LOSegClass, class)
|
|||
class->size = sizeof(LOSegStruct);
|
||||
class->init = loSegInit;
|
||||
class->finish = loSegFinish;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -81,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);
|
||||
|
|
@ -112,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);
|
||||
|
||||
|
|
@ -286,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);
|
||||
|
||||
|
|
@ -460,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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -558,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) {
|
||||
|
|
@ -774,25 +775,23 @@ static void LOReclaim(Pool pool, Trace trace, Seg seg)
|
|||
|
||||
DEFINE_POOL_CLASS(LOPoolClass, this)
|
||||
{
|
||||
INHERIT_CLASS(this, AbstractCollectPoolClass);
|
||||
INHERIT_CLASS(this, AbstractSegBufPoolClass);
|
||||
PoolClassMixInFormat(this);
|
||||
PoolClassMixInCollect(this);
|
||||
this->name = "LO";
|
||||
this->size = sizeof(LOStruct);
|
||||
this->offset = offsetof(LOStruct, poolStruct);
|
||||
this->attr &= ~(AttrSCAN | AttrINCR_RB);
|
||||
this->varargs = LOVarargs;
|
||||
this->init = LOInit;
|
||||
this->finish = LOFinish;
|
||||
this->bufferFill = LOBufferFill;
|
||||
this->bufferEmpty = LOBufferEmpty;
|
||||
this->whiten = LOWhiten;
|
||||
this->grey = PoolNoGrey;
|
||||
this->blacken = PoolNoBlacken;
|
||||
this->scan = PoolNoScan;
|
||||
this->fix = LOFix;
|
||||
this->fixEmergency = LOFix;
|
||||
this->reclaim = LOReclaim;
|
||||
this->walk = LOWalk;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -821,7 +820,7 @@ static Bool LOCheck(LO lo)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolmfs.c: MANUAL FIXED SMALL UNIT POOL
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* This is the implementation of the MFS pool class.
|
||||
*
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
@ -347,6 +347,7 @@ DEFINE_POOL_CLASS(MFSPoolClass, this)
|
|||
this->alloc = MFSAlloc;
|
||||
this->free = MFSFree;
|
||||
this->describe = MFSDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -369,7 +370,7 @@ Bool MFSCheck(MFS mfs)
|
|||
CHECKS(MFS, mfs);
|
||||
CHECKD(Pool, &mfs->poolStruct);
|
||||
CHECKL(mfs->poolStruct.class == EnsureMFSPoolClass());
|
||||
CHECKL(mfs->unroundedUnitSize >= UNIT_MIN);
|
||||
CHECKL(mfs->unitSize >= UNIT_MIN);
|
||||
CHECKL(mfs->extendBy >= UNIT_MIN);
|
||||
CHECKL(BoolCheck(mfs->extendSelf));
|
||||
arena = PoolArena(&mfs->poolStruct);
|
||||
|
|
@ -377,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;
|
||||
}
|
||||
|
|
@ -385,7 +386,7 @@ Bool MFSCheck(MFS mfs)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolmrg.c: MANUAL RANK GUARDIAN POOL
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
*
|
||||
|
|
@ -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 */
|
||||
|
|
@ -302,6 +302,7 @@ DEFINE_SEG_CLASS(MRGLinkSegClass, class)
|
|||
class->name = "MRGLSEG";
|
||||
class->size = sizeof(MRGLinkSegStruct);
|
||||
class->init = MRGLinkSegInit;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -314,6 +315,7 @@ DEFINE_SEG_CLASS(MRGRefSegClass, class)
|
|||
class->name = "MRGRSEG";
|
||||
class->size = sizeof(MRGRefSegStruct);
|
||||
class->init = MRGRefSegInit;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -629,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);
|
||||
|
|
@ -855,13 +857,14 @@ DEFINE_POOL_CLASS(MRGPoolClass, this)
|
|||
this->name = "MRG";
|
||||
this->size = sizeof(MRGStruct);
|
||||
this->offset = offsetof(MRGStruct, poolStruct);
|
||||
this->attr |= (AttrSCAN | AttrFREE | AttrINCR_RB);
|
||||
this->attr |= AttrSCAN;
|
||||
this->init = MRGInit;
|
||||
this->finish = MRGFinish;
|
||||
this->grey = PoolTrivGrey;
|
||||
this->blacken = PoolTrivBlacken;
|
||||
this->scan = MRGScan;
|
||||
this->describe = MRGDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -873,7 +876,7 @@ PoolClass PoolClassMRG(void)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolmv.c: MANUAL VARIABLE POOL
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* **** RESTRICTION: This pool may not allocate from the arena control
|
||||
|
|
@ -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);
|
||||
|
|
@ -792,6 +792,7 @@ DEFINE_POOL_CLASS(MVPoolClass, this)
|
|||
this->alloc = MVAlloc;
|
||||
this->free = MVFree;
|
||||
this->describe = MVDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -811,6 +812,7 @@ DEFINE_POOL_CLASS(MVDebugPoolClass, this)
|
|||
this->size = sizeof(MVDebugStruct);
|
||||
this->varargs = MVDebugVarargs;
|
||||
this->debugMixin = MVDebugMixin;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -901,7 +903,7 @@ Bool MVCheck(MV mv)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolmv2.c: MANUAL VARIABLE-SIZED TEMPORAL POOL
|
||||
*
|
||||
* $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: A manual-variable pool designed to take advantage of
|
||||
* placement according to predicted deathtime.
|
||||
|
|
@ -145,6 +145,7 @@ DEFINE_POOL_CLASS(MVTPoolClass, this)
|
|||
this->bufferFill = MVTBufferFill;
|
||||
this->bufferEmpty = MVTBufferEmpty;
|
||||
this->describe = MVTDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
/* Macros */
|
||||
|
|
@ -199,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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -278,7 +279,9 @@ static Res MVTInit(Pool pool, ArgList args)
|
|||
if (res != ResOK)
|
||||
goto failABQ;
|
||||
|
||||
FreelistInit(MVTFreelist(mvt), align);
|
||||
res = FreelistInit(MVTFreelist(mvt), align);
|
||||
if (res != ResOK)
|
||||
goto failFreelist;
|
||||
|
||||
pool->alignment = align;
|
||||
mvt->reuseSize = reuseSize;
|
||||
|
|
@ -343,6 +346,8 @@ static Res MVTInit(Pool pool, ArgList args)
|
|||
reserveDepth, fragLimit);
|
||||
return ResOK;
|
||||
|
||||
failFreelist:
|
||||
ABQFinish(arena, MVTABQ(mvt));
|
||||
failABQ:
|
||||
CBSFinish(MVTCBS(mvt));
|
||||
failCBS:
|
||||
|
|
@ -359,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);
|
||||
|
|
@ -375,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));
|
||||
}
|
||||
|
|
@ -683,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.
|
||||
<design/poolmvt/#arch.ap.no-fit.oversize> */
|
||||
|
|
@ -757,9 +759,11 @@ static Bool MVTDeleteOverlapping(Bool *deleteReturn, void *element,
|
|||
|
||||
|
||||
/* MVTReserve -- add a range to the available range queue, and if the
|
||||
* queue is full, return segments to the arena.
|
||||
* queue is full, return segments to the arena. Return TRUE if it
|
||||
* succeeded in adding the range to the queue, FALSE if the queue
|
||||
* overflowed.
|
||||
*/
|
||||
static Res MVTReserve(MVT mvt, Range range)
|
||||
static Bool MVTReserve(MVT mvt, Range range)
|
||||
{
|
||||
AVERT(MVT, mvt);
|
||||
AVERT(Range, range);
|
||||
|
|
@ -774,18 +778,18 @@ static Res MVTReserve(MVT mvt, Range range)
|
|||
SURELY(ABQPeek(MVTABQ(mvt), &oldRange));
|
||||
AVERT(Range, &oldRange);
|
||||
if (!MVTReturnSegs(mvt, &oldRange, arena))
|
||||
goto failOverflow;
|
||||
goto overflow;
|
||||
METER_ACC(mvt->returns, RangeSize(&oldRange));
|
||||
if (!ABQPush(MVTABQ(mvt), range))
|
||||
goto failOverflow;
|
||||
goto overflow;
|
||||
}
|
||||
|
||||
return ResOK;
|
||||
return TRUE;
|
||||
|
||||
failOverflow:
|
||||
overflow:
|
||||
mvt->abqOverflow = TRUE;
|
||||
METER_ACC(mvt->overflows, RangeSize(range));
|
||||
return ResFAIL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -820,7 +824,7 @@ static Res MVTInsert(MVT mvt, Addr base, Addr limit)
|
|||
* are coalesced on the ABQ.
|
||||
*/
|
||||
ABQIterate(MVTABQ(mvt), MVTDeleteOverlapping, &newRange, 0);
|
||||
MVTReserve(mvt, &newRange);
|
||||
(void)MVTReserve(mvt, &newRange);
|
||||
}
|
||||
|
||||
return ResOK;
|
||||
|
|
@ -875,11 +879,11 @@ static Res MVTDelete(MVT mvt, Addr base, Addr limit)
|
|||
*/
|
||||
RangeInit(&rangeLeft, RangeBase(&rangeOld), base);
|
||||
if (RangeSize(&rangeLeft) >= mvt->reuseSize)
|
||||
MVTReserve(mvt, &rangeLeft);
|
||||
(void)MVTReserve(mvt, &rangeLeft);
|
||||
|
||||
RangeInit(&rangeRight, limit, RangeLimit(&rangeOld));
|
||||
if (RangeSize(&rangeRight) >= mvt->reuseSize)
|
||||
MVTReserve(mvt, &rangeRight);
|
||||
(void)MVTReserve(mvt, &rangeRight);
|
||||
|
||||
return ResOK;
|
||||
}
|
||||
|
|
@ -1269,8 +1273,6 @@ static Bool MVTReturnSegs(MVT mvt, Range range, Arena arena)
|
|||
*/
|
||||
static Bool MVTRefillCallback(MVT mvt, Range range)
|
||||
{
|
||||
Res res;
|
||||
|
||||
AVERT(ABQ, MVTABQ(mvt));
|
||||
AVERT(Range, range);
|
||||
|
||||
|
|
@ -1278,11 +1280,7 @@ static Bool MVTRefillCallback(MVT mvt, Range range)
|
|||
return TRUE;
|
||||
|
||||
METER_ACC(mvt->refillPushes, ABQDepth(MVTABQ(mvt)));
|
||||
res = MVTReserve(mvt, range);
|
||||
if (res != ResOK)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return MVTReserve(mvt, range);
|
||||
}
|
||||
|
||||
static Bool MVTCBSRefillCallback(CBS cbs, Range range,
|
||||
|
|
@ -1488,7 +1486,7 @@ CBS _mps_mvt_cbs(mps_pool_t mps_pool) {
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolmvff.c: First Fit Manual Variable Pool
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* .purpose: This is a pool class for manually managed objects of
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
@ -720,6 +720,7 @@ DEFINE_POOL_CLASS(MVFFPoolClass, this)
|
|||
this->bufferFill = MVFFBufferFill;
|
||||
this->bufferEmpty = MVFFBufferEmpty;
|
||||
this->describe = MVFFDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -739,6 +740,7 @@ DEFINE_POOL_CLASS(MVFFDebugPoolClass, this)
|
|||
this->size = sizeof(MVFFDebugStruct);
|
||||
this->varargs = MVFFDebugVarargs;
|
||||
this->debugMixin = MVFFDebugMixin;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -828,7 +830,7 @@ CBS _mps_mvff_cbs(mps_pool_t mps_pool) {
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* pooln.c: NULL POOL CLASS
|
||||
*
|
||||
* $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 "pooln.h"
|
||||
|
|
@ -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;
|
||||
|
|
@ -270,8 +270,7 @@ DEFINE_POOL_CLASS(NPoolClass, this)
|
|||
this->name = "N";
|
||||
this->size = sizeof(PoolNStruct);
|
||||
this->offset = offsetof(PoolNStruct, poolStruct);
|
||||
this->attr = AttrSCAN | AttrALLOC | AttrFREE | AttrBUF |
|
||||
AttrBUF_RESERVE | AttrGC;
|
||||
this->attr |= (AttrALLOC | AttrBUF | AttrFREE | AttrGC | AttrSCAN);
|
||||
this->init = NInit;
|
||||
this->finish = NFinish;
|
||||
this->alloc = NAlloc;
|
||||
|
|
@ -287,6 +286,7 @@ DEFINE_POOL_CLASS(NPoolClass, this)
|
|||
this->reclaim = NReclaim;
|
||||
this->traceEnd = NTraceEnd;
|
||||
this->describe = NDescribe;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ Bool PoolNCheck(PoolN poolN)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* poolsnc.c: STACK NO CHECKING POOL CLASS
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* DESIGN
|
||||
*
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -185,6 +185,7 @@ DEFINE_BUFFER_CLASS(SNCBufClass, class)
|
|||
class->size = sizeof(SNCBufStruct);
|
||||
class->init = SNCBufInit;
|
||||
class->finish = SNCBufFinish;
|
||||
AVERT(BufferClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -216,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);
|
||||
}
|
||||
|
|
@ -237,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);
|
||||
|
|
@ -261,6 +262,7 @@ DEFINE_SEG_CLASS(SNCSegClass, class)
|
|||
class->name = "SNCSEG";
|
||||
class->size = sizeof(SNCSegStruct);
|
||||
class->init = sncSegInit;
|
||||
AVERT(SegClass, class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -365,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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -431,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);
|
||||
|
|
@ -682,6 +684,7 @@ DEFINE_POOL_CLASS(SNCPoolClass, this)
|
|||
this->framePopPending = SNCFramePopPending;
|
||||
this->walk = SNCWalk;
|
||||
this->bufferClass = SNCBufClassGet;
|
||||
AVERT(PoolClass, this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -699,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;
|
||||
}
|
||||
|
|
@ -707,7 +710,7 @@ static Bool SNCCheck(SNC snc)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* prmci3li.c: PROTECTION MUTATOR CONTEXT INTEL 386 (LINUX)
|
||||
*
|
||||
* $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: This module implements the part of the protection module
|
||||
* that decodes the MutatorFaultContext.
|
||||
|
|
@ -57,9 +57,10 @@ MRef Prmci3AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum)
|
|||
case 5: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EBP]);
|
||||
case 6: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_ESI]);
|
||||
case 7: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EDI]);
|
||||
default:
|
||||
NOTREACHED;
|
||||
return NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
NOTREACHED;
|
||||
return (MRef)NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* prmci3w3.c: PROTECTION MUTATOR CONTEXT INTEL 386 (Win32)
|
||||
*
|
||||
* $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
|
||||
*
|
||||
|
|
@ -46,9 +46,10 @@ MRef Prmci3AddressHoldingReg(MutatorFaultContext context, unsigned int regnum)
|
|||
case 5: return (MRef)&wincont->Ebp;
|
||||
case 6: return (MRef)&wincont->Esi;
|
||||
case 7: return (MRef)&wincont->Edi;
|
||||
default:
|
||||
NOTREACHED;
|
||||
return NULL; /* suppress warning */
|
||||
}
|
||||
NOTREACHED;
|
||||
return NULL; /* suppress warning */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ void Prmci3StepOverIns(MutatorFaultContext context, Size inslen)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* prmci3xc.c: PROTECTION MUTATOR CONTEXT INTEL 386 (MAC OS X)
|
||||
*
|
||||
* $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: This module implements the part of the protection module
|
||||
* that decodes the MutatorFaultContext.
|
||||
|
|
@ -55,9 +55,10 @@ MRef Prmci3AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum)
|
|||
case 5: return (MRef)((char *)&mfc->threadState->__ebp);
|
||||
case 6: return (MRef)((char *)&mfc->threadState->__esi);
|
||||
case 7: return (MRef)((char *)&mfc->threadState->__edi);
|
||||
default:
|
||||
NOTREACHED;
|
||||
return NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
NOTREACHED;
|
||||
return (MRef)NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -104,7 +105,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* prmci6li.c: PROTECTION MUTATOR CONTEXT x64 (LINUX)
|
||||
*
|
||||
* $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: This module implements the part of the protection module
|
||||
* that decodes the MutatorFaultContext.
|
||||
|
|
@ -61,9 +61,10 @@ MRef Prmci6AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum)
|
|||
case 13: return &gregs[REG_R13];
|
||||
case 14: return &gregs[REG_R14];
|
||||
case 15: return &gregs[REG_R15];
|
||||
default:
|
||||
NOTREACHED;
|
||||
return NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
NOTREACHED;
|
||||
return (MRef)NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -111,7 +112,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* prmci6w3.c: PROTECTION MUTATOR CONTEXT INTEL 386 (Win32)
|
||||
*
|
||||
* $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
|
||||
*
|
||||
|
|
@ -52,9 +52,10 @@ MRef Prmci6AddressHoldingReg(MutatorFaultContext context, unsigned int regnum)
|
|||
case 13: return (MRef)&wincont->R13;
|
||||
case 14: return (MRef)&wincont->R14;
|
||||
case 15: return (MRef)&wincont->R15;
|
||||
default:
|
||||
NOTREACHED;
|
||||
return NULL; /* suppress warning */
|
||||
}
|
||||
NOTREACHED;
|
||||
return NULL; /* suppress warning */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ void Prmci6StepOverIns(MutatorFaultContext context, Size inslen)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* prmci6xc.c: PROTECTION MUTATOR CONTEXT x64 (MAC OS X)
|
||||
*
|
||||
* $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: This module implements the part of the protection module
|
||||
* that decodes the MutatorFaultContext.
|
||||
|
|
@ -58,9 +58,10 @@ MRef Prmci6AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum)
|
|||
case 13: return (MRef)((char *)&mfc->threadState->__r13);
|
||||
case 14: return (MRef)((char *)&mfc->threadState->__r14);
|
||||
case 15: return (MRef)((char *)&mfc->threadState->__r15);
|
||||
default:
|
||||
NOTREACHED;
|
||||
return NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
NOTREACHED;
|
||||
return (MRef)NULL; /* Avoids compiler warning. */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* pool.c: PROTOCOL 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.
|
||||
*
|
||||
* DESIGN
|
||||
*
|
||||
|
|
@ -18,7 +18,7 @@ SRCID(protocol, "$Id$");
|
|||
Bool ProtocolClassCheck(ProtocolClass class)
|
||||
{
|
||||
CHECKS(ProtocolClass, class);
|
||||
CHECKS(ProtocolClass, class->superclass);
|
||||
CHECKU(ProtocolClass, class->superclass);
|
||||
CHECKL(FUNCHECK(class->coerceInst));
|
||||
CHECKL(FUNCHECK(class->coerceClass));
|
||||
return TRUE;
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +118,7 @@ DEFINE_CLASS(ProtocolClass, theClass)
|
|||
theClass->superclass = theClass;
|
||||
theClass->coerceInst = ProtocolCoerceInst;
|
||||
theClass->coerceClass = ProtocolCoerceClass;
|
||||
AVERT(ProtocolClass, theClass);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -126,7 +127,7 @@ DEFINE_CLASS(ProtocolClass, theClass)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -106,11 +106,13 @@ LONG WINAPI ProtSEHfilter(LPEXCEPTION_POINTERS info)
|
|||
|
||||
void ProtSetup(void)
|
||||
{
|
||||
void *handler;
|
||||
/* See "AddVectoredExceptionHandler function (Windows)"
|
||||
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms679274%28v=vs.85%29.aspx> */
|
||||
/* ProtSetup is called only once per process, not once per arena, so
|
||||
this exception handler is only installed once. */
|
||||
AddVectoredExceptionHandler(1uL, ProtSEHfilter);
|
||||
handler = AddVectoredExceptionHandler(1uL, ProtSEHfilter);
|
||||
AVER(handler != NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ static void swap(void)
|
|||
|
||||
static void makerndlist(unsigned l)
|
||||
{
|
||||
unsigned i;
|
||||
size_t i;
|
||||
mps_word_t r;
|
||||
mps_addr_t addr;
|
||||
|
||||
|
|
@ -318,15 +318,14 @@ static void validate(void)
|
|||
for(i = 0; i < listl; ++i) {
|
||||
cdie(((QSCell)reg[1])->tag == QSInt, "validate int");
|
||||
if((mps_word_t)((QSCell)reg[1])->value != list[i]) {
|
||||
fprintf(stdout,
|
||||
"mps_res_t: Element %"PRIuLONGEST" of the two lists do not match.\n",
|
||||
(ulongest_t)i);
|
||||
(void)fprintf(stdout, "mps_res_t: Element %"PRIuLONGEST" of the "
|
||||
"two lists do not match.\n", (ulongest_t)i);
|
||||
return;
|
||||
}
|
||||
reg[1] = (mps_addr_t)((QSCell)reg[1])->tail;
|
||||
}
|
||||
cdie(reg[1] == (mps_word_t)0, "validate end");
|
||||
fprintf(stdout, "Note: Lists compare equal.\n");
|
||||
(void)fprintf(stdout, "Note: Lists compare equal.\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -335,7 +334,6 @@ static void *go(void *p, size_t s)
|
|||
mps_fmt_t format;
|
||||
mps_chain_t chain;
|
||||
mps_addr_t base;
|
||||
mps_addr_t *addr;
|
||||
|
||||
testlib_unused(p);
|
||||
testlib_unused(s);
|
||||
|
|
@ -358,9 +356,7 @@ static void *go(void *p, size_t s)
|
|||
"RootCreateTable");
|
||||
|
||||
base = &activationStack;
|
||||
addr = base;
|
||||
die(mps_root_create_table(&actroot, arena, mps_rank_ambig(), 0,
|
||||
addr, sizeof(QSCell)/sizeof(mps_addr_t)),
|
||||
die(mps_root_create_table(&actroot, arena, mps_rank_ambig(), 0, base, 1),
|
||||
"RootCreateTable");
|
||||
|
||||
/* makes a random list */
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "mpstd.h"
|
||||
|
||||
|
||||
#ifdef MPS_PF_W3I6MV
|
||||
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
|
||||
#define PRIuLONGEST "llu"
|
||||
#define PRIXPTR "016llX"
|
||||
typedef unsigned long long ulongest_t;
|
||||
|
|
@ -47,6 +47,7 @@ static Word eventTime = 0; /* current event time */
|
|||
|
||||
/* error -- error signalling */
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2))
|
||||
static void error(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue