< prev index next >

src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp

Print this page
rev 13267 : [mq]: Atomic_polishing

*** 903,965 **** // These routines are the initial value of atomic_xchg_entry(), // atomic_cmpxchg_entry(), atomic_inc_entry() and fence_entry() // until initialization is complete. // TODO - replace with .il implementation when compiler supports it. ! typedef jint xchg_func_t (jint, volatile jint*); ! typedef jint cmpxchg_func_t (jint, volatile jint*, jint); ! typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong); ! typedef jint add_func_t (jint, volatile jint*); ! jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { // try to use the stub: xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry()); if (func != NULL) { os::atomic_xchg_func = func; return (*func)(exchange_value, dest); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); ! jint old_value = *dest; *dest = exchange_value; return old_value; } ! jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) { // try to use the stub: cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); if (func != NULL) { os::atomic_cmpxchg_func = func; return (*func)(exchange_value, dest, compare_value); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); ! jint old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } ! jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) { // try to use the stub: cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); if (func != NULL) { os::atomic_cmpxchg_long_func = func; return (*func)(exchange_value, dest, compare_value); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); ! jlong old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } ! jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) { // try to use the stub: add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry()); if (func != NULL) { os::atomic_add_func = func; --- 903,965 ---- // These routines are the initial value of atomic_xchg_entry(), // atomic_cmpxchg_entry(), atomic_inc_entry() and fence_entry() // until initialization is complete. // TODO - replace with .il implementation when compiler supports it. ! typedef int32_t xchg_func_t (int32_t, volatile int32_t*); ! typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t); ! typedef int64_t cmpxchg_long_func_t(int64_t, volatile int64_t*, int64_t); ! typedef int32_t add_func_t (int32_t, volatile int32_t*); ! int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) { // try to use the stub: xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry()); if (func != NULL) { os::atomic_xchg_func = func; return (*func)(exchange_value, dest); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); ! int32_t old_value = *dest; *dest = exchange_value; return old_value; } ! int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) { // try to use the stub: cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); if (func != NULL) { os::atomic_cmpxchg_func = func; return (*func)(exchange_value, dest, compare_value); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); ! int32_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } ! int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) { // try to use the stub: cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); if (func != NULL) { os::atomic_cmpxchg_long_func = func; return (*func)(exchange_value, dest, compare_value); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); ! int64_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } ! int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) { // try to use the stub: add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry()); if (func != NULL) { os::atomic_add_func = func;
< prev index next >