[m-dev.] MR_GC_MALLOC_ATOMIC?

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Sep 19 18:45:58 AEST 2011




On Mon, 19 Sep 2011, Peter Wang wrote:

> On 2011-09-19, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>> Hi,
>>
>> runtime/mercury.h:214 contains the following:
>>
>>   #define MR_new_object_atomic(type, size, alloc_id, name) \
>>                 ((type *) MR_GC_MALLOC_ATOMIC(size))
>>
>> However, MR_GC_MALLOC_ATOMIC does not appear to be defined anywhere.
>> (The only other reference to it is in the comment directly above this.)
>>
>> Is this supposed to actually to be just GC_MALLOC_ATOMIC?
>
> Yes, see the diff from Sun Aug 20 05:01:25 2006 +0000 below.

I will commit the following diff which changes it to be GC_MALLOC_ATOMIC
and also fixes the (now incorrect) use of the MR_CONSERVATIVE_GC in that
piece of code.  Since the Boehm GC now provides GC_MALLOC_ATOMIC_WORDS,
the defn of MR_new_object_atomic may need to be revisited here anyway.
(I've added an XXX comment regarding the latter.)

Julien.

--------------------------

Branches: 11.07, main

runtime/mercury.h:
 	Fix the condition protecting the definition of MR_GC_MALLOC_INLINE,
 	since we are calling the Boehm collector directly we require
  	MR_BOEHM_GC to be defined, not just MR_CONSERVATIVE_GC.

 	MR_GC_MALLOC_ATOMIC does not exist; use GC_MALLOC_ATOMIC instead.

 	Add a couple of XXXs regarding the definition of MR_new_object_atomic
 	in the case where inline allocation is enabled.

Index: runtime/mercury.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury.h,v
retrieving revision 1.79
diff -u -r1.79 mercury.h
--- runtime/mercury.h	22 Aug 2011 07:56:10 -0000	1.79
+++ runtime/mercury.h	19 Sep 2011 07:54:58 -0000
@@ -176,7 +176,7 @@
  **	Allocates memory on the garbage-collected heap.
  */

-#ifdef MR_CONSERVATIVE_GC
+#ifdef MR_BOEHM_GC
    #ifdef MR_INLINE_ALLOC
      #ifndef MR_GNUC
        #error "MR_INLINE_ALLOC requires GNU C"
@@ -208,10 +208,13 @@
      ** Since the Boehm collector defined GC_MALLOC_WORDS but not
      ** GC_MALLOC_WORDS_ATOMIC, we can define MR_new_object_atomic here
      ** to call either MR_GC_MALLOC_ATOMIC or MR_GC_MALLOC_INLINE,
-    ** depending on whether we value atomicity or inline expansion more.
+    ** depending on whether we value atomicity or inline expansion more. 
+    ** XXX the above is out-of-date: Bohem GC does now provide
+    ** GC_MALLOC_ATOMIC_WORDS.
+    ** XXX we don't provide MR_GC_MALLOC_ATOMIC.
      */
      #define MR_new_object_atomic(type, size, alloc_id, name) \
-		((type *) MR_GC_MALLOC_ATOMIC(size))
+		((type *) GC_MALLOC_ATOMIC(size))
    #else /* !MR_INLINE_ALLOC */

      #ifdef MR_MPROF_PROFILE_MEMORY_ATTRIBUTION
@@ -227,7 +230,7 @@
      #endif
    #endif /* !MR_INLINE_ALLOC */

-#else /* !MR_CONSERVATIVE_GC */
+#else /* !MR_BOEHM_GC */

    #ifndef MR_GNUC
      /*
@@ -235,7 +238,7 @@
      ** It's not worth worrying about compilers other than GNU C for
      ** this obscure combination of options.
      */
-    #error "For C compilers other than GNU C, `--high-level-code' requires `--gc conservative'"
+    #error "For C compilers other than GNU C, `--high-level-code' requires `--gc boehm'"
    #endif

    /*
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list