[m-dev.] diff: fix taifun asm_fast bug

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Sep 5 04:13:06 AEDT 2000


Estimated hours taken: 3

Fix a bug in Zoltan's 2000/03/24 type_info changes that broke lots of
our test cases in global register non-gc grades (e.g. `asm_fast') on
the SPARC.

library/std_util.m:
	The calls to save_transient_registers() and
	restore_transient_registers() need to be in the
	`pragma c_code', not in the function ML_type_ctor_and_args()
	that is called from them, because once a function has been
	called, the transient registers have already been clobbered
	by the function calling mechanism.

Workspace: /home/pgrad/fjh/ws/hg
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.195
diff -u -d -r1.195 std_util.m
--- library/std_util.m	2000/08/02 14:13:09	1.195
+++ library/std_util.m	2000/09/04 17:06:26
@@ -1491,6 +1491,11 @@
 	return type_ctor_desc;
 }
 
+/*
+** You need to wrap save/restore_transient_registers() around
+** calls to this function.
+*/
+
 void
 ML_type_ctor_and_args(MR_TypeInfo type_info, bool collapse_equivalences,
 	MR_TypeCtorDesc *type_ctor_desc_ptr, Word *arg_type_info_list_ptr)
@@ -1499,8 +1504,6 @@
 	MR_TypeCtorDesc type_ctor_desc;
 	Integer		arity;
 
-	save_transient_registers();
-
 	if (collapse_equivalences) {
 		type_info = MR_collapse_equivalences(type_info);
 	}
@@ -1518,8 +1521,6 @@
 		*arg_type_info_list_ptr = ML_type_params_vector_to_list(arity,
 			MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info));
 	}
-
-	restore_transient_registers();
 }
 ").
 
@@ -1529,9 +1530,13 @@
 	MR_TypeCtorDesc type_ctor_desc;
 	MR_TypeInfo	type_info;
 
+	save_transient_registers();
+
 	type_info = (MR_TypeInfo) TypeDesc;
 	ML_type_ctor_and_args(type_info, TRUE, &type_ctor_desc, &ArgTypes);
 	TypeCtorDesc = (Word) type_ctor_desc;
+
+	restore_transient_registers();
 }
 ").
 
@@ -1591,9 +1596,13 @@
 	MR_TypeCtorDesc type_ctor_desc;
 	MR_TypeInfo	type_info;
 
+	save_transient_registers();
+
 	type_info = (MR_TypeInfo) TypeDesc;
 	ML_type_ctor_and_args(type_info, FALSE, &type_ctor_desc, &ArgTypes);
 	TypeCtorDesc = (Word) type_ctor_desc;
+
+	restore_transient_registers();
 }
 ").
 

-- 
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