changeset 4632:6b388e7d4905

8013633: Cleanup platform ifdefs in unsafe.cpp Summary: Replace ifdefs with SUPPORTS_NATIVE_CX8 set in platform include file Reviewed-by: dholmes, dlong
author bpittore
date Tue, 07 May 2013 10:19:33 -0400
parents e01e02a9fcb6
children a258a8351528
files src/cpu/sparc/vm/globalDefinitions_sparc.hpp src/cpu/x86/vm/globalDefinitions_x86.hpp src/share/vm/prims/unsafe.cpp
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/globalDefinitions_sparc.hpp	Mon Apr 29 01:58:43 2013 -0700
+++ b/src/cpu/sparc/vm/globalDefinitions_sparc.hpp	Tue May 07 10:19:33 2013 -0400
@@ -30,4 +30,6 @@
 
 const int StackAlignmentInBytes = (2*wordSize);
 
+#define SUPPORTS_NATIVE_CX8
+
 #endif // CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP
--- a/src/cpu/x86/vm/globalDefinitions_x86.hpp	Mon Apr 29 01:58:43 2013 -0700
+++ b/src/cpu/x86/vm/globalDefinitions_x86.hpp	Tue May 07 10:19:33 2013 -0400
@@ -27,4 +27,6 @@
 
 const int StackAlignmentInBytes  = 16;
 
+#define SUPPORTS_NATIVE_CX8
+
 #endif // CPU_X86_VM_GLOBALDEFINITIONS_X86_HPP
--- a/src/share/vm/prims/unsafe.cpp	Mon Apr 29 01:58:43 2013 -0700
+++ b/src/share/vm/prims/unsafe.cpp	Tue May 07 10:19:33 2013 -0400
@@ -315,10 +315,7 @@
   OrderAccess::fence();
 UNSAFE_END
 
-#if defined(SPARC) || defined(X86)
-// Sparc and X86 have atomic jlong (8 bytes) instructions
-
-#else
+#ifndef SUPPORTS_NATIVE_CX8
 // Keep old code for platforms which may not have atomic jlong (8 bytes) instructions
 
 // Volatile long versions must use locks if !VM_Version::supports_cx8().
@@ -356,7 +353,7 @@
   }
 UNSAFE_END
 
-#endif // not SPARC and not X86
+#endif // not SUPPORTS_NATIVE_CX8
 
 #define DEFINE_GETSETOOP(jboolean, Boolean) \
  \
@@ -420,8 +417,7 @@
 DEFINE_GETSETOOP_VOLATILE(jfloat, Float);
 DEFINE_GETSETOOP_VOLATILE(jdouble, Double);
 
-#if defined(SPARC) || defined(X86)
-// Sparc and X86 have atomic jlong (8 bytes) instructions
+#ifdef SUPPORTS_NATIVE_CX8
 DEFINE_GETSETOOP_VOLATILE(jlong, Long);
 #endif
 
@@ -450,8 +446,7 @@
 
 UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x))
   UnsafeWrapper("Unsafe_SetOrderedLong");
-#if defined(SPARC) || defined(X86)
-  // Sparc and X86 have atomic jlong (8 bytes) instructions
+#ifdef SUPPORTS_NATIVE_CX8
   SET_FIELD_VOLATILE(obj, offset, jlong, x);
 #else
   // Keep old code for platforms which may not have atomic long (8 bytes) instructions