[m-dev.] diff: fix bugs in grades fast.*/jump.*

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 27 01:56:20 AEST 2000


Estimated hours taken: 1.5

Fix some bugs in Zoltan's recent MR_TypeInfo changes that
caused problems for grades `fast.*' and `jump.*'.

compiler/rtti_out.m:
	- Fix a bug: ensure that we use the MR_MAYBE_STATIC_CODE() macro
	  when outputting code_addrs.

runtime/mercury_type_info.h:
	- Fix bugs in the macros MR_INIT_BUILTIN_TYPE_CTOR_INFO(),
	  MR_INIT_TYPE_CTOR_INFO(), and MR_INIT_TYPE_CTOR_INFO_WITH_PRED():
	  they had an `->' where they should have had a `.',
	  they were missing the ENTRY() wrapper around the label names,
	  and one of the macro arguments was not parenthesized.
	- Fix a bug in the MR_MAYBE_STATIC_CODE macro:
	  if MR_STATIC_CODE_ADDRESSES is false, then MR_MAYBE_STATIC_CODE
	  should expand to a null pointer, e.g. `NULL', not to `((Integer) 0)'.

Workspace: /home/mercury0/fjh/mercury
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.4
diff -u -d -r1.4 rtti_out.m
--- compiler/rtti_out.m	2000/03/24 10:27:34	1.4
+++ compiler/rtti_out.m	2000/03/26 15:52:10
@@ -217,18 +217,18 @@
 	{ RttiTypeId = rtti_type_id(Module, Type, TypeArity) },
 	io__write_int(TypeArity),
 	io__write_string(",\n\t"),
-	output_maybe_code_addr(Unify),
+	output_maybe_static_code_addr(Unify),
 	io__write_string(",\n\t"),
-	output_maybe_code_addr(Index),
+	output_maybe_static_code_addr(Index),
 	io__write_string(",\n\t"),
-	output_maybe_code_addr(Compare),
+	output_maybe_static_code_addr(Compare),
 	io__write_string(",\n\t"),
 	{ rtti__type_ctor_rep_to_string(CtorRep, CtorRepStr) },
 	io__write_string(CtorRepStr),
 	io__write_string(",\n\t"),
-	output_maybe_code_addr(Solver),
+	output_maybe_static_code_addr(Solver),
 	io__write_string(",\n\t"),
-	output_maybe_code_addr(Init),
+	output_maybe_static_code_addr(Init),
 	io__write_string(",\n\t"""),
 	{ prog_out__sym_name_to_string(Module, ModuleName) },
 	c_util__output_quoted_string(ModuleName),
@@ -298,7 +298,7 @@
 %		io__write_string("NULL")
 %	),
 %	io__write_string(",\n\t"),
-%	output_maybe_code_addr(Prettyprinter),
+%	output_maybe_static_code_addr(Prettyprinter),
 	io__write_string("\n};\n").
 
 :- pred output_functors_info_decl(rtti_type_id::in,
@@ -602,12 +602,14 @@
 	io__write_list(Locns, ",\n\t", output_exist_locn),
 	io__write_string("\n").
 
-:- pred output_maybe_code_addr(maybe(code_addr)::in,
+:- pred output_maybe_static_code_addr(maybe(code_addr)::in,
 	io__state::di, io__state::uo) is det.
 
-output_maybe_code_addr(yes(CodeAddr)) -->
-	output_code_addr(CodeAddr).
-output_maybe_code_addr(no) -->
+output_maybe_static_code_addr(yes(CodeAddr)) -->
+	io__write_string("MR_MAYBE_STATIC_CODE("),
+	output_code_addr(CodeAddr),
+	io__write_string(")").
+output_maybe_static_code_addr(no) -->
 	io__write_string("NULL").
 
 :- pred rtti_name_would_include_code_addr(rtti_name::in, bool::out) is det.
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.41
diff -u -d -r1.41 mercury_type_info.h
--- runtime/mercury_type_info.h	2000/03/24 10:27:52	1.41
+++ runtime/mercury_type_info.h	2000/03/26 15:52:34
@@ -807,29 +807,29 @@
 
 #ifndef MR_STATIC_CODE_ADDRESSES
 
-  #define MR_MAYBE_STATIC_CODE(X)   ((Integer) 0)
+  #define MR_MAYBE_STATIC_CODE(X)   NULL
 
   #define MR_STATIC_CODE_CONST
 
-  #define   MR_INIT_BUILTIN_TYPE_CTOR_INFO(B, T)            \
-  do {                                                      \
-    B->unify_pred = mercury__builtin_unify##T##2_0;         \
-    B->index_pred = mercury__builtin_index##T##2_0;         \
-    B->compare_pred = mercury__builtin_compare##T##3_0;     \
+  #define   MR_INIT_BUILTIN_TYPE_CTOR_INFO(B, T)            		\
+  do {                                                      		\
+    (B).unify_pred = ENTRY(mercury__builtin_unify##T##2_0);		\
+    (B).index_pred = ENTRY(mercury__builtin_index##T##2_0);		\
+    (B).compare_pred = ENTRY(mercury__builtin_compare##T##3_0);		\
   } while (0)
 
   #define   MR_INIT_TYPE_CTOR_INFO_WITH_PRED(B, P)          \
   do {                                                      \
-    B->unify_pred = P;                                      \
-    B->index_pred = P;                                      \
-    B->compare_pred = P;                                    \
+    (B).unify_pred = ENTRY(P);                              \
+    (B).index_pred = ENTRY(P);                              \
+    (B).compare_pred = ENTRY(P);                            \
   } while (0)
 
   #define   MR_INIT_TYPE_CTOR_INFO(B, T)                    \
   do {                                                      \
-    B->unify_pred = mercury____##Unify##___##T;             \
-    B->index_pred = mercury____##Index##___##T;             \
-    B->compare_pred = mercury____##Compare##___##T;         \
+    (B).unify_pred = ENTRY(mercury____##Unify##___##T);     \
+    (B).index_pred = ENTRY(mercury____##Index##___##T);     \
+    (B).compare_pred = ENTRY(mercury____##Compare##___##T); \
   } while (0)
 
 #else   /* MR_STATIC_CODE_ADDRESSES */
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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