[m-rev.] Re: GC bug for dynamic type_infos

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Feb 22 17:09:54 AEDT 2006


On 22-Feb-2006, Gregory James DUCK <gjd at cs.mu.OZ.AU> wrote:
> I've traced this to runtime/mercury_type_desc.c and function MR_make_type.
> I think (one of) the roles of this function is to allocate space for the
> type_info, however it seems to use MR_offset_incr_hp_atomic_msg.
> Surely this should be MR_offset_incr_hp_msg since type_infos
> may contain pointers to non-static data (this is true for the test program).

runtime/mercury_type_desc.c:
	Fix a bug detected and localized by Greg Duck. Allocated typeinfos
	can contain pointers to other typeinfos that are themselves heap cells,
	so don't use the *atomic* allocation macros for them, since those
	macros tell boehm_gc that they *don't* contain pointers.

cvs diff: Diffing .
Index: mercury_type_desc.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_type_desc.c,v
retrieving revision 1.8
diff -u -b -r1.8 mercury_type_desc.c
--- mercury_type_desc.c	14 Dec 2004 01:07:25 -0000	1.8
+++ mercury_type_desc.c	22 Feb 2006 04:39:34 -0000
@@ -18,7 +18,7 @@
 #endif
 #include "mercury_type_info.h"
 #include "mercury_type_desc.h"
-#include "mercury_heap.h"       /* for MR_offset_incr_hp_atomic_msg() */
+#include "mercury_heap.h"       /* for MR_offset_incr_hp_msg() */
 #include "mercury_misc.h"       /* for MR_fatal_error() */
 
 MR_TypeCtorDesc
@@ -166,7 +166,7 @@
             type_ctor_desc);
 
         MR_restore_transient_registers();
-        MR_offset_incr_hp_atomic_msg(new_type_info_arena_word, 0,
+        MR_offset_incr_hp_msg(new_type_info_arena_word, 0,
             MR_var_arity_type_info_size(arity), "MR_make_type", "type_info");
         new_type_info_arena = (MR_Word *) new_type_info_arena_word;
         MR_save_transient_registers();
@@ -181,7 +181,7 @@
         }
 
         MR_restore_transient_registers();
-        MR_offset_incr_hp_atomic_msg(new_type_info_arena_word, 0,
+        MR_offset_incr_hp_msg(new_type_info_arena_word, 0,
             MR_fixed_arity_type_info_size(arity), "MR_make_type", "type_info");
         new_type_info_arena = (MR_Word *) new_type_info_arena_word;
         MR_save_transient_registers();
cvs diff: Diffing GETOPT
cvs diff: Diffing machdeps
--------------------------------------------------------------------------
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