[m-rev.] for review: fix deep profiling runtime compilation failure

Simon Taylor staylr at gmail.com
Fri Feb 16 15:54:27 AEDT 2007


On 16-Feb-2007, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> On Fri, 16 Feb 2007, Simon Taylor wrote:
> >On 16-Feb-2007, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> >>This change breaks the deep profiling grades (and possibly also the
> >>debugging ones).  There is a fundamental problem with the way the
> >>bitmap type is defined.  It's a foreign type but (parts of) the runtime 
> >>also
> >>treat it as though it were a builtin type.
> >>
> >>This is a problem because the runtime is now referring to entities that
> >>are defined in the library.  The solution here is to make it either one
> >>or the other.
> >
> >This is the same as for arrays (they are defined in exactly the same way).
> 
> Ah, I didn't realise that was the case.
> 
> >The short-term fix is to abort if compare_representation/3 is called for
> >bitmaps as well.
> 
> This is fairly yucky.  We should consider allowing 
> compare_representation/3 to be defined for foreign_types.

I would have thought that compare_representation/3 for foreign types
should just call the normal comparison predicate, if it is defined.

Simon.


Estimated hours taken: 0.1
Branches: main

runtime/mercury_unify_compare_body.h:
	Disable C code for unifying and comparing bitmaps because
	in deep profiling grades it refers to proc_layouts that
	aren't defined.  compare_representation/3 now aborts whe
	applied to bitmaps.  This is the same as for arrays.

Index: mercury_unify_compare_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_unify_compare_body.h,v
retrieving revision 1.43
diff -u -u -r1.43 mercury_unify_compare_body.h
--- mercury_unify_compare_body.h	13 Feb 2007 01:59:00 -0000	1.43
+++ mercury_unify_compare_body.h	16 Feb 2007 04:27:10 -0000
@@ -149,6 +149,12 @@
   #endif
 
   #ifdef include_compare_rep_code
+        case MR_TYPECTOR_REP_BITMAP:
+            MR_fatal_error("sorry, not implemented: "
+                "compare_representation for bitmaps");
+  #endif
+
+  #ifdef include_compare_rep_code
         case MR_TYPECTOR_REP_FOREIGN:
             MR_fatal_error("sorry, not implemented: "
                 "compare_representation for foreign types");
@@ -424,6 +430,7 @@
         case MR_TYPECTOR_REP_NOTAG_USEREQ:
         case MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ:
         case MR_TYPECTOR_REP_ARRAY:
+        case MR_TYPECTOR_REP_BITMAP:
         case MR_TYPECTOR_REP_FOREIGN:
         case MR_TYPECTOR_REP_STABLE_FOREIGN:
 
@@ -610,30 +617,6 @@
 #endif
             }
 
-        case MR_TYPECTOR_REP_BITMAP:
-            {
-                int result;
-                MR_BitmapPtr bx = (MR_BitmapPtr) x;
-                MR_BitmapPtr by = (MR_BitmapPtr) y;
-
-                result = MR_bitmap_cmp(bx, by);
-
-#ifdef  select_compare_code
-                if (result == 0) {
-                    return_compare_answer(bitmap, bitmap, 0,
-                        MR_COMPARE_EQUAL);
-                } else if (result < 0) {
-                    return_compare_answer(bitmap, bitmap, 0,
-                        MR_COMPARE_LESS);
-                } else {
-                    return_compare_answer(bitmap, bitmap, 0,
-                        MR_COMPARE_GREATER);
-                }
-#else
-                return_unify_answer(bitmap, bitmap, 0, result == 0);
-#endif
-            }
-
             /*
             ** We use the c_pointer statistics for stable_c_pointer
             ** until the stable_c_pointer type is actually added,
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list