src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2009, 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 inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
  26 inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
  27 inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
  28 
  29 
  30 inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
  31 inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
  32 
  33 inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
  34 inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
  35 inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
  36 inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
  37 inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
  38 
  39 inline void Atomic::inc    (volatile jint*     dest) { (void)add    (1, dest); }
  40 inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
  41 inline void Atomic::inc_ptr(volatile void*     dest) { (void)add_ptr(1, dest); }
  42 
  43 inline void Atomic::dec    (volatile jint*     dest) { (void)add    (-1, dest); }
  44 inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }


 228     cvl.long_value = compare_value;
 229     int mp = os::is_MP();
 230 
 231     __asm__ volatile ("cmp $0, %%esi\n\t"
 232        "je 1f \n\t"
 233        "lock\n\t"
 234        "1: cmpxchg8b (%%edi)\n\t"
 235        : "=a"(cvl.words[0]),   "=d"(cvl.words[1])
 236        : "a"(cvl.words[0]), "d"(cvl.words[1]),
 237          "b"(evl.words[0]), "c"(evl.words[1]),
 238          "D"(dest), "S"(mp)
 239        :  "cc", "memory");
 240     return cvl.long_value;
 241     #endif // if 0
 242 #endif // AMD64
 243   }
 244 }
 245 #undef LOCK_IF_MP
 246 
 247 #endif // _GNU_SOURCE


   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_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP
  26 #define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP
  27 
  28 #include "orderAccess_solaris_x86.inline.hpp"
  29 #include "runtime/atomic.hpp"
  30 #include "runtime/os.hpp"
  31 #include "vm_version_x86.hpp"
  32 
  33 inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
  34 inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
  35 inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
  36 
  37 
  38 inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
  39 inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
  40 
  41 inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
  42 inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
  43 inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
  44 inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
  45 inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
  46 
  47 inline void Atomic::inc    (volatile jint*     dest) { (void)add    (1, dest); }
  48 inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
  49 inline void Atomic::inc_ptr(volatile void*     dest) { (void)add_ptr(1, dest); }
  50 
  51 inline void Atomic::dec    (volatile jint*     dest) { (void)add    (-1, dest); }
  52 inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }


 236     cvl.long_value = compare_value;
 237     int mp = os::is_MP();
 238 
 239     __asm__ volatile ("cmp $0, %%esi\n\t"
 240        "je 1f \n\t"
 241        "lock\n\t"
 242        "1: cmpxchg8b (%%edi)\n\t"
 243        : "=a"(cvl.words[0]),   "=d"(cvl.words[1])
 244        : "a"(cvl.words[0]), "d"(cvl.words[1]),
 245          "b"(evl.words[0]), "c"(evl.words[1]),
 246          "D"(dest), "S"(mp)
 247        :  "cc", "memory");
 248     return cvl.long_value;
 249     #endif // if 0
 250 #endif // AMD64
 251   }
 252 }
 253 #undef LOCK_IF_MP
 254 
 255 #endif // _GNU_SOURCE
 256 
 257 #endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP