hotspot/src/share/vm/runtime/orderAccess.inline.hpp
author goetz
Sun, 20 Dec 2015 10:37:23 -0500
changeset 35201 996db89f378e
parent 29459 d6252edb4fca
child 35594 cc13089c6327
permissions -rw-r--r--
8139864: Improve handling of stack protection zones. Reviewed-by: stuefe, coleenp, fparain
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24351
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     1
/*
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
24351
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     3
 * Copyright 2014 SAP AG. All rights reserved.
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     5
 *
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
     9
 *
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    14
 * accompanied this code).
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    15
 *
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    19
 *
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    22
 * questions.
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    23
 *
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    24
 */
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    25
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    26
#ifndef SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    27
#define SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    28
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    29
#include "runtime/atomic.inline.hpp"
24351
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    30
#include "runtime/orderAccess.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    31
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    32
// Linux
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    33
#ifdef TARGET_OS_ARCH_linux_x86
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    34
# include "orderAccess_linux_x86.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    35
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    36
#ifdef TARGET_OS_ARCH_linux_sparc
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    37
# include "orderAccess_linux_sparc.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    38
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    39
#ifdef TARGET_OS_ARCH_linux_zero
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    40
# include "orderAccess_linux_zero.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    41
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    42
#ifdef TARGET_OS_ARCH_linux_arm
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    43
# include "orderAccess_linux_arm.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    44
#endif
29180
50369728b00e 8064611: AARCH64: Changes to HotSpot shared code
aph
parents: 24351
diff changeset
    45
#ifdef TARGET_OS_ARCH_linux_aarch64
50369728b00e 8064611: AARCH64: Changes to HotSpot shared code
aph
parents: 24351
diff changeset
    46
# include "orderAccess_linux_aarch64.inline.hpp"
50369728b00e 8064611: AARCH64: Changes to HotSpot shared code
aph
parents: 24351
diff changeset
    47
#endif
24351
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    48
#ifdef TARGET_OS_ARCH_linux_ppc
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    49
# include "orderAccess_linux_ppc.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    50
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    51
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    52
// Solaris
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    53
#ifdef TARGET_OS_ARCH_solaris_x86
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    54
# include "orderAccess_solaris_x86.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    55
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    56
#ifdef TARGET_OS_ARCH_solaris_sparc
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    57
# include "orderAccess_solaris_sparc.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    58
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    59
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    60
// Windows
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    61
#ifdef TARGET_OS_ARCH_windows_x86
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    62
# include "orderAccess_windows_x86.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    63
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    64
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    65
// AIX
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    66
#ifdef TARGET_OS_ARCH_aix_ppc
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    67
# include "orderAccess_aix_ppc.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    68
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    69
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    70
// BSD
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    71
#ifdef TARGET_OS_ARCH_bsd_x86
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    72
# include "orderAccess_bsd_x86.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    73
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    74
#ifdef TARGET_OS_ARCH_bsd_zero
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    75
# include "orderAccess_bsd_zero.inline.hpp"
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    76
#endif
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
    77
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    78
#ifdef VM_HAS_GENERALIZED_ORDER_ACCESS
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    79
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    80
template<> inline void ScopedFenceGeneral<X_ACQUIRE>::postfix()       { OrderAccess::acquire(); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    81
template<> inline void ScopedFenceGeneral<RELEASE_X>::prefix()        { OrderAccess::release(); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    82
template<> inline void ScopedFenceGeneral<RELEASE_X_FENCE>::prefix()  { OrderAccess::release(); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    83
template<> inline void ScopedFenceGeneral<RELEASE_X_FENCE>::postfix() { OrderAccess::fence();   }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    84
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    85
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    86
template <typename FieldType, ScopedFenceType FenceType>
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    87
inline void OrderAccess::ordered_store(volatile FieldType* p, FieldType v) {
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    88
  ScopedFence<FenceType> f((void*)p);
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    89
  store(p, v);
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    90
}
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    91
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    92
template <typename FieldType, ScopedFenceType FenceType>
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    93
inline FieldType OrderAccess::ordered_load(volatile FieldType* p) {
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    94
  ScopedFence<FenceType> f((void*)p);
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    95
  return load(p);
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    96
}
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    97
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    98
inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
    99
inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   100
inline jint     OrderAccess::load_acquire(volatile jint*    p) { return specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   101
inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   102
inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   103
inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   104
inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return (jubyte) specialized_load_acquire((volatile jbyte*)p);  }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   105
inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return (jushort)specialized_load_acquire((volatile jshort*)p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   106
inline juint    OrderAccess::load_acquire(volatile juint*   p) { return (juint)  specialized_load_acquire((volatile jint*)p);   }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   107
inline julong   OrderAccess::load_acquire(volatile julong*  p) { return (julong) specialized_load_acquire((volatile jlong*)p);  }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   108
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   109
inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t*   p) { return (intptr_t)specialized_load_acquire(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   110
inline void*    OrderAccess::load_ptr_acquire(volatile void*       p) { return (void*)specialized_load_acquire((volatile intptr_t*)p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   111
inline void*    OrderAccess::load_ptr_acquire(const volatile void* p) { return (void*)specialized_load_acquire((volatile intptr_t*)p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   112
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   113
inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   114
inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   115
inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   116
inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   117
inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   118
inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   119
inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { specialized_release_store((volatile jbyte*) p, (jbyte) v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   120
inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { specialized_release_store((volatile jshort*)p, (jshort)v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   121
inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { specialized_release_store((volatile jint*)  p, (jint)  v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   122
inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { specialized_release_store((volatile jlong*) p, (jlong) v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   123
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   124
inline void     OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { specialized_release_store(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   125
inline void     OrderAccess::release_store_ptr(volatile void*     p, void*    v) { specialized_release_store((volatile intptr_t*)p, (intptr_t)v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   126
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   127
inline void     OrderAccess::release_store_fence(volatile jbyte*   p, jbyte   v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   128
inline void     OrderAccess::release_store_fence(volatile jshort*  p, jshort  v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   129
inline void     OrderAccess::release_store_fence(volatile jint*    p, jint    v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   130
inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   131
inline void     OrderAccess::release_store_fence(volatile jfloat*  p, jfloat  v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   132
inline void     OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   133
inline void     OrderAccess::release_store_fence(volatile jubyte*  p, jubyte  v) { specialized_release_store_fence((volatile jbyte*) p, (jbyte) v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   134
inline void     OrderAccess::release_store_fence(volatile jushort* p, jushort v) { specialized_release_store_fence((volatile jshort*)p, (jshort)v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   135
inline void     OrderAccess::release_store_fence(volatile juint*   p, juint   v) { specialized_release_store_fence((volatile jint*)  p, (jint)  v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   136
inline void     OrderAccess::release_store_fence(volatile julong*  p, julong  v) { specialized_release_store_fence((volatile jlong*) p, (jlong) v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   137
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   138
inline void     OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { specialized_release_store_fence(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   139
inline void     OrderAccess::release_store_ptr_fence(volatile void*     p, void*    v) { specialized_release_store_fence((volatile intptr_t*)p, (intptr_t)v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   140
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   141
// The following methods can be specialized using simple template specialization
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   142
// in the platform specific files for optimization purposes. Otherwise the
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   143
// generalized variant is used.
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   144
template<typename T> inline T    OrderAccess::specialized_load_acquire       (volatile T* p)       { return ordered_load<T, X_ACQUIRE>(p);    }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   145
template<typename T> inline void OrderAccess::specialized_release_store      (volatile T* p, T v)  { ordered_store<T, RELEASE_X>(p, v);       }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   146
template<typename T> inline void OrderAccess::specialized_release_store_fence(volatile T* p, T v)  { ordered_store<T, RELEASE_X_FENCE>(p, v); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   147
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   148
// Generalized atomic volatile accesses valid in OrderAccess
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   149
// All other types can be expressed in terms of these.
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   150
inline void OrderAccess::store(volatile jbyte*   p, jbyte   v) { *p = v; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   151
inline void OrderAccess::store(volatile jshort*  p, jshort  v) { *p = v; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   152
inline void OrderAccess::store(volatile jint*    p, jint    v) { *p = v; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   153
inline void OrderAccess::store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   154
inline void OrderAccess::store(volatile jdouble* p, jdouble v) { Atomic::store(jlong_cast(v), (volatile jlong*)p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   155
inline void OrderAccess::store(volatile jfloat*  p, jfloat  v) { *p = v; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   156
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   157
inline jbyte   OrderAccess::load(volatile jbyte*   p) { return *p; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   158
inline jshort  OrderAccess::load(volatile jshort*  p) { return *p; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   159
inline jint    OrderAccess::load(volatile jint*    p) { return *p; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   160
inline jlong   OrderAccess::load(volatile jlong*   p) { return Atomic::load(p); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   161
inline jdouble OrderAccess::load(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   162
inline jfloat  OrderAccess::load(volatile jfloat*  p) { return *p; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   163
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   164
#endif // VM_HAS_GENERALIZED_ORDER_ACCESS
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 24351
diff changeset
   165
24351
61b33cc6d3cf 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
diff changeset
   166
#endif // SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP