[m-rev.] diff: agc deep copy bug fix

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Dec 18 21:41:09 AEDT 2003


On 18-Dec-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Fix a bug in the accurate GC version of the deep copy code.
> 
> runtime/mercury_deep_copy_body.h:
> runtime/mercury_deep_copy.c:
> 	When copying type_infos and typeclass_infos, ensure that we
> 	allocate the extra word for the forwarding pointer.

Estimated hours taken: 0.75
Branches: main

A correction to my earlier incomplete attempt to fix a bug for accurate GC.

runtime/mercury_deep_copy_body.h:
	When copying type_infos and typeclass_infos, ensure that we
	allocate the extra word for the forwarding pointer whenever
	MR_NATIVE_GC is defined.  If MR_NATIVE_GC is defined, this
	needs to be done in both MR_deep_copy() and MR_agc_deep_copy(),
	not just in MR_agc_deep_copy().

runtime/mercury_deep_copy.c:
	Delete the use_forwarding_pointers() macro, since it is no
	longer used.

Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: runtime/mercury_deep_copy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.c,v
retrieving revision 1.32
diff -u -d -r1.32 mercury_deep_copy.c
--- runtime/mercury_deep_copy.c	17 Dec 2003 13:09:37 -0000	1.32
+++ runtime/mercury_deep_copy.c	18 Dec 2003 10:39:54 -0000
@@ -40,9 +40,6 @@
 #undef  copy_typeclass_info
 #define copy_typeclass_info	MR_deep_copy_typeclass_info
 
-#undef  use_forwarding_pointers
-#define use_forwarding_pointers() MR_FALSE
-
 #undef  if_forwarding_pointer
 #define if_forwarding_pointer(Data, ACTION)
 
@@ -81,9 +78,6 @@
 #else
   #define FORWARD_DEBUG_MSG(Msg, Data) ((void)0)
 #endif
-
-#undef  use_forwarding_pointers
-#define use_forwarding_pointers() MR_TRUE
 
 /*
 ** This points to a bitmap, which is used to record which objects
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.64
diff -u -d -r1.64 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h	17 Dec 2003 13:09:37 -0000	1.64
+++ runtime/mercury_deep_copy_body.h	17 Dec 2003 15:18:21 -0000
@@ -749,7 +749,11 @@
         }
 
         /* compute how many words to reserve for the forwarding pointer */
-        forwarding_pointer_size = (use_forwarding_pointers() ? 1 : 0);
+#ifdef MR_NATIVE_GC
+        forwarding_pointer_size = 1;
+#else
+        forwarding_pointer_size = 0;
+#endif
 
         if (MR_type_ctor_has_variable_arity(type_ctor_info)) {
             arity = MR_TYPEINFO_GET_VAR_ARITY_ARITY(type_info);
@@ -811,7 +815,11 @@
         base_typeclass_info = (MR_Word *) *typeclass_info;
 
         /* compute how many words to reserve for the forwarding pointer */
-        forwarding_pointer_size = (use_forwarding_pointers() ? 1 : 0);
+#ifdef MR_NATIVE_GC
+        forwarding_pointer_size = 1;
+#else
+        forwarding_pointer_size = 0;
+#endif
 
         num_instance_constraints =
             MR_typeclass_info_num_instance_constraints(typeclass_info);
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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