[m-rev.] for review: TYPE_CTOR_REP_REFERENCE
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Feb 12 02:42:36 AEDT 2003
On 10-Feb-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Index: runtime/mercury_builtin_types.h
> +MR_bool MR_CALL mercury__private_builtin____Unify____ref_1_0(
> + MR_Reference x, MR_Reference y);
Actually, this is wrong. Given a type of arity N, the two values being compared
(x and y) must be preceded by the N typeinfos of the argument types in the
signature of the unify and compare functions. Since the MR_TYPE_CTOR_INFO
macro declares the types of the unify and compare functions, the definition
of this function (and the compare function) get a C compiler error.
The same problem exists in the MC++ version.
My proposed fix follows. It is being bootchecked now.
Zoltan.
runtime/mercury_builtin_types.[ch]:
Fix a bug: add the required type_infos to the unify and compare
functions used by the C MLDS back end for the new ref/1 type.
cvs diff: Diffing .
Index: mercury_builtin_types.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_builtin_types.c,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_builtin_types.c
--- mercury_builtin_types.c 10 Feb 2003 17:12:02 -0000 1.5
+++ mercury_builtin_types.c 11 Feb 2003 15:24:18 -0000
@@ -169,8 +169,8 @@
}
MR_bool MR_CALL
-mercury__private_builtin____Unify____ref_1_0(MR_Reference x,
- MR_Reference y)
+mercury__private_builtin____Unify____ref_1_0(MR_Mercury_Type_Info type_info,
+ MR_Reference x, MR_Reference y)
{
return x == y;
}
@@ -324,10 +324,10 @@
void MR_CALL
mercury__private_builtin____Compare____ref_1_0(
- MR_Comparison_Result *result, MR_Reference x, MR_Reference y)
+ MR_Mercury_Type_Info type_info, MR_Comparison_Result *result,
+ MR_Reference x, MR_Reference y)
{
- MR_fatal_error(
- "called compare/3 for `private_builtin.ref' type");
+ MR_fatal_error("called compare/3 for `private_builtin.ref' type");
}
void MR_CALL
@@ -457,9 +457,10 @@
}
MR_bool MR_CALL
-mercury__private_builtin__do_unify__ref_1_0(MR_Box x, MR_Box y)
+mercury__private_builtin__do_unify__ref_1_0(MR_Mercury_Type_Info type_info,
+ MR_Box x, MR_Box y)
{
- return mercury__private_builtin____Unify____ref_1_0(
+ return mercury__private_builtin____Unify____ref_1_0(type_info,
(MR_Reference) x, (MR_Reference) y);
}
@@ -597,11 +598,10 @@
}
void MR_CALL
-mercury__private_builtin__do_compare__ref_1_0(
+mercury__private_builtin__do_compare__ref_1_0(MR_Mercury_Type_Info type_info,
MR_Comparison_Result *result, MR_Box x, MR_Box y)
{
- MR_fatal_error(
- "called compare/3 for `private_builtin.ref' type");
+ MR_fatal_error("called compare/3 for `private_builtin.ref' type");
}
void MR_CALL
Index: mercury_builtin_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_builtin_types.h,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_builtin_types.h
--- mercury_builtin_types.h 10 Feb 2003 17:03:57 -0000 1.3
+++ mercury_builtin_types.h 11 Feb 2003 15:25:07 -0000
@@ -80,7 +80,7 @@
MR_bool MR_CALL mercury__private_builtin____Unify____heap_pointer_0_0(
MR_Heap_Pointer x, MR_Heap_Pointer y);
MR_bool MR_CALL mercury__private_builtin____Unify____ref_1_0(
- MR_Reference x, MR_Reference y);
+ MR_Mercury_Type_Info type_info, MR_Reference x, MR_Reference y);
MR_bool MR_CALL mercury__builtin____Unify____func_0_0(MR_Func x, MR_Func y);
MR_bool MR_CALL mercury__builtin____Unify____pred_0_0(MR_Pred x, MR_Pred y);
MR_bool MR_CALL mercury__builtin____Unify____tuple_0_0(MR_Tuple x, MR_Tuple y);
@@ -116,7 +116,8 @@
void MR_CALL mercury__private_builtin____Compare____heap_pointer_0_0(
MR_Comparison_Result *result, MR_Heap_Pointer x, MR_Heap_Pointer y);
void MR_CALL mercury__private_builtin____Compare____ref_1_0(
- MR_Comparison_Result *result, MR_Reference x, MR_Reference y);
+ MR_Mercury_Type_Info type_info, MR_Comparison_Result *result,
+ MR_Reference x, MR_Reference y);
void MR_CALL mercury__builtin____Compare____func_0_0(
MR_Comparison_Result *result, MR_Func x, MR_Func y);
void MR_CALL mercury__builtin____Compare____pred_0_0(
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