From 44cb42a24859c9304f2d18816f0ca397d9a05475 Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Thu, 4 Jul 2002 16:10:08 +0100 Subject: Better timing test for amc. Copied from Perforce Change: 30791 ServerID: perforce.ravenbrook.com --- mps/code/steptest.c | 553 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 387 insertions(+), 166 deletions(-) (limited to 'mps/code') diff --git a/mps/code/steptest.c b/mps/code/steptest.c index 826b76579d3..b4bcc037aa2 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -1,9 +1,9 @@ -/* steptest.c: TEST FOR ARENA CLAMPING AND STEPPING +/* steptest.c: TEST FOR ARENA STEPPING * * $Id$ * Copyright (C) 1998 Ravenbrook Limited. See end of file for license. * - * Based on . + * Loosely based on . */ #include "fmtdy.h" @@ -23,13 +23,41 @@ #define avLEN 3 #define exactRootsCOUNT 200 #define ambigRootsCOUNT 50 -#define objCOUNT 1000000 -#define genCOUNT 2 +#define objCOUNT 2000000 +#define clockSetFREQ 10000 + +#define genCOUNT 3 +#define gen1SIZE 750 /* kB */ +#define gen2SIZE 2000 /* kB */ +#define gen3SIZE 5000 /* kB */ +#define gen1MORTALITY 0.85 +#define gen2MORTALITY 0.60 +#define gen3MORTALITY 0.40 /* testChain -- generation parameters for the test */ static mps_gen_param_s testChain[genCOUNT] = { - { 150, 0.85 }, { 170, 0.45 } }; + {gen1SIZE, gen1MORTALITY}, + {gen2SIZE, gen2MORTALITY}, + {gen3SIZE, gen3MORTALITY}, +}; + +/* run the test several times, calling mps_arena_step at a different + * frequency each time. When we call it often, tracing is never done + * during allocation. When we call it never, tracing is always done + * during allocation. + */ + +static size_t step_frequencies[] = { + 1000, + 5000, + 10000, + 1000000000, +}; + +#define TESTS (sizeof(step_frequencies) / sizeof(step_frequencies[0])) + +static int test_number = 0; /* objNULL needs to be odd so that it's ignored in exactRoots. */ @@ -40,6 +68,29 @@ static mps_ap_t ap; static mps_addr_t exactRoots[exactRootsCOUNT]; static mps_addr_t ambigRoots[ambigRootsCOUNT]; +/* Things we want to measure. Times are all in microseconds. */ + +double alloc_time; /* Time spent allocating */ +double max_alloc_time; /* Max time taken to allocate one object */ +double step_time; /* Time spent in mps_arena_step returning 1 */ +double max_step_time; /* Max time of mps_arena_step returning 1 */ +double no_step_time; /* Time spent in mps_arena_step returning 0 */ +double max_no_step_time; /* Max time of mps_arena_step returning 0 */ + +double total_clock_time; /* Time spent reading the clock */ +long clock_reads; /* Number of times clock is read */ +long steps; /* # of mps_arena_step calls returning 1 */ +long no_steps; /* # of mps_arena_step calls returning 0 */ +long alloc_bytes; /* # of bytes allocated */ +long commit_failures; /* # of times mps_commit fails */ + + +/* Operating-system dependent timing. Defines two functions, void + * prepare_clock(void) and double my_clock(void). my_clock() returns + * the number of microseconds of CPU time used so far by the process. + * prepare_clock() sets things up so that my_clock() can run + * efficiently. + */ #ifdef MPS_OS_W3 @@ -47,7 +98,7 @@ static HANDLE currentProcess; static void prepare_clock(void) { - currentProcess = GetCurrentProcess(); + currentProcess = GetCurrentProcess(); } static double my_clock(void) @@ -55,10 +106,13 @@ static double my_clock(void) FILETIME ctime, etime, ktime, utime; double dk, du; GetProcessTimes(currentProcess, &ctime, &etime, &ktime, &utime); - dk = ktime.dwHighDateTime * 4096.0 * 1024.0 * 1024.0 + ktime.dwLowDateTime; + dk = ktime.dwHighDateTime * 4096.0 * 1024.0 * 1024.0 + + ktime.dwLowDateTime; dk /= 10.0; - du = utime.dwHighDateTime * 4096.0 * 1024.0 * 1024.0 + utime.dwLowDateTime; + du = utime.dwHighDateTime * 4096.0 * 1024.0 * 1024.0 + + utime.dwLowDateTime; du /= 10.0; + ++ clock_reads; return (du+dk); } @@ -71,208 +125,375 @@ static double my_clock(void) static void prepare_clock(void) { + /* do nothing */ } static double my_clock(void) { struct rusage ru; getrusage(RUSAGE_SELF, &ru); + ++ clock_reads; return ((ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) * 1000000.0 + - (ru.ru_utime.tv_usec) + - (ru.ru_stime.tv_usec)); + (ru.ru_utime.tv_usec + + ru.ru_stime.tv_usec)); } #endif -double alloc_time, step_time, no_step_time, max_step_time, max_no_step_time, max_alloc_time; +/* Need to calibrate the clock. */ +/* In fact we need to do this repeatedly while the tests run because + * on some platforms the time taken to read the clock changes + * significantly during program execution. Yes, really (e.g. fri4gc + * on thrush.ravenbrook.com on 2002-06-28, clock_time goes from 5.43 + * us near process start to 7.45 us later). */ -long steps, no_steps; +double clock_time; /* current estimate of time to read the clock */ -long alloc_bytes; -long commit_failures; +#define CLOCK_TESTS 20000 -#define CLOCK_TESTS 100000 +/* set_clock_timing() sets clock_time. */ -static double clock_timing(void) +static void set_clock_timing(void) { long i; - double t1, t2; + double t1, t2, t3; t2 = 0.0; + t3 = my_clock(); for (i=0; i MAXPRINTABLE) { + while (x[-1] && t > MAXPRINTABLE) { + t /= 1000.0; + -- x; + } + if (t < MAXPRINTABLE) { + printf("%.3f %cs", t, *x); + } else { + printf("%.3f s", t/1000.0); + } + } else { + while (x[1] && t < MINPRINTABLE) { + t *= 1000.0; + ++ x; + } + if (t > MINPRINTABLE) + printf("%.3f %cs", t, *x); + else + printf("%g s", ot/1000000.0); + } + if (after) + printf(after); } +/* Make a single Dylan object */ + static mps_addr_t make(void) { - size_t length = rnd() % (2*avLEN); - size_t size = (length+2) * sizeof(mps_word_t); - mps_addr_t p; - mps_res_t res; + size_t length = rnd() % (avLEN * 2); + size_t size = (length+2) * sizeof(mps_word_t); + mps_addr_t p; + mps_res_t res; - alloc_bytes += size; + alloc_bytes += size; - for(;;) { - mps_bool_t commit_res; - double t1 = my_clock(); - MPS_RESERVE_BLOCK(res, p, ap, size); - t1 = my_clock() - t1; - alloc_time += t1; - if (t1 > max_alloc_time) - max_alloc_time = t1; - if(res) - die(res, "MPS_RESERVE_BLOCK"); - res = dylan_init(p, size, exactRoots, exactRootsCOUNT); - if(res) - die(res, "dylan_init"); - t1 = my_clock(); - commit_res = mps_commit(ap, p, size); - t1 = my_clock() - t1; - alloc_time += t1; - if (t1 > max_alloc_time) - max_alloc_time = t1; - if (commit_res) - break; - else - ++ commit_failures; - } - - return p; + for(;;) { + mps_bool_t commit_res; + double t1, t2; + t1 = my_clock(); + MPS_RESERVE_BLOCK(res, p, ap, size); + t1 = time_since(t1); /* reserve time */ + if(res) + die(res, "MPS_RESERVE_BLOCK"); + res = dylan_init(p, size, exactRoots, exactRootsCOUNT); + if(res) + die(res, "dylan_init"); + t2 = my_clock(); + commit_res = mps_commit(ap, p, size); + t2 = time_since(t2); /* commit time */ + t1 += t2; /* total MPS time for this allocation */ + alloc_time += t1; + if (t1 > max_alloc_time) + max_alloc_time = t1; + if (commit_res) + break; + else + ++ commit_failures; + } + + return p; } +/* call mps_arena_step() */ + static void test_step(mps_arena_t arena) { - mps_bool_t res; - double t1 = my_clock(); - res = mps_arena_step(arena, 0.1); - t1 = my_clock() - t1; - if (res) { - if (t1 > max_step_time) - max_step_time = t1; - step_time += t1; - ++ steps; - } else { - if (t1 > max_no_step_time) - max_no_step_time = t1; - no_step_time += t1; - ++ no_steps; - } + mps_bool_t res; + double t1 = my_clock(); + res = mps_arena_step(arena, 0.1); + t1 = time_since(t1); + if (res) { + if (t1 > max_step_time) + max_step_time = t1; + step_time += t1; + ++ steps; + } else { + if (t1 > max_no_step_time) + max_no_step_time = t1; + no_step_time += t1; + ++ no_steps; + } } /* test -- the body of the test */ static void *test(void *arg, size_t s) { - mps_arena_t arena; - mps_fmt_t format; - mps_chain_t chain; - mps_root_t exactRoot, ambigRoot; - unsigned long objs; size_t i; - - arena = (mps_arena_t)arg; - (void)s; /* unused */ - - die(dylan_fmt(&format, arena), "fmt_create"); - die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); - - die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), - "pool_create(amc)"); - - die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); - - for(i = 0; i < exactRootsCOUNT; ++i) - exactRoots[i] = objNULL; - for(i = 0; i < ambigRootsCOUNT; ++i) - ambigRoots[i] = (mps_addr_t)rnd(); - - die(mps_root_create_table_masked(&exactRoot, arena, - MPS_RANK_EXACT, (mps_rm_t)0, - &exactRoots[0], exactRootsCOUNT, - (mps_word_t)1), - "root_create_table(exact)"); - die(mps_root_create_table(&ambigRoot, arena, - MPS_RANK_AMBIG, (mps_rm_t)0, - &ambigRoots[0], ambigRootsCOUNT), - "root_create_table(ambig)"); - - objs = 0; - steps = no_steps = 0; - alloc_bytes = 0; - commit_failures = 0; - alloc_time = step_time = no_step_time = 0.0; - max_alloc_time = max_step_time = max_no_step_time = 0.0; - - while(objs < objCOUNT) { - size_t r; - - r = (size_t)rnd(); - if(r & 1) { - i = (r >> 1) % exactRootsCOUNT; - if(exactRoots[i] != objNULL) - cdie(dylan_check(exactRoots[i]), "dying root check"); - exactRoots[i] = make(); - if(exactRoots[(exactRootsCOUNT-1) - i] != objNULL) - dylan_write(exactRoots[(exactRootsCOUNT-1) - i], - exactRoots, exactRootsCOUNT); - } else { - i = (r >> 1) % ambigRootsCOUNT; - ambigRoots[(ambigRootsCOUNT-1) - i] = make(); - /* Create random interior pointers */ - ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1); + mps_arena_t arena; + mps_fmt_t format; + mps_chain_t chain; + mps_root_t exactRoot, ambigRoot; + unsigned long objs; size_t i; + mps_message_t message; + size_t live, condemned, not_condemned; + size_t messages; + mps_word_t collections, old_collections; + double total_mps_time; + + arena = (mps_arena_t)arg; + (void)s; /* unused */ + + die(dylan_fmt(&format, arena), "fmt_create"); + die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); + + die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain), + "pool_create(amc)"); + + die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); + + for(i = 0; i < exactRootsCOUNT; ++i) + exactRoots[i] = objNULL; + for(i = 0; i < ambigRootsCOUNT; ++i) + ambigRoots[i] = (mps_addr_t)rnd(); + + die(mps_root_create_table_masked(&exactRoot, arena, + MPS_RANK_EXACT, (mps_rm_t)0, + &exactRoots[0], exactRootsCOUNT, + (mps_word_t)1), + "root_create_table(exact)"); + die(mps_root_create_table(&ambigRoot, arena, + MPS_RANK_AMBIG, (mps_rm_t)0, + &ambigRoots[0], ambigRootsCOUNT), + "root_create_table(ambig)"); + + printf("Stepping every %lu allocations.\n", + (unsigned long)step_frequencies[test_number]); + + mps_message_type_enable(arena, mps_message_type_gc()); + + /* zero all our counters and timers. */ + + objs = 0; + clock_reads = 0; + steps = no_steps = 0; + alloc_bytes = 0; + commit_failures = 0; + alloc_time = step_time = no_step_time = 0.0; + max_alloc_time = max_step_time = max_no_step_time = 0.0; + total_clock_time = 0.0; + collections = old_collections = 0; + + while(objs < objCOUNT) { + size_t r; + + r = (size_t)rnd(); + if(r & 1) { + i = (r >> 1) % exactRootsCOUNT; + if(exactRoots[i] != objNULL) + cdie(dylan_check(exactRoots[i]), "dying root check"); + exactRoots[i] = make(); + if(exactRoots[(exactRootsCOUNT-1) - i] != objNULL) + dylan_write(exactRoots[(exactRootsCOUNT-1) - i], + exactRoots, exactRootsCOUNT); + } else { + i = (r >> 1) % ambigRootsCOUNT; + ambigRoots[(ambigRootsCOUNT-1) - i] = make(); + /* Create random interior pointers */ + ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1); + } + + ++objs; + + if (objs % step_frequencies[test_number] == 0) + test_step(arena); + + if (objs % clockSetFREQ == 0) + set_clock_timing(); + + collections = mps_collections(arena); + if (collections > old_collections) { + old_collections = collections; + putchar('.'); + fflush(stdout); + } } - if(objs % 1000 == 0) { - test_step(arena); + if (collections > 0) + printf("\n"); + + messages = live = condemned = not_condemned = 0; + while (mps_message_get(&message, arena, mps_message_type_gc())) { + ++ messages; + live += mps_message_gc_live_size(arena, message); + condemned += mps_message_gc_condemned_size(arena, message); + not_condemned += mps_message_gc_not_condemned_size(arena, + message); + mps_message_discard(arena, message); + } + if (collections != messages) { + printf("%lu collections but %lu messages\n", + (unsigned long)collections, (unsigned long)messages); + collections = messages; } - ++objs; - } - - printf("%ld objects (%ld bytes) allocated\n", objs, alloc_bytes); - printf("commit failed %ld times\n", commit_failures); - printf("allocation took %.0f us, mean %.2f us, max %.0f us\n", - alloc_time, alloc_time / objs, max_alloc_time); - printf("%ld steps took %.0f us, mean %.2f us, max %.0f us\n", - steps, step_time, step_time / steps, max_step_time); - printf("%ld non-steps took %.0f us, mean %.2f us, max %.0f us\n", - no_steps, no_step_time, no_step_time / no_steps, max_no_step_time); - - printf("clock timing %.2f us\n", clock_timing()); - - mps_ap_destroy(ap); - mps_root_destroy(exactRoot); - mps_root_destroy(ambigRoot); - mps_pool_destroy(pool); - mps_chain_destroy(chain); - mps_fmt_destroy(format); + total_mps_time = alloc_time + step_time + no_step_time; + printf("Collection statistics:\n"); + printf(" %lu collections\n", (unsigned long)collections); + printf(" %lu bytes condemned.\n", (unsigned long)condemned); + printf(" %lu bytes not condemned.\n", + (unsigned long)not_condemned); + printf(" %lu bytes survived.\n", (unsigned long)live); + if (condemned) { + printf(" Mortality %5.2f%%.\n", + (1.0 - ((double)live)/condemned) * 100.0); + printf(" Condemned fraction %5.2f%%.\n", + ((double)condemned/(condemned + not_condemned)) * 100.0); + } + if (collections) { + printf(" Condemned per collection %lu bytes.\n", + (unsigned long)condemned/collections); + printf(" Reclaimed per collection %lu bytes.\n", + (unsigned long)(condemned - live)/collections); + } - return NULL; + printf("Allocation statistics:\n"); + printf(" %ld objects (%ld bytes) allocated.\n", objs, alloc_bytes); + printf(" Commit failed %ld times.\n", commit_failures); + + printf("Timings:\n"); + print_time(" Allocation took ", alloc_time, ""); + print_time(", mean ", alloc_time / objs, ""); + print_time(", max ", max_alloc_time, ".\n"); + if (steps) { + printf(" %ld steps took ", steps); + print_time("", step_time, ""); + print_time(", mean ", step_time/steps, ""); + print_time(", max ", max_step_time, ".\n"); + } + if (no_steps) { + printf(" %ld non-steps took ", no_steps); + print_time("", no_step_time, ""); + print_time(", mean ", no_step_time / no_steps, ""); + print_time(", max ", max_no_step_time, ".\n"); + } + if (alloc_time > 0.0) + printf(" Allocated %.2f bytes per us.\n", + (double)alloc_bytes/alloc_time); + if (step_time > 0.0) { + printf(" Reclaimed %.2f bytes per us of step.\n", + (double)(condemned - live)/step_time); + if (collections > 0) { + printf(" Took %.2f steps ", (double)steps/collections); + print_time("(", step_time / collections, ") per collection.\n"); + } + } + print_time(" Total MPS time ", total_mps_time, ""); + print_time(" (", total_mps_time/alloc_bytes, " per byte, "); + print_time("", total_mps_time/objs, " per object)\n"); + print_time(" (adjusted for clock timing: ", + total_clock_time, + " spent reading the clock;\n"); + printf(" %lu clock reads; ", (unsigned long)clock_reads); + print_time("", total_clock_time / clock_reads, " per read)\n"); + mps_ap_destroy(ap); + mps_root_destroy(exactRoot); + mps_root_destroy(ambigRoot); + mps_pool_destroy(pool); + mps_chain_destroy(chain); + mps_fmt_destroy(format); + + return NULL; } int main(int argc, char **argv) { - mps_arena_t arena; - mps_thr_t thread; - void *r; - - prepare_clock(); - - randomize(argc, argv); - - die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), - "arena_create"); - die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit"); - die(mps_thread_reg(&thread, arena), "thread_reg"); - mps_tramp(&r, test, arena, 0); - mps_thread_dereg(thread); - mps_arena_destroy(arena); + prepare_clock(); + + randomize(argc, argv); + + while (test_number < TESTS) { + mps_arena_t arena; + mps_thr_t thread; + void *r; + + set_clock_timing(); + die(mps_arena_create(&arena, mps_arena_class_vm(), + testArenaSIZE), + "arena_create"); + die(mps_thread_reg(&thread, arena), "thread_reg"); + mps_tramp(&r, test, arena, 0); + mps_thread_dereg(thread); + mps_arena_destroy(arena); + ++ test_number; + } - fflush(stdout); /* synchronize */ - fprintf(stderr, "\nConclusion: Failed to find any defects.\n"); - return 0; + fflush(stdout); /* synchronize */ + fprintf(stderr, "\nConclusion: Failed to find any defects.\n"); + return 0; } @@ -281,18 +502,18 @@ int main(int argc, char **argv) * Copyright (C) 2001-2002 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. Redistributions in any form must be accompanied by information on how * to obtain complete source code for this software and any accompanying * software that uses this software. The source code must either be @@ -303,7 +524,7 @@ int main(int argc, char **argv) * 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 -- cgit v1.2.1 From 175b300c786312ee7310fb88e2f93c8cd7e00d28 Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Thu, 4 Jul 2002 16:41:03 +0100 Subject: Improve clock calibration so it does a better job on low-granularity clocks. Copied from Perforce Change: 30792 ServerID: perforce.ravenbrook.com --- mps/code/steptest.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'mps/code') diff --git a/mps/code/steptest.c b/mps/code/steptest.c index b4bcc037aa2..eca90727625 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -149,7 +149,8 @@ static double my_clock(void) double clock_time; /* current estimate of time to read the clock */ -#define CLOCK_TESTS 20000 +/* take at least this many microseconds to set the clock */ +#define CLOCK_TIME_SET 10000 /* set_clock_timing() sets clock_time. */ @@ -160,12 +161,14 @@ static void set_clock_timing(void) t2 = 0.0; t3 = my_clock(); - for (i=0; i 0) printf("\n"); @@ -454,8 +459,10 @@ static void *test(void *arg, size_t s) print_time("(", step_time / collections, ") per collection.\n"); } } + print_time(" Total time ", total_time, ".\n"); print_time(" Total MPS time ", total_mps_time, ""); - print_time(" (", total_mps_time/alloc_bytes, " per byte, "); + printf(" (%5.2f%%, ", total_mps_time * 100.0 / total_time); + print_time("", total_mps_time/alloc_bytes, " per byte, "); print_time("", total_mps_time/objs, " per object)\n"); print_time(" (adjusted for clock timing: ", total_clock_time, -- cgit v1.2.1 From be3dfe6079920f5603dc11a3850199659c738267 Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Thu, 4 Jul 2002 17:23:35 +0100 Subject: Time_since will almost always be zero. Copied from Perforce Change: 30795 ServerID: perforce.ravenbrook.com --- mps/code/steptest.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mps/code') diff --git a/mps/code/steptest.c b/mps/code/steptest.c index 671986c82d5..a2709b063f2 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -188,13 +188,11 @@ static void set_clock_timing(void) static double time_since(double t) { t = my_clock() - t; - if (t < clock_time) { - total_clock_time += clock_time + t; + total_clock_time += clock_time + clock_time; + if (t < clock_time) return 0.0; - } else { - total_clock_time += clock_time + clock_time; + else return (t - clock_time); - } } /* print a number of microseconds in a useful format. */ @@ -468,7 +466,8 @@ static void *test(void *arg, size_t s) total_clock_time, " spent reading the clock;\n"); printf(" %lu clock reads; ", (unsigned long)clock_reads); - print_time("", total_clock_time / clock_reads, " per read)\n"); + print_time("", total_clock_time / clock_reads, " per read;"); + print_time(" recently measured as ", clock_time, ").\n"); mps_ap_destroy(ap); mps_root_destroy(exactRoot); mps_root_destroy(ambigRoot); -- cgit v1.2.1 From d7b4e67a529148d029f1e055b6dd0ec3cf9d174a Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Mon, 8 Jul 2002 14:22:32 +0100 Subject: Remove configura-specific stuff from the build system. Copied from Perforce Change: 30877 ServerID: perforce.ravenbrook.com --- mps/code/commpost.nmk | 6 +++--- mps/code/commpre.nmk | 10 ---------- mps/code/config.h | 8 -------- mps/code/w3i3mv.nmk | 22 ---------------------- 4 files changed, 3 insertions(+), 43 deletions(-) (limited to 'mps/code') diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index e7be53c65a3..1dd3303817a 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -35,7 +35,7 @@ mpmss.exe amcss.exe amcsshe.exe amsss.exe amssshe.exe segsmss.exe awlut.exe awlu abqtest.exe cbstest.exe btcv.exe mv2test.exe messtest.exe steptest.exe \ locbwcss.exe locusss.exe \ replay.exe replaysw.exe eventcnv.exe \ - mmdw.lib mmsw.lib mps_conf.lib mpsplan.lib: + mmdw.lib mmsw.lib mps.lib mpsplan.lib: !IFDEF VARIETY $(MAKE) /nologo /f $(PFM).nmk TARGET=$@ variety !ELSE @@ -140,7 +140,7 @@ $(PFM)\$(VARIETY)\amcss.exe: $(PFM)\$(VARIETY)\amcss.obj \ $(TESTLIBOBJ) $(PFM)\$(VARIETY)\amcsshe.exe: $(PFM)\$(VARIETY)\amcsshe.obj \ - $(CONFIGURAOBJ) $(AMCOBJ) $(PLINTHOBJ) $(HETESTOBJ) \ + $(MPMOBJ) $(AMCOBJ) $(PLINTHOBJ) $(HETESTOBJ) \ $(TESTLIBOBJ) $(PFM)\$(VARIETY)\amsss.exe: $(PFM)\$(VARIETY)\amsss.obj \ @@ -228,7 +228,7 @@ $(PFM)\$(VARIETY)\mmdw.lib: $(MPMOBJ) $(AMCOBJ) $(DWOBJ) \ $(ECHO) $@ $(LIBMAN) $(LIBFLAGS) /OUT:$@ $** -$(PFM)\$(VARIETY)\mps_conf.lib: $(CONFIGURAOBJ) $(AMCOBJ) $(LOOBJ) $(SNCOBJ) \ +$(PFM)\$(VARIETY)\mps.lib: $(MPMOBJ) $(AMCOBJ) $(LOOBJ) $(SNCOBJ) \ $(MVFFOBJ) $(AMSOBJ) $(AWLOBJ) $(ECHO) $@ $(LIBMAN) $(LIBFLAGS) /OUT:$@ $** diff --git a/mps/code/commpre.nmk b/mps/code/commpre.nmk index ca86c24bcf6..495f90d6265 100644 --- a/mps/code/commpre.nmk +++ b/mps/code/commpre.nmk @@ -112,16 +112,6 @@ LINKFLAGSWHITE = libcmt.lib LINKFLAGSHOT = libcmt.lib LINKFLAGSCOOL = libcmt.lib -!elseif "$(TARGET)" == "mps_conf.lib" || "$(TARGET)" == "amcsshe.exe" -CFLAGSTARGETPRE = /DCONFIG_PROD_CONFIGURA -CFLAGSTARGETPOST = -CRTFLAGSW = /ML -CRTFLAGSH = /ML -CRTFLAGSC = /MLd -LINKFLAGSWHITE = libc.lib -LINKFLAGSHOT = libc.lib -LINKFLAGSCOOL = libcd.lib - !else CFLAGSTARGETPRE = /DCONFIG_PROD_MPS CFLAGSTARGETPOST = diff --git a/mps/code/config.h b/mps/code/config.h index e5443336a3a..c5dd1405c69 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -275,14 +275,6 @@ #define DONGLE_NONE #define PROD_CHECK_DEFAULT CheckSHALLOW -#elif defined(CONFIG_PROD_CONFIGURA) -#define MPS_PROD_STRING "configura" -#define MPS_PROD_CONFIGURA -#define ARENA_INIT_SPARE_COMMIT_LIMIT ((Size)10uL*1024uL*1024uL) -#define THREAD_SINGLE -#define PROTECTION -#define DONGLE_NONE - #elif defined(CONFIG_PROD_MPS) #define MPS_PROD_STRING "mps" #define MPS_PROD_MPS diff --git a/mps/code/w3i3mv.nmk b/mps/code/w3i3mv.nmk index 41636b37faf..f3b98dbdea7 100644 --- a/mps/code/w3i3mv.nmk +++ b/mps/code/w3i3mv.nmk @@ -27,14 +27,6 @@ SW = \ \ \ -CONFIGURA = \ - \ - \ - \ - \ - \ - \ - PLINTH = AMC = AMS = @@ -70,8 +62,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\he\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\he\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\he\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\he\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\he\) @@ -103,8 +93,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\ce\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\ce\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\ce\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\ce\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\ce\) @@ -136,8 +124,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\hi\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\hi\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\hi\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\hi\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\hi\) @@ -169,8 +155,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\ci\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\ci\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\ci\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\ci\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\ci\) @@ -202,8 +186,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\ti\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\ti\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\ti\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\ti\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\ti\) @@ -235,8 +217,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\wi\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\wi\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\wi\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\wi\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\wi\) @@ -268,8 +248,6 @@ PLINTHOBJ0 = $(PLINTH:<=w3i3mv\we\) PLINTHOBJ = $(PLINTHOBJ0:>=.obj) SWOBJ0 = $(SW:<=w3i3mv\we\) SWOBJ = $(SWOBJ0:>=.obj) -CONFIGURAOBJ0 = $(CONFIGURA:<=w3i3mv\we\) -CONFIGURAOBJ = $(CONFIGURAOBJ0:>=.obj) AMSOBJ0 = $(AMS:<=w3i3mv\we\) AMSOBJ = $(AMSOBJ0:>=.obj) AMCOBJ0 = $(AMC:<=w3i3mv\we\) -- cgit v1.2.1 From 739244733c92366bf43cc166f48d18cbd5c1295f Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Mon, 8 Jul 2002 14:34:10 +0100 Subject: Add a batch file for building the mps on windows, which should really be part of the release procedure. Copied from Perforce Change: 30879 ServerID: perforce.ravenbrook.com --- mps/code/w3build.bat | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 mps/code/w3build.bat (limited to 'mps/code') diff --git a/mps/code/w3build.bat b/mps/code/w3build.bat new file mode 100755 index 00000000000..25e4cb72c76 --- /dev/null +++ b/mps/code/w3build.bat @@ -0,0 +1,44 @@ +@rem impl.bat.gathconf: GATHERING A RELEASE FOR CONFIGURA +@rem +@rem $HopeName: !gathconf.bat(trunk.1) $ +@rem Copyright (C) 2000 Harlequin Limited. All rights reserved. + +rmdir /s w3i3mv +nmake /f w3i3mv.nmk VARIETY=we mps.lib mpsplan.lib +nmake /f w3i3mv.nmk VARIETY=wi mps.lib mpsplan.lib +nmake /f w3i3mv.nmk VARIETY=ce mps.lib mpsplan.lib +nmake /f w3i3mv.nmk VARIETY=ci mps.lib mpsplan.lib +mkdir release +mkdir release\include +mkdir release\lib +mkdir release\lib\w3i3 +mkdir release\lib\w3i3\we +mkdir release\lib\w3i3\ce +mkdir release\lib\w3i3\wi +mkdir release\lib\w3i3\ci +mkdir release\src +copy mps.h release\include +copy mpsavm.h release\include +copy mpsacl.h release\include +copy mpscamc.h release\include +copy mpscams.h release\include +copy mpscawl.h release\include +copy mpsclo.h release\include +copy mpscmv.h release\include +copy mpscmvff.h release\include +copy mpscsnc.h release\include +copy mpsio.h release\include +copy mpslib.h release\include +copy mpstd.h release\include +copy mpsw3.h release\include +copy mpswin.h release\include +copy w3i3mv\we\mps.lib release\lib\w3i3\we +copy w3i3mv\ce\mps.lib release\lib\w3i3\ce +copy w3i3mv\we\mpsplan.lib release\lib\w3i3\we +copy w3i3mv\ce\mpsplan.lib release\lib\w3i3\ce +copy w3i3mv\wi\mps.lib release\lib\w3i3\wi +copy w3i3mv\ci\mps.lib release\lib\w3i3\ci +copy w3i3mv\wi\mpsplan.lib release\lib\w3i3\wi +copy w3i3mv\ci\mpsplan.lib release\lib\w3i3\ci +copy mpsliban.c release\src +copy mpsioan.c release\src -- cgit v1.2.1 From b7e2e7be1a730d9488a37d26d6b4e8412548cb2c Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Mon, 8 Jul 2002 14:37:12 +0100 Subject: Unused parameter declaration. Copied from Perforce Change: 30880 ServerID: perforce.ravenbrook.com --- mps/code/poolams.c | 1 + 1 file changed, 1 insertion(+) (limited to 'mps/code') diff --git a/mps/code/poolams.c b/mps/code/poolams.c index b8650af428e..d649a4794f2 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c @@ -1456,6 +1456,7 @@ static Res AMSFix(Pool pool, ScanState ss, Seg seg, Ref *refIO) static Res amsBlackenObject(Seg seg, Index i, Addr p, Addr next, void *clos) { + UNUSED(p); AVER(clos == NULL); /* Do what amsScanObject does, minus the scanning. */ if (AMS_IS_GREY(seg, i)) { -- cgit v1.2.1 From d45e3cfd75ebde6b9ccc95ba43b262d9e9b07e8e Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Fri, 18 Oct 2002 14:29:20 +0100 Subject: Add a new test, for finalization, demonstrating the value of proxies. Copied from Perforce Change: 34507 ServerID: perforce.ravenbrook.com --- mps/code/comm.gmk | 9 +- mps/code/commpost.nmk | 8 +- mps/code/finaltest.c | 301 ++++++++++++++++++++++++++++++++++++++++++++++++++ mps/code/fmtdytst.c | 65 ++++++++--- mps/code/fmtdytst.h | 18 ++- 5 files changed, 378 insertions(+), 23 deletions(-) create mode 100644 mps/code/finaltest.c (limited to 'mps/code') diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 1714cf46d5a..b7cc3011a55 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -266,7 +266,7 @@ endif all: mpmss sacss amcss amcsshe amsss amssshe segsmss awlut awluthe \ mpsicv lockcov poolncv locv qs apss \ - finalcv arenacv bttest teletest \ + finalcv finaltest arenacv bttest teletest \ abqtest cbstest btcv mv2test messtest steptest \ eventcnv mps.a @@ -277,7 +277,7 @@ swall: mmsw.a replaysw # bttest & teletest cannot be run unattended # mv2test cannot be run because MV2 is broken testrun: mpmss apss sacss amcss amcsshe amsss amssshe segsmss awlut awluthe \ - mpsicv lockcov poolncv locv qs finalcv arenacv \ + mpsicv lockcov poolncv locv qs finalcv finaltest arenacv \ abqtest cbstest btcv messtest steptest $(^:%=date && $(PFM)/$(VARIETY)/% &&) true @@ -288,7 +288,7 @@ testrun: mpmss apss sacss amcss amcsshe amsss amssshe segsmss awlut awluthe \ mpmss sacss amcss amcssth amcsshe amsss amssshe segsmss awlut awlutth \ awluthe mpsicv lockcov poolncv locv qs apss \ - finalcv arenacv bttest teletest \ + finalcv finaltest arenacv bttest teletest \ abqtest cbstest btcv mv2test \ messtest steptest \ eventcnv replay replaysw \ @@ -344,6 +344,9 @@ ifdef VARIETY $(PFM)/$(VARIETY)/finalcv: $(PFM)/$(VARIETY)/finalcv.o \ $(FMTDYTSTOBJ) $(MPMOBJ) $(AMCOBJ) $(TESTLIBOBJ) +$(PFM)/$(VARIETY)/finaltest: $(PFM)/$(VARIETY)/finaltest.o \ + $(FMTDYTSTOBJ) $(MPMOBJ) $(AMCOBJ) $(TESTLIBOBJ) + $(PFM)/$(VARIETY)/locv: $(PFM)/$(VARIETY)/locv.o \ $(MPMOBJ) $(LOOBJ) $(TESTLIBOBJ) diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index 1dd3303817a..a1f1b971de7 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -16,7 +16,7 @@ all: mpmss.exe amcss.exe amsss.exe amssshe.exe segsmss.exe awlut.exe awluthe.exe\ mpsicv.exe lockutw3.exe lockcov.exe poolncv.exe locv.exe qs.exe apss.exe \ - finalcv.exe arenacv.exe bttest.exe teletest.exe protcv.exe \ + finalcv.exe finaltest.exe arenacv.exe bttest.exe teletest.exe protcv.exe \ abqtest.exe cbstest.exe btcv.exe mv2test.exe messtest.exe steptest.exe \ locbwcss.exe locusss.exe \ eventcnv.exe @@ -31,7 +31,7 @@ swall: mmsw.lib replaysw.exe mpmss.exe amcss.exe amcsshe.exe amsss.exe amssshe.exe segsmss.exe awlut.exe awluthe.exe dwstress.exe \ mpsicv.exe lockutw3.exe lockcov.exe poolncv.exe locv.exe qs.exe apss.exe \ - finalcv.exe arenacv.exe bttest.exe teletest.exe protcv.exe \ + finalcv.exe finaltest.exe arenacv.exe bttest.exe teletest.exe protcv.exe \ abqtest.exe cbstest.exe btcv.exe mv2test.exe messtest.exe steptest.exe \ locbwcss.exe locusss.exe \ replay.exe replaysw.exe eventcnv.exe \ @@ -106,6 +106,10 @@ $(PFM)\$(VARIETY)\finalcv.exe: $(PFM)\$(VARIETY)\finalcv.obj \ $(MPMOBJ) $(PLINTHOBJ) $(AMCOBJ) $(DWOBJ) $(DWTESTOBJ) \ $(MRGOBJ) $(TESTLIBOBJ) +$(PFM)\$(VARIETY)\finaltest.exe: $(PFM)\$(VARIETY)\finaltest.obj \ + $(MPMOBJ) $(PLINTHOBJ) $(AMCOBJ) $(DWOBJ) $(DWTESTOBJ) \ + $(MRGOBJ) $(TESTLIBOBJ) + $(PFM)\$(VARIETY)\locv.exe: $(PFM)\$(VARIETY)\locv.obj \ $(MPMOBJ) $(PLINTHOBJ) $(TESTLIBOBJ) $(LOOBJ) diff --git a/mps/code/finaltest.c b/mps/code/finaltest.c new file mode 100644 index 00000000000..bdfdda4be85 --- /dev/null +++ b/mps/code/finaltest.c @@ -0,0 +1,301 @@ +/* finaltest.c: LARGE-SCALE FINALIZATION TEST + * + * $Id$ + * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Portions copyright (C) 2002 Global Graphics Software. + * + * DESIGN + * + * DEPENDENCIES + * + * This test uses the dylan object format, but the reliance on this + * particular format is not great and could be removed. + * + * NOTES + * + * This code was created by first copying + */ + +#include "testlib.h" +#include "mps.h" +#include "mpscamc.h" +#include "mpsavm.h" +#include "fmtdy.h" +#include "fmtdytst.h" +#include "mpstd.h" +#ifdef MPS_OS_W3 +#include "mpsw3.h" +#endif +#include + + +#define testArenaSIZE ((size_t)16<<20) +#define rootCOUNT 20 +#define maxtreeDEPTH 12 +#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 */ + +static mps_word_t object_count = 0; + +static mps_word_t make_numbered_cons(mps_word_t car, mps_word_t cdr, + mps_ap_t ap) +{ + mps_word_t cons; + die(make_dylan_vector(&cons, ap, 3), "make_dylan_vector"); + DYLAN_VECTOR_SLOT(cons, 0) = car; + DYLAN_VECTOR_SLOT(cons, 1) = cdr; + DYLAN_VECTOR_SLOT(cons, 2) = DYLAN_INT(object_count); + ++ object_count; + return cons; +} + +static mps_word_t make_numbered_tree(mps_word_t depth, + mps_ap_t ap) +{ + mps_word_t left, right; + if (depth < 2) { + left = DYLAN_INT(object_count); + right = DYLAN_INT(object_count); + } else { + left = make_numbered_tree(depth-1, ap); + right = make_numbered_tree(depth-1, ap); + } + return make_numbered_cons(left, right, ap); +} + +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); + register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 0), arena); + register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 1), arena); + } +} + +static mps_word_t make_indirect_cons(mps_word_t car, mps_word_t cdr, + mps_ap_t ap) +{ + mps_word_t cons, indirect; + die(make_dylan_vector(&indirect, ap, 1), "make_dylan_vector"); + DYLAN_VECTOR_SLOT(indirect, 0) = DYLAN_INT(object_count); + die(make_dylan_vector(&cons, ap, 3), "make_dylan_vector"); + DYLAN_VECTOR_SLOT(cons, 0) = car; + DYLAN_VECTOR_SLOT(cons, 1) = cdr; + DYLAN_VECTOR_SLOT(cons, 2) = indirect; + ++ object_count; + return cons; +} + +static mps_word_t make_indirect_tree(mps_word_t depth, + mps_ap_t ap) +{ + mps_word_t left, right; + if (depth < 2) { + left = DYLAN_INT(object_count); + right = DYLAN_INT(object_count); + } else { + left = make_indirect_tree(depth-1, ap); + right = make_indirect_tree(depth-1, ap); + } + return make_indirect_cons(left, right, ap); +} + +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); + register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 0), arena); + register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 1), arena); + } +} + + +static void *root[rootCOUNT]; + +static void *test(void *arg, size_t s) +{ + mps_ap_t ap; + mps_fmt_t fmt; + mps_chain_t chain; + mps_word_t finals; + mps_pool_t amc; + 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"); + 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"); + + 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_word_t obj; + mps_addr_t objaddr; + cdie(mps_message_get(&message, arena, + mps_message_type_finalization()), + "get"); + mps_message_finalization_ref(&objaddr, arena, message); + obj = (mps_word_t)objaddr; + 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_word_t obj; + mps_addr_t objaddr; + cdie(mps_message_get(&message, arena, + mps_message_type_finalization()), + "get"); + mps_message_finalization_ref(&objaddr, arena, message); + obj = (mps_word_t)objaddr; + 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); + } + + mps_ap_destroy(ap); + mps_root_destroy(mps_root); + mps_pool_destroy(amc); + mps_chain_destroy(chain); + mps_fmt_destroy(fmt); + + return NULL; +} + + +int main(int argc, char **argv) +{ + mps_arena_t arena; + mps_thr_t thread; + void *r; + + 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); + mps_thread_dereg(thread); + mps_arena_destroy(arena); + + fflush(stdout); /* synchronize */ + return 0; +} + + +/* C. COPYRIGHT AND LICENSE + * + * Copyright (C) 2001-2002 Ravenbrook Limited . + * All rights reserved. This is an open source license. Contact + * Ravenbrook for commercial licensing options. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Redistributions in any form must be accompanied by information on how + * to obtain complete source code for this software and any accompanying + * software that uses this software. The source code must either be + * included in the distribution or be available for no more than the cost + * of distribution plus a nominal fee, and must be freely redistributable + * under reasonable conditions. For an executable file, complete source + * code means the source code for all modules it contains. It does not + * include source code for modules or files that typically accompany the + * major components of the operating system on which the executable file + * runs. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ diff --git a/mps/code/fmtdytst.c b/mps/code/fmtdytst.c index ce9c607cac0..9fa6eb2ec32 100644 --- a/mps/code/fmtdytst.c +++ b/mps/code/fmtdytst.c @@ -50,14 +50,8 @@ static mps_word_t dylan_make_WV(mps_word_t version, mps_word_t vb, vf); } - -mps_res_t dylan_init(mps_addr_t addr, size_t size, - mps_addr_t *refs, size_t nr_refs) +static mps_res_t dylan_make_wrapper_wrapper(void) { - - /* Make sure the size is aligned. */ - assert((size & (ALIGN-1)) == 0); - if(ww == NULL) { ww = malloc(sizeof(mps_word_t) * (BASIC_WRAPPER_SIZE + 1)); if(ww == NULL) return MPS_RES_MEMORY; @@ -84,10 +78,23 @@ mps_res_t dylan_init(mps_addr_t addr, size_t size, tvw[WV] = dylan_make_WV(2, 0, 0, 2); /* traceable variable part */ tvw[WS] = 1; /* no patterns */ } + return MPS_RES_OK; +} + + +mps_res_t dylan_init(mps_addr_t addr, size_t size, + mps_addr_t *refs, size_t nr_refs) +{ + mps_res_t res; + /* Make sure the size is aligned. */ + assert((size & (ALIGN-1)) == 0); + + res = dylan_make_wrapper_wrapper(); + if (res != MPS_RES_OK) + return res; /* If there is enough room, make a vector, otherwise just */ /* make a padding object. */ - if(size >= sizeof(mps_word_t) * 2) { mps_word_t *p = (mps_word_t *)addr; mps_word_t i, t = (size / sizeof(mps_word_t)) - 2; @@ -108,6 +115,38 @@ mps_res_t dylan_init(mps_addr_t addr, size_t size, return MPS_RES_OK; } +mps_res_t make_dylan_vector(mps_word_t *v, mps_ap_t ap, size_t slots) +{ + mps_res_t res; + mps_addr_t addr; + mps_word_t *p; + size_t size; + size_t i; + + res = dylan_make_wrapper_wrapper(); + if (res != MPS_RES_OK) + return res; + + size = (slots + 2) * sizeof(mps_word_t); + + do { + MPS_RESERVE_BLOCK(res, addr, ap, size); + if (res != MPS_RES_OK) + return res; + + p = (mps_word_t *)addr; + p[0] = (mps_word_t)tvw; /* install vector wrapper */ + p[1] = (slots << 2) | 1; /* tag the vector length */ + /* fill all slots with zero ints. */ + for (i=0; i. * 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 @@ -180,7 +219,7 @@ mps_bool_t dylan_check(mps_addr_t addr) * 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 diff --git a/mps/code/fmtdytst.h b/mps/code/fmtdytst.h index d8d1d2fa0b2..0e284a42ab8 100644 --- a/mps/code/fmtdytst.h +++ b/mps/code/fmtdytst.h @@ -18,6 +18,14 @@ extern mps_bool_t dylan_check(mps_addr_t addr); extern void dylan_pad(mps_addr_t addr, size_t size); extern int dylan_wrapper_check(mps_word_t *w); +extern mps_res_t make_dylan_vector(mps_word_t *v, mps_ap_t ap, size_t slots); + +#define DYLAN_VECTOR_SLOT(o,n) (((mps_word_t *) (o))[(n)+2]) + +#define DYLAN_INT(n) (((n) << 2) | 1) + +#define DYLAN_INT_INT(d) ((d) >> 2) + #endif /* fmtdy_h */ @@ -26,18 +34,18 @@ extern int dylan_wrapper_check(mps_word_t *w); * Copyright (C) 2001-2002 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. Redistributions in any form must be accompanied by information on how * to obtain complete source code for this software and any accompanying * software that uses this software. The source code must either be @@ -48,7 +56,7 @@ extern int dylan_wrapper_check(mps_word_t *w); * 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 -- cgit v1.2.1 From c0f415ad6f50117f046b3be58e7c16e7c6dd1120 Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Fri, 18 Oct 2002 16:28:37 +0100 Subject: Worked around precompiler and gdb debug info bugs in mac os x 10.2 build. Copied from Perforce Change: 34514 ServerID: perforce.ravenbrook.com --- mps/code/xcppgc.gmk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mps/code') diff --git a/mps/code/xcppgc.gmk b/mps/code/xcppgc.gmk index 476dcf60f30..a160a700224 100644 --- a/mps/code/xcppgc.gmk +++ b/mps/code/xcppgc.gmk @@ -24,7 +24,9 @@ CC = cc # inline function. # .types: sys/types.h uses 'long long' even under -ansi. CFLAGSCOMPILER := $(subst -Wstrict-prototypes,,$(CFLAGSCOMPILER)) \ - -Wno-unused -Wno-long-long + -Wno-unused -Wno-long-long -no-cpp-precomp +CFLAGSDEBUG := $(subst -g -ggdb3,-g3,$(CFLAGSDEBUG)) +CFLAGSOPT := $(subst -g -ggdb3,-g3,$(CFLAGSOPT)) include comm.gmk -- cgit v1.2.1 From a3e55f6c01edaf570b0a0c916418ae7cd7b6add9 Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Mon, 28 Oct 2002 12:48:29 +0000 Subject: Split long strings to comply with c standard. also make sure %p arguments are pointers. Copied from Perforce Change: 34863 ServerID: perforce.ravenbrook.com --- mps/code/bttest.c | 12 ++++++------ mps/code/cbstest.c | 2 +- mps/code/teletest.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'mps/code') diff --git a/mps/code/bttest.c b/mps/code/bttest.c index 736a0f23c3e..3c5e44833c6 100644 --- a/mps/code/bttest.c +++ b/mps/code/bttest.c @@ -223,17 +223,17 @@ static void help(void) "d destroy the current BT\n" "s set the bit index 'i'\n" "r reset the bit index 'i'\n" - "g get the bit index 'i'\n" - "sr [ ] set the specified range\n" + "g get the bit index 'i'\n"); + printf("sr [ ] set the specified range\n" "rr [ ] reset the specified range\n" "is [ ] is the specified range set?\n" - "ir [ ] is the specified range reset?\n" - "f [ ] find a reset range of length 'l'.\n" + "ir [ ] is the specified range reset?\n"); + printf("f [ ] find a reset range of length 'l'.\n" "fh [ ] find a reset range length 'l', working downwards\n" "fl [ ] find a reset range of length at least 'l'\n" "q quit\n" - "? print this message\n" - "\n" + "? print this message\n"); + printf("\n" "No way of testing BTSize, BTRangesSame, or BTCopyInvertRange.\n"); } diff --git a/mps/code/cbstest.c b/mps/code/cbstest.c index 0e2f4a42fa6..393a17c162d 100644 --- a/mps/code/cbstest.c +++ b/mps/code/cbstest.c @@ -607,7 +607,7 @@ extern int main(int argc, char *argv[]) "failed to allocate block"); dummyBlock = (Addr)p; /* avoid pun */ - printf("Allocated block [%p, %p)\n", dummyBlock, + printf("Allocated block [%p, %p)\n", (void*)dummyBlock, (char *)dummyBlock + ArraySize); checkCBS(cbs, allocTable, dummyBlock); diff --git a/mps/code/teletest.c b/mps/code/teletest.c index 571e4e83fc3..ab2a742a891 100644 --- a/mps/code/teletest.c +++ b/mps/code/teletest.c @@ -110,8 +110,8 @@ static void doHelp(void) "read -> Read filter\n" "set -> Set filter\n" "reset -> Reset filter\n" - "flip -> Toggle filter\n" - "intern -> Intern string\n" + "flip -> Toggle filter\n"); + (void)printf("intern -> Intern string\n" "label
Label address\n" "flush Flush buffer\n" "help Print this message\n" -- cgit v1.2.1 From e0b805400340b4edc4ea2b6421bcf2cf80aa11c4 Mon Sep 17 00:00:00 2001 From: Nick Barnes Date: Mon, 30 Dec 2002 13:54:24 +0000 Subject: Turn off pedantic ansi compilation on freebsd, because of broken system header files (from freebsd 4.3 to at least 4.7). Copied from Perforce Change: 37425 ServerID: perforce.ravenbrook.com --- mps/code/fri4gc.gmk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mps/code') diff --git a/mps/code/fri4gc.gmk b/mps/code/fri4gc.gmk index b66a381c286..103b2f61a45 100644 --- a/mps/code/fri4gc.gmk +++ b/mps/code/fri4gc.gmk @@ -15,8 +15,9 @@ LIBS = -lm -pthread include gc.gmk -CFLAGSDEBUG = -g -CFLAGSOPT = -O -g +CFLAGSCOMPILER := $(subst -pedantic,,$(CFLAGSCOMPILER)) +CFLAGSDEBUG = -g3 +CFLAGSOPT = -O -g3 CC = cc -- cgit v1.2.1