88 // <fence> decrement-dest <membar StoreLoad|StoreStore>
89 inline static void dec (volatile jint* dest);
90 static void dec (volatile jshort* dest);
91 inline static void dec (volatile size_t* dest);
92 inline static void dec_ptr(volatile intptr_t* dest);
93 inline static void dec_ptr(volatile void* dest);
94
95 // Performs atomic exchange of *dest with exchange_value. Returns old
96 // prior value of *dest. xchg*() provide:
97 // <fence> exchange-value-with-dest <membar StoreLoad|StoreStore>
98 inline static jint xchg(jint exchange_value, volatile jint* dest);
99 static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest);
100
101 inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest);
102 inline static void* xchg_ptr(void* exchange_value, volatile void* dest);
103
104 // Performs atomic compare of *dest and compare_value, and exchanges
105 // *dest with exchange_value if the comparison succeeded. Returns prior
106 // value of *dest. cmpxchg*() provide:
107 // <fence> compare-and-exchange <membar StoreLoad|StoreStore>
108 static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
109 inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value);
110 // See comment above about using jlong atomics on 32-bit platforms
111 inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value);
112
113 static unsigned int cmpxchg(unsigned int exchange_value,
114 volatile unsigned int* dest,
115 unsigned int compare_value);
116
117 inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value);
118 inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value);
119 };
120
121 // To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
122 // aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
123 // achieve is to place your short value next to another short value, which doesn't need atomic ops.
124 //
125 // Example
126 // ATOMIC_SHORT_PAIR(
127 // volatile short _refcount, // needs atomic operation
128 // unsigned short _length // number of UTF8 characters in the symbol (does not need atomic op)
|
88 // <fence> decrement-dest <membar StoreLoad|StoreStore>
89 inline static void dec (volatile jint* dest);
90 static void dec (volatile jshort* dest);
91 inline static void dec (volatile size_t* dest);
92 inline static void dec_ptr(volatile intptr_t* dest);
93 inline static void dec_ptr(volatile void* dest);
94
95 // Performs atomic exchange of *dest with exchange_value. Returns old
96 // prior value of *dest. xchg*() provide:
97 // <fence> exchange-value-with-dest <membar StoreLoad|StoreStore>
98 inline static jint xchg(jint exchange_value, volatile jint* dest);
99 static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest);
100
101 inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest);
102 inline static void* xchg_ptr(void* exchange_value, volatile void* dest);
103
104 // Performs atomic compare of *dest and compare_value, and exchanges
105 // *dest with exchange_value if the comparison succeeded. Returns prior
106 // value of *dest. cmpxchg*() provide:
107 // <fence> compare-and-exchange <membar StoreLoad|StoreStore>
108 #ifdef X86
109 inline static
110 #else
111 static
112 #endif // X86
113 jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
114 inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value);
115 // See comment above about using jlong atomics on 32-bit platforms
116 inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value);
117
118 static unsigned int cmpxchg(unsigned int exchange_value,
119 volatile unsigned int* dest,
120 unsigned int compare_value);
121
122 inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value);
123 inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value);
124 };
125
126 // To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
127 // aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
128 // achieve is to place your short value next to another short value, which doesn't need atomic ops.
129 //
130 // Example
131 // ATOMIC_SHORT_PAIR(
132 // volatile short _refcount, // needs atomic operation
133 // unsigned short _length // number of UTF8 characters in the symbol (does not need atomic op)
|