[m-dev.] for review: deforestation [2/3]
Simon Taylor
stayl at cs.mu.OZ.AU
Fri Apr 24 18:55:50 AEST 1998
[options.m]
> A comment saying that `pd' stands for "partial deduction",
> i.e. deforestation, might be helpful here.
[simplify.m]
> It would probably be clearer and more maintainable to write this as a DCG.
Done.
> > Index: tests/misc_tests/mdemangle_test.exp
> > Index: tests/misc_tests/mdemangle_test.inp
> > Index: util/mdemangle.c
>
> These changes aren't in the log message.
>
> Also you need to modify profiler/demangle.m to match the changes to
> util/mdemangle.c.
>
util/mdemangle.c
profiler/demangle.m
tests/misc_tests/mdemangle_test.{exp,inp}
Handle the `DeforestationIn__' predicate names introduced
by deforestation, similar to the `IntroducedFrom__' for
lambda goals.
Index: demangle.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/profiler/demangle.m,v
retrieving revision 1.5
diff -u -r1.5 demangle.m
--- demangle.m 1998/03/03 17:42:07 1.5
+++ demangle.m 1998/04/22 02:48:23
@@ -34,7 +34,14 @@
; unify
; compare
; ordinary
- ; lambda(int, int, string). % line, sequence number, pred name
+ ; introduced(introduced_pred_type, int, int, string)
+ % type, line, sequence number, pred name
+ .
+
+:- type introduced_pred_type
+ ---> (lambda)
+ ; deforestation
+ .
:- type data_category
---> common
@@ -200,11 +207,11 @@
( { Category0 \= ordinary } ->
remove_prefix("_"),
remove_maybe_module_prefix(MaybeModule,
- ["IntroducedFrom__"]),
+ ["IntroducedFrom__", "DeforestationIn__"]),
{ MaybeModule \= yes("") }
;
remove_maybe_module_prefix(MaybeModule,
- ["IntroducedFrom__"])
+ ["IntroducedFrom__", "DeforestationIn__"])
),
%
@@ -214,7 +221,14 @@
=(PredName0),
- ( remove_prefix("IntroducedFrom__") ->
+ (
+ ( remove_prefix("IntroducedFrom__") ->
+ { IntroducedPredType = (lambda) }
+ ;
+ remove_prefix("DeforestationIn__"),
+ { IntroducedPredType = deforestation }
+ )
+ ->
( remove_prefix("pred__") ->
{ LambdaPredOrFunc = "pred" }
; remove_prefix("func__") ->
@@ -227,7 +241,8 @@
remove_int(Line),
remove_prefix("__"),
remove_int(Seq),
- { Category = lambda(Line, Seq, LambdaPredOrFunc) }
+ { Category = introduced(IntroducedPredType, Line,
+ Seq, LambdaPredOrFunc) }
;
{ Category = Category0 },
{ PredName = PredName0 }
@@ -271,10 +286,18 @@
[s(PredOrFunc), s(QualifiedName), i(Arity), i(ModeNum)],
MainPart)
;
- Category = lambda(Line, Seq, LambdaPredOrFunc),
- string__format("%s goal (#%d) from %s line %d",
- [s(LambdaPredOrFunc), i(Seq), s(QualifiedName),
- i(Line)], MainPart)
+ Category = introduced(Type, Line, Seq, IntroPredOrFunc),
+ (
+ Type = (lambda),
+ string__format("%s goal (#%d) from %s line %d",
+ [s(IntroPredOrFunc), i(Seq), s(QualifiedName),
+ i(Line)], MainPart)
+ ;
+ Type = deforestation,
+ string__format(
+ "deforestation procedure (#%d) from %s line %d",
+ [i(Seq), s(QualifiedName), i(Line)], MainPart)
+ )
},
[MainPart],
( { HigherOrder = yes } ->
More information about the developers
mailing list