[m-dev.] for review: use type_ctor_rep for unify, index and compare
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Sep 30 10:51:26 AEST 1999
By anyone who knows the RTTI system.
Change the way unify, index and compare work. Instead of always calling the
type-specific unification, index and comparison procedures, do a dispatch
on the type_ctor_rep instead, and call the type-specific routine only
if necessary. Also, specialize the common cases of type_ctors of arity
0, 1 and 2. This gives us a speedup of about 3 or 4 percent.
Later we should be able to use the RTTI info to avoid calling the type-specific
routines at all, except for types with user-defined equality.
runtime/mercury_ho_call.c:
Make the change described above, while keeping the old code around
but #ifdef'd out.
The index routine now (properly) prints an error for enumerated types;
previously, the compiler-generated predicate would usually (depending
on compilation options) ignore the error.
runtime/mercury_type_info.h:
Fix a bug: the type_ctor arity field must be of type Integer,
because that is the type that the compiler generates for this field.
Add parentheses around a macro's arguments.
Fix some spelling errors and XXX some obsolete macros.
Put an MR_ prefix on macros used in mercury_ho_call.c, so that the
new code there does not have to use non-name-space-clean macros.
runtime/mercury_bootstrap.h:
Provide backwards compatilibity for those prefixed macros.
The speed test results are as follows:
EXTRA_MCFLAGS = -O2
EXTRA_CFLAGS =
batch/hocall.mercury_compile.1 40.460u 0.600s 0:42.18 97.3%
batch/hocall.mercury_compile.1 40.330u 0.430s 0:40.91 99.6%
batch/hocall.mercury_compile.1 40.440u 0.310s 0:40.87 99.7%
batch/hocall.mercury_compile.1 40.380u 0.390s 0:41.01 99.4%
EXTRA_MCFLAGS = -O2
EXTRA_CFLAGS = -DMR_UNIFY_COMPARE_BY_CTOR_REP
batch/hocall.mercury_compile.2 40.470u 0.350s 0:41.75 97.7%
batch/hocall.mercury_compile.2 40.330u 0.370s 0:40.84 99.6%
batch/hocall.mercury_compile.2 40.400u 0.300s 0:40.84 99.6%
batch/hocall.mercury_compile.2 40.430u 0.310s 0:40.79 99.8%
EXTRA_MCFLAGS = -O2
EXTRA_CFLAGS = -DMR_UNIFY_COMPARE_BY_CTOR_REP -DMR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
batch/hocall.mercury_compile.3 39.320u 0.350s 0:40.62 97.6%
batch/hocall.mercury_compile.3 39.250u 0.270s 0:39.61 99.7%
batch/hocall.mercury_compile.3 39.130u 0.370s 0:39.68 99.5%
batch/hocall.mercury_compile.3 39.230u 0.280s 0:39.63 99.6%
EXTRA_MCFLAGS = -O2
EXTRA_CFLAGS = -DMR_UNIFY_COMPARE_BY_CTOR_REP -DMR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
batch/hocall.mercury_compile.4 40.410u 0.450s 0:42.83 95.4%
batch/hocall.mercury_compile.4 40.440u 0.300s 0:40.92 99.5%
batch/hocall.mercury_compile.4 40.410u 0.320s 0:40.93 99.5%
batch/hocall.mercury_compile.4 40.500u 0.350s 0:42.50 96.1%
EXTRA_MCFLAGS = -O2
EXTRA_CFLAGS = -DMR_UNIFY_COMPARE_BY_CTOR_REP -DMR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1 -DMR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
batch/hocall.mercury_compile.5 39.090u 0.430s 0:40.99 96.4%
batch/hocall.mercury_compile.5 39.030u 0.340s 0:39.51 99.6%
batch/hocall.mercury_compile.5 39.110u 0.260s 0:39.44 99.8%
batch/hocall.mercury_compile.5 38.980u 0.390s 0:39.44 99.8%
When I commit the change, I therefore intend to add
#define MR_UNIFY_COMPARE_BY_CTOR_REP
#define MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
#define MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
to the top of mercury_ho_call.c.
Zoltan.
cvs diff: Diffing .
Index: mercury_bootstrap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_bootstrap.h
--- mercury_bootstrap.h 1999/09/10 10:26:24 1.9
+++ mercury_bootstrap.h 1999/09/28 02:21:53
@@ -15,6 +15,10 @@
#ifndef MERCURY_BOOTSTRAP_H
#define MERCURY_BOOTSTRAP_H
+#define COMPARE_EQUAL MR_COMPARE_EQUAL
+#define COMPARE_LESS MR_COMPARE_LESS
+#define COMPARE_GREATER MR_COMPARE_GREATER
+
#ifndef MR_NO_BACKWARDS_COMPAT
/*
Index: mercury_ho_call.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.21
diff -u -b -r1.21 mercury_ho_call.c
--- mercury_ho_call.c 1999/09/27 05:20:45 1.21
+++ mercury_ho_call.c 1999/09/30 02:49:17
@@ -249,13 +249,185 @@
/*
** mercury__unify_2_0 is called as `unify(TypeInfo, X, Y)'
** in the mode `unify(in, in, in) is semidet'.
-**
-** We call the type-specific unification routine as
-** `UnifyPred(...ArgTypeInfos..., X, Y)' is semidet, with all arguments input.
*/
Define_entry(mercury__unify_2_0);
{
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP
+ Word type_info;
+ MR_TypeCtorInfo type_ctor_info;
+ Word x, y;
+
+ type_info = r1;
+ x = r2;
+ y = r3;
+
+unify_start:
+ type_ctor_info = MR_TYPEINFO_GET_TYPE_CTOR_INFO((Word *) type_info);
+ switch (type_ctor_info->type_ctor_rep) {
+
+ /*
+ ** For notag and equiv types, we should probably
+ ** set type_info to refer to the appropriate type
+ ** and then goto start. However, the code that we
+ ** have here now works, even though it could be
+ ** improved.
+ */
+
+ case MR_TYPECTOR_REP_DU:
+ case MR_TYPECTOR_REP_ARRAY:
+ case MR_TYPECTOR_REP_NOTAG:
+ case MR_TYPECTOR_REP_EQUIV:
+ case MR_TYPECTOR_REP_EQUIV_VAR:
+
+ /*
+ ** We call the type-specific unify routine as
+ ** `UnifyPred(...ArgTypeInfos..., X, Y)' is semidet.
+ ** The ArgTypeInfo arguments are input, and are passed
+ ** in r1, r2, ... rN. The X and Y arguments are also
+ ** input, and are passed in rN+1 and rN+2.
+ ** The success indication is output in 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.
+ */
+
+ if (type_ctor_info->arity == 0) {
+ r1 = x;
+ r2 = y;
+ }
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
+ else if (type_ctor_info->arity == 1) {
+ Word *args_base;
+
+ args_base = (Word *) type_info;
+ r1 = args_base[1];
+ r2 = x;
+ r3 = y;
+ }
+#endif
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
+ else if (type_ctor_info->arity == 2) {
+ Word *args_base;
+
+ args_base = (Word *) type_info;
+ r1 = args_base[1];
+ r2 = args_base[2];
+ r3 = x;
+ r4 = y;
+ }
+#endif
+ else {
+ int i;
+ int type_arity;
+ Word *args_base;
+
+ type_arity = type_ctor_info->arity;
+ args_base = (Word *) type_info;
+ save_registers();
+
+ /* CompPred(...ArgTypeInfos..., Res, X, Y) * */
+ for (i = 1; i <= type_arity; i++) {
+ virtual_reg(i) = args_base[i];
+ }
+ virtual_reg(type_arity + 1) = x;
+ virtual_reg(type_arity + 2) = y;
+
+ restore_registers();
+ }
+
+ tailcall(type_ctor_info->unify_pred,
+ LABEL(mercury__unify_2_0));
+
+ case MR_TYPECTOR_REP_ENUM:
+ r1 = ((Unsigned) x == (Unsigned) y);
+ proceed();
+
+ case MR_TYPECTOR_REP_INT:
+ case MR_TYPECTOR_REP_CHAR:
+ r1 = ((Integer) x == (Integer) y);
+ proceed();
+
+ case MR_TYPECTOR_REP_FLOAT:
+ {
+ Float fx, fy;
+
+ fx = word_to_float(x);
+ fy = word_to_float(y);
+ r1 = (fx == fy);
+ proceed();
+ }
+
+ case MR_TYPECTOR_REP_STRING:
+ r1 = (strcmp((char *) x, (char *) y) == 0);
+ proceed();
+
+ case MR_TYPECTOR_REP_UNIV:
+ {
+ Word type_info_x, type_info_y;
+ int result;
+
+ /* First compare the type_infos */
+ type_info_x = MR_field(MR_mktag(0), x,
+ UNIV_OFFSET_FOR_TYPEINFO);
+ type_info_y = MR_field(MR_mktag(0), y,
+ UNIV_OFFSET_FOR_TYPEINFO);
+ save_transient_registers();
+ result = MR_compare_type_info(
+ type_info_x, type_info_y);
+ restore_transient_registers();
+ if (result != MR_COMPARE_EQUAL) {
+ r1 = FALSE;
+ proceed();
+ }
+
+ /*
+ ** If the types are the same, then unify
+ ** the unwrapped args.
+ */
+
+ type_info = type_info_x;
+ x = MR_field(MR_mktag(0), x,
+ UNIV_OFFSET_FOR_DATA);
+ y = MR_field(MR_mktag(0), y,
+ UNIV_OFFSET_FOR_DATA);
+ goto unify_start;
+ }
+
+ case MR_TYPECTOR_REP_C_POINTER:
+ r1 = ((void *) x == (void *) y);
+ proceed();
+
+ case MR_TYPECTOR_REP_TYPEINFO:
+ {
+ int result;
+
+ save_transient_registers();
+ result = MR_compare_type_info(x, y);
+ restore_transient_registers();
+ r1 = (result == MR_COMPARE_EQUAL);
+ proceed();
+ }
+
+ case MR_TYPECTOR_REP_VOID:
+ fatal_error("attempt to unify terms of type `void'");
+
+ case MR_TYPECTOR_REP_PRED:
+ fatal_error("attempt to unify higher-order terms");
+
+ case MR_TYPECTOR_REP_TYPECLASSINFO:
+ fatal_error("attempt to unify typeclass_infos");
+
+ case MR_TYPECTOR_REP_UNKNOWN:
+ fatal_error("attempt to unify terms of unknown type");
+
+ default:
+ fatal_error("attempt to unify terms "
+ "of unknown representation");
+ }
+#else
Code *unify_pred; /* address of the unify pred for this type */
int type_arity; /* number of type_info args */
Word args_base; /* the address of the word before the first */
@@ -296,6 +468,7 @@
restore_registers();
tailcall(unify_pred, LABEL(mercury__unify_2_0));
+#endif
}
/*
@@ -310,6 +483,131 @@
Define_entry(mercury__index_2_0);
{
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP
+ Word type_info;
+ MR_TypeCtorInfo type_ctor_info;
+ Word x;
+
+ type_info = r1;
+ x = r2;
+
+ type_ctor_info = MR_TYPEINFO_GET_TYPE_CTOR_INFO((Word *) type_info);
+ switch (type_ctor_info->type_ctor_rep) {
+
+ /*
+ ** For notag and equiv types, we should probably
+ ** set type_info to refer to the appropriate type
+ ** and then goto start. However, the code that we
+ ** have here now works, even though it could be
+ ** improved.
+ */
+
+ case MR_TYPECTOR_REP_DU:
+ case MR_TYPECTOR_REP_NOTAG:
+ case MR_TYPECTOR_REP_EQUIV:
+ case MR_TYPECTOR_REP_EQUIV_VAR:
+ case MR_TYPECTOR_REP_ARRAY:
+
+ /*
+ ** We call the type-specific unify routine as
+ ** `IndexPred(...ArgTypeInfos..., X, Index)' is det.
+ ** The ArgTypeInfo arguments are input, and are passed
+ ** in r1, r2, ... rN. The X argument is also input
+ ** and is passed in rN+1. The index is output in 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.
+ */
+
+ if (type_ctor_info->arity == 0) {
+ r1 = x;
+ }
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
+ else if (type_ctor_info->arity == 1) {
+ Word *args_base;
+
+ args_base = (Word *) type_info;
+ r1 = args_base[1];
+ r2 = x;
+ }
+#endif
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
+ else if (type_ctor_info->arity == 2) {
+ Word *args_base;
+
+ args_base = (Word *) type_info;
+ r1 = args_base[1];
+ r2 = args_base[2];
+ r3 = x;
+ }
+#endif
+ else {
+ int i;
+ int type_arity;
+ Word *args_base;
+
+ type_arity = type_ctor_info->arity;
+ args_base = (Word *) type_info;
+ save_registers();
+
+ /* IndexPred(...ArgTypeInfos..., X, Index) */
+ for (i = 1; i <= type_arity; i++) {
+ virtual_reg(i) = args_base[i];
+ }
+ virtual_reg(type_arity + 1) = x;
+
+ restore_registers();
+ }
+
+ tailcall(type_ctor_info->index_pred,
+ LABEL(mercury__index_2_0));
+
+ case MR_TYPECTOR_REP_ENUM:
+ fatal_error("attempt to index a term "
+ "of an enumerated type");
+ proceed();
+
+ case MR_TYPECTOR_REP_INT:
+ case MR_TYPECTOR_REP_CHAR:
+ r1 = x;
+ proceed();
+
+ case MR_TYPECTOR_REP_FLOAT:
+ fatal_error("attempt to index a float");
+
+ case MR_TYPECTOR_REP_STRING:
+ fatal_error("attempt to index a string");
+ proceed();
+
+ case MR_TYPECTOR_REP_UNIV:
+ fatal_error("attempt to index a term of type `univ'");
+
+ case MR_TYPECTOR_REP_C_POINTER:
+ r1 = x;
+ proceed();
+
+ case MR_TYPECTOR_REP_TYPEINFO:
+ fatal_error("attempt to index a type_info");
+
+ case MR_TYPECTOR_REP_VOID:
+ fatal_error("attempt to index a term of type `void'");
+
+ case MR_TYPECTOR_REP_PRED:
+ fatal_error("attempt to index a higher-order term");
+
+ case MR_TYPECTOR_REP_TYPECLASSINFO:
+ fatal_error("attempt to index a typeclass_info");
+
+ case MR_TYPECTOR_REP_UNKNOWN:
+ fatal_error("attempt to index a term of unknown type");
+
+ default:
+ fatal_error("attempt to index a term "
+ "of unknown representation");
+ }
+#else
Code *index_pred; /* address of the index pred for this type */
int type_arity; /* number of type_info args */
Word args_base; /* the address of the word before the first */
@@ -347,6 +645,7 @@
restore_registers();
tailcall(index_pred, LABEL(mercury__index_2_0));
+#endif
}
/*
@@ -354,12 +653,6 @@
** in the mode `compare(in, out, in, in) is det'.
**
** (The additional entry points replace either or both "in"s with "ui"s.)
-**
-** We call the type-specific compare routine as
-** `ComparePred(...ArgTypeInfos..., Result, X, Y)' is det.
-** The ArgTypeInfo arguments are input, and are passed in r1, r2, ... rN.
-** The X and Y arguments are also input, and are passed in rN+1 and rN+2.
-** The Index argument is output.
*/
Define_entry(mercury__compare_3_0);
@@ -382,6 +675,221 @@
#endif
Define_entry(mercury__compare_3_3);
{
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP
+ Word type_info;
+ MR_TypeCtorInfo type_ctor_info;
+ Word x, y;
+
+ type_info = r1;
+ x = r2;
+ y = r3;
+
+compare_start:
+ type_ctor_info = MR_TYPEINFO_GET_TYPE_CTOR_INFO((Word *) type_info);
+ switch (type_ctor_info->type_ctor_rep) {
+
+ /*
+ ** For notag and equiv types, we should probably
+ ** set type_info to refer to the appropriate type
+ ** and then goto start. However, the code that we
+ ** have here now works, even though it could be
+ ** improved.
+ */
+
+ case MR_TYPECTOR_REP_DU:
+ case MR_TYPECTOR_REP_NOTAG:
+ case MR_TYPECTOR_REP_EQUIV:
+ case MR_TYPECTOR_REP_EQUIV_VAR:
+ case MR_TYPECTOR_REP_ARRAY:
+
+ /*
+ ** We call the type-specific compare routine as
+ ** `CompPred(...ArgTypeInfos..., Result, X, Y)' is det.
+ ** The ArgTypeInfo arguments are input, and are passed
+ ** in r1, r2, ... rN. The X and Y arguments are also
+ ** input, and are passed in rN+1 and rN+2.
+ ** The Result argument is output in 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.
+ */
+
+ if (type_ctor_info->arity == 0) {
+ r1 = x;
+ r2 = y;
+ }
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
+ else if (type_ctor_info->arity == 1) {
+ Word *args_base;
+
+ args_base = (Word *) type_info;
+ r1 = args_base[1];
+ r2 = x;
+ r3 = y;
+ }
+#endif
+#ifdef MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
+ else if (type_ctor_info->arity == 2) {
+ Word *args_base;
+
+ args_base = (Word *) type_info;
+ r1 = args_base[1];
+ r2 = args_base[2];
+ r3 = x;
+ r4 = y;
+ }
+#endif
+ else {
+ int i;
+ int type_arity;
+ Word *args_base;
+
+ type_arity = type_ctor_info->arity;
+ args_base = (Word *) type_info;
+ save_registers();
+
+ /* CompPred(...ArgTypeInfos..., Res, X, Y) * */
+ for (i = 1; i <= type_arity; i++) {
+ virtual_reg(i) = args_base[i];
+ }
+ virtual_reg(type_arity + 1) = x;
+ virtual_reg(type_arity + 2) = y;
+
+ restore_registers();
+ }
+
+ tailcall(type_ctor_info->compare_pred,
+ LABEL(mercury__compare_3_3));
+
+ case MR_TYPECTOR_REP_ENUM:
+ if ((Unsigned) x == (Unsigned) y) {
+ r1 = MR_COMPARE_EQUAL;
+ } else if ((Unsigned) x < (Unsigned) y) {
+ r1 = MR_COMPARE_LESS;
+ } else {
+ r1 = MR_COMPARE_GREATER;
+ }
+
+ proceed();
+
+ case MR_TYPECTOR_REP_INT:
+ case MR_TYPECTOR_REP_CHAR:
+ if ((Integer) x == (Integer) y) {
+ r1 = MR_COMPARE_EQUAL;
+ } else if ((Integer) x < (Integer) y) {
+ r1 = MR_COMPARE_LESS;
+ } else {
+ r1 = MR_COMPARE_GREATER;
+ }
+
+ proceed();
+
+ case MR_TYPECTOR_REP_FLOAT:
+ {
+ Float fx, fy;
+
+ fx = word_to_float(x);
+ fy = word_to_float(y);
+ if (fx == fy) {
+ r1 = MR_COMPARE_EQUAL;
+ } else if (fx < fy) {
+ r1 = MR_COMPARE_LESS;
+ } else {
+ r1 = MR_COMPARE_GREATER;
+ }
+
+ proceed();
+ }
+
+ case MR_TYPECTOR_REP_STRING:
+ {
+ int result;
+
+ result = strcmp((char *) x, (char *) y);
+ if (result == 0) {
+ r1 = MR_COMPARE_EQUAL;
+ } else if (result < 0) {
+ r1 = MR_COMPARE_LESS;
+ } else {
+ r1 = MR_COMPARE_GREATER;
+ }
+
+ proceed();
+ }
+
+ case MR_TYPECTOR_REP_UNIV:
+ {
+ Word type_info_x, type_info_y;
+ int result;
+
+ /* First compare the type_infos */
+ type_info_x = MR_field(MR_mktag(0), x,
+ UNIV_OFFSET_FOR_TYPEINFO);
+ type_info_y = MR_field(MR_mktag(0), y,
+ UNIV_OFFSET_FOR_TYPEINFO);
+ save_transient_registers();
+ result = MR_compare_type_info(
+ type_info_x, type_info_y);
+ restore_transient_registers();
+ if (result != MR_COMPARE_EQUAL) {
+ r1 = result;
+ proceed();
+ }
+
+ /*
+ ** If the types are the same, then compare
+ ** the unwrapped args.
+ */
+
+ type_info = type_info_x;
+ x = MR_field(MR_mktag(0), x,
+ UNIV_OFFSET_FOR_DATA);
+ y = MR_field(MR_mktag(0), y,
+ UNIV_OFFSET_FOR_DATA);
+ goto compare_start;
+ }
+
+ case MR_TYPECTOR_REP_C_POINTER:
+ if ((void *) x == (void *) y) {
+ r1 = MR_COMPARE_EQUAL;
+ } else if ((void *) x < (void *) y) {
+ r1 = MR_COMPARE_LESS;
+ } else {
+ r1 = MR_COMPARE_GREATER;
+ }
+
+ proceed();
+
+ case MR_TYPECTOR_REP_TYPEINFO:
+ {
+ int result;
+
+ save_transient_registers();
+ result = MR_compare_type_info(x, y);
+ restore_transient_registers();
+ r1 = result;
+ proceed();
+ }
+
+ case MR_TYPECTOR_REP_VOID:
+ fatal_error("attempt to compare terms of type `void'");
+
+ case MR_TYPECTOR_REP_PRED:
+ fatal_error("attempt to compare higher-order terms");
+
+ case MR_TYPECTOR_REP_TYPECLASSINFO:
+ fatal_error("attempt to compare typeclass_infos");
+
+ case MR_TYPECTOR_REP_UNKNOWN:
+ fatal_error("attempt to compare terms of unknown type");
+
+ default:
+ fatal_error("attempt to compare terms "
+ "of unknown representation");
+ }
+#else
Code *compare_pred; /* address of the compare pred for this type */
int type_arity; /* number of type_info args */
Word args_base; /* the address of the word before the first */
@@ -422,6 +930,7 @@
restore_registers();
tailcall(compare_pred, LABEL(mercury__compare_3_3));
+#endif
}
END_MODULE
Index: mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_type_info.h
--- mercury_type_info.h 1999/09/27 05:20:52 1.25
+++ mercury_type_info.h 1999/09/28 05:08:26
@@ -74,9 +74,9 @@
** Definitions for handwritten code, mostly for mercury_compare_typeinfo.
*/
-#define COMPARE_EQUAL 0
-#define COMPARE_LESS 1
-#define COMPARE_GREATER 2
+#define MR_COMPARE_EQUAL 0
+#define MR_COMPARE_LESS 1
+#define MR_COMPARE_GREATER 2
/*---------------------------------------------------------------------------*/
@@ -675,7 +675,7 @@
*/
#define MR_TYPEINFO_GET_TYPE_CTOR_INFO(TypeInfo) \
- ((MR_TypeCtorInfo) ((*TypeInfo) ? *TypeInfo : (Word) TypeInfo))
+ ((MR_TypeCtorInfo) ((*(TypeInfo)) ? *(TypeInfo) : (Word) (TypeInfo)))
#define MR_TYPEINFO_GET_HIGHER_ARITY(TypeInfo) \
((Integer) (Word *) (TypeInfo)[TYPEINFO_OFFSET_FOR_PRED_ARITY])
@@ -730,7 +730,7 @@
/*---------------------------------------------------------------------------*/
/*
-** defintions and functions for categorizing data representations.
+** definitions and functions for categorizing data representations.
*/
/*
@@ -792,7 +792,7 @@
*/
struct MR_TypeCtorInfo_struct {
- int arity;
+ Integer arity;
Code *unify_pred;
Code *index_pred;
Code *compare_pred;
@@ -820,7 +820,10 @@
typedef struct MR_TypeCtorInfo_struct *MR_TypeCtorInfo;
/*
- ** Macros for retreiving things from type_ctor_infos.
+ ** Macros for retrieving things from type_ctor_infos.
+ **
+ ** XXX zs: these macros should be deleted; the code using them
+ ** would be clearer if it referred to TypeCtorInfo fields directly.
*/
#define MR_TYPE_CTOR_INFO_GET_TYPE_CTOR_FUNCTORS(TypeCtorInfo) \
((TypeCtorInfo)->type_ctor_functors)
cvs diff: Diffing GETOPT
cvs diff: Diffing machdeps
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list