67
68 extern "C" {
69 jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
70 jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
71 jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
72 jbyte compare_value IS_MP_DECL());
73 jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
74 jint compare_value IS_MP_DECL());
75 jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
76 jlong compare_value IS_MP_DECL());
77 }
78
79 inline jint Atomic::add (jint add_value, volatile jint* dest) {
80 return _Atomic_add(add_value, dest IS_MP_ARG());
81 }
82
83 inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
84 return _Atomic_xchg(exchange_value, dest);
85 }
86
87 #define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
88 inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
89 return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
90 }
91
92 inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
93 return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
94 }
95
96 inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
97 return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
98 }
99
100
101 #ifdef AMD64
102 inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
103 inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
104 extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
105 extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
106
107 inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
108 return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
|
67
68 extern "C" {
69 jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
70 jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
71 jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
72 jbyte compare_value IS_MP_DECL());
73 jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
74 jint compare_value IS_MP_DECL());
75 jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
76 jlong compare_value IS_MP_DECL());
77 }
78
79 inline jint Atomic::add (jint add_value, volatile jint* dest) {
80 return _Atomic_add(add_value, dest IS_MP_ARG());
81 }
82
83 inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
84 return _Atomic_xchg(exchange_value, dest);
85 }
86
87 inline jbyte AtomicPlatform::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
88 return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
89 }
90
91 inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
92 return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
93 }
94
95 inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
96 return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
97 }
98
99
100 #ifdef AMD64
101 inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
102 inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
103 extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
104 extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
105
106 inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
107 return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
|