orderAccess_solaris_sparc.inline.hpp revision 0
0N/A/*
0N/A * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/A// Implementation of class OrderAccess.
0N/A
0N/A// Assume TSO.
0N/A
0N/A// In solaris_sparc.il
0N/Aextern "C" void _OrderAccess_acquire();
0N/Aextern "C" void _OrderAccess_fence();
0N/A
0N/Ainline void OrderAccess::loadload() { acquire(); }
0N/Ainline void OrderAccess::storestore() { release(); }
0N/Ainline void OrderAccess::loadstore() { acquire(); }
0N/Ainline void OrderAccess::storeload() { fence(); }
0N/A
0N/A#ifdef _GNU_SOURCE
0N/A
0N/Ainline void OrderAccess::acquire() {
0N/A __asm__ volatile ("nop" : : :);
0N/A}
0N/A
0N/Ainline void OrderAccess::release() {
0N/A jint* dummy = (jint*)&dummy;
0N/A __asm__ volatile("stw %%g0, [%0]" : : "r" (dummy) : "memory");
0N/A}
0N/A
0N/Ainline void OrderAccess::fence() {
0N/A __asm__ volatile ("membar #StoreLoad" : : :);
0N/A}
0N/A
0N/A#else // _GNU_SOURCE
0N/A
0N/Ainline void OrderAccess::acquire() {
0N/A _OrderAccess_acquire();
0N/A}
0N/A
0N/Ainline void OrderAccess::release() {
0N/A dummy = 0;
0N/A}
0N/A
0N/A#if defined(COMPILER2) || defined(_LP64)
0N/A
0N/Ainline void OrderAccess::fence() {
0N/A _OrderAccess_fence();
0N/A}
0N/A
0N/A#else // defined(COMPILER2) || defined(_LP64)
0N/A
0N/Ainline void OrderAccess::fence() {
0N/A if (os::is_MP()) {
0N/A (*os::fence_func)();
0N/A }
0N/A}
0N/A
0N/A#endif // defined(COMPILER2) || defined(_LP64)
0N/A
0N/A#endif // _GNU_SOURCE
0N/A
0N/Ainline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
0N/Ainline jshort OrderAccess::load_acquire(volatile jshort* p) { return *p; }
0N/Ainline jint OrderAccess::load_acquire(volatile jint* p) { return *p; }
0N/Ainline jlong OrderAccess::load_acquire(volatile jlong* p) { return *p; }
0N/Ainline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; }
0N/Ainline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
0N/Ainline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
0N/Ainline julong OrderAccess::load_acquire(volatile julong* p) { return *p; }
0N/Ainline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
0N/Ainline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
0N/A
0N/Ainline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
0N/Ainline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
0N/Ainline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
0N/A
0N/Ainline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jshort* p, jshort v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jint* p, jint v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jlong* p, jlong v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile julong* p, julong v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
0N/Ainline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
0N/A
0N/Ainline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
0N/Ainline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
0N/A
0N/Ainline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jshort* p, jshort v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jint* p, jint v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jlong* p, jlong v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jubyte* p, jubyte v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jushort* p, jushort v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(juint* p, juint v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(julong* p, julong v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jfloat* p, jfloat v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_fence(jdouble* p, jdouble v) { *p = v; fence(); }
0N/A
0N/Ainline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) { *p = v; fence(); }
0N/Ainline void OrderAccess::store_ptr_fence(void** p, void* v) { *p = v; fence(); }
0N/A
0N/Ainline void OrderAccess::release_store_fence(volatile jbyte* p, jbyte v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jshort* p, jshort v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jint* p, jint v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile juint* p, juint v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile julong* p, julong v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
0N/A
0N/Ainline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { *p = v; fence(); }
0N/Ainline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { *(void* volatile *)p = v; fence(); }