[m-dev.] MR_GC_MALLOC_ATOMIC?

Peter Wang novalazy at gmail.com
Mon Sep 19 16:56:23 AEST 2011


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.

We should consider removing --inline-alloc as clearly no one uses it.

Peter

diff --git a/runtime/mercury.h b/runtime/mercury.h
index 145558e..dcc7343 100644
--- a/runtime/mercury.h
+++ b/runtime/mercury.h
@@ -201,9 +201,19 @@ extern     MR_Word mercury__private_builtin__dummy_var;
         )
     #define MR_new_object(type, size, name) \
                ((type *) MR_GC_MALLOC_INLINE(size))
+    /*
+    ** 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.
+    */
+    #define MR_new_object_atomic(type, size, name) \
+               ((type *) MR_GC_MALLOC_ATOMIC(size))
   #else /* !MR_INLINE_ALLOC */
     #define MR_new_object(type, size, name) \
                ((type *) GC_MALLOC(size)) 
+    #define MR_new_object_atomic(type, size, name) \
+               ((type *) GC_MALLOC_ATOMIC(size)) 
   #endif /* !MR_INLINE_ALLOC */
 
 #else /* !MR_CONSERVATIVE_GC */

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