annotate src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp @ 844:bd02caa94611

6862919: Update copyright year Summary: Update copyright for files that have been modified in 2009, up to 07/09 Reviewed-by: tbell, ohair
author xdono
date Tue, 28 Jul 2009 12:12:40 -0700
parents d0994e5bebce
children c18cbe5936b8
rev   line source
duke@0 1 /*
xdono@844 2 * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 // Implementation of class OrderAccess.
duke@0 26
duke@0 27 // For Sun Studio - implementation is in solaris_i486.il.
duke@0 28 // For gcc - implementation is just below.
duke@0 29 extern "C" void _OrderAccess_acquire();
duke@0 30 extern "C" void _OrderAccess_fence();
duke@0 31
duke@0 32 inline void OrderAccess::loadload() { acquire(); }
duke@0 33 inline void OrderAccess::storestore() { release(); }
duke@0 34 inline void OrderAccess::loadstore() { acquire(); }
duke@0 35 inline void OrderAccess::storeload() { fence(); }
duke@0 36
duke@0 37 inline void OrderAccess::acquire() {
duke@0 38 _OrderAccess_acquire();
duke@0 39
duke@0 40 }
duke@0 41
duke@0 42 inline void OrderAccess::release() {
duke@0 43 dummy = 0;
duke@0 44 }
duke@0 45
duke@0 46 inline void OrderAccess::fence() {
duke@0 47 if (os::is_MP()) {
duke@0 48 _OrderAccess_fence();
duke@0 49 }
duke@0 50 }
duke@0 51
duke@0 52 #ifdef _GNU_SOURCE
duke@0 53
duke@0 54 extern "C" {
duke@0 55 inline void _OrderAccess_acquire() {
duke@0 56 volatile intptr_t dummy;
duke@0 57 #ifdef AMD64
duke@0 58 __asm__ volatile ("movq 0(%%rsp), %0" : "=r" (dummy) : : "memory");
duke@0 59 #else
duke@0 60 __asm__ volatile ("movl 0(%%esp),%0" : "=r" (dummy) : : "memory");
duke@0 61 #endif // AMD64
duke@0 62 }
duke@0 63 inline void _OrderAccess_fence() {
never@671 64 // Always use locked addl since mfence is sometimes expensive
duke@0 65 __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
duke@0 66 }
duke@0 67
duke@0 68 }
duke@0 69
duke@0 70 #endif // GNU_SOURCE
duke@0 71
duke@0 72 inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
duke@0 73 inline jshort OrderAccess::load_acquire(volatile jshort* p) { return *p; }
duke@0 74 inline jint OrderAccess::load_acquire(volatile jint* p) { return *p; }
duke@0 75 inline jlong OrderAccess::load_acquire(volatile jlong* p) { return *p; }
duke@0 76 inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; }
duke@0 77 inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
duke@0 78 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
duke@0 79 inline julong OrderAccess::load_acquire(volatile julong* p) { return *p; }
duke@0 80 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
duke@0 81 inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
duke@0 82
duke@0 83 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
duke@0 84 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
duke@0 85 inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
duke@0 86
duke@0 87 inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { *p = v; }
duke@0 88 inline void OrderAccess::release_store(volatile jshort* p, jshort v) { *p = v; }
duke@0 89 inline void OrderAccess::release_store(volatile jint* p, jint v) { *p = v; }
duke@0 90 inline void OrderAccess::release_store(volatile jlong* p, jlong v) { *p = v; }
duke@0 91 inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; }
duke@0 92 inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
duke@0 93 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
duke@0 94 inline void OrderAccess::release_store(volatile julong* p, julong v) { *p = v; }
duke@0 95 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
duke@0 96 inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
duke@0 97
duke@0 98 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
duke@0 99 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
duke@0 100
duke@0 101 inline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); }
duke@0 102 inline void OrderAccess::store_fence(jshort* p, jshort v) { *p = v; fence(); }
duke@0 103 inline void OrderAccess::store_fence(jint* p, jint v) { *p = v; fence(); }
duke@0 104 inline void OrderAccess::store_fence(jlong* p, jlong v) { *p = v; fence(); }
duke@0 105 inline void OrderAccess::store_fence(jubyte* p, jubyte v) { *p = v; fence(); }
duke@0 106 inline void OrderAccess::store_fence(jushort* p, jushort v) { *p = v; fence(); }
duke@0 107 inline void OrderAccess::store_fence(juint* p, juint v) { *p = v; fence(); }
duke@0 108 inline void OrderAccess::store_fence(julong* p, julong v) { *p = v; fence(); }
duke@0 109 inline void OrderAccess::store_fence(jfloat* p, jfloat v) { *p = v; fence(); }
duke@0 110 inline void OrderAccess::store_fence(jdouble* p, jdouble v) { *p = v; fence(); }
duke@0 111
duke@0 112 inline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) { *p = v; fence(); }
duke@0 113 inline void OrderAccess::store_ptr_fence(void** p, void* v) { *p = v; fence(); }
duke@0 114
duke@0 115 inline void OrderAccess::release_store_fence(volatile jbyte* p, jbyte v) { *p = v; fence(); }
duke@0 116 inline void OrderAccess::release_store_fence(volatile jshort* p, jshort v) { *p = v; fence(); }
duke@0 117 inline void OrderAccess::release_store_fence(volatile jint* p, jint v) { *p = v; fence(); }
duke@0 118 inline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { *p = v; fence(); }
duke@0 119 inline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { *p = v; fence(); }
duke@0 120 inline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); }
duke@0 121 inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { *p = v; fence(); }
duke@0 122 inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { *p = v; fence(); }
duke@0 123 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); }
duke@0 124 inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
duke@0 125
duke@0 126 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { *p = v; fence(); }
duke@0 127 inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { *(void* volatile *)p = v; fence(); }