diff -c /home/omega/attardi/posso/cmm/ChangeLog /project/posso/cmm/curr/cmm/ChangeLog *** /home/omega/attardi/posso/cmm/ChangeLog Mon Sep 22 10:20:26 1997 --- /project/posso/cmm/curr/cmm/ChangeLog Wed Aug 6 17:35:44 1997 *************** *** 1,22 **** - Mon Sep 22 10:19:21 1997 Giuseppe Attardi - - * Makefile (test): renamed test5 to test1 - - * test5.cpp: added new test for reference types - - Wed Sep 17 18:25:01 1997 Giuseppe Attardi - - * cmm.h: added macros CmmRefLoc and CmmRefLocRel to handle - reference types within traverse - - * cmm.h (class CmmObject): ID field with unique ID for objects. - Useful for experimentation, is available by defining flag CMM_ID - - Mon Aug 18 11:41:34 1997 Giuseppe Attardi - - * cmm.h: moved typedef bool to machine.h - * cmm.h (CmmHeap::scanRoots): arg type is Page (for Watcom) - Wed Aug 6 11:38:21 1997 Giuseppe Attardi * Released version 1.9 --- 1,3 ---- *************** *** 27,34 **** SunOS 5.3 sparc SunOS 4.1.3_U1 sparc Win32 VC++ 4.0 (except testmsw3 with debug) - - * tempheap.cpp (scavenge): (int) -> (Word) * cmm.cpp (Cmm): ensure max n. of pages will fit in a Page --- 8,13 ---- diff -c /home/omega/attardi/posso/cmm/Copyright /project/posso/cmm/curr/cmm/Copyright *** /home/omega/attardi/posso/cmm/Copyright Mon Sep 8 12:17:20 1997 --- /project/posso/cmm/curr/cmm/Copyright Mon Nov 25 12:32:53 1996 *************** *** 54,57 **** Uttam M. Narsu Pietro Iglio Hans J. Boehm - Christian Heckler \ No newline at end of file --- 54,56 ---- diff -c /home/omega/attardi/posso/cmm/Makefile /project/posso/cmm/curr/cmm/Makefile *** /home/omega/attardi/posso/cmm/Makefile Mon Sep 22 10:15:51 1997 --- /project/posso/cmm/curr/cmm/Makefile Fri Aug 1 19:09:44 1997 *************** *** 32,46 **** # ones succeeded and which failed. # "clean" removes all object code from this directory. ! CFLAGS = -O CC = g++ HFILES = machine.h cmm.h OBJS = cmm.o tempheap.o msw.o memory.o ! TESTS = test1 test2 test3 test4 test5 test6 test7 test8 test9 \ ! testmsw1 testmsw2 testmsw3 all: libCmm.a --- 32,45 ---- # ones succeeded and which failed. # "clean" removes all object code from this directory. ! CFLAGS = -O2 CC = g++ HFILES = machine.h cmm.h OBJS = cmm.o tempheap.o msw.o memory.o ! TESTS = test2 test3 test4 test5 test6 test7 test8 testmsw1 testmsw2 testmsw3 all: libCmm.a *************** *** 71,78 **** msw.o: msw.cpp msw.h $(HFILES) $(CC) $(CFLAGS) -c msw.cpp - test1: test1.cpp libCmm.a - $(CC) $(CFLAGS) -o test1 test1.cpp libCmm.a test2: test2.cpp libCmm.a $(CC) $(CFLAGS) -o test2 test2.cpp libCmm.a test3: test3.cpp libCmm.a --- 70,75 ---- *************** *** 87,94 **** $(CC) $(CFLAGS) -o test7 test7.cpp libCmm.a test8: test8.cpp libCmm.a $(CC) $(CFLAGS) -o test8 test8.cpp libCmm.a - test9: test9.cpp libCmm.a - $(CC) $(CFLAGS) -o test9 test9.cpp libCmm.a testmsw1: testmsw1.c libCmm.a $(CC) $(CFLAGS) -g -o testmsw1 testmsw1.c libCmm.a testmsw2: testmsw2.c libCmm.a --- 84,89 ---- *************** *** 96,99 **** testmsw3: testmsw3.cpp libCmm.a $(CC) $(CFLAGS) -o testmsw3 testmsw3.cpp libCmm.a clean: ! /bin/rm -rf *.o libCmm.a $(TESTS) tests.out --- 91,94 ---- testmsw3: testmsw3.cpp libCmm.a $(CC) $(CFLAGS) -o testmsw3 testmsw3.cpp libCmm.a clean: ! /bin/rm -rf *.o $(TESTS) libCmm.a diff -c /home/omega/attardi/posso/cmm/Makefile.schema /project/posso/cmm/curr/cmm/Makefile.schema *** /home/omega/attardi/posso/cmm/Makefile.schema Mon Sep 22 10:14:53 1997 --- /project/posso/cmm/curr/cmm/Makefile.schema Tue Feb 25 18:30:50 1997 *************** *** 14,21 **** OBJS = cmm.o tempheap.o msw.o memory.o ! TESTS = test1 test2 test3 test4 test5 test6 test7 test8 test9 \ ! testmsw1 testmsw2 testmsw3 all: libCmm.a --- 14,20 ---- OBJS = cmm.o tempheap.o msw.o memory.o ! TESTS = test2 test3 test4 test5 test6 test7 test8 testmsw1 testmsw2 testmsw3 all: libCmm.a *************** *** 46,74 **** sed -e s:'"CMM .*"':\\\"CMM `date +%D`\\\": cmm.cpp > tmp.cpp mv tmp.cpp cmm.cpp - - test1: test1.cpp libCmm.a - ${CPP} -o test1 ${CFLAGS} test1.cpp libCmm.a test2: test2.cpp libCmm.a ${CPP} -o test2 ${CFLAGS} test2.cpp libCmm.a test3: test3.cpp libCmm.a ${CPP} -o test3 ${CFLAGS} test3.cpp libCmm.a test4: test4.cpp libCmm.a ${CPP} -o test4 ${CFLAGS} test4.cpp libCmm.a test5: test5.cpp libCmm.a ${CPP} -o test5 ${CFLAGS} test5.cpp libCmm.a test6: test6.cpp libCmm.a ${CPP} -o test6 ${CFLAGS} test6.cpp libCmm.a test7: test7.cpp libCmm.a ${CPP} -o test7 ${CFLAGS} test7.cpp libCmm.a test8: test8.cpp libCmm.a ${CPP} -o test8 ${CFLAGS} test8.cpp libCmm.a ! test9: test9.cpp libCmm.a ! ${CPP} -o test9 ${CFLAGS} test9.cpp libCmm.a testmsw1: testmsw1.c libCmm.a ${CPP} -g -o testmsw1 ${CFLAGS} testmsw1.c libCmm.a testmsw2: testmsw2.c libCmm.a ${CPP} -g -o testmsw2 ${CFLAGS} testmsw2.c libCmm.a testmsw3: testmsw3.cpp libCmm.a ${CPP} ${OPTS} -o testmsw3 ${CFLAGS} testmsw3.cpp libCmm.a --- 45,77 ---- sed -e s:'"CMM .*"':\\\"CMM `date +%D`\\\": cmm.cpp > tmp.cpp mv tmp.cpp cmm.cpp test2: test2.cpp libCmm.a ${CPP} -o test2 ${CFLAGS} test2.cpp libCmm.a + test3: test3.cpp libCmm.a ${CPP} -o test3 ${CFLAGS} test3.cpp libCmm.a + test4: test4.cpp libCmm.a ${CPP} -o test4 ${CFLAGS} test4.cpp libCmm.a + test5: test5.cpp libCmm.a ${CPP} -o test5 ${CFLAGS} test5.cpp libCmm.a + test6: test6.cpp libCmm.a ${CPP} -o test6 ${CFLAGS} test6.cpp libCmm.a + test7: test7.cpp libCmm.a ${CPP} -o test7 ${CFLAGS} test7.cpp libCmm.a + test8: test8.cpp libCmm.a ${CPP} -o test8 ${CFLAGS} test8.cpp libCmm.a ! testmsw1: testmsw1.c libCmm.a ${CPP} -g -o testmsw1 ${CFLAGS} testmsw1.c libCmm.a + testmsw2: testmsw2.c libCmm.a ${CPP} -g -o testmsw2 ${CFLAGS} testmsw2.c libCmm.a + testmsw3: testmsw3.cpp libCmm.a ${CPP} ${OPTS} -o testmsw3 ${CFLAGS} testmsw3.cpp libCmm.a Only in /home/omega/attardi/posso/cmm: Parallel diff -c /home/omega/attardi/posso/cmm/cmm.cpp /project/posso/cmm/curr/cmm/cmm.cpp *** /home/omega/attardi/posso/cmm/cmm.cpp Wed Sep 24 11:24:44 1997 --- /project/posso/cmm/curr/cmm/cmm.cpp Wed Aug 6 17:33:40 1997 *************** *** 54,60 **** /* Version tag */ ! char* Cmm::version = "CMM 1.9a"; /*---------------------------------------------------------------------------* * --- 54,60 ---- /* Version tag */ ! char* Cmm::version = "CMM 1.9"; /*---------------------------------------------------------------------------* * *************** *** 232,252 **** verbose |= newVerbose; } ! /*---------------------------------------------------------------------------*/ ! ! int const CmmLocOffsets[] = ! {0,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21, ! 22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45, ! 46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69, ! 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93, ! 94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112}; ! ! /*---------------------------------------------------------------------------* * Freespace objects have a tag of 0. * Pad objects for double alignment have a tag of 1. * CmmObjects have a tag of 2. * The header for a one-word double alignment pad is kept in doublepad. ! *---------------------------------------------------------------------------*/ #define OBJECT_TAG 2 #if HEADER_SIZE --- 232,243 ---- verbose |= newVerbose; } ! /* * Freespace objects have a tag of 0. * Pad objects for double alignment have a tag of 1. * CmmObjects have a tag of 2. * The header for a one-word double alignment pad is kept in doublepad. ! */ #define OBJECT_TAG 2 #if HEADER_SIZE *************** *** 560,586 **** } /*---------------------------------------------------------------------------* - * Object ID - * - * IDs are used to keep track of objects even after they are moved by - * the collector. - *---------------------------------------------------------------------------*/ - - #ifdef CMM_ID - /* with ID_INC=20000000, stats gets corrupted after 158 collection - (in bjork70 on Solaris). - Apparently the 40MB block is allocated at 0x2447b20-0x4a6d520, and heap - expansion reaches 0x4b6d400 and incorporates it. Pages from here are - used by the default heap. - */ - #define ID_INC 60000000 - Byte *stats = NULL; - int objectIDs = 0; - int objectIDmax = 0; - int ncollect = 0; - #endif - - /*---------------------------------------------------------------------------* * -- CmmInit * * The heap is allocated and the appropriate data structures are initialized --- 551,556 ---- *************** *** 608,623 **** char *heap; Page i; - #ifdef CMM_ID - /* - * create stats here so as not to interfere with heap. - * Allocate dynamically to avoid extra work for CmmExamineStaticArea. - */ - objectIDmax = ID_INC; - stats = ::new char[objectIDmax]; - bzero(stats, objectIDmax); - #endif CMM_ID - /* Log actual heap parameters if from environment or logging */ if ((environmentValue("CMM_MINHEAP", Cmm::minHeap) | environmentValue("CMM_MAXHEAP", Cmm::maxHeap) --- 578,583 ---- *************** *** 1056,1061 **** --- 1016,1022 ---- static void newlineIfLogging(); static void logRoot(GCP); + /*---------------------------------------------------------------------------* * -- DefaultHeap::move * *************** *** 1073,1081 **** GCP DefaultHeap::move(GCP cp) { - #ifdef CMM_ID - int ID; - #endif int page = GCPtoPage(cp); /* Page number */ GCP np; /* Pointer to the new object */ # if HEADER_SIZE --- 1034,1039 ---- *************** *** 1152,1177 **** # ifdef MARKING MARK(np); # endif - #ifdef CMM_ID - { - ID = ((CmmObject*)np)->ID; - if (ID >= objectIDmax) - { - int newMax = objectIDmax + ID_INC; - newMax = MAX(newMax, ID+1); - Byte *newStats = ::new char[newMax]; - bzero(newStats, newMax); - if (stats) - { - bcopy(stats, newStats, objectIDmax); - ::delete stats; - } - stats = newStats; - objectIDmax = newMax; - } - stats[ID]++; - } - #endif return(np); } --- 1110,1115 ---- *************** *** 1287,1296 **** nextSpace = STABLESPACE; usedPages = stablePages; // start counting in StableSpace - #ifdef CMM_ID - ncollect++; - #endif - # if !HEADER_SIZE || defined(MARKING) /* Clear the liveMap bitmap */ bzero((char*)&liveMap[WORD_INDEX(firstHeapPage * bytesPerPage)], --- 1225,1230 ---- *************** *** 1351,1373 **** collected heap for possible pointers */ WHEN_VERBOSE (CMM_ROOTLOG, fprintf(stderr, "stack roots:\n")); void CmmExamineStaticArea(GCP, GCP); /* ensure flushing of register caches */ ! { ! jmp_buf regs; ! if (_setjmp(regs) == 0) _longjmp(regs, 1); ! } /* Examine the stack: */ - GCP fp; /* Pointer for checking the stack. - * Don't move this earlier or on Solaris it - * will crash when using -g. - */ # ifdef STACK_GROWS_DOWNWARD ! for (fp = (GCP)(&fp+1); fp < (GCP)stackBottom; fp++) # else ! for (fp = (GCP)(&fp-1); fp > (GCP)stackBottom; fp--) # endif { WHEN_VERBOSE (CMM_ROOTLOG, logRoot(fp)); --- 1285,1302 ---- collected heap for possible pointers */ WHEN_VERBOSE (CMM_ROOTLOG, fprintf(stderr, "stack roots:\n")); + GCP fp; /* Pointer for checking the stack */ void CmmExamineStaticArea(GCP, GCP); /* ensure flushing of register caches */ ! jmp_buf regs; ! if (_setjmp(regs) == 0) _longjmp(regs, 1); /* Examine the stack: */ # ifdef STACK_GROWS_DOWNWARD ! for (fp = (GCP)regs; fp < (GCP)stackBottom; fp++) # else ! for (fp = (GCP)regs + sizeof(regs); fp > (GCP)stackBottom; fp--) # endif { WHEN_VERBOSE (CMM_ROOTLOG, logRoot(fp)); *************** *** 1793,1801 **** firstFreeWord = NULL; } ALLOC_SETUP(object, size); - #ifdef CMM_ID - ((CmmObject *)object)->ID = objectIDs++; - #endif return(object); } --- 1722,1727 ---- *************** *** 1845,1855 **** GCP object = heap->alloc(size); // To avoid problems in GC after new but during constructor ! #ifdef CMM_ID ! *(object+1) = *((GCP)aCmmObject+1); ! #else ! *object = *(GCP)aCmmObject; ! #endif return (void *)object; } --- 1771,1778 ---- GCP object = heap->alloc(size); // To avoid problems in GC after new but during constructor ! *object = *((GCP)aCmmObject); ! return (void *)object; } *************** *** 1876,1886 **** GCP object = heap->alloc(size + extraSize); // To avoid problems in GC after new() but during constructor ! #ifdef CMM_ID ! *(object+1) = *((GCP)aCmmVarObject+1); ! #else ! *object = *(GCP)aCmmVarObject; ! #endif return (void *)object; } --- 1799,1805 ---- GCP object = heap->alloc(size + extraSize); // To avoid problems in GC after new() but during constructor ! *object = *((GCP)aCmmVarObject); return (void *)object; } diff -c /home/omega/attardi/posso/cmm/cmm.h /project/posso/cmm/curr/cmm/cmm.h *** /home/omega/attardi/posso/cmm/cmm.h Wed Sep 17 15:15:05 1997 --- /project/posso/cmm/curr/cmm/cmm.h Sat Aug 2 13:30:58 1997 *************** *** 53,71 **** the method C::traverse must contain scavenge(&x); (b) for a class containing an instance of a collected object, say ! class C { CmmClass x; }, the method C::traverse must contain x.traverse(); (c) for a class derived from another collected class, say ! class C: CmmClass {...}, the method C::traverse must contain ! CmmClass::traverse(); ! (d) for a class containing a reference, say class C { type &x; }, ! the method C::traverse must contain scavenge(CmmRefLoc(C, x)); ! ! (e) for a class deriving from a virtual base class, say class ! C: virtual CmmClass {...}, the method C::traverse must contain ! scavenge(VirtualBase(CmmClass)); For example, --- 53,68 ---- the method C::traverse must contain scavenge(&x); (b) for a class containing an instance of a collected object, say ! class C { GcClass x; }, the method C::traverse must contain x.traverse(); (c) for a class derived from another collected class, say ! class C: GcClass {...}, the method C::traverse must contain ! GcClass::traverse(); ! (d) for a class deriving from a virtual base class, say class ! C: virtual GcClass {...}, the method C::traverse must contain ! scavenge(VirtualBase(GcClass)); For example, *************** *** 304,309 **** --- 301,312 ---- #include "machine.h" #include "msw.h" + #ifdef _WIN32 + typedef int bool; + #define false 0 + #define true 1 + #endif + /*---------------------------------------------------------------------------* * * -- Enable CMM features or verbosity *************** *** 348,369 **** /*---------------------------------------------------------------------------* * ! * Support for rule (d) above. ! * ! *---------------------------------------------------------------------------*/ ! ! /* this involves runtime calculation */ ! extern int const CmmLocOffsets[]; ! ! #define CmmRefLoc(T, ref) \ ! ((GcObject **)((Word)this + sizeof(GCP) * (int)(&((T*)CmmLocOffsets)->ref))) ! ! /* this is resolved at compile time */ ! #define CmmRefLocRel(field, offset) ((GcObject **)(&field + offset)) ! ! /*---------------------------------------------------------------------------* ! * ! * Support for rule (e) above. Compiler dependent. * *---------------------------------------------------------------------------*/ --- 351,357 ---- /*---------------------------------------------------------------------------* * ! * Support for rule (d) above. Compiler dependent. * *---------------------------------------------------------------------------*/ *************** *** 598,604 **** virtual GCP alloc(Word) = 0; virtual void reclaim(GCP) {}; ! virtual void scanRoots(Page) {}; virtual void collect() { --- 586,592 ---- virtual GCP alloc(Word) = 0; virtual void reclaim(GCP) {}; ! virtual void scanRoots(int) {}; virtual void collect() { *************** *** 663,669 **** GCP alloc(Word); void reclaim(GCP) {} // Bartlett's delete does nothing. void collect(); // the default garbarge collector ! void scavenge(CmmObject **); GCP getPages(int); int usedPages; // pages in actual use --- 651,657 ---- GCP alloc(Word); void reclaim(GCP) {} // Bartlett's delete does nothing. void collect(); // the default garbarge collector ! void scavenge(CmmObject **ptr); GCP getPages(int); int usedPages; // pages in actual use *************** *** 691,713 **** class MarkAndSweep : public CmmHeap { public: MarkAndSweep(); ! inline GCP alloc(Word size){ return (GCP) mswAlloc(size); } ! inline void reclaim(GCP p) { mswFree(p); } ! inline void collect() { mswCollect(); } ! inline void* realloc(void * p, Word size) { return mswRealloc(p, size); } ! inline void* calloc(Word n, Word size) { return mswCalloc(n, size); } ! ! inline void checkHeap() { mswCheckHeap(1); } ! inline void showInfo() { mswShowInfo(); } ! ! void tempHeapStart() { mswTempHeapStart(); } ! void tempHeapEnd() { mswTempHeapEnd(); } ! void tempHeapFree() { mswTempHeapFree(); } - void scanRoots(Page page); }; /*---------------------------------------------------------------------------* --- 679,706 ---- class MarkAndSweep : public CmmHeap { + public: MarkAndSweep(); ! inline GCP alloc (Word size) ! { return (GCP) mswAlloc(size); } ! inline void reclaim (GCP p) { mswFree(p); } ! inline void collect () { mswCollect(); } ! inline void* realloc (void * p, Word size) ! { return mswRealloc(p, size); } ! inline void* calloc (Word n, Word size) ! { return mswCalloc(n, size); } ! ! inline void checkHeap() { mswCheckHeap(1); } ! inline void showInfo() { mswShowInfo(); } ! ! void tempHeapStart () { mswTempHeapStart(); } ! void tempHeapEnd () { mswTempHeapEnd(); } ! void tempHeapFree () { mswTempHeapFree(); } ! ! void scanRoots(Page page); }; /*---------------------------------------------------------------------------* *************** *** 716,722 **** * *---------------------------------------------------------------------------*/ - #define CMM_ID class CmmObject { public: --- 709,714 ---- *************** *** 737,742 **** --- 729,735 ---- #ifdef MARKING inline void mark() { MARK(this); } + inline bool marked() { return (MARKED(this)); } #endif *************** *** 769,778 **** void* operator new[](size_t size, CmmHeap* = Cmm::heap); void operator delete[](void*); #endif - - #ifdef CMM_ID - int ID; - #endif }; /*---------------------------------------------------------------------------* --- 762,767 ---- *************** *** 829,836 **** }; /*---------------------------------------------------------------------------*/ ! inline void ! CmmHeap::visit(CmmObject* ptr) { #ifdef MARKING if (!ptr->marked()) --- 818,826 ---- }; /*---------------------------------------------------------------------------*/ ! ! inline void CmmHeap:: ! visit(CmmObject* ptr) { #ifdef MARKING if (!ptr->marked()) Common subdirectories: /home/omega/attardi/posso/cmm/doc and /project/posso/cmm/curr/cmm/doc diff -c /home/omega/attardi/posso/cmm/machine.h /project/posso/cmm/curr/cmm/machine.h *** /home/omega/attardi/posso/cmm/machine.h Mon Sep 8 12:13:27 1997 --- /project/posso/cmm/curr/cmm/machine.h Mon Jul 28 19:56:20 1997 *************** *** 49,60 **** typedef Ptr * GCP; /* Pointer to a garbage collected object */ typedef unsigned Page; /* Page number */ - #ifdef _WIN32 - typedef int bool; /* Watcom C++ 11.0 complains */ - #define false 0 - #define true 1 - #endif - /*---------------------------------------------------------------------------* * -- Compatibility *---------------------------------------------------------------------------*/ --- 49,54 ---- diff -c /home/omega/attardi/posso/cmm/msw.cpp /project/posso/cmm/curr/cmm/msw.cpp *** /home/omega/attardi/posso/cmm/msw.cpp Wed Sep 24 11:22:31 1997 --- /project/posso/cmm/curr/cmm/msw.cpp Sun Aug 3 21:29:12 1997 *************** *** 921,927 **** if (pageInfo == PAGE_Fixed) return page->objSize; else ! return (page->nPages * bytesPerPage) - FirstObjOffset +1; } /*---------------------------------------------------------------------------* --- 921,927 ---- if (pageInfo == PAGE_Fixed) return page->objSize; else ! return (page->nPages * bytesPerPage) - FirstObjOffset -1; } /*---------------------------------------------------------------------------* *************** *** 951,978 **** else { newPtr = (Ptr)mswAlloc(size); /* If obj is opaque, then keep it opaque */ ! ! Byte isOpaque; ! PageHeader oldHead; ! ! if (realSize < MaxFixedSize) ! isOpaque = (*((Ptr)p-2) == OpaqueMask); ! else { ! PageHeader oldHead = (PageHeader) ROUND_DOWN(p, ! bytesPerPage); ! isOpaque = (Byte) oldHead->isOpaque; ! } ! ! if (size < MaxFixedSize) { ! if (isOpaque) ! *(newPtr-2) = OpaqueMask; ! } else { PageHeader newHead = (PageHeader) ROUND_DOWN(newPtr, bytesPerPage); ! newHead->isOpaque = isOpaque; } - memcpy(newPtr, p, realSize); mswFree(p); return newPtr; --- 951,965 ---- else { newPtr = (Ptr)mswAlloc(size); /* If obj is opaque, then keep it opaque */ ! if (size < MaxFixedSize) ! *(newPtr-2) = *((Ptr)p-2); else { PageHeader newHead = (PageHeader) ROUND_DOWN(newPtr, bytesPerPage); ! PageHeader oldHead = (PageHeader) ROUND_DOWN(p, ! bytesPerPage); ! newHead->isOpaque = oldHead->isOpaque; } memcpy(newPtr, p, realSize); mswFree(p); return newPtr; *************** *** 2102,2108 **** /*---------------------------------------------------------------------------* * ! * -- MarkAndSweep::scanRoots(Page page) * * Promotes pages referred by any allocated object inside "page". * (Should be) Used by DefaultHeap to identify pointers from MarkAndSweep --- 2089,2095 ---- /*---------------------------------------------------------------------------* * ! * -- MarkAndSweep::scanRoots(int page) * * Promotes pages referred by any allocated object inside "page". * (Should be) Used by DefaultHeap to identify pointers from MarkAndSweep diff -c /home/omega/attardi/posso/cmm/tempheap.cpp /project/posso/cmm/curr/cmm/tempheap.cpp *** /home/omega/attardi/posso/cmm/tempheap.cpp Mon Sep 8 12:10:01 1997 --- /project/posso/cmm/curr/cmm/tempheap.cpp Wed Aug 6 19:45:46 1997 *************** *** 208,218 **** void TempHeap::scavenge(CmmObject **ptr) { ! GCP pp = (GCP)*ptr; if (OUTSIDE_HEAPS(GCPtoPage(pp))) return; ! CmmObject *oldPtr = (CmmObject *)basePointer(pp); int offset = (Word)pp - (Word)oldPtr; if (!inside(oldPtr)) --- 208,218 ---- void TempHeap::scavenge(CmmObject **ptr) { ! Word pp = (GCP)*ptr; if (OUTSIDE_HEAPS(GCPtoPage(pp))) return; ! CmmObject *oldPtr = basePointer(pp); int offset = (Word)pp - (Word)oldPtr; if (!inside(oldPtr)) Only in /home/omega/attardi/posso/cmm: test1.cpp diff -c /home/omega/attardi/posso/cmm/test5.cpp /project/posso/cmm/curr/cmm/test5.cpp *** /home/omega/attardi/posso/cmm/test5.cpp Wed Sep 17 18:14:44 1997 --- /project/posso/cmm/curr/cmm/test5.cpp Mon Jul 28 21:22:06 1997 *************** *** 1,64 **** ! #include "cmm.h" ! #include ! /* ! * Tests use of reference types in objects. ! * ! */ ! #define SIZE 1000 ! class cell : public CmmObject { ! public: ! char c; // just to check alignment problems ! cell &car; ! cell &cdr; int value; - cell(); cell(cell *initcar, cell *initcdr, int initvalue); void traverse(); }; void cell::traverse() { CmmHeap *heap = Cmm::heap; ! heap->scavenge(CmmRefLoc(cell, car)); ! heap->scavenge(CmmRefLoc(cell, cdr)); } cell::cell(cell *initcar, cell *initcdr, int initvalue) - : car(*initcar), cdr(*initcdr), value(initvalue) { } void ! visitTree(cell *zp) { ! cell *tp = zp; ! while (tp != NULL) { printf("%x: %d ", tp, tp->value); ! tp = &tp->cdr; } printf("\n"); tp = zp; ! while (tp != NULL) { printf("%x: %d ", tp, tp->value); ! tp = &tp->car; } printf("\n"); } void ! listTest1() { int i, j; ! cell *lp = NULL, *zp; printf("List test 1\n"); ! for (i = 0; i <= SIZE; i++) { if (i % 50 == 0) { printf("."); fflush(stdout); } --- 1,102 ---- ! /* Test program for CMM */ ! ! /* Externals */ ! #include ! #include ! #include "cmm.h" ! #define VECT_SIZE 1000 ! struct cell : CmmObject { ! cell *car; ! cell *cdr; int value; cell(cell *initcar, cell *initcdr, int initvalue); void traverse(); }; + typedef cell* CP; + void cell::traverse() { CmmHeap *heap = Cmm::heap; ! heap->scavenge((CmmObject **)&car); ! heap->scavenge((CmmObject **)&cdr); } + cell::cell(cell *initcar, cell *initcdr, int initvalue) { + car = initcar; + cdr = initcdr; + value = initvalue; } + struct vector : CmmObject + { + vector *car; + vector *cdr; + int value1; + char bytes[VECT_SIZE]; + int value2; + vector(vector* x, vector* y, int v1, int v2); + void traverse(); + }; + + typedef vector* VP; + + void vector::traverse() + { + CmmHeap *heap = Cmm::heap; + heap->scavenge((CmmObject **)&car); + heap->scavenge((CmmObject **)&cdr); + } + + vector::vector(vector* x, vector* y, int v1, int v2) + { + car = x; + cdr = y; + value1 = v1; + value2 = v2; + } + + /* Test program */ + + int init_global = 2, + array_global[VECT_SIZE]; + void ! printtree(CP zp) { ! CP tp; ! ! tp = zp; ! while (tp != NULL) { printf("%x: %d ", tp, tp->value); ! tp = tp->cdr; } printf("\n"); tp = zp; ! while (tp != NULL) { printf("%x: %d ", tp, tp->value); ! tp = tp->car; } printf("\n"); } void ! listtest1() { int i, j; ! CP lp, zp; printf("List test 1\n"); ! lp = NULL; ! for (i = 0; i <= VECT_SIZE ; i++) { if (i % 50 == 0) { printf("."); fflush(stdout); } *************** *** 69,86 **** for (j = i; j >= 0 ; j--) { if ((zp == NULL) || (zp->value != j)) ! printf("LP is damaged at j = %d\n", j); ! zp = &zp->cdr; } } printf("\n"); } ! cell * ! treeTest() { int i; ! cell *tp, *zp; printf("Tree test\n"); tp = new cell(NULL, NULL, 0); --- 107,150 ---- for (j = i; j >= 0 ; j--) { if ((zp == NULL) || (zp->value != j)) ! printf("LP is not a good list when j = %d\n", j); ! zp = zp->cdr; } } printf("\n"); } ! void ! vectortest() ! { ! int i, j; ! VP lp, zp; ! ! printf("Vector test\n"); ! lp = NULL; ! for (i = 0; i <= 100 ; i++) ! { ! if (i % 10 == 0) ! { printf("."); fflush(stdout); } ! zp = new vector(NULL, lp, i, i); ! lp = zp; ! Cmm::heap->collect(); ! zp = lp; ! for (j = i; j >= 0 ; j--) ! { ! if ((zp == NULL) || (zp->value1 != j) || (zp->value2 != j)) ! printf("LP is not a good list when j = %d\n", j); ! zp = zp->cdr; ! } ! } ! printf("\n"); ! } ! ! CP ! treetest() { int i; ! CP tp, zp; printf("Tree test\n"); tp = new cell(NULL, NULL, 0); *************** *** 92,106 **** Cmm::heap->collect(); zp = new cell(tp, tp, 6); Cmm::heap->collect(); ! visitTree(zp); return(zp); } void ! listTest2() { ! int i, j, length = 1000, repeat = 100; ! cell *lp = NULL, *zp; printf("List Test 2\n"); for (i = 0; i < repeat; i++) --- 156,170 ---- Cmm::heap->collect(); zp = new cell(tp, tp, 6); Cmm::heap->collect(); ! printtree(zp); return(zp); } void ! listtest2() { ! int i, j, length = 10000, repeat = 1000; ! CP lp, zp; printf("List Test 2\n"); for (i = 0; i < repeat; i++) *************** *** 108,113 **** --- 172,178 ---- if (i % 50 == 0) { printf("."); fflush(stdout); } /* Build the list */ + lp = NULL; for (j = 0; j < length; j++) { zp = new cell(NULL, lp, j); *************** *** 119,144 **** { if ((zp == NULL) || (zp->value != j)) printf("LP is not a good list when j = %d\n", j); ! zp = &zp->cdr; } } printf("\n"); } ! cell *gp = NULL; /* A global pointer */ void main() { /* List construction test */ ! listTest1(); /* Tree construction test */ ! gp = treeTest(); ! /* 100 1000 node lists */ ! listTest2(); /* Check that tree is still there */ ! visitTree(gp); } --- 184,212 ---- { if ((zp == NULL) || (zp->value != j)) printf("LP is not a good list when j = %d\n", j); ! zp = zp->cdr; } } printf("\n"); } ! CP gp; /* A global pointer */ void main() { /* List construction test */ ! listtest1(); ! ! /* List of vectors > 1 page */ ! vectortest(); /* Tree construction test */ ! gp = treetest(); ! /* 1000 10000 node lists */ ! listtest2(); /* Check that tree is still there */ ! printtree(gp); } diff -c /home/omega/attardi/posso/cmm/test7.cpp /project/posso/cmm/curr/cmm/test7.cpp *** /home/omega/attardi/posso/cmm/test7.cpp Mon Sep 8 12:11:08 1997 --- /project/posso/cmm/curr/cmm/test7.cpp Mon Jul 28 21:22:45 1997 *************** *** 1,6 **** /* ! * Test for CmmArray (requires GNU C++) */ #include "cmm.h" --- 1,6 ---- /* ! * Test for CmmArray */ #include "cmm.h"