hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
changeset 7885 c02b05ba16a1
parent 7397 5b173b4ca846
child 15855 2ac9ebea17f3
equal deleted inserted replaced
7884:10a0fafc26aa 7885:c02b05ba16a1
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   135 
   135 
   136 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
   136 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
   137   return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
   137   return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
   138 }
   138 }
   139 
   139 
       
   140 inline jlong Atomic::load(volatile jlong* src) { return *src; }
       
   141 
   140 #else // !AMD64
   142 #else // !AMD64
   141 
   143 
   142 //inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
       
   143 //inline void Atomic::store  (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
       
   144 inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
   144 inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
   145   int mp = os::is_MP();
   145   int mp = os::is_MP();
   146   __asm {
   146   __asm {
   147     mov edx, dest;
   147     mov edx, dest;
   148     mov eax, add_value;
   148     mov eax, add_value;
   252 }
   252 }
   253 
   253 
   254 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
   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);
   255   return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
   256 }
   256 }
       
   257 
       
   258 inline jlong Atomic::load(volatile jlong* src) {
       
   259   volatile jlong dest;
       
   260   volatile jlong* pdest = &dest;
       
   261   __asm {
       
   262     mov eax, src
       
   263     fild     qword ptr [eax]
       
   264     mov eax, pdest
       
   265     fistp    qword ptr [eax]
       
   266   }
       
   267   return dest;
       
   268 }
       
   269 
       
   270 inline void Atomic::store(jlong store_value, volatile jlong* dest) {
       
   271   volatile jlong* src = &store_value;
       
   272   __asm {
       
   273     mov eax, src
       
   274     fild     qword ptr [eax]
       
   275     mov eax, dest
       
   276     fistp    qword ptr [eax]
       
   277   }
       
   278 }
       
   279 
       
   280 inline void Atomic::store(jlong store_value, jlong* dest) {
       
   281   Atomic::store(store_value, (volatile jlong*)dest);
       
   282 }
       
   283 
   257 #endif // AMD64
   284 #endif // AMD64
   258 
   285 
   259 #pragma warning(default: 4035) // Enables warnings reporting missing return statement
   286 #pragma warning(default: 4035) // Enables warnings reporting missing return statement
   260 
   287 
   261 #endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
   288 #endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP