[m-rev.] for review: dead_pred_elim optimization

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 23 21:07:06 AEST 2003


On 23-Apr-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> On Wed, Apr 16, 2003 at 11:00:58AM +1000, Fergus Henderson wrote:
> > E.g. consider a name "a.b.c.d.e.f", where "a", "b", and "d"
> > have been imported using "import_module", and "c" and "e" have
> > been imported using "use_module".  Valid ways to refer to this
> > name are "c.d.e.f", "b.c.d.e.f", and "a.b.c.d.e.f",
> > but not "d.e.f", "e.f", or "f".
> > Will your code handle this case correctly?

> Yes.
> 
> Does my explaination help?

Yes.

I've added a test case in tests/hard_coded/sub-modules/deeply_nested.m.
(See diff below.)  If your code passes that, both with and without intermodule
optimization, I'll be happy.

> PS. I have been trying to bootcheck this on the CS machines and I keep
> getting problems with
> 
> Error reading options file `/usr/local/mercury-DEV/lib/mercury/conf/Mercury.config'.
> 
> Has anyone else been having the same problem?  Have I done something
> stupid?

This may be something newly introduced by Simon's recent changes?

----------

Branches: main
Estimated hours taken: 0.5

tests/hard_coded/sub-modules/Mmakefile:
tests/hard_coded/sub-modules/deeply_nested.m:
tests/hard_coded/sub-modules/deeply_nested.exp:
	Add a test case for deeply nested uses of "use_module"
	and "include_module".

Workspace: /home/ceres/fjh/mercury
Index: tests/hard_coded/sub-modules/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/sub-modules/Mmakefile,v
retrieving revision 1.8
diff -u -d -r1.8 Mmakefile
--- tests/hard_coded/sub-modules/Mmakefile	12 Jan 2003 22:33:25 -0000	1.8
+++ tests/hard_coded/sub-modules/Mmakefile	23 Apr 2003 10:51:06 -0000
@@ -17,6 +17,7 @@
 SUB_MODULE_PROGS= \
 	accessibility \
 	accessibility2 \
+	deeply_nested \
 	use_submodule \
 	parent \
 	parent2 \
Index: tests/hard_coded/sub-modules/deeply_nested.exp
===================================================================
RCS file: tests/hard_coded/sub-modules/deeply_nested.exp
diff -N tests/hard_coded/sub-modules/deeply_nested.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/deeply_nested.exp	16 Apr 2003 01:28:50 -0000
@@ -0,0 +1,5 @@
+f
+f
+f
+f
+f
Index: tests/hard_coded/sub-modules/deeply_nested.m
===================================================================
RCS file: tests/hard_coded/sub-modules/deeply_nested.m
diff -N tests/hard_coded/sub-modules/deeply_nested.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/deeply_nested.m	23 Apr 2003 10:54:32 -0000
@@ -0,0 +1,50 @@
+:- module deeply_nested.
+:- interface.
+  :- import_module io.
+
+  :- module a.
+  :- interface.
+    :- module b.
+    :- interface.
+      :- module c.
+      :- interface.
+        :- module d.
+        :- interface.
+          :- module e.
+          :- interface.
+            :- type f ---> f.
+          :- end_module e.
+        :- end_module d.
+      :- end_module c.
+    :- end_module b.
+  :- end_module a.
+
+  :- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+  :- import_module deeply_nested.a.
+  :- import_module deeply_nested.a.b.
+  :- use_module    deeply_nested.a.b.c.
+  :- import_module deeply_nested.a.b.c.d.
+  :- use_module    deeply_nested.a.b.c.d.e.
+
+  :- type t0 == deeply_nested.a.b.c.d.e.f.
+  :- type t1 == a.b.c.d.e.f.
+  :- type t2 == b.c.d.e.f.
+  :- type t3 == c.d.e.f.
+%  :- type t4 == d.e.f.		% error, "d" must be referred to as "c.d"
+  :- type t5 == e.f.
+%  :- type t6 == f.		% error, "f" must be referred to as "e.f"
+
+  main -->
+  	print(deeply_nested.a.b.c.d.e.f), nl,
+  	print(a.b.c.d.e.f), nl,
+  	print(b.c.d.e.f), nl,
+  	print(c.d.e.f), nl,
+%  	print(d.e.f), nl,	% error, "d" must be referred to as "c.d"
+  	print(e.f), nl,
+%  	print(f), nl,		% error, "f" must be referred to as "e.f"
+	[].
+
+:- end_module deeply_nested.
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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