[m-dev.] for review: make univ a user defined type.

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 10 15:45:01 AEDT 2001


Tom, your diff looks fine now.

On 09-Jan-2001, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> +++ runtime/mercury_deep_copy_body.h	2001/01/07 23:37:07
> @@ -502,53 +502,6 @@
>          }
>          break;
>  
> -    case MR_TYPECTOR_REP_UNIV:
> -        {
> -            MR_Word    *data_value;
> -
> -            assert(MR_tag(data) == 0);
> -            data_value = (MR_Word *) MR_body(data, MR_mktag(0));
> -
> -            /* if the univ is stored in range, copy it */
> -            if (in_range(data_value)) {
> -                MR_Word *new_data_ptr;
> -
> -                /* allocate space for a univ */
> -                MR_incr_saved_hp(new_data, 2);
> -                new_data_ptr = (MR_Word *) new_data;
> -                /*
> -                ** Copy the fields across.
> -                ** Note: we must copy the data before the type_info,
> -                ** because when copying the data, we need the type_info
> -                ** to still contain the type rather than just holding
> -                ** a forwarding pointer.
> -                */

Hmm... does the MR_agc_deep_copy() handle existentially quantified
data types correctly?  I think it doesn't, because it doesn't
address the issue raised by this comment.

This bug is unrelated to your change, and agc doesn't work anyway,
so feel free to go ahead and commit it, even though it might
exacerbate the impact of this bug on agc.

The following patch may fix the MR_agc_deep_copy() bug.

Index: mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.34
diff -u -d -u -r1.34 mercury_deep_copy_body.h
--- mercury_deep_copy_body.h	2000/12/04 18:28:38	1.34
+++ mercury_deep_copy_body.h	2001/01/10 04:42:46
@@ -144,7 +144,7 @@
 **                  for (i = 0; i < arity; i++) {
 **                      if (MR_arg_type_may_contain_var(functor_desc, i)) {
 **                          MR_field(0, new_data, cur_slot) =
-**                              copy_arg(data_value, &data_value[cur_slot],
+**                              copy_arg(new_data, &data_value[cur_slot],
 **                                  functor_desc,
 **                                  MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(
 **                                      type_info),
@@ -215,7 +215,7 @@
                     for (i = 0; i < arity; i++) {                           \
                         if (MR_arg_type_may_contain_var(functor_desc, i)) { \
                             MR_field(0, new_data, cur_slot) =               \
-                                copy_arg(data_value, &data_value[cur_slot], \
+                                copy_arg(new_data, &data_value[cur_slot], \
                                     functor_desc,                           \
 			            MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR( \
                                         type_info),                         \

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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