< prev index next >
src/os_cpu/bsd_x86/vm/atomic_bsd_x86.hpp
Print this page
@@ -40,37 +40,31 @@
inline void Atomic::store (jint store_value, volatile jint* dest) { *dest = store_value; }
inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
inline void Atomic::store_ptr(void* store_value, volatile void* dest) { *(void* volatile *)dest = store_value; }
-// Adding a lock prefix to an instruction on MP machine
-#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
-
inline jint Atomic::add (jint add_value, volatile jint* dest) {
jint addend = add_value;
- int mp = os::is_MP();
- __asm__ volatile ( LOCK_IF_MP(%3) "xaddl %0,(%2)"
+ __asm__ volatile ( "lock xaddl %0,(%2)"
: "=r" (addend)
- : "0" (addend), "r" (dest), "r" (mp)
+ : "0" (addend), "r" (dest)
: "cc", "memory");
return addend + add_value;
}
inline void Atomic::inc (volatile jint* dest) {
- int mp = os::is_MP();
- __asm__ volatile (LOCK_IF_MP(%1) "addl $1,(%0)" :
- : "r" (dest), "r" (mp) : "cc", "memory");
+ __asm__ volatile ( "lock addl $1,(%0)" :
+ : "r" (dest) : "cc", "memory");
}
inline void Atomic::inc_ptr(volatile void* dest) {
inc_ptr((volatile intptr_t*)dest);
}
inline void Atomic::dec (volatile jint* dest) {
- int mp = os::is_MP();
- __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
- : "r" (dest), "r" (mp) : "cc", "memory");
+ __asm__ volatile ( "lock subl $1,(%0)" :
+ : "r" (dest) : "cc", "memory");
}
inline void Atomic::dec_ptr(volatile void* dest) {
dec_ptr((volatile intptr_t*)dest);
}
@@ -87,58 +81,53 @@
return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
}
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
- int mp = os::is_MP();
- __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+ __asm__ volatile ( "lock cmpxchgb %1,(%3)"
: "=a" (exchange_value)
- : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+ : "q" (exchange_value), "a" (compare_value), "r" (dest)
: "cc", "memory");
return exchange_value;
}
inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
- int mp = os::is_MP();
- __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
+ __asm__ volatile ( "lock cmpxchgl %1,(%3)"
: "=a" (exchange_value)
- : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+ : "r" (exchange_value), "a" (compare_value), "r" (dest)
: "cc", "memory");
return exchange_value;
}
#ifdef AMD64
inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
intptr_t addend = add_value;
- bool mp = os::is_MP();
- __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
+ __asm__ __volatile__ ( "lock xaddq %0,(%2)"
: "=r" (addend)
- : "0" (addend), "r" (dest), "r" (mp)
+ : "0" (addend), "r" (dest)
: "cc", "memory");
return addend + add_value;
}
inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
}
inline void Atomic::inc_ptr(volatile intptr_t* dest) {
- bool mp = os::is_MP();
- __asm__ __volatile__ (LOCK_IF_MP(%1) "addq $1,(%0)"
+ __asm__ __volatile__ ( "lock addq $1,(%0)"
:
: "r" (dest), "r" (mp)
: "cc", "memory");
}
inline void Atomic::dec_ptr(volatile intptr_t* dest) {
- bool mp = os::is_MP();
- __asm__ __volatile__ (LOCK_IF_MP(%1) "subq $1,(%0)"
+ __asm__ __volatile__ ( "lock subq $1,(%0)"
:
- : "r" (dest), "r" (mp)
+ : "r" (dest)
: "cc", "memory");
}
inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
__asm__ __volatile__ ("xchgq (%2),%0"
@@ -147,14 +136,13 @@
: "memory");
return exchange_value;
}
inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
- bool mp = os::is_MP();
- __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
+ __asm__ __volatile__ ( "lock cmpxchgq %1,(%3)"
: "=a" (exchange_value)
- : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+ : "r" (exchange_value), "a" (compare_value), "r" (dest)
: "cc", "memory");
return exchange_value;
}
inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
< prev index next >