[m-rev.] diff: enable par grades on MacOS X

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue May 6 11:35:02 AEST 2003


On 06-May-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> I suggest that you first worry about fixing the inconsistent state of
> the repository, and then deal with the merge.

I couldn't wait for Pete to do this, so I did the most immediate part myself.
I preserved the boehm_gc directory in the repository (as boehm_gc.corrupted),
and then restored the old state of the files petdr modified, with the following
diff, which seems to have been enough to let the code in the boehm_gc
directory to at least compile. (The bootcheck is in progress.) The rest of
the cleanup I leave to Pete.

I also wrote a small script to make a backup copy of $CVSROOT/mercury every
night, keeping the last three copies in home/mars/zs/cvs_backup. The first
backup should be tonight. This should help us cope with problems like this.

Zoltan.

boehm_gc/BCC_MAKEFILE:
boehm_gc/mallocx.c:
boehm_gc/win32_threads.c:
boehm_gc/include/gc_cpp.h:
	Restore the versions of these files before petdr's attempted merge.

	The files his merge added are still there, but they should be harmless.

cvs diff: Diffing .
Index: BCC_MAKEFILE
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/boehm_gc/BCC_MAKEFILE,v
retrieving revision 1.1.1.7
diff -u -b -r1.1.1.7 BCC_MAKEFILE
--- BCC_MAKEFILE	5 May 2003 12:48:26 -0000	1.1.1.7
+++ BCC_MAKEFILE	6 May 2003 01:22:39 -0000
@@ -6,17 +6,16 @@
 bclib=	   $(bc)\lib
 bcinclude= $(bc)\include
 
-gcinclude1 = $(bc)\gc6.2\include
-gcinclude2 = $(bc)\gc6.2\cord
+gcinclude= $(bc)\gc6.0\include
 
 cc=	 $(bcbin)\bcc32
 rc=	 $(bcbin)\brc32
 lib=	 $(bcbin)\tlib
-link=	 $(bcbin)\ilink32
-cflags=  -O2 -R -v- -vi -H -H=gc.csm -I$(bcinclude);$(gcinclude1);$(gcinclude2) -L$(bclib) \
+link=	 $(bcbin)\tlink32
+cflags=  -O2 -R -v- -vi -H -H=gc.csm -I$(bcinclude);$(gcinclude);cord -L$(bclib) \
 	 -w-pro -w-aus -w-par -w-ccc -w-rch -a4 -D__STDC__=0
 #defines= -DSILENT
-defines= -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_GETENV -DJAVA_FINALIZATION -DGC_OPERATOR_NEW_ARRAY
+defines= -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_DEBUGGING -DNO_GETENV -DJAVA_FINALIZATION
 
 .c.obj:
 	$(cc) @&&|
@@ -54,7 +53,7 @@
 	$(cflags) -W -e$* tests\test.obj gc.lib
 |
 
-cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h \
+cord\de.obj cord\de_win.obj: cord\cord.h cord\private\cord_pos.h cord\de_win.h \
     cord\de_cmds.h
 
 cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj \
@@ -73,7 +72,7 @@
 test_cpp.cpp: tests\test_cpp.cc
 	copy tests\test_cpp.cc test_cpp.cpp
 
-test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib
+test_cpp.exe: test_cpp.obj gc_cpp.h gc.h gc.lib
     $(cc) @&&|
 	$(cflags) -W -e$* test_cpp.obj gc.lib
 |
Index: mallocx.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/boehm_gc/mallocx.c,v
retrieving revision 1.1.1.11
diff -u -b -r1.1.1.11 mallocx.c
--- mallocx.c	5 May 2003 12:48:30 -0000	1.1.1.11
+++ mallocx.c	6 May 2003 01:24:07 -0000
@@ -142,11 +142,7 @@
     }
 }
 
-# if defined(REDIRECT_MALLOC) && !defined(REDIRECT_REALLOC)
-#   define REDIRECT_REALLOC GC_realloc
-# endif
-
-# ifdef REDIRECT_REALLOC
+# if defined(REDIRECT_MALLOC) || defined(REDIRECT_REALLOC)
 # ifdef __STDC__
     GC_PTR realloc(GC_PTR p, size_t lb)
 # else
@@ -155,9 +151,13 @@
     size_t lb;
 # endif
   {
+#   ifdef REDIRECT_REALLOC
     return(REDIRECT_REALLOC(p, lb));
+#   else
+      return(GC_realloc(p, lb));
+#   endif
   }
-# endif /* REDIRECT_REALLOC */
+# endif /* REDIRECT_MALLOC */
 
 
 /* The same thing, except caller does not hold allocation lock.	*/
@@ -177,7 +177,7 @@
     lw = ROUNDED_UP_WORDS(lb);
     n_blocks = OBJ_SZ_TO_BLOCKS(lw);
     init = GC_obj_kinds[k].ok_init;
-    if (GC_have_errors) GC_print_all_errors();
+    if (GC_debugging_started) GC_print_all_smashed();
     GC_INVOKE_FINALIZERS();
     DISABLE_SIGNALS();
     LOCK();
@@ -287,7 +287,7 @@
 register ptr_t op;
 DCL_LOCK_STATE;
 
-    if (GC_have_errors) GC_print_all_errors();
+    if (GC_debugging_started) GC_print_all_smashed();
     GC_INVOKE_FINALIZERS();
     DISABLE_SIGNALS();
     LOCK();
@@ -356,7 +356,7 @@
         return;
     }
     lw = ALIGNED_WORDS(lb);
-    if (GC_have_errors) GC_print_all_errors();
+    if (GC_debugging_started) GC_print_all_smashed();
     GC_INVOKE_FINALIZERS();
     DISABLE_SIGNALS();
     LOCK();
@@ -578,44 +578,6 @@
 	return((GC_PTR) op);
     }
 }
-
-#ifdef __STDC__
-/* Not well tested nor integrated.	*/
-/* Debug version is tricky and currently missing.	*/
-#include <limits.h>
-
-GC_PTR GC_memalign(size_t align, size_t lb) 
-{ 
-    size_t new_lb;
-    size_t offset;
-    ptr_t result;
-
-#   ifdef ALIGN_DOUBLE
-	if (align <= WORDS_TO_BYTES(2) && lb > align) return GC_malloc(lb);
-#   endif
-    if (align <= WORDS_TO_BYTES(1)) return GC_malloc(lb);
-    if (align >= HBLKSIZE/2 || lb >= HBLKSIZE/2) {
-        if (align > HBLKSIZE) return GC_oom_fn(LONG_MAX-1024) /* Fail */;
-	return GC_malloc(lb <= HBLKSIZE? HBLKSIZE : lb);
-	    /* Will be HBLKSIZE aligned.	*/
-    }
-    /* We could also try to make sure that the real rounded-up object size */
-    /* is a multiple of align.  That would be correct up to HBLKSIZE.	   */
-    new_lb = lb + align - 1;
-    result = GC_malloc(new_lb);
-    offset = (word)result % align;
-    if (offset != 0) {
-	offset = align - offset;
-        if (!GC_all_interior_pointers) {
-	    if (offset >= VALID_OFFSET_SZ) return GC_malloc(HBLKSIZE);
-	    GC_register_displacement(offset);
-	}
-    }
-    result = (GC_PTR) ((ptr_t)result + offset);
-    GC_ASSERT((word)result % align == 0);
-    return result;
-}
-#endif 
 
 # ifdef ATOMIC_UNCOLLECTABLE
 /* Allocate lb bytes of pointerfree, untraced, uncollectable data 	*/
Index: win32_threads.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/boehm_gc/win32_threads.c,v
retrieving revision 1.1.1.6
diff -u -b -r1.1.1.6 win32_threads.c
--- win32_threads.c	5 May 2003 12:48:31 -0000	1.1.1.6
+++ win32_threads.c	6 May 2003 01:24:21 -0000
@@ -58,7 +58,7 @@
     for (i = 0; i < MAX_THREADS; i++)
       if (thread_table[i].in_use) GC_push_all((ptr_t)&(thread_table[i].status),(ptr_t)(&(thread_table[i].status)+1));
   }
-# endif
+#endif
 }
 
 void GC_stop_world()
@@ -89,12 +89,11 @@
             exitCode != STILL_ACTIVE) {
           thread_table[i].stack = 0; /* prevent stack from being pushed */
 #         ifndef CYGWIN32
-            /* this breaks pthread_join on Cygwin, which is guaranteed to  */
-	    /* only see user pthreads 					   */
+          /* this breaks pthread_join on Cygwin, which is guaranteed to only see user pthreads */
 	    thread_table[i].in_use = FALSE;
 	    CloseHandle(thread_table[i].handle);
 	    BZERO((void *)(&thread_table[i].context), sizeof(CONTEXT));
-#         endif
+#endif
 	  continue;
 	}
 	if (SuspendThread(thread_table[i].handle) == (DWORD)-1)
@@ -809,7 +808,8 @@
 #else
 
 /*
- * We avoid acquiring locks here, since this doesn't seem to be preemptable.
+ * This isn't generally safe, since DllMain is not premptible.
+ * If another thread holds the lock while this runs we're in trouble.
  * Pontus Rydin suggests wrapping the thread start routine instead.
  */
 BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
cvs diff: Diffing Mac_files
cvs diff: Diffing cord
cvs diff: Diffing cord/private
cvs diff: Diffing doc
cvs diff: Diffing include
Index: include/gc_cpp.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/boehm_gc/include/gc_cpp.h,v
retrieving revision 1.1.1.8
diff -u -b -r1.1.1.8 gc_cpp.h
--- include/gc_cpp.h	5 May 2003 12:48:33 -0000	1.1.1.8
+++ include/gc_cpp.h	6 May 2003 01:24:45 -0000
@@ -134,9 +134,7 @@
 #include "gc.h"
 
 #ifndef THINK_CPLUS
-#  define GC_cdecl
-#else
-#  define GC_cdecl _cdecl
+#define _cdecl
 #endif
 
 #if ! defined( GC_NO_OPERATOR_NEW_ARRAY ) \
@@ -165,18 +163,14 @@
     	/* Must be redefined here, since the other overloadings	*/
     	/* hide the global definition.				*/
     inline void operator delete( void* obj );
-#   ifndef __BORLANDC__  /* Confuses the Borland compiler. */
       inline void operator delete( void*, void* );
-#   endif
 
 #ifdef GC_OPERATOR_NEW_ARRAY
     inline void* operator new[]( size_t size );
     inline void* operator new[]( size_t size, GCPlacement gcp );
     inline void* operator new[]( size_t size, void *p );
     inline void operator delete[]( void* obj );
-#   ifndef __BORLANDC__
       inline void gc::operator delete[]( void*, void* );
-#   endif
 #endif /* GC_OPERATOR_NEW_ARRAY */
     };    
     /*
@@ -188,7 +182,7 @@
     inline gc_cleanup();
     inline virtual ~gc_cleanup();
 private:
-    inline static void GC_cdecl cleanup( void* obj, void* clientData );};
+    inline static void _cdecl cleanup( void* obj, void* clientData );};
     /*
     Instances of classes derived from "gc_cleanup" will be allocated
     in the collected heap by default.  When the collector discovers an
@@ -282,9 +276,7 @@
 inline void gc::operator delete( void* obj ) {
     GC_FREE( obj );}
     
-#ifndef __BORLANDC__
-  inline void gc::operator delete( void*, void* ) {}
-#endif
+inline void gc::operator delete( void*, void* ) {}
 
 #ifdef GC_OPERATOR_NEW_ARRAY
 
@@ -300,15 +292,13 @@
 inline void gc::operator delete[]( void* obj ) {
     gc::operator delete( obj );}
 
-#ifndef __BORLANDC__
-  inline void gc::operator delete[]( void*, void* ) {}
-#endif
+inline void gc::operator delete[]( void*, void* ) {}
     
 #endif /* GC_OPERATOR_NEW_ARRAY */
 
 
 inline gc_cleanup::~gc_cleanup() {
-    GC_register_finalizer_ignore_self( GC_base(this), 0, 0, 0, 0 );}
+    GC_REGISTER_FINALIZER_IGNORE_SELF( GC_base(this), 0, 0, 0, 0 );}
 
 inline void gc_cleanup::cleanup( void* obj, void* displ ) {
     ((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();}
cvs diff: Diffing include/private
cvs diff: Diffing tests
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list