[m-dev.] for review: demangle instance declarations

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 2 13:57:59 AEDT 1999


On 02-Feb-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> DJ, could you please review this one?
> 
> --------------------
> 
> Estimated hours taken: 4
> 
> Implement demangling for instance declarations (i.e. base_typeclass_infos).
> 
> compiler/base_typeclass_info.m:
> compiler/llds_out.m:
> 	Change the way name mangling for base_typeclass_infos is done
> 	to ensure that they can be unambiguously demangled.
> 
> util/mdemangle.c:
> profiler/demangle.m:
> 	Add code to demangle base_typeclass_infos.
> 
> util/mdemangle.c:
> 	Fix a bug: if it got part way through demangling a symbol
> 	before noticing that it had the wrong format, then it would
> 	sometimes print out a partially demangled version of the
> 	symbol rather than printing out the original symbol unchanged.

Here's a small addendum to that change.

tests/debugger/*.exp*:
        Update the expected output to reflect the new mangling scheme.
	(Really the debugger ought to demangle the names, but
	currently it doesn't.)

Index: tests/debugger/existential_type_classes.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/existential_type_classes.exp,v
retrieving revision 1.4
diff -u -r1.4 existential_type_classes.exp
--- existential_type_classes.exp	1998/11/15 16:47:43	1.4
+++ existential_type_classes.exp	1999/02/02 02:01:29
@@ -14,13 +14,13 @@
 mdb> P
        HeadVar__1           		42
 mdb> 
-       4:      4  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+       4:      4  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		42
 mdb> continue -a
        5:      5  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
        6:      5  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-       7:      4  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+       7:      4  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
        8:      3  3 EXIT pred existential_type_classes:foo/2-0 (det) 
        9:      2  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -35,13 +35,13 @@
 mdb> P
        HeadVar__1           		"blah"
 mdb> 
-      12:      8  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string_0_____existential_type_classes__foo_2/2-0 (det) 
+      12:      8  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		"blah"
 mdb> continue -a
       13:      9  5 CALL pred existential_type_classes:string_foo/2-0 (det) 
       14:      9  5 EXIT pred existential_type_classes:string_foo/2-0 (det) 
-      15:      8  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string_0_____existential_type_classes__foo_2/2-0 (det) 
+      15:      8  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string__arity0______existential_type_classes__foo_2/2-0 (det) 
       16:      7  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       17:      6  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -58,13 +58,13 @@
 mdb> P
        HeadVar__1           		43
 mdb> 
-      22:     13  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      22:     13  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		43
 mdb> continue -a
       23:     14  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
       24:     14  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-      25:     13  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      25:     13  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
       26:     12  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       27:     11  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -83,13 +83,13 @@
 mdb> P
        HeadVar__1           		43
 mdb> 
-      34:     19  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      34:     19  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		43
 mdb> continue -a
       35:     20  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
       36:     20  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-      37:     19  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      37:     19  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
       38:     18  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       39:     17  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -108,13 +108,13 @@
 mdb> P
        HeadVar__1           		45
 mdb> 
-      46:     25  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      46:     25  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		45
 mdb> continue -a
       47:     26  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
       48:     26  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-      49:     25  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      49:     25  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
       50:     24  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       51:     23  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
Index: tests/debugger/existential_type_classes.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/existential_type_classes.exp2,v
retrieving revision 1.2
diff -u -r1.2 existential_type_classes.exp2
--- existential_type_classes.exp2	1998/11/15 16:47:46	1.2
+++ existential_type_classes.exp2	1999/02/02 02:49:18
@@ -14,13 +14,13 @@
 mdb> P
        HeadVar__1           		42
 mdb> 
-       4:      4  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+       4:      4  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		42
 mdb> continue -a
        5:      5  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
        6:      5  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-       7:      4  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+       7:      4  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
        8:      3  3 EXIT pred existential_type_classes:foo/2-0 (det) 
        9:      2  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -35,7 +35,7 @@
 mdb> P
        HeadVar__1           		"blah"
 mdb> 
-      12:      8  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string_0_____existential_type_classes__foo_2/2-0 (det) 
+      12:      8  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		"blah"
 mdb> continue -a
@@ -43,7 +43,7 @@
       14:     10  6 CALL pred string:length/2-0 (det) 
       15:     10  6 EXIT pred string:length/2-0 (det) 
       16:      9  5 EXIT pred existential_type_classes:string_foo/2-0 (det) 
-      17:      8  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string_0_____existential_type_classes__foo_2/2-0 (det) 
+      17:      8  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__string__arity0______existential_type_classes__foo_2/2-0 (det) 
       18:      7  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       19:      6  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -60,13 +60,13 @@
 mdb> P
        HeadVar__1           		43
 mdb> 
-      24:     14  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      24:     14  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		43
 mdb> continue -a
       25:     15  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
       26:     15  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-      27:     14  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      27:     14  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
       28:     13  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       29:     12  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -85,13 +85,13 @@
 mdb> P
        HeadVar__1           		43
 mdb> 
-      36:     20  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      36:     20  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		43
 mdb> continue -a
       37:     21  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
       38:     21  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-      39:     20  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      39:     20  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
       40:     19  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       41:     18  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
@@ -110,13 +110,13 @@
 mdb> P
        HeadVar__1           		45
 mdb> 
-      48:     26  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      48:     26  4 CALL pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
 mdb> P
        HeadVar__1           		45
 mdb> continue -a
       49:     27  5 CALL pred existential_type_classes:int_foo/2-0 (det) 
       50:     27  5 EXIT pred existential_type_classes:int_foo/2-0 (det) 
-      51:     26  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int_0_____existential_type_classes__foo_2/2-0 (det) 
+      51:     26  4 EXIT pred existential_type_classes:Introduced_pred_for_existential_type_classes__fooable__int__arity0______existential_type_classes__foo_2/2-0 (det) 
       52:     25  3 EXIT pred existential_type_classes:foo/2-0 (det) 
       53:     24  2 EXIT pred existential_type_classes:do_foo/2-0 (det) 
 mdb> P
Index: tests/debugger/implied_instance.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/implied_instance.exp,v
retrieving revision 1.2
diff -u -r1.2 implied_instance.exp
--- implied_instance.exp	1998/11/04 04:20:16	1.2
+++ implied_instance.exp	1999/02/02 02:01:29
@@ -8,7 +8,7 @@
 mdb> P
        HeadVar__1           		2
 mdb> 
-       3:      3  3 CALL pred implied_instance:Introduced_pred_for_implied_instance__sumable__int_0_____implied_instance__p_2/2-0 (det) 
+       3:      3  3 CALL pred implied_instance:Introduced_pred_for_implied_instance__sumable__int__arity0______implied_instance__p_2/2-0 (det) 
 mdb> P
        HeadVar__1           		2
 mdb> break -e p
@@ -16,13 +16,13 @@
 mdb> continue -a
        4:      4  4 CALL pred implied_instance:copy_int/2-0 (det) 
        5:      4  4 EXIT pred implied_instance:copy_int/2-0 (det) 
-       6:      3  3 EXIT pred implied_instance:Introduced_pred_for_implied_instance__sumable__int_0_____implied_instance__p_2/2-0 (det) 
+       6:      3  3 EXIT pred implied_instance:Introduced_pred_for_implied_instance__sumable__int__arity0______implied_instance__p_2/2-0 (det) 
        7:      2  2 EXIT pred implied_instance:p/2-0 (det) 
        8:      5  2 CALL pred implied_instance:p/2-0 (det) 
 mdb> P
        HeadVar__1           		[42, 24, 1, 2, 3]
 mdb> 
-       9:      6  3 CALL pred implied_instance:Introduced_pred_for_implied_instance__sumable__list_0_list_1_____implied_instance__p_2/2-0 (det) 
+       9:      6  3 CALL pred implied_instance:Introduced_pred_for_implied_instance__sumable__list__list__arity1______implied_instance__p_2/2-0 (det) 
 mdb> P
        HeadVar__1           		[42, 24, 1, 2, 3]
 mdb> 
@@ -35,7 +35,7 @@
 mdb> P
        HeadVar__1           		42
 mdb> 
-      13:      9  6 CALL pred implied_instance:Introduced_pred_for_implied_instance__sumable__int_0_____implied_instance__p_2/2-0 (det) 
+      13:      9  6 CALL pred implied_instance:Introduced_pred_for_implied_instance__sumable__int__arity0______implied_instance__p_2/2-0 (det) 
 mdb> P
        HeadVar__1           		42
 mdb> continue -S
Index: tests/debugger/multi_parameter.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/multi_parameter.exp,v
retrieving revision 1.3
diff -u -r1.3 multi_parameter.exp
--- multi_parameter.exp	1998/11/15 16:47:45	1.3
+++ multi_parameter.exp	1999/02/02 02:01:29
@@ -9,11 +9,11 @@
 mdb> print *
        HeadVar__1           		'z'
 mdb> 
-       4:      4  4 CALL pred multi_parameter:Introduced_pred_for_multi_parameter__m__character_0_int_0_____multi_parameter__a_2/2-0 (det) 
+       4:      4  4 CALL pred multi_parameter:Introduced_pred_for_multi_parameter__m__character__arity0__int__arity0______multi_parameter__a_2/2-0 (det) 
 mdb> print *
        HeadVar__1           		'z'
 mdb> 
-       5:      4  4 EXIT pred multi_parameter:Introduced_pred_for_multi_parameter__m__character_0_int_0_____multi_parameter__a_2/2-0 (det) 
+       5:      4  4 EXIT pred multi_parameter:Introduced_pred_for_multi_parameter__m__character__arity0__int__arity0______multi_parameter__a_2/2-0 (det) 
 mdb> print *
        HeadVar__1           		'z'
        HeadVar__2           		122
Index: tests/debugger/multi_parameter.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/multi_parameter.exp2,v
retrieving revision 1.2
diff -u -r1.2 multi_parameter.exp2
--- multi_parameter.exp2	1998/11/15 16:47:47	1.2
+++ multi_parameter.exp2	1999/02/02 02:46:19
@@ -9,7 +9,7 @@
 mdb> print *
        HeadVar__1           		'z'
 mdb> 
-       4:      4  4 CALL pred multi_parameter:Introduced_pred_for_multi_parameter__m__character_0_int_0_____multi_parameter__a_2/2-0 (det) 
+       4:      4  4 CALL pred multi_parameter:Introduced_pred_for_multi_parameter__m__character__arity0__int__arity0______multi_parameter__a_2/2-0 (det) 
 mdb> print *
        HeadVar__1           		'z'
 mdb> 
@@ -22,7 +22,7 @@
        Character            		'z'
        Int                  		122
 mdb> 
-       7:      4  4 EXIT pred multi_parameter:Introduced_pred_for_multi_parameter__m__character_0_int_0_____multi_parameter__a_2/2-0 (det) 
+       7:      4  4 EXIT pred multi_parameter:Introduced_pred_for_multi_parameter__m__character__arity0__int__arity0______multi_parameter__a_2/2-0 (det) 
 mdb> print *
        HeadVar__1           		'z'
        HeadVar__2           		122

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh at 128.250.37.3        |     -- leaked Microsoft memo.



More information about the developers mailing list