]> granicus.if.org Git - gc/commitdiff
gc4.7 tarball import gc4_7
authorHans Boehm <boehm@acm.org>
Sat, 18 Nov 1995 00:00:00 +0000 (00:00 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 17 May 2014 13:23:40 +0000 (17:23 +0400)
MacOS.c
Mac_files/MacOS_Test_config.h
Mac_files/MacOS_config.h
README
checksums.c
mach_dep.c
mark.c

diff --git a/MacOS.c b/MacOS.c
index 18d347759cbd53f77c056508dd056034693df3ec..280bf88fd75c8985fa9bf7a5ca5b339a7656445a 100644 (file)
--- a/MacOS.c
+++ b/MacOS.c
@@ -11,7 +11,7 @@
        
        by Patrick C. Beard.
  */
-/* Boehm, July 28, 1994 10:35 am PDT */
+/* Boehm, November 17, 1995 11:50 am PST */
 
 #include <Resources.h>
 #include <Memory.h>
@@ -51,9 +51,10 @@ struct TemporaryMemoryBlock {
        char data[];
 };
 
-TemporaryMemoryHandle theTemporaryMemory = NULL;
+static TemporaryMemoryHandle theTemporaryMemory = NULL;
+static Boolean firstTime = true;
 
-static void GC_MacFreeTemporaryMemory(void);
+void GC_MacFreeTemporaryMemory(void);
 
 Ptr GC_MacTemporaryNewPtr(Size size, Boolean clearMemory)
 {
@@ -83,7 +84,7 @@ Ptr GC_MacTemporaryNewPtr(Size size, Boolean clearMemory)
        return tempPtr;
 }
 
-static void GC_MacFreeTemporaryMemory()
+void GC_MacFreeTemporaryMemory()
 {
        long totalMemoryUsed = 0;
        TemporaryMemoryHandle tempMemBlock = theTemporaryMemory;
index db24e0bdf2bc4935ffc9b18b20eab445bf32eab9..94db03f0fb68a2d6ff01b294e2a2d027f6657145 100644 (file)
@@ -5,8 +5,13 @@
        
        Test version.
        
+       <Revision History>
+
+       11/16/95  pcb  Updated compilation flags to reflect latest 4.6 Makefile.
+       
        by Patrick C. Beard.
  */
+/* Boehm, November 17, 1995 12:05 pm PST */
 
 #ifdef __MWERKS__
 #if defined(__powerc)
 #undef TRUE
 #undef FALSE
 
-#define ALL_INTERIOR_POINTERS     // follows interior pointers.
-//#define SILENT                    // no collection messages.
-//#define DONT_ADD_BYTE_AT_END      // no padding.
-//#define SMALL_CONFIG              // use a smaller heap.
-#define USE_TEMPORARY_MEMORY      // use Macintosh temporary memory.
+#define ALL_INTERIOR_POINTERS  // follows interior pointers.
+//#define SILENT               // want collection messages.
+//#define DONT_ADD_BYTE_AT_END // no padding.
+//#define SMALL_CONFIG         // whether to a smaller heap.
+#define NO_SIGNALS             // signals aren't real on the Macintosh.
+#define USE_TEMPORARY_MEMORY   // use Macintosh temporary memory.
 
-// CFLAGS= -O -DALL_INTERIOR_POINTERS -DSILENT
+// CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DSILENT
+//
+//LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
+//    -DREDIRECT_MALLOC=GC_malloc_uncollectable \
+//    -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
+//   Flags for building libgc.a -- the last two are required.
+//
 // Setjmp_test may yield overly optimistic results when compiled
 // without optimization.
 // -DSILENT disables statistics printing, and improves performance.
 // -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
 //   altered stubborn objects, at substantial performance cost.
+//   Use only for incremental collector debugging.
 // -DFIND_LEAK causes the collector to assume that all inaccessible
-//   objects should have been explicitly deallocated, and reports exceptions
+//   objects should have been explicitly deallocated, and reports exceptions.
+//   Finalization and the test program are not usable in this mode.
 // -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
 //   (Clients should also define SOLARIS_THREADS and then include
 //   gc.h before performing thr_ or GC_ operations.)
+//   This is broken on nonSPARC machines.
 // -DALL_INTERIOR_POINTERS allows all pointers to the interior
-//   of objects to be recognized.  (See gc_private.h for consequences.)
+//   of objects to be recognized.  (See gc_priv.h for consequences.)
 // -DSMALL_CONFIG tries to tune the collector for small heap sizes,
 //   usually causing it to use less space in such situations.
 //   Incremental collection no longer works in this case.
+// -DLARGE_CONFIG tunes the collector for unusually large heaps.
+//   Necessary for heaps larger than about 500 MB on most machines.
+//   Recommended for heaps larger than about 64 MB.
 // -DDONT_ADD_BYTE_AT_END is meaningful only with
 //   -DALL_INTERIOR_POINTERS.  Normally -DALL_INTERIOR_POINTERS
 //   causes all objects to be padded so that pointers just past the end of
 //   an object can be recognized.  This can be expensive.  (The padding
 //   is normally more than one byte due to alignment constraints.)
 //   -DDONT_ADD_BYTE_AT_END disables the padding.
+// -DNO_SIGNALS does not disable signals during critical parts of
+//   the GC process.  This is no less correct than many malloc 
+//   implementations, and it sometimes has a significant performance
+//   impact.  However, it is dangerous for many not-quite-ANSI C
+//   programs that call things like printf in asynchronous signal handlers.
+// -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
+//   new syntax "operator new[]" for allocating and deleting arrays.
+//   See gc_cpp.h for details.  No effect on the C part of the collector.
+//   This is defined implicitly in a few environments.
+// -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
+//   as aliases for X, GC_realloc, and GC_free, respectively.
+//   Calloc is redefined in terms of the new malloc.  X should
+//   be either GC_malloc or GC_malloc_uncollectable.
+//   The former is occasionally useful for working around leaks in code
+//   you don't want to (or can't) look at.  It may not work for
+//   existing code, but it often does.  Neither works on all platforms,
+//   since some ports use malloc or calloc to obtain system memory.
+//   (Probably works for UNIX, and win32.)
+// -DNO_DEBUG removes GC_dump and the debugging routines it calls.
+//   Reduces code size slightly at the expense of debuggability.
\ No newline at end of file
index dd88516d00563fb619673fde277a6e35e1670fac..838be5910aee9116e5a57f9efdea026e02325994 100644 (file)
@@ -3,8 +3,13 @@
        
        Configuration flags for Macintosh development systems.
        
+       <Revision History>
+       
+       11/16/95  pcb  Updated compilation flags to reflect latest 4.6 Makefile.
+       
        by Patrick C. Beard.
  */
+/* Boehm, November 17, 1995 12:10 pm PST */
 
 #ifdef __MWERKS__
 #if defined(__powerc)
 #undef TRUE
 #undef FALSE
 
-#define ALL_INTERIOR_POINTERS     // follows interior pointers.
-#define SILENT                    // no collection messages.
-//#define DONT_ADD_BYTE_AT_END      // no padding.
-//#define SMALL_CONFIG              // use a smaller heap.
-#define USE_TEMPORARY_MEMORY      // use Macintosh temporary memory.
+#define ALL_INTERIOR_POINTERS  // follows interior pointers.
+#define SILENT                 // no collection messages.
+//#define DONT_ADD_BYTE_AT_END // no padding.
+//#define SMALL_CONFIG         // whether to use a smaller heap.
+#define NO_SIGNALS             // signals aren't real on the Macintosh.
+#define USE_TEMPORARY_MEMORY   // use Macintosh temporary memory.
 
-// CFLAGS= -O -DALL_INTERIOR_POINTERS -DSILENT
+// CFLAGS= -O -DNO_SIGNALS -DSILENT -DALL_INTERIOR_POINTERS
+//
+//LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
+//    -DREDIRECT_MALLOC=GC_malloc_uncollectable \
+//    -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
+//   Flags for building libgc.a -- the last two are required.
+//
 // Setjmp_test may yield overly optimistic results when compiled
 // without optimization.
 // -DSILENT disables statistics printing, and improves performance.
 // -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
 //   altered stubborn objects, at substantial performance cost.
+//   Use only for incremental collector debugging.
 // -DFIND_LEAK causes the collector to assume that all inaccessible
-//   objects should have been explicitly deallocated, and reports exceptions
+//   objects should have been explicitly deallocated, and reports exceptions.
+//   Finalization and the test program are not usable in this mode.
 // -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
 //   (Clients should also define SOLARIS_THREADS and then include
 //   gc.h before performing thr_ or GC_ operations.)
+//   This is broken on nonSPARC machines.
 // -DALL_INTERIOR_POINTERS allows all pointers to the interior
-//   of objects to be recognized.  (See gc_private.h for consequences.)
+//   of objects to be recognized.  (See gc_priv.h for consequences.)
 // -DSMALL_CONFIG tries to tune the collector for small heap sizes,
 //   usually causing it to use less space in such situations.
 //   Incremental collection no longer works in this case.
+// -DLARGE_CONFIG tunes the collector for unusually large heaps.
+//   Necessary for heaps larger than about 500 MB on most machines.
+//   Recommended for heaps larger than about 64 MB.
 // -DDONT_ADD_BYTE_AT_END is meaningful only with
 //   -DALL_INTERIOR_POINTERS.  Normally -DALL_INTERIOR_POINTERS
 //   causes all objects to be padded so that pointers just past the end of
 //   an object can be recognized.  This can be expensive.  (The padding
 //   is normally more than one byte due to alignment constraints.)
 //   -DDONT_ADD_BYTE_AT_END disables the padding.
+// -DNO_SIGNALS does not disable signals during critical parts of
+//   the GC process.  This is no less correct than many malloc 
+//   implementations, and it sometimes has a significant performance
+//   impact.  However, it is dangerous for many not-quite-ANSI C
+//   programs that call things like printf in asynchronous signal handlers.
+// -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
+//   new syntax "operator new[]" for allocating and deleting arrays.
+//   See gc_cpp.h for details.  No effect on the C part of the collector.
+//   This is defined implicitly in a few environments.
+// -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
+//   as aliases for X, GC_realloc, and GC_free, respectively.
+//   Calloc is redefined in terms of the new malloc.  X should
+//   be either GC_malloc or GC_malloc_uncollectable.
+//   The former is occasionally useful for working around leaks in code
+//   you don't want to (or can't) look at.  It may not work for
+//   existing code, but it often does.  Neither works on all platforms,
+//   since some ports use malloc or calloc to obtain system memory.
+//   (Probably works for UNIX, and win32.)
+// -DNO_DEBUG removes GC_dump and the debugging routines it calls.
+//   Reduces code size slightly at the expense of debuggability.
\ No newline at end of file
diff --git a/README b/README
index 985036fb15f8d9bd284f2885d1b99e263051fb8c..0fc7a6b95ac916531b352cb64c097c8ec511c32b 100644 (file)
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ Permission to modify the code and to distribute modified code is granted,
 provided the above notices are retained, and a notice that the code was
 modified is included with the above copyright notice.
 
-This is version 4.6 of a conservative garbage collector for C and C++.
+This is version 4.7 of a conservative garbage collector for C and C++.
 
 HISTORY -
 
@@ -1112,7 +1112,7 @@ Since version 4.5:
    first renames ALL "GC_xxx" identifiers as "_GC_xxx".  The second is the
    inverse transformation.  Note that doing this is guaranteed to break all
    clients written for the other names.
- - descriptor field for kinf NORMAL in GC_obj_kinds with ADD_BYTE_AT_END
+ - descriptor field for kind NORMAL in GC_obj_kinds with ADD_BYTE_AT_END
    defined should be -ALIGNMENT not WORDS_TO_BYTES(-1).  This is
    a serious bug on machines with pointer alignment of less than a word.
  - GC_ignore_self_finalize_mark_proc didn't handle pointers to very near the
@@ -1121,4 +1121,11 @@ Since version 4.5:
  - gc_inl.h still had problems.  Partially fixed.  Added warnings at the
    beginning to hopefully specify the remaining dangers.
  - Added DATAEND definition to config.h.
- - Fixed some of the .h file organization.  Fixed "make floppy".
\ No newline at end of file
+ - Fixed some of the .h file organization.  Fixed "make floppy".
+Since version 4.6:
+ - Fixed some compilation problems with -DCHECKSUMS (thanks to Ian Searle)
+ - Updated some Mac specific files to synchronize with Patrick Beard.
+ - Fixed a serious bug for machines with non-word-aligned pointers.
+   (Thanks to Patrick Beard for pointing out the problem.  The collector
+   should fail almost any conceivable test immediately on such machines.)
index 7d9b7b7d2d028208e709bec3114374b459352bff..98ef08fe63f395fecdbc0175382382bc1e60876f 100644 (file)
@@ -142,9 +142,9 @@ void GC_check_blocks()
     }
     GC_printf2("GC_bytes_in_used_blocks = %ld, bytes_in_free_blocks = %ld ",
                GC_bytes_in_used_blocks, bytes_in_free_blocks);
-    GC_printf("GC_heapsize = %ld\n", GC_heapsize);
+    GC_printf1("GC_heapsize = %ld\n", GC_heapsize);
     if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) {
-       GC_printf("LOST SOME BLOCKS!!\n");
+       GC_printf0("LOST SOME BLOCKS!!\n");
     }
 }
 
index 7fa43b180fe739c9cb9f35fd44503f6c00dccdd1..fbd8c6c65cd0044ed12d2fbff188290f705f0904 100644 (file)
@@ -11,7 +11,7 @@
  * provided the above notices are retained, and a notice that the code was
  * modified is included with the above copyright notice.
  */
-/* Boehm, September 14, 1995 12:42 pm PDT */
+/* Boehm, November 17, 1995 12:13 pm PST */
 # include "gc_priv.h"
 # include <stdio.h>
 # include <setjmp.h>
@@ -34,10 +34,12 @@ asm static void PushMacRegisters()
     jsr                GC_push_one
     move.l  a4,(sp)
     jsr                GC_push_one
-       // <pcb> perhaps a6 should be pushed if stack frames arent being used.
-    move.l  a6,(sp)
-    jsr     GC_push_one
-       // skip a5 (globals), and a7 (stack pointer)
+#   if !__option(a6frames)
+       // <pcb> perhaps a6 should be pushed if stack frames aren't being used.    
+       move.l  a6,(sp)
+       jsr             GC_push_one
+#   endif
+       // skip a5 (globals), a6 (frame pointer), and a7 (stack pointer)
     move.l  d2,(sp)
     jsr                GC_push_one
     move.l  d3,(sp)
diff --git a/mark.c b/mark.c
index c55f80a8280f95cffa0caca98854e6becbeb03da..a93c4edefa8a42cc89e6249c5ab5b9f6743ece70 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -34,7 +34,7 @@ struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
 /* PTRFREE */ { &GC_aobjfreelist[0], 0 /* filled in dynamically */,
                0 | DS_LENGTH, FALSE, FALSE },
 /* NORMAL  */ { &GC_objfreelist[0], 0,
-#              ifdef ADD_BYTE_AT_END
+#              if defined(ADD_BYTE_AT_END) && ALIGNMENT > DS_TAGS
                (word)(-ALIGNMENT) | DS_LENGTH,
 #              else
                0 | DS_LENGTH,