133N/A/*
1631N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
133N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
133N/A *
133N/A * This code is free software; you can redistribute it and/or modify it
133N/A * under the terms of the GNU General Public License version 2 only, as
133N/A * published by the Free Software Foundation.
133N/A *
133N/A * This code is distributed in the hope that it will be useful, but WITHOUT
133N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
133N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
133N/A * version 2 for more details (a copy is included in the LICENSE file that
133N/A * accompanied this code).
133N/A *
133N/A * You should have received a copy of the GNU General Public License version
133N/A * 2 along with this work; if not, write to the Free Software Foundation,
133N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
133N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
133N/A *
133N/A */
133N/A
1879N/A#ifndef OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP
1879N/A#define OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP
1879N/A
1879N/A#include "runtime/orderAccess.hpp"
1879N/A#include "vm_version_sparc.hpp"
1879N/A
133N/A// Implementation of class OrderAccess.
133N/A
133N/A// Assume TSO.
133N/A
133N/Ainline void OrderAccess::loadload() { acquire(); }
133N/Ainline void OrderAccess::storestore() { release(); }
133N/Ainline void OrderAccess::loadstore() { acquire(); }
133N/Ainline void OrderAccess::storeload() { fence(); }
133N/A
133N/Ainline void OrderAccess::acquire() {
133N/A __asm__ volatile ("nop" : : :);
133N/A}
133N/A
133N/Ainline void OrderAccess::release() {
1631N/A jint* local_dummy = (jint*)&local_dummy;
1631N/A __asm__ volatile("stw %%g0, [%0]" : : "r" (local_dummy) : "memory");
133N/A}
133N/A
133N/Ainline void OrderAccess::fence() {
133N/A __asm__ volatile ("membar #StoreLoad" : : :);
133N/A}
133N/A
133N/Ainline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
133N/Ainline jshort OrderAccess::load_acquire(volatile jshort* p) { return *p; }
133N/Ainline jint OrderAccess::load_acquire(volatile jint* p) { return *p; }
133N/Ainline jlong OrderAccess::load_acquire(volatile jlong* p) { return *p; }
133N/Ainline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; }
133N/Ainline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
133N/Ainline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
133N/Ainline julong OrderAccess::load_acquire(volatile julong* p) { return *p; }
133N/Ainline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
133N/Ainline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
133N/A
133N/Ainline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
133N/Ainline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
133N/Ainline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
133N/A
133N/Ainline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jshort* p, jshort v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jint* p, jint v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jlong* p, jlong v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile julong* p, julong v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
133N/Ainline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
133N/A
133N/Ainline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
133N/Ainline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
133N/A
133N/Ainline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jshort* p, jshort v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jint* p, jint v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jlong* p, jlong v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jubyte* p, jubyte v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jushort* p, jushort v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(juint* p, juint v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(julong* p, julong v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jfloat* p, jfloat v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_fence(jdouble* p, jdouble v) { *p = v; fence(); }
133N/A
133N/Ainline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) { *p = v; fence(); }
133N/Ainline void OrderAccess::store_ptr_fence(void** p, void* v) { *p = v; fence(); }
133N/A
133N/Ainline void OrderAccess::release_store_fence(volatile jbyte* p, jbyte v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jshort* p, jshort v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jint* p, jint v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile juint* p, juint v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile julong* p, julong v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
133N/A
133N/Ainline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { *p = v; fence(); }
133N/Ainline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { *(void* volatile *)p = v; fence(); }
1879N/A
1879N/A#endif // OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP