annotate src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents 435e64505015
children c18cbe5936b8
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 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 133
diff changeset
2 * Copyright 1999-2008 Sun Microsystems, Inc. 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 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
21 * have any questions.
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
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
25 // Implementation of class atomic
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
26
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
27 inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
28 inline void Atomic::store (jshort store_value, jshort* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
29 inline void Atomic::store (jint store_value, jint* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
30 inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
31 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
32 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
33
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
34 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
35 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
36 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
37 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
38 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
39 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
40
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
41 inline void Atomic::inc (volatile jint* dest) { (void)add (1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
42 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
43 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
44
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
45 inline void Atomic::dec (volatile jint* dest) { (void)add (-1, dest); }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
46 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
47 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
48
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
49 inline jint Atomic::add (jint add_value, volatile jint* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
50 intptr_t rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
51 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
52 "1: \n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
53 " ld [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
54 " add %1, %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
55 " cas [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
56 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
57 " bne 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
58 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
59 " add %1, %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
60 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
61 : "r" (add_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
62 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
63 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
64 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
65
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
66 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
67 intptr_t rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
68 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
69 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
70 "1: \n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
71 " ldx [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
72 " add %0, %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
73 " casx [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
74 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
75 " bne %%xcc, 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
76 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
77 " add %0, %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
78 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
79 : "r" (add_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
80 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
81 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
82 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
83 "1: \n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
84 " ld [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
85 " add %1, %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
86 " cas [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
87 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
88 " bne 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
89 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
90 " add %1, %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
91 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
92 : "r" (add_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
93 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
94 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
95 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
96 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
97
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
98 inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
99 return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
100 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
101
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
102
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
103 inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
104 intptr_t rv = exchange_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
105 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
106 " swap [%2],%1\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
107 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
108 : "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
109 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
110 return rv;
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
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
113 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
114 intptr_t rv = exchange_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
115 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
116 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
117 "1:\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
118 " mov %1, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
119 " ldx [%2], %%o2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
120 " casx [%2], %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
121 " cmp %%o2, %%o3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
122 " bne %%xcc, 1b\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
123 " nop\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
124 " mov %%o2, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
125 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
126 : "r" (exchange_value), "r" (dest)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
127 : "memory", "o2", "o3");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
128 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
129 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
130 "swap [%2],%1\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
131 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
132 : "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
133 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
134 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
135 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
136 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
137
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
138 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
139 return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
140 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
141
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
142
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
143 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
144 jint rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
145 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
146 " cas [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
147 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
148 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
149 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
150 return rv;
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
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
153 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
154 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
155 jlong rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
156 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
157 " casx [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
158 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
159 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
160 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
161 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
162 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
163 assert(VM_Version::v9_instructions_work(), "cas only supported on v9");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
164 volatile jlong_accessor evl, cvl, rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
165 evl.long_value = exchange_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
166 cvl.long_value = compare_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
167
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
168 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
169 " sllx %2, 32, %2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
170 " srl %3, 0, %3\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
171 " or %2, %3, %2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
172 " sllx %5, 32, %5\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
173 " srl %6, 0, %6\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
174 " or %5, %6, %5\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
175 " casx [%4], %5, %2\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
176 " srl %2, 0, %1\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
177 " srlx %2, 32, %0\n\t"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
178 : "=r" (rv.words[0]), "=r" (rv.words[1])
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
179 : "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
180 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
181
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
182 return rv.long_value;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
183 #endif
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
184 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
185
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
186 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
187 intptr_t rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
188 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
189 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
190 " casx [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
191 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
192 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
193 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
194 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
195 __asm__ volatile(
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
196 " cas [%2], %3, %0"
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
197 : "=r" (rv)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
198 : "0" (exchange_value), "r" (dest), "r" (compare_value)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
199 : "memory");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
200 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
201 return rv;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
202 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
203
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
204 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
205 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
206 }