< prev index next >

src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp

Print this page
rev 13030 : [mq]: add_const
   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
   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.


  63 //                           Load|Load,
  64 //                          Store|Load
  65 //
  66 
  67 #define inlasm_sync()     __asm__ __volatile__ ("sync"   : : : "memory");
  68 #define inlasm_lwsync()   __asm__ __volatile__ ("lwsync" : : : "memory");
  69 #define inlasm_eieio()    __asm__ __volatile__ ("eieio"  : : : "memory");
  70 #define inlasm_isync()    __asm__ __volatile__ ("isync"  : : : "memory");
  71 // Use twi-isync for load_acquire (faster than lwsync).
  72 #define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
  73 
  74 inline void   OrderAccess::loadload()   { inlasm_lwsync(); }
  75 inline void   OrderAccess::storestore() { inlasm_lwsync(); }
  76 inline void   OrderAccess::loadstore()  { inlasm_lwsync(); }
  77 inline void   OrderAccess::storeload()  { inlasm_sync();   }
  78 
  79 inline void   OrderAccess::acquire()    { inlasm_lwsync(); }
  80 inline void   OrderAccess::release()    { inlasm_lwsync(); }
  81 inline void   OrderAccess::fence()      { inlasm_sync();   }
  82 
  83 template<> inline jbyte  OrderAccess::specialized_load_acquire<jbyte> (volatile jbyte*  p) { register jbyte t = load(p);  inlasm_acquire_reg(t); return t; }
  84 template<> inline jshort OrderAccess::specialized_load_acquire<jshort>(volatile jshort* p) { register jshort t = load(p); inlasm_acquire_reg(t); return t; }
  85 template<> inline jint   OrderAccess::specialized_load_acquire<jint>  (volatile jint*   p) { register jint t = load(p);   inlasm_acquire_reg(t); return t; }
  86 template<> inline jlong  OrderAccess::specialized_load_acquire<jlong> (volatile jlong*  p) { register jlong t = load(p);  inlasm_acquire_reg(t); return t; }
  87 
  88 #undef inlasm_sync
  89 #undef inlasm_lwsync
  90 #undef inlasm_eieio
  91 #undef inlasm_isync
  92 #undef inlasm_acquire_reg
  93 
  94 #define VM_HAS_GENERALIZED_ORDER_ACCESS 1
  95 
  96 #endif // OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
   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.


  63 //                           Load|Load,
  64 //                          Store|Load
  65 //
  66 
  67 #define inlasm_sync()     __asm__ __volatile__ ("sync"   : : : "memory");
  68 #define inlasm_lwsync()   __asm__ __volatile__ ("lwsync" : : : "memory");
  69 #define inlasm_eieio()    __asm__ __volatile__ ("eieio"  : : : "memory");
  70 #define inlasm_isync()    __asm__ __volatile__ ("isync"  : : : "memory");
  71 // Use twi-isync for load_acquire (faster than lwsync).
  72 #define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
  73 
  74 inline void   OrderAccess::loadload()   { inlasm_lwsync(); }
  75 inline void   OrderAccess::storestore() { inlasm_lwsync(); }
  76 inline void   OrderAccess::loadstore()  { inlasm_lwsync(); }
  77 inline void   OrderAccess::storeload()  { inlasm_sync();   }
  78 
  79 inline void   OrderAccess::acquire()    { inlasm_lwsync(); }
  80 inline void   OrderAccess::release()    { inlasm_lwsync(); }
  81 inline void   OrderAccess::fence()      { inlasm_sync();   }
  82 
  83 template<> inline jbyte  OrderAccess::specialized_load_acquire<jbyte> (const volatile jbyte*  p) { register jbyte t = load(p);  inlasm_acquire_reg(t); return t; }
  84 template<> inline jshort OrderAccess::specialized_load_acquire<jshort>(const volatile jshort* p) { register jshort t = load(p); inlasm_acquire_reg(t); return t; }
  85 template<> inline jint   OrderAccess::specialized_load_acquire<jint>  (const volatile jint*   p) { register jint t = load(p);   inlasm_acquire_reg(t); return t; }
  86 template<> inline jlong  OrderAccess::specialized_load_acquire<jlong> (const volatile jlong*  p) { register jlong t = load(p);  inlasm_acquire_reg(t); return t; }
  87 
  88 #undef inlasm_sync
  89 #undef inlasm_lwsync
  90 #undef inlasm_eieio
  91 #undef inlasm_isync
  92 #undef inlasm_acquire_reg
  93 
  94 #define VM_HAS_GENERALIZED_ORDER_ACCESS 1
  95 
  96 #endif // OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
< prev index next >