71 __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
72 : "r" (dest), "r" (mp) : "cc", "memory");
73 }
74
75 inline void Atomic::dec_ptr(volatile void* dest) {
76 dec_ptr((volatile intptr_t*)dest);
77 }
78
79 inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
80 __asm__ volatile ( "xchgl (%2),%0"
81 : "=r" (exchange_value)
82 : "0" (exchange_value), "r" (dest)
83 : "memory");
84 return exchange_value;
85 }
86
87 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
88 return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
89 }
90
91 #define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
92 inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
93 int mp = os::is_MP();
94 __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
95 : "=a" (exchange_value)
96 : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
97 : "cc", "memory");
98 return exchange_value;
99 }
100
101 inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
102 int mp = os::is_MP();
103 __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
104 : "=a" (exchange_value)
105 : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
106 : "cc", "memory");
107 return exchange_value;
108 }
109
110 #ifdef AMD64
111 inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
112 inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
|
71 __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
72 : "r" (dest), "r" (mp) : "cc", "memory");
73 }
74
75 inline void Atomic::dec_ptr(volatile void* dest) {
76 dec_ptr((volatile intptr_t*)dest);
77 }
78
79 inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
80 __asm__ volatile ( "xchgl (%2),%0"
81 : "=r" (exchange_value)
82 : "0" (exchange_value), "r" (dest)
83 : "memory");
84 return exchange_value;
85 }
86
87 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
88 return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
89 }
90
91 inline jbyte AtomicPlatform::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
92 int mp = os::is_MP();
93 __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
94 : "=a" (exchange_value)
95 : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
96 : "cc", "memory");
97 return exchange_value;
98 }
99
100 inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
101 int mp = os::is_MP();
102 __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
103 : "=a" (exchange_value)
104 : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
105 : "cc", "memory");
106 return exchange_value;
107 }
108
109 #ifdef AMD64
110 inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
111 inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
|