Mercurial > hg > truffle
comparison src/share/vm/runtime/atomic.hpp @ 7212:291ffc492eb6
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 14 Dec 2012 14:35:13 +0100 |
parents | cd3d6a6b95d9 |
children | 0598674c0056 |
comparison
equal
deleted
inserted
replaced
7163:2ed8d74e5984 | 7212:291ffc492eb6 |
---|---|
28 #include "memory/allocation.hpp" | 28 #include "memory/allocation.hpp" |
29 | 29 |
30 class Atomic : AllStatic { | 30 class Atomic : AllStatic { |
31 public: | 31 public: |
32 // Atomically store to a location | 32 // Atomically store to a location |
33 static void store (jbyte store_value, jbyte* dest); | 33 inline static void store (jbyte store_value, jbyte* dest); |
34 static void store (jshort store_value, jshort* dest); | 34 inline static void store (jshort store_value, jshort* dest); |
35 static void store (jint store_value, jint* dest); | 35 inline static void store (jint store_value, jint* dest); |
36 static void store (jlong store_value, jlong* dest); | 36 inline static void store (jlong store_value, jlong* dest); |
37 static void store_ptr(intptr_t store_value, intptr_t* dest); | 37 inline static void store_ptr(intptr_t store_value, intptr_t* dest); |
38 static void store_ptr(void* store_value, void* dest); | 38 inline static void store_ptr(void* store_value, void* dest); |
39 | 39 |
40 static void store (jbyte store_value, volatile jbyte* dest); | 40 inline static void store (jbyte store_value, volatile jbyte* dest); |
41 static void store (jshort store_value, volatile jshort* dest); | 41 inline static void store (jshort store_value, volatile jshort* dest); |
42 static void store (jint store_value, volatile jint* dest); | 42 inline static void store (jint store_value, volatile jint* dest); |
43 static void store (jlong store_value, volatile jlong* dest); | 43 inline static void store (jlong store_value, volatile jlong* dest); |
44 static void store_ptr(intptr_t store_value, volatile intptr_t* dest); | 44 inline static void store_ptr(intptr_t store_value, volatile intptr_t* dest); |
45 static void store_ptr(void* store_value, volatile void* dest); | 45 inline static void store_ptr(void* store_value, volatile void* dest); |
46 | 46 |
47 static jlong load(volatile jlong* src); | 47 inline static jlong load(volatile jlong* src); |
48 | 48 |
49 // Atomically add to a location, return updated value | 49 // Atomically add to a location, return updated value |
50 static jint add (jint add_value, volatile jint* dest); | 50 inline static jint add (jint add_value, volatile jint* dest); |
51 static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest); | 51 inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest); |
52 static void* add_ptr(intptr_t add_value, volatile void* dest); | 52 inline static void* add_ptr(intptr_t add_value, volatile void* dest); |
53 | 53 |
54 static jlong add (jlong add_value, volatile jlong* dest); | 54 static jlong add (jlong add_value, volatile jlong* dest); |
55 | 55 |
56 // Atomically increment location | 56 // Atomically increment location |
57 static void inc (volatile jint* dest); | 57 inline static void inc (volatile jint* dest); |
58 static void inc_ptr(volatile intptr_t* dest); | 58 inline static void inc_ptr(volatile intptr_t* dest); |
59 static void inc_ptr(volatile void* dest); | 59 inline static void inc_ptr(volatile void* dest); |
60 | 60 |
61 // Atomically decrement a location | 61 // Atomically decrement a location |
62 static void dec (volatile jint* dest); | 62 inline static void dec (volatile jint* dest); |
63 static void dec_ptr(volatile intptr_t* dest); | 63 inline static void dec_ptr(volatile intptr_t* dest); |
64 static void dec_ptr(volatile void* dest); | 64 inline static void dec_ptr(volatile void* dest); |
65 | 65 |
66 // Performs atomic exchange of *dest with exchange_value. Returns old prior value of *dest. | 66 // Performs atomic exchange of *dest with exchange_value. Returns old prior value of *dest. |
67 static jint xchg(jint exchange_value, volatile jint* dest); | 67 inline static jint xchg(jint exchange_value, volatile jint* dest); |
68 static unsigned int xchg(unsigned int exchange_value, | 68 static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest); |
69 volatile unsigned int* dest); | |
70 | 69 |
71 static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest); | 70 inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest); |
72 static void* xchg_ptr(void* exchange_value, volatile void* dest); | 71 inline static void* xchg_ptr(void* exchange_value, volatile void* dest); |
73 | 72 |
74 // Performs atomic compare of *dest and compare_value, and exchanges *dest with exchange_value | 73 // Performs atomic compare of *dest and compare_value, and exchanges *dest with exchange_value |
75 // if the comparison succeeded. Returns prior value of *dest. Guarantees a two-way memory | 74 // if the comparison succeeded. Returns prior value of *dest. Guarantees a two-way memory |
76 // barrier across the cmpxchg. I.e., it's really a 'fence_cmpxchg_acquire'. | 75 // barrier across the cmpxchg. I.e., it's really a 'fence_cmpxchg_acquire'. |
77 static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); | 76 static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); |
78 static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); | 77 inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); |
79 static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value); | 78 inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value); |
80 | 79 |
81 static unsigned int cmpxchg(unsigned int exchange_value, | 80 static unsigned int cmpxchg(unsigned int exchange_value, |
82 volatile unsigned int* dest, | 81 volatile unsigned int* dest, |
83 unsigned int compare_value); | 82 unsigned int compare_value); |
84 | 83 |
85 static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value); | 84 inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value); |
86 static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value); | 85 inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value); |
87 }; | 86 }; |
88 | 87 |
89 #endif // SHARE_VM_RUNTIME_ATOMIC_HPP | 88 #endif // SHARE_VM_RUNTIME_ATOMIC_HPP |