< prev index next >
src/os_cpu/solaris_x86/vm/atomic_solaris_x86.hpp
Print this page
rev 13069 : imported patch Remove_GNU_SOURCE
*** 159,260 ****
_Atomic_move_long((volatile jlong*)&store_value, dest);
}
#endif // AMD64
- #ifdef _GNU_SOURCE
-
- extern "C" {
- inline jint _Atomic_add(jint add_value, volatile jint* dest) {
- jint addend = add_value;
- __asm__ volatile ("lock xaddl %0,(%2)"
- : "=r" (addend)
- : "0" (addend), "r" (dest)
- : "cc", "memory");
- return addend + add_value;
- }
-
- #ifdef AMD64
- inline jlong _Atomic_add_long(jlong add_value, volatile jlong* dest) {
- intptr_t addend = add_value;
- __asm__ __volatile__ ("lock xaddq %0,(%2)"
- : "=r" (addend)
- : "0" (addend), "r" (dest)
- : "cc", "memory");
- return addend + add_value;
- }
-
- inline jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest) {
- __asm__ __volatile__ ("xchgq (%2),%0"
- : "=r" (exchange_value)
- : "0" (exchange_value), "r" (dest)
- : "memory");
- return exchange_value;
- }
-
- #endif // AMD64
-
- inline jint _Atomic_xchg(jint exchange_value, volatile jint* dest) {
- __asm__ __volatile__ ("xchgl (%2),%0"
- : "=r" (exchange_value)
- : "0" (exchange_value), "r" (dest)
- : "memory");
- return exchange_value;
- }
-
- inline jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value) {
- __asm__ volatile ("lock cmpxchgl %1,(%3)"
- : "=a" (exchange_value)
- : "r" (exchange_value), "a" (compare_value), "r" (dest)
- : "cc", "memory");
- return exchange_value;
- }
-
-
- inline jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
- __asm__ volatile ("lock cmpxchgb %1,(%3)"
- : "=a" (exchange_value)
- : "q" (exchange_value), "a" (compare_value), "r" (dest)
- : "cc", "memory");
- return exchange_value;
- }
-
- // This is the interface to the atomic instruction in solaris_i486.s.
- jlong _Atomic_cmpxchg_long_gcc(jlong exchange_value, volatile jlong* dest, jlong compare_value);
-
- inline jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
- #ifdef AMD64
- __asm__ __volatile__ ("lock cmpxchgq %1,(%3)"
- : "=a" (exchange_value)
- : "r" (exchange_value), "a" (compare_value), "r" (dest)
- : "cc", "memory");
- return exchange_value;
- #else
- return _Atomic_cmpxchg_long_gcc(exchange_value, dest, compare_value);
-
- #if 0
- // The code below does not work presumably because of the bug in gcc
- // The error message says:
- // can't find a register in class BREG while reloading asm
- // However I want to save this code and later replace _Atomic_cmpxchg_long_gcc
- // with such inline asm code:
-
- volatile jlong_accessor evl, cvl, rv;
- evl.long_value = exchange_value;
- cvl.long_value = compare_value;
-
- __asm__ volatile (
- "lock cmpxchg8b (%%edi)\n\t"
- : "=a"(cvl.words[0]), "=d"(cvl.words[1])
- : "a"(cvl.words[0]), "d"(cvl.words[1]),
- "b"(evl.words[0]), "c"(evl.words[1]),
- "D"(dest)
- : "cc", "memory");
- return cvl.long_value;
- #endif // if 0
- #endif // AMD64
- }
- }
-
- #endif // _GNU_SOURCE
#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
--- 159,165 ----
< prev index next >