[m-rev.] diff: common.m improvement

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Apr 20 12:41:55 AEST 2005


compiler/common.m:
	Allow the equality test for types succeed even for types that cannot
	be deconstructed, such as the ones for typeclassinfos. This allows
	common.m to a slightly better job of detecting common cells. This
	diff yields an improvement of about 0.5% in speed and 0.2% in
	executable size.

	I had this change lying around for some time, but committing it before
	the loop_inv bug was fixed would have prevented that fix, since it
	masks its symptoms.

Zoltan.

cvs diff: Diffing compiler
Index: compiler/common.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/common.m,v
retrieving revision 1.77
diff -u -b -r1.77 common.m
--- compiler/common.m	24 Mar 2005 02:00:18 -0000	1.77
+++ compiler/common.m	20 Apr 2005 02:41:11 -0000
@@ -755,13 +755,7 @@
 
 :- pred common__types_match_exactly((type)::in, (type)::in) is semidet.
 
-common__types_match_exactly(term__variable(Var), term__variable(Var)).
-common__types_match_exactly(Type1, Type2) :-
-    % XXX should succeed for embedded constraints
-    type_to_ctor_and_args(Type1, TypeCtor1, Args1),
-    type_to_ctor_and_args(Type2, TypeCtor2, Args2),
-    TypeCtor1 = TypeCtor2,
-    common__types_match_exactly_list(Args1, Args2).
+common__types_match_exactly(Type, Type).
 
 :- pred common__types_match_exactly_list(list(type)::in, list(type)::in)
     is semidet.
cvs diff: Diffing compiler/notes
--------------------------------------------------------------------------
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