# HG changeset patch
# User jcoomes
# Date 1282936351 -3600
# Node ID 379b95785a1faacbe5261b7517159718e139e57b
# Parent  13f94cc872531ff5b81d1551edf7145f73864c74
6951319: enable solaris builds using Sun Studio 12 update 1
Reviewed-by: kamg, ysr, dholmes, johnc

diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/amd64.make
--- openjdk.orig/hotspot/make/solaris/makefiles/amd64.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/amd64.make	Fri Aug 27 20:12:31 2010 +0100
@@ -33,14 +33,8 @@
 #
 ifeq ("${Platform_compiler}", "sparcWorks")
 
-# Temporary until C++ compiler is fixed
-
-# _lwp_create_interpose must have a frame
-OPT_CFLAGS/os_solaris_x86_64.o = -xO1
-
 # Temporary until SS10 C++ compiler is fixed
 OPT_CFLAGS/generateOptoStub.o = -xO2
-OPT_CFLAGS/thread.o = -xO2
 
 else
 
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/fastdebug.make
--- openjdk.orig/hotspot/make/solaris/makefiles/fastdebug.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/fastdebug.make	Fri Aug 27 20:12:31 2010 +0100
@@ -36,15 +36,15 @@
 ifeq ("${Platform_compiler}", "sparcWorks")
 OPT_CFLAGS/SLOWER = -xO2
 
-# Problem with SS12 compiler, dtrace doesn't like the .o files  (bug 6693876)
 ifeq ($(COMPILER_REV_NUMERIC), 509)
-  # To avoid jvm98 crash
-  OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER)
-  # Not clear this workaround could be skipped in some cases.
-  OPT_CFLAGS/vmGCOperations.o = $(OPT_CFLAGS/SLOWER)
-  OPT_CFLAGS/java.o = $(OPT_CFLAGS/SLOWER)
-  OPT_CFLAGS/jni.o = $(OPT_CFLAGS/SLOWER)
-endif
+# To avoid jvm98 crash
+OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER)
+endif # COMPILER_NUMERIC_REV == 509
+
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+# dtrace cannot handle tail call optimization (6672627, 6693876)
+OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
+endif # COMPILER_NUMERIC_REV >= 509
 
 ifeq ($(COMPILER_REV_NUMERIC), 505)
 # CC 5.5 has bug 4908364 with -xO4  (Fixed in 5.6)
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/i486.make
--- openjdk.orig/hotspot/make/solaris/makefiles/i486.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/i486.make	Fri Aug 27 20:12:31 2010 +0100
@@ -33,25 +33,6 @@
 # Special case flags for compilers and compiler versions on i486.
 #
 ifeq ("${Platform_compiler}", "sparcWorks")
-
-# _lwp_create_interpose must have a frame
-OPT_CFLAGS/os_solaris_x86.o = -xO1
-else
-
-ifeq ("${Platform_compiler}", "gcc")
-# gcc
-# _lwp_create_interpose must have a frame
-OPT_CFLAGS/os_solaris_x86.o = -fno-omit-frame-pointer
-#
-else
-# error
-_JUNK2_ := $(shell echo >&2 \
-       "*** ERROR: this compiler is not yet supported by this code base!")
-	@exit 1
-endif
-endif
-
-ifeq ("${Platform_compiler}", "sparcWorks")
 # ILD is gone as of SS11 (5.8), not supported in SS10 (5.7)
 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1)
   #
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/launcher.make
--- openjdk.orig/hotspot/make/solaris/makefiles/launcher.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/launcher.make	Fri Aug 27 20:12:31 2010 +0100
@@ -80,15 +80,12 @@
 	} > $@
 
 $(LAUNCHER): $(LAUNCHER.o) $(LIBJVM) $(LAUNCHER_MAPFILE)
+ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
+	@echo Linking launcher...
+	$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
 	$(QUIETLY) \
-	case "$(CFLAGS_BROWSE)" in \
-	-sbfast|-xsbfast) \
-	    ;; \
-	*) \
-	    echo Linking launcher...; \
-	    $(LINK_LAUNCHER/PRE_HOOK) \
-	    $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER); \
-	    $(LINK_LAUNCHER/POST_HOOK) \
-	    [ -f $(LAUNCHER_G) ] || { ln -s $@ $(LAUNCHER_G); }; \
-	    ;; \
-	esac
+	$(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER)
+	$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
+	[ -f $(LAUNCHER_G) ] || ln -s $@ $(LAUNCHER_G)
+endif # filter -sbfast -xsbfast
+
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/optimized.make
--- openjdk.orig/hotspot/make/solaris/makefiles/optimized.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/optimized.make	Fri Aug 27 20:12:31 2010 +0100
@@ -32,13 +32,10 @@
 # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
 ifeq ("${Platform_compiler}", "sparcWorks")
 
-# Problem with SS12 compiler, dtrace doesn't like the .o files  (bug 6693876)
-ifeq ($(COMPILER_REV_NUMERIC),509)
-  # Not clear this workaround could be skipped in some cases.
-  OPT_CFLAGS/vmGCOperations.o = $(OPT_CFLAGS/SLOWER) -g
-  OPT_CFLAGS/java.o = $(OPT_CFLAGS/SLOWER) -g
-  OPT_CFLAGS/jni.o = $(OPT_CFLAGS/SLOWER) -g
-endif
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+# dtrace cannot handle tail call optimization (6672627, 6693876)
+OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
+endif # COMPILER_NUMERIC_REV >= 509
 
 # Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12)
 ifeq ($(COMPILER_REV_NUMERIC),508)
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/product.make
--- openjdk.orig/hotspot/make/solaris/makefiles/product.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/product.make	Fri Aug 27 20:12:31 2010 +0100
@@ -40,13 +40,10 @@
 # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
 ifeq ("${Platform_compiler}", "sparcWorks")
 
-# Problem with SS12 compiler, dtrace doesn't like the .o files  (bug 6693876)
-ifeq ($(COMPILER_REV_NUMERIC),509)
-  # Not clear this workaround could be skipped in some cases.
-  OPT_CFLAGS/vmGCOperations.o = $(OPT_CFLAGS/SLOWER) -g
-  OPT_CFLAGS/java.o = $(OPT_CFLAGS/SLOWER) -g
-  OPT_CFLAGS/jni.o = $(OPT_CFLAGS/SLOWER) -g
-endif
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+# dtrace cannot handle tail call optimization (6672627, 6693876)
+OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
+endif # COMPILER_NUMERIC_REV >= 509
 
 # Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12)
 ifeq ($(COMPILER_REV_NUMERIC),508)
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/sparcWorks.make
--- openjdk.orig/hotspot/make/solaris/makefiles/sparcWorks.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/sparcWorks.make	Fri Aug 27 20:12:31 2010 +0100
@@ -48,27 +48,33 @@
 # Pick which compiler is validated
 ifeq ($(JRE_RELEASE_VER),1.6.0)
   # Validated compiler for JDK6 is SS11 (5.8)
-  VALIDATED_COMPILER_REV   := 5.8
-  VALIDATED_C_COMPILER_REV := 5.8
+  VALIDATED_COMPILER_REVS   := 5.8
+  VALIDATED_C_COMPILER_REVS := 5.8
 else
-  # Validated compiler for JDK7 is SS12 (5.9)
-  VALIDATED_COMPILER_REV   := 5.9
-  VALIDATED_C_COMPILER_REV := 5.9
+  # Validated compilers for JDK7 are SS12 (5.9) or SS12 update 1 (5.10)
+  VALIDATED_COMPILER_REVS   := 5.9 5.10
+  VALIDATED_C_COMPILER_REVS := 5.9 5.10
 endif
 
-# Warning messages about not using the above validated version
-ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV}
-ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV})
-dummy_target_to_enforce_compiler_rev:=\
-$(shell echo >&2 WARNING: You are using CC version ${COMPILER_REV} \
-and should be using version ${ENFORCE_COMPILER_REV}. Set ENFORCE_COMPILER_REV=${COMPILER_REV} to avoid this warning.)
+# Warning messages about not using the above validated versions
+ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := $(strip ${VALIDATED_COMPILER_REVS})
+ifeq ($(filter ${ENFORCE_COMPILER_REV},${COMPILER_REV}),)
+PRINTABLE_CC_REVS := $(subst $(shell echo ' '), or ,${ENFORCE_COMPILER_REV})
+dummy_var_to_enforce_compiler_rev := $(shell \
+	echo >&2 WARNING: You are using CC version ${COMPILER_REV} and \
+	should be using version ${PRINTABLE_CC_REVS}.; \
+	echo >&2 Set ENFORCE_COMPILER_REV=${COMPILER_REV} to avoid this \
+	warning.)
 endif
 
-ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV}
-ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV})
-dummy_target_to_enforce_c_compiler_rev:=\
-$(shell echo >&2 WARNING: You are using cc version ${C_COMPILER_REV} \
-and should be using version ${ENFORCE_C_COMPILER_REV}. Set ENFORCE_C_COMPILER_REV=${C_COMPILER_REV} to avoid this warning.)
+ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := $(strip ${VALIDATED_C_COMPILER_REVS})
+ifeq ($(filter ${ENFORCE_C_COMPILER_REV},${C_COMPILER_REV}),)
+PRINTABLE_C_REVS := $(subst $(shell echo ' '), or ,${ENFORCE_C_COMPILER_REV})
+dummy_var_to_enforce_c_compiler_rev := $(shell \
+	echo >&2 WARNING: You are using cc version ${C_COMPILER_REV} and \
+	should be using version ${PRINTABLE_C_REVS}.; \
+	echo >&2 Set ENFORCE_C_COMPILER_REV=${C_COMPILER_REV} to avoid this \
+	warning.)
 endif
 
 COMPILER_REV_NUMERIC := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$1 * 100 + $$2 }')
@@ -139,6 +145,13 @@
 OPT_CFLAGS/O2=-xO2
 OPT_CFLAGS/NOOPT=-xO1
 
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+ifeq ($(Platform_arch), x86)
+OPT_CFLAGS/NO_TAIL_CALL_OPT  = -Wu,-O~yz
+OPT_CCFLAGS/NO_TAIL_CALL_OPT = -Qoption ube -O~yz
+endif # Platform_arch == x86
+endif # COMPILER_REV_NUMERIC >= 509
+
 #################################################
 # Begin current (>=5.6) Forte compiler options #
 #################################################
@@ -181,10 +194,7 @@
 
 ifeq ("${Platform_arch_model}", "x86_32")
 
-OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
-
-# UBE (CC 5.5) has bug 4923569 with -xO4
-OPT_CFLAGS+=-xO3
+OPT_CFLAGS=-xtarget=pentium -xO4 $(EXTRA_OPT_CFLAGS)
 
 endif # 32bit x86
 
@@ -461,7 +471,7 @@
 # The -g0 setting allows the C++ frontend to inline, which is a big win.
 
 # Special global options for SS12
-ifeq ($(COMPILER_REV_NUMERIC),509)
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
   # There appears to be multiple issues with the new Dwarf2 debug format, so
   #   we tell the compiler to use the older 'stabs' debug format all the time.
   #   Note that this needs to be used in optimized compiles too to be 100%.
diff -r 13f94cc87253 -r 379b95785a1f make/solaris/makefiles/vm.make
--- openjdk.orig/hotspot/make/solaris/makefiles/vm.make	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/make/solaris/makefiles/vm.make	Fri Aug 27 20:12:31 2010 +0100
@@ -174,19 +174,16 @@
 endif
 # making the library:
 $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) 
-	$(QUIETLY) \
-	case "$(CFLAGS_BROWSE)" in \
-	-sbfast|-xsbfast) \
-	    ;; \
-	*) \
-	    echo Linking vm...; \
-	    $(LINK_LIB.CC/PRE_HOOK) \
-	    $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \
-	    $(LINK_LIB.CC/POST_HOOK) \
-	    rm -f $@.1; ln -s $@ $@.1; \
-	    [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
-	    ;; \
-	esac
+ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
+	@echo Linking vm...
+	$(QUIETLY) $(LINK_LIB.CC/PRE_HOOK)
+	$(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM)
+	$(QUIETLY) $(LINK_LIB.CC/POST_HOOK)
+	$(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
+	$(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
+	$(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
+endif # filter -sbfast -xsbfast
+
 
 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
 
diff -r 13f94cc87253 -r 379b95785a1f src/cpu/sparc/vm/assembler_sparc.hpp
--- openjdk.orig/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Aug 27 20:12:31 2010 +0100
@@ -2239,7 +2239,7 @@
   AddressLiteral constant_oop_address(jobject obj);                          // find_index
   inline void    set_oop             (jobject obj, Register d);              // uses allocate_oop_address
   inline void    set_oop_constant    (jobject obj, Register d);              // uses constant_oop_address
-  inline void    set_oop             (AddressLiteral& obj_addr, Register d); // same as load_address
+  inline void    set_oop             (const AddressLiteral& obj_addr, Register d); // same as load_address
 
   void set_narrow_oop( jobject obj, Register d );
 
diff -r 13f94cc87253 -r 379b95785a1f src/cpu/sparc/vm/assembler_sparc.inline.hpp
--- openjdk.orig/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Fri Aug 27 20:12:31 2010 +0100
@@ -707,7 +707,7 @@
 }
 
 
-inline void MacroAssembler::set_oop(AddressLiteral& obj_addr, Register d) {
+inline void MacroAssembler::set_oop(const AddressLiteral& obj_addr, Register d) {
   assert(obj_addr.rspec().type() == relocInfo::oop_type, "must be an oop reloc");
   set(obj_addr, d);
 }
diff -r 13f94cc87253 -r 379b95785a1f src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
--- openjdk.orig/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp	Fri Aug 27 20:12:31 2010 +0100
@@ -47,40 +47,56 @@
 // For Sun Studio - implementation is in solaris_x86_[32/64].il.
 // For gcc - implementation is just below.
 
-extern "C" jint _Atomic_add(jint add_value, volatile jint* dest, int mp);
-extern "C" jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
-extern "C" jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, int mp);
-extern "C" jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp);
+// The lock prefix can be omitted for certain instructions on uniprocessors; to
+// facilitate this, os::is_MP() is passed as an additional argument.  64-bit
+// processors are assumed to be multi-threaded and/or multi-core, so the extra
+// argument is unnecessary.
+#ifndef _LP64
+#define IS_MP_DECL() , int is_mp
+#define IS_MP_ARG()  , (int) os::is_MP()
+#else
+#define IS_MP_DECL()
+#define IS_MP_ARG()
+#endif // _LP64
+
+extern "C" {
+  jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
+  jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
+  jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
+                       jint compare_value IS_MP_DECL());
+  jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
+                             jlong compare_value IS_MP_DECL());
+}
 
 inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  return _Atomic_add(add_value, dest, (int) os::is_MP());
+  return _Atomic_add(add_value, dest IS_MP_ARG());
+}
+
+inline jint     Atomic::xchg       (jint     exchange_value, volatile jint*     dest) {
+  return _Atomic_xchg(exchange_value, dest);
 }
 
 inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value) {
-  return _Atomic_cmpxchg(exchange_value, dest, compare_value, (int) os::is_MP());
+  return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
 }
 
 inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value) {
-  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, (int) os::is_MP());
+  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
 }
 
 
 #ifdef AMD64
 inline void Atomic::store    (jlong    store_value, jlong*             dest) { *dest = store_value; }
 inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest, int mp);
+extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
 extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
 
 inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest, (int) os::is_MP());
+  return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
 }
 
 inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest, (int) os::is_MP());
-}
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  return _Atomic_xchg(exchange_value, dest);
+  return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
 }
 
 inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
@@ -92,11 +108,11 @@
 }
 
 inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
-  return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, (int) os::is_MP());
+  return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
 }
 
 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
-  return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, (int) os::is_MP());
+  return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
 }
 
 inline jlong Atomic::load(volatile jlong* src) { return *src; }
@@ -111,13 +127,6 @@
   return (void*)add((jint)add_value, (volatile jint*)dest);
 }
 
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  // We noticed a CC5.5 bug (4894807), so keep calling the stub just to be safe.
-  // Will use the inline template version after 4894807 is fixed.
-  // return _Atomic_xchg(exchange_value, dest);
-  return (*os::atomic_xchg_func)(exchange_value, dest);
-}
-
 inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
   return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
 }
@@ -179,9 +188,6 @@
 #endif // AMD64
 
   inline jint _Atomic_xchg(jint exchange_value, volatile jint* dest) {
-
-    // 32bit version originally did nothing!!
-
     __asm__ __volatile__ ("xchgl (%2),%0"
                           : "=r" (exchange_value)
                         : "0" (exchange_value), "r" (dest)
diff -r 13f94cc87253 -r 379b95785a1f src/os_cpu/solaris_x86/vm/solaris_x86_32.il
--- openjdk.orig/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il	Fri Aug 27 20:12:31 2010 +0100
@@ -50,10 +50,12 @@
       movl     4(%esp), %edx   // dest
       movl     %eax, %ecx
       cmpl     $0, 8(%esp)     // MP test
-      je       1f
-      lock
-1:    xaddl    %eax, (%edx)
-      addl     %ecx, %eax
+      jne      1f
+      xaddl    %eax, (%edx)
+      jmp      2f
+1:    lock
+      xaddl    %eax, (%edx)
+2:    addl     %ecx, %eax
       .end
 
   // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest).
@@ -72,9 +74,12 @@
       movl     0(%esp), %ecx   // exchange_value
       movl     4(%esp), %edx   // dest
       cmp      $0, 12(%esp)    // MP test
-      je       1f
-      lock
-1:    cmpxchgl %ecx, (%edx)
+      jne      1f
+      cmpxchgl %ecx, (%edx)
+      jmp      2f
+1:    lock
+      cmpxchgl %ecx, (%edx)
+2:
       .end
 
   // Support for jlong Atomic::cmpxchg(jlong exchange_value,
@@ -90,10 +95,12 @@
       movl     8(%esp), %ebx   // exchange_value (low)
       movl     12(%esp), %ecx  // exchange_high (high)
       cmp      $0, 28(%esp)    // MP test
-      je       1f
-      lock
-1:    cmpxchg8b (%edi)
-      popl     %edi
+      jne      1f
+      cmpxchg8b (%edi)
+      jmp      2f
+1:    lock
+      cmpxchg8b (%edi)
+2:    popl     %edi
       popl     %ebx
       .end
 
diff -r 13f94cc87253 -r 379b95785a1f src/os_cpu/solaris_x86/vm/solaris_x86_64.il
--- openjdk.orig/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il	Fri Aug 27 20:12:31 2010 +0100
@@ -37,24 +37,18 @@
       .end
 
   // Support for jint Atomic::add(jint add_value, volatile jint* dest)
-  // An additional bool (os::is_MP()) is passed as the last argument.
-      .inline _Atomic_add,3
+      .inline _Atomic_add,2
       movl     %edi, %eax      // save add_value for return
-      testl    %edx, %edx      // MP test
-      je       1f
       lock
-1:    xaddl    %edi, (%rsi)
+      xaddl    %edi, (%rsi)
       addl     %edi, %eax
       .end
 
   // Support for jlong Atomic::add(jlong add_value, volatile jlong* dest)
-  // An additional bool (os::is_MP()) is passed as the last argument.
-      .inline _Atomic_add_long,3
+      .inline _Atomic_add_long,2
       movq     %rdi, %rax      // save add_value for return
-      testq    %rdx, %rdx      // MP test
-      je       1f
       lock
-1:    xaddq    %rdi, (%rsi)
+      xaddq    %rdi, (%rsi)
       addq     %rdi, %rax
       .end
 
@@ -73,25 +67,19 @@
   // Support for jint Atomic::cmpxchg(jint exchange_value, 
   //                                  volatile jint *dest, 
   //                                  jint compare_value)
-  // An additional bool (os::is_MP()) is passed as the last argument.
-      .inline _Atomic_cmpxchg,4
+      .inline _Atomic_cmpxchg,3
       movl     %edx, %eax      // compare_value
-      testl    %ecx, %ecx      // MP test
-      je       1f
       lock
-1:    cmpxchgl %edi, (%rsi)
+      cmpxchgl %edi, (%rsi)
       .end
 
   // Support for jlong Atomic::cmpxchg(jlong exchange_value,
   //                                   volatile jlong* dest,
   //                                   jlong compare_value)
-  // An additional bool (os::is_MP()) is passed as the last argument.
-      .inline _Atomic_cmpxchg_long,6
+      .inline _Atomic_cmpxchg_long,3
       movq     %rdx, %rax      // compare_value
-      testq    %rcx, %rcx      // MP test
-      je       1f
       lock
-1:    cmpxchgq %rdi, (%rsi)
+      cmpxchgq %rdi, (%rsi)
       .end
 
   // Support for OrderAccess::acquire()
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/gc_implementation/g1/concurrentMark.cpp
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Aug 27 20:12:31 2010 +0100
@@ -766,9 +766,11 @@
 
   _has_aborted = false;
 
+#ifndef PRODUCT
   if (G1PrintReachableAtInitialMark) {
     print_reachable(true, "before");
   }
+#endif
 
   // Initialise marking structures. This has to be done in a STW phase.
   reset();
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Aug 27 20:12:31 2010 +0100
@@ -2387,10 +2387,12 @@
       gclog_or_tty->print_cr("Heap:");
       print_on(gclog_or_tty, true /* extended */);
       gclog_or_tty->print_cr("");
+#ifndef PRODUCT
       if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
         concurrent_mark()->print_reachable(use_prev_marking,
                                            "failed-verification");
       }
+#endif
       gclog_or_tty->flush();
     }
     guarantee(!failures, "there should not have been any failures");
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/gc_implementation/shared/spaceDecorator.hpp
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.hpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.hpp	Fri Aug 27 20:12:31 2010 +0100
@@ -109,7 +109,7 @@
   // is fully constructed.  Also is used when a generation is expanded
   // and possibly before the spaces have been reshaped to to the new
   // size of the generation.
-  static void mangle_region(MemRegion mr);
+  static void mangle_region(MemRegion mr) PRODUCT_RETURN;
 };
 
 class ContiguousSpace;
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/gc_implementation/shared/vmGCOperations.cpp
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Fri Aug 27 20:12:31 2010 +0100
@@ -32,10 +32,12 @@
 // for the other file anymore.   The dtrace probes have to remain stable.
 void VM_GC_Operation::notify_gc_begin(bool full) {
   HS_DTRACE_PROBE1(hotspot, gc__begin, full);
+  HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
 }
 
 void VM_GC_Operation::notify_gc_end() {
   HS_DTRACE_PROBE(hotspot, gc__end);
+  HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
 }
 
 void VM_GC_Operation::acquire_pending_list_lock() {
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/runtime/java.cpp
--- openjdk.orig/hotspot/src/share/vm/runtime/java.cpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/runtime/java.cpp	Fri Aug 27 20:12:31 2010 +0100
@@ -470,6 +470,7 @@
 void notify_vm_shutdown() {
   // For now, just a dtrace probe.
   HS_DTRACE_PROBE(hotspot, vm__shutdown);
+  HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
 }
 
 void vm_direct_exit(int code) {
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/runtime/vframe.cpp
--- openjdk.orig/hotspot/src/share/vm/runtime/vframe.cpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/runtime/vframe.cpp	Fri Aug 27 20:12:31 2010 +0100
@@ -101,8 +101,8 @@
   bool found_first_monitor = false;
   ObjectMonitor *pending_monitor = thread()->current_pending_monitor();
   ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor();
-  oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : NULL);
-  oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : NULL);
+  oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL);
+  oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL);
 
   for (int index = (mons->length()-1); index >= 0; index--) {
     MonitorInfo* monitor = mons->at(index);
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/runtime/vm_version.cpp
--- openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/runtime/vm_version.cpp	Fri Aug 27 20:12:31 2010 +0100
@@ -190,6 +190,8 @@
         #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
       #elif __SUNPRO_CC == 0x590
         #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
+      #elif __SUNPRO_CC == 0x5100
+        #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
       #else
         #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
       #endif
diff -r 13f94cc87253 -r 379b95785a1f src/share/vm/utilities/dtrace.hpp
--- openjdk.orig/hotspot/src/share/vm/utilities/dtrace.hpp	Fri Jun 18 01:17:46 2010 -0700
--- openjdk/hotspot/src/share/vm/utilities/dtrace.hpp	Fri Aug 27 20:12:31 2010 +0100
@@ -29,6 +29,10 @@
 #define DTRACE_ONLY(x) x
 #define NOT_DTRACE(x)
 
+// Work around dtrace tail call bug 6672627 until it is fixed in solaris 10.
+#define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() \
+  do { volatile size_t dtrace_workaround_tail_call_bug = 1; } while (0)
+
 #else // ndef SOLARIS || ndef DTRACE_ENABLED
 
 #define DTRACE_ONLY(x)
@@ -41,6 +45,8 @@
 #define DTRACE_PROBE4(a,b,c,d,e,f) {;}
 #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;}
 
+#define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG()
+
 #endif
 
 #define HS_DTRACE_PROBE_FN(provider,name)\
