[Gc] Re: Re[6]: PATCH: Add x32 support to boehm-gc

H.J. Lu hjl.tools at gmail.com
Sun Sep 30 13:32:49 PDT 2012

On Sun, Sep 30, 2012 at 10:20 AM, Ivan Maidanski <ivmai at mail.ru> wrote:
> Hi H.J.,
> Could you please test this branch of libatomic_ops under x32:
> https://github.com/ivmai/libatomic_ops/tree/master-untested ?

X32 is x86-64 with 32bit pointers and long.

> This branch contain 2 commits (extra to "master" branch):
> 1) a fix for AO_compare_double_and_swap_double_full - it should use
> cmpxchg8b instead of cmpxchg16b for x32

src/atomic_ops/sysdeps/standard_ao_double_t.h has

#if (defined(__x86_64__) && __GNUC__ >= 4) || defined(_WIN64)
# include <xmmintrin.h>
  typedef __m128 double_ptr_storage;
#elif defined(_WIN32) && !defined(__GNUC__)
  typedef unsigned __int64 double_ptr_storage;
  typedef unsigned long long double_ptr_storage;


typedef union {
    double_ptr_storage AO_whole;
    struct {AO_t AO_v1; AO_t AO_v2;} AO_parts;
} AO_double_t;
#define AO_HAVE_double_t

This is incorrect for x32 sice AO_t is size_t, which is
32bit for x32.  X32 has native support for 64-bit integer
operations.  For x32, AO_double_t is 64bit integer and
we can use 64-bit cmpxchg.  There is no need for
x32 AO_compare_double_and_swap_double_full,
which breaks 64bit integer into 2 32-bit integers.
Can you add a 64-bit version of atomic operations?

> 2) code refactoring merging x86_64.h code into x86.h file
> In particular, it's unclear to me whether PIC mode for x32 is the same as
> for x86.

That is incorrect.  X32 PIC is identical to x86-64 PIC.


More information about the Gc mailing list