[m-rev.] diff: workaround a problem with the demangler

Julien Fischer juliensf at cs.mu.OZ.AU
Tue May 31 18:00:22 AEST 2005


Estimated hours taken: 8
Branches: main, release

Workaround a problem in the demangler so that mprof works when the
library is compiled at -O5 and greater.  The problem is that the names
of the predicates generated by unused argument analysis were changed
(when Simon integrated unused argument analysis into the intermodule
analysis framework), but the code in the demangler was never updated
accordingly.  (The log message says that there was a change to the
demangler being planned at the same time, which is why it was never
updated - evidently it never happened.)

The above situation sometimes results in two different mangled names
demangling to the same name.  The workaround, for the moment, is to
disable all demangling, bar the fixing of mangled ASCII codes, for
predicates created by unused argument analysis.

profiler/demangle.m:
util/demangle.c:
	Add a workaround to the demanglers so that the profiler
	does not abort when processing procedures produced by
	unused argument analysis.

Julien.

Index: profiler/demangle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/demangle.m,v
retrieving revision 1.20
diff -u -r1.20 demangle.m
--- profiler/demangle.m	24 Mar 2005 01:10:33 -0000	1.20
+++ profiler/demangle.m	31 May 2005 07:18:03 -0000
@@ -171,12 +171,12 @@
 		remove_prefix("_"),
 		remove_maybe_module_prefix(MaybeModule,
 			["IntroducedFrom__", "DeforestationIn__",
-			"AccFrom__", "TypeSpecOf__"]),
+			"AccFrom__", "TypeSpecOf__", "UnusedArgs__"]),
 		{ MaybeModule \= yes("") }
 	;
 		remove_maybe_module_prefix(MaybeModule,
 			["IntroducedFrom__", "DeforestationIn__",
-			"AccFrom__", "TypeSpecOf__"])
+			"AccFrom__", "TypeSpecOf__", "UnusedArgs__"])
 	),

 	% Remove any prefixes added for introduced predicates,
@@ -284,7 +284,7 @@
 	%
 	remove_maybe_module_prefix(MaybeModule0,
 		["IntroducedFrom__", "DeforestationIn__",
-		"AccFrom__", "TypeSpecOf__", "__"]),
+		"AccFrom__", "TypeSpecOf__", "UnusedArgs__", "__"]),

 	%
 	% Check whether the start of the string matches the name of
Index: util/mdemangle.c
===================================================================
RCS file: /home/mercury1/repository/mercury/util/mdemangle.c,v
retrieving revision 1.51
diff -u -r1.51 mdemangle.c
--- util/mdemangle.c	5 Sep 2004 23:52:54 -0000	1.51
+++ util/mdemangle.c	31 May 2005 07:28:48 -0000
@@ -162,6 +162,7 @@
 	static const char deforestation[]  = "DeforestationIn__";
 	static const char accumulator[]  = "AccFrom__";
 	static const char type_spec[]  = "TypeSpecOf__";
+	static const char unused_arg[] = "UnusedArgs__";
 	static const char pred[]  = "pred__";
 	static const char func[]  = "func__";
 	static const char porf[]  = "pred_or_func__";
@@ -195,6 +196,7 @@
 		deforestation,
 		accumulator,
 		type_spec,
+		unused_arg,
 		unify1, compare1, index1, initialise1,
 		NULL
 	};
@@ -204,7 +206,6 @@
 		ho_suffix,
 		NULL
 	};
-

 	static const char * trailing_context_2[] = {
 		type_ctor_layout,

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list