< prev index next >

src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp

Print this page
rev 13030 : [mq]: add_const
   1 /*
   2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.


 293 #else
 294 #ifdef M68K
 295   return m68k_compare_and_swap(dest, compare_value, exchange_value);
 296 #else
 297   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 298 #endif // M68K
 299 #endif // ARM
 300 }
 301 
 302 inline void* Atomic::cmpxchg_ptr(void* exchange_value,
 303                                  volatile void* dest,
 304                                  void* compare_value,
 305                                  cmpxchg_memory_order order) {
 306 
 307   return (void *) cmpxchg_ptr((intptr_t) exchange_value,
 308                               (volatile intptr_t*) dest,
 309                               (intptr_t) compare_value,
 310                               order);
 311 }
 312 
 313 inline jlong Atomic::load(volatile jlong* src) {
 314   volatile jlong dest;
 315   os::atomic_copy64(src, &dest);
 316   return dest;
 317 }
 318 
 319 inline void Atomic::store(jlong store_value, jlong* dest) {
 320   os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
 321 }
 322 
 323 inline void Atomic::store(jlong store_value, volatile jlong* dest) {
 324   os::atomic_copy64((volatile jlong*)&store_value, dest);
 325 }
 326 
 327 #endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.


 293 #else
 294 #ifdef M68K
 295   return m68k_compare_and_swap(dest, compare_value, exchange_value);
 296 #else
 297   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 298 #endif // M68K
 299 #endif // ARM
 300 }
 301 
 302 inline void* Atomic::cmpxchg_ptr(void* exchange_value,
 303                                  volatile void* dest,
 304                                  void* compare_value,
 305                                  cmpxchg_memory_order order) {
 306 
 307   return (void *) cmpxchg_ptr((intptr_t) exchange_value,
 308                               (volatile intptr_t*) dest,
 309                               (intptr_t) compare_value,
 310                               order);
 311 }
 312 
 313 inline jlong Atomic::load(const volatile jlong* src) {
 314   volatile jlong dest;
 315   os::atomic_copy64(src, &dest);
 316   return dest;
 317 }
 318 
 319 inline void Atomic::store(jlong store_value, jlong* dest) {
 320   os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
 321 }
 322 
 323 inline void Atomic::store(jlong store_value, volatile jlong* dest) {
 324   os::atomic_copy64((volatile jlong*)&store_value, dest);
 325 }
 326 
 327 #endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
< prev index next >