[m-rev.] diff: MLDS->C accurate GC bug fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 30 23:34:36 AEDT 2002


On 30-Jan-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Various bug fixes for accurate GC with the MLDS->C back-end.

With those changes, plus the following hack (which is far too horrible
to commit) to work-around compilation errors due to stuff which is not
yet implemented, and using `--no-reclaim-heap-on-failure', the hlc.agc
grade does work for at least some test cases.

(Without `--no-reclaim-heap-on-failure', it gets an error because the GC
doesn't know how to handle the saved heap pointers.)

The test cases I tried were nrev (with MERCURY_OPTIONS=-r1000 to repeat
it lots of times) and the following program.  I was able to compile
these test cases in grade hlc.agc, and execute them.  Numerous garbage
collections were invoked, and everything worked correctly.

	:- module gctest.
	:- interface.
	:- import_module io.

	:- pred main(io__state::di, io__state::uo) is det.

	:- implementation.
	:- import_module int, string.

	main --> loop(0).
		
	:- pred loop(int::in, io__state::di, io__state::uo) is det.
	loop(N) -->
		io__write_string("iteration " ++ string__int_to_string(N)
			++ "\n"),
		loop(N + 1).

Index: mercury.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.h,v
retrieving revision 1.44
diff -u -d -u -r1.44 mercury.h
--- mercury.h	28 Jan 2002 05:30:31 -0000	1.44
+++ mercury.h	30 Jan 2002 09:29:15 -0000
@@ -594,6 +594,10 @@
 
 /*---------------------------------------------------------------------------*/
 
+#ifdef NATIVE_GC
+#include "native_gc_hack.h"
+#endif
+
 #endif /* MR_HIGHLEVEL_CODE */
 
 #endif /* not MERCURY_H */
Index: native_gc_hack.h
===================================================================
RCS file: native_gc_hack.h
diff -N native_gc_hack.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ native_gc_hack.h	30 Jan 2002 12:04:07 -0000
@@ -0,0 +1,125 @@
+/* 
+ * XXX
+ * Accurate GC handling is not yet implemented properly for 
+ * code using closures or type class methods.
+ * The following is a hack to get the Mercury standard library
+ * to compile.  The generated code for anything using closures
+ * or type class methods won't be correct, though.
+ */
+
+MR_Word mercury__array__TypeInfo_32_32;
+MR_Word mercury__array__TypeInfo_33_33;
+MR_Word mercury__array__TypeInfo_44_44;
+MR_Word mercury__array__TypeInfo_45_45;
+MR_Word mercury__array__TypeInfo_for_T1_14;
+MR_Word mercury__array__TypeInfo_for_T2_15;
+MR_Word mercury__array__TypeInfo_for_T_18;
+MR_Word mercury__array__TypeInfo_for_T_19;
+MR_Word mercury__bitmap__TypeInfo_78_78;
+MR_Word mercury__bitmap__TypeInfo_80_80;
+MR_Word mercury__bitmap__TypeInfo_81_81;
+MR_Word mercury__bitmap__TypeInfo_82_82;
+MR_Word mercury__bitmap__TypeInfo_97_97;
+MR_Word mercury__bitmap__TypeInfo_98_98;
+MR_Word mercury__bool__TypeInfo_4_4;
+MR_Word mercury__bool__TypeInfo_5_5;
+MR_Word mercury__builtin____type_ctor_info_void_0;
+MR_Word mercury__char__TypeInfo_11_11;
+MR_Word mercury__char__TypeInfo_12_12;
+MR_Word mercury__exception__TypeInfo_100_100;
+MR_Word mercury__exception__TypeInfo_107_107;
+MR_Word mercury__exception__TypeInfo_108_108;
+MR_Word mercury__exception__TypeInfo_24_24;
+MR_Word mercury__exception__TypeInfo_33_33;
+MR_Word mercury__exception__TypeInfo_34_34;
+MR_Word mercury__exception__TypeInfo_35_35;
+MR_Word mercury__exception__TypeInfo_70_70;
+MR_Word mercury__exception__TypeInfo_92_92;
+MR_Word mercury__exception__TypeInfo_for_A_19;
+MR_Word mercury__exception__TypeInfo_for_T_18;
+MR_Word mercury__exception__TypeInfo_for_T_22;
+MR_Word mercury__exception__TypeInfo_for_T_32;
+MR_Word mercury__exception__TypeInfo_for_T_34;
+MR_Word mercury__exception__TypeInfo_for_T_38;
+MR_Word mercury__getopt__TypeInfo_166_166;
+MR_Word mercury__getopt__TypeInfo_167_167;
+MR_Word mercury__getopt__TypeInfo_for_OptionType_22;
+MR_Word mercury__graph__TypeInfo_118_118;
+MR_Word mercury__graph__TypeInfo_for_A_11;
+MR_Word mercury__graph__TypeInfo_for_N_10;
+MR_Word mercury__hash_table__TypeInfo_226_226;
+MR_Word mercury__hash_table__TypeInfo_227_227;
+MR_Word mercury__hash_table__TypeInfo_60_60;
+MR_Word mercury__hash_table__TypeInfo_61_61;
+MR_Word mercury__hash_table__TypeInfo_62_62;
+MR_Word mercury__hash_table__TypeInfo_63_63;
+MR_Word mercury__hash_table__TypeInfo_for_T_54;
+MR_Word mercury__int__TypeInfo_4_4;
+MR_Word mercury__io__TypeInfo_127_127;
+MR_Word mercury__io__TypeInfo_27_27;
+MR_Word mercury__io__TypeInfo_53_53;
+MR_Word mercury__io__TypeInfo_56_56;
+MR_Word mercury__io__TypeInfo_for_T_12;
+MR_Word mercury__list__TypeInfo_28_28;
+MR_Word mercury__ops__TypeInfo_4_4;
+MR_Word mercury__pprint__TypeInfo_15_15;
+MR_Word mercury__pprint__TypeInfo_79_79;
+MR_Word mercury__pprint__TypeInfo_84_84;
+MR_Word mercury__pprint__TypeInfo_for_T1_17;
+MR_Word mercury__pprint__TypeInfo_for_T_14;
+MR_Word mercury__pprint__TypeInfo_for_T_8;
+MR_Word mercury__private_builtin__TypeInfo_3_3;
+MR_Word mercury__private_builtin__TypeInfo_4_4;
+MR_Word mercury__relation__TypeInfo_for_T_22;
+MR_Word mercury__relation__TypeInfo_for_T_50;
+MR_Word mercury__rtti_implementation__TypeInfo_38_38;
+MR_Word mercury__rtti_implementation__TypeInfo_39_39;
+MR_Word mercury__rtti_implementation__TypeInfo_41_41;
+MR_Word mercury__rtti_implementation__TypeInfo_43_43;
+MR_Word mercury__rtti_implementation__TypeInfo_45_45;
+MR_Word mercury__rtti_implementation__TypeInfo_for_P_45;
+MR_Word mercury__rtti_implementation__TypeInfo_for_T_37;
+MR_Word mercury__rtti_implementation__TypeInfo_for_T_46;
+MR_Word mercury__set_bbbtree__TypeInfo_for_T_6;
+MR_Word mercury__sparse_bitset__TypeInfo_46_46;
+MR_Word mercury__sparse_bitset__V_18_18;
+MR_Word mercury__std_util__TypeInfo_13_13;
+MR_Word mercury__std_util__TypeInfo_13_15;
+MR_Word mercury__std_util__TypeInfo_13_30;
+MR_Word mercury__std_util__TypeInfo_13_31;
+MR_Word mercury__std_util__TypeInfo_13_42;
+MR_Word mercury__std_util__TypeInfo_13_54;
+MR_Word mercury__std_util__TypeInfo_50_50;
+MR_Word mercury__std_util__TypeInfo_5_37;
+MR_Word mercury__std_util__TypeInfo_5_41;
+MR_Word mercury__std_util__TypeInfo_5_5;
+MR_Word mercury__std_util__TypeInfo_60_60;
+MR_Word mercury__std_util__TypeInfo_6_38;
+MR_Word mercury__std_util__TypeInfo_6_42;
+MR_Word mercury__std_util__TypeInfo_6_59;
+MR_Word mercury__std_util__TypeInfo_6_6;
+MR_Word mercury__std_util__TypeInfo_6_75;
+MR_Word mercury__std_util__TypeInfo_7_60;
+MR_Word mercury__std_util__TypeInfo_7_76;
+MR_Word mercury__std_util__TypeInfo_7_7;
+MR_Word mercury__std_util__TypeInfo_for_T_7;
+MR_Word mercury__string__TypeInfo_83_83;
+MR_Word mercury__string__TypeInfo_182_182;
+MR_Word mercury__string__TypeInfo_183_183;
+MR_Word mercury__string__TypeInfo_186_186;
+MR_Word mercury__string__TypeInfo_187_187;
+MR_Word mercury__string__TypeInfo_73_73;
+MR_Word mercury__string__TypeInfo_86_86;
+MR_Word mercury__string__TypeInfo_89_89;
+MR_Word mercury__term__TypeInfo_30_30;
+MR_Word mercury__term__TypeInfo_5_5;
+MR_Word mercury__term__TypeInfo_76_76;
+MR_Word mercury__term__TypeInfo_for_T_24;
+MR_Word mercury__term_io__TypeInfo_52_52;
+MR_Word mercury__tree234__TypeInfo_28_28;
+MR_Word mercury__tree234__TypeInfo_for_K_17;
+MR_Word mercury__tree234__TypeInfo_for_K_22;
+MR_Word mercury__tree234__TypeInfo_for_T_24;
+MR_Word mercury__tree234__TypeInfo_for_V_18;
+MR_Word mercury__tree234__TypeInfo_for_V_23;
+MR_Word mercury__tree234__TypeInfo_for_W_19;
-- 
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