[m-rev.] for review: TYPE_CTOR_REP_REFERENCE

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Feb 12 02:51:27 AEDT 2003


On 12-Feb-2003, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 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.

Thanks.  That fix looks fine.
Sorry, I should have tested this in hlc.gc before committing.

Here's the corresponding patch for the MC++ version.

Index: private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.111
diff -u -d -u -r1.111 private_builtin.m
--- private_builtin.m	10 Feb 2003 17:03:50 -0000	1.111
+++ private_builtin.m	11 Feb 2003 15:50:10 -0000
@@ -1124,20 +1124,20 @@
 	MR_TYPECTOR_REP_REFERENCE) 
 
 static int
-__Unify__private_builtin__ref_1_0(MR_Word x, MR_Word y)
+__Unify__private_builtin__ref_1_0(MR_Word type_info, MR_Word x, MR_Word y)
 {
 	return x == y;
 }
 
 static int
-do_unify__ref_1_0(MR_Box x, MR_Box y)
+do_unify__ref_1_0(MR_Word type_info, MR_Box x, MR_Box y)
 {
 	return x == y;
 }
 
 static void
 __Compare__private_builtin__ref_1_0(
-	MR_Word_Ref result, MR_Word x, MR_Word y)
+	MR_Word type_info, MR_Word_Ref result, MR_Word x, MR_Word y)
 {
 	mercury::runtime::Errors::fatal_error(
 		""called compare/3 for type `private_builtin.ref'"");
@@ -1145,7 +1145,7 @@
 
 static void
 do_compare__ref_1_0(
-	MR_Word_Ref result, MR_Box x, MR_Box y)
+	MR_Word type_info, MR_Word_Ref result, MR_Box x, MR_Box y)
 {
 	mercury::runtime::Errors::fatal_error(
 		""called compare/3 for type `private_builtin.ref'"");

-- 
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