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

Ivan Maidanski ivmai at mail.ru
Mon Oct 1 05:54:25 PDT 2012


Hi H.J,

Done both (in the same branch). Please retry.

I've implemented double CAS using __sync_bool_compare_and_swap (similar to normal CAS on x86_64 starting from GCC 4.2). Please inspect the assembly code for it (as you pointed out it should be cmpxchg but not cmpxchg8b).
Also, I don't add cast of __sync_bool_compare_and_swap result to int (I assume the problem should be already fixed on GCC with x32 support - please check that GCC does not report warnings in AO_double_compare_and_swap_full).

Diff: https://github.com/ivmai/libatomic_ops/compare/47eb0ea6bf3...4d2f91e90e

Regards,
Ivan

Sun, 30 Sep 2012 13:32:49 -0700 "H.J. Lu" <hjl.tools at gmail.com>:
>	
>
>
	
	
>
		
		
			
>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;
>
#else
>
  typedef unsigned long long double_ptr_storage;
>
#endif
>
>
# define AO_HAVE_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.
>
>
>
-- 
>
H.J.
>
_______________________________________________
>
Gc mailing list
>Gc at linux.hpl.hp.com
>http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>
			
		
		
	

	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20121001/6b56dc39/attachment.htm


More information about the Gc mailing list