[Gc] Re: Re: PATCH: Add x32 support to boehm-gc
hjl.tools at gmail.com
Mon Oct 8 09:08:39 PDT 2012
On Mon, Oct 8, 2012 at 9:05 AM, Ivan Maidanski <ivmai at mail.ru> wrote:
> Hi H.J.,
> Mon, 8 Oct 2012 08:54:08 -0700 от "H.J. Lu" <hjl.tools at gmail.com>:
> A couple comments:
> 1. AO_double_compare_and_swap_full is wrong:
> #elif defined(__ILP32__) || !defined(__x86_64__)
> # include "../standard_ao_double_t.h"
> /* X32 has native support for 64-bit integer operations (AO_double_t */
> /* is a 64-bit integer and we could use 64-bit cmpxchg). */
> /* This primitive is used by compare_double_and_swap_double_full. */
> AO_INLINE int
> AO_double_compare_and_swap_full(volatile AO_double_t *addr,
> AO_double_t old_val, AO_double_t new_val)
> This is only for x32. You should check
> #elif defined(__ILP32__) && defined(__x86_64__)
> No, the former is correct. Because this is not only for x32 but also for x86
> (if gcc 4+ and AO_USE_SYNC_CAS_BUILTIN manually defined). I've tested it
> (and inspected -S output) with recent clang and recent gcc-4.4 .. 4.7. See
> this commit message:
> 2. Why is AO_int_fetch_and_add_full only defined for 64-bit x86-64?
> AO_INLINE unsigned int
> AO_int_fetch_and_add_full (volatile unsigned int *p, unsigned int incr)
> unsigned int result;
> __asm__ __volatile__ ("lock; xaddl %0, %1"
> : "=r" (result), "=m" (*p)
> : "0" (incr), "m" (*p)
> : "memory");
> return result;
> works for ia32, x32 and x86-64.
> For ia32 and x32, we define AO_T_IS_INT which force
> AO_int_fetch_and_add_full to be defined as AO_fetch_and_add_full in
> Please run test_atomic and see it output whether AO_int_fetch_and_add_full
> is reported to be missing on X32. I'm sure it's not.
> Does "make check" successfully pass all tests on X32?
Yes, I got
make: Entering directory
About 1000000 pushes + 1000000 pops in 1 threads: 23 msecs
About 1000000 pushes + 1000000 pops in 2 threads: 119 msecs
About 1000000 pushes + 1000000 pops in 3 threads: 146 msecs
About 1000000 pushes + 1000000 pops in 4 threads: 179 msecs
Performing 1000 reversals of 1000 element lists in 10 threads
All 4 tests passed
make: Leaving directory
More information about the Gc