[m-dev.] diff: MLDS back-end: fix bug with complicated unification procs

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 9 18:10:44 AEST 2000


Estimated hours taken: 1

Fix a bug in the MLDS back-end that broke samples/muz.

compiler/ml_code_util.m:
	Fix a bug: it was getting the defining module
	wrong when generating references to complicated
	modes of unification procedures for types defined
	in different modules (and likewise for opt_imported
	procedures).

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.6
diff -u -d -r1.6 ml_code_util.m
--- compiler/ml_code_util.m	2000/04/18 16:41:50	1.6
+++ compiler/ml_code_util.m	2000/05/09 08:03:21
@@ -809,15 +809,19 @@
 				PredName = "__Unify__",
 				\+ hlds_pred__in_in_unification_proc_id(ProcId)
 			->
-				DeclaringModule = yes(TypeModule)
+				% This is a locally-defined instance
+				% of a unification procedure for a type
+				% defined in some other module
+				DefiningModule = ThisModule,
+				MaybeDeclaringModule = yes(TypeModule)
 			;
 				% the module declaring the type is the same as
 				% the module defining this special pred
-				DeclaringModule = no
+				DefiningModule = TypeModule,
+				MaybeDeclaringModule = no
 			),
 			MLDS_PredLabel = special_pred(PredName,
-				DeclaringModule, TypeName, TypeArity),
-			MLDS_Module = mercury_module_name_to_mlds(TypeModule)
+				MaybeDeclaringModule, TypeName, TypeArity)
 		;
 			string__append_list(["ml_gen_pred_label:\n",
 				"cannot make label for special pred `",
@@ -833,16 +837,18 @@
 		->
 			% This predicate is a specialized version of 
 			% a pred from a `.opt' file.
+			DefiningModule = ThisModule,
 			MaybeDeclaringModule = yes(PredModule)
 		;	
 			% The predicate was declared in the same module
 			% that it is defined in
+			DefiningModule = PredModule,
 			MaybeDeclaringModule = no
 		),
 		MLDS_PredLabel = pred(PredOrFunc, MaybeDeclaringModule,
-				PredName, PredArity),
-		MLDS_Module = mercury_module_name_to_mlds(PredModule)
-	).
+				PredName, PredArity)
+	),
+	MLDS_Module = mercury_module_name_to_mlds(DefiningModule).
 
 %-----------------------------------------------------------------------------%
 %

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