[m-dev.] diff: MLDS back-end: fix bug with main/2 module qual

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 9 02:40:33 AEST 2000


Estimated hours taken: 0.5

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

compiler/mlds_to_c.m:
	Make sure that we don't module-qualify references
	to functions defined as part of main/2, since we
	don't module-qualify the corresponding function
	definitions.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.28
diff -u -d -r1.28 mlds_to_c.m
--- compiler/mlds_to_c.m	2000/05/01 17:42:21	1.28
+++ compiler/mlds_to_c.m	2000/05/08 16:36:06
@@ -676,6 +676,25 @@
 		mlds_output_fully_qualified(QualifiedName, mlds_output_name)
 	).
 
+:- pred mlds_output_fully_qualified_proc_label(mlds__qualified_proc_label,
+		io__state, io__state).
+:- mode mlds_output_fully_qualified_proc_label(in, di, uo) is det.
+
+mlds_output_fully_qualified_proc_label(QualifiedName) -->
+	(
+		%
+		% don't module-qualify main/2
+		%
+		{ QualifiedName = qual(_ModuleName, Name) },
+		{ Name = PredLabel - _ProcId },
+		{ PredLabel = pred(predicate, no, "main", 2) }
+	->
+		mlds_output_proc_label(Name)
+	;
+		mlds_output_fully_qualified(QualifiedName,
+			mlds_output_proc_label)
+	).
+
 :- pred mlds_output_fully_qualified(mlds__fully_qualified_name(T),
 		pred(T, io__state, io__state), io__state, io__state).
 :- mode mlds_output_fully_qualified(in, pred(in, di, uo) is det,
@@ -1845,9 +1864,9 @@
 :- mode mlds_output_code_addr(in, di, uo) is det.
 
 mlds_output_code_addr(proc(Label, _Sig)) -->
-	mlds_output_fully_qualified(Label, mlds_output_proc_label).
+	mlds_output_fully_qualified_proc_label(Label).
 mlds_output_code_addr(internal(Label, SeqNum, _Sig)) -->
-	mlds_output_fully_qualified(Label, mlds_output_proc_label),
+	mlds_output_fully_qualified_proc_label(Label),
 	io__write_string("_"),
 	io__write_int(SeqNum).
 

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