1 /*
2 * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // The following alternative implementations are needed because
26 // Windows 95 doesn't support (some of) the corresponding Windows NT
27 // calls. Furthermore, these versions allow inlining in the caller.
28 // (More precisely: The documentation for InterlockedExchange says
29 // it is supported for Windows 95. However, when single-stepping
30 // through the assembly code we cannot step into the routine and
31 // when looking at the routine address we see only garbage code.
32 // Better safe then sorry!). Was bug 7/31/98 (gri).
33 //
34 // Performance note: On uniprocessors, the 'lock' prefixes are not
35 // necessary (and expensive). We should generate separate cases if
36 // this becomes a performance problem.
37
38 #pragma warning(disable: 4035) // Disables warnings reporting missing return statement
39
40 inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; }
41 inline void Atomic::store (jshort store_value, jshort* dest) { *dest = store_value; }
42 inline void Atomic::store (jint store_value, jint* dest) { *dest = store_value; }
43
44 inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
232 mov edi, dest
233 mov ebx, ex_lo
234 mov ecx, ex_hi
235 LOCK_IF_MP(mp)
236 cmpxchg8b qword ptr [edi]
237 pop edi
238 pop ebx
239 }
240 }
241
242 inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
243 return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
244 }
245
246 inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
247 return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
248 }
249 #endif // AMD64
250
251 #pragma warning(default: 4035) // Enables warnings reporting missing return statement
|
1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
26 #define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
27
28 #include "orderAccess_windows_x86.inline.hpp"
29 #include "runtime/atomic.hpp"
30 #include "runtime/os.hpp"
31 #include "vm_version_x86.hpp"
32
33 // The following alternative implementations are needed because
34 // Windows 95 doesn't support (some of) the corresponding Windows NT
35 // calls. Furthermore, these versions allow inlining in the caller.
36 // (More precisely: The documentation for InterlockedExchange says
37 // it is supported for Windows 95. However, when single-stepping
38 // through the assembly code we cannot step into the routine and
39 // when looking at the routine address we see only garbage code.
40 // Better safe then sorry!). Was bug 7/31/98 (gri).
41 //
42 // Performance note: On uniprocessors, the 'lock' prefixes are not
43 // necessary (and expensive). We should generate separate cases if
44 // this becomes a performance problem.
45
46 #pragma warning(disable: 4035) // Disables warnings reporting missing return statement
47
48 inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; }
49 inline void Atomic::store (jshort store_value, jshort* dest) { *dest = store_value; }
50 inline void Atomic::store (jint store_value, jint* dest) { *dest = store_value; }
51
52 inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
240 mov edi, dest
241 mov ebx, ex_lo
242 mov ecx, ex_hi
243 LOCK_IF_MP(mp)
244 cmpxchg8b qword ptr [edi]
245 pop edi
246 pop ebx
247 }
248 }
249
250 inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
251 return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
252 }
253
254 inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
255 return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
256 }
257 #endif // AMD64
258
259 #pragma warning(default: 4035) // Enables warnings reporting missing return statement
260
261 #endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
|