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

H.J. Lu hjl.tools at gmail.com
Sat Oct 13 14:53:01 PDT 2012


I got

 [hjl at gnu-tools-1 libatomic_ops]$ make check
Making check in src
make[1]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src'
Making check in atomic_ops
make[2]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src/atomic_ops'
Making check in sysdeps
make[3]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src/atomic_ops/sysdeps'
make[3]: Nothing to be done for `check'.
make[3]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src/atomic_ops/sysdeps'
make[3]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src/atomic_ops'
make[3]: Nothing to be done for `check-am'.
make[3]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src/atomic_ops'
make[2]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src/atomic_ops'
make[2]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src'
gcc -mx32 -DHAVE_CONFIG_H -I.  -I../src -I../src  -fPIC -g -O2
-DNDEBUG -MT atomic_ops.o -MD -MP -MF .deps/atomic_ops.Tpo -c -o
atomic_ops.o atomic_ops.c
mv -f .deps/atomic_ops.Tpo .deps/atomic_ops.Po
rm -f libatomic_ops.a
ar cru libatomic_ops.a atomic_ops.o
ranlib libatomic_ops.a
gcc -mx32 -DHAVE_CONFIG_H -I.  -I../src -I../src  -fPIC -g -O2
-DNDEBUG -MT atomic_ops_stack.o -MD -MP -MF .deps/atomic_ops_stack.Tpo
-c -o atomic_ops_stack.o atomic_ops_stack.c
mv -f .deps/atomic_ops_stack.Tpo .deps/atomic_ops_stack.Po
gcc -mx32 -DHAVE_CONFIG_H -I.  -I../src -I../src  -fPIC -g -O2
-DNDEBUG -MT atomic_ops_malloc.o -MD -MP -MF
.deps/atomic_ops_malloc.Tpo -c -o atomic_ops_malloc.o
atomic_ops_malloc.c
mv -f .deps/atomic_ops_malloc.Tpo .deps/atomic_ops_malloc.Po
rm -f libatomic_ops_gpl.a
ar cru libatomic_ops_gpl.a atomic_ops_stack.o atomic_ops_malloc.o
ranlib libatomic_ops_gpl.a
make[2]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src'
make[1]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/src'
Making check in doc
make[1]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/doc'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/doc'
Making check in tests
make[1]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
gcc -mx32 -DHAVE_CONFIG_H -I. -I../src  -I../src -I../src   -g -O2
-DNDEBUG list_atomic.c -E > list_atomic.i
make  check-am
make[2]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
make  test_atomic test_atomic_pthreads test_stack test_malloc
make[3]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
gcc -mx32 -DHAVE_CONFIG_H -I. -I../src  -I../src -I../src   -g -O2
-DNDEBUG -MT test_atomic.o -MD -MP -MF .deps/test_atomic.Tpo -c -o
test_atomic.o test_atomic.c
mv -f .deps/test_atomic.Tpo .deps/test_atomic.Po
gcc -mx32  -g -O2 -DNDEBUG   -o test_atomic test_atomic.o -lpthread
../src/libatomic_ops.a
gcc -mx32 -DHAVE_CONFIG_H -I. -I../src  -DAO_USE_PTHREAD_DEFS -I../src
-I../src   -g -O2 -DNDEBUG -MT test_atomic_pthreads-test_atomic.o -MD
-MP -MF .deps/test_atomic_pthreads-test_atomic.Tpo -c -o
test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo
'./'`test_atomic.c
mv -f .deps/test_atomic_pthreads-test_atomic.Tpo
.deps/test_atomic_pthreads-test_atomic.Po
gcc -mx32  -g -O2 -DNDEBUG   -o test_atomic_pthreads
test_atomic_pthreads-test_atomic.o -lpthread ../src/libatomic_ops.a
gcc -mx32 -DHAVE_CONFIG_H -I. -I../src  -I../src -I../src   -g -O2
-DNDEBUG -MT test_stack.o -MD -MP -MF .deps/test_stack.Tpo -c -o
test_stack.o test_stack.c
mv -f .deps/test_stack.Tpo .deps/test_stack.Po
gcc -mx32  -g -O2 -DNDEBUG   -o test_stack test_stack.o -lpthread
../src/libatomic_ops_gpl.a ../src/libatomic_ops.a
gcc -mx32 -DHAVE_CONFIG_H -I. -I../src  -I../src -I../src   -g -O2
-DNDEBUG -MT test_malloc.o -MD -MP -MF .deps/test_malloc.Tpo -c -o
test_malloc.o test_malloc.c
mv -f .deps/test_malloc.Tpo .deps/test_malloc.Po
gcc -mx32  -g -O2 -DNDEBUG   -o test_malloc test_malloc.o -lpthread
../src/libatomic_ops_gpl.a ../src/libatomic_ops.a
make[3]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
make  check-TESTS
make[3]: Entering directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
Missing: AO_compare_and_swap_double
Missing: AO_nop_acquire
Missing: AO_store_acquire
Missing: AO_short_store_acquire
Missing: AO_char_store_acquire
Missing: AO_int_store_acquire
Missing: AO_compare_and_swap_double_acquire
Missing: AO_nop_release
Missing: AO_load_release
Missing: AO_short_load_release
Missing: AO_char_load_release
Missing: AO_int_load_release
Missing: AO_compare_and_swap_double_release
Missing: AO_store_read
Missing: AO_short_store_read
Missing: AO_char_store_read
Missing: AO_int_store_read
Missing: AO_compare_and_swap_double_read
Missing: AO_load_write
Missing: AO_short_load_write
Missing: AO_char_load_write
Missing: AO_int_load_write
Missing: AO_compare_and_swap_double_write
Missing: AO_compare_and_swap_double_full
Missing: AO_nop_release_write
Missing: AO_load_release_write
Missing: AO_short_load_release_write
Missing: AO_char_load_release_write
Missing: AO_int_load_release_write
Missing: AO_compare_and_swap_double_release_write
Missing: AO_nop_acquire_read
Missing: AO_store_acquire_read
Missing: AO_short_store_acquire_read
Missing: AO_char_store_acquire_read
Missing: AO_int_store_acquire_read
Missing: AO_compare_and_swap_double_acquire_read
Testing add1/sub1
Succeeded
Testing store_release_write/load_acquire_read
Succeeded
Testing test_and_set
Succeeded
PASS: test_atomic
Missing: AO_nop_acquire
Missing: AO_store_acquire
Missing: AO_short_store_acquire
Missing: AO_char_store_acquire
Missing: AO_int_store_acquire
Missing: AO_nop_release
Missing: AO_load_release
Missing: AO_short_load_release
Missing: AO_char_load_release
Missing: AO_int_load_release
Missing: AO_store_read
Missing: AO_short_store_read
Missing: AO_char_store_read
Missing: AO_int_store_read
Missing: AO_load_write
Missing: AO_short_load_write
Missing: AO_char_load_write
Missing: AO_int_load_write
Missing: AO_nop_release_write
Missing: AO_load_release_write
Missing: AO_short_load_release_write
Missing: AO_char_load_release_write
Missing: AO_int_load_release_write
Missing: AO_nop_acquire_read
Missing: AO_store_acquire_read
Missing: AO_short_store_acquire_read
Missing: AO_char_store_acquire_read
Missing: AO_int_store_acquire_read
Testing add1/sub1
Succeeded
Testing store_release_write/load_acquire_read
Succeeded
Testing test_and_set
Succeeded
PASS: test_atomic_pthreads
About 1000000 pushes + 1000000 pops in 1 threads: 26 msecs
About 1000000 pushes + 1000000 pops in 2 threads: 127 msecs
About 1000000 pushes + 1000000 pops in 3 threads: 154 msecs
About 1000000 pushes + 1000000 pops in 4 threads: 179 msecs
PASS: test_stack
Performing 1000 reversals of 1000 element lists in 10 threads
Testing AO_malloc/AO_free
Succeeded
PASS: test_malloc
==================
All 4 tests passed
==================
make[3]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
make[2]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
make[1]: Leaving directory
`/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
make[1]: Entering directory `/export/gnu/import/git/github/bdwgc/libatomic_ops'
make[1]: Nothing to be done for `check-am'.
make[1]: Leaving directory `/export/gnu/import/git/github/bdwgc/libatomic_ops'
[hjl at gnu-tools-1 libatomic_ops]$


On Sat, Oct 13, 2012 at 3:27 AM, Ivan Maidanski <ivmai at mail.ru> wrote:
> Hi H. J.,
>
> Thank you.
>
> I've merged these changes to master and back-ported fix for double-CAS on
> x32 to https://github.com/ivmai/libatomic_ops/tree/release-7_2 branch. Could
> you also test it please (just make sure that all tests pass)?
>
> release-7_2 diff:
> https://github.com/ivmai/libatomic_ops/compare/0810914...72fd402
>
> Regards,
> Ivan
>
>
> Mon, 8 Oct 2012 09:08:39 -0700  "H.J. Lu" <hjl.tools at gmail.com>:
>
> 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:
>>
>> https://github.com/ivmai/libatomic_ops/commit/03de7740c21fe6e4a6bdd7af09d5ff5189d4d70e
>>
>>
>
> I see.
>
>>
>> 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
>> ao_t_is_int.h
>
> I see.
>
>> 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 check-TESTS
> make[3]: Entering directory
> `/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
> Missing: AO_compare_and_swap_double
> Missing: AO_compare_and_swap_double_acquire
> Missing: AO_compare_and_swap_double_release
> Missing: AO_compare_and_swap_double_read
> Missing: AO_compare_and_swap_double_write
> Missing: AO_compare_and_swap_double_full
> Missing: AO_compare_and_swap_double_release_write
> Missing: AO_compare_and_swap_double_acquire_read
> Testing add1/sub1
> Succeeded
> Testing store_release_write/load_acquire_read
> Succeeded
> Testing test_and_set
> Succeeded
> PASS: test_atomic
> Testing add1/sub1
> Succeeded
> Testing store_release_write/load_acquire_read
> Succeeded
> Testing test_and_set
> Succeeded
> PASS: test_atomic_pthreads
> 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
> PASS: test_stack
> Performing 1000 reversals of 1000 element lists in 10 threads
> Testing AO_malloc/AO_free
> Succeeded
> PASS: test_malloc
> ==================
> All 4 tests passed
> ==================
> make[3]: Leaving directory
> `/export/gnu/import/git/github/bdwgc/libatomic_ops/tests'
>
> Thanks.
>
> --
> H.J.
>
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>
>



-- 
H.J.



More information about the Gc mailing list