[m-dev.] diff: GCC back-end: (partial) fix for GC bug

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Jan 20 03:40:40 AEDT 2001


Estimated hours taken: 5

gcc/mercury/mercury-gcc.c:
	Fix a bug: call gcc_add_tree_root() to register various tree
	nodes with GCC's garbage collector.  This is needed because
	GCC uses a garbage collector which requires you to explicitly
	register all the roots.

	This is only a partial fix for the problem; we also allocate
	tree nodes which are only pointed to via Mercury data structures
	on the Mercury heap, and currently they don't get registered
	with GCC's garbage collector.

Index: mercury-gcc.c
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/mercury-gcc.c,v
retrieving revision 1.23
diff -u -d -u -r1.23 mercury-gcc.c
--- mercury-gcc.c	2001/01/18 15:44:02	1.23
+++ mercury-gcc.c	2001/01/19 16:24:20
@@ -1523,6 +1523,16 @@
   ggc_add_tree_root (&merc_box_float_function_node, 1);
   ggc_add_tree_root (&merc_setjmp_function_node, 1);
   ggc_add_tree_root (&merc_longjmp_function_node, 1);
+  ggc_add_tree_root (&merc_int8_type_node, 1);
+  ggc_add_tree_root (&merc_int16_type_node, 1);
+  ggc_add_tree_root (&merc_int32_type_node, 1);
+  ggc_add_tree_root (&merc_int64_type_node, 1);
+  ggc_add_tree_root (&merc_intptr_type_node, 1);
+  ggc_add_tree_root (&merc_jmpbuf_type_node, 1);
+  ggc_add_tree_root (&signed_and_unsigned_types[0][0],
+		     (MAX_BITS_PER_WORD + 1) * 2);
+  ggc_add_tree_root (c_global_trees, CTI_MAX);
+  ggc_add_tree_root (ridpointers, RID_MAX);
 }
 
 /* If DECL has a cleanup, build and return that cleanup here.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list