[m-rev.] for review: workaround problems with mercury_atomic_ops and gcc -O0

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Oct 24 15:25:28 AEST 2007


On Wed, 24 Oct 2007, Peter Wang wrote:

> On 2007-10-24, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>>  For review by PeterW.
>>
>>  Estimated hours taken: 0.2
>>  Branches: main
>>
>>  Avoid problems with some versions of gcc when compiling the runtime
>>  atomic_ops module at -O0 in non low-level .par grades.
>>
>>  runtime/mercury_atomic_ops.[hc]:
>>  	Implement MR_compare_and_swap_word using the builtin gcc compare
>>  	and swap if it is available.  (In particular prefer this to the
>>  	handcoded assembler versions on x86 and x86_64.)
>>
>>  	Only include the code in these modules if MR_LL_PARALLEL_CONJ
>>  	is defined.  This helps to avoid problems with gcc in grades
>>  	where atomic operations are not used.
>>
>>  Julien.
>>
>>  Index: mercury_atomic_ops.c
>>  ===================================================================
>>  RCS file:
>>  /home/mercury/mercury1/repository/mercury/runtime/mercury_atomic_ops.c,v
>>  retrieving revision 1.1
>>  diff -u -r1.1 mercury_atomic_ops.c
>>  --- mercury_atomic_ops.c	11 Oct 2007 12:18:03 -0000	1.1
>>  +++ mercury_atomic_ops.c	24 Oct 2007 04:55:44 -0000
>>  @@ -14,6 +14,8 @@
>>   #include "mercury_imp.h"
>>   #include "mercury_atomic_ops.h"
>>
>>  +#if defined(MR_LL_PARALLEL_CON)
>
> MR_LL_PARALLEL_CONJ

Fixed.

>>  /*---------------------------------------------------------------------------*/
>>   /*
>>   ** Provide definitions for functions declared `extern inline'.
>>  @@ -28,3 +30,5 @@
>>   	MR_COMPARE_AND_SWAP_WORD_BODY;
>>       }
>>   )
>>  +
>>  +#endif /* MR_LL_PARALLEL_CONJ */
>>  Index: mercury_atomic_ops.h
>>  ===================================================================
>>  RCS file:
>>  /home/mercury/mercury1/repository/mercury/runtime/mercury_atomic_ops.h,v
>>  retrieving revision 1.1
>>  diff -u -r1.1 mercury_atomic_ops.h
>>  --- mercury_atomic_ops.h	11 Oct 2007 12:18:03 -0000	1.1
>>  +++ mercury_atomic_ops.h	24 Oct 2007 04:54:58 -0000
>>  @@ -16,6 +16,8 @@
>>
>>   #include "mercury_std.h"
>>
>>  +#if defined(MR_LL_PARALLEL_CON)

And this one.

> MR_LL_PARALLEL_CONJ
>
>>  @@ -82,4 +85,5 @@
>>   ** currently require any atomic ops.
>>   */
>>
>>  +#endif /* MR_LL_PARALLEL_CONJ */
>>   #endif /* not MERCURY_ATOMIC_OPS_H */
>
> What's the convention on #endif comments?

C coding standard section 2.3.2 -- on the developer information page
on the website.

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