src/share/vm/runtime/atomic.hpp

Tue, 26 Mar 2013 09:06:16 -0400

author
hseigel
date
Tue, 26 Mar 2013 09:06:16 -0400
changeset 4819
36376b540a98
parent 4647
0598674c0056
child 5306
d9eed26d638a
permissions
-rw-r--r--

8009595: The UseSplitVerifier option needs to be deprecated.
Summary: Put UseSplitVerifier option on the deprecated list.
Reviewed-by: dcubed, kmo, acorn

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_RUNTIME_ATOMIC_HPP
stefank@2314 26 #define SHARE_VM_RUNTIME_ATOMIC_HPP
stefank@2314 27
stefank@2314 28 #include "memory/allocation.hpp"
stefank@2314 29
duke@435 30 class Atomic : AllStatic {
duke@435 31 public:
jwilhelm@4647 32 // Atomic operations on jlong types are not available on all 32-bit
jwilhelm@4647 33 // platforms. If atomic ops on jlongs are defined here they must only
jwilhelm@4647 34 // be used from code that verifies they are available at runtime and
jwilhelm@4647 35 // can provide an alternative action if not - see supports_cx8() for
jwilhelm@4647 36 // a means to test availability.
jwilhelm@4647 37
duke@435 38 // Atomically store to a location
twisti@4318 39 inline static void store (jbyte store_value, jbyte* dest);
twisti@4318 40 inline static void store (jshort store_value, jshort* dest);
twisti@4318 41 inline static void store (jint store_value, jint* dest);
jwilhelm@4647 42 // See comment above about using jlong atomics on 32-bit platforms
twisti@4318 43 inline static void store (jlong store_value, jlong* dest);
twisti@4318 44 inline static void store_ptr(intptr_t store_value, intptr_t* dest);
twisti@4318 45 inline static void store_ptr(void* store_value, void* dest);
duke@435 46
twisti@4318 47 inline static void store (jbyte store_value, volatile jbyte* dest);
twisti@4318 48 inline static void store (jshort store_value, volatile jshort* dest);
twisti@4318 49 inline static void store (jint store_value, volatile jint* dest);
jwilhelm@4647 50 // See comment above about using jlong atomics on 32-bit platforms
twisti@4318 51 inline static void store (jlong store_value, volatile jlong* dest);
twisti@4318 52 inline static void store_ptr(intptr_t store_value, volatile intptr_t* dest);
twisti@4318 53 inline static void store_ptr(void* store_value, volatile void* dest);
duke@435 54
jwilhelm@4647 55 // See comment above about using jlong atomics on 32-bit platforms
twisti@4318 56 inline static jlong load(volatile jlong* src);
kvn@1329 57
duke@435 58 // Atomically add to a location, return updated value
twisti@4318 59 inline static jint add (jint add_value, volatile jint* dest);
twisti@4318 60 inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest);
twisti@4318 61 inline static void* add_ptr(intptr_t add_value, volatile void* dest);
jwilhelm@4647 62 // See comment above about using jlong atomics on 32-bit platforms
twisti@4318 63 static jlong add (jlong add_value, volatile jlong* dest);
minqi@2964 64
duke@435 65 // Atomically increment location
twisti@4318 66 inline static void inc (volatile jint* dest);
twisti@4318 67 inline static void inc_ptr(volatile intptr_t* dest);
twisti@4318 68 inline static void inc_ptr(volatile void* dest);
duke@435 69
duke@435 70 // Atomically decrement a location
twisti@4318 71 inline static void dec (volatile jint* dest);
twisti@4318 72 inline static void dec_ptr(volatile intptr_t* dest);
twisti@4318 73 inline static void dec_ptr(volatile void* dest);
duke@435 74
duke@435 75 // Performs atomic exchange of *dest with exchange_value. Returns old prior value of *dest.
twisti@4318 76 inline static jint xchg(jint exchange_value, volatile jint* dest);
twisti@4318 77 static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest);
coleenp@548 78
twisti@4318 79 inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest);
twisti@4318 80 inline static void* xchg_ptr(void* exchange_value, volatile void* dest);
duke@435 81
duke@435 82 // Performs atomic compare of *dest and compare_value, and exchanges *dest with exchange_value
duke@435 83 // if the comparison succeeded. Returns prior value of *dest. Guarantees a two-way memory
duke@435 84 // barrier across the cmpxchg. I.e., it's really a 'fence_cmpxchg_acquire'.
twisti@4318 85 static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
twisti@4318 86 inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value);
jwilhelm@4647 87 // See comment above about using jlong atomics on 32-bit platforms
twisti@4318 88 inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value);
coleenp@548 89
twisti@4318 90 static unsigned int cmpxchg(unsigned int exchange_value,
twisti@4318 91 volatile unsigned int* dest,
twisti@4318 92 unsigned int compare_value);
coleenp@548 93
twisti@4318 94 inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value);
twisti@4318 95 inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value);
duke@435 96 };
stefank@2314 97
stefank@2314 98 #endif // SHARE_VM_RUNTIME_ATOMIC_HPP

mercurial