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 // Memory Access Ordering Model 26 // 27 // This interface is based on the JSR-133 Cookbook for Compiler Writers 28 // and on the IA64 memory model. It is the dynamic equivalent of the 29 // C/C++ volatile specifier. I.e., volatility restricts compile-time 30 // memory access reordering in a way similar to what we want to occur 31 // at runtime. 32 // 33 // In the following, the terms 'previous', 'subsequent', 'before', 34 // 'after', 'preceding' and 'succeeding' refer to program order. The 35 // terms 'down' and 'below' refer to forward load or store motion 36 // relative to program order, while 'up' and 'above' refer to backward 37 // motion. 38 // 39 // 40 // We define four primitive memory barrier operations. 41 // 42 // LoadLoad: Load1(s); LoadLoad; Load2 43 // 44 // Ensures that Load1 completes (obtains the value it loads from memory) 292 static void release_store_fence(volatile jbyte* p, jbyte v); 293 static void release_store_fence(volatile jshort* p, jshort v); 294 static void release_store_fence(volatile jint* p, jint v); 295 static void release_store_fence(volatile jlong* p, jlong v); 296 static void release_store_fence(volatile jubyte* p, jubyte v); 297 static void release_store_fence(volatile jushort* p, jushort v); 298 static void release_store_fence(volatile juint* p, juint v); 299 static void release_store_fence(volatile julong* p, julong v); 300 static void release_store_fence(volatile jfloat* p, jfloat v); 301 static void release_store_fence(volatile jdouble* p, jdouble v); 302 303 static void release_store_ptr_fence(volatile intptr_t* p, intptr_t v); 304 static void release_store_ptr_fence(volatile void* p, void* v); 305 306 private: 307 // This is a helper that invokes the StubRoutines::fence_entry() 308 // routine if it exists, It should only be used by platforms that 309 // don't another way to do the inline eassembly. 310 static void StubRoutines_fence(); 311 }; | 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 SHARE_VM_RUNTIME_ORDERACCESS_HPP 26 #define SHARE_VM_RUNTIME_ORDERACCESS_HPP 27 28 #include "memory/allocation.hpp" 29 30 // Memory Access Ordering Model 31 // 32 // This interface is based on the JSR-133 Cookbook for Compiler Writers 33 // and on the IA64 memory model. It is the dynamic equivalent of the 34 // C/C++ volatile specifier. I.e., volatility restricts compile-time 35 // memory access reordering in a way similar to what we want to occur 36 // at runtime. 37 // 38 // In the following, the terms 'previous', 'subsequent', 'before', 39 // 'after', 'preceding' and 'succeeding' refer to program order. The 40 // terms 'down' and 'below' refer to forward load or store motion 41 // relative to program order, while 'up' and 'above' refer to backward 42 // motion. 43 // 44 // 45 // We define four primitive memory barrier operations. 46 // 47 // LoadLoad: Load1(s); LoadLoad; Load2 48 // 49 // Ensures that Load1 completes (obtains the value it loads from memory) 297 static void release_store_fence(volatile jbyte* p, jbyte v); 298 static void release_store_fence(volatile jshort* p, jshort v); 299 static void release_store_fence(volatile jint* p, jint v); 300 static void release_store_fence(volatile jlong* p, jlong v); 301 static void release_store_fence(volatile jubyte* p, jubyte v); 302 static void release_store_fence(volatile jushort* p, jushort v); 303 static void release_store_fence(volatile juint* p, juint v); 304 static void release_store_fence(volatile julong* p, julong v); 305 static void release_store_fence(volatile jfloat* p, jfloat v); 306 static void release_store_fence(volatile jdouble* p, jdouble v); 307 308 static void release_store_ptr_fence(volatile intptr_t* p, intptr_t v); 309 static void release_store_ptr_fence(volatile void* p, void* v); 310 311 private: 312 // This is a helper that invokes the StubRoutines::fence_entry() 313 // routine if it exists, It should only be used by platforms that 314 // don't another way to do the inline eassembly. 315 static void StubRoutines_fence(); 316 }; 317 318 #endif // SHARE_VM_RUNTIME_ORDERACCESS_HPP |