[m-dev.] [reuse] diff: bugfix unconditional reuse propagation

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Fri Oct 27 22:22:50 AEDT 2000


Hi,


===================================================================


Estimated hours taken: 0.2

Bugfix of the propagation of unconditional reuses (being a bit too
quick in committing)

sr_indirect.m:
	Bugfix: first check if we're dealing with unconditional reuse, 
	and only then check for top-alias. 

sr_profile.m:
	Also dump pred_id/proc_id in the graphs. 

Index: sr_indirect.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_indirect.m,v
retrieving revision 1.1.2.13
diff -u -r1.1.2.13 sr_indirect.m
--- sr_indirect.m	2000/10/27 08:31:08	1.1.2.13
+++ sr_indirect.m	2000/10/27 11:18:47
@@ -708,6 +708,14 @@
 	% 2. once found, we can immediately handle the case where
 	% the tabled reuse would say that reuse is not possible anyway:
 	(
+		% unconditional reuse
+		FormalMemo = yes([])
+	->
+		indirect_reuse_pool_add_unconditional( Pool0, Pool ), 
+		Info = Info0, 
+		YesNo = yes
+	;
+		% no reuse possible anyway
 		( 
 			memo_reuse_top(FormalMemo) ; 
 			pa_alias_as__is_top(Alias0)
@@ -716,13 +724,6 @@
 		Pool = Pool0,
 		Info = Info0, 
 		YesNo = no
-	;
-		% unconditional reuse
-		FormalMemo = yes([])
-	->
-		indirect_reuse_pool_add_unconditional( Pool0, Pool ), 
-		Info = Info0, 
-		YesNo = yes
 	;
 		memo_reuse_rename( ProcInfo0, ActualVars, FormalMemo, 
 					Memo ), 
Index: sr_profile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_profile.m,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 sr_profile.m
--- sr_profile.m	2000/10/26 16:11:01	1.1.2.3
+++ sr_profile.m	2000/10/27 11:18:48
@@ -208,7 +208,13 @@
 					pred_info_import_status(PredInfo,
 							ImportStatus),
 					status_defined_in_this_module(
-							ImportStatus, yes)
+							ImportStatus, yes),
+					module_info_get_special_pred_map(
+							HLDS, SpecialPredMap),
+					map__values(SpecialPredMap,
+							SpecialPredIds),
+					\+ list__member( PredId, 
+							SpecialPredIds)
 				;
 					\+ set__singleton_set(ComponentSet, _)
 				),
@@ -285,9 +291,7 @@
 				",peripheries=", Periferies, "];\n"], 
 				Options ) }, 
 
-	io__write_char('"'),
-	hlds_out__write_pred_proc_id(HLDS, PredId, ProcId),
-	io__write_char('"'),
+	write_node_name(HLDS, PredId, ProcId), 
 
 	io__write_string(Options), 
 
@@ -302,17 +306,28 @@
 	{ Parent = proc(ParentPredId, ParentProcId) },
 	{ Child = proc(ChildPredId, ChildProcId) },
 
-	io__write_char('"'),
-	hlds_out__write_pred_proc_id(HLDS, ParentPredId, ParentProcId),
-	io__write_string("\" -> "),
-
-	io__write_char('"'),
-	hlds_out__write_pred_proc_id(HLDS, ChildPredId, ChildProcId),
-	io__write_string("\";\n"),
+	write_node_name( HLDS, ParentPredId, ParentProcId), 
+	io__write_string(" -> "),
 
+	write_node_name( HLDS, ChildPredId, ChildProcId), 
+	io__write_string(";\n"),
+
 	io__set_output_stream(OldStream, _).
 	
 
+:- pred write_node_name( module_info::in, pred_id::in, proc_id::in, 
+			io__state::di, io__state::uo) is det.
+write_node_name( HLDS, PredId, ProcId ) --> 
+	{ pred_id_to_int( PredId, PredIdInt ) }, 
+	{ proc_id_to_int( ProcId, ProcIdInt ) }, 
+	io__write_char('"'), 
+	hlds_out__write_pred_proc_id( HLDS, PredId, ProcId), 
+	io__write_string("\\n"), 
+	io__write_int(PredIdInt), 
+	io__write_char('/'), 
+	io__write_int(ProcIdInt), 
+	io__write_char('"'). 
+	
 :- pred write_prof_item( io__output_stream, pred(profiling_info, int), 
 			profiling_info, 
 			string, io__state, io__state).

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