annotate src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp @ 12404:47eb670c1634

Merge.
author Christian Humer <christian.humer@gmail.com>
date Mon, 14 Oct 2013 18:48:21 +0200
parents 46c544b8fbfc
children 7f77d17d0f13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
1 /*
8675
63e54c37ac64 8008959: Fix non-PCH build on Linux, Windows and MacOS X
simonis
parents: 2114
diff changeset
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
4 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
7 * published by the Free Software Foundation.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
8 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
13 * accompanied this code).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
14 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
21 * questions.
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
22 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
23 */
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "runtime/atomic.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "runtime/os.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "vm_version_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
32 // Implementation of class atomic
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
33
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
34 inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
35 inline void Atomic::store (jshort store_value, jshort* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
36 inline void Atomic::store (jint store_value, jint* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
37 inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
38 inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
39 inline void Atomic::store_ptr(void* store_value, void* dest) { *(void**)dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
40
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
41 inline void Atomic::store (jbyte store_value, volatile jbyte* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
42 inline void Atomic::store (jshort store_value, volatile jshort* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
43 inline void Atomic::store (jint store_value, volatile jint* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
44 inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
45 inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
46 inline void Atomic::store_ptr(void* store_value, volatile void* dest) { *(void* volatile *)dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
47
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
48 inline void Atomic::inc (volatile jint* dest) { (void)add (1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
49 inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
50 inline void Atomic::inc_ptr(volatile void* dest) { (void)add_ptr(1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
51
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
52 inline void Atomic::dec (volatile jint* dest) { (void)add (-1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
53 inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
54 inline void Atomic::dec_ptr(volatile void* dest) { (void)add_ptr(-1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
55
2114
4fc084dac61e 7009756: volatile variables could be broken throw reflection API
kvn
parents: 1972
diff changeset
56 inline jlong Atomic::load(volatile jlong* src) { return *src; }
4fc084dac61e 7009756: volatile variables could be broken throw reflection API
kvn
parents: 1972
diff changeset
57
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
58 inline jint Atomic::add (jint add_value, volatile jint* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
59 intptr_t rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
60 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
61 "1: \n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
62 " ld [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
63 " add %1, %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
64 " cas [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
65 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
66 " bne 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
67 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
68 " add %1, %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
69 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
70 : "r" (add_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
71 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
72 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
73 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
74
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
75 inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
76 intptr_t rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
77 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
78 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
79 "1: \n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
80 " ldx [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
81 " add %0, %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
82 " casx [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
83 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
84 " bne %%xcc, 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
85 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
86 " add %0, %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
87 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
88 : "r" (add_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
89 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
90 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
91 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
92 "1: \n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
93 " ld [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
94 " add %1, %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
95 " cas [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
96 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
97 " bne 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
98 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
99 " add %1, %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
100 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
101 : "r" (add_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
102 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
103 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
104 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
105 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
106
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
107 inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
108 return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
109 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
110
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
111
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
112 inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
113 intptr_t rv = exchange_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
114 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
115 " swap [%2],%1\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
116 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
117 : "0" (exchange_value) /* we use same register as for return value */, "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
118 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
119 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
120 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
121
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
122 inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
123 intptr_t rv = exchange_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
124 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
125 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
126 "1:\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
127 " mov %1, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
128 " ldx [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
129 " casx [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
130 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
131 " bne %%xcc, 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
132 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
133 " mov %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
134 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
135 : "r" (exchange_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
136 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
137 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
138 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
139 "swap [%2],%1\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
140 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
141 : "0" (exchange_value) /* we use same register as for return value */, "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
142 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
143 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
144 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
145 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
146
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
147 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
148 return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
149 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
150
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
151
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
152 inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
153 jint rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
154 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
155 " cas [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
156 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
157 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
158 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
159 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
160 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
161
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
162 inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
163 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
164 jlong rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
165 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
166 " casx [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
167 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
168 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
169 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
170 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
171 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
172 volatile jlong_accessor evl, cvl, rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
173 evl.long_value = exchange_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
174 cvl.long_value = compare_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
175
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
176 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
177 " sllx %2, 32, %2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
178 " srl %3, 0, %3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
179 " or %2, %3, %2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
180 " sllx %5, 32, %5\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
181 " srl %6, 0, %6\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
182 " or %5, %6, %5\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
183 " casx [%4], %5, %2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
184 " srl %2, 0, %1\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
185 " srlx %2, 32, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
186 : "=r" (rv.words[0]), "=r" (rv.words[1])
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
187 : "r" (evl.words[0]), "r" (evl.words[1]), "r" (dest), "r" (cvl.words[0]), "r" (cvl.words[1])
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
188 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
189
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
190 return rv.long_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
191 #endif
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
192 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
193
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
194 inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
195 intptr_t rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
196 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
197 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
198 " casx [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
199 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
200 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
201 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
202 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
203 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
204 " cas [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
205 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
206 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
207 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
208 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
209 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
210 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
211
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
212 inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
213 return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
214 }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
215
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
216 #endif // OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP