[m-rev.] Re: MR_COMPARE_BY_RTTI

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon May 13 19:59:46 AEST 2002


On 13-May-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> MR_COMPARE_BY_RTTI is not documented in runtime/mercury_conf_param.h.
> Likewise for MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_{1,2}.
> Could you please document them?

runtime/mercury_conf_param.h:
	Document MR_COMPARE_BY_RTTI.

runtime/mercury_ho_call.c:
runtime/mercury_unify_compare_body.h:
	Delete the undocumented configuration macros
	MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_[12].

Zoltan.

cvs diff: Diffing .
Index: mercury_conf_param.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.57
diff -u -b -r1.57 mercury_conf_param.h
--- mercury_conf_param.h	25 Apr 2002 09:31:57 -0000	1.57
+++ mercury_conf_param.h	13 May 2002 09:46:21 -0000
@@ -285,6 +285,16 @@
 ** If you want to gather statistics about the number and size of stack frames,
 ** then set this macro to a string giving the name of the file to which which
 ** the statistics should be appended when the program exits.
+** 
+** MR_COMPARE_BY_RTTI
+** Enable this if you want to perform unifications and comparisons on types
+** with standard equality by interpreting the RTTI data structures instead of
+** invoking the type-specific unify and compare procedures. The last time we
+** measured it, this lead to about a 6% slowdown. Since the code interpreting
+** the data structures calls C functions, defining this macro also leads to
+** problems if user-defined unify procedures abort: the exception could be
+** transmitted to the parent Mercury code only by catching and retransmitting
+** it, which, for efficiency reasons, the code doesn't do.
 */
 
 #if defined(MR_THREAD_SAFE) && defined(MR_TRACE_HISTOGRAM)
Index: mercury_ho_call.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.55
diff -u -b -r1.55 mercury_ho_call.c
--- mercury_ho_call.c	5 May 2002 22:44:26 -0000	1.55
+++ mercury_ho_call.c	13 May 2002 09:46:35 -0000
@@ -8,9 +8,6 @@
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
 
-#define	MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
-#define	MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
-
 /*
 ** This module provides much of the functionality for doing higher order
 ** calls (with the rest provided by code generation of the generic_call
Index: mercury_unify_compare_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_unify_compare_body.h,v
retrieving revision 1.24
diff -u -b -r1.24 mercury_unify_compare_body.h
--- mercury_unify_compare_body.h	25 Apr 2002 09:31:58 -0000	1.24
+++ mercury_unify_compare_body.h	13 May 2002 09:48:40 -0000
@@ -357,18 +357,15 @@
             ** input, and are passed in MR_rN+1 and MR_rN+2.
             ** The Result argument is output in MR_r1.
             **
-            ** We specialize the case where the type_ctor arity
-            ** is zero, since in this case we don't need the loop.
-            ** We could also specialize other arities; 1 and 2
-            ** may be worthwhile.
+            ** We specialize the case where the type_ctor arity is 0, 1 or 2,
+            ** in order to avoid the loop. If type_ctors with higher arities
+            ** were commonly used, we could specialize them too.
             */
 
             if (type_ctor_info->MR_type_ctor_arity == 0) {
                 MR_r1 = x;
                 MR_r2 = y;
-            }
-#ifdef  MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
-            else if (type_ctor_info->MR_type_ctor_arity == 1) {
+            } else if (type_ctor_info->MR_type_ctor_arity == 1) {
                 MR_Word    *args_base;
 
                 args_base = (MR_Word *)
@@ -376,10 +373,7 @@
                 MR_r1 = args_base[1];
                 MR_r2 = x;
                 MR_r3 = y;
-            }
-#endif
-#ifdef  MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
-            else if (type_ctor_info->MR_type_ctor_arity == 2) {
+            } else if (type_ctor_info->MR_type_ctor_arity == 2) {
                 MR_Word    *args_base;
 
                 args_base = (MR_Word *)
@@ -388,9 +382,7 @@
                 MR_r2 = args_base[2];
                 MR_r3 = x;
                 MR_r4 = y;
-            }
-#endif
-            else {
+            } else {
                 int     i;
                 int     type_arity;
                 MR_Word *args_base;
cvs diff: Diffing GETOPT
cvs diff: Diffing machdeps
--------------------------------------------------------------------------
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