changeset 12996:5ce6db38ea84

Merge
author lana
date Sun, 17 Jun 2012 22:07:44 -0700
parents 0a91fe123fa2 7e981cb0ad6a
children 7ad469d89bed
files jdk/makefiles/altclasses/Makefile jdk/makefiles/apple/Makefile jdk/makefiles/apple/applescript/Makefile jdk/makefiles/com/Makefile jdk/makefiles/com/apple/Makefile jdk/makefiles/com/apple/osx/Makefile jdk/makefiles/com/apple/osxui/Makefile jdk/makefiles/com/oracle/Makefile jdk/makefiles/com/oracle/jfr/Makefile jdk/makefiles/com/oracle/security/ucrypto/FILES_c.gmk jdk/makefiles/com/oracle/security/ucrypto/Makefile jdk/makefiles/com/oracle/security/ucrypto/mapfile-vers jdk/makefiles/com/sun/Makefile jdk/makefiles/common/shared/Defs-utils.gmk jdk/makefiles/java/fdlibm/FILES_c.gmk jdk/makefiles/java/fdlibm/Makefile jdk/makefiles/java/instrument/Makefile jdk/makefiles/java/instrument/mapfile-vers jdk/makefiles/java/java/Exportedfiles.gmk jdk/makefiles/java/java/FILES_c.gmk jdk/makefiles/java/java/FILES_java.gmk jdk/makefiles/java/java/Makefile jdk/makefiles/java/java/localelist.sh jdk/makefiles/java/java/mapfile-vers jdk/makefiles/java/java/reflect/Makefile jdk/makefiles/java/java/reorder-i586 jdk/makefiles/java/java/reorder-sparc jdk/makefiles/java/java/reorder-sparcv9 jdk/makefiles/java/java_crw_demo/Makefile jdk/makefiles/java/java_crw_demo/mapfile-vers jdk/makefiles/java/java_hprof_demo/Makefile jdk/makefiles/java/java_hprof_demo/mapfile-vers jdk/makefiles/java/jexec/Makefile jdk/makefiles/java/jli/Makefile jdk/makefiles/java/jli/mapfile-vers jdk/makefiles/java/jobjc/Makefile jdk/makefiles/java/jvm/Makefile jdk/makefiles/java/main/Makefile jdk/makefiles/java/main/java/Makefile jdk/makefiles/java/main/java/mapfile-amd64 jdk/makefiles/java/main/java/mapfile-i586 jdk/makefiles/java/main/java/mapfile-sparc jdk/makefiles/java/main/java/mapfile-sparcv9 jdk/makefiles/java/main/javaw/Makefile jdk/makefiles/java/management/Exportedfiles.gmk jdk/makefiles/java/management/FILES_c.gmk jdk/makefiles/java/management/Makefile jdk/makefiles/java/management/mapfile-vers jdk/makefiles/java/net/FILES_c.gmk jdk/makefiles/java/net/Makefile jdk/makefiles/java/net/mapfile-vers jdk/makefiles/java/nio/Exportedfiles.gmk jdk/makefiles/java/nio/FILES_c.gmk jdk/makefiles/java/nio/FILES_java.gmk jdk/makefiles/java/nio/Makefile jdk/makefiles/java/nio/addNotices.sh jdk/makefiles/java/nio/genBuffer.sh jdk/makefiles/java/nio/genCharsetProvider.sh jdk/makefiles/java/nio/genCoder.sh jdk/makefiles/java/nio/genExceptions.sh jdk/makefiles/java/nio/mapfile-bsd jdk/makefiles/java/nio/mapfile-linux jdk/makefiles/java/nio/mapfile-solaris jdk/makefiles/java/nio/reorder-i586 jdk/makefiles/java/nio/reorder-sparc jdk/makefiles/java/nio/reorder-sparcv9 jdk/makefiles/java/npt/Makefile jdk/makefiles/java/npt/mapfile-vers jdk/makefiles/java/redist/fonts/Makefile jdk/makefiles/java/security/Makefile jdk/makefiles/java/sun_nio/FILES_java.gmk jdk/makefiles/java/sun_nio/Makefile jdk/makefiles/java/util/FILES_java.gmk jdk/makefiles/java/util/FILES_properties.gmk jdk/makefiles/java/util/Makefile jdk/makefiles/java/verify/Makefile jdk/makefiles/java/verify/mapfile-vers jdk/makefiles/java/verify/reorder-i586 jdk/makefiles/java/verify/reorder-sparc jdk/makefiles/java/verify/reorder-sparcv9 jdk/makefiles/javax/Makefile jdk/makefiles/javax/imageio/Makefile jdk/makefiles/javax/management/Makefile jdk/makefiles/javax/sound/FILES_c.gmk jdk/makefiles/javax/sound/Makefile jdk/makefiles/javax/sound/SoundDefs.gmk jdk/makefiles/javax/sound/jsoundalsa/Makefile jdk/makefiles/javax/sound/jsoundalsa/mapfile-vers jdk/makefiles/javax/sound/jsoundds/Makefile jdk/makefiles/javax/sound/mapfile-vers jdk/makefiles/javax/sql/Makefile jdk/makefiles/javax/swing/FILES.gmk jdk/makefiles/javax/swing/Makefile jdk/makefiles/javax/swing/beaninfo/FILES.gmk jdk/makefiles/javax/swing/beaninfo/Makefile jdk/makefiles/javax/swing/beaninfo/SwingBeans.gmk jdk/makefiles/javax/swing/beaninfo/manifest jdk/makefiles/javax/swing/html32dtd/Makefile jdk/makefiles/javax/swing/plaf/FILES.gmk jdk/makefiles/javax/swing/plaf/Makefile jdk/makefiles/sun/Makefile jdk/makefiles/sun/awt/CondenseRules.awk jdk/makefiles/sun/awt/Depend.mak jdk/makefiles/sun/awt/Depend.sed jdk/makefiles/sun/awt/FILES_c_macosx.gmk jdk/makefiles/sun/awt/FILES_c_unix.gmk jdk/makefiles/sun/awt/FILES_c_windows.gmk jdk/makefiles/sun/awt/FILES_export_macosx.gmk jdk/makefiles/sun/awt/FILES_export_unix.gmk jdk/makefiles/sun/awt/FILES_export_windows.gmk jdk/makefiles/sun/awt/Makefile jdk/makefiles/sun/awt/README jdk/makefiles/sun/awt/make.depend jdk/makefiles/sun/awt/mapfile-mawt-vers jdk/makefiles/sun/awt/mapfile-vers jdk/makefiles/sun/awt/mapfile-vers-linux jdk/makefiles/sun/awt/mawt.gmk jdk/makefiles/sun/cmm/Makefile jdk/makefiles/sun/cmm/kcms/FILES_c_unix.gmk jdk/makefiles/sun/cmm/kcms/FILES_c_windows.gmk jdk/makefiles/sun/cmm/kcms/Makefile jdk/makefiles/sun/cmm/kcms/mapfile-vers jdk/makefiles/sun/dcpr/FILES_c.gmk jdk/makefiles/sun/dcpr/Makefile jdk/makefiles/sun/dcpr/mapfile-vers jdk/makefiles/sun/headless/Makefile jdk/makefiles/sun/headless/mapfile-vers jdk/makefiles/sun/headless/reorder-i586 jdk/makefiles/sun/headless/reorder-sparc jdk/makefiles/sun/headless/reorder-sparcv9 jdk/makefiles/sun/image/Makefile jdk/makefiles/sun/image/generic/FILES_c.gmk jdk/makefiles/sun/image/generic/Makefile jdk/makefiles/sun/image/generic/mapfile-vers jdk/makefiles/sun/image/vis/FILES_c.gmk jdk/makefiles/sun/image/vis/Makefile jdk/makefiles/sun/javazic/Makefile jdk/makefiles/sun/jdbc/Makefile jdk/makefiles/sun/jdga/Makefile jdk/makefiles/sun/jdga/mapfile-vers jdk/makefiles/sun/lwawt/FILES_c_macosx.gmk jdk/makefiles/sun/lwawt/FILES_export_macosx.gmk jdk/makefiles/sun/lwawt/Makefile jdk/makefiles/sun/nio/Makefile jdk/makefiles/sun/nio/cs/FILES_java.gmk jdk/makefiles/sun/nio/cs/Makefile jdk/makefiles/sun/org/Makefile jdk/makefiles/sun/org/mozilla/Makefile jdk/makefiles/sun/org/mozilla/javascript/Makefile jdk/makefiles/sun/osxapp/Makefile jdk/makefiles/sun/security/Makefile jdk/makefiles/sun/security/ec/FILES_c.gmk jdk/makefiles/sun/security/ec/mapfile-vers jdk/makefiles/sun/security/jgss/Makefile jdk/makefiles/sun/security/jgss/wrapper/FILES_c.gmk jdk/makefiles/sun/security/jgss/wrapper/Makefile jdk/makefiles/sun/security/jgss/wrapper/mapfile-vers jdk/makefiles/sun/security/krb5/FILES_c_windows.gmk jdk/makefiles/sun/security/krb5/Makefile jdk/makefiles/sun/security/mscapi/FILES_cpp.gmk jdk/makefiles/sun/security/mscapi/Makefile jdk/makefiles/sun/security/other/Makefile jdk/makefiles/sun/security/smartcardio/FILES_c.gmk jdk/makefiles/sun/security/smartcardio/Makefile jdk/makefiles/sun/security/smartcardio/mapfile-vers jdk/makefiles/sun/security/tools/Makefile jdk/makefiles/sun/security/util/Makefile jdk/makefiles/sun/splashscreen/FILES_c.gmk jdk/makefiles/sun/splashscreen/Makefile jdk/makefiles/sun/splashscreen/mapfile-vers jdk/makefiles/sun/xawt/FILES_c_unix.gmk jdk/makefiles/sun/xawt/FILES_export_unix.gmk jdk/makefiles/sun/xawt/Makefile jdk/makefiles/sun/xawt/mapfile-vers jdk/src/share/classes/sun/nio/ch/DevPollSelectorProvider.java jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_ja.java jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_zh_CN.java jdk/src/share/native/java/sql/DriverManager.c jdk/test/sun/security/krb5/auto/ok-as-delegate-xrealm.sh jdk/test/sun/security/krb5/auto/ok-as-delegate.sh langtools/test/tools/javac/diags/examples/FullInstSig.java langtools/test/tools/javac/diags/examples/InvalidInferredTypes.java langtools/test/tools/javac/diags/examples/UndeterminedType1.java
diffstat 686 files changed, 26328 insertions(+), 30212 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jun 14 16:34:43 2012 -0700
+++ b/.hgtags	Sun Jun 17 22:07:44 2012 -0700
@@ -163,3 +163,5 @@
 35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39
 6e4e654931b976304bf6e7b4d0d6db8f75bac5d9 jdk8-b40
 c029c972396cea042a0dc67c0f7ccf2fe68007d4 jdk8-b41
+5c5a64ec0839df5affe9394b99ff338c363acbca jdk8-b42
+69d8a827cdf9236be9694a46d75c710d71dac7d7 jdk8-b43
--- a/.hgtags-top-repo	Thu Jun 14 16:34:43 2012 -0700
+++ b/.hgtags-top-repo	Sun Jun 17 22:07:44 2012 -0700
@@ -163,3 +163,5 @@
 8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39
 a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40
 1a8c7c530f8a9b7f5bdb9b0693b2f5435ca5205e jdk8-b41
+1ce5dc16416611c58b7480ca67a2eee5153498a6 jdk8-b42
+661c9aae602bbd9766d12590800c90f1edd1d8dd jdk8-b43
--- a/README-builds.html	Thu Jun 14 16:34:43 2012 -0700
+++ b/README-builds.html	Sun Jun 17 22:07:44 2012 -0700
@@ -108,6 +108,7 @@
                 <li><a href="#testing">Testing the Build</a> </li>
                 <li><a href="#variables">Environment/Make Variables</a></li>
                 <li><a href="#troubleshooting">Troubleshooting</a></li>
+                <li><a href="#newbuild">The New Build</a></li>
             </ul>
         </blockquote>
 
@@ -2120,6 +2121,16 @@
                 </li>
             </ul>
         </blockquote>
+        <!-- ------------------------------------------------------ -->
+        <hr>
+        <h2><a name="newbuild">The New Build</a></h2>
+        <blockquote>
+            The <a href="http://openjdk.java.net/projects/build-infra/">
+            Build Infrastructure project</a> is working on a new 
+            build. For information on how to try it out, please see the
+            <a href="http://openjdk.java.net/projects/build-infra/guide.html">
+            Build Infra User Guide</a> 
+        </blockquote>
         <hr>
     </body>
 </html>
--- a/common/autoconf/autogen.sh	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/autogen.sh	Sun Jun 17 22:07:44 2012 -0700
@@ -22,5 +22,5 @@
 # questions.
 #
 
-autoconf configure.ac > configure
+autoconf -W all configure.ac > configure
 rm -rf config.status config.log autom4te.cache
--- a/common/autoconf/builddeps.m4	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/builddeps.m4	Sun Jun 17 22:07:44 2012 -0700
@@ -34,7 +34,7 @@
                 . $builddepsfile
                 AC_MSG_RESULT([loaded!])
             else
-               AC_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!])
+               AC_MSG_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!])
            fi
         else
             AC_MSG_CHECKING([for builddeps.conf files in sources...])
@@ -47,7 +47,7 @@
                 . $builddepsfile
                 AC_MSG_RESULT([found at least one!])
             else
-               AC_ERROR([Could not find any builddeps.conf at all!])
+               AC_MSG_ERROR([Could not find any builddeps.conf at all!])
            fi
         fi
         # Create build and host names that use _ instead of "-" and ".".
@@ -117,7 +117,7 @@
         ) | ftp -in $FTPSERVER
     fi
     if test "x$VALID_TOOL" != xyes; then
-       AC_ERROR([I do not know how to use the tool: $BDEPS_FTP])
+       AC_MSG_ERROR([I do not know how to use the tool: $BDEPS_FTP])
     fi
 ])
 
@@ -159,7 +159,7 @@
             thecflags=${builddep_$2_CFLAGS}
             thelibs=${builddep_$2_LIBS}
             if test "x$depdir" = x; then
-                AC_ERROR([Could not download build dependency $2])
+                AC_MSG_ERROR([Could not download build dependency $2])
             fi
             $1=$depdir
             if test "x$theroot" != x; then
@@ -198,17 +198,17 @@
             mkdir -p $installdir
         fi
         if test ! -d $installdir; then
-            AC_ERROR([Could not create directory $installdir])
+            AC_MSG_ERROR([Could not create directory $installdir])
         fi
         tmpfile=`mktemp $installdir/$1.XXXXXXXXX`
         touch $tmpfile    
         if test ! -f $tmpfile; then
-            AC_ERROR([Could not create files in directory $installdir])
+            AC_MSG_ERROR([Could not create files in directory $installdir])
         fi
         BDEPS_FTPGET([$3/$2] , [$tmpfile])
         mv $tmpfile $installdir/$filename
         if test ! -s $installdir/$filename; then 
-            AC_ERROR([Could not download $3/$2])
+            AC_MSG_ERROR([Could not download $3/$2])
         fi
         case "$extension" in
             zip)  echo "Unzipping $installdir/$filename..."
@@ -220,7 +220,7 @@
             tgz) echo "Untaring $installdir/$filename..."
                (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
             ;;
-            *) AC_ERROR([Cannot handle build depency archive with extension $extension])
+            *) AC_MSG_ERROR([Cannot handle build depency archive with extension $extension])
             ;;
         esac
     fi
@@ -228,4 +228,3 @@
         $5=$installdir
     fi
 ])
-
--- a/common/autoconf/configure	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/configure	Sun Jun 17 22:07:44 2012 -0700
@@ -595,7 +595,12 @@
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+CACERTS_FILE
 TEST_IN_BUILD
+SALIB_NAME
+OS_VERSION_MICRO
+OS_VERSION_MINOR
+OS_VERSION_MAJOR
 LIBCXX
 LDFLAGS_JDKEXE_SUFFIX
 LDFLAGS_JDKLIB_SUFFIX
@@ -625,15 +630,20 @@
 LANGTOOLS_MAKE_ARGS
 LANGTOOLS_DIST
 LANGTOOLS_OUTPUTDIR
+CXX_FLAG_DEPS
+C_FLAG_DEPS
 CXX_O_FLAG_NONE
 CXX_O_FLAG_NORM
 CXX_O_FLAG_HI
+CXX_O_FLAG_HIGHEST
 C_O_FLAG_NONE
 C_O_FLAG_NORM
 C_O_FLAG_HI
+C_O_FLAG_HIGHEST
 DISABLE_NIMBUS
 GENERATE_DOCS
 ENABLE_DOCS
+LIBDL
 LIBM
 USE_EXTERNAL_LIBZ
 USE_EXTERNAL_LIBGIF
@@ -665,6 +675,7 @@
 BOOT_JDK_JVMARGS
 OVERRIDE_SRC_ROOT
 ADD_SRC_ROOT
+NATIVE2ASCII
 RMIC
 JAR
 JAVAH
@@ -678,7 +689,11 @@
 JAVA_CHECK
 JAVAC_CHECK
 ENDIAN
+POST_MCS_CMD
+POST_STRIP_CMD
 SET_SHARED_LIBRARY_ORIGIN
+CXX_FLAG_REORDER
+C_FLAG_REORDER
 SET_SHARED_LIBRARY_MAPFILE
 SET_SHARED_LIBRARY_NAME
 SHARED_LIBRARY_FLAGS
@@ -749,6 +764,7 @@
 CORBA_TOPDIR
 LANGTOOLS_TOPDIR
 OUTPUT_ROOT
+CONF_NAME
 SPEC
 MSVCR100DLL
 CHECK_FOR_VCINSTALLDIR
@@ -797,6 +813,8 @@
 CONCURRENT_BUILD_JOBS
 NUM_CORES
 DATE_WHEN_CONFIGURED
+REQUIRED_OS_VERSION
+REQUIRED_OS_NAME
 LEGACY_BUILD_CPU3
 LEGACY_BUILD_CPU2
 LEGACY_BUILD_CPU1
@@ -829,6 +847,7 @@
 build_vendor
 build_cpu
 build
+HG
 FILE
 EXPR
 READELF
@@ -918,7 +937,7 @@
 with_data_model
 with_num_cores
 with_memory_size
-enable_openjdk
+enable_openjdk_only
 enable_jigsaw
 with_jdk_variant
 enable_headful
@@ -967,6 +986,7 @@
 enable_nimbus
 enable_static_link_stdc__
 enable_hotspot_test_in_build
+with_cacerts_file
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1610,7 +1630,7 @@
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-openjdk        build OpenJDK regardless of the presence of closed
+  --enable-openjdk-only   build OpenJDK regardless of the presence of closed
                           repositories [disabled]
   --enable-jigsaw         build Jigsaw images (not yet available) [disabled]
   --disable-headful       build headful support (graphical UI support)
@@ -1718,6 +1738,7 @@
                           headers under PATH/include)
   --with-pulse-include    specify directory for the pulseaudio include files
   --with-pulse-lib        specify directory for the pulseaudio library
+  --with-cacerts-file     specify alternative cacerts file
 
 Some influential environment variables:
   PKG_CONFIG  path to pkg-config utility
@@ -3036,7 +3057,6 @@
 
 
 
-
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -3095,6 +3115,8 @@
 # Fixes paths on windows hosts to be mixed mode short.
 
 
+
+
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -3149,59 +3171,61 @@
 # questions.
 #
 
+function prepare_help_system {
+    for ac_prog in apt-get yum port pkgutil pkgadd
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_PKGHANDLER+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PKGHANDLER"; then
+  ac_cv_prog_PKGHANDLER="$PKGHANDLER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGHANDLER="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGHANDLER=$ac_cv_prog_PKGHANDLER
+if test -n "$PKGHANDLER"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGHANDLER" >&5
+$as_echo "$PKGHANDLER" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PKGHANDLER" && break
+done
+
+}
+
 function help_on_build_dependency {
     # Print a helpful message on how to acquire the necessary build dependency.
     # $1 is the help tag: freetyp2, cups, pulse, alsa etc
     MISSING_DEPENDENCY=$1
     PKGHANDLER_COMMAND=
 
-    for ac_prog in apt-get yum port pkgutil pkgadd
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PKGHANDLER+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$PKGHANDLER"; then
-  ac_cv_prog_PKGHANDLER="$PKGHANDLER" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_PKGHANDLER="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-PKGHANDLER=$ac_cv_prog_PKGHANDLER
-if test -n "$PKGHANDLER"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGHANDLER" >&5
-$as_echo "$PKGHANDLER" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$PKGHANDLER" && break
-done
-
-
     case $PKGHANDLER in
 	apt-get)
                 apt_help     $MISSING_DEPENDENCY ;;
-        yum)
+    yum)
                 yum_help     $MISSING_DEPENDENCY ;;
 	port)
                 port_help    $MISSING_DEPENDENCY ;;
@@ -3214,7 +3238,7 @@
     esac
 
     if test "x$PKGHANDLER_COMMAND" != x; then
-        HELP_MSG="Try running '$PKGHANDLER_COMMAND'."
+        HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
     fi
 }
 
@@ -5384,6 +5408,47 @@
     # Test that variable FILE is not empty.
     if test "" = "$FILE"; then as_fn_error $? "Could not find file !" "$LINENO" 5 ; fi
 
+# Extract the first word of "hg", so it can be a program name with args.
+set dummy hg; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_HG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $HG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_HG="$HG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_HG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+HG=$ac_cv_path_HG
+if test -n "$HG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HG" >&5
+$as_echo "$HG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
 # Figure out the build and host system.
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -5491,7 +5556,7 @@
     # The same values are setup for BUILD_...
     #
     # And the legacy variables, for controlling the old makefiles.
-    # LEGACY_HOST_CPU1=i586,amd64,sparc,sparcv9,arm,arm64...
+    # LEGACY_HOST_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
     # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
     # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris)
     # LEGACY_HOST_OS_API=solaris,windows
@@ -5918,6 +5983,33 @@
         LEGACY_BUILD_CPU3=""
     fi
 
+    # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_HOST_CPU1) ...
+    if test "x$HOST_OS" = xmacosx && test "x$HOST_CPU" = xx64; then
+        LEGACY_HOST_CPU1="x86_64"
+    fi
+
+
+    if test "x$HOST_OS" = "xsolaris"; then
+       REQUIRED_OS_NAME=SunOS
+       REQUIRED_OS_VERSION=5.10
+    fi
+    if test "x$HOST_OS" = "xlinux"; then
+       REQUIRED_OS_NAME=Linux
+       REQUIRED_OS_VERSION=2.6
+    fi
+    if test "x$HOST_OS" = "xwindows"; then
+        REQUIRED_OS_NAME=Windows
+        REQUIRED_OS_VERSION=5.1
+    fi
+    if test "x$HOST_OS" = "xmacosx"; then
+        REQUIRED_OS_NAME=Darwin
+        REQUIRED_OS_VERSION=11.2
+    fi
+
+
+
+
+
 # Now the following vars are defined.
 # HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows
 # HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince
@@ -6143,15 +6235,15 @@
 #
 # OpenJDK or closed
 #
-# Check whether --enable-openjdk was given.
-if test "${enable_openjdk+set}" = set; then :
-  enableval=$enable_openjdk;
-fi
-
-
-if test "x$enable_openjdk" = "xyes"; then
+# Check whether --enable-openjdk-only was given.
+if test "${enable_openjdk_only+set}" = set; then :
+  enableval=$enable_openjdk_only;
+fi
+
+
+if test "x$enable_openjdk_only" = "xyes"; then
     OPENJDK=true
-elif test "x$enable_openjdk" = "xno"; then
+elif test "x$enable_openjdk_only" = "xno"; then
     OPENJDK=false
 elif test -d "$SRC_ROOT/jdk/src/closed"; then
     OPENJDK=false
@@ -6458,7 +6550,8 @@
 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
     # We are running configure from the src root.
     # Create a default ./build/host-variant-debuglevel output root.
-    OUTPUT_ROOT="$SRC_ROOT/build/${HOST_OS}-${HOST_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
+    CONF_NAME="${HOST_OS}-${HOST_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
+    OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
     mkdir -p "$OUTPUT_ROOT"
     if test ! -d "$OUTPUT_ROOT"; then
         as_fn_error $? "Could not create build directory $OUTPUT_ROOT" "$LINENO" 5
@@ -6466,6 +6559,9 @@
 else
     # We are running configure from outside of the src dir.
     # Then use the current directory as output dir!
+    # If configuration is situated in normal build directory, just use the build
+    # directory name as configuration name, otherwise use the complete path.
+    CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
     OUTPUT_ROOT="$CURDIR"
 fi
 
@@ -6531,7 +6627,7 @@
         esac
         # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
         cd $OUTPUT_ROOT
-        $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
+        bash $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
 	cd $CURDIR
 	if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can extract the needed env variables" >&5
@@ -6618,6 +6714,8 @@
 
 SPEC=$OUTPUT_ROOT/spec.gmk
 
+CONF_NAME=$CONF_NAME
+
 OUTPUT_ROOT=$OUTPUT_ROOT
 
 
@@ -7362,6 +7460,8 @@
 ORG_CXXFLAGS="$CXXFLAGS"
 ORG_OBJCFLAGS="$OBJCFLAGS"
 
+prepare_help_system
+
 # gcc is almost always present, but on Windows we
 # prefer cl.exe and on Solaris we prefer CC.
 # Thus test for them in this order.
@@ -8769,9 +8869,10 @@
         LD="$car"
     fi
 
-LDEXE="$LD"
-LDCXX="$LD"
-LDEXECXX="$LD"
+LD="$CC"
+LDEXE="$CC"
+LDCXX="$CXX"
+LDEXECXX="$CXX"
 # LDEXE is the linker to use, when creating executables.
 
 # Linking C++ libraries.
@@ -8926,7 +9027,7 @@
 
     # For now, assume that we are always compiling using cl.exe.
     CC_OUT_OPTION=-Fo
-    EXE_OUT_OPTION=-Fe
+    EXE_OUT_OPTION=-out:
     LD_OUT_OPTION=-out:
     AR_OUT_OPTION=-out:
     # On Windows, reject /usr/bin/link, which is a cygwin
@@ -9008,10 +9109,9 @@
     WINLD="$tmp"
 
     LD="$WINLD"
-    # However creating executables can only be done with cl.exe.
-    LDEXE="$CC"
+    LDEXE="$WINLD"
     LDCXX="$WINLD"
-    LDEXECXX="$CC"
+    LDEXECXX="$WINLD"
 
     # Extract the first word of "mt", so it can be a program name with args.
 set dummy mt; ac_word=$2
@@ -9163,7 +9263,7 @@
     RC="$tmp"
 
 
-    RC_FLAGS="/l 0x409 /r"
+    RC_FLAGS="-nologo /l 0x409 /r"
     if test "x$VARIANT" = xOPT; then :
 
         RC_FLAGS="$RC_FLAGS -d NDEBUG"
@@ -9303,14 +9403,13 @@
 
 
     COMPILER_TYPE=CL
-    CFLAGS="$CFLAGS -nologo"
-    LDFLAGS="$LDFLAGS -nologo -dll -opt:ref -incremental:no "
+    CCXXFLAGS="$CCXXFLAGS -nologo"
+    LDFLAGS="$LDFLAGS -nologo -opt:ref -incremental:no"
     if test "x$LEGACY_HOST_CPU1" = xi586; then
         LDFLAGS="$LDFLAGS -safeseh"
     fi
-    if test "x$DEBUG_LEVEL" != xrelease; then
-        LDFLAGS="$LDFLAGS -debug"
-    fi
+    # TODO: make -debug optional "--disable-full-debug-symbols"
+    LDFLAGS="$LDFLAGS -debug"
 
 fi
 
@@ -9764,7 +9863,7 @@
 
 
 
-if test "x$HOST_CPU_BITS" = x32 && test "x$HOST_OS" = macosx; then
+if test "x$HOST_CPU_BITS" = x32 && test "x$HOST_OS" = xmacosx; then
     # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
     # While waiting for a better solution, the current workaround is to use -mstackrealign.
     CFLAGS="$CFLAGS -mstackrealign"
@@ -10499,6 +10598,16 @@
 # (The JVM can use 32 or 64 bit Java pointers but that decision
 # is made at runtime.)
 #
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+OLD_CXXFLAGS="$CXXFLAGS"
+if test "x$HOST_OS" = xsolaris && test "x$with_data_model" != x; then
+	CXXFLAGS="-m{$with_data_model} $CXXFLAGS"
+fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
@@ -10662,6 +10771,14 @@
 _ACEOF
 
 
+CXXFLAGS="$OLD_CXXFLAGS"
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
 if test "x$ac_cv_sizeof_int_p" = x0; then
     # The test failed, lets pick the assumed value.
     ARCH_DATA_MODEL=$HOST_CPU_BITS
@@ -10741,12 +10858,16 @@
     OBJ_SUFFIX='.o'
     EXE_SUFFIX=''
     SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1'
-    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$(JDK_TOPDIR)/$1'
+    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$1'
+    C_FLAG_REORDER=''
+    CXX_FLAG_REORDER=''
     SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN/$1'
     LD="$CC"
     LDEXE="$CC"
     LDCXX="$CXX"
     LDEXECXX="$CXX"
+    # TODO: for embedded set --strip-unneeded
+    POST_STRIP_CMD="$STRIP -g"
 
     # Linking is different on MacOSX
     if test "x$BUILD_OS" = xmacosx; then
@@ -10759,6 +10880,7 @@
         SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/$1'
         SET_SHARED_LIBRARY_MAPFILE=''
         SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
+        POST_STRIP_CMD="$STRIP -S"
     fi
 else
     if test "x$BUILD_OS" = xsolaris; then
@@ -10774,9 +10896,13 @@
         OBJ_SUFFIX='.o'
         EXE_SUFFIX=''
         SET_SHARED_LIBRARY_NAME=''
-        SET_SHARED_LIBRARY_MAPFILE='-M $(JDK_TOPDIR)/$1'
+        SET_SHARED_LIBRARY_MAPFILE='-M $1'
+	C_FLAG_REORDER='-xF'
+	CXX_FLAG_REORDER='-xF'
         SET_SHARED_LIBRARY_ORIGIN='-R \$$$$ORIGIN/$1'
         CFLAGS_JDKLIB_EXTRA='-xstrconst -D__solaris__'
+        POST_STRIP_CMD="$STRIP -x"
+        POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
     fi
     if test "x$BUILD_OS" = xwindows; then
         # If it is not gcc, then assume it is the MS Visual Studio compiler
@@ -10808,6 +10934,10 @@
 
 
 
+
+
+
+
 # The (cross) compiler is now configured, we can now test capabilities
 # of the host platform.
 
@@ -11072,30 +11202,30 @@
         # Source the builddeps file again, to make sure it uses the latest variables!
         . $builddepsfile
         # Look for a host and build machine specific resource!
-        eval resource=\${builddep_bootjdk_BUILD_${rewritten_build_var}_HOST_${rewritten_host_var}}
+        eval resource=\${builddep_boot-jdk_BUILD_${rewritten_build_var}_HOST_${rewritten_host_var}}
         if test "x$resource" = x; then
             # Ok, lets instead look for a host specific resource
-            eval resource=\${builddep_bootjdk_HOST_${rewritten_host_var}}
+            eval resource=\${builddep_boot-jdk_HOST_${rewritten_host_var}}
         fi
         if test "x$resource" = x; then
             # Ok, lets instead look for a build specific resource
-            eval resource=\${builddep_bootjdk_BUILD_${rewritten_build_var}}
+            eval resource=\${builddep_boot-jdk_BUILD_${rewritten_build_var}}
         fi
         if test "x$resource" = x; then
             # Ok, lets instead look for a generic resource
-            # (The bootjdk comes from M4 and not the shell, thus no need for eval here.)
-            resource=${builddep_bootjdk}
+            # (The boot-jdk comes from M4 and not the shell, thus no need for eval here.)
+            resource=${builddep_boot-jdk}
         fi
         if test "x$resource" != x; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Using builddeps $resource for bootjdk" >&5
-$as_echo "$as_me: Using builddeps $resource for bootjdk" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Using builddeps $resource for boot-jdk" >&5
+$as_echo "$as_me: Using builddeps $resource for boot-jdk" >&6;}
 	    # If the resource in the builddeps.conf file is an existing directory,
 	    # for example /java/linux/cups
 	    if test -d ${resource}; then
 	       depdir=${resource}
 	    else
 
-# bootjdk is for example mymodule
+# boot-jdk is for example mymodule
 # $resource is for example libs/general/libmymod_1_2_3.zip
 # $with_builddeps_server is for example ftp://mybuilddeps.myserver.com/builddeps
 # $with_builddeps_dir is for example /localhome/builddeps
@@ -11108,15 +11238,15 @@
     extension=${filename#*.}
     installdir=$with_builddeps_dir/$filebase
     if test ! -f $installdir/$filename.unpacked; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Downloading build dependency bootjdk from $with_builddeps_server/$resource and installing into $installdir" >&5
-$as_echo "$as_me: Downloading build dependency bootjdk from $with_builddeps_server/$resource and installing into $installdir" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Downloading build dependency boot-jdk from $with_builddeps_server/$resource and installing into $installdir" >&5
+$as_echo "$as_me: Downloading build dependency boot-jdk from $with_builddeps_server/$resource and installing into $installdir" >&6;}
         if test ! -d $installdir; then
             mkdir -p $installdir
         fi
         if test ! -d $installdir; then
             as_fn_error $? "Could not create directory $installdir" "$LINENO" 5
         fi
-        tmpfile=`mktemp $installdir/bootjdk.XXXXXXXXX`
+        tmpfile=`mktemp $installdir/boot-jdk.XXXXXXXXX`
         touch $tmpfile
         if test ! -f $tmpfile; then
             as_fn_error $? "Could not create files in directory $installdir" "$LINENO" 5
@@ -11187,11 +11317,11 @@
             # was updated to point at the current build dependency install directory.
             . $builddepsfile
             # Now extract variables from the builddeps.conf files.
-            theroot=${builddep_bootjdk_ROOT}
-            thecflags=${builddep_bootjdk_CFLAGS}
-            thelibs=${builddep_bootjdk_LIBS}
+            theroot=${builddep_boot-jdk_ROOT}
+            thecflags=${builddep_boot-jdk_CFLAGS}
+            thelibs=${builddep_boot-jdk_LIBS}
             if test "x$depdir" = x; then
-                as_fn_error $? "Could not download build dependency bootjdk" "$LINENO" 5
+                as_fn_error $? "Could not download build dependency boot-jdk" "$LINENO" 5
             fi
             BOOT_JDK=$depdir
             if test "x$theroot" != x; then
@@ -11220,15 +11350,15 @@
         fi
         # Aha, the user has set a JAVA_HOME
         # let us use that as the Boot JDK.
-        BOOT_JDK=$JAVA_HOME
+        BOOT_JDK="$JAVA_HOME"
         BOOT_JDK_FOUND=yes
         # To be on the safe side, lets check that it is a JDK.
-        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
-            JAVAC=$BOOT_JDK/bin/javac
-            JAVA=$BOOT_JDK/bin/java
+        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
+            JAVAC="$BOOT_JDK/bin/javac"
+            JAVA="$BOOT_JDK/bin/java"
             BOOT_JDK_FOUND=yes
         else
-            as_fn_error $? "Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK." "$LINENO" 5
+            as_fn_error $? "Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=$JAVA_HOME" "$LINENO" 5
         fi
     fi
 fi
@@ -11634,7 +11764,7 @@
 FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
 if test "x$FOUND_VERSION_78" = x; then
     help_on_build_dependency openjdk
-    as_fn_error $? "Your bootjdk must be version 7 or 8. $HELP_MSG" "$LINENO" 5
+    as_fn_error $? "Your boot-jdk must be version 7 or 8. $HELP_MSG" "$LINENO" 5
 fi
 
 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
@@ -11653,7 +11783,7 @@
 
 
 
-# Use the javac tool from the Boot JDK.
+# Use the javah tool from the Boot JDK.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
 $as_echo_n "checking for javah in Boot JDK... " >&6; }
 JAVAH=$BOOT_JDK/bin/javah
@@ -11686,6 +11816,17 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+# Use the native2ascii tool from the Boot JDK.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native2ascii in Boot JDK" >&5
+$as_echo_n "checking for native2ascii in Boot JDK... " >&6; }
+NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
+if test ! -x $NATIVE2ASCII; then
+    as_fn_error $? "Could not find a working native2ascii" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
 ###############################################################################
 #
 # Pickup additional source for a component from outside of the source root
@@ -13135,9 +13276,6 @@
     as_fn_error $? "Could not find X11 libraries. $HELP_MSG" "$LINENO" 5
 fi
 
-
-
-
 # Some of the old makefiles require a setting of OPENWIN_HOME
 # Since the X11R6 directory has disappeared on later Linuxes,
 # we need to probe for it.
@@ -13154,6 +13292,18 @@
 fi
 
 
+
+#
+# Weird Sol10 something check...TODO change to try compile
+#
+if test "x${HOST_OS}" = xsolaris; then
+  if test "`uname -r`" = "5.10"; then
+     if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
+     	X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
+     fi
+  fi
+fi
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -13192,6 +13342,9 @@
     as_fn_error $? "Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG" "$LINENO" 5
 fi
 
+
+
+
 ###############################################################################
 #
 # The common unix printing system cups is used to print from java.
@@ -13216,7 +13369,7 @@
 
 
 if test "x$CUPS_NOT_NEEDED" = xyes; then
-	if test "x$with_cups" != x || test "x$with_cups-include" != x || test "x$with_cups-lib" != x; then
+	if test "x${with_cups}" != x || test "x${with_cups_include}" != x || test "x${with_cups_lib}" != x; then
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cups not used, so --with-cups is ignored" >&5
 $as_echo "$as_me: WARNING: cups not used, so --with-cups is ignored" >&2;}
 	fi
@@ -13225,21 +13378,21 @@
 else
 	CUPS_FOUND=no
 
-	if test "x$with_cups" = xno || test "x$with_cups-include" = xno || test "x$with_cups-lib" = xno; then
+	if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno || test "x${with_cups_lib}" = xno; then
 	    as_fn_error $? "It is not possible to disable the use of cups. Remove the --without-cups option." "$LINENO" 5
 	fi
 
-	if test "x$with_cups" != x; then
-	    CUPS_LIBS="-L$with_cups/lib -lcups"
-	    CUPS_CFLAGS="-I$with_cups/include"
+	if test "x${with_cups}" != x; then
+	    CUPS_LIBS="-L${with_cups}/lib -lcups"
+	    CUPS_CFLAGS="-I${with_cups}/include"
 	    CUPS_FOUND=yes
 	fi
-	if test "x$with_cups-include" != x; then
-	    CUPS_CFLAGS="-I$with_cups-include"
+	if test "x${with_cups_include}" != x; then
+	    CUPS_CFLAGS="-I${with_cups_include}"
 	    CUPS_FOUND=yes
 	fi
-	if test "x$with_cups-lib" != x; then
-	    CUPS_LIBS="-L$with_cups-lib -lcups"
+	if test "x${with_cups_lib}" != x; then
+	    CUPS_LIBS="-L${with_cups_lib} -lcups"
 	    CUPS_FOUND=yes
 	fi
 	if test "x$CUPS_FOUND" = xno; then
@@ -13796,7 +13949,7 @@
 
 
 if test "x$ALSA_NOT_NEEDED" = xyes; then
-	if test "x$with_alsa" != x || test "x$with_alsa-include" != x || test "x$with_alsa-lib" != x; then
+	if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: alsa not used, so --with-alsa is ignored" >&5
 $as_echo "$as_me: WARNING: alsa not used, so --with-alsa is ignored" >&2;}
 	fi
@@ -13805,21 +13958,21 @@
 else
 	ALSA_FOUND=no
 
-	if test "x$with_alsa" = xno || test "x$with_alsa-include" = xno || test "x$with_alsa-lib" = xno; then
+	if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
 	    as_fn_error $? "It is not possible to disable the use of alsa. Remove the --without-alsa option." "$LINENO" 5
 	fi
 
-	if test "x$with_alsa" != x; then
-	    ALSA_LIBS="-L$with_alsa/lib -lalsa"
-	    ALSA_CFLAGS="-I$with_alsa/include"
+	if test "x${with_alsa}" != x; then
+	    ALSA_LIBS="-L${with_alsa}/lib -lalsa"
+	    ALSA_CFLAGS="-I${with_alsa}/include"
 	    ALSA_FOUND=yes
 	fi
-	if test "x$with_alsa-include" != x; then
-	    ALSA_CFLAGS="-I$with_alsa/include"
+	if test "x${with_alsa_include}" != x; then
+	    ALSA_CFLAGS="-I${with_alsa_include}"
 	    ALSA_FOUND=yes
 	fi
-	if test "x$with_alsa-lib" != x; then
-	    ALSA_LIBS="-L$with_alsa/lib -lalsa"
+	if test "x${with_alsa_lib}" != x; then
+	    ALSA_LIBS="-L${with_alsa_lib} -lalsa"
 	    ALSA_FOUND=yes
 	fi
 	if test "x$ALSA_FOUND" = xno; then
@@ -14090,17 +14243,17 @@
 fi
 
 
-if test "x$with_pulse" != x; then
-    PULSE_LIBS="-L$with_pulse/lib -lfreetype"
-    PULSE_CFLAGS="-I$with_pulse/include"
+if test "x${with_pulse}" != x; then
+    PULSE_LIBS="-L${with_pulse}/lib -lfreetype"
+    PULSE_CFLAGS="-I${with_pulse}/include"
     PULSE_FOUND=yes
 fi
-if test "x$with_pulse-include" != x; then
-    PULSE_CFLAGS="-I$with_pulse/include"
+if test "x${with_pulse_include}" != x; then
+    PULSE_CFLAGS="-I${with_pulse_include}"
     PULSE_FOUND=yes
 fi
-if test "x$with_pulse-lib" != x; then
-    PULSE_LIBS="-L$with_pulse/lib -lfreetype"
+if test "x${with_pulse_lib}" != x; then
+    PULSE_LIBS="-L${with_pulse_lib} -lpulse"
     PULSE_FOUND=yes
 fi
 if test "x$PULSE_FOUND" = xno; then
@@ -14537,9 +14690,9 @@
 # Check the maths library
 #
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
-$as_echo_n "checking for main in -lm... " >&6; }
-if test "${ac_cv_lib_m_main+set}" = set; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if test "${ac_cv_lib_m_cos+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -14547,27 +14700,33 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
 int
 main ()
 {
-return main ();
+return cos ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
-  ac_cv_lib_m_main=yes
-else
-  ac_cv_lib_m_main=no
+  ac_cv_lib_m_cos=yes
+else
+  ac_cv_lib_m_cos=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
-$as_echo "$ac_cv_lib_m_main" >&6; }
-if test "x$ac_cv_lib_m_main" = x""yes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBM 1
 _ACEOF
@@ -14585,6 +14744,61 @@
 
 ###############################################################################
 #
+# Check for libdl.so
+
+save_LIBS="$LIBS"
+LIBS=""
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+  LIBS="-ldl $LIBS"
+
+fi
+
+LIBDL="$LIBS"
+
+LIBS="$save_LIBS"
+
+###############################################################################
+#
 # Should we run the painfully slow javadoc tool?
 #
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build documentation" >&5
@@ -14632,6 +14846,9 @@
 # Setup the opt flags for different compilers
 # and different operating systems.
 #
+C_FLAG_DEPS="-MMD -MF"
+CXX_FLAG_DEPS="-MMD -MF"
+
 case $COMPILER_TYPE in
   CC )
     D_FLAG="-g"
@@ -14641,9 +14858,9 @@
 	  macosx )
 	    # On MacOSX we optimize for size, something
 	    # we should do for all platforms?
-	    C_O_FLAG_HI="-O3"
+	    C_O_FLAG_HI="-Os"
 	    C_O_FLAG_NORM="-Os"
-	    C_O_FLAG_NONE="-O0"
+	    C_O_FLAG_NONE=""
 	    ;;
 	  *)
 	    C_O_FLAG_HI="-O3"
@@ -14656,19 +14873,61 @@
         CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
         ;;
       ossc )
+        #
+        # Forte has different names for this with their C++ compiler...
+        #
+	CXX_FLAG_DEPS="-xMMD -xMF"
+
+# Extra options used with HIGHEST
+#
+# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
+#          done with care, there are some assumptions below that need to
+#          be understood about the use of pointers, and IEEE behavior.
+#
+# Use non-standard floating point mode (not IEEE 754)
+CC_HIGHEST="$CC_HIGHEST -fns"
+# Do some simplification of floating point arithmetic (not IEEE 754)
+CC_HIGHEST="$CC_HIGHEST -fsimple"
+# Use single precision floating point with 'float'
+CC_HIGHEST="$CC_HIGHEST -fsingle"
+# Assume memory references via basic pointer types do not alias
+#   (Source with excessing pointer casting and data access with mixed
+#    pointer types are not recommended)
+CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
+# Use intrinsic or inline versions for math/std functions
+#   (If you expect perfect errno behavior, do not use this)
+CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
+# Loop data dependency optimizations (need -xO3 or higher)
+CC_HIGHEST="$CC_HIGHEST -xdepend"
+# Pointer parameters to functions do not overlap
+#   (Similar to -xalias_level=basic usage, but less obvious sometimes.
+#    If you pass in multiple pointers to the same data, do not use this)
+CC_HIGHEST="$CC_HIGHEST -xrestrict"
+# Inline some library routines
+#   (If you expect perfect errno behavior, do not use this)
+CC_HIGHEST="$CC_HIGHEST -xlibmil"
+# Use optimized math routines
+#   (If you expect perfect errno behavior, do not use this)
+#  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
+#CC_HIGHEST="$CC_HIGHEST -xlibmopt"
+
         case $LEGACY_HOST_CPU1 in
           i586)
+            C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xchip=pentium"
             C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
             C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
             C_O_FLAG_NONE=""
+            CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xchip=pentium"
             CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz"
             CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz"
             CXX_O_FLAG_NONE=""
             ;;
           sparc)
+            C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
             C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
             C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
             C_O_FLAG_NONE=""
+            CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
             CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
             CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
             CXX_O_FLAG_NONE=""
@@ -14687,6 +14946,18 @@
     ;;
 esac
 
+if test -z "$C_O_FLAG_HIGHEST"; then
+   C_O_FLAG_HIGHEST="$C_O_FLAG_HI"
+fi
+
+if test -z "$CXX_O_FLAG_HIGHEST"; then
+   CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI"
+fi
+
+
+
+
+
 
 
 
@@ -14810,16 +15081,17 @@
 #
 case $COMPILER_NAME in
       gcc )
-      	  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer \
+      	  CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
+                          -pipe -fno-omit-frame-pointer \
                           -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
           CFLAGS_JDK="$CFLAGS_JDK -fno-strict-aliasing"
           ;;
       ossc )
-      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa REQUIRED -v -mt -norunpath -xnolib"
-      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt REQUIRED -features=no%except -DCC_NOEX"
+      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -norunpath -xnolib"
+      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX"
           ;;
       cl )
-          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
+          CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
                -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
 	       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
 	       -DWIN32 -DIAL"
@@ -14898,14 +15170,14 @@
 #
 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
 if test "x$COMPILER_TYPE" = xCL; then
-    LDFLAGS_JDKLIB="$LDFLAGS -libpath:${JDK_OUTPUTDIR}/lib jvm.lib java.lib"
+    LDFLAGS_JDKLIB="$LDFLAGS -dll -libpath:${JDK_OUTPUTDIR}/lib -libpath:${JDK_OUTPUTDIR}/objs"
     LDFLAGS_JDKLIB_SUFFIX=""
-    if test "x$HOST_CPU_BITS" = "x64"; then
-        LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj64/jli.lib"
+    if test "$HOST_CPU_BITS" == "64"; then
+        LDFLAGS_STACK_SIZE=1048576
     else
-        LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj/jli.lib"
-    fi
-    LDFLAGS_JDKEXE_SUFFIX=""
+        LDFLAGS_STACK_SIZE=327680
+    fi
+    LDFLAGS_JDKEXE="$LDFLAGS /STACK:$LDFLAGS_STACK_SIZE"
 else
     # If this is a --hash-style=gnu system, use --hash-style=both, why?
     HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
@@ -14920,7 +15192,9 @@
         fi
     fi
 
-    LDFLAGS_JDKLIB="$LDFLAGS $SHARED_LIBRARY_FLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
+    LDFLAGS_JDKLIB="$LDFLAGS $SHARED_LIBRARY_FLAGS \
+                    -L${JDK_OUTPUTDIR}/objs \
+                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
                     -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}client \
   	            -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}"
     LDFLAGS_JDKLIB_SUFFIX="-ljvm -ljava"
@@ -14930,8 +15204,10 @@
 
     # Only the jli library is explicitly linked when the launchers are built.
     # The libjvm is then dynamically loaded/linked by the launcher.
-    LDFLAGS_JDKEXE="$LDFLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
-    LDFLAGS_JDKEXE_SUFFIX="-ljli"
+    if test "x$HOST_OS" != "xmacosx"; then
+       LDFLAGS_JDKEXE="$LDFLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
+       LDFLAGS_JDKEXE_SUFFIX="-ljli"
+    fi
 fi
 
 
@@ -15081,17 +15357,39 @@
 # Could someone enlighten this configure script with a comment about libCrun?
 # The LEGACY_HOST_CPU3 is the setting for ISA_DIR.
 #
-if test "x$HOST_OS" = xsolaris; then
-    LIBCXX="$LIBCXX /usr/lib${LEGACY_HOST_CPU3}/libCrun.so.1"
+if test "x$HOST_OS" = xsolaris && test "x$LIBCXX" = x; then
+    LIBCXX="/usr/lib${LEGACY_HOST_CPU3}/libCrun.so.1"
+fi
+
+# TODO better (platform agnostic) test
+if test "x$HOST_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
+    LIBCXX="-lstdc++"
 fi
 
 
 
 ###############################################################################
+
+OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
+OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
+OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
+OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
+
+
+
+
+###############################################################################
 #
 # Misc
 #
 
+# The name of the Service Agent jar.
+SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
+if test "x$HOST_OS" = "xwindows"; then
+    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
+fi
+
+
 # Control wether Hotspot runs Queens test after build.
 # Check whether --enable-hotspot-test-in-build was given.
 if test "${enable_hotspot_test_in_build+set}" = set; then :
@@ -15109,19 +15407,48 @@
 
 ###############################################################################
 #
-# A helpful message at the end of the configure run.
-#
-if test "x$CCACHE_FOUND" = x && test "x$GCC" = xyes; then
-    help_on_build_dependency ccache
-
-    printf "\nTip of the day:\nYou should really install ccache version 3.1.4 or newer.\n"
-    printf "It gives a tremendous speedup for C++ recompilations with precompiled headers!\n"
-fi
-
-if test "x$CCACHE_FOUND" != x && test "x$HAS_GOOD_CCACHE" = x; then
-    printf "You have a ccache installed, but it is a version prior to 3.1.4. Try upgrading.\n"
-fi
-
+# Choose cacerts source file
+#
+
+# Check whether --with-cacerts-file was given.
+if test "${with_cacerts_file+set}" = set; then :
+  withval=$with_cacerts_file;
+fi
+
+if test "x$with_cacerts_file" != x; then
+    CACERTS_FILE=$with_cacerts_file
+else
+    if test "x$OPENJDK" = "xtrue"; then
+        CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
+    else
+        CACERTS_FILE=${SRC_ROOT}/jdk/src/closed/share/lib/security/cacerts.internal
+    fi
+fi
+
+
+# Check if build directory is on local disk.
+# return 0 if it is on local disk, non-0 if on remote disk or failure
+function is_directory_on_local_disk {
+	# df -l lists only local disks; if the given directory is not found then
+	# a non-zero exit code is given
+	$DF -l $1 > /dev/null 2>&1
+}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if build directory is on local disk" >&5
+$as_echo_n "checking if build directory is on local disk... " >&6; }
+if is_directory_on_local_disk $OUTPUT_ROOT; then
+	OUTPUT_DIR_IS_LOCAL="yes"
+else
+	OUTPUT_DIR_IS_LOCAL="no"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OUTPUT_DIR_IS_LOCAL" >&5
+$as_echo "$OUTPUT_DIR_IS_LOCAL" >&6; }
+
+# We're messing a bit with internal autoconf variables to put the config.status in the
+# output directory instead of the current directory.
+CONFIG_STATUS=$OUTPUT_ROOT/config.status
+
+# Now create the actual output files, after this, the main work of configure is done
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -16393,3 +16720,62 @@
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
+
+# Finally output some useful information to the user
+
+if test "x$CCACHE_FOUND" != x; then
+	if  test "x$HAS_GOOD_CCACHE" = x; then
+		CCACHE_STATUS="installed, but disabled (version older than 3.1.4)"
+		CCACHE_HELP_MSG="You have ccache installed, but it is a version prior to 3.1.4. Try upgrading."
+	else
+		CCACHE_STATUS="installed and in use"
+	fi
+else
+	if test "x$GCC" = xyes; then
+		CCACHE_STATUS="not installed (consider installing)"
+		CCACHE_HELP_MSG="You do not have ccache installed. Try installing it."
+	else
+		CCACHE_STATUS="not available for your system"
+	fi
+fi
+
+printf "\n"
+printf "====================================================\n"
+printf "A new configuration has been successfully created in\n"
+printf "$OUTPUT_ROOT\n"
+if test "x$CONFIGURE_COMMAND_LINE" != x; then
+	printf "using configure arguments '$CONFIGURE_COMMAND_LINE'.\n"
+else
+	printf "using default settings.\n"
+fi
+
+printf "\n"
+printf "Configuration summary:\n"
+printf "* Debug level:  $DEBUG_LEVEL\n"
+printf "* JDK variant:  $JDK_VARIANT\n"
+printf "* JVM variants: $with_jvm_variants\n"
+printf "* Host info:    OS: $HOST_OS, CPU architecture: $HOST_CPU_ARCH, address length: $HOST_CPU_BITS\n"
+printf "* Boot JDK:     $BOOT_JDK\n"
+
+printf "\n"
+printf "Build performance summary:\n"
+printf "* Cores to use:  $NUM_CORES\n"
+printf "* Memory limit:  $MEMORY_SIZE MB\n"
+printf "* ccache status: $CCACHE_STATUS\n"
+
+if test "x$OUTPUT_DIR_IS_LOCAL" != "xyes"; then
+	printf "\n"
+	printf "WARNING: Your build output directory is not on a local disk.\n"
+	printf "This will severely degrade build performance!\n"
+	printf "It is recommended that you create an output directory on a local disk,\n"
+	printf "and run the configure script again from that directory.\n"
+fi
+
+if test "x$CCACHE_HELP_MSG" != x; then
+	printf "\n"
+	printf "Build performance tip: ccache gives a tremendous speedup for C++ recompilations.\n"
+	printf "$CCACHE_HELP_MSG\n"
+
+    help_on_build_dependency ccache
+    printf "$HELP_MSG\n"
+fi
--- a/common/autoconf/configure.ac	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/configure.ac	Sun Jun 17 22:07:44 2012 -0700
@@ -93,7 +93,7 @@
 CHECK_NONEMPTY(MAKE)
 MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'`
 if test "x$MAKE_VERSION" = x; then
-    AC_ERROR([You must use GNU make 3.81 or newer! Please put it in the path.])
+    AC_MSG_ERROR([You must use GNU make 3.81 or newer! Please put it in the path.])
 fi
 AC_PATH_PROG(MKDIR, mkdir)
 CHECK_NONEMPTY(MKDIR)
@@ -147,6 +147,8 @@
 CHECK_NONEMPTY(EXPR)
 AC_PATH_PROG(FILE, file)
 CHECK_NONEMPTY(FILE)
+AC_PATH_PROG(HG, hg)
+
 # Figure out the build and host system.
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
@@ -157,7 +159,7 @@
 if test "x$with_data_model" != x && \
    test "x$with_data_model" != x32 && \
    test "x$with_data_model" != x64 ; then
-    AC_ERROR([The data model can only be 32 or 64!])
+    AC_MSG_ERROR([The data model can only be 32 or 64!])
 fi
 # Translate the standard cpu-vendor-kernel-os quadruplets into
 # the new HOST_.... and BUILD_... and the legacy names used by
@@ -221,7 +223,7 @@
 PATH_SEP=":"
 if test "x$BUILD_OS" = "xwindows"; then
     if test "x$CYGPATH" = x; then
-        AC_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
+        AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
     fi
     PATH_SEP=";"
 fi
@@ -239,12 +241,12 @@
 #
 # OpenJDK or closed
 #
-AC_ARG_ENABLE([openjdk], [AS_HELP_STRING([--enable-openjdk],
+AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
     [build OpenJDK regardless of the presence of closed repositories @<:@disabled@:>@])],,)
 
-if test "x$enable_openjdk" = "xyes"; then
+if test "x$enable_openjdk_only" = "xyes"; then
     OPENJDK=true
-elif test "x$enable_openjdk" = "xno"; then
+elif test "x$enable_openjdk_only" = "xno"; then
     OPENJDK=false
 elif test -d "$SRC_ROOT/jdk/src/closed"; then
     OPENJDK=false
@@ -298,7 +300,7 @@
     MINIMIZE_RAM_USAGE="MINIMIZE_RAM_USAGE:=true"
     JDK_VARIANT="embedded"
 else
-    AC_ERROR([The available JDK variants are: normal, embedded])
+    AC_MSG_ERROR([The available JDK variants are: normal, embedded])
 fi
                               
 AC_SUBST(JAVASE_EMBEDDED)
@@ -370,7 +372,7 @@
 TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'`
 
 if test "x$TEST_VARIANTS" != "x,"; then
-   AC_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark])
+   AC_MSG_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark])
 fi   
 AC_MSG_RESULT([$with_jvm_variants])
 
@@ -382,12 +384,12 @@
 
 if test "x$JVM_VARIANT_CLIENT" = xtrue; then
     if test "x$HOST_CPU_BITS" = x64; then
-        AC_ERROR([You cannot build a client JVM for a 64-bit machine.])
+        AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
     fi
 fi
 if test "x$JVM_VARIANT_KERNEL" = xtrue; then
     if test "x$HOST_CPU_BITS" = x64; then
-        AC_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
+        AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
     fi
 fi
 
@@ -426,7 +428,7 @@
 	[
         DEBUG_LEVEL="${withval}"
         if test "x$ENABLE_DEBUG" = xyes; then
-			AC_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
+			AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
         fi
     ])
 AC_MSG_RESULT([$DEBUG_LEVEL])
@@ -434,7 +436,7 @@
 if test "x$DEBUG_LEVEL" != xrelease && \
    test "x$DEBUG_LEVEL" != xfastdebug && \
    test "x$DEBUG_LEVEL" != xslowdebug; then
-   AC_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
+   AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
 fi
 
 case $DEBUG_LEVEL in
@@ -520,14 +522,18 @@
 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
     # We are running configure from the src root.
     # Create a default ./build/host-variant-debuglevel output root.
-    OUTPUT_ROOT="$SRC_ROOT/build/${HOST_OS}-${HOST_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
+    CONF_NAME="${HOST_OS}-${HOST_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
+    OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
     mkdir -p "$OUTPUT_ROOT"
     if test ! -d "$OUTPUT_ROOT"; then
-        AC_ERROR([Could not create build directory $OUTPUT_ROOT])
+        AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
     fi
 else
     # We are running configure from outside of the src dir.
     # Then use the current directory as output dir!
+    # If configuration is situated in normal build directory, just use the build
+    # directory name as configuration name, otherwise use the complete path.
+    CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
     OUTPUT_ROOT="$CURDIR"
 fi
 
@@ -565,7 +571,7 @@
 	if test "x$VARSBAT" = x || test ! -d "$VCPATH"; then
             AC_MSG_CHECKING([if we can find the VS installation])
             AC_MSG_RESULT([no])
-            AC_ERROR([Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
+            AC_MSG_ERROR([Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
         fi
         case "$LEGACY_HOST_CPU1" in
           i?86)
@@ -577,12 +583,12 @@
         esac
         # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
         cd $OUTPUT_ROOT
-        $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
+        bash $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
 	cd $CURDIR
 	if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then
             AC_MSG_CHECKING([if we can extract the needed env variables])
             AC_MSG_RESULT([no])
-            AC_ERROR([Could not succesfully extract the env variables needed for the VS setup. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
+            AC_MSG_ERROR([Could not succesfully extract the env variables needed for the VS setup. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
         fi 
         # Now set all paths and other env variables. This will allow the rest of 
         # the configure script to find and run the compiler in the proper way.
@@ -592,7 +598,7 @@
             AC_MSG_RESULT([$VCINSTALLDIR])
         else 
             AC_MSG_RESULT([no])
-            AC_ERROR([Could not find VS installation. Please install. If you are sure you have installed VS, then please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
+            AC_MSG_ERROR([Could not find VS installation. Please install. If you are sure you have installed VS, then please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
         fi
         CHECK_FOR_VCINSTALLDIR=no
 	SETUPDEVENV="include $OUTPUT_ROOT/localdevenv.gmk"
@@ -614,7 +620,7 @@
         fi
 	if test "x$MSVCR100DLL" = x; then
            AC_MSG_RESULT([no])
-	   AC_ERROR([Could not find msvcr100.dll !])
+	   AC_MSG_ERROR([Could not find msvcr100.dll !])
         fi
         AC_MSG_RESULT([$MSVCR100DLL])
 	SPACESAFE(MSVCR100DLL,[the path to msvcr100.dll])
@@ -636,6 +642,7 @@
 AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
 
 AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
+AC_SUBST(CONF_NAME, $CONF_NAME)
 AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
 
 # Where are the sources. Any of these can be overridden
@@ -783,13 +790,15 @@
 ORG_CXXFLAGS="$CXXFLAGS"
 ORG_OBJCFLAGS="$OBJCFLAGS"
 
+prepare_help_system
+
 # gcc is almost always present, but on Windows we
 # prefer cl.exe and on Solaris we prefer CC.
 # Thus test for them in this order.
 AC_PROG_CC([cl cc gcc])
 if test "x$CC" = x; then
     help_on_build_dependency devkit
-    AC_ERROR([Could not find a compiler. $HELP_MSG])
+    AC_MSG_ERROR([Could not find a compiler. $HELP_MSG])
 fi
 if test "x$CC" = xcc && test "x$BUILD_OS" = xmacosx; then
     # Do not use cc on MacOSX use gcc instead.
@@ -807,7 +816,7 @@
 
 if test "x$CXX" = x || test "x$CC" = x; then
     help_on_build_dependency devkit
-    AC_ERROR([Could not find the needed compilers! $HELP_MSG ])
+    AC_MSG_ERROR([Could not find the needed compilers! $HELP_MSG ])
 fi
 
 if test "x$BUILD_OS" != xwindows; then
@@ -832,9 +841,10 @@
 
 AC_CHECK_TOOL(LD, ld)
 WHICHCMD(LD)
-LDEXE="$LD"
-LDCXX="$LD"
-LDEXECXX="$LD"
+LD="$CC"
+LDEXE="$CC"
+LDCXX="$CXX"
+LDEXECXX="$CXX"
 # LDEXE is the linker to use, when creating executables.
 AC_SUBST(LDEXE)
 # Linking C++ libraries.
@@ -856,7 +866,7 @@
 AS_IF([test "x$BUILD_OS" = xwindows], [
     # For now, assume that we are always compiling using cl.exe. 
     CC_OUT_OPTION=-Fo
-    EXE_OUT_OPTION=-Fe
+    EXE_OUT_OPTION=-out:
     LD_OUT_OPTION=-out:
     AR_OUT_OPTION=-out:
     # On Windows, reject /usr/bin/link, which is a cygwin
@@ -866,10 +876,9 @@
     # the full path to the link.exe program.
     WHICHCMD_SPACESAFE([WINLD])
     LD="$WINLD"
-    # However creating executables can only be done with cl.exe. 
-    LDEXE="$CC"
+    LDEXE="$WINLD"
     LDCXX="$WINLD"
-    LDEXECXX="$CC"
+    LDEXECXX="$WINLD"
 
     AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
     WHICHCMD_SPACESAFE([MT])
@@ -877,7 +886,7 @@
     AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
     WHICHCMD_SPACESAFE([RC])
 
-    RC_FLAGS="/l 0x409 /r"
+    RC_FLAGS="-nologo /l 0x409 /r"
     AS_IF([test "x$VARIANT" = xOPT], [
         RC_FLAGS="$RC_FLAGS -d NDEBUG"
     ])
@@ -903,14 +912,13 @@
     WHICHCMD_SPACESAFE([DUMPBIN])
 
     COMPILER_TYPE=CL
-    CFLAGS="$CFLAGS -nologo"
-    LDFLAGS="$LDFLAGS -nologo -dll -opt:ref -incremental:no "
+    CCXXFLAGS="$CCXXFLAGS -nologo"
+    LDFLAGS="$LDFLAGS -nologo -opt:ref -incremental:no"
     if test "x$LEGACY_HOST_CPU1" = xi586; then 
         LDFLAGS="$LDFLAGS -safeseh"
     fi
-    if test "x$DEBUG_LEVEL" != xrelease; then
-        LDFLAGS="$LDFLAGS -debug"
-    fi
+    # TODO: make -debug optional "--disable-full-debug-symbols"
+    LDFLAGS="$LDFLAGS -debug"
 ])
 AC_SUBST(RC_FLAGS)
 AC_SUBST(COMPILER_TYPE)
@@ -933,7 +941,7 @@
 AC_SUBST(AS)
 AC_SUBST(ASFLAGS)
 
-if test "x$HOST_CPU_BITS" = x32 && test "x$HOST_OS" = macosx; then
+if test "x$HOST_CPU_BITS" = x32 && test "x$HOST_OS" = xmacosx; then
     # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
     # While waiting for a better solution, the current workaround is to use -mstackrealign.
     CFLAGS="$CFLAGS -mstackrealign"
@@ -944,7 +952,7 @@
                    ],
 	           [
 		        AC_MSG_RESULT([no])
-	                AC_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
+	                AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
 	           ])
 fi
 
@@ -979,7 +987,7 @@
     if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then 
         AC_MSG_RESULT([no])
         cat $OUTPUT_ROOT/uncygdrive1.log
-        AC_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
+        AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
     fi
     AC_MSG_RESULT([$UNCYGDRIVE])
     AC_MSG_CHECKING([if uncygdrive.exe works])
@@ -989,7 +997,7 @@
     if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then 
         AC_MSG_RESULT([no])
         cat $OUTPUT_ROOT/uncygdrive2.log
-        AC_ERROR([Uncygdrive did not work!])
+        AC_MSG_ERROR([Uncygdrive did not work!])
     fi
     AC_MSG_RESULT([yes])
     rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
@@ -1014,7 +1022,15 @@
 # (The JVM can use 32 or 64 bit Java pointers but that decision
 # is made at runtime.)
 #
+AC_LANG_PUSH(C++)
+OLD_CXXFLAGS="$CXXFLAGS"
+if test "x$HOST_OS" = xsolaris && test "x$with_data_model" != x; then
+	CXXFLAGS="-m{$with_data_model} $CXXFLAGS"
+fi
 AC_CHECK_SIZEOF([int *], [1111])
+CXXFLAGS="$OLD_CXXFLAGS"
+AC_LANG_POP(C++)
+
 if test "x$ac_cv_sizeof_int_p" = x0; then 
     # The test failed, lets pick the assumed value.
     ARCH_DATA_MODEL=$HOST_CPU_BITS
@@ -1032,7 +1048,7 @@
 AC_SUBST(ARCH_DATA_MODEL)
 
 if test "x$ARCH_DATA_MODEL" != "x$HOST_CPU_BITS"; then
-    AC_ERROR([The tested number of bits in the host ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the host ($HOST_CPU_BITS)])
+    AC_MSG_ERROR([The tested number of bits in the host ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the host ($HOST_CPU_BITS)])
 fi
 
 ###############################################################################
@@ -1084,12 +1100,16 @@
     OBJ_SUFFIX='.o'
     EXE_SUFFIX=''
     SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1'
-    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$(JDK_TOPDIR)/$1'
+    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$1'
+    C_FLAG_REORDER=''
+    CXX_FLAG_REORDER=''
     SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN/$1'
     LD="$CC"
     LDEXE="$CC"
     LDCXX="$CXX"
     LDEXECXX="$CXX"
+    # TODO: for embedded set --strip-unneeded
+    POST_STRIP_CMD="$STRIP -g"
 
     # Linking is different on MacOSX
     if test "x$BUILD_OS" = xmacosx; then
@@ -1102,6 +1122,7 @@
         SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/$1' 
         SET_SHARED_LIBRARY_MAPFILE=''
         SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
+        POST_STRIP_CMD="$STRIP -S"
     fi
 else
     if test "x$BUILD_OS" = xsolaris; then
@@ -1117,9 +1138,13 @@
         OBJ_SUFFIX='.o'
         EXE_SUFFIX=''
         SET_SHARED_LIBRARY_NAME=''
-        SET_SHARED_LIBRARY_MAPFILE='-M $(JDK_TOPDIR)/$1'
+        SET_SHARED_LIBRARY_MAPFILE='-M $1'
+	C_FLAG_REORDER='-xF'
+	CXX_FLAG_REORDER='-xF'
         SET_SHARED_LIBRARY_ORIGIN='-R \$$$$ORIGIN/$1'
         CFLAGS_JDKLIB_EXTRA='-xstrconst -D__solaris__'
+        POST_STRIP_CMD="$STRIP -x"
+        POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
     fi
     if test "x$BUILD_OS" = xwindows; then
         # If it is not gcc, then assume it is the MS Visual Studio compiler
@@ -1149,7 +1174,11 @@
 AC_SUBST(SHARED_LIBRARY_FLAGS)
 AC_SUBST(SET_SHARED_LIBRARY_NAME)
 AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
+AC_SUBST(C_FLAG_REORDER)
+AC_SUBST(CXX_FLAG_REORDER)
 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
+AC_SUBST(POST_STRIP_CMD)
+AC_SUBST(POST_MCS_CMD)
 
 # The (cross) compiler is now configured, we can now test capabilities
 # of the host platform.
@@ -1161,13 +1190,13 @@
 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal"])
 
 if test "x$ENDIAN" = xuniversal; then
-    AC_ERROR([It seems like someone needs to decide how we are to deal with universal binaries on the MacOSX?])
+    AC_MSG_ERROR([It seems like someone needs to decide how we are to deal with universal binaries on the MacOSX?])
 fi
 if test "x$ENDIAN" = xunknown; then
     ENDIAN="$HOST_CPU_ENDIAN"
 fi
 if test "x$ENDIAN" != "x$HOST_CPU_ENDIAN"; then
-    AC_WARN([The tested endian in the host ($ENDIAN) differs from the endian expected to be found in the host ($HOST_CPU_ENDIAN)])
+    AC_MSG_WARN([The tested endian in the host ($ENDIAN) differs from the endian expected to be found in the host ($HOST_CPU_ENDIAN)])
     ENDIAN="$HOST_CPU_ENDIAN"
 fi
 AC_SUBST(ENDIAN)
@@ -1185,25 +1214,25 @@
     BOOT_JDK_FOUND=yes
 fi
 if test "x$BOOT_JDK_FOUND" = xno; then
-    BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no])
+    BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no])
 fi
 
 if test "x$BOOT_JDK_FOUND" = xno; then
     if test "x$JAVA_HOME" != x; then
         if test ! -d "$JAVA_HOME"; then
-            AC_ERROR([Your JAVA_HOME points to a non-existing directory!])
+            AC_MSG_ERROR([Your JAVA_HOME points to a non-existing directory!])
         fi
         # Aha, the user has set a JAVA_HOME
         # let us use that as the Boot JDK.
-        BOOT_JDK=$JAVA_HOME
+        BOOT_JDK="$JAVA_HOME"
         BOOT_JDK_FOUND=yes
         # To be on the safe side, lets check that it is a JDK.
-        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
-            JAVAC=$BOOT_JDK/bin/javac
-            JAVA=$BOOT_JDK/bin/java
+        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
+            JAVAC="$BOOT_JDK/bin/javac"
+            JAVA="$BOOT_JDK/bin/java"
             BOOT_JDK_FOUND=yes
         else
-            AC_ERROR([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK.])
+            AC_MSG_ERROR([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=[$]JAVA_HOME])
         fi            
     fi
 fi
@@ -1260,11 +1289,11 @@
         fi
         if test "x$BOOT_JDK_FOUND" = xno; then
             help_on_build_dependency openjdk
-            AC_ERROR([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG])
+            AC_MSG_ERROR([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG])
         fi
     else
         help_on_build_dependency openjdk
-        AC_ERROR([Could not find a JDK. $HELP_MSG])
+        AC_MSG_ERROR([Could not find a JDK. $HELP_MSG])
     fi
 fi
 
@@ -1281,7 +1310,7 @@
     # On MacOSX it is called classes.jar
     BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar
     if test ! -f $BOOT_RTJAR; then
-        AC_ERROR([Cannot find the rt.jar or its equivalent!])
+        AC_MSG_ERROR([Cannot find the rt.jar or its equivalent!])
     fi
     # Remove the .. 
     BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
@@ -1303,7 +1332,7 @@
 AC_MSG_CHECKING([for java in Boot JDK])
 JAVA=$BOOT_JDK/bin/java
 if test ! -x $JAVA; then
-    AC_ERROR([Could not find a working java])
+    AC_MSG_ERROR([Could not find a working java])
 fi
 BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1`
 AC_MSG_RESULT([yes $BOOT_JDK_VERSION])
@@ -1313,7 +1342,7 @@
 [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
 if test "x$FOUND_VERSION_78" = x; then
     help_on_build_dependency openjdk
-    AC_ERROR([Your bootjdk must be version 7 or 8. $HELP_MSG])
+    AC_MSG_ERROR([Your boot-jdk must be version 7 or 8. $HELP_MSG])
 fi
 
 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
@@ -1324,17 +1353,17 @@
 AC_MSG_CHECKING([for javac in Boot JDK])
 JAVAC=$BOOT_JDK/bin/javac
 if test ! -x $JAVAC; then
-    AC_ERROR([Could not find a working javac])
+    AC_MSG_ERROR([Could not find a working javac])
 fi
 AC_MSG_RESULT(yes)
 AC_SUBST(JAVAC)
 AC_SUBST(JAVAC_FLAGS)
 
-# Use the javac tool from the Boot JDK.
+# Use the javah tool from the Boot JDK.
 AC_MSG_CHECKING([for javah in Boot JDK])
 JAVAH=$BOOT_JDK/bin/javah
 if test ! -x $JAVAH; then
-    AC_ERROR([Could not find a working javah])
+    AC_MSG_ERROR([Could not find a working javah])
 fi
 AC_MSG_RESULT(yes)
 AC_SUBST(JAVAH)
@@ -1343,7 +1372,7 @@
 AC_MSG_CHECKING([for jar in Boot JDK])
 JAR=$BOOT_JDK/bin/jar
 if test ! -x $JAR; then
-    AC_ERROR([Could not find a working jar])
+    AC_MSG_ERROR([Could not find a working jar])
 fi
 AC_SUBST(JAR)
 AC_MSG_RESULT(yes)
@@ -1352,11 +1381,20 @@
 AC_MSG_CHECKING([for rmic in Boot JDK])
 RMIC=$BOOT_JDK/bin/rmic
 if test ! -x $RMIC; then
-    AC_ERROR([Could not find a working rmic])
+    AC_MSG_ERROR([Could not find a working rmic])
 fi
 AC_SUBST(RMIC)
 AC_MSG_RESULT(yes)
 
+# Use the native2ascii tool from the Boot JDK.
+AC_MSG_CHECKING([for native2ascii in Boot JDK])
+NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
+if test ! -x $NATIVE2ASCII; then
+    AC_MSG_ERROR([Could not find a working native2ascii])
+fi
+AC_MSG_RESULT(yes)
+AC_SUBST(NATIVE2ASCII)
+
 ###############################################################################
 #
 # Pickup additional source for a component from outside of the source root
@@ -1382,7 +1420,7 @@
 
 if test "x$with_add_source_root" != x; then
     if ! test -d $with_add_source_root; then
-       AC_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
+       AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
     fi
     CURDIR="$PWD"
     cd "$with_add_source_root"
@@ -1392,34 +1430,34 @@
     # If it does, then it is usually an error, prevent this.
     if test -f $with_add_source_root/langtools/makefiles/Makefile || \
        test -f $with_add_source_root/langtools/make/Makefile; then
-        AC_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
+        AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
     fi
     if test -f $with_add_source_root/corba/makefiles/Makefile || \
        test -f $with_add_source_root/corba/make/Makefile; then
-        AC_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
+        AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
     fi
     if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
        test -f $with_add_source_root/jaxp/make/Makefile; then
-        AC_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
+        AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
     fi
     if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
        test -f $with_add_source_root/jaxws/make/Makefile; then
-        AC_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
+        AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
     fi
     if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
        test -f $with_add_source_root/hotspot/make/Makefile; then
-        AC_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
+        AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
     fi
     if test -f $with_add_source_root/jdk/makefiles/Makefile || \
        test -f $with_add_source_root/jdk/make/Makefile; then
-        AC_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
+        AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
     fi
 fi
 AC_SUBST(ADD_SRC_ROOT)
 
 if test "x$with_override_source_root" != x; then
     if ! test -d $with_override_source_root; then
-       AC_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
+       AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
     fi
     CURDIR="$PWD"
     cd "$with_override_source_root"
@@ -1427,27 +1465,27 @@
     cd "$CURDIR"
     if test -f $with_override_source_root/langtools/makefiles/Makefile || \
        test -f $with_override_source_root/langtools/make/Makefile; then
-        AC_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
+        AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
     fi
     if test -f $with_override_source_root/corba/makefiles/Makefile || \
        test -f $with_override_source_root/corba/make/Makefile; then
-        AC_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
+        AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
     fi
     if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
        test -f $with_override_source_root/jaxp/make/Makefile; then
-        AC_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
+        AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
     fi
     if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
        test -f $with_override_source_root/jaxws/make/Makefile; then
-        AC_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
+        AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
     fi
     if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
        test -f $with_override_source_root/hotspot/make/Makefile; then
-        AC_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
+        AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
     fi
     if test -f $with_override_source_root/jdk/makefiles/Makefile || \
        test -f $with_override_source_root/jdk/make/Makefile; then
-        AC_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
+        AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
     fi
 fi
 AC_SUBST(OVERRIDE_SRC_ROOT)
@@ -1495,7 +1533,7 @@
     LANGTOOLS_TOPDIR="`pwd`"
     cd "$CURDIR"
     if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then
-        AC_ERROR([You have to override langtools with a full langtools repo!])
+        AC_MSG_ERROR([You have to override langtools with a full langtools repo!])
     fi
     AC_MSG_CHECKING([if langtools should be overridden])
     AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
@@ -1506,7 +1544,7 @@
     CORBA_TOPDIR="`pwd`"
     cd "$CURDIR"
     if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then
-        AC_ERROR([You have to override corba with a full corba repo!])
+        AC_MSG_ERROR([You have to override corba with a full corba repo!])
     fi
     AC_MSG_CHECKING([if corba should be overridden])
     AC_MSG_RESULT([yes with $CORBA_TOPDIR])
@@ -1517,7 +1555,7 @@
     JAXP_TOPDIR="`pwd`"
     cd "$CURDIR"
     if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then
-        AC_ERROR([You have to override jaxp with a full jaxp repo!])
+        AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!])
     fi
     AC_MSG_CHECKING([if jaxp should be overridden])
     AC_MSG_RESULT([yes with $JAXP_TOPDIR])
@@ -1528,7 +1566,7 @@
     JAXWS_TOPDIR="`pwd`"
     cd "$CURDIR"
     if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then
-        AC_ERROR([You have to override jaxws with a full jaxws repo!])
+        AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!])
     fi
     AC_MSG_CHECKING([if jaxws should be overridden])
     AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
@@ -1540,7 +1578,7 @@
     cd "$CURDIR"
     if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \
        ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then
-        AC_ERROR([You have to override hotspot with a full hotspot repo!])
+        AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!])
     fi
     AC_MSG_CHECKING([if hotspot should be overridden])
     AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
@@ -1551,7 +1589,7 @@
     JDK_TOPDIR="`pwd`"
     cd "$CURDIR"
     if ! test -f $JDK_TOPDIR/makefiles/Makefile; then
-        AC_ERROR([You have to override JDK with a full JDK repo!])
+        AC_MSG_ERROR([You have to override JDK with a full JDK repo!])
     fi
     AC_MSG_CHECKING([if JDK should be overridden])
     AC_MSG_RESULT([yes with $JDK_TOPDIR])
@@ -1605,7 +1643,7 @@
     SERVER_JAVA="$with_server_java"
     FOUND_VERSION=`$SERVER_JAVA -version 2>&1 | grep " version \""`
     if test "x$FOUND_VERSION" = x; then
-        AC_ERROR([Could not execute server java: $SERVER_JAVA])
+        AC_MSG_ERROR([Could not execute server java: $SERVER_JAVA])
     fi
 else
     SERVER_JAVA=""
@@ -1806,12 +1844,9 @@
 
 if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then 
     help_on_build_dependency x11
-    AC_ERROR([Could not find X11 libraries. $HELP_MSG])
+    AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
 fi
 
-AC_SUBST(X_CFLAGS)
-AC_SUBST(X_LIBS)
-
 # Some of the old makefiles require a setting of OPENWIN_HOME
 # Since the X11R6 directory has disappeared on later Linuxes,
 # we need to probe for it.
@@ -1828,6 +1863,18 @@
 fi
 AC_SUBST(OPENWIN_HOME)
 
+
+#
+# Weird Sol10 something check...TODO change to try compile
+#
+if test "x${HOST_OS}" = xsolaris; then
+  if test "`uname -r`" = "5.10"; then
+     if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
+     	X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
+     fi
+  fi
+fi
+
 AC_LANG_PUSH(C)
 OLD_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $X_CFLAGS"
@@ -1839,9 +1886,12 @@
 
 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then 
     help_on_build_dependency x11
-    AC_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG])
+    AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG])
 fi
 
+AC_SUBST(X_CFLAGS)
+AC_SUBST(X_LIBS)
+
 ###############################################################################
 #
 # The common unix printing system cups is used to print from java.
@@ -1855,7 +1905,7 @@
 	[specify directory for the cups library])])
 
 if test "x$CUPS_NOT_NEEDED" = xyes; then
-	if test "x$with_cups" != x || test "x$with_cups-include" != x || test "x$with_cups-lib" != x; then
+	if test "x${with_cups}" != x || test "x${with_cups_include}" != x || test "x${with_cups_lib}" != x; then
 		AC_MSG_WARN([cups not used, so --with-cups is ignored])
 	fi
 	CUPS_CFLAGS=
@@ -1863,21 +1913,21 @@
 else
 	CUPS_FOUND=no
 
-	if test "x$with_cups" = xno || test "x$with_cups-include" = xno || test "x$with_cups-lib" = xno; then
-	    AC_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
+	if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno || test "x${with_cups_lib}" = xno; then
+	    AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
 	fi
 
-	if test "x$with_cups" != x; then
-	    CUPS_LIBS="-L$with_cups/lib -lcups"
-	    CUPS_CFLAGS="-I$with_cups/include"
+	if test "x${with_cups}" != x; then
+	    CUPS_LIBS="-L${with_cups}/lib -lcups"
+	    CUPS_CFLAGS="-I${with_cups}/include"
 	    CUPS_FOUND=yes
 	fi
-	if test "x$with_cups-include" != x; then
-	    CUPS_CFLAGS="-I$with_cups-include"
+	if test "x${with_cups_include}" != x; then
+	    CUPS_CFLAGS="-I${with_cups_include}"
 	    CUPS_FOUND=yes
 	fi
-	if test "x$with_cups-lib" != x; then
-	    CUPS_LIBS="-L$with_cups-lib -lcups"
+	if test "x${with_cups_lib}" != x; then
+	    CUPS_LIBS="-L${with_cups_lib} -lcups"
 	    CUPS_FOUND=yes
 	fi
 	if test "x$CUPS_FOUND" = xno; then
@@ -1910,7 +1960,7 @@
 	fi
 	if test "x$CUPS_FOUND" = xno; then 
 	    help_on_build_dependency cups
-	    AC_ERROR([Could not find cups! $HELP_MSG ])
+	    AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
 	fi
 fi
 
@@ -1953,16 +2003,16 @@
    	    if test "x$FREETYPE2_FOUND" = xyes; then
 	        # Verify that the directories exist 
                 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
-		   AC_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
+		   AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
 		fi
 	        # List the contents of the lib.
 		FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
                 if test "x$FREETYPELIB" = x; then
-		   AC_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib])
+		   AC_MSG_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib])
 		fi
 	        # Check one h-file
                 if ! test -s "$with_freetype/include/ft2build.h"; then
-		   AC_ERROR([Could not find $with_freetype/include/ft2build.h])
+		   AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
 		fi
             fi
         fi
@@ -2010,7 +2060,7 @@
 	fi
 	if test "x$FREETYPE2_FOUND" = xno; then
 		help_on_build_dependency freetype2
-		AC_ERROR([Could not find freetype2! $HELP_MSG ])
+		AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
 	fi    
 fi
 
@@ -2032,7 +2082,7 @@
 	[specify directory for the alsa library])])
 
 if test "x$ALSA_NOT_NEEDED" = xyes; then
-	if test "x$with_alsa" != x || test "x$with_alsa-include" != x || test "x$with_alsa-lib" != x; then
+	if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
 		AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
 	fi
 	ALSA_CFLAGS=
@@ -2040,21 +2090,21 @@
 else
 	ALSA_FOUND=no
 
-	if test "x$with_alsa" = xno || test "x$with_alsa-include" = xno || test "x$with_alsa-lib" = xno; then
-	    AC_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
+	if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
+	    AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
 	fi
 
-	if test "x$with_alsa" != x; then
-	    ALSA_LIBS="-L$with_alsa/lib -lalsa"
-	    ALSA_CFLAGS="-I$with_alsa/include"
+	if test "x${with_alsa}" != x; then
+	    ALSA_LIBS="-L${with_alsa}/lib -lalsa"
+	    ALSA_CFLAGS="-I${with_alsa}/include"
 	    ALSA_FOUND=yes
 	fi
-	if test "x$with_alsa-include" != x; then
-	    ALSA_CFLAGS="-I$with_alsa/include"
+	if test "x${with_alsa_include}" != x; then
+	    ALSA_CFLAGS="-I${with_alsa_include}"
 	    ALSA_FOUND=yes
 	fi
-	if test "x$with_alsa-lib" != x; then
-	    ALSA_LIBS="-L$with_alsa/lib -lalsa"
+	if test "x${with_alsa_lib}" != x; then
+	    ALSA_LIBS="-L${with_alsa_lib} -lalsa"
 	    ALSA_FOUND=yes
 	fi
 	if test "x$ALSA_FOUND" = xno; then
@@ -2073,7 +2123,7 @@
 	fi
 	if test "x$ALSA_FOUND" = xno; then 
 	    help_on_build_dependency alsa
-	    AC_ERROR([Could not find alsa! $HELP_MSG ])
+	    AC_MSG_ERROR([Could not find alsa! $HELP_MSG ])
 	fi    
 fi
 
@@ -2093,17 +2143,17 @@
 AC_ARG_WITH(pulse-lib, [AS_HELP_STRING([--with-pulse-lib],
 	[specify directory for the pulseaudio library])])
 
-if test "x$with_pulse" != x; then
-    PULSE_LIBS="-L$with_pulse/lib -lfreetype"
-    PULSE_CFLAGS="-I$with_pulse/include"
+if test "x${with_pulse}" != x; then
+    PULSE_LIBS="-L${with_pulse}/lib -lfreetype"
+    PULSE_CFLAGS="-I${with_pulse}/include"
     PULSE_FOUND=yes
 fi
-if test "x$with_pulse-include" != x; then
-    PULSE_CFLAGS="-I$with_pulse/include"
+if test "x${with_pulse_include}" != x; then
+    PULSE_CFLAGS="-I${with_pulse_include}"
     PULSE_FOUND=yes
 fi
-if test "x$with_pulse-lib" != x; then
-    PULSE_LIBS="-L$with_pulse/lib -lfreetype"
+if test "x${with_pulse_lib}" != x; then
+    PULSE_LIBS="-L${with_pulse_lib} -lpulse"
     PULSE_FOUND=yes
 fi
 if test "x$PULSE_FOUND" = xno; then
@@ -2123,7 +2173,7 @@
 
 if test "x$PULSE_FOUND" = xno && test "x$PULSE_NOT_NEEDED" != xyes; then 
     help_on_build_dependency pulse
-    AC_ERROR([Could not find pulse audio libraries. $HELP_MSG ])
+    AC_MSG_ERROR([Could not find pulse audio libraries. $HELP_MSG ])
 fi    
 
 AC_SUBST(PULSE_CFLAGS)
@@ -2170,9 +2220,9 @@
 # Check if altzone exists in time.h
 #
 
-AC_TRY_LINK([#include <time.h>], [return (int)altzone;],
-            has_altzone=yes,
-            has_altzone=no)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])],
+            [has_altzone=yes],
+            [has_altzone=no])
 if test "x$has_altzone" = xyes; then
     AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
 fi
@@ -2182,7 +2232,7 @@
 # Check the maths library
 #
 
-AC_CHECK_LIB(m, main, [],
+AC_CHECK_LIB(m, cos, [],
              [ 
                   AC_MSG_NOTICE([Maths library was not found])
              ])
@@ -2190,6 +2240,17 @@
 
 ###############################################################################
 #
+# Check for libdl.so
+
+save_LIBS="$LIBS"
+LIBS=""
+AC_CHECK_LIB(dl,dlopen)
+LIBDL="$LIBS"
+AC_SUBST(LIBDL)
+LIBS="$save_LIBS"
+
+###############################################################################
+#
 # Should we run the painfully slow javadoc tool?
 #
 AC_MSG_CHECKING([whether to build documentation])
@@ -2225,6 +2286,9 @@
 # Setup the opt flags for different compilers
 # and different operating systems.
 #
+C_FLAG_DEPS="-MMD -MF"
+CXX_FLAG_DEPS="-MMD -MF"
+
 case $COMPILER_TYPE in
   CC )
     D_FLAG="-g"
@@ -2234,9 +2298,9 @@
 	  macosx )
 	    # On MacOSX we optimize for size, something
 	    # we should do for all platforms?
-	    C_O_FLAG_HI="-O3"
+	    C_O_FLAG_HI="-Os"
 	    C_O_FLAG_NORM="-Os"
-	    C_O_FLAG_NONE="-O0"
+	    C_O_FLAG_NONE=""
 	    ;;
 	  *)
 	    C_O_FLAG_HI="-O3"
@@ -2249,19 +2313,61 @@
         CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
         ;;
       ossc )
+        #
+        # Forte has different names for this with their C++ compiler...
+        #
+	CXX_FLAG_DEPS="-xMMD -xMF"
+
+# Extra options used with HIGHEST
+#
+# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
+#          done with care, there are some assumptions below that need to
+#          be understood about the use of pointers, and IEEE behavior.
+#
+# Use non-standard floating point mode (not IEEE 754)
+CC_HIGHEST="$CC_HIGHEST -fns"
+# Do some simplification of floating point arithmetic (not IEEE 754)
+CC_HIGHEST="$CC_HIGHEST -fsimple"
+# Use single precision floating point with 'float'
+CC_HIGHEST="$CC_HIGHEST -fsingle"
+# Assume memory references via basic pointer types do not alias
+#   (Source with excessing pointer casting and data access with mixed 
+#    pointer types are not recommended)
+CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
+# Use intrinsic or inline versions for math/std functions
+#   (If you expect perfect errno behavior, do not use this)
+CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
+# Loop data dependency optimizations (need -xO3 or higher)
+CC_HIGHEST="$CC_HIGHEST -xdepend"
+# Pointer parameters to functions do not overlap
+#   (Similar to -xalias_level=basic usage, but less obvious sometimes.
+#    If you pass in multiple pointers to the same data, do not use this)
+CC_HIGHEST="$CC_HIGHEST -xrestrict"
+# Inline some library routines
+#   (If you expect perfect errno behavior, do not use this)
+CC_HIGHEST="$CC_HIGHEST -xlibmil"
+# Use optimized math routines
+#   (If you expect perfect errno behavior, do not use this)
+#  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
+#CC_HIGHEST="$CC_HIGHEST -xlibmopt"
+
         case $LEGACY_HOST_CPU1 in
           i586)
+            C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xchip=pentium"
             C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
             C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
             C_O_FLAG_NONE=""
+            CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xchip=pentium"
             CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz"
             CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz"
             CXX_O_FLAG_NONE=""
             ;;
           sparc)
+            C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
             C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
             C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
             C_O_FLAG_NONE=""
+            CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
             CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
             CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
             CXX_O_FLAG_NONE=""
@@ -2280,12 +2386,24 @@
     ;;
 esac
 
+if test -z "$C_O_FLAG_HIGHEST"; then
+   C_O_FLAG_HIGHEST="$C_O_FLAG_HI"
+fi
+
+if test -z "$CXX_O_FLAG_HIGHEST"; then
+   CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI"
+fi
+
+AC_SUBST(C_O_FLAG_HIGHEST)
 AC_SUBST(C_O_FLAG_HI)
 AC_SUBST(C_O_FLAG_NORM)
 AC_SUBST(C_O_FLAG_NONE)
+AC_SUBST(CXX_O_FLAG_HIGHEST)
 AC_SUBST(CXX_O_FLAG_HI)
 AC_SUBST(CXX_O_FLAG_NORM)
 AC_SUBST(CXX_O_FLAG_NONE)
+AC_SUBST(C_FLAG_DEPS)
+AC_SUBST(CXX_FLAG_DEPS)
 
 ###############################################################################
 #
@@ -2403,16 +2521,17 @@
 #
 case $COMPILER_NAME in
       gcc )
-      	  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer \
+      	  CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
+                          -pipe -fno-omit-frame-pointer \
                           -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
           CFLAGS_JDK="$CFLAGS_JDK -fno-strict-aliasing"
           ;;
       ossc )
-      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa REQUIRED -v -mt -norunpath -xnolib"
-      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt REQUIRED -features=no%except -DCC_NOEX"
+      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -norunpath -xnolib"
+      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX"
           ;;
       cl )
-          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
+          CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
                -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
 	       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
 	       -DWIN32 -DIAL"
@@ -2491,14 +2610,14 @@
 #
 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
 if test "x$COMPILER_TYPE" = xCL; then
-    LDFLAGS_JDKLIB="$LDFLAGS -libpath:${JDK_OUTPUTDIR}/lib jvm.lib java.lib"
+    LDFLAGS_JDKLIB="$LDFLAGS -dll -libpath:${JDK_OUTPUTDIR}/lib -libpath:${JDK_OUTPUTDIR}/objs"
     LDFLAGS_JDKLIB_SUFFIX=""
-    if test "x$HOST_CPU_BITS" = "x64"; then
-        LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj64/jli.lib"
+    if test "$HOST_CPU_BITS" == "64"; then
+        LDFLAGS_STACK_SIZE=1048576
     else
-        LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj/jli.lib"
+        LDFLAGS_STACK_SIZE=327680
     fi
-    LDFLAGS_JDKEXE_SUFFIX=""
+    LDFLAGS_JDKEXE="$LDFLAGS /STACK:$LDFLAGS_STACK_SIZE"
 else
     # If this is a --hash-style=gnu system, use --hash-style=both, why?
     HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
@@ -2513,9 +2632,11 @@
         fi
     fi
 
-    LDFLAGS_JDKLIB="$LDFLAGS $SHARED_LIBRARY_FLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
+    LDFLAGS_JDKLIB="$LDFLAGS $SHARED_LIBRARY_FLAGS \
+                    -L${JDK_OUTPUTDIR}/objs \
+                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
                     -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}client \
-  	            -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}" 
+  	            -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}"
     LDFLAGS_JDKLIB_SUFFIX="-ljvm -ljava"
     if test "x$COMPILER_NAME" = xossc; then
         LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
@@ -2523,8 +2644,10 @@
 
     # Only the jli library is explicitly linked when the launchers are built.
     # The libjvm is then dynamically loaded/linked by the launcher.
-    LDFLAGS_JDKEXE="$LDFLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
-    LDFLAGS_JDKEXE_SUFFIX="-ljli"
+    if test "x$HOST_OS" != "xmacosx"; then
+       LDFLAGS_JDKEXE="$LDFLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
+       LDFLAGS_JDKEXE_SUFFIX="-ljli"
+    fi
 fi
 
                 
@@ -2557,9 +2680,9 @@
     AC_LANG_PUSH(C++)
     OLD_CXXFLAGS="$CXXFLAGS"
     CXXFLAGS="$CXXFLAGS -lstdc++"
-    AC_TRY_LINK([], [return 0;],
-            has_dynamic_libstdcxx=yes,
-            has_dynamic_libstdcxx=no)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
+            [has_dynamic_libstdcxx=yes],
+            [has_dynamic_libstdcxx=no])
     CXXFLAGS="$OLD_CXXFLAGS"
     AC_LANG_POP(C++)
     AC_MSG_RESULT([$has_dynamic_libstdcxx])
@@ -2572,16 +2695,16 @@
     OLD_CXX="$CXX"
     LIBS="$STATIC_STDCXX_FLAGS"
     CXX="$CC"                       
-    AC_TRY_LINK([], [return 0;],
-            has_static_libstdcxx=yes,
-            has_static_libstdcxx=no)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
+            [has_static_libstdcxx=yes],
+            [has_static_libstdcxx=no])
     LIBS="$OLD_LIBS"
     CXX="$OLD_CXX"
     AC_LANG_POP(C++)
     AC_MSG_RESULT([$has_static_libstdcxx])
 
     if test "x$has_static_libcxx" = xno && test "x$has_dynamic_libcxx" = xno; then
-        AC_ERROR([I cannot link to stdc++! Neither dynamically nor statically.])
+        AC_MSG_ERROR([I cannot link to stdc++! Neither dynamically nor statically.])
     fi
 
     if test "x$enable_static_link_stdc__" = xyes && test "x$has_static_libstdcxx" = xno; then
@@ -2611,17 +2734,39 @@
 # Could someone enlighten this configure script with a comment about libCrun?
 # The LEGACY_HOST_CPU3 is the setting for ISA_DIR.
 #
-if test "x$HOST_OS" = xsolaris; then
-    LIBCXX="$LIBCXX /usr/lib${LEGACY_HOST_CPU3}/libCrun.so.1"
+if test "x$HOST_OS" = xsolaris && test "x$LIBCXX" = x; then
+    LIBCXX="/usr/lib${LEGACY_HOST_CPU3}/libCrun.so.1"
+fi
+
+# TODO better (platform agnostic) test
+if test "x$HOST_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
+    LIBCXX="-lstdc++"
 fi
 
 AC_SUBST(LIBCXX)
 
 ###############################################################################
+
+OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
+OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
+OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
+OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
+AC_SUBST(OS_VERSION_MAJOR)
+AC_SUBST(OS_VERSION_MINOR)
+AC_SUBST(OS_VERSION_MICRO)
+
+###############################################################################
 #
 # Misc
 #
 
+# The name of the Service Agent jar.
+SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
+if test "x$HOST_OS" = "xwindows"; then
+    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
+fi
+AC_SUBST(SALIB_NAME)
+
 # Control wether Hotspot runs Queens test after build.
 AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
 	[enable running of Queens test after Hotspot build (not yet available) @<:@disabled@:>@])],,
@@ -2635,17 +2780,99 @@
 
 ###############################################################################
 #
-# A helpful message at the end of the configure run.
+# Choose cacerts source file
 #
-if test "x$CCACHE_FOUND" = x && test "x$GCC" = xyes; then
-    help_on_build_dependency ccache
-    
-    printf "\nTip of the day:\nYou should really install ccache version 3.1.4 or newer.\n"
-    printf "It gives a tremendous speedup for C++ recompilations with precompiled headers!\n"
-fi    
+AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
+    [specify alternative cacerts file])])
+if test "x$with_cacerts_file" != x; then
+    CACERTS_FILE=$with_cacerts_file
+else
+    if test "x$OPENJDK" = "xtrue"; then
+        CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
+    else
+        CACERTS_FILE=${SRC_ROOT}/jdk/src/closed/share/lib/security/cacerts.internal
+    fi
+fi
+AC_SUBST(CACERTS_FILE)
 
-if test "x$CCACHE_FOUND" != x && test "x$HAS_GOOD_CCACHE" = x; then
-    printf "You have a ccache installed, but it is a version prior to 3.1.4. Try upgrading.\n"
+# Check if build directory is on local disk.
+# return 0 if it is on local disk, non-0 if on remote disk or failure
+function is_directory_on_local_disk {
+	# df -l lists only local disks; if the given directory is not found then
+	# a non-zero exit code is given
+	$DF -l $1 > /dev/null 2>&1
+}
+
+AC_MSG_CHECKING([if build directory is on local disk])
+if is_directory_on_local_disk $OUTPUT_ROOT; then
+	OUTPUT_DIR_IS_LOCAL="yes"
+else
+	OUTPUT_DIR_IS_LOCAL="no"
+fi
+AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
+
+# We're messing a bit with internal autoconf variables to put the config.status in the
+# output directory instead of the current directory.
+CONFIG_STATUS=$OUTPUT_ROOT/config.status
+
+# Now create the actual output files, after this, the main work of configure is done
+AC_OUTPUT
+
+# Finally output some useful information to the user
+
+if test "x$CCACHE_FOUND" != x; then
+	if  test "x$HAS_GOOD_CCACHE" = x; then
+		CCACHE_STATUS="installed, but disabled (version older than 3.1.4)"
+		CCACHE_HELP_MSG="You have ccache installed, but it is a version prior to 3.1.4. Try upgrading."
+	else
+		CCACHE_STATUS="installed and in use"
+	fi
+else
+	if test "x$GCC" = xyes; then
+		CCACHE_STATUS="not installed (consider installing)"
+		CCACHE_HELP_MSG="You do not have ccache installed. Try installing it."
+	else
+		CCACHE_STATUS="not available for your system"
+	fi
 fi
 
-AC_OUTPUT
+printf "\n"
+printf "====================================================\n"
+printf "A new configuration has been successfully created in\n"
+printf "$OUTPUT_ROOT\n"
+if test "x$CONFIGURE_COMMAND_LINE" != x; then
+	printf "using configure arguments '$CONFIGURE_COMMAND_LINE'.\n"
+else
+	printf "using default settings.\n"
+fi
+
+printf "\n"
+printf "Configuration summary:\n"
+printf "* Debug level:  $DEBUG_LEVEL\n"
+printf "* JDK variant:  $JDK_VARIANT\n"
+printf "* JVM variants: $with_jvm_variants\n"
+printf "* Host info:    OS: $HOST_OS, CPU architecture: $HOST_CPU_ARCH, address length: $HOST_CPU_BITS\n"
+printf "* Boot JDK:     $BOOT_JDK\n"
+
+printf "\n"
+printf "Build performance summary:\n"
+printf "* Cores to use:  $NUM_CORES\n"
+printf "* Memory limit:  $MEMORY_SIZE MB\n"
+printf "* ccache status: $CCACHE_STATUS\n"
+
+if test "x$OUTPUT_DIR_IS_LOCAL" != "xyes"; then
+	printf "\n"
+	printf "WARNING: Your build output directory is not on a local disk.\n"
+	printf "This will severely degrade build performance!\n"
+	printf "It is recommended that you create an output directory on a local disk,\n"
+	printf "and run the configure script again from that directory.\n"
+fi
+
+if test "x$CCACHE_HELP_MSG" != x; then
+	printf "\n"
+	printf "Build performance tip: ccache gives a tremendous speedup for C++ recompilations.\n"
+	printf "$CCACHE_HELP_MSG\n"
+
+    help_on_build_dependency ccache
+    printf "$HELP_MSG\n"
+fi
--- a/common/autoconf/help.m4	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/help.m4	Sun Jun 17 22:07:44 2012 -0700
@@ -23,18 +23,20 @@
 # questions.
 #
 
+function prepare_help_system {
+    AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
+}
+	
 function help_on_build_dependency {
     # Print a helpful message on how to acquire the necessary build dependency.
     # $1 is the help tag: freetyp2, cups, pulse, alsa etc
     MISSING_DEPENDENCY=$1
     PKGHANDLER_COMMAND=
 
-    AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
-
     case $PKGHANDLER in
 	apt-get)
                 apt_help     $MISSING_DEPENDENCY ;;
-        yum)
+    yum)
                 yum_help     $MISSING_DEPENDENCY ;;
 	port)
                 port_help    $MISSING_DEPENDENCY ;;
@@ -47,7 +49,7 @@
     esac
 
     if test "x$PKGHANDLER_COMMAND" != x; then
-        HELP_MSG="Try running '$PKGHANDLER_COMMAND'."
+        HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
     fi
 }
 
--- a/common/autoconf/platform.m4	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/platform.m4	Sun Jun 17 22:07:44 2012 -0700
@@ -48,7 +48,7 @@
 AC_DEFUN([CHECK_NONEMPTY],
 [
     # Test that variable $1 is not empty.
-    if test "" = "[$]$1"; then AC_ERROR(Could not find translit($1,A-Z,a-z) !); fi
+    if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
 ])
 
 AC_DEFUN([ADD_JVM_ARG_IF_OK],
@@ -97,7 +97,7 @@
             $1=`$CYGPATH -s -m -a "[$]$1"`
             $1=`$CYGPATH -u "[$]$1"`            
         else
-            AC_ERROR([You cannot have spaces in $2! "[$]$1"])
+            AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
         fi
     fi
 ])
@@ -215,7 +215,7 @@
             AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
             PUSHED_FLAGS="$CXXFLAGS"
             CXXFLAGS="-fpch-preprocess $CXXFLAGS"
-            AC_TRY_COMPILE([], [], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
             CXXFLAGS="$PUSHED_FLAGS"
             if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
                 AC_MSG_RESULT([yes])
@@ -257,7 +257,7 @@
     # The same values are setup for BUILD_...
     # 
     # And the legacy variables, for controlling the old makefiles.
-    # LEGACY_HOST_CPU1=i586,amd64,sparc,sparcv9,arm,arm64...
+    # LEGACY_HOST_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
     # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
     # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris)
     # LEGACY_HOST_OS_API=solaris,windows
@@ -276,7 +276,14 @@
     if test "x$HOST_OS" != xsolaris; then
         LEGACY_HOST_CPU3=""
         LEGACY_BUILD_CPU3=""
-    fi   
+    fi
+
+    # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_HOST_CPU1) ...
+    if test "x$HOST_OS" = xmacosx && test "x$HOST_CPU" = xx64; then
+        LEGACY_HOST_CPU1="x86_64"
+    fi
+
+    SET_RELEASE_FILE_OS_VALUES()
 ])
 
 AC_DEFUN([EXTRACT_VARS_FROM_OS_TO],
@@ -427,7 +434,7 @@
       VAR_LEGACY_CPU=s390x
        ;;
     *)
-      AC_ERROR([unsupported cpu $1])
+      AC_MSG_ERROR([unsupported cpu $1])
       ;;
   esac
 
@@ -515,3 +522,26 @@
         $1="$tmp"
     fi
 ])
+
+AC_DEFUN([SET_RELEASE_FILE_OS_VALUES],
+[
+    if test "x$HOST_OS" = "xsolaris"; then
+       REQUIRED_OS_NAME=SunOS
+       REQUIRED_OS_VERSION=5.10
+    fi
+    if test "x$HOST_OS" = "xlinux"; then
+       REQUIRED_OS_NAME=Linux
+       REQUIRED_OS_VERSION=2.6
+    fi
+    if test "x$HOST_OS" = "xwindows"; then
+        REQUIRED_OS_NAME=Windows
+        REQUIRED_OS_VERSION=5.1
+    fi
+    if test "x$HOST_OS" = "xmacosx"; then
+        REQUIRED_OS_NAME=Darwin
+        REQUIRED_OS_VERSION=11.2
+    fi
+
+    AC_SUBST(REQUIRED_OS_NAME)
+    AC_SUBST(REQUIRED_OS_VERSION)
+])
--- a/common/autoconf/spec.gmk.in	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/autoconf/spec.gmk.in	Sun Jun 17 22:07:44 2012 -0700
@@ -64,6 +64,9 @@
 # A self-referential reference to this file.
 SPEC:=@SPEC@
 
+# The "human readable" name of this configuration
+CONF_NAME:=@CONF_NAME@
+
 # The built jdk will run in this host system.
 HOST:=@HOST@
 HOST_OS:=@HOST_OS@
@@ -87,6 +90,10 @@
 BUILD_CPU_BITS:=@BUILD_CPU_BITS@
 BUILD_CPU_ENDIAN:=@BUILD_CPU_ENDIAN@
 
+# Legacy OS values for use in release file.
+REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@
+REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@
+
 # Old name for HOST_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
 PLATFORM:=@HOST_OS@
 # Old name for HOST_CPU, uses i586 and amd64, instead of ia32 and x64.
@@ -105,6 +112,7 @@
 @SET_OPENJDK@
 JIGSAW:=@JIGSAW@
 LIBM:=-lm
+LIBDL:=@LIBDL@
 
 # colon or semicolon
 PATH_SEP:=@PATH_SEP@
@@ -287,8 +295,8 @@
 
 PACKAGE_PATH=@PACKAGE_PATH@
 
-CACERTS_FILE:=$(SRC_ROOT)/jdk/src/share/lib/security/cacerts
-#CACERTS_INT=$(CLOSED_SHARE_SRC)/lib/security/cacerts.internal
+# Source file for cacerts
+CACERTS_FILE=@CACERTS_FILE@
 
 #MOZILLA_HEADERS_PATH:=
 
@@ -308,13 +316,18 @@
 AR_OUT_OPTION:=@AR_OUT_OPTION@
 
 # Flags used for overriding the default opt setting for a C/C++ source file.
+C_O_FLAG_HIGHEST:=@C_O_FLAG_HIGHEST@
 C_O_FLAG_HI:=@C_O_FLAG_HI@
 C_O_FLAG_NORM:=@C_O_FLAG_NORM@
 C_O_FLAG_NONE:=@C_O_FLAG_NONE@
+CXX_O_FLAG_HIGHEST:=@CXX_O_FLAG_HIGHEST@
 CXX_O_FLAG_HI:=@CXX_O_FLAG_HI@
 CXX_O_FLAG_NORM:=@CXX_O_FLAG_NORM@
 CXX_O_FLAG_NONE:=@CXX_O_FLAG_NONE@
 
+C_FLAG_DEPS:=@C_FLAG_DEPS@
+CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
+
 # Tools that potentially need to be cross compilation aware.
 CC:=@UNCYGDRIVE@ @CCACHE@ @CC@
 
@@ -386,6 +399,11 @@
 # (Note absence of := assignment, because we do not want to evaluate the macro body here)
 SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@
 
+# Options for C/CXX compiler to be used if linking is performed
+#   using reorder file
+C_FLAG_REORDER:=@C_FLAG_REORDER@
+CXX_FLAG_REORDER:=@CXX_FLAG_REORDER@
+
 # Options to linker to specify the library name.
 # (Note absence of := assignment, because we do not want to evaluate the macro body here)
 SET_SHARED_LIBRARY_NAME=@SET_SHARED_LIBRARY_NAME@
@@ -406,6 +424,9 @@
 EXE_SUFFIX:=@EXE_SUFFIX@
 OBJ_SUFFIX:=@OBJ_SUFFIX@
 
+POST_STRIP_CMD:=@POST_STRIP_CMD@
+POST_MCS_CMD:=@POST_MCS_CMD@
+
 JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
 
 JAVA=@UNCYGDRIVE@ @JAVA@ $(JAVA_FLAGS)
@@ -419,6 +440,8 @@
 
 RMIC:=@UNCYGDRIVE@ @RMIC@
 
+NATIVE2ASCII:=@UNCYGDRIVE@ @NATIVE2ASCII@
+
 BOOT_JAR_CMD:=@UNCYGDRIVE@ @JAR@
 BOOT_JAR_JFLAGS:=
 
@@ -483,6 +506,7 @@
 READELF:=@READELF@
 EXPR:=@EXPR@
 FILE:=@FILE@
+HG:=@HG@
 
 UNCYGDRIVE:=@UNCYGDRIVE@
 
@@ -584,5 +608,13 @@
 # Misc
 #
 
+# Name of Service Agent library
+SALIB_NAME=@SALIB_NAME@
+
 # Control wether Hotspot runs Queens test after building
 TEST_IN_BUILD=@TEST_IN_BUILD@
+
+OS_VERSION_MAJOR:=@OS_VERSION_MAJOR@
+OS_VERSION_MINOR:=@OS_VERSION_MINOR@
+OS_VERSION_MICRO:=@OS_VERSION_MICRO@
+
--- a/common/bin/compareimage.sh	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/bin/compareimage.sh	Sun Jun 17 22:07:44 2012 -0700
@@ -45,7 +45,7 @@
 #
 
 if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
-    echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image"
+    echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image"
     echo ""
     echo "Compare the directory structure."
     echo "Compare the filenames in the directories."
@@ -55,11 +55,11 @@
     echo "Compare the native executables"
     echo "Compare the remaining files"
     echo ""
-    echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]"
+    echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]"
     echo ""
     echo "Compare only the selected subset of the images."
     echo ""
-    echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar"
+    echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar"
     echo ""
     echo "Compare only the CodePointIM.jar file"
     echo "Can be used to compare zips, libraries and executables."
@@ -114,10 +114,10 @@
     CMP_OTHER=true
 fi
 
-DIFFJARZIP=`dirname $0`/diffjarzip.sh
-DIFFLIB=`dirname $0`/difflib.sh
-DIFFEXEC=`dirname $0`/diffexec.sh
-export COMPARE_ROOT=/tmp/cimages
+DIFFJARZIP="/bin/bash `dirname $0`/diffjarzip.sh"
+DIFFLIB="/bin/bash `dirname $0`/difflib.sh"
+DIFFEXEC="/bin/bash `dirname $0`/diffexec.sh"
+export COMPARE_ROOT=/tmp/cimages.$USER
 mkdir -p $COMPARE_ROOT
 
 # Load the correct exception list.
@@ -167,16 +167,64 @@
     ONLY_OLD=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '<')
     if [ "$ONLY_OLD" ]; then
         echo Only in $OLD
-        echo $ONLY_OLD | sed 's|< ./|\t|g' | sed 's/ /\n/g'
+        echo "$ONLY_OLD" | sed 's|< ./|    |g'
     fi
     # Differences in directories found.
     ONLY_NEW=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '>')
     if [ "$ONLY_NEW" ]; then
         echo Only in $NEW
-        echo $ONLY_NEW | sed 's|> ./|\t|g' | sed 's/ /\n/g'
+        echo "$ONLY_NEW" | sed 's|> ./|    |g'
     fi
 fi
 
+if [ "`uname`" == "SunOS" ]; then
+    PERM="gstat -c%a"
+elif [ $OSTYPE == "cygwin" ]; then
+    PERM=
+elif [ "`uname`" == "Darwin" ]; then
+    PERM="stat -f%p"
+elif [ "`uname`" == "Linux" ]; then
+    PERM="stat -c%A"
+else
+    PERM="stat -c%a"
+fi
+
+if [ "${PERM}" ]
+then
+    echo -n Permissions...
+    found=""
+    for f in `cd $OLD && find . -type f`
+    do
+	if [ ! -f ${OLD}/$f ]; then continue; fi
+	if [ ! -f ${NEW}/$f ]; then continue; fi
+	OP=`${PERM} ${OLD}/$f`
+	NP=`${PERM} ${NEW}/$f`
+	if [ "$OP" != "$NP" ]
+	then
+	    if [ -z "$found" ]; then echo ; found="yes"; fi
+	    printf "\told: ${OP} new: ${NP}\t$f\n"
+	fi
+    done
+    if [ -z "$found" ]; then echo ; found="yes"; fi
+fi
+
+GENERAL_FILES=$(cd $OLD && find . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
+                                  ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
+                                  ! -name "ct.sym" \
+                              | grep -v "./bin/"  | sort | $FILTER)
+echo General files...
+for f in $GENERAL_FILES
+do
+    if [ -e $NEW/$f ]; then
+        DIFF_OUT=$(diff $OLD/$f $NEW/$f 2>&1)
+        if [ -n "$DIFF_OUT" ]; then
+            echo $f
+            echo "$DIFF_OUT"
+        fi
+    fi
+done
+
+
 if [ "x$CMP_ZIPS" == "xtrue" ]; then
     ZIPS=$(cd $OLD && find . -type f -name "*.zip" | sort | $FILTER)
 
@@ -194,7 +242,7 @@
 fi    
 
 if [ "x$CMP_JARS" == "xtrue" ]; then
-    JARS=$(cd $OLD && find . -type f -name "*.jar" | sort | $FILTER)
+    JARS=$(cd $OLD && find . -type f -name "*.jar" -o -name "ct.sym" | sort | $FILTER)
 
     if [ -n "$JARS" ]; then
         echo Jar files...
--- a/common/bin/diffexec.sh	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/bin/diffexec.sh	Sun Jun 17 22:07:44 2012 -0700
@@ -50,14 +50,21 @@
 
 if [ "`uname`" == "SunOS" ]; then
     NM=gnm
-    STAT=gstat
+    STAT="gstat -c%s"
+    LDD=ldd
 elif [ $OSTYPE == "cygwin" ]; then
     NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
     NM_ARGS=/exports
-    STAT=stat
+    STAT="stat -c%s"
+    LDD=
+elif [ "`uname`" == "Darwin" ]; then
+    NM=nm
+    STAT="stat -f%z"
+    LDD="otool -L"
 else
     NM=nm
-    STAT=stat
+    STAT="stat -c%s"
+    LDD=ldd
 fi
 
 # Should the differences be viewed?
@@ -72,8 +79,8 @@
 OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
 NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
 
-OLD_SIZE=$($STAT -c%s "$OLD")
-NEW_SIZE=$($STAT -c%s "$NEW")
+OLD_SIZE=$($STAT "$OLD")
+NEW_SIZE=$($STAT "$NEW")
 
 if [ $# -gt 3 ]
 then
@@ -119,15 +126,41 @@
 
 DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
 
+if [ "${LDD}" ]
+then
+    NAME=`basename $OLD`
+    TMP=$COMPARE_ROOT/ldd/ldd.${NAME}
+    rm -rf "${TMP}"
+    mkdir -p "${TMP}"
+
+    (cd "${TMP}" && cp $OLD . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.old | uniq > dep.uniq.old)
+    (cd "${TMP}" && cp $NEW . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.new | uniq > dep.uniq.new)
+    (cd "${TMP}" && rm -f ${NAME})
+    
+    DIFFS_DEP=$(LANG=C diff "${TMP}/dep.old" "${TMP}/dep.new")
+    DIFFS_UNIQ_DEP=$(LANG=C diff "${TMP}/dep.uniq.old" "${TMP}/dep.uniq.new")
+    
+    DEP_MSG=
+    if [ -z "${DIFFS_UNIQ_DEP}" -a -z "${DIFFS_DEP}" ]; then
+       DEP_MSG="Identical dependencies"
+    elif [ -z "${DIFFS_UNIQ_DEP}" ]; then
+       DEP_MSG="Redundant duplicate dependencies added"
+       RES=1
+    else
+       DEP_MSG="DIFFERENT dependencies"
+       RES=1
+    fi
+fi
+
 RESULT=0
 
 if [ -n "$DIFFS" ]; then
    if [ $OLD_SIZE -ne $NEW_SIZE ]
    then
-       echo Differences, content AND size     : $OLD_NAME 
+       echo Differences, content AND size     : $DEP_MSG : $OLD_NAME 
        RESULT=4
    else
-       echo Differences, content BUT SAME size: $OLD_NAME 
+       echo Differences, content BUT SAME size: $DEP_MSG : $OLD_NAME 
        RESULT=3
    fi
    if [ "x$VIEW" == "xview" ]; then
@@ -136,10 +169,10 @@
 else
    if [ $OLD_SIZE -ne $NEW_SIZE ]
    then
-       echo Identical symbols BUT NEW size    : $OLD_NAME 
+       echo Identical symbols BUT NEW size    : $DEP_MSG : $OLD_NAME 
        RESULT=2
    else
-       echo Identical symbols AND size, BUT not bytewise identical: $OLD_NAME 
+       echo Identical symbols AND size, BUT not bytewise identical: $DEP_MSG : $OLD_NAME 
        RESULT=1
    fi
 fi
--- a/common/bin/diffjarzip.sh	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/bin/diffjarzip.sh	Sun Jun 17 22:07:44 2012 -0700
@@ -84,8 +84,8 @@
     exit 2
 fi
 
-if [ "$OLD_SUFFIX" != "zip" ] && [ "$OLD_SUFFIX" != "jar" ]; then
-    echo The files have to be zip or jar! They are $OLD_SUFFIX
+if [ "$OLD_SUFFIX" != "zip" ] && [ "$OLD_SUFFIX" != "jar" ] && [ "$OLD_SUFFIX" != "sym" ]; then
+    echo The files have to be zip, jar or sym! They are $OLD_SUFFIX
     exit 2
 fi
 
@@ -128,7 +128,7 @@
         | sed "s|Only in $NEW_TEMPDIR|            |"g | sed 's|: |/|g'
 fi
 
-DIFFTEXT=`dirname $0`/difftext.sh
+DIFFTEXT="/bin/bash `dirname $0`/difftext.sh"
 
 LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep differ | cut -f 2,4 -d ' ' | \
    awk "{ print \"$DIFFTEXT \"\$1\" \"\$2 }" > $COMPARE_ROOT/diffing
--- a/common/bin/difflib.sh	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/bin/difflib.sh	Sun Jun 17 22:07:44 2012 -0700
@@ -54,14 +54,21 @@
 
 if [ "`uname`" == "SunOS" ]; then
     NM=gnm
-    STAT=gstat
+    STAT="gstat -c%s"
+    LDD=ldd
 elif [ $OSTYPE == "cygwin" ]; then
     NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
     NM_ARGS=/exports
-    STAT=stat
+    STAT="stat -c%s"
+    LDD=
+elif [ "`uname`" == "Darwin" ]; then
+    NM=nm
+    STAT="stat -f%z"
+    LDD="otool -L"
 else
     NM=nm
-    STAT=stat
+    STAT="stat -c%s"
+    LDD=ldd
 fi
 
 # Should the differences be viewed?
@@ -76,8 +83,8 @@
 OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
 NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
 
-OLD_SIZE=$($STAT -c%s "$OLD")
-NEW_SIZE=$($STAT -c%s "$NEW")
+OLD_SIZE=$($STAT "$OLD")
+NEW_SIZE=$($STAT "$NEW")
 
 if [ $# -gt 3 ]
 then
@@ -139,13 +146,39 @@
 
 RESULT=0
 
+if [ "${LDD}" ]
+then
+    NAME=`basename $OLD`
+    TMP=$COMPARE_ROOT/ldd/ldd.${NAME}
+    rm -rf "${TMP}"
+    mkdir -p "${TMP}"
+    
+    (cd "${TMP}" && cp $OLD . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.old | uniq > dep.uniq.old)
+    (cd "${TMP}" && cp $NEW . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.new | uniq > dep.uniq.new)
+    (cd "${TMP}" && rm -f ${NAME})
+    
+    DIFFS_DEP=$(LANG=C diff "${TMP}/dep.old" "${TMP}/dep.new")
+    DIFFS_UNIQ_DEP=$(LANG=C diff "${TMP}/dep.uniq.old" "${TMP}/dep.uniq.new")
+    
+    DEP_MSG=
+    if [ -z "${DIFFS_UNIQ_DEP}" -a -z "${DIFFS_DEP}" ]; then
+       DEP_MSG="Identical dependencies"
+    elif [ -z "${DIFFS_UNIQ_DEP}" ]; then
+       DEP_MSG="Redundant duplicate dependencies added"
+       RES=1
+    else
+       DEP_MSG="DIFFERENT dependencies"
+       RES=1
+    fi
+fi
+
 if [ -n "$DIFFS" ]; then
    if [ $OLD_SIZE -ne $NEW_SIZE ]
    then
-       echo Differences, content AND size     : $OLD_NAME 
+       echo Differences, content AND size     : $DEP_MSG : $OLD_NAME 
        RESULT=4
    else
-       echo Differences, content BUT SAME size: $OLD_NAME 
+       echo Differences, content BUT SAME size: $DEP_MSG : $OLD_NAME 
        RESULT=3
    fi
    if [ "x$VIEW" == "xview" ]; then
@@ -154,10 +187,10 @@
 else
    if [ $OLD_SIZE -ne $NEW_SIZE ]
    then
-       echo Identical symbols BUT NEW size    : $OLD_NAME 
+       echo Identical symbols BUT NEW size    : $DEP_MSG : $OLD_NAME 
        RESULT=2
    else
-       echo Identical symbols AND size, BUT not bytewise identical: $OLD_NAME 
+       echo Identical symbols AND size, BUT not bytewise identical: $DEP_MSG : $OLD_NAME 
        RESULT=1
    fi
 fi
--- a/common/bin/logger.sh	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/bin/logger.sh	Sun Jun 17 22:07:44 2012 -0700
@@ -37,10 +37,9 @@
 
 # Create a temporary directory to store the result code from
 # the wrapped command.
-RCDIR=`mktemp -d tmp.XXXXXX` || exit $?
-trap "rm -rf '$RCDIR'" EXIT
+RCDIR=`mktemp -dt jdk-build-logger.tmp.XXXXXX` || exit $?
+trap "rm -rf \"$RCDIR\"" EXIT
 LOGFILE=$1
 shift
-(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > $RCDIR/rc) | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
-exit `cat $RCDIR/rc`
-
+(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
+exit `cat "$RCDIR/rc"`
--- a/common/makefiles/JavaCompilation.gmk	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/makefiles/JavaCompilation.gmk	Sun Jun 17 22:07:44 2012 -0700
@@ -126,8 +126,7 @@
     #    JAR:=Jar file to create
     #    MANIFEST:=Optional manifest file template.
     #    JARMAIN:=Optional main class to add to manifest
-    #    SETUP:=The Java(h) compiler setup, needed to run javah.
-    #    HEADERS:=Directory to put headers in
+    #    JARINDEX := 
     #    SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically 
     #                  added to the archive.
     #    EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
@@ -143,9 +142,8 @@
     $(if $(12),$1_$(strip $(12)))
     $(if $(13),$1_$(strip $(13)))
     $(if $(14),$1_$(strip $(14)))
+    $(if $(15),$1_$(strip $(15)))
 
-    $1_JVM   := $$($$($1_SETUP)_JVM)
-    $1_JAVAH := $$($$($1_SETUP)_JAVAH)
     $1_JARMAIN:=$(strip $$($1_JARMAIN))
     $1_JARNAME:=$$(notdir $$($1_JAR))
     $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
@@ -155,19 +153,46 @@
     $1_NATIVEAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native_notifications
     $1_NATIVEAPI_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native
     $1_BIN:=$$(dir $$($1_JAR))
+
     ifeq (,$$($1_SUFFIXES))
         # No suffix was set, default to classes.
         $1_SUFFIXES:=.class
     endif
     # Convert suffixes to a find expression
     $1_FIND_PATTERNS:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
+    # On windows, a lot of includes/excludes risk making the command line too long, so 
+    # writing the grep patterns to files.
     ifneq (,$$($1_INCLUDES))
-        $1_GREP_INCLUDES:=| $(GREP) $$(foreach src,$$($1_SRCS),$$(addprefix -e$(SPACE)$$(src)/,$$($1_INCLUDES)))
+        $1_GREP_INCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),\
+					$$(addprefix $$(src)/,$$($1_INCLUDES)))
+        $$(eval $$(call ListPathsSafelyNow,$1_GREP_INCLUDE_PATTERNS,\n, \
+			>> $$($1_BIN)/_the.$$($1_JARNAME)_include))
+        $1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include
     endif
     ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES))
-        $1_GREP_EXCLUDES:=| $(GREP) -v $$(foreach src,$$($1_SRCS),$$(addprefix -e$(SPACE)$$(src)/,$$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
+        $1_GREP_EXCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,\
+		$$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
+        $$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \
+			>> $$($1_BIN)/_the.$$($1_JARNAME)_exclude))
+        $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
     endif
 
+    ifneq (,$$($1_JARINDEX))
+      $1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@))
+    else
+      $1_JARINDEX = true
+    endif
+    # When this macro is run in the same makefile as the java compilation, dependencies are transfered
+    # in make variables. When the macro is run in a different makefile than the java compilation, the 
+    # dependencies need to be found in the filesystem.
+    $1_ALL_SRCS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \
+			-a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
+			$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES))))
+    ifeq (,$$($1_SKIP_METAINF))
+        $1_ALL_SRCS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null))
+    endif
+
+
     # Utility macros, to make the shell script receipt somewhat easier to dechipher.
 
     # The capture contents macro finds all files (matching the patterns, typically
@@ -187,15 +212,6 @@
                     (cd $$(src) && \
                     $(FIND) . -name _the.package.api.notify -exec dirname \{\} \; >> $$($1_PUBAPI_NOTIFICATIONS_FILE) ; \
                     true) &&)
-    # The capture nativeapi macro scans for native api change notificiations. If such notifications are
-    # found, then we will run javah on the changed classes. It also collects all classes with native methods
-    # to be used to find out which classes no longer has native methods, to trigger deletion of those .h files.
-    $1_CAPTURE_NATIVEAPI=$$(foreach src,$$($1_SRCS),\
-                    (cd $$(src) && \
-                    $(FIND) . -name _the.package.native.notify | $(SED) 's/package.native.notify/package.native/' | \
-                            $(XARGS) $(CAT)  | $(GREP) '^TYPE ' | $(SED) 's/.*TYPE //' >> $$($1_NATIVEAPI_NOTIFICATIONS_FILE) ; \
-                    $(FIND) . -name _the.package.native -exec $(CAT) \{\} \; | $(SED) -n 's/^TYPE //p' >> $$($1_NATIVEAPI_FILE) ; \
-                    true) &&)
     # The update contents macro updates the jar file with the previously capture contents.
     $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
                     (cd $$(src) && \
@@ -205,13 +221,18 @@
                      fi) &&)
     # The s-variants of the above macros are used when the jar is created from scratch.
     $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
-                    (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > $$(src)/_the.$$($1_JARNAME)_contents) && )
+                    (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
+			$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > \
+			$$(src)/_the.$$($1_JARNAME)_contents) && )
+
     ifeq (,$$($1_SKIP_METAINF))
         $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\
-                    ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents) && )
+                    ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
+			$$(src)/_the.$$($1_JARNAME)_contents) && )
     endif
     $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
                     (cd $$(src) && $(JAR) uf $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
+
     # The TOUCH macro is used to make sure all timestamps are identical for package files and the pubapi files.
     # If we do not do this, we get random recompilations, the next time we run make, since the order of package building is random,
     # ie independent of package --dependes on-> public api of another package. This is of course
@@ -223,7 +244,7 @@
     # Use a slightly shorter name for logging, but with enough path to identify this jar.
     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
     # Here is the rule that creates/updates the jar file.
-    $$($1_JAR) : $2
+    $$($1_JAR) : $2 $$($1_ALL_SRC)
 	$(MKDIR) -p $$($1_BIN)
 	if [ -n "$$($1_MANIFEST)" ]; then \
 		$(SED) -e "s#@@RELEASE@@#$(RELEASE)#"           \
@@ -231,9 +252,11 @@
 	else \
 		$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE); \
 	fi
-	$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE)
+	if [ -n "$$(strip $$($1_JARMAIN))" ]; then \
+		$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE); \
+	fi
 	if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \
-		$(ECHO) "$$($1_EXTRA_MANIFEST_ATTR)" >> $$($1_MANIFEST_FILE); \
+		$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \
 	fi
 	+if [ -s $$@ ]; then \
 		$(RM) -r $$($1_PUBAPI_NOTIFICATIONS_FILE) && \
@@ -255,20 +278,8 @@
 	                        $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
 			fi && \
 			$$($1_UPDATE_CONTENTS) true && \
+			$$($1_JARINDEX) && \
 			$$($1_TOUCH_API_FILES) true && \
-			$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
-			$$($1_CAPTURE_NATIVEAPI) true && \
-			if [ "x$$($1_JAVAH)" != "x" ] && [ -s $$($1_NATIVEAPI_NOTIFICATIONS_FILE) ]; then \
-				$(ECHO) Native api change detected in: && $(CAT) $$($1_NATIVEAPI_NOTIFICATIONS_FILE) && \
-		                $$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_JAR)" -d $$($1_HEADERS) @$$($1_NATIVEAPI_NOTIFICATIONS_FILE) ; \
-	    		fi && \
-			$(TOUCH) $$($1_NATIVEAPI_FILE)_prev ; \
-			($(GREP) -xvf $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev > $$($1_NATIVEAPI_FILE)_deleted; true) && \
-			$(CP) $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev && \
-			if [ -s $$($1_NATIVEAPI_FILE)_deleted ]; then \
-				$(ECHO) Native methods dropped from classes: && $(CAT) $$($1_NATIVEAPI_FILE)_deleted && \
-				$(RM) `$(CAT) $$($1_NATIVEAPI_FILE)_deleted | $(SED) -e 's|\.|_|g' -e 's|.*|$$($1_HEADERS)/&.h $$($1_HEADERS)/&_*|'` ; \
-			fi && \
 			$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \
 		fi ; \
 	else \
@@ -276,15 +287,9 @@
 	        $$($1_SCAPTURE_CONTENTS) \
 		$$($1_SCAPTURE_METAINF) \
 		$$($1_SUPDATE_CONTENTS) \
+		$$($1_JARINDEX) && \
 		$$($1_TOUCH_API_FILES) true && \
 		$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
-		$$($1_CAPTURE_NATIVEAPI) true && \
-		if [ "x$$($1_JAVAH)" != "x" ] && [ -s $$($1_NATIVEAPI_FILE) ]; then \
-			$(ECHO) Generating native api headers for `$(CAT) $$($1_NATIVEAPI_FILE) | $(WC) -l` classes && \
-			$(RM) $$($1_HEADERS)/*.h && \
-			$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_JAR)" -d $$($1_HEADERS) @$$($1_NATIVEAPI_FILE) && \
-			$(CP) $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev ; \
-		fi && \
 		$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name "*.notify" $(FIND_DELETE); true) &&) true ; \
 	fi; 
 
@@ -297,7 +302,7 @@
 define SetupZipArchive
     # param 1 is for example ZIP_MYSOURCE
     # param 2,3,4,5,6,7,8,9 are named args.
-    #    SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES
+    #    SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
     $(if $2,$1_$(strip $2))
     $(if $3,$1_$(strip $3))
     $(if $4,$1_$(strip $4))
@@ -308,11 +313,17 @@
     $(if $9,$1_$(strip $9))
 
     # Find all files in the source tree.
-    $1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*"))
+    $1_SUFFIX_FILTER := $$(patsubst %,-o -name $(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
+    $1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*" \( -name FALSE_DUMMY  $$($1_SUFFIX_FILTER) \) ))
 
     ifneq ($$($1_INCLUDES),)
         $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
-        $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
+        ifneq ($$($1_SUFFIXES),)
+            $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES),\
+		$$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
+        else
+            $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
+        endif
         $1_ALL_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
     endif
     ifneq ($$($1_EXCLUDES),)
@@ -329,7 +340,7 @@
     # Explicitly excluded files can be given with absolute path. The patsubst solution
     # isn't perfect but the likelyhood of an absolute path to match something in a src
     # dir is very small.
-    $$($1_ZIP) : $$($1_ALL_SRCS)
+    $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 		$(MKDIR) -p $$(@D)
 		$(ECHO) Updating $$($1_NAME)
 		$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES)))) ;) true
@@ -472,7 +483,7 @@
 		   | $(SED) -e '/^#/d' -e '/^$$$$/d' \
 		            -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
 			    -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
-			    -e 's/\\=/=/' | LANG=C sort > $$@
+			    -e 's/\\=/=/' | LANG=C $(SORT) > $$@
 	$(CHMOD) -f ug+w $$@
 
     # And do not forget this target
@@ -623,6 +634,7 @@
     #    JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac.
     #                                     Its only here until we cleanup some nasty source code pasta in the jdk.
     #    HEADERS:=path to directory where all generated c-headers are written.
+    #    DEPENDS:=Extra dependecy
     $(if $2,$1_$(strip $2))
     $(if $3,$1_$(strip $3))
     $(if $4,$1_$(strip $4))
@@ -650,9 +662,6 @@
 $1_JAVAC := $$($$($1_SETUP)_JAVAC)
 $1_JAVAH := $$($$($1_SETUP)_JAVAH)
 $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
-ifeq (,$$($1_HEADERS))
-    $1_HEADERS := $$($1_BIN)
-endif
 
 # Handle addons and overrides.
 $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
@@ -776,24 +785,21 @@
       $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
     endif
 
+    ifneq (,$$($1_HEADERS))
+      $1_HEADERS_ARG := -h $$($1_HEADERS)
+    endif
+
     # Create a sed expression to remove the source roots and to replace / with .
     # and remove .java at the end. 
     $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
 
     # Here is the batch rules that depends on all the sources.
-    $$($1_BIN)/_the.batch: $$($1_SRCS)
+    $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
 	$(MKDIR) -p $$(@D)
 	$(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
 	$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
 	$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1
-	($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) @$$($1_BIN)/_the.batch.tmp && \
-	 $$(if $$($1_JAVAH),\
-             $(CAT) $$($1_BIN)/_the.batch.tmp | $(XARGS) $(GREP) -E "[[:space:]]native[[:space:]]|@GenerateNativeHeader" |\
-             $(GREP) -v '*' | $(GREP) -v '//' | $(CUT) -f 1 -d ':' | $(SORT) -u |\
-             $(SED) $$($1_REWRITE_INTO_CLASSES) > $$($1_BIN)/_the.batch.natives && \
-         if test -s $$($1_BIN)/_the.batch.natives; then \
-             $$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_BIN)" -d $$($1_HEADERS) @$$($1_BIN)/_the.batch.natives ; \
-         fi &&) \
+	($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
          $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
 else
     # Ok, we have a modern javac server running!
@@ -868,6 +874,7 @@
 	JARMAIN:=$$($1_JARMAIN),\
 	MANIFEST:=$$($1_MANIFEST),\
 	EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
+	JARINDEX:=$$($1_JARINDEX),\
 	HEADERS:=$$($1_HEADERS),\
 	SETUP:=$$($1_SETUP)))
 endif
--- a/common/makefiles/MakeBase.gmk	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/makefiles/MakeBase.gmk	Sun Jun 17 22:07:44 2012 -0700
@@ -91,6 +91,15 @@
   > $(BUILDTIMESDIR)/build_time_diff_$1
 endef
 
+# Check if the current target is the final target, as specified by
+# the user on the command line. If so, call PrintEndMessage.
+define CheckIfFinished
+$(if $(filter $@,$(MAKECMDGOALS)),$(call PrintEndMessage))
+# If no taget is given, "all" is default. Check for that, too.
+# At most one of the tests can be true.
+$(if $(MAKECMDGOALS),,$(if $(filter $@,all),$(call PrintEndMessage)))
+endef
+
 # Indicate that we are done.
 # Record ending time and print out the total time it took to build.
 define MakeFinish 
@@ -101,6 +110,7 @@
 "########################################################################" \
 $(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \
 "########################################################################"
+$(call CheckIfFinished)
 endef
 
 # Find all build_time_* files and print their contents in a list sorted
@@ -126,6 +136,18 @@
 	$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
 endef
 
+# Hook to be called as the very first thing when running a normal build
+define AtRootMakeStart
+	$(call PrintStartMessage)
+	$(call StartTimer)
+endef
+
+# Hook to be called as the very last thing for targets that are "top level" targets
+define AtRootMakeEnd
+	$(call StopTimer)
+	$(call CheckIfFinished)
+endef
+
 # If the variable that you want to send to stdout for piping into a file or otherwise,
 # is potentially long, for example the a list of file paths, eg a list of all package directories.
 # Then you need to use ListPathsSafely, which optimistically splits the output into several shell
@@ -324,4 +346,51 @@
 
 endef
 
+# The source tips can come from the Mercurial repository, or in the files
+#   $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
+#   directory as the original $(HGDIR) directory.
+#   These should not be := assignments, only used from the root Makefile.
+HG_VERSION = $(shell $(HG) version 2> /dev/null)
+HG_DIRECTORY=.hg
+HGTIP_FILENAME=.hgtip
+HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
+REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
+    $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \
+                                   $(LS)    $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \
+	        2> /dev/null)))))
+
+# Emit the repo:tip pairs to $@
+define GetSourceTips
+$(CD) $(SRC_ROOT) ; \
+for i in $(REPO_LIST) IGNORE ; do \
+  if [ "$${i}" = "IGNORE" ] ; then \
+    continue; \
+  elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
+    $(PRINTF) " %s:%s" \
+      "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \
+  elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
+    $(PRINTF) " %s:%s" \
+      "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
+  fi; \
+done >> $@
+$(PRINTF) "\n" >> $@
+endef
+
+# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
+define CreateHgTip
+$(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\
+$(ECHO) $1/$(HGTIP_FILENAME)
+endef
+
+define SetupLogging
+    ifneq ($(findstring $(LOG),debug trace),)
+        # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
+        OLD_SHELL:=$$(SHELL)
+        SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
+    endif
+endef
+
+# Make sure logging is setup for everyone that includes MakeBase.gmk.
+$(eval $(call SetupLogging))
+
 endif # _MAKEBASE_GMK
--- a/common/makefiles/Makefile	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/makefiles/Makefile	Sun Jun 17 22:07:44 2012 -0700
@@ -23,49 +23,144 @@
 # questions.
 #
 
-# Default to sane output from make.
-# Override with empty string to get insane amount of output.
-# Override with -d to get even more insane amount of debugging output.
-# Override with "-d -p" to get it all.
-VERBOSE=-s
+# This must be the first rule
+default: all
+
+# Find out which variables were passed explicitely on the make command line. These
+# will be passed on to sub-makes, overriding spec.gmk settings.
+MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)=$($(var)))
+
+define fatal-error
+    # If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
+    $$(if $$(findstring help,$$(MAKECMDGOALS)),,$$(error Cannot continue))
+endef
+
+ifeq ($(origin VERBOSE),undefined)
+    # Setup logging according to LOG (but only if VERBOSE is not given)
+    ifeq ($(LOG),)
+        # Set LOG to "warn" as default if not set (and no VERBOSE given)
+        LOG=warn
+    endif
+    ifeq ($(LOG),warn)
+        VERBOSE=-s
+    else ifeq ($(LOG),info)
+        VERBOSE=
+    else ifeq ($(LOG),debug)
+        VERBOSE=
+    else ifeq ($(LOG),trace)
+        VERBOSE=-d -p
+    else
+        $(info Error: LOG must be one of: warn, info, debug or trace.)
+        $(eval $(call fatal-error))
+    endif
+else
+    ifneq ($(LOG),)
+        # We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves,
+        # but complain if this is the top-level make call.
+        ifeq ($(MAKELEVEL),0)
+            $(info Cannot use LOG=$(LOG) and VERBOSE=$(VERBOSE) at the same time. Choose one.)
+            $(eval $(call fatal-error))
+        endif
+    endif
+endif
+
+# TODO: Fix duplication in MakeBase.gmk
+define SetupLogging
+    ifneq ($(findstring $(LOG),debug trace),)
+        # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
+        OLD_SHELL:=$$(SHELL)
+        SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
+    endif
+endef
+
+$(eval $(call SetupLogging))
 
 # Find all environment or command line variables that begin with ALT.
 list_alt_overrides_with_origins = $(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
 list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
-ifneq ($(list_alt_overrides),)
-    $(info You have set the following ALT_ variables:)
-    $(foreach var,$(list_alt_overrides), $(info $(var)=$($(var))))
-    $(error Using ALT_ variables is deprecated! Please clean your environment!)
+
+ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
+    makefile_path=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
+else
+    makefile_path=$(lastword $(MAKEFILE_LIST))
 endif
+root_dir=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
+output_dir=$(root_dir)/build
 
-# The spec.gmk file contains the variables extracted by the configure script.
-# It is usually set with SPEC=....spec.gmk on the make command line.
-# However if you simply type make from the openjdk source root, it will go looking
-# for a spec file, if only one is found, use it. If more than one is found,
-# complain. If none is found, request the user to run configure!
-SPEC ?= $(wildcard $(CURDIR)/../../build/*/spec.gmk)
+ifneq ($(origin SPEC),undefined)
+    # We have been given a SPEC, check that it works out properly
+    ifeq ($(wildcard $(SPEC)),)
+        $(info Cannot locate spec.gmk, given by SPEC=$(SPEC))
+        $(eval $(call fatal-error))
+    endif
+    ifneq ($(origin CONF),undefined)
+        # We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
+        # but complain if this is the top-level make call.
+        ifeq ($(MAKELEVEL),0)
+            $(info Cannot use CONF=$(CONF) and SPEC=$(SPEC) at the same time. Choose one.)
+            $(eval $(call fatal-error))
+        endif
+    endif
+    # ... OK, we're satisfied, we'll use this SPEC later on
+else
+    # Find all spec.gmk files in the build output directory
+    all_spec_files=$(wildcard $(output_dir)/*/spec.gmk)
+    ifeq ($(all_spec_files),)
+        $(info No configurations found for $(root_dir)! Please run configure to create a configuration.)
+        $(eval $(call fatal-error))
+    endif
+    # Extract the configuration names from the path
+    all_confs=$(patsubst %/spec.gmk,%,$(patsubst $(output_dir)/%,%,$(all_spec_files)))
 
-ifeq ($(words $(SPEC)),0)
-    $(error You must run configure!)
+    ifneq ($(origin CONF),undefined)
+        # User have given a CONF= argument.
+        ifeq ($(CONF),)
+            # If given CONF=, match all configurations
+            matching_confs=$(strip $(all_confs))
+        else
+            # Otherwise select those that contain the given CONF string
+            matching_confs=$(strip $(foreach var,$(all_confs),$(if $(findstring $(CONF),$(var)),$(var))))
+        endif
+        ifeq ($(matching_confs),)
+            $(info No configurations found matching CONF=$(CONF))
+            $(info Available configurations:)
+            $(foreach var,$(all_confs),$(info * $(var)))
+            $(eval $(call fatal-error))
+        else
+            ifeq ($(words $(matching_confs)),1)
+                $(info Building '$(matching_confs)' (matching CONF=$(CONF)))
+            else
+                $(info Building the following configurations (matching CONF=$(CONF)):)
+                $(foreach var,$(matching_confs),$(info * $(var)))
+            endif
+        endif
+
+        # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
+        SPEC=$(addsuffix /spec.gmk,$(addprefix $(output_dir)/,$(matching_confs)))
+    else
+        # No CONF or SPEC given, check the available configurations
+        ifneq ($(words $(all_spec_files)),1)
+            $(info No CONF or SPEC given, but more than one spec.gmk found in $(output_dir).)
+            $(info Available configurations:)
+            $(foreach var,$(all_confs),$(info * $(var)))
+            $(info Please retry building with CONF=<config> or SPEC=<specfile>)
+            $(eval $(call fatal-error))
+        endif
+
+        # We found exactly one configuration, use it
+        SPEC=$(strip $(all_spec_files))
+    endif
 endif
 
 ifneq ($(words $(SPEC)),1)
-    ifeq ($(MAKECMDGOALS),all-conf)
-        SPECS:=$(shell echo $(SPEC) | sed -e 's|$(CURDIR)/build/||g' -e 's|/spec.gmk|\\n|g' -e 's| ||g')
-        allconf:
-		@echo Building configurations:
-		@printf "$(SPECS)"
-		@$(foreach s,$(SPEC),($(MAKE) SPEC=$s $(VERBOSE) VERBOSE=$(VERBOSE) images) &&) true
-		@echo Done building configurations:
-		@printf "$(SPECS)"
-        .PHONY: all-conf
-    else
-        $(error Since you have more than one output dir configured under build, \
-            you have to either run make from the output dir of your choice \
-            or specify run "make SPEC=build/.../spec.gmk" or run all the build configurations \
-	    using "make all-conf")
-    endif
+# We have multiple configurations to build, call make repeatedly
+all jdk hotspot jaxws jaxp corba langtools install images packages clean dist-clean:
+	@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true
+
+.PHONY: all jdk hotspot jaxws jaxp corba langtools install images packages clean dist-clean
+
 else
+# This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
 
 # Now load the spec
 -include $(SPEC)
@@ -88,51 +183,101 @@
 # Clean out any notifications from the previous build.
 $(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
 
+# If make was called explicitely with -j, don't add a -j ourself to sub-makes, since
+# this will be inherited automatically by make. Otherwise use our default for sub-makes.
+# The -j in MAKEFLAGS is only visible when executing a recipe, hence this macro.
+define GetMakeJobFlag
+    $(if $(findstring -j,$(MAKEFLAGS)),,-j$(NUM_CORES))
+endef
+
+define CheckEnvironment
+    $(if $(list_alt_overrides),
+        @$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
+    @$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
+    @$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n"
+    )
+endef
+
+define PrintStartMessage
+    $(if $(VERBOSE),,@$(ECHO) Running make as $(MAKE) $(MFLAGS) $(MAKE_ARGS))
+    $(call CheckEnvironment)
+    @$(ECHO) "Building OpenJDK for target $(if $(MAKECMDGOALS),'$(MAKECMDGOALS)','all') in configuration '$(CONF_NAME)'"
+endef
+
+define PrintEndMessage
+    @$(ECHO) "Finished building OpenJDK for target '$@'"
+    $(call CheckEnvironment)
+endef
+
 all: jdk
-	@$(call StopTimer)
 	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(call AtRootMakeEnd)
 
-langtools: start-timer
+langtools: start-make
 	@$(call MakeStart,langtools,all)
-	@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(LANGTOOLS_MAKE_ARGS))
+	@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(LANGTOOLS_MAKE_ARGS) $(MAKE_ARGS))
 	@$(call MakeFinish,langtools,all)
 
 corba: langtools
 	@$(call MakeStart,corba,all)
-	@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS))
+	@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
 	@$(call MakeFinish,corba,all)
 
 jaxp: langtools
 	@$(call MakeStart,jaxp,all)
-	@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS))
+	@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
 	@$(call MakeFinish,jaxp,all)
 
 jaxws: langtools jaxp
 	@$(call MakeStart,jaxws,all)
-	@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS))
+	@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
 	@$(call MakeFinish,jaxws,all)
 
 hotspot: langtools
 	@$(call MakeStart,hotspot,all)
-	@($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS))
+	@($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS))
 	@$(call MakeFinish,hotspot,all)
 
 jdk: langtools corba jaxp jaxws hotspot
 	@$(call MakeStart,jdk,all)
-	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS))
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS))
 	@$(call MakeFinish,jdk,all)
 
-images install packages: start-timer jdk langtools corba jaxp jaxws hotspot
+images install packages: source-tips start-make jdk langtools corba jaxp jaxws hotspot
 	@$(call MakeStart,jdk-images,$@)
-	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS) $@)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS) $@)
 	@$(call MakeFinish,jdk-images,$@)
-	@$(call StopTimer)
 	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(call AtRootMakeEnd)
 
-start-timer:
-	@$(call StartTimer)
+old-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot
+	@$(call MakeStart,jdk-old-images,$@)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS) $@)
+	@$(call MakeFinish,old-jdk-images,$@)
+	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(call AtRootMakeEnd)
 
-.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-timer
+start-make:
+	@$(call AtRootMakeStart)
+
+.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-make
+
+test: start-make
+	@$(call MakeStart,test,$(if $(TEST),$(TEST),all))
+	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
+	@$(call MakeFinish,test,$(if $(TEST),$(TEST),all))
+	@$(call AtRootMakeEnd)
+.PHONY: test
+
+
+# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
+# used to track the exact sources used to build that image.
+source-tips: $(OUTPUT_ROOT)/source_tips
+$(OUTPUT_ROOT)/source_tips: FRC
+	@$(MKDIR) -p $(@D)
+	@$(RM) $@
+	@$(call GetSourceTips)
+
 
 # Remove everything, except the output from configure.
 clean:
@@ -152,25 +297,35 @@
 	@$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)"
 .PHONY: clean
 
+endif
+
+# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
+# If you addd more global targets, please update the fatal-error macro.
+
 help:
-	$(info     )
-	$(info Typical make commands:)
-	$(info     make)
-	$(info     make VERBOSE=        # print all commands)
-	$(info     make VERBOSE="-d -p" # debug make as well)
-	$(info     make all-conf        # build images for all configurations)
-	$(info     make clean           # remove build artifacts)
-	$(info     make dist-clean      # you have to rerun configure)
-#	$(info     make test            # run tests)
-	$(info     make images          # create the jdk and jre images)
-	$(info     make install         # install the jdk image)
-#	$(info     make modules         # EXPERIMENTAL: Migrate JDK into a modularized form!)
-	$(info     make packages        # create zips and other packages)
-
-#	$(info     make eclipse_workspace  # Create an Eclipse workspace)
-#	$(info     make netbeans_workspace # Create a NetBeans workspace)
-#	$(info     make vs_workspace       # Create a Visual Studio workspace)
-
+	$(info )
+	$(info OpenJDK Makefile help)
+	$(info =====================)
+	$(info )
+	$(info Common make targets)
+	$(info .  make [all]            # Compile all code but do not create images)
+	$(info .  make images           # Create complete j2sdk and j2re images)
+	$(info .  make install          # Install the generated images locally)
+	$(info .  make clean            # Remove all files generated by make, but not those generated by configure)
+	$(info .  make dist-clean       # Remove all files generated by both make and configure)
+	$(info .  make help             # Give some help on using make)
+	$(info .  make test             # Run tests, default is all tests (see TEST below))
+	$(info )
+	$(info Useful make variables)
+	$(info .  make CONF=            # Build all configurations (note, assignment is empty))
+	$(info .  make CONF=<substring> # Build the configuration(s) with a name matching the given substring)
+	$(info )
+	$(info .  make LOG=<loglevel>   # Change loglevel from warn (default) to the given loglevel)
+	$(info .                        # Available loglevels are: warn, info, debug and trace)
+	$(info .                        # To see executed command lines, use LOG=info)
+	$(info )
+	$(info .  make test TEST=<test> # Only run the given test or tests, e.g.)
+	$(info .                        # make test TEST="jdk_lang jdk_net")
+	$(info )
 .PHONY: help
-
-endif
+FRC: # Force target
--- a/common/makefiles/NativeCompilation.gmk	Thu Jun 14 16:34:43 2012 -0700
+++ b/common/makefiles/NativeCompilation.gmk	Sun Jun 17 22:07:44 2012 -0700
@@ -28,7 +28,7 @@
 # desired whenever sort is used below!
 
 ifeq  (,$(_MAKEBASE_GMK))
-    $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
+    $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk)
 endif
 
 ifeq ($(COMPILER_TYPE),CC)
@@ -54,15 +54,22 @@
 
     ifneq (,$$(filter %.c,$2))
         # Compile as a C file
-        $1_$2_FLAGS=$4
+        $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS)
         $1_$2_COMP=$5
+        $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
+    else ifneq (,$$(filter %.m,$2))
+        # Compile as a objective-c file
+        $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS)
+        $1_$2_COMP=$5
+        $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
     else
         # Compile as a C++ file
-        $1_$2_FLAGS=$6
+        $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS)
         $1_$2_COMP=$7
+        $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS)
     endif
     # Generate the .o (.obj) file name and place it in the bin dir.
-    $1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(notdir $2)))
+    $1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(notdir $2))))
     # Only continue if this object file hasn't been processed already. This lets the first found
     # source file override any other with the same name.
     ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR)))
@@ -80,7 +87,7 @@
         $$($1_$2_OBJ) : $2
         ifeq ($(COMPILER_TYPE),CC)
 		$$(call COMPILING_MSG,$$(notdir $2))
-		$$($1_$2_COMP) $$($1_$2_FLAGS) -MMD -MF $$($1_$2_DEP) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
+		$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
         endif
         ifeq ($(COMPILER_TYPE),CL)
 		$$(call COMPILING_MSG,$$(notdir $2))
@@ -109,6 +116,8 @@
     #    EXCLUDE_FILES with these names
     #    VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
     #    RC_FLAGS flags for RC.
+    #    MAPFILE mapfile
+    #    REORDER reorder file
     $(if $2,$1_$(strip $2))
     $(if $3,$1_$(strip $3))
     $(if $4,$1_$(strip $4))
@@ -154,7 +163,7 @@
     ifneq ($$($1_EXCLUDE_FILES),)
         $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES))
     endif
-    $1_SRCS     := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.c %.cpp,$$($1_ALL_SRCS)))
+    $1_SRCS     := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.c %.cpp %.m,$$($1_ALL_SRCS)))
     ifneq (,$$(strip $$($1_INCLUDE_FILES)))
         $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS))
     endif
@@ -178,7 +187,7 @@
 
     # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides
     # a reproducable order on the input files to the linker).
-    $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_BIN)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS))))))
+    $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_BIN)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS)))))))
     $1 := $$($1_EXPECTED_OBJS)
     # Are there too many object files on disk? Perhaps because some source file was removed?
     $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
@@ -218,6 +227,11 @@
         $1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
     endif
 
+    ifneq (,$$($1_REORDER))
+          $1_EXTRA_CFLAGS += $$(C_FLAG_REORDER)
+          $1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
+    endif
+
     # Now create a list of the packages that are about to compile. Used when sending source
     # in a batch to the compiler.
     $$(shell $(RM) $$($1_BIN)/_the.list_of_sources)
@@ -233,29 +247,53 @@
     ifeq ($(HOST_OS_API), winapi)
         ifneq (,$$($1_VERSIONINFO_RESOURCE))
             ifneq (,$$($1_LIB))
-                ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB)))
-                    $1_RES:=$$(patsubst %$(SHARED_LIBRARY_SUFFIX),%.res,$$($1_LIB))
-                else
-                    $1_RES:=$$(patsubst %$(STATIC_LIBRARY_SUFFIX),%.res,$$($1_LIB))
-                endif
+                $1_BASENAME:=$$(basename $$(notdir $$($1_LIB)))
             endif
             ifneq (,$$($1_EXE))
-                $1_RES:=$$(patsubst %$(EXE_SUFFIX),%.res,$$($1_EXE))
+                $1_BASENAME:=$$(basename $$(notdir $$($1_EXE)))
             endif
+            $1_RES:=$$($1_BIN)/$$($1_BASENAME).res
             $$($1_RES): $$($1_VERSIONINFO_RESOURCE)
 		$(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE)
         endif
+        ifneq (,$$($1_MANIFEST))
+            $1_PROGRAM:=$$(basename $$(notdir $$($1_EXE)))
+            $1_GEN_MANIFEST:=$$($1_BIN)/$$($1_PROGRAM).manifest
+            IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER)
+            $$($1_GEN_MANIFEST): $$($1_MANIFEST)
+		$(SED) 's%IMVERSION%$$(IMVERSIONVALUE)%g;s%PROGRAM%$$($1_PROGRAM)%g' $$< > $$@
+        endif
+    endif
+
+    # mapfile doesnt seem to be implemented on macosx (yet??)
+    ifneq ($(HOST_OS),macosx)
+    ifneq ($(HOST_OS),windows)
+        $1_REAL_MAPFILE := $$($1_MAPFILE)
+        ifneq (,$$($1_REORDER))
+            $1_REAL_MAPFILE := $$($1_BIN)/mapfile
+
+            $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
+		$$(MKDIR) -p $$(@D)
+		$$(CP) $$($1_MAPFILE) $$@.tmp
+		$$(SED) -e 's=OUTPUTDIR=$$($1_BIN)=' $$($1_REORDER) >> $$@.tmp
+		$$(MV) $$@.tmp $$@
+        endif
+    endif
     endif
 
     # Pickup extra HOST_OS_API dependent variables (posix or winapi) and 
     # (linux,solaris,windows,bsd) for LDFLAGS and LDFLAGS_SUFFIX
     $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(HOST_OS_API)) $$($1_LDFLAGS_$(PLATFORM))
     $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(HOST_OS_API)) $$($1_LDFLAGS_SUFFIX_$(PLATFORM))
+    ifneq (,$$($1_REAL_MAPFILE))
+	$1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
+    endif
+
     ifneq (,$$($1_LIB))
         ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB)))
             # Generating a dynamic library.
             $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$(notdir $$($1_LIB)))
-            $$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES)
+            $$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
 	    	$$(call LINKING_MSG,$$(notdir $$($1_LIB)))
 		$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$($1_LIB) \
 			$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
@@ -269,9 +307,13 @@
     endif
     ifneq (,$$($1_EXE))
         # A executable binary has been specified, setup the target for it.
-        $$($1_EXE) : $$($1_EXPECTED_OBJS) $$($1_RES)
+        $$($1_EXE) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
 	    	$$(call LINKING_EXE_MSG,$$(notdir $$($1_EXE)))
 		$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_EXE) \
-			$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
+			$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+			$$($1_EXTRA_LDFLAGS_SUFFIX)
+        ifneq (,$$($1_GEN_MANIFEST))
+		$(MT) -nologo /manifest $$($1_GEN_MANIFEST) /outputresource:$$@;#1
+        endif
     endif
 endef
--- a/corba/.hgtags	Thu Jun 14 16:34:43 2012 -0700
+++ b/corba/.hgtags	Sun Jun 17 22:07:44 2012 -0700
@@ -163,3 +163,5 @@
 785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39
 56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40
 113f0d5f0a08aa0947b3edf783b603e7f042748a jdk8-b41
+79cc42c9c71bbd6630ede681642e98f5e4a841fa jdk8-b42
+cd879aff5d3cc1f58829aab3116880aa19525b78 jdk8-b43
--- a/corba/make/common/shared/Platform.gmk	Thu Jun 14 16:34:43 2012 -0700
+++ b/corba/make/common/shared/Platform.gmk	Sun Jun 17 22:07:44 2012 -0700
@@ -143,7 +143,7 @@
     REQUIRED_FREE_SPACE=1040000
   endif
   # How much RAM does this machine have:
-  MB_OF_MEMORY=$(shell /etc/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3)
+  MB_OF_MEMORY:=$(shell /usr/sbin/prtconf 2>/dev/null | fgrep 'Memory size:' | expand | cut -d' ' -f3)
 endif
 
 # Platform settings specific to Linux
--- a/corba/makefiles/Makefile	Thu Jun 14 16:34:43 2012 -0700
+++ b/corba/makefiles/Makefile	Sun Jun 17 22:07:44 2012 -0700
@@ -27,13 +27,14 @@
 # Makefile for building the corba workspace.
 #
 
+# This must be the first rule
+default: all
+
 include $(SPEC)
 include MakeBase.gmk
 include JavaCompilation.gmk
 include IdlCompilation.gmk
 
-default: all
-
 JAVAC_JARS ?= "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \
 		-jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar
 # The Corba sources are old and generates a LOT of warnings.
@@ -105,9 +106,9 @@
 $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/%SystemException.java : \
 			$(CORBA_TOPDIR)/src/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
 			$(CORBA_OUTPUTDIR)/btjars/logutil.jar
-	mkdir -p $(@D)
-	rm -f $(@D)/_the_wrappers.d
-	echo Generating class file from $*.mc
+	$(MKDIR) -p $(@D)
+	$(RM) -f $(@D)/_the_wrappers.d
+	$(ECHO) Generating class file from $*.mc
 	$(JAVA) -jar $(CORBA_OUTPUTDIR)/btjars/logutil.jar make-class $< $(@D)
 
 # Generate LogWrapper properties file by concatening resource files 
@@ -120,15 +121,15 @@
 		$(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
 		$(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
 		$(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
-	mkdir -p $(@D)
-	echo Concatenating 8 resource files into $(@F)
+	$(MKDIR) -p $(@D)
+	$(ECHO) Concatenating 8 resource files into $(@F)
 	$(CAT) $^ > $@
 
 # The resources files are generated from lisp-like .mc files.
 $(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource : $(CORBA_TOPDIR)/src/share/classes/com/sun/corba/se/spi/logging/data/%.mc $(CORBA_OUTPUTDIR)/btjars/logutil.jar
-	mkdir -p $(@D)
-	rm -f $(@D)/_the_wrappers.d
-	echo Generating resource file from $*.mc
+	$(MKDIR) -p $(@D)
+	$(RM) -f $(@D)/_the_wrappers.d
+	$(ECHO) Generating resource file from $*.mc
 	$(JAVA) -jar $(CORBA_OUTPUTDIR)/btjars/logutil.jar make-resource $< $(@D)
 
 
@@ -142,8 +143,8 @@
 	$(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/POASystemException.java \
 	$(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/UtilSystemException.java \
 	$(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/LogStrings.properties
-	mkdir -p $(@D) 
-	echo LOGWRAPPERS_ARE_CREATED=yes > $@
+	$(MKDIR) -p $(@D) 
+	$(ECHO) LOGWRAPPERS_ARE_CREATED=yes > $@
 
 # Trigger the generation of the logwrappers. After the logwrapper classes and
 # resources have been created, then the makefile will restart and the newly
@@ -167,8 +168,8 @@
         $(BUILD_IDLS) : $(CORBA_OUTPUTDIR)/btjars/idlj.jar
 
         $(CORBA_OUTPUTDIR)/gensrc/_the_idls.d : $(BUILD_IDLS) $(CORBA_OUTPUTDIR)/btjars/idlj.jar
-		mkdir -p $(@D)
-		echo IDLS_ARE_CREATED=yes > $@
+		$(MKDIR) -p $(@D)
+		$(ECHO) IDLS_ARE_CREATED=yes > $@
 
         -include $(CORBA_OUTPUTDIR)/gensrc/_the_idls.d
 
@@ -229,15 +230,16 @@
                 # The created src.zip now contains .java and .properties files used to create the classes in classes.jar
                 # and is ready for inclusion into the jdk src.zip
 
-                BIN_FILES:=$(CORBA_TOPDIR)/src/share/classes/org/omg/CORBA/orb.idl $(CORBA_TOPDIR)/src/share/classes/org/omg/CORBA/ir.idl
+                BIN_FILES:=$(CORBA_TOPDIR)/src/share/classes/com/sun/tools/corba/se/idl/orb.idl \
+			   $(CORBA_TOPDIR)/src/share/classes/com/sun/tools/corba/se/idl/ir.idl
 
                 $(CORBA_OUTPUTDIR)/dist/lib/bin.zip : $(BIN_FILES) $(CORBA_OUTPUTDIR)/dist/lib/classes.jar
-			mkdir -p $(CORBA_OUTPUTDIR)/dist/lib
-			mkdir -p $(CORBA_OUTPUTDIR)/lib
-			rm -f $@
-			echo Creating `basename $@`
-			cp $(CORBA_TOPDIR)/src/share/classes/org/omg/CORBA/*.idl $(CORBA_OUTPUTDIR)/lib
-			chmod ug+w $(CORBA_OUTPUTDIR)/lib/*
+			$(MKDIR) -p $(CORBA_OUTPUTDIR)/dist/lib
+			$(MKDIR) -p $(CORBA_OUTPUTDIR)/lib
+			$(RM) -f $@
+			$(ECHO) Creating `basename $@`
+			$(CP) $(BIN_FILES) $(CORBA_OUTPUTDIR)/lib
+			$(CHMOD) ug+w $(CORBA_OUTPUTDIR)/lib/*
 			(cd $(CORBA_OUTPUTDIR); $(ZIP) -q $@ lib/orb.idl lib/ir.idl)
 
                 # The created bin.zip now contains the corba specific binaries: orb.idl, ir.idl
@@ -252,6 +254,6 @@
 endif
 
 clean:
-	rm -rf $(CORBA_OUTPUTDIR)
+	$(RM) -rf $(CORBA_OUTPUTDIR)
 
 .PHONY: default all clean clobber 
--- a/hotspot/.hgtags	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/.hgtags	Sun Jun 17 22:07:44 2012 -0700
@@ -252,3 +252,6 @@
 785573170238f0eae6dc8e22ecf1050fbc9ea055 hs24-b12
 37add4fa0296705f67481e1fd50e2900cd25e39b jdk8-b41
 bd568544be7fcd12a9327e6c448592198d57b043 hs24-b13
+55954061c6e8750ea39a63523fd65d580db6eeb1 jdk8-b42
+e77b8e0ed1f84e3e268239e276c7ab64fa573baa jdk8-b43
+5ba29a1db46ecb80a321ca873adb56a3fe6ad320 hs24-b14
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,8 +50,7 @@
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type                  = db.lookupType("constMethodOopDesc");
-    // Backpointer to non-const methodOop
-    method                     = new OopField(type.getOopField("_method"), 0);
+    constants                  = new OopField(type.getOopField("_constants"), 0);
     // The exception handler table. 4-tuples of ints [start_pc, end_pc,
     // handler_pc, catch_type index] For methods with no exceptions the
     // table is pointing to Universe::the_empty_int_array
@@ -69,6 +68,7 @@
     nameIndex                  = new CIntField(type.getCIntegerField("_name_index"), 0);
     signatureIndex             = new CIntField(type.getCIntegerField("_signature_index"), 0);
     genericSignatureIndex      = new CIntField(type.getCIntegerField("_generic_signature_index"),0);
+    idnum                      = new CIntField(type.getCIntegerField("_method_idnum"), 0);
 
     // start of byte code
     bytecodeOffset = type.getSize();
@@ -85,7 +85,7 @@
   }
 
   // Fields
-  private static OopField  method;
+  private static OopField  constants;
   private static OopField  exceptionTable;
   private static CIntField constMethodSize;
   private static ByteField flags;
@@ -93,6 +93,7 @@
   private static CIntField nameIndex;
   private static CIntField signatureIndex;
   private static CIntField genericSignatureIndex;
+  private static CIntField idnum;
 
   // start of bytecode
   private static long bytecodeOffset;
@@ -100,9 +101,15 @@
   private static long checkedExceptionElementSize;
   private static long localVariableTableElementSize;
 
+  public Method getMethod() {
+    InstanceKlass ik = (InstanceKlass)getConstants().getPoolHolder();
+    ObjArray methods = ik.getMethods();
+    return (Method)methods.getObjAt(getIdNum());
+  }
+
   // Accessors for declared fields
-  public Method getMethod() {
-    return (Method) method.getValue(this);
+  public ConstantPool getConstants() {
+    return (ConstantPool) constants.getValue(this);
   }
 
   public TypeArray getExceptionTable() {
@@ -133,6 +140,10 @@
     return genericSignatureIndex.getValue(this);
   }
 
+  public long getIdNum() {
+    return idnum.getValue(this);
+  }
+
   public Symbol getName() {
     return getMethod().getName();
   }
@@ -223,7 +234,7 @@
   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
     super.iterateFields(visitor, doVMFields);
     if (doVMFields) {
-      visitor.doOop(method, true);
+      visitor.doOop(constants, true);
       visitor.doOop(exceptionTable, true);
       visitor.doCInt(constMethodSize, true);
       visitor.doByte(flags, true);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,6 @@
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type                  = db.lookupType("methodOopDesc");
     constMethod                = new OopField(type.getOopField("_constMethod"), 0);
-    constants                  = new OopField(type.getOopField("_constants"), 0);
     methodData                 = new OopField(type.getOopField("_method_data"), 0);
     methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
     maxStack                   = new CIntField(type.getCIntegerField("_max_stack"), 0);
@@ -83,7 +82,6 @@
 
   // Fields
   private static OopField  constMethod;
-  private static OopField  constants;
   private static OopField  methodData;
   private static CIntField methodSize;
   private static CIntField maxStack;
@@ -125,7 +123,9 @@
 
   // Accessors for declared fields
   public ConstMethod  getConstMethod()                { return (ConstMethod)  constMethod.getValue(this);       }
-  public ConstantPool getConstants()                  { return (ConstantPool) constants.getValue(this);         }
+  public ConstantPool getConstants()                  {
+    return getConstMethod().getConstants();
+  }
   public MethodData   getMethodData()                 { return (MethodData) methodData.getValue(this);          }
   public TypeArray    getExceptionTable()             { return getConstMethod().getExceptionTable();            }
   /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
@@ -281,7 +281,6 @@
     super.iterateFields(visitor, doVMFields);
     if (doVMFields) {
       visitor.doOop(constMethod, true);
-      visitor.doOop(constants, true);
       visitor.doCInt(methodSize, true);
       visitor.doCInt(maxStack, true);
       visitor.doCInt(maxLocals, true);
--- a/hotspot/make/bsd/makefiles/gcc.make	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/make/bsd/makefiles/gcc.make	Sun Jun 17 22:07:44 2012 -0700
@@ -214,7 +214,7 @@
 
 # Flags for generating make dependency flags.
 ifneq ("${CC_VER_MAJOR}", "2")
-DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
+DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
 endif
 
 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
--- a/hotspot/make/hotspot_version	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/make/hotspot_version	Sun Jun 17 22:07:44 2012 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=24
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=13
+HS_BUILD_NUMBER=14
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/make/jprt.properties	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/make/jprt.properties	Sun Jun 17 22:07:44 2012 -0700
@@ -54,72 +54,72 @@
 # Define the Solaris platforms we want for the various releases
 jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10
 jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10
-jprt.my.solaris.sparc.jdk7u4=${jprt.my.solaris.sparc.jdk7}
+jprt.my.solaris.sparc.jdk7u6=${jprt.my.solaris.sparc.jdk7}
 jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}}
 
 jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10
 jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10
-jprt.my.solaris.sparcv9.jdk7u4=${jprt.my.solaris.sparcv9.jdk7}
+jprt.my.solaris.sparcv9.jdk7u6=${jprt.my.solaris.sparcv9.jdk7}
 jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}}
 
 jprt.my.solaris.i586.jdk8=solaris_i586_5.10
 jprt.my.solaris.i586.jdk7=solaris_i586_5.10
-jprt.my.solaris.i586.jdk7u4=${jprt.my.solaris.i586.jdk7}
+jprt.my.solaris.i586.jdk7u6=${jprt.my.solaris.i586.jdk7}
 jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}}
 
 jprt.my.solaris.x64.jdk8=solaris_x64_5.10
 jprt.my.solaris.x64.jdk7=solaris_x64_5.10
-jprt.my.solaris.x64.jdk7u4=${jprt.my.solaris.x64.jdk7}
+jprt.my.solaris.x64.jdk7u6=${jprt.my.solaris.x64.jdk7}
 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.i586.jdk8=linux_i586_2.6
 jprt.my.linux.i586.jdk7=linux_i586_2.6
-jprt.my.linux.i586.jdk7u4=${jprt.my.linux.i586.jdk7}
+jprt.my.linux.i586.jdk7u6=${jprt.my.linux.i586.jdk7}
 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
 
 jprt.my.linux.x64.jdk8=linux_x64_2.6
 jprt.my.linux.x64.jdk7=linux_x64_2.6
-jprt.my.linux.x64.jdk7u4=${jprt.my.linux.x64.jdk7}
+jprt.my.linux.x64.jdk7u6=${jprt.my.linux.x64.jdk7}
 jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.ppc.jdk8=linux_ppc_2.6
 jprt.my.linux.ppc.jdk7=linux_ppc_2.6
-jprt.my.linux.ppc.jdk7u4=${jprt.my.linux.ppc.jdk7}
+jprt.my.linux.ppc.jdk7u6=${jprt.my.linux.ppc.jdk7}
 jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}}
 
 jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6
 jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6
-jprt.my.linux.ppcv2.jdk7u4=${jprt.my.linux.ppcv2.jdk7}
+jprt.my.linux.ppcv2.jdk7u6=${jprt.my.linux.ppcv2.jdk7}
 jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}}
 
 jprt.my.linux.ppcsflt.jdk8=linux_ppcsflt_2.6
 jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6
-jprt.my.linux.ppcsflt.jdk7u4=${jprt.my.linux.ppcsflt.jdk7}
+jprt.my.linux.ppcsflt.jdk7u6=${jprt.my.linux.ppcsflt.jdk7}
 jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}}
 
 jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6
 jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6
-jprt.my.linux.armvfp.jdk7u4=${jprt.my.linux.armvfp.jdk7}
+jprt.my.linux.armvfp.jdk7u6=${jprt.my.linux.armvfp.jdk7}
 jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}}
 
 jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6
 jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6
-jprt.my.linux.armsflt.jdk7u4=${jprt.my.linux.armsflt.jdk7}
+jprt.my.linux.armsflt.jdk7u6=${jprt.my.linux.armsflt.jdk7}
 jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}}
 
 jprt.my.macosx.x64.jdk8=macosx_x64_10.7
 jprt.my.macosx.x64.jdk7=macosx_x64_10.7
-jprt.my.macosx.x64.jdk7u4=${jprt.my.macosx.x64.jdk7}
+jprt.my.macosx.x64.jdk7u6=${jprt.my.macosx.x64.jdk7}
 jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}}
 
 jprt.my.windows.i586.jdk8=windows_i586_5.1
 jprt.my.windows.i586.jdk7=windows_i586_5.1
-jprt.my.windows.i586.jdk7u4=${jprt.my.windows.i586.jdk7}
+jprt.my.windows.i586.jdk7u6=${jprt.my.windows.i586.jdk7}
 jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
 
 jprt.my.windows.x64.jdk8=windows_x64_5.2
 jprt.my.windows.x64.jdk7=windows_x64_5.2
-jprt.my.windows.x64.jdk7u4=${jprt.my.windows.x64.jdk7}
+jprt.my.windows.x64.jdk7u6=${jprt.my.windows.x64.jdk7}
 jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
 
 # Standard list of jprt build targets for this source tree
@@ -154,7 +154,7 @@
 
 jprt.build.targets.jdk8=${jprt.build.targets.all}
 jprt.build.targets.jdk7=${jprt.build.targets.all}
-jprt.build.targets.jdk7u4=${jprt.build.targets.all}
+jprt.build.targets.jdk7u6=${jprt.build.targets.all}
 jprt.build.targets=${jprt.build.targets.${jprt.tools.default.release}}
 
 # Subset lists of test targets for this source tree
@@ -346,12 +346,12 @@
     ${jprt.my.macosx.x64}-{product|fastdebug}-c2-GCOld_ParNewGC, \
     ${jprt.my.macosx.x64}-{product|fastdebug}-c2-GCOld_CMS, \
     ${jprt.my.macosx.x64}-{product|fastdebug}-c2-GCOld_G1, \
-    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-GCOld_ParOldGC
-#    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_default, \
-#    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_default_tiered, \
-#    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_ParallelGC, \
-#    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_G1, \
-#    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_ParOldGC
+    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-GCOld_ParOldGC, \
+    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_default, \
+    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_default_nontiered, \
+    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_ParallelGC, \
+    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_G1, \
+    ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jbb_ParOldGC
 
 jprt.my.windows.i586.test.targets = \
     ${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-jvm98, \
@@ -447,7 +447,7 @@
 
 jprt.test.targets.jdk8=${jprt.test.targets.standard}
 jprt.test.targets.jdk7=${jprt.test.targets.standard}
-jprt.test.targets.jdk7u4=${jprt.test.targets.jdk7}
+jprt.test.targets.jdk7u6=${jprt.test.targets.jdk7}
 jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}}
 
 # The default test/Makefile targets that should be run
@@ -507,6 +507,9 @@
 
 jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard}
 jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard}
-jprt.make.rule.test.targets.jdk7u4=${jprt.make.rule.test.targets.jdk7}
+jprt.make.rule.test.targets.jdk7u6=${jprt.make.rule.test.targets.jdk7}
 jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}}
 
+# 7155453: Work-around to prevent popups on OSX from blocking test completion
+# but the work-around is added to all platforms to be consistent 
+jprt.jbb.options=-Djava.awt.headless=true
--- a/hotspot/make/linux/makefiles/gcc.make	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/make/linux/makefiles/gcc.make	Sun Jun 17 22:07:44 2012 -0700
@@ -166,7 +166,7 @@
 
 # Flags for generating make dependency flags.
 ifneq ("${CC_VER_MAJOR}", "2")
-DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
+DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
 endif
 
 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
--- a/hotspot/make/solaris/makefiles/gcc.make	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/make/solaris/makefiles/gcc.make	Sun Jun 17 22:07:44 2012 -0700
@@ -141,7 +141,7 @@
 
 # Flags for generating make dependency flags.
 ifneq ("${CC_VER_MAJOR}", "2")
-DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
+DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
 endif
 
 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -644,30 +644,6 @@
 }
 
 
-void LIRGenerator::do_AttemptUpdate(Intrinsic* x) {
-  assert(x->number_of_arguments() == 3, "wrong type");
-  LIRItem obj       (x->argument_at(0), this);  // AtomicLong object
-  LIRItem cmp_value (x->argument_at(1), this);  // value to compare with field
-  LIRItem new_value (x->argument_at(2), this);  // replace field with new_value if it matches cmp_value
-
-  obj.load_item();
-  cmp_value.load_item();
-  new_value.load_item();
-
-  // generate compare-and-swap and produce zero condition if swap occurs
-  int value_offset = sun_misc_AtomicLongCSImpl::value_offset();
-  LIR_Opr addr = FrameMap::O7_opr;
-  __ add(obj.result(), LIR_OprFact::intConst(value_offset), addr);
-  LIR_Opr t1 = FrameMap::G1_opr;  // temp for 64-bit value
-  LIR_Opr t2 = FrameMap::G3_opr;  // temp for 64-bit value
-  __ cas_long(addr, cmp_value.result(), new_value.result(), t1, t2);
-
-  // generate conditional move of boolean result
-  LIR_Opr result = rlock_result(x);
-  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result, T_LONG);
-}
-
-
 void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) {
   assert(x->number_of_arguments() == 4, "wrong type");
   LIRItem obj   (x->argument_at(0), this);  // object
@@ -989,10 +965,10 @@
   if (!x->klass()->is_loaded() || PatchALot) {
     patching_info = state_for(x, x->state_before());
 
-    // cannot re-use same xhandlers for multiple CodeEmitInfos, so
-    // clone all handlers.  This is handled transparently in other
-    // places by the CodeEmitInfo cloning logic but is handled
-    // specially here because a stub isn't being used.
+    // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
+    // clone all handlers (NOTE: Usually this is handled transparently
+    // by the CodeEmitInfo cloning logic in CodeStub constructors but
+    // is done explicitly here because a stub isn't being used).
     x->set_exception_handlers(new XHandlers(x->exception_handlers()));
   }
   CodeEmitInfo* info = state_for(x, x->state());
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -490,7 +490,8 @@
                       ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch);
 
     // get constant pool cache
-    __ ld_ptr(G5_method, in_bytes(methodOopDesc::constants_offset()), G3_scratch);
+    __ ld_ptr(G5_method, in_bytes(methodOopDesc::const_offset()), G3_scratch);
+    __ ld_ptr(G3_scratch, in_bytes(constMethodOopDesc::constants_offset()), G3_scratch);
     __ ld_ptr(G3_scratch, constantPoolOopDesc::cache_offset_in_bytes(), G3_scratch);
 
     // get specific constant pool cache entry
@@ -768,7 +769,8 @@
     // for static methods insert the mirror argument
     const int mirror_offset = in_bytes(Klass::java_mirror_offset());
 
-    __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc:: constants_offset())), O1);
+    __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc:: const_offset())), O1);
+    __ ld_ptr(Address(O1, 0, in_bytes(constMethodOopDesc::constants_offset())), O1);
     __ ld_ptr(Address(O1, 0, constantPoolOopDesc::pool_holder_offset_in_bytes()), O1);
     __ ld_ptr(O1, mirror_offset, O1);
     // where the mirror handle body is allocated:
@@ -1047,7 +1049,7 @@
   assert_different_registers(state, prev_state);
   assert_different_registers(prev_state, G3_scratch);
   const Register Gtmp = G3_scratch;
-  const Address constants         (G5_method, 0, in_bytes(methodOopDesc::constants_offset()));
+  const Address constMethod       (G5_method, 0, in_bytes(methodOopDesc::const_offset()));
   const Address access_flags      (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset()));
   const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset()));
   const Address max_stack         (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset()));
@@ -1155,7 +1157,8 @@
   __ set((int) BytecodeInterpreter::method_entry, O1);
   __ st(O1, XXX_STATE(_msg));
 
-  __ ld_ptr(constants, O3);
+  __ ld_ptr(constMethod, O3);
+  __ ld_ptr(O3, in_bytes(constMethodOopDesc::constants_offset()), O3);
   __ ld_ptr(O3, constantPoolOopDesc::cache_offset_in_bytes(), O2);
   __ st_ptr(O2, XXX_STATE(_constants));
 
@@ -1178,7 +1181,8 @@
     __ ld_ptr(XXX_STATE(_locals), O1);
     __ br( Assembler::zero, true, Assembler::pt, got_obj);
     __ delayed()->ld_ptr(O1, 0, O1);                  // get receiver for not-static case
-    __ ld_ptr(constants, O1);
+    __ ld_ptr(constMethod, O1);
+    __ ld_ptr( O1, in_bytes(constMethodOopDesc::constants_offset()), O1);
     __ ld_ptr( O1, constantPoolOopDesc::pool_holder_offset_in_bytes(), O1);
     // lock the mirror, not the klassOop
     __ ld_ptr( O1, mirror_offset, O1);
@@ -1536,7 +1540,7 @@
   const Register Gtmp1 = G3_scratch;
   // const Register Lmirror = L1;     // native mirror (native calls only)
 
-  const Address constants         (G5_method, 0, in_bytes(methodOopDesc::constants_offset()));
+  const Address constMethod       (G5_method, 0, in_bytes(methodOopDesc::const_offset()));
   const Address access_flags      (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset()));
   const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset()));
   const Address max_stack         (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset()));
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -934,8 +934,14 @@
 }
 
 
+void InterpreterMacroAssembler::get_const(Register Rdst) {
+  ld_ptr(Lmethod, in_bytes(methodOopDesc::const_offset()), Rdst);
+}
+
+
 void InterpreterMacroAssembler::get_constant_pool(Register Rdst) {
-  ld_ptr(Lmethod, in_bytes(methodOopDesc::constants_offset()), Rdst);
+  get_const(Rdst);
+  ld_ptr(Rdst, in_bytes(constMethodOopDesc::constants_offset()), Rdst);
 }
 
 
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -205,6 +205,7 @@
   void index_check(Register array, Register index, int index_shift, Register tmp, Register res);
   void index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res);
 
+  void get_const(Register Rdst);
   void get_constant_pool(Register Rdst);
   void get_constant_pool_cache(Register Rdst);
   void get_cpool_and_tags(Register Rcpool, Register Rtags);
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Sun Jun 17 22:07:44 2012 -0700
@@ -827,7 +827,6 @@
       // a Load
       // inputs are (0:control, 1:memory, 2:address)
       if (!(n->ideal_Opcode()==ld_op)       && // Following are special cases
-          !(n->ideal_Opcode()==Op_LoadLLocked && ld_op==Op_LoadI) &&
           !(n->ideal_Opcode()==Op_LoadPLocked && ld_op==Op_LoadP) &&
           !(n->ideal_Opcode()==Op_LoadI     && ld_op==Op_LoadF) &&
           !(n->ideal_Opcode()==Op_LoadF     && ld_op==Op_LoadI) &&
@@ -7306,17 +7305,6 @@
   ins_pipe(iload_mem);
 %}
 
-// LoadL-locked.  Same as a regular long load when used with a compare-swap
-instruct loadLLocked(iRegL dst, memory mem) %{
-  match(Set dst (LoadLLocked mem));
-  ins_cost(MEMORY_REF_COST);
-  size(4);
-  format %{ "LDX    $mem,$dst\t! long" %}
-  opcode(Assembler::ldx_op3);
-  ins_encode(simple_form3_mem_reg( mem, dst ) );
-  ins_pipe(iload_mem);
-%}
-
 instruct storePConditional( iRegP heap_top_ptr, iRegP oldval, g3RegP newval, flagsRegP pcc ) %{
   match(Set pcc (StorePConditional heap_top_ptr (Binary oldval newval)));
   effect( KILL newval );
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -371,7 +371,8 @@
     __ br( Assembler::zero, true, Assembler::pt, done);
     __ delayed()->ld_ptr(Llocals, Interpreter::local_offset_in_bytes(0), O0); // get receiver for not-static case
 
-    __ ld_ptr( Lmethod, in_bytes(methodOopDesc::constants_offset()), O0);
+    __ ld_ptr( Lmethod, in_bytes(methodOopDesc::const_offset()), O0);
+    __ ld_ptr( O0, in_bytes(constMethodOopDesc::constants_offset()), O0);
     __ ld_ptr( O0, constantPoolOopDesc::pool_holder_offset_in_bytes(), O0);
 
     // lock the mirror, not the klassOop
@@ -670,7 +671,8 @@
                       ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch);
 
     // get constant pool cache
-    __ ld_ptr(G5_method, methodOopDesc::constants_offset(), G3_scratch);
+    __ ld_ptr(G5_method, methodOopDesc::const_offset(), G3_scratch);
+    __ ld_ptr(G3_scratch, constMethodOopDesc::constants_offset(), G3_scratch);
     __ ld_ptr(G3_scratch, constantPoolOopDesc::cache_offset_in_bytes(), G3_scratch);
 
     // get specific constant pool cache entry
@@ -993,7 +995,8 @@
     // for static methods insert the mirror argument
     const int mirror_offset = in_bytes(Klass::java_mirror_offset());
 
-    __ ld_ptr(Lmethod, methodOopDesc:: constants_offset(), O1);
+    __ ld_ptr(Lmethod, methodOopDesc:: const_offset(), O1);
+    __ ld_ptr(O1, constMethodOopDesc::constants_offset(), O1);
     __ ld_ptr(O1, constantPoolOopDesc::pool_holder_offset_in_bytes(), O1);
     __ ld_ptr(O1, mirror_offset, O1);
 #ifdef ASSERT
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -6927,21 +6927,42 @@
   addptr(rsp,sizeof(jdouble));
 }
 
+void MacroAssembler::increase_precision() {
+  subptr(rsp, BytesPerWord);
+  fnstcw(Address(rsp, 0));
+  movl(rax, Address(rsp, 0));
+  orl(rax, 0x300);
+  push(rax);
+  fldcw(Address(rsp, 0));
+  pop(rax);
+}
+
+void MacroAssembler::restore_precision() {
+  fldcw(Address(rsp, 0));
+  addptr(rsp, BytesPerWord);
+}
+
 void MacroAssembler::fast_pow() {
   // computes X^Y = 2^(Y * log2(X))
   // if fast computation is not possible, result is NaN. Requires
   // fallback from user of this macro.
+  // increase precision for intermediate steps of the computation
+  increase_precision();
   fyl2x();                 // Stack: (Y*log2(X)) ...
   pow_exp_core_encoding(); // Stack: exp(X) ...
+  restore_precision();
 }
 
 void MacroAssembler::fast_exp() {
   // computes exp(X) = 2^(X * log2(e))
   // if fast computation is not possible, result is NaN. Requires
   // fallback from user of this macro.
+  // increase precision for intermediate steps of the computation
+  increase_precision();
   fldl2e();                // Stack: log2(e) X ...
   fmulp(1);                // Stack: (X*log2(e)) ...
   pow_exp_core_encoding(); // Stack: exp(X) ...
+  restore_precision();
 }
 
 void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) {
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -2395,6 +2395,8 @@
   // runtime call.
   void fast_pow();
   void fast_exp();
+  void increase_precision();
+  void restore_precision();
 
   // computes exp(x). Fallback to runtime call included.
   void exp_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(true, num_fpu_regs_in_use); }
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -2673,7 +2673,7 @@
 #endif // _LP64
         }
       } else {
-        ShouldNotReachHere();
+        fatal(err_msg("unexpected type: %s", basictype_to_str(c->type())));
       }
       // cpu register - address
     } else if (opr2->is_address()) {
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -718,35 +718,6 @@
 }
 
 
-void LIRGenerator::do_AttemptUpdate(Intrinsic* x) {
-  assert(x->number_of_arguments() == 3, "wrong type");
-  LIRItem obj       (x->argument_at(0), this);  // AtomicLong object
-  LIRItem cmp_value (x->argument_at(1), this);  // value to compare with field
-  LIRItem new_value (x->argument_at(2), this);  // replace field with new_value if it matches cmp_value
-
-  // compare value must be in rdx,eax (hi,lo); may be destroyed by cmpxchg8 instruction
-  cmp_value.load_item_force(FrameMap::long0_opr);
-
-  // new value must be in rcx,ebx (hi,lo)
-  new_value.load_item_force(FrameMap::long1_opr);
-
-  // object pointer register is overwritten with field address
-  obj.load_item();
-
-  // generate compare-and-swap; produces zero condition if swap occurs
-  int value_offset = sun_misc_AtomicLongCSImpl::value_offset();
-  LIR_Opr addr = new_pointer_register();
-  __ leal(LIR_OprFact::address(new LIR_Address(obj.result(), value_offset, T_LONG)), addr);
-  LIR_Opr t1 = LIR_OprFact::illegalOpr;  // no temp needed
-  LIR_Opr t2 = LIR_OprFact::illegalOpr;  // no temp needed
-  __ cas_long(addr, cmp_value.result(), new_value.result(), t1, t2);
-
-  // generate conditional move of boolean result
-  LIR_Opr result = rlock_result(x);
-  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result, T_LONG);
-}
-
-
 void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) {
   assert(x->number_of_arguments() == 4, "wrong type");
   LIRItem obj   (x->argument_at(0), this);  // object
@@ -1116,10 +1087,10 @@
   if (!x->klass()->is_loaded() || PatchALot) {
     patching_info = state_for(x, x->state_before());
 
-    // cannot re-use same xhandlers for multiple CodeEmitInfos, so
-    // clone all handlers.  This is handled transparently in other
-    // places by the CodeEmitInfo cloning logic but is handled
-    // specially here because a stub isn't being used.
+    // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
+    // clone all handlers (NOTE: Usually this is handled transparently
+    // by the CodeEmitInfo cloning logic in CodeStub constructors but
+    // is done explicitly here because a stub isn't being used).
     x->set_exception_handlers(new XHandlers(x->exception_handlers()));
   }
   CodeEmitInfo* info = state_for(x, x->state());
--- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -481,7 +481,8 @@
   __ xorptr(rdx, rdx);
   __ movptr(STATE(_oop_temp), rdx);                     // state->_oop_temp = NULL (only really needed for native)
   __ movptr(STATE(_mdx), rdx);                          // state->_mdx = NULL
-  __ movptr(rdx, Address(rbx, methodOopDesc::constants_offset()));
+  __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
+  __ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
   __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
   __ movptr(STATE(_constants), rdx);                    // state->_constants = constants()
 
@@ -516,7 +517,8 @@
     __ testl(rax, JVM_ACC_STATIC);
     __ movptr(rax, Address(locals, 0));                   // get receiver (assume this is frequent case)
     __ jcc(Assembler::zero, done);
-    __ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
+    __ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
     __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(rax, Address(rax, mirror_offset));
     __ bind(done);
@@ -769,7 +771,8 @@
     __ testl(rax, JVM_ACC_STATIC);
     __ movptr(rax, Address(rdi, 0));                                    // get receiver (assume this is frequent case)
     __ jcc(Assembler::zero, done);
-    __ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
+    __ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
     __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(rax, Address(rax, mirror_offset));
     __ bind(done);
@@ -821,9 +824,9 @@
     __ testptr(rax, rax);
     __ jcc(Assembler::zero, slow_path);
 
-    __ movptr(rdi, Address(rbx, methodOopDesc::constants_offset()));
     // read first instruction word and extract bytecode @ 1 and index @ 2
     __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
     __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
     // Shift codes right to get the index on the right.
     // The bytecode fetched looks like <index><0xb4><0x2a>
@@ -1185,7 +1188,8 @@
     __ testl(t, JVM_ACC_STATIC);
     __ jcc(Assembler::zero, L);
     // get mirror
-    __ movptr(t, Address(method, methodOopDesc:: constants_offset()));
+    __ movptr(t, Address(method, methodOopDesc:: const_offset()));
+    __ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
     __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(t, Address(t, mirror_offset));
     // copy mirror into activation object
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,8 @@
 
   // Helpers for runtime call arguments/results
   void get_method(Register reg)                            { movptr(reg, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); }
-  void get_constant_pool(Register reg)                     { get_method(reg); movptr(reg, Address(reg, methodOopDesc::constants_offset())); }
+  void get_const(Register reg)                             { get_method(reg); movptr(reg, Address(reg, methodOopDesc::const_offset())); }
+  void get_constant_pool(Register reg)                     { get_const(reg); movptr(reg, Address(reg, constMethodOopDesc::constants_offset())); }
   void get_constant_pool_cache(Register reg)               { get_constant_pool(reg); movptr(reg, Address(reg, constantPoolOopDesc::cache_offset_in_bytes())); }
   void get_cpool_and_tags(Register cpool, Register tags)   { get_constant_pool(cpool); movptr(tags, Address(cpool, constantPoolOopDesc::tags_offset_in_bytes()));
   }
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,9 +84,14 @@
     movptr(reg, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
   }
 
+  void get_const(Register reg) {
+    get_method(reg);
+    movptr(reg, Address(reg, methodOopDesc::const_offset()));
+  }
+
   void get_constant_pool(Register reg) {
-    get_method(reg);
-    movptr(reg, Address(reg, methodOopDesc::constants_offset()));
+    get_const(reg);
+    movptr(reg, Address(reg, constMethodOopDesc::constants_offset()));
   }
 
   void get_constant_pool_cache(Register reg) {
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -566,7 +566,8 @@
     __ testl(rax, JVM_ACC_STATIC);
     __ movptr(rax, Address(rdi, Interpreter::local_offset_in_bytes(0)));  // get receiver (assume this is frequent case)
     __ jcc(Assembler::zero, done);
-    __ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
+    __ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
     __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(rax, Address(rax, mirror_offset));
     __ bind(done);
@@ -606,7 +607,8 @@
     __ push(0);
   }
 
-  __ movptr(rdx, Address(rbx, methodOopDesc::constants_offset()));
+  __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
+  __ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
   __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
   __ push(rdx);                                       // set constant pool cache
   __ push(rdi);                                       // set locals pointer
@@ -661,9 +663,9 @@
     __ testptr(rax, rax);
     __ jcc(Assembler::zero, slow_path);
 
-    __ movptr(rdi, Address(rbx, methodOopDesc::constants_offset()));
     // read first instruction word and extract bytecode @ 1 and index @ 2
     __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
     __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
     // Shift codes right to get the index on the right.
     // The bytecode fetched looks like <index><0xb4><0x2a>
@@ -1026,7 +1028,8 @@
     __ testl(t, JVM_ACC_STATIC);
     __ jcc(Assembler::zero, L);
     // get mirror
-    __ movptr(t, Address(method, methodOopDesc:: constants_offset()));
+    __ movptr(t, Address(method, methodOopDesc:: const_offset()));
+    __ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
     __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(t, Address(t, mirror_offset));
     // copy mirror into activation frame
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,7 +522,8 @@
     // get receiver (assume this is frequent case)
     __ movptr(rax, Address(r14, Interpreter::local_offset_in_bytes(0)));
     __ jcc(Assembler::zero, done);
-    __ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
+    __ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
     __ movptr(rax, Address(rax,
                            constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(rax, Address(rax, mirror_offset));
@@ -579,7 +580,8 @@
     __ push(0);
   }
 
-  __ movptr(rdx, Address(rbx, methodOopDesc::constants_offset()));
+  __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
+  __ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
   __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
   __ push(rdx); // set constant pool cache
   __ push(r14); // set locals pointer
@@ -629,9 +631,9 @@
     __ testptr(rax, rax);
     __ jcc(Assembler::zero, slow_path);
 
-    __ movptr(rdi, Address(rbx, methodOopDesc::constants_offset()));
     // read first instruction word and extract bytecode @ 1 and index @ 2
     __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
+    __ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
     __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
     // Shift codes right to get the index on the right.
     // The bytecode fetched looks like <index><0xb4><0x2a>
@@ -1020,7 +1022,8 @@
     __ testl(t, JVM_ACC_STATIC);
     __ jcc(Assembler::zero, L);
     // get mirror
-    __ movptr(t, Address(method, methodOopDesc::constants_offset()));
+    __ movptr(t, Address(method, methodOopDesc::const_offset()));
+    __ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
     __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
     __ movptr(t, Address(t, mirror_offset));
     // copy mirror into activation frame
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Sun Jun 17 22:07:44 2012 -0700
@@ -5555,8 +5555,9 @@
   ins_pipe( ialu_reg_reg);
 %}
 
-instruct bytes_reverse_unsigned_short(eRegI dst) %{
+instruct bytes_reverse_unsigned_short(eRegI dst, eFlagsReg cr) %{
   match(Set dst (ReverseBytesUS dst));
+  effect(KILL cr);
 
   format %{ "BSWAP  $dst\n\t" 
             "SHR    $dst,16\n\t" %}
@@ -5567,8 +5568,9 @@
   ins_pipe( ialu_reg );
 %}
 
-instruct bytes_reverse_short(eRegI dst) %{
+instruct bytes_reverse_short(eRegI dst, eFlagsReg cr) %{
   match(Set dst (ReverseBytesS dst));
+  effect(KILL cr);
 
   format %{ "BSWAP  $dst\n\t" 
             "SAR    $dst,16\n\t" %}
@@ -5729,9 +5731,10 @@
 
 //---------- Population Count Instructions -------------------------------------
 
-instruct popCountI(eRegI dst, eRegI src) %{
+instruct popCountI(eRegI dst, eRegI src, eFlagsReg cr) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountI src));
+  effect(KILL cr);
 
   format %{ "POPCNT $dst, $src" %}
   ins_encode %{
@@ -5740,9 +5743,10 @@
   ins_pipe(ialu_reg);
 %}
 
-instruct popCountI_mem(eRegI dst, memory mem) %{
+instruct popCountI_mem(eRegI dst, memory mem, eFlagsReg cr) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountI (LoadI mem)));
+  effect(KILL cr);
 
   format %{ "POPCNT $dst, $mem" %}
   ins_encode %{
@@ -7796,50 +7800,6 @@
   ins_pipe( ialu_reg_mem );
 %}
 
-// LoadLong-locked - same as a volatile long load when used with compare-swap
-instruct loadLLocked(stackSlotL dst, memory mem) %{
-  predicate(UseSSE<=1);
-  match(Set dst (LoadLLocked mem));
-
-  ins_cost(200);
-  format %{ "FILD   $mem\t# Atomic volatile long load\n\t"
-            "FISTp  $dst" %}
-  ins_encode(enc_loadL_volatile(mem,dst));
-  ins_pipe( fpu_reg_mem );
-%}
-
-instruct loadLX_Locked(stackSlotL dst, memory mem, regD tmp) %{
-  predicate(UseSSE>=2);
-  match(Set dst (LoadLLocked mem));
-  effect(TEMP tmp);
-  ins_cost(180);
-  format %{ "MOVSD  $tmp,$mem\t# Atomic volatile long load\n\t"
-            "MOVSD  $dst,$tmp" %}
-  ins_encode %{
-    __ movdbl($tmp$$XMMRegister, $mem$$Address);
-    __ movdbl(Address(rsp, $dst$$disp), $tmp$$XMMRegister);
-  %}
-  ins_pipe( pipe_slow );
-%}
-
-instruct loadLX_reg_Locked(eRegL dst, memory mem, regD tmp) %{
-  predicate(UseSSE>=2);
-  match(Set dst (LoadLLocked mem));
-  effect(TEMP tmp);
-  ins_cost(160);
-  format %{ "MOVSD  $tmp,$mem\t# Atomic volatile long load\n\t"
-            "MOVD   $dst.lo,$tmp\n\t"
-            "PSRLQ  $tmp,32\n\t"
-            "MOVD   $dst.hi,$tmp" %}
-  ins_encode %{
-    __ movdbl($tmp$$XMMRegister, $mem$$Address);
-    __ movdl($dst$$Register, $tmp$$XMMRegister);
-    __ psrlq($tmp$$XMMRegister, 32);
-    __ movdl(HIGH_FROM_LOW($dst$$Register), $tmp$$XMMRegister);
-  %}
-  ins_pipe( pipe_slow );
-%}
-
 // Conditional-store of the updated heap-top.
 // Used during allocation of the shared heap.
 // Sets flags (EQ) on success.  Implemented with a CMPXCHG on Intel.
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Sun Jun 17 22:07:44 2012 -0700
@@ -6417,14 +6417,14 @@
   match(Set dst (ReverseBytesL dst));
 
   format %{ "bswapq  $dst" %}
-
   opcode(0x0F, 0xC8); /* Opcode 0F /C8 */
   ins_encode( REX_reg_wide(dst), OpcP, opc2_reg(dst) );
   ins_pipe( ialu_reg);
 %}
 
-instruct bytes_reverse_unsigned_short(rRegI dst) %{
+instruct bytes_reverse_unsigned_short(rRegI dst, rFlagsReg cr) %{
   match(Set dst (ReverseBytesUS dst));
+  effect(KILL cr);
 
   format %{ "bswapl  $dst\n\t"
             "shrl    $dst,16\n\t" %}
@@ -6435,8 +6435,9 @@
   ins_pipe( ialu_reg );
 %}
 
-instruct bytes_reverse_short(rRegI dst) %{
+instruct bytes_reverse_short(rRegI dst, rFlagsReg cr) %{
   match(Set dst (ReverseBytesS dst));
+  effect(KILL cr);
 
   format %{ "bswapl  $dst\n\t"
             "sar     $dst,16\n\t" %}
@@ -6564,9 +6565,10 @@
 
 //---------- Population Count Instructions -------------------------------------
 
-instruct popCountI(rRegI dst, rRegI src) %{
+instruct popCountI(rRegI dst, rRegI src, rFlagsReg cr) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountI src));
+  effect(KILL cr);
 
   format %{ "popcnt  $dst, $src" %}
   ins_encode %{
@@ -6575,9 +6577,10 @@
   ins_pipe(ialu_reg);
 %}
 
-instruct popCountI_mem(rRegI dst, memory mem) %{
+instruct popCountI_mem(rRegI dst, memory mem, rFlagsReg cr) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountI (LoadI mem)));
+  effect(KILL cr);
 
   format %{ "popcnt  $dst, $mem" %}
   ins_encode %{
@@ -6587,9 +6590,10 @@
 %}
 
 // Note: Long.bitCount(long) returns an int.
-instruct popCountL(rRegI dst, rRegL src) %{
+instruct popCountL(rRegI dst, rRegL src, rFlagsReg cr) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountL src));
+  effect(KILL cr);
 
   format %{ "popcnt  $dst, $src" %}
   ins_encode %{
@@ -6599,9 +6603,10 @@
 %}
 
 // Note: Long.bitCount(long) returns an int.
-instruct popCountL_mem(rRegI dst, memory mem) %{
+instruct popCountL_mem(rRegI dst, memory mem, rFlagsReg cr) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountL (LoadL mem)));
+  effect(KILL cr);
 
   format %{ "popcnt  $dst, $mem" %}
   ins_encode %{
@@ -7492,18 +7497,6 @@
   ins_pipe(ialu_reg_mem); // XXX
 %}
 
-// LoadL-locked - same as a regular LoadL when used with compare-swap
-instruct loadLLocked(rRegL dst, memory mem)
-%{
-  match(Set dst (LoadLLocked mem));
-
-  ins_cost(125); // XXX
-  format %{ "movq    $dst, $mem\t# long locked" %}
-  opcode(0x8B);
-  ins_encode(REX_reg_mem_wide(dst, mem), OpcP, reg_mem(dst, mem));
-  ins_pipe(ialu_reg_mem); // XXX
-%}
-
 // Conditional-store of the updated heap-top.
 // Used during allocation of the shared heap.
 // Sets flags (EQ) on success.  Implemented with a CMPXCHG on Intel.
--- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -220,10 +220,10 @@
   printf("\n");
 
   GEN_OFFS(methodOopDesc, _constMethod);
-  GEN_OFFS(methodOopDesc, _constants);
   GEN_OFFS(methodOopDesc, _access_flags);
   printf("\n");
 
+  GEN_OFFS(constMethodOopDesc, _constants);
   GEN_OFFS(constMethodOopDesc, _flags);
   GEN_OFFS(constMethodOopDesc, _code_size);
   GEN_OFFS(constMethodOopDesc, _name_index);
--- a/hotspot/src/os/solaris/dtrace/jhelper.d	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/os/solaris/dtrace/jhelper.d	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
   copyin_offset(OFFSET_Symbol_body);
 
   copyin_offset(OFFSET_methodOopDesc_constMethod);
-  copyin_offset(OFFSET_methodOopDesc_constants);
+  copyin_offset(OFFSET_constMethodOopDesc_constants);
   copyin_offset(OFFSET_constMethodOopDesc_name_index);
   copyin_offset(OFFSET_constMethodOopDesc_signature_index);
 
@@ -359,8 +359,8 @@
   this->signatureIndex = copyin_uint16(this->constMethod +
       OFFSET_constMethodOopDesc_signature_index);
 
-  this->constantPool = copyin_ptr(this->methodOopPtr +
-      OFFSET_methodOopDesc_constants);
+  this->constantPool = copyin_ptr(this->constMethod +
+      OFFSET_constMethodOopDesc_constants);
 
   this->nameSymbol = copyin_ptr(this->constantPool +
       this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
--- a/hotspot/src/os/solaris/dtrace/libjvm_db.c	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -514,9 +514,9 @@
   char * signatureString = NULL;
   int err;
 
-  err = read_pointer(J, methodOopPtr + OFFSET_methodOopDesc_constants, &constantPool);
+  err = read_pointer(J, methodOopPtr + OFFSET_methodOopDesc_constMethod, &constMethod);
   CHECK_FAIL(err);
-  err = read_pointer(J, methodOopPtr + OFFSET_methodOopDesc_constMethod, &constMethod);
+  err = read_pointer(J->P, constMethod + OFFSET_constMethodOopDesc_constants, &constantPool);
   CHECK_FAIL(err);
 
   /* To get name string */
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1591,7 +1591,8 @@
     case 5001: st->print(" Windows XP"); break;
     case 5002:
     case 6000:
-    case 6001: {
+    case 6001:
+    case 6002: {
       // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
       // find out whether we are running on 64 bit processor or not.
       SYSTEM_INFO si;
@@ -1623,6 +1624,14 @@
         }
         if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
             st->print(" , 64 bit");
+      } else if (os_vers == 6002) {
+        if (osvi.wProductType == VER_NT_WORKSTATION) {
+            st->print(" Windows 8");
+        } else {
+            st->print(" Windows Server 2012");
+        }
+        if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+            st->print(" , 64 bit");
       } else { // future os
         // Unrecognized windows, print out its major and minor versions
         st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
--- a/hotspot/src/share/vm/adlc/forms.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/adlc/forms.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -261,7 +261,6 @@
   if( strcmp(opType,"LoadL")==0 )  return Form::idealL;
   if( strcmp(opType,"LoadL_unaligned")==0 )  return Form::idealL;
   if( strcmp(opType,"LoadPLocked")==0 )  return Form::idealP;
-  if( strcmp(opType,"LoadLLocked")==0 )  return Form::idealL;
   if( strcmp(opType,"LoadP")==0 )  return Form::idealP;
   if( strcmp(opType,"LoadN")==0 )  return Form::idealN;
   if( strcmp(opType,"LoadRange")==0 )  return Form::idealI;
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -3387,7 +3387,7 @@
     "Load4I" ,"Load2I" ,"Load2L" ,"Load2D" ,"Load4F" ,"Load2F" ,"Load16B" ,
     "Load8B" ,"Load4B" ,"Load8C" ,"Load4C" ,"Load2C" ,"Load8S", "Load4S","Load2S",
     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
-    "LoadPLocked", "LoadLLocked",
+    "LoadPLocked",
     "StorePConditional", "StoreIConditional", "StoreLConditional",
     "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
     "StoreCM",
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -42,6 +42,11 @@
   // the instruction stream (because the instruction list is embedded
   // in the instructions).
   if (canonical() != x) {
+#ifndef PRODUCT
+    if (!x->has_printable_bci()) {
+      x->set_printable_bci(bci());
+    }
+#endif
     if (PrintCanonicalization) {
       PrintValueVisitor do_print_value;
       canonical()->input_values_do(&do_print_value);
@@ -451,6 +456,28 @@
     }
     break;
   }
+  case vmIntrinsics::_isInstance          : {
+    assert(x->number_of_arguments() == 2, "wrong type");
+
+    InstanceConstant* c = x->argument_at(0)->type()->as_InstanceConstant();
+    if (c != NULL && !c->value()->is_null_object()) {
+      // ciInstance::java_mirror_type() returns non-NULL only for Java mirrors
+      ciType* t = c->value()->as_instance()->java_mirror_type();
+      if (t->is_klass()) {
+        // substitute cls.isInstance(obj) of a constant Class into
+        // an InstantOf instruction
+        InstanceOf* i = new InstanceOf(t->as_klass(), x->argument_at(1), x->state_before());
+        set_canonical(i);
+        // and try to canonicalize even further
+        do_InstanceOf(i);
+      } else {
+        assert(t->is_primitive_type(), "should be a primitive type");
+        // cls.isInstance(obj) always returns false for primitive classes
+        set_constant(0);
+      }
+    }
+    break;
+  }
   }
 }
 
@@ -677,8 +704,8 @@
                 return;
             }
           }
+          set_bci(cmp->state_before()->bci());
           set_canonical(canon);
-          set_bci(cmp->state_before()->bci());
         }
       }
     } else if (l->as_InstanceOf() != NULL) {
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -3170,6 +3170,7 @@
       break;
 
     case vmIntrinsics::_getClass      :
+    case vmIntrinsics::_isInstance    :
       if (!InlineClassNatives) return false;
       preserves_state = true;
       break;
@@ -3194,13 +3195,6 @@
       preserves_state = true;
       break;
 
-    // sun/misc/AtomicLong.attemptUpdate
-    case vmIntrinsics::_attemptUpdate :
-      if (!VM_Version::supports_cx8()) return false;
-      if (!InlineAtomicLong) return false;
-      preserves_state = true;
-      break;
-
     // Use special nodes for Unsafe instructions so we can more easily
     // perform an address-mode optimization on the raw variants
     case vmIntrinsics::_getObject : return append_unsafe_get_obj(callee, T_OBJECT,  false);
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -302,8 +302,6 @@
 
   void update_exception_state(ValueStack* state);
 
-  bool has_printable_bci() const                 { return NOT_PRODUCT(_printable_bci != -99) PRODUCT_ONLY(false); }
-
  protected:
   void set_type(ValueType* type) {
     assert(type != NULL, "type must exist");
@@ -392,8 +390,9 @@
   // accessors
   int id() const                                 { return _id; }
 #ifndef PRODUCT
+  bool has_printable_bci() const                 { return _printable_bci != -99; }
   int printable_bci() const                      { assert(has_printable_bci(), "_printable_bci should have been set"); return _printable_bci; }
-  void set_printable_bci(int bci)                { NOT_PRODUCT(_printable_bci = bci;) }
+  void set_printable_bci(int bci)                { _printable_bci = bci; }
 #endif
   int use_count() const                          { return _use_count; }
   int pin_state() const                          { return _pin_state; }
@@ -576,6 +575,7 @@
   , _block(b)
   , _index(index)
   {
+    NOT_PRODUCT(set_printable_bci(Value(b)->printable_bci()));
     if (type->is_illegal()) {
       make_illegal();
     }
@@ -631,7 +631,9 @@
     : Instruction(type)
     , _java_index(index)
     , _declared_type(declared)
-  {}
+  {
+    NOT_PRODUCT(set_printable_bci(-1));
+  }
 
   // accessors
   int java_index() const                         { return _java_index; }
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1242,6 +1242,36 @@
               NULL   /* info */);
 }
 
+// Example: clazz.isInstance(object)
+void LIRGenerator::do_isInstance(Intrinsic* x) {
+  assert(x->number_of_arguments() == 2, "wrong type");
+
+  // TODO could try to substitute this node with an equivalent InstanceOf
+  // if clazz is known to be a constant Class. This will pick up newly found
+  // constants after HIR construction. I'll leave this to a future change.
+
+  // as a first cut, make a simple leaf call to runtime to stay platform independent.
+  // could follow the aastore example in a future change.
+
+  LIRItem clazz(x->argument_at(0), this);
+  LIRItem object(x->argument_at(1), this);
+  clazz.load_item();
+  object.load_item();
+  LIR_Opr result = rlock_result(x);
+
+  // need to perform null check on clazz
+  if (x->needs_null_check()) {
+    CodeEmitInfo* info = state_for(x);
+    __ null_check(clazz.result(), info);
+  }
+
+  LIR_Opr call_result = call_runtime(clazz.value(), object.value(),
+                                     CAST_FROM_FN_PTR(address, Runtime1::is_instance_of),
+                                     x->type(),
+                                     NULL); // NULL CodeEmitInfo results in a leaf call
+  __ move(call_result, result);
+}
+
 // Example: object.getClass ()
 void LIRGenerator::do_getClass(Intrinsic* x) {
   assert(x->number_of_arguments() == 1, "wrong type");
@@ -2777,31 +2807,29 @@
       int index = bcs.get_method_index();
       size_t call_site_offset = cpcache->get_f1_offset(index);
 
+      // Load CallSite object from constant pool cache.
+      LIR_Opr call_site = new_register(objectType);
+      __ oop2reg(cpcache->constant_encoding(), call_site);
+      __ move_wide(new LIR_Address(call_site, call_site_offset, T_OBJECT), call_site);
+
       // If this invokedynamic call site hasn't been executed yet in
       // the interpreter, the CallSite object in the constant pool
       // cache is still null and we need to deoptimize.
       if (cpcache->is_f1_null_at(index)) {
-        // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
-        // clone all handlers.  This is handled transparently in other
-        // places by the CodeEmitInfo cloning logic but is handled
-        // specially here because a stub isn't being used.
-        x->set_exception_handlers(new XHandlers(x->exception_handlers()));
-
+        // Only deoptimize if the CallSite object is still null; we don't
+        // recompile methods in C1 after deoptimization so this call site
+        // might be resolved the next time we execute it after OSR.
         DeoptimizeStub* deopt_stub = new DeoptimizeStub(deopt_info);
-        __ jump(deopt_stub);
+        __ cmp(lir_cond_equal, call_site, LIR_OprFact::oopConst(NULL));
+        __ branch(lir_cond_equal, T_OBJECT, deopt_stub);
       }
 
       // Use the receiver register for the synthetic MethodHandle
       // argument.
       receiver = LIR_Assembler::receiverOpr();
-      LIR_Opr tmp = new_register(objectType);
-
-      // Load CallSite object from constant pool cache.
-      __ oop2reg(cpcache->constant_encoding(), tmp);
-      __ move_wide(new LIR_Address(tmp, call_site_offset, T_OBJECT), tmp);
 
       // Load target MethodHandle from CallSite object.
-      __ load(new LIR_Address(tmp, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
+      __ load(new LIR_Address(call_site, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
 
       __ call_dynamic(target, receiver, result_register,
                       SharedRuntime::get_resolve_opt_virtual_call_stub(),
@@ -2809,7 +2837,7 @@
       break;
     }
     default:
-      ShouldNotReachHere();
+      fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(x->code())));
       break;
   }
 
@@ -2951,6 +2979,7 @@
     break;
 
   case vmIntrinsics::_Object_init:    do_RegisterFinalizer(x); break;
+  case vmIntrinsics::_isInstance:     do_isInstance(x);    break;
   case vmIntrinsics::_getClass:       do_getClass(x);      break;
   case vmIntrinsics::_currentThread:  do_currentThread(x); break;
 
@@ -2978,11 +3007,6 @@
     do_CompareAndSwap(x, longType);
     break;
 
-    // sun.misc.AtomicLongCSImpl.attemptUpdate
-  case vmIntrinsics::_attemptUpdate:
-    do_AttemptUpdate(x);
-    break;
-
   case vmIntrinsics::_Reference_get:
     do_Reference_get(x);
     break;
@@ -3223,4 +3247,3 @@
     }
   }
 }
-
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -238,12 +238,12 @@
   LIR_Opr getThreadPointer();
 
   void do_RegisterFinalizer(Intrinsic* x);
+  void do_isInstance(Intrinsic* x);
   void do_getClass(Intrinsic* x);
   void do_currentThread(Intrinsic* x);
   void do_MathIntrinsic(Intrinsic* x);
   void do_ArrayCopy(Intrinsic* x);
   void do_CompareAndSwap(Intrinsic* x, ValueType* type);
-  void do_AttemptUpdate(Intrinsic* x);
   void do_NIOCheckIndex(Intrinsic* x);
   void do_FPIntrinsics(Intrinsic* x);
   void do_Reference_get(Intrinsic* x);
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -294,6 +294,7 @@
   FUNCTION_CASE(entry, SharedRuntime::lrem);
   FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
   FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
+  FUNCTION_CASE(entry, is_instance_of);
   FUNCTION_CASE(entry, trace_block_entry);
 #ifdef TRACE_HAVE_INTRINSICS
   FUNCTION_CASE(entry, TRACE_TIME_METHOD);
@@ -1270,6 +1271,19 @@
 JRT_END
 
 
+JRT_LEAF(int, Runtime1::is_instance_of(oopDesc* mirror, oopDesc* obj))
+  // had to return int instead of bool, otherwise there may be a mismatch
+  // between the C calling convention and the Java one.
+  // e.g., on x86, GCC may clear only %al when returning a bool false, but
+  // JVM takes the whole %eax as the return value, which may misinterpret
+  // the return value as a boolean true.
+
+  assert(mirror != NULL, "should null-check on mirror before calling");
+  klassOop k = java_lang_Class::as_klassOop(mirror);
+  return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
+JRT_END
+
+
 #ifndef PRODUCT
 void Runtime1::print_statistics() {
   tty->print_cr("C1 Runtime statistics:");
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -186,6 +186,7 @@
   static int  arraycopy(oopDesc* src, int src_pos, oopDesc* dst, int dst_pos, int length);
   static void primitive_arraycopy(HeapWord* src, HeapWord* dst, int length);
   static void oop_arraycopy(HeapWord* src, HeapWord* dst, int length);
+  static int  is_instance_of(oopDesc* mirror, oopDesc* obj);
 
   static void print_statistics()                 PRODUCT_RETURN;
 };
--- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -141,8 +141,11 @@
 
   // visitor functions
   void do_StoreField     (StoreField*      x) {
-    if (x->is_init_point()) {
-      // putstatic is an initialization point so treat it as a wide kill
+    if (x->is_init_point() ||  // putstatic is an initialization point so treat it as a wide kill
+        // This is actually too strict and the JMM doesn't require
+        // this in all cases (e.g. load a; volatile store b; load a)
+        // but possible future optimizations might require this.
+        x->field()->is_volatile()) {
       kill_memory();
     } else {
       kill_field(x->field());
@@ -160,8 +163,8 @@
   void do_Local          (Local*           x) { /* nothing to do */ }
   void do_Constant       (Constant*        x) { /* nothing to do */ }
   void do_LoadField      (LoadField*       x) {
-    if (x->is_init_point()) {
-      // getstatic is an initialization point so treat it as a wide kill
+    if (x->is_init_point() ||         // getstatic is an initialization point so treat it as a wide kill
+        x->field()->is_volatile()) {  // the JMM requires this
       kill_memory();
     }
   }
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -2919,7 +2919,6 @@
 int java_lang_AssertionStatusDirectives::packageEnabled_offset;
 int java_lang_AssertionStatusDirectives::deflt_offset;
 int java_nio_Buffer::_limit_offset;
-int sun_misc_AtomicLongCSImpl::_value_offset;
 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset = 0;
 int sun_reflect_ConstantPool::_cp_oop_offset;
 int sun_reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
@@ -2979,21 +2978,6 @@
   compute_offset(_limit_offset, k, vmSymbols::limit_name(), vmSymbols::int_signature());
 }
 
-// Support for intrinsification of sun.misc.AtomicLongCSImpl.attemptUpdate
-int sun_misc_AtomicLongCSImpl::value_offset() {
-  assert(SystemDictionary::AtomicLongCSImpl_klass() != NULL, "can't call this");
-  return _value_offset;
-}
-
-
-void sun_misc_AtomicLongCSImpl::compute_offsets() {
-  klassOop k = SystemDictionary::AtomicLongCSImpl_klass();
-  // If this class is not present, its value field offset won't be referenced.
-  if (k != NULL) {
-    compute_offset(_value_offset, k, vmSymbols::value_name(), vmSymbols::long_signature());
-  }
-}
-
 void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
   if (_owner_offset != 0) return;
 
@@ -3098,7 +3082,6 @@
     sun_reflect_ConstantPool::compute_offsets();
     sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
   }
-  sun_misc_AtomicLongCSImpl::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1383,15 +1383,6 @@
   static void compute_offsets();
 };
 
-class sun_misc_AtomicLongCSImpl: AllStatic {
- private:
-  static int _value_offset;
-
- public:
-  static int  value_offset();
-  static void compute_offsets();
-};
-
 class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic {
  private:
   static int  _owner_offset;
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -170,9 +170,6 @@
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */               \
   template(nio_Buffer_klass,             java_nio_Buffer,                Opt) \
                                                                               \
-  /* If this class isn't present, it won't be referenced. */                  \
-  template(AtomicLongCSImpl_klass,       sun_misc_AtomicLongCSImpl,   Opt)    \
-                                                                              \
   template(DownloadManager_klass,        sun_jkernel_DownloadManager, Opt_Kernel) \
                                                                               \
   template(PostVMInitHook_klass,         sun_misc_PostVMInitHook, Opt)        \
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1738,10 +1738,14 @@
   int target = bci + default_offset;
   stackmap_table->check_jump_target(current_frame, target, CHECK_VERIFY(this));
   for (int i = 0; i < keys; i++) {
+    // Because check_jump_target() may safepoint, the bytecode could have
+    // moved, which means 'aligned_bcp' is no good and needs to be recalculated.
+    aligned_bcp = (address)round_to((intptr_t)(bcs->bcp() + 1), jintSize);
     target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize);
     stackmap_table->check_jump_target(
       current_frame, target, CHECK_VERIFY(this));
   }
+  NOT_PRODUCT(aligned_bcp = NULL);  // no longer valid at this point
 }
 
 bool ClassVerifier::name_in_supers(
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -722,15 +722,6 @@
   /* java/lang/ref/Reference */                                                                                         \
   do_intrinsic(_Reference_get,            java_lang_ref_Reference, get_name,    void_object_signature, F_R)             \
                                                                                                                         \
-                                                                                                                        \
-  do_class(sun_misc_AtomicLongCSImpl,     "sun/misc/AtomicLongCSImpl")                                                  \
-  do_intrinsic(_get_AtomicLong,           sun_misc_AtomicLongCSImpl, get_name, void_long_signature,              F_R)   \
-  /*   (symbols get_name and void_long_signature defined above) */                                                      \
-                                                                                                                        \
-  do_intrinsic(_attemptUpdate,            sun_misc_AtomicLongCSImpl, attemptUpdate_name, attemptUpdate_signature, F_R)  \
-   do_name(     attemptUpdate_name,                                 "attemptUpdate")                                    \
-   do_signature(attemptUpdate_signature,                            "(JJ)Z")                                            \
-                                                                                                                        \
   /* support for sun.misc.Unsafe */                                                                                     \
   do_class(sun_misc_Unsafe,               "sun/misc/Unsafe")                                                            \
                                                                                                                         \
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -293,7 +293,7 @@
     // Java thread is waiting for a full GC to happen (e.g., it
     // called System.gc() with +ExplicitGCInvokesConcurrent).
     _sts.join();
-    g1h->increment_full_collections_completed(true /* concurrent */);
+    g1h->increment_old_marking_cycles_completed(true /* concurrent */);
     _sts.leave();
   }
   assert(_should_terminate, "just checking");
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1299,6 +1299,7 @@
 
     gc_prologue(true);
     increment_total_collections(true /* full gc */);
+    increment_old_marking_cycles_started();
 
     size_t g1h_prev_used = used();
     assert(used() == recalculate_used(), "Should be equal");
@@ -1492,22 +1493,28 @@
     JavaThread::dirty_card_queue_set().abandon_logs();
     assert(!G1DeferredRSUpdate
            || (G1DeferredRSUpdate && (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any");
-  }
-
-  _young_list->reset_sampled_info();
-  // At this point there should be no regions in the
-  // entire heap tagged as young.
-  assert( check_young_list_empty(true /* check_heap */),
-    "young list should be empty at this point");
-
-  // Update the number of full collections that have been completed.
-  increment_full_collections_completed(false /* concurrent */);
-
-  _hrs.verify_optional();
-  verify_region_sets_optional();
-
-  print_heap_after_gc();
-  g1mm()->update_sizes();
+
+    _young_list->reset_sampled_info();
+    // At this point there should be no regions in the
+    // entire heap tagged as young.
+    assert( check_young_list_empty(true /* check_heap */),
+      "young list should be empty at this point");
+
+    // Update the number of full collections that have been completed.
+    increment_old_marking_cycles_completed(false /* concurrent */);
+
+    _hrs.verify_optional();
+    verify_region_sets_optional();
+
+    print_heap_after_gc();
+
+    // We must call G1MonitoringSupport::update_sizes() in the same scoping level
+    // as an active TraceMemoryManagerStats object (i.e. before the destructor for the
+    // TraceMemoryManagerStats is called) so that the G1 memory pools are updated
+    // before any GC notifications are raised.
+    g1mm()->update_sizes();
+  }
+
   post_full_gc_dump();
 
   return true;
@@ -1888,7 +1895,8 @@
   _retained_old_gc_alloc_region(NULL),
   _expand_heap_after_alloc_failure(true),
   _surviving_young_words(NULL),
-  _full_collections_completed(0),
+  _old_marking_cycles_started(0),
+  _old_marking_cycles_completed(0),
   _in_cset_fast_test(NULL),
   _in_cset_fast_test_base(NULL),
   _dirty_cards_region_list(NULL),
@@ -2360,7 +2368,16 @@
 }
 #endif // !PRODUCT
 
-void G1CollectedHeap::increment_full_collections_completed(bool concurrent) {
+void G1CollectedHeap::increment_old_marking_cycles_started() {
+  assert(_old_marking_cycles_started == _old_marking_cycles_completed ||
+    _old_marking_cycles_started == _old_marking_cycles_completed + 1,
+    err_msg("Wrong marking cycle count (started: %d, completed: %d)",
+    _old_marking_cycles_started, _old_marking_cycles_completed));
+
+  _old_marking_cycles_started++;
+}
+
+void G1CollectedHeap::increment_old_marking_cycles_completed(bool concurrent) {
   MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 
   // We assume that if concurrent == true, then the caller is a
@@ -2368,11 +2385,6 @@
   // Set. If there's ever a cheap way to check this, we should add an
   // assert here.
 
-  // We have already incremented _total_full_collections at the start
-  // of the GC, so total_full_collections() represents how many full
-  // collections have been started.
-  unsigned int full_collections_started = total_full_collections();
-
   // Given that this method is called at the end of a Full GC or of a
   // concurrent cycle, and those can be nested (i.e., a Full GC can
   // interrupt a concurrent cycle), the number of full collections
@@ -2382,21 +2394,21 @@
 
   // This is the case for the inner caller, i.e. a Full GC.
   assert(concurrent ||
-         (full_collections_started == _full_collections_completed + 1) ||
-         (full_collections_started == _full_collections_completed + 2),
-         err_msg("for inner caller (Full GC): full_collections_started = %u "
-                 "is inconsistent with _full_collections_completed = %u",
-                 full_collections_started, _full_collections_completed));
+         (_old_marking_cycles_started == _old_marking_cycles_completed + 1) ||
+         (_old_marking_cycles_started == _old_marking_cycles_completed + 2),
+         err_msg("for inner caller (Full GC): _old_marking_cycles_started = %u "
+                 "is inconsistent with _old_marking_cycles_completed = %u",
+                 _old_marking_cycles_started, _old_marking_cycles_completed));
 
   // This is the case for the outer caller, i.e. the concurrent cycle.
   assert(!concurrent ||
-         (full_collections_started == _full_collections_completed + 1),
+         (_old_marking_cycles_started == _old_marking_cycles_completed + 1),
          err_msg("for outer caller (concurrent cycle): "
-                 "full_collections_started = %u "
-                 "is inconsistent with _full_collections_completed = %u",
-                 full_collections_started, _full_collections_completed));
-
-  _full_collections_completed += 1;
+                 "_old_marking_cycles_started = %u "
+                 "is inconsistent with _old_marking_cycles_completed = %u",
+                 _old_marking_cycles_started, _old_marking_cycles_completed));
+
+  _old_marking_cycles_completed += 1;
 
   // We need to clear the "in_progress" flag in the CM thread before
   // we wake up any waiters (especially when ExplicitInvokesConcurrent
@@ -2432,7 +2444,7 @@
   assert_heap_not_locked();
 
   unsigned int gc_count_before;
-  unsigned int full_gc_count_before;
+  unsigned int old_marking_count_before;
   bool retry_gc;
 
   do {
@@ -2443,7 +2455,7 @@
 
       // Read the GC count while holding the Heap_lock
       gc_count_before = total_collections();
-      full_gc_count_before = total_full_collections();
+      old_marking_count_before = _old_marking_cycles_started;
     }
 
     if (should_do_concurrent_full_gc(cause)) {
@@ -2458,7 +2470,7 @@
 
       VMThread::execute(&op);
       if (!op.pause_succeeded()) {
-        if (full_gc_count_before == total_full_collections()) {
+        if (old_marking_count_before == _old_marking_cycles_started) {
           retry_gc = op.should_retry_gc();
         } else {
           // A Full GC happened while we were trying to schedule the
@@ -2486,7 +2498,7 @@
         VMThread::execute(&op);
       } else {
         // Schedule a Full GC.
-        VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause);
+        VM_G1CollectFull op(gc_count_before, old_marking_count_before, cause);
         VMThread::execute(&op);
       }
     }
@@ -3613,7 +3625,7 @@
     if (g1_policy()->during_initial_mark_pause()) {
       // We are about to start a marking cycle, so we increment the
       // full collection counter.
-      increment_total_full_collections();
+      increment_old_marking_cycles_started();
     }
     // if the log level is "finer" is on, we'll print long statistics information
     // in the collector policy code, so let's not print this as the output
@@ -3930,25 +3942,30 @@
 
       gc_epilogue(false);
     }
-  }
-
-  // The closing of the inner scope, immediately above, will complete
-  // logging at the "fine" level. The record_collection_pause_end() call
-  // above will complete logging at the "finer" level.
-  //
-  // It is not yet to safe, however, to tell the concurrent mark to
-  // start as we have some optional output below. We don't want the
-  // output from the concurrent mark thread interfering with this
-  // logging output either.
-
-  _hrs.verify_optional();
-  verify_region_sets_optional();
-
-  TASKQUEUE_STATS_ONLY(if (ParallelGCVerbose) print_taskqueue_stats());
-  TASKQUEUE_STATS_ONLY(reset_taskqueue_stats());
-
-  print_heap_after_gc();
-  g1mm()->update_sizes();
+
+    // The closing of the inner scope, immediately above, will complete
+    // logging at the "fine" level. The record_collection_pause_end() call
+    // above will complete logging at the "finer" level.
+    //
+    // It is not yet to safe, however, to tell the concurrent mark to
+    // start as we have some optional output below. We don't want the
+    // output from the concurrent mark thread interfering with this
+    // logging output either.
+
+    _hrs.verify_optional();
+    verify_region_sets_optional();
+
+    TASKQUEUE_STATS_ONLY(if (ParallelGCVerbose) print_taskqueue_stats());
+    TASKQUEUE_STATS_ONLY(reset_taskqueue_stats());
+
+    print_heap_after_gc();
+
+    // We must call G1MonitoringSupport::update_sizes() in the same scoping level
+    // as an active TraceMemoryManagerStats object (i.e. before the destructor for the
+    // TraceMemoryManagerStats is called) so that the G1 memory pools are updated
+    // before any GC notifications are raised.
+    g1mm()->update_sizes();
+  }
 
   if (G1SummarizeRSetStats &&
       (G1SummarizeRSetStatsPeriod > 0) &&
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -359,10 +359,13 @@
   // (c) cause == _g1_humongous_allocation
   bool should_do_concurrent_full_gc(GCCause::Cause cause);
 
-  // Keeps track of how many "full collections" (i.e., Full GCs or
-  // concurrent cycles) we have completed. The number of them we have
-  // started is maintained in _total_full_collections in CollectedHeap.
-  volatile unsigned int _full_collections_completed;
+  // Keeps track of how many "old marking cycles" (i.e., Full GCs or
+  // concurrent cycles) we have started.
+  volatile unsigned int _old_marking_cycles_started;
+
+  // Keeps track of how many "old marking cycles" (i.e., Full GCs or
+  // concurrent cycles) we have completed.
+  volatile unsigned int _old_marking_cycles_completed;
 
   // This is a non-product method that is helpful for testing. It is
   // called at the end of a GC and artificially expands the heap by
@@ -673,8 +676,12 @@
            (size_t) _in_cset_fast_test_length * sizeof(bool));
   }
 
+  // This is called at the start of either a concurrent cycle or a Full
+  // GC to update the number of old marking cycles started.
+  void increment_old_marking_cycles_started();
+
   // This is called at the end of either a concurrent cycle or a Full
-  // GC to update the number of full collections completed. Those two
+  // GC to update the number of old marking cycles completed. Those two
   // can happen in a nested fashion, i.e., we start a concurrent
   // cycle, a Full GC happens half-way through it which ends first,
   // and then the cycle notices that a Full GC happened and ends
@@ -683,14 +690,14 @@
   // false, the caller is the inner caller in the nesting (i.e., the
   // Full GC). If concurrent is true, the caller is the outer caller
   // in this nesting (i.e., the concurrent cycle). Further nesting is
-  // not currently supported. The end of the this call also notifies
+  // not currently supported. The end of this call also notifies
   // the FullGCCount_lock in case a Java thread is waiting for a full
   // GC to happen (e.g., it called System.gc() with
   // +ExplicitGCInvokesConcurrent).
-  void increment_full_collections_completed(bool concurrent);
+  void increment_old_marking_cycles_completed(bool concurrent);
 
-  unsigned int full_collections_completed() {
-    return _full_collections_completed;
+  unsigned int old_marking_cycles_completed() {
+    return _old_marking_cycles_completed;
   }
 
   G1HRPrinter* hr_printer() { return &_hr_printer; }
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -64,7 +64,7 @@
     _should_initiate_conc_mark(should_initiate_conc_mark),
     _target_pause_time_ms(target_pause_time_ms),
     _should_retry_gc(false),
-    _full_collections_completed_before(0) {
+    _old_marking_cycles_completed_before(0) {
   guarantee(target_pause_time_ms > 0.0,
             err_msg("target_pause_time_ms = %1.6lf should be positive",
                     target_pause_time_ms));
@@ -112,11 +112,11 @@
 
   GCCauseSetter x(g1h, _gc_cause);
   if (_should_initiate_conc_mark) {
-    // It's safer to read full_collections_completed() here, given
+    // It's safer to read old_marking_cycles_completed() here, given
     // that noone else will be updating it concurrently. Since we'll
     // only need it if we're initiating a marking cycle, no point in
     // setting it earlier.
-    _full_collections_completed_before = g1h->full_collections_completed();
+    _old_marking_cycles_completed_before = g1h->old_marking_cycles_completed();
 
     // At this point we are supposed to start a concurrent cycle. We
     // will do so if one is not already in progress.
@@ -181,17 +181,17 @@
 
     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
-    // In the doit() method we saved g1h->full_collections_completed()
-    // in the _full_collections_completed_before field. We have to
-    // wait until we observe that g1h->full_collections_completed()
+    // In the doit() method we saved g1h->old_marking_cycles_completed()
+    // in the _old_marking_cycles_completed_before field. We have to
+    // wait until we observe that g1h->old_marking_cycles_completed()
     // has increased by at least one. This can happen if a) we started
     // a cycle and it completes, b) a cycle already in progress
     // completes, or c) a Full GC happens.
 
     // If the condition has already been reached, there's no point in
     // actually taking the lock and doing the wait.
-    if (g1h->full_collections_completed() <=
-                                          _full_collections_completed_before) {
+    if (g1h->old_marking_cycles_completed() <=
+                                          _old_marking_cycles_completed_before) {
       // The following is largely copied from CMS
 
       Thread* thr = Thread::current();
@@ -200,8 +200,8 @@
       ThreadToNativeFromVM native(jt);
 
       MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
-      while (g1h->full_collections_completed() <=
-                                          _full_collections_completed_before) {
+      while (g1h->old_marking_cycles_completed() <=
+                                          _old_marking_cycles_completed_before) {
         FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
       }
     }
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -80,7 +80,7 @@
   bool         _should_initiate_conc_mark;
   bool         _should_retry_gc;
   double       _target_pause_time_ms;
-  unsigned int _full_collections_completed_before;
+  unsigned int _old_marking_cycles_completed_before;
 public:
   VM_G1IncCollectionPause(unsigned int   gc_count_before,
                           size_t         word_size,
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -844,6 +844,14 @@
     int bci = method->bci_from(fr.interpreter_frame_bcp());
     nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
   }
+#ifndef PRODUCT
+  if (TraceOnStackReplacement) {
+    if (nm != NULL) {
+      tty->print("OSR entry @ pc: " INTPTR_FORMAT ": ", nm->osr_entry());
+      nm->print();
+    }
+  }
+#endif
   return nm;
 }
 
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -230,7 +230,7 @@
   link_tail(chunk);
 
   assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list");
-  FreeList<Chunk>::increment_count();
+  increment_count();
   debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
@@ -258,7 +258,7 @@
   }
   head()->link_after(chunk);
   assert(!head() || size() == head()->size(), "Wrong sized chunk in list");
-  FreeList<Chunk>::increment_count();
+  increment_count();
   debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
@@ -909,6 +909,7 @@
 
 template <class Chunk>
 class AscendTreeCensusClosure : public TreeCensusClosure<Chunk> {
+  using TreeCensusClosure<Chunk>::do_list;
  public:
   void do_tree(TreeList<Chunk>* tl) {
     if (tl != NULL) {
@@ -921,6 +922,7 @@
 
 template <class Chunk>
 class DescendTreeCensusClosure : public TreeCensusClosure<Chunk> {
+  using TreeCensusClosure<Chunk>::do_list;
  public:
   void do_tree(TreeList<Chunk>* tl) {
     if (tl != NULL) {
@@ -987,6 +989,7 @@
 
 template <class Chunk>
 class DescendTreeSearchClosure : public TreeSearchClosure<Chunk> {
+  using TreeSearchClosure<Chunk>::do_list;
  public:
   bool do_tree(TreeList<Chunk>* tl) {
     if (tl != NULL) {
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -60,13 +60,18 @@
   TreeList<Chunk>* left()   const { return _left;   }
   TreeList<Chunk>* right()  const { return _right;  }
 
-  // Wrapper on call to base class, to get the template to compile.
-  Chunk* head() const { return FreeList<Chunk>::head(); }
-  Chunk* tail() const { return FreeList<Chunk>::tail(); }
-  void set_head(Chunk* head) { FreeList<Chunk>::set_head(head); }
-  void set_tail(Chunk* tail) { FreeList<Chunk>::set_tail(tail); }
+  // Explicitly import these names into our namespace to fix name lookup with templates
+  using FreeList<Chunk>::head;
+  using FreeList<Chunk>::set_head;
 
-  size_t size() const { return FreeList<Chunk>::size(); }
+  using FreeList<Chunk>::tail;
+  using FreeList<Chunk>::set_tail;
+  using FreeList<Chunk>::link_tail;
+
+  using FreeList<Chunk>::increment_count;
+  NOT_PRODUCT(using FreeList<Chunk>::increment_returned_bytes_by;)
+  using FreeList<Chunk>::verify_chunk_in_free_list;
+  using FreeList<Chunk>::size;
 
   // Accessors for links in tree.
 
--- a/hotspot/src/share/vm/oops/constMethodKlass.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/oops/constMethodKlass.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
   No_Safepoint_Verifier no_safepoint;
   cm->set_interpreter_kind(Interpreter::invalid);
   cm->init_fingerprint();
-  cm->set_method(NULL);
+  cm->set_constants(NULL);
   cm->set_stackmap_data(NULL);
   cm->set_exception_table(NULL);
   cm->set_code_size(byte_code_size);
@@ -98,7 +98,7 @@
 void constMethodKlass::oop_follow_contents(oop obj) {
   assert (obj->is_constMethod(), "object must be constMethod");
   constMethodOop cm = constMethodOop(obj);
-  MarkSweep::mark_and_push(cm->adr_method());
+  MarkSweep::mark_and_push(cm->adr_constants());
   MarkSweep::mark_and_push(cm->adr_stackmap_data());
   MarkSweep::mark_and_push(cm->adr_exception_table());
   // Performance tweak: We skip iterating over the klass pointer since we
@@ -110,7 +110,7 @@
                                            oop obj) {
   assert (obj->is_constMethod(), "object must be constMethod");
   constMethodOop cm_oop = constMethodOop(obj);
-  PSParallelCompact::mark_and_push(cm, cm_oop->adr_method());
+  PSParallelCompact::mark_and_push(cm, cm_oop->adr_constants());
   PSParallelCompact::mark_and_push(cm, cm_oop->adr_stackmap_data());
   PSParallelCompact::mark_and_push(cm, cm_oop->adr_exception_table());
   // Performance tweak: We skip iterating over the klass pointer since we
@@ -121,7 +121,7 @@
 int constMethodKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
   assert (obj->is_constMethod(), "object must be constMethod");
   constMethodOop cm = constMethodOop(obj);
-  blk->do_oop(cm->adr_method());
+  blk->do_oop(cm->adr_constants());
   blk->do_oop(cm->adr_stackmap_data());
   blk->do_oop(cm->adr_exception_table());
   // Get size before changing pointers.
@@ -135,7 +135,7 @@
   assert (obj->is_constMethod(), "object must be constMethod");
   constMethodOop cm = constMethodOop(obj);
   oop* adr;
-  adr = cm->adr_method();
+  adr = cm->adr_constants();
   if (mr.contains(adr)) blk->do_oop(adr);
   adr = cm->adr_stackmap_data();
   if (mr.contains(adr)) blk->do_oop(adr);
@@ -153,7 +153,7 @@
 int constMethodKlass::oop_adjust_pointers(oop obj) {
   assert(obj->is_constMethod(), "should be constMethod");
   constMethodOop cm = constMethodOop(obj);
-  MarkSweep::adjust_pointer(cm->adr_method());
+  MarkSweep::adjust_pointer(cm->adr_constants());
   MarkSweep::adjust_pointer(cm->adr_stackmap_data());
   MarkSweep::adjust_pointer(cm->adr_exception_table());
   // Get size before changing pointers.
@@ -188,8 +188,8 @@
   assert(obj->is_constMethod(), "must be constMethod");
   Klass::oop_print_on(obj, st);
   constMethodOop m = constMethodOop(obj);
-  st->print(" - method:       " INTPTR_FORMAT " ", (address)m->method());
-  m->method()->print_value_on(st); st->cr();
+  st->print(" - constants:       " INTPTR_FORMAT " ", (address)m->constants());
+  m->constants()->print_value_on(st); st->cr();
   st->print(" - exceptions:   " INTPTR_FORMAT "\n", (address)m->exception_table());
   if (m->has_stackmap_table()) {
     st->print(" - stackmap data:       ");
@@ -223,8 +223,8 @@
   // Verification can occur during oop construction before the method or
   // other fields have been initialized.
   if (!obj->partially_loaded()) {
-    guarantee(m->method()->is_perm(), "should be in permspace");
-    guarantee(m->method()->is_method(), "should be method");
+    guarantee(m->constants()->is_perm(), "should be in permspace");
+    guarantee(m->constants()->is_constantPool(), "should be constant pool");
     typeArrayOop stackmap_data = m->stackmap_data();
     guarantee(stackmap_data == NULL ||
               stackmap_data->is_perm(),  "should be in permspace");
--- a/hotspot/src/share/vm/oops/constMethodOop.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/oops/constMethodOop.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,6 +53,10 @@
   return align_object_size(header_size() + extra_words);
 }
 
+methodOop constMethodOopDesc::method() const {
+    return instanceKlass::cast(_constants->pool_holder())->method_with_idnum(
+                               _method_idnum);
+  }
 
 // linenumber table - note that length is unknown until decompression,
 // see class CompressedLineNumberReadStream.
--- a/hotspot/src/share/vm/oops/constMethodOop.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/oops/constMethodOop.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
 // |------------------------------------------------------|
 // | fingerprint 1                                        |
 // | fingerprint 2                                        |
-// | method                         (oop)                 |
+// | constants                      (oop)                 |
 // | stackmap_data                  (oop)                 |
 // | exception_table                (oop)                 |
 // | constMethod_size                                     |
@@ -113,7 +113,7 @@
   volatile bool     _is_conc_safe; // if true, safe for concurrent GC processing
 
 public:
-  oop* oop_block_beg() const { return adr_method(); }
+  oop* oop_block_beg() const { return adr_constants(); }
   oop* oop_block_end() const { return adr_exception_table() + 1; }
 
 private:
@@ -121,8 +121,7 @@
   // The oop block.  See comment in klass.hpp before making changes.
   //
 
-  // Backpointer to non-const methodOop (needed for some JVMTI operations)
-  methodOop         _method;
+  constantPoolOop   _constants;                  // Constant pool
 
   // Raw stackmap data for the method
   typeArrayOop      _stackmap_data;
@@ -167,10 +166,13 @@
   void set_interpreter_kind(int kind)      { _interpreter_kind = kind; }
   int  interpreter_kind(void) const        { return _interpreter_kind; }
 
-  // backpointer to non-const methodOop
-  methodOop method() const                 { return _method; }
-  void set_method(methodOop m)             { oop_store_without_check((oop*)&_method, (oop) m); }
+  // constant pool
+  constantPoolOop constants() const        { return _constants; }
+  void set_constants(constantPoolOop c)    {
+    oop_store_without_check((oop*)&_constants, (oop)c);
+  }
 
+  methodOop method() const;
 
   // stackmap table data
   typeArrayOop stackmap_data() const { return _stackmap_data; }
@@ -278,11 +280,13 @@
                             { return in_ByteSize(sizeof(constMethodOopDesc)); }
 
   // interpreter support
+  static ByteSize constants_offset()
+               { return byte_offset_of(constMethodOopDesc, _constants); }
   static ByteSize exception_table_offset()
                { return byte_offset_of(constMethodOopDesc, _exception_table); }
 
   // Garbage collection support
-  oop*  adr_method() const             { return (oop*)&_method;          }
+  oop*  adr_constants() const          { return (oop*)&_constants; }
   oop*  adr_stackmap_data() const      { return (oop*)&_stackmap_data;   }
   oop*  adr_exception_table() const    { return (oop*)&_exception_table; }
   bool is_conc_safe() { return _is_conc_safe; }
--- a/hotspot/src/share/vm/oops/methodKlass.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/oops/methodKlass.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,11 +112,6 @@
 
   assert(m->is_parsable(), "must be parsable here.");
   assert(m->size() == size, "wrong size for object");
-  // We should not publish an uprasable object's reference
-  // into one that is parsable, since that presents problems
-  // for the concurrent parallel marking and precleaning phases
-  // of concurrent gc (CMS).
-  xconst->set_method(m);
   return m;
 }
 
@@ -127,7 +122,6 @@
   // Performance tweak: We skip iterating over the klass pointer since we
   // know that Universe::methodKlassObj never moves.
   MarkSweep::mark_and_push(m->adr_constMethod());
-  MarkSweep::mark_and_push(m->adr_constants());
   if (m->method_data() != NULL) {
     MarkSweep::mark_and_push(m->adr_method_data());
   }
@@ -141,7 +135,6 @@
   // Performance tweak: We skip iterating over the klass pointer since we
   // know that Universe::methodKlassObj never moves.
   PSParallelCompact::mark_and_push(cm, m->adr_constMethod());
-  PSParallelCompact::mark_and_push(cm, m->adr_constants());
 #ifdef COMPILER2
   if (m->method_data() != NULL) {
     PSParallelCompact::mark_and_push(cm, m->adr_method_data());
@@ -159,7 +152,6 @@
   // Performance tweak: We skip iterating over the klass pointer since we
   // know that Universe::methodKlassObj never moves
   blk->do_oop(m->adr_constMethod());
-  blk->do_oop(m->adr_constants());
   if (m->method_data() != NULL) {
     blk->do_oop(m->adr_method_data());
   }
@@ -178,8 +170,6 @@
   oop* adr;
   adr = m->adr_constMethod();
   if (mr.contains(adr)) blk->do_oop(adr);
-  adr = m->adr_constants();
-  if (mr.contains(adr)) blk->do_oop(adr);
   if (m->method_data() != NULL) {
     adr = m->adr_method_data();
     if (mr.contains(adr)) blk->do_oop(adr);
@@ -197,7 +187,6 @@
   // Performance tweak: We skip iterating over the klass pointer since we
   // know that Universe::methodKlassObj never moves.
   MarkSweep::adjust_pointer(m->adr_constMethod());
-  MarkSweep::adjust_pointer(m->adr_constants());
   if (m->method_data() != NULL) {
     MarkSweep::adjust_pointer(m->adr_method_data());
   }
@@ -213,7 +202,6 @@
   assert(obj->is_method(), "should be method");
   methodOop m = methodOop(obj);
   PSParallelCompact::adjust_pointer(m->adr_constMethod());
-  PSParallelCompact::adjust_pointer(m->adr_constants());
 #ifdef COMPILER2
   if (m->method_data() != NULL) {
     PSParallelCompact::adjust_pointer(m->adr_method_data());
@@ -339,8 +327,6 @@
   if (!obj->partially_loaded()) {
     methodOop m = methodOop(obj);
     guarantee(m->is_perm(),  "should be in permspace");
-    guarantee(m->constants()->is_perm(), "should be in permspace");
-    guarantee(m->constants()->is_constantPool(), "should be constant pool");
     guarantee(m->constMethod()->is_constMethod(), "should be constMethodOop");
     guarantee(m->constMethod()->is_perm(), "should be in permspace");
     methodDataOop method_data = m->method_data();
--- a/hotspot/src/share/vm/oops/methodOop.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -70,11 +70,11 @@
   return _adapter->get_c2i_unverified_entry();
 }
 
-char* methodOopDesc::name_and_sig_as_C_string() {
+char* methodOopDesc::name_and_sig_as_C_string() const {
   return name_and_sig_as_C_string(Klass::cast(constants()->pool_holder()), name(), signature());
 }
 
-char* methodOopDesc::name_and_sig_as_C_string(char* buf, int size) {
+char* methodOopDesc::name_and_sig_as_C_string(char* buf, int size) const {
   return name_and_sig_as_C_string(Klass::cast(constants()->pool_holder()), name(), signature(), buf, size);
 }
 
@@ -177,7 +177,8 @@
 
 
 int methodOopDesc::bci_from(address bcp) const {
-  assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(), "bcp doesn't belong to this method");
+  assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(),
+         err_msg("bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s", bcp, name_and_sig_as_C_string()));
   return bcp - code_base();
 }
 
@@ -531,9 +532,9 @@
 
 
 bool methodOopDesc::is_klass_loaded_by_klass_index(int klass_index) const {
-  if( _constants->tag_at(klass_index).is_unresolved_klass() ) {
+  if( constants()->tag_at(klass_index).is_unresolved_klass() ) {
     Thread *thread = Thread::current();
-    Symbol* klass_name = _constants->klass_name_at(klass_index);
+    Symbol* klass_name = constants()->klass_name_at(klass_index);
     Handle loader(thread, instanceKlass::cast(method_holder())->class_loader());
     Handle prot  (thread, Klass::cast(method_holder())->protection_domain());
     return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
@@ -544,7 +545,7 @@
 
 
 bool methodOopDesc::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {
-  int klass_index = _constants->klass_ref_index_at(refinfo_index);
+  int klass_index = constants()->klass_ref_index_at(refinfo_index);
   if (must_be_resolved) {
     // Make sure klass is resolved in constantpool.
     if (constants()->tag_at(klass_index).is_unresolved_klass()) return false;
@@ -886,11 +887,13 @@
 }
 
 jint* methodOopDesc::method_type_offsets_chain() {
-  static jint pchase[] = { -1, -1, -1 };
+  static jint pchase[] = { -1, -1, -1, -1 };
   if (pchase[0] == -1) {
-    jint step0 = in_bytes(constants_offset());
-    jint step1 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize;
+    jint step0 = in_bytes(const_offset());
+    jint step1 = in_bytes(constMethodOopDesc::constants_offset());
+    jint step2 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize;
     // do this in reverse to avoid races:
+    OrderAccess::release_store(&pchase[2], step2);
     OrderAccess::release_store(&pchase[1], step1);
     OrderAccess::release_store(&pchase[0], step0);
   }
@@ -1076,9 +1079,7 @@
   assert(m->constMethod()->is_parsable(), "Should remain parsable");
 
   // Reset correct method/const method, method size, and parameter info
-  newcm->set_method(newm());
   newm->set_constMethod(newcm);
-  assert(newcm->method() == newm(), "check");
   newm->constMethod()->set_code_size(new_code_length);
   newm->constMethod()->set_constMethod_size(new_const_method_size);
   newm->set_method_size(new_method_size);
--- a/hotspot/src/share/vm/oops/methodOop.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -64,7 +64,6 @@
 // | klass                                                |
 // |------------------------------------------------------|
 // | constMethodOop                 (oop)                 |
-// | constants                      (oop)                 |
 // |------------------------------------------------------|
 // | methodData                     (oop)                 |
 // | interp_invocation_count                              |
@@ -110,7 +109,6 @@
  friend class VMStructs;
  private:
   constMethodOop    _constMethod;                // Method read-only data.
-  constantPoolOop   _constants;                  // Constant pool
   methodDataOop     _method_data;
   int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
   AccessFlags       _access_flags;               // Access flags
@@ -170,17 +168,17 @@
   void set_access_flags(AccessFlags flags)       { _access_flags = flags; }
 
   // name
-  Symbol* name() const                           { return _constants->symbol_at(name_index()); }
+  Symbol* name() const                           { return constants()->symbol_at(name_index()); }
   int name_index() const                         { return constMethod()->name_index();         }
   void set_name_index(int index)                 { constMethod()->set_name_index(index);       }
 
   // signature
-  Symbol* signature() const                      { return _constants->symbol_at(signature_index()); }
+  Symbol* signature() const                      { return constants()->symbol_at(signature_index()); }
   int signature_index() const                    { return constMethod()->signature_index();         }
   void set_signature_index(int index)            { constMethod()->set_signature_index(index);       }
 
   // generics support
-  Symbol* generic_signature() const              { int idx = generic_signature_index(); return ((idx != 0) ? _constants->symbol_at(idx) : (Symbol*)NULL); }
+  Symbol* generic_signature() const              { int idx = generic_signature_index(); return ((idx != 0) ? constants()->symbol_at(idx) : (Symbol*)NULL); }
   int generic_signature_index() const            { return constMethod()->generic_signature_index(); }
   void set_generic_signature_index(int index)    { constMethod()->set_generic_signature_index(index); }
 
@@ -198,8 +196,8 @@
   // C string, for the purpose of providing more useful NoSuchMethodErrors
   // and fatal error handling. The string is allocated in resource
   // area if a buffer is not provided by the caller.
-  char* name_and_sig_as_C_string();
-  char* name_and_sig_as_C_string(char* buf, int size);
+  char* name_and_sig_as_C_string() const;
+  char* name_and_sig_as_C_string(char* buf, int size) const;
 
   // Static routine in the situations we don't have a methodOop
   static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature);
@@ -242,8 +240,8 @@
   }
 
   // constant pool for klassOop holding this method
-  constantPoolOop constants() const              { return _constants; }
-  void set_constants(constantPoolOop c)          { oop_store_without_check((oop*)&_constants, c); }
+  constantPoolOop constants() const              { return constMethod()->constants(); }
+  void set_constants(constantPoolOop c)          { constMethod()->set_constants(c); }
 
   // max stack
   int  max_stack() const                         { return _max_stack; }
@@ -453,7 +451,7 @@
                        { return constMethod()->compressed_linenumber_table(); }
 
   // method holder (the klassOop holding this method)
-  klassOop method_holder() const                 { return _constants->pool_holder(); }
+  klassOop method_holder() const                 { return constants()->pool_holder(); }
 
   void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
   Symbol* klass_name() const;                    // returns the name of the method holder
@@ -544,7 +542,6 @@
 
   // interpreter support
   static ByteSize const_offset()                 { return byte_offset_of(methodOopDesc, _constMethod       ); }
-  static ByteSize constants_offset()             { return byte_offset_of(methodOopDesc, _constants         ); }
   static ByteSize access_flags_offset()          { return byte_offset_of(methodOopDesc, _access_flags      ); }
 #ifdef CC_INTERP
   static ByteSize result_index_offset()          { return byte_offset_of(methodOopDesc, _result_index ); }
@@ -723,7 +720,6 @@
 
   // Garbage collection support
   oop*  adr_constMethod() const                  { return (oop*)&_constMethod;     }
-  oop*  adr_constants() const                    { return (oop*)&_constants;       }
   oop*  adr_method_data() const                  { return (oop*)&_method_data;     }
 };
 
--- a/hotspot/src/share/vm/opto/classes.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/classes.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -147,7 +147,6 @@
 macro(LoadL)
 macro(LoadL_unaligned)
 macro(LoadPLocked)
-macro(LoadLLocked)
 macro(LoadP)
 macro(LoadN)
 macro(LoadRange)
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -2297,7 +2297,6 @@
   case Op_LoadL:
   case Op_LoadL_unaligned:
   case Op_LoadPLocked:
-  case Op_LoadLLocked:
   case Op_LoadP:
   case Op_LoadN:
   case Op_LoadRange:
--- a/hotspot/src/share/vm/opto/divnode.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/divnode.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -284,9 +284,14 @@
 
   const int N = 64;
 
+  // Dummy node to keep intermediate nodes alive during construction
+  Node* hook = new (phase->C, 4) Node(4);
+
   // u0 = u & 0xFFFFFFFF;  u1 = u >> 32;
   Node* u0 = phase->transform(new (phase->C, 3) AndLNode(dividend, phase->longcon(0xFFFFFFFF)));
   Node* u1 = phase->transform(new (phase->C, 3) RShiftLNode(dividend, phase->intcon(N / 2)));
+  hook->init_req(0, u0);
+  hook->init_req(1, u1);
 
   // v0 = v & 0xFFFFFFFF;  v1 = v >> 32;
   Node* v0 = phase->longcon(magic_const & 0xFFFFFFFF);
@@ -299,19 +304,14 @@
   Node* u1v0 = phase->transform(new (phase->C, 3) MulLNode(u1, v0));
   Node* temp = phase->transform(new (phase->C, 3) URShiftLNode(w0, phase->intcon(N / 2)));
   Node* t    = phase->transform(new (phase->C, 3) AddLNode(u1v0, temp));
+  hook->init_req(2, t);
 
   // w1 = t & 0xFFFFFFFF;
-  Node* w1 = new (phase->C, 3) AndLNode(t, phase->longcon(0xFFFFFFFF));
+  Node* w1 = phase->transform(new (phase->C, 3) AndLNode(t, phase->longcon(0xFFFFFFFF)));
+  hook->init_req(3, w1);
 
   // w2 = t >> 32;
-  Node* w2 = new (phase->C, 3) RShiftLNode(t, phase->intcon(N / 2));
-
-  // 6732154: Construct both w1 and w2 before transforming, so t
-  // doesn't go dead prematurely.
-  // 6837011: We need to transform w2 before w1 because the
-  // transformation of w1 could return t.
-  w2 = phase->transform(w2);
-  w1 = phase->transform(w1);
+  Node* w2 = phase->transform(new (phase->C, 3) RShiftLNode(t, phase->intcon(N / 2)));
 
   // w1 = u0*v1 + w1;
   Node* u0v1 = phase->transform(new (phase->C, 3) MulLNode(u0, v1));
@@ -322,6 +322,16 @@
   Node* temp1 = phase->transform(new (phase->C, 3) AddLNode(u1v1, w2));
   Node* temp2 = phase->transform(new (phase->C, 3) RShiftLNode(w1, phase->intcon(N / 2)));
 
+  // Remove the bogus extra edges used to keep things alive
+  PhaseIterGVN* igvn = phase->is_IterGVN();
+  if (igvn != NULL) {
+    igvn->remove_dead_node(hook);
+  } else {
+    for (int i = 0; i < 4; i++) {
+      hook->set_req(i, NULL);
+    }
+  }
+
   return new (phase->C, 3) AddLNode(temp1, temp2);
 }
 
--- a/hotspot/src/share/vm/opto/domgraph.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/domgraph.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -465,15 +465,11 @@
           // Kill dead input path
           assert( !visited.test(whead->in(i)->_idx),
                   "input with no loop must be dead" );
-          _igvn.hash_delete(whead);
-          whead->del_req(i);
-          _igvn._worklist.push(whead);
+          _igvn.delete_input_of(whead, i);
           for (DUIterator_Fast jmax, j = whead->fast_outs(jmax); j < jmax; j++) {
             Node* p = whead->fast_out(j);
             if( p->is_Phi() ) {
-              _igvn.hash_delete(p);
-              p->del_req(i);
-              _igvn._worklist.push(p);
+              _igvn.delete_input_of(p, i);
             }
           }
           i--;                  // Rerun same iteration
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -338,8 +338,7 @@
   Node *phi_f = NULL;     // do not construct unless needed
   for (DUIterator_Last i2min, i2 = phi->last_outs(i2min); i2 >= i2min; --i2) {
     Node* v = phi->last_out(i2);// User of the phi
-    igvn->hash_delete(v);       // Have to fixup other Phi users
-    igvn->_worklist.push(v);
+    igvn->rehash_node_delayed(v); // Have to fixup other Phi users
     uint vop = v->Opcode();
     Node *proj = NULL;
     if( vop == Op_Phi ) {       // Remote merge point
@@ -552,9 +551,8 @@
   if( new_cmp == cmp ) return;
   // Else, adjust existing check
   Node *new_bol = gvn->transform( new (gvn->C, 2) BoolNode( new_cmp, bol->as_Bool()->_test._test ) );
-  igvn->hash_delete( iff );
+  igvn->rehash_node_delayed( iff );
   iff->set_req_X( 1, new_bol, igvn );
-  igvn->_worklist.push( iff );
 }
 
 //------------------------------up_one_dom-------------------------------------
@@ -732,9 +730,7 @@
               Node* adjusted = phase->transform(new (phase->C, 3) SubINode(n, phase->intcon(failtype->_lo)));
               Node* newcmp = phase->transform(new (phase->C, 3) CmpUNode(adjusted, phase->intcon(bound)));
               Node* newbool = phase->transform(new (phase->C, 2) BoolNode(newcmp, cond));
-              phase->hash_delete(dom_iff);
-              dom_iff->set_req(1, phase->intcon(ctrl->as_Proj()->_con));
-              phase->is_IterGVN()->_worklist.push(dom_iff);
+              phase->is_IterGVN()->replace_input_of(dom_iff, 1, phase->intcon(ctrl->as_Proj()->_con));
               phase->hash_delete(this);
               set_req(1, newbool);
               return this;
@@ -1042,17 +1038,15 @@
     // Loop ends when projection has no more uses.
     for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) {
       Node* s = ifp->last_out(j);   // Get child of IfTrue/IfFalse
-      igvn->hash_delete(s);         // Yank from hash table before edge hacking
       if( !s->depends_only_on_test() ) {
         // Find the control input matching this def-use edge.
         // For Regions it may not be in slot 0.
         uint l;
         for( l = 0; s->in(l) != ifp; l++ ) { }
-        s->set_req(l, ctrl_target);
+        igvn->replace_input_of(s, l, ctrl_target);
       } else {                      // Else, for control producers,
-        s->set_req(0, data_target); // Move child to data-target
+        igvn->replace_input_of(s, 0, data_target); // Move child to data-target
       }
-      igvn->_worklist.push(s);  // Revisit collapsed Phis
     } // End for each child of a projection
 
     igvn->remove_dead_node(ifp);
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -192,8 +192,6 @@
   void copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, bool is_array, bool card_mark);
   bool inline_native_clone(bool is_virtual);
   bool inline_native_Reflection_getCallerClass();
-  bool inline_native_AtomicLong_get();
-  bool inline_native_AtomicLong_attemptUpdate();
   bool is_method_invoke_or_aux_frame(JVMState* jvms);
   // Helper function for inlining native object hash method
   bool inline_native_hashcode(bool is_virtual, bool is_static);
@@ -331,11 +329,6 @@
     // We do not intrinsify this.  The optimizer does fine with it.
     return NULL;
 
-  case vmIntrinsics::_get_AtomicLong:
-  case vmIntrinsics::_attemptUpdate:
-    if (!InlineAtomicLong)  return NULL;
-    break;
-
   case vmIntrinsics::_getCallerClass:
     if (!UseNewReflection)  return NULL;
     if (!InlineReflectionGetCallerClass)  return NULL;
@@ -711,11 +704,6 @@
   case vmIntrinsics::_reverseBytes_c:
     return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id());
 
-  case vmIntrinsics::_get_AtomicLong:
-    return inline_native_AtomicLong_get();
-  case vmIntrinsics::_attemptUpdate:
-    return inline_native_AtomicLong_attemptUpdate();
-
   case vmIntrinsics::_getCallerClass:
     return inline_native_Reflection_getCallerClass();
 
@@ -4006,113 +3994,6 @@
   return false;
 }
 
-static int value_field_offset = -1;  // offset of the "value" field of AtomicLongCSImpl.  This is needed by
-                                     // inline_native_AtomicLong_attemptUpdate() but it has no way of
-                                     // computing it since there is no lookup field by name function in the
-                                     // CI interface.  This is computed and set by inline_native_AtomicLong_get().
-                                     // Using a static variable here is safe even if we have multiple compilation
-                                     // threads because the offset is constant.  At worst the same offset will be
-                                     // computed and  stored multiple
-
-bool LibraryCallKit::inline_native_AtomicLong_get() {
-  // Restore the stack and pop off the argument
-  _sp+=1;
-  Node *obj = pop();
-
-  // get the offset of the "value" field. Since the CI interfaces
-  // does not provide a way to look up a field by name, we scan the bytecodes
-  // to get the field index.  We expect the first 2 instructions of the method
-  // to be:
-  //    0 aload_0
-  //    1 getfield "value"
-  ciMethod* method = callee();
-  if (value_field_offset == -1)
-  {
-    ciField* value_field;
-    ciBytecodeStream iter(method);
-    Bytecodes::Code bc = iter.next();
-
-    if ((bc != Bytecodes::_aload_0) &&
-              ((bc != Bytecodes::_aload) || (iter.get_index() != 0)))
-      return false;
-    bc = iter.next();
-    if (bc != Bytecodes::_getfield)
-      return false;
-    bool ignore;
-    value_field = iter.get_field(ignore);
-    value_field_offset = value_field->offset_in_bytes();
-  }
-
-  // Null check without removing any arguments.
-  _sp++;
-  obj = do_null_check(obj, T_OBJECT);
-  _sp--;
-  // Check for locking null object
-  if (stopped()) return true;
-
-  Node *adr = basic_plus_adr(obj, obj, value_field_offset);
-  const TypePtr *adr_type = _gvn.type(adr)->is_ptr();
-  int alias_idx = C->get_alias_index(adr_type);
-
-  Node *result = _gvn.transform(new (C, 3) LoadLLockedNode(control(), memory(alias_idx), adr));
-
-  push_pair(result);
-
-  return true;
-}
-
-bool LibraryCallKit::inline_native_AtomicLong_attemptUpdate() {
-  // Restore the stack and pop off the arguments
-  _sp+=5;
-  Node *newVal = pop_pair();
-  Node *oldVal = pop_pair();
-  Node *obj = pop();
-
-  // we need the offset of the "value" field which was computed when
-  // inlining the get() method.  Give up if we don't have it.
-  if (value_field_offset == -1)
-    return false;
-
-  // Null check without removing any arguments.
-  _sp+=5;
-  obj = do_null_check(obj, T_OBJECT);
-  _sp-=5;
-  // Check for locking null object
-  if (stopped()) return true;
-
-  Node *adr = basic_plus_adr(obj, obj, value_field_offset);
-  const TypePtr *adr_type = _gvn.type(adr)->is_ptr();
-  int alias_idx = C->get_alias_index(adr_type);
-
-  Node *cas = _gvn.transform(new (C, 5) StoreLConditionalNode(control(), memory(alias_idx), adr, newVal, oldVal));
-  Node *store_proj = _gvn.transform( new (C, 1) SCMemProjNode(cas));
-  set_memory(store_proj, alias_idx);
-  Node *bol = _gvn.transform( new (C, 2) BoolNode( cas, BoolTest::eq ) );
-
-  Node *result;
-  // CMove node is not used to be able fold a possible check code
-  // after attemptUpdate() call. This code could be transformed
-  // into CMove node by loop optimizations.
-  {
-    RegionNode *r = new (C, 3) RegionNode(3);
-    result = new (C, 3) PhiNode(r, TypeInt::BOOL);
-
-    Node *iff = create_and_xform_if(control(), bol, PROB_FAIR, COUNT_UNKNOWN);
-    Node *iftrue = opt_iff(r, iff);
-    r->init_req(1, iftrue);
-    result->init_req(1, intcon(1));
-    result->init_req(2, intcon(0));
-
-    set_control(_gvn.transform(r));
-    record_for_igvn(r);
-
-    C->set_has_split_ifs(true); // Has chance for split-if optimization
-  }
-
-  push(_gvn.transform(result));
-  return true;
-}
-
 bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
   // restore the arguments
   _sp += arg_size();
--- a/hotspot/src/share/vm/opto/loopPredicate.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -212,9 +212,8 @@
     Node* use = rgn->fast_out(i);
     if (use->is_Phi() && use->outcnt() > 0) {
       assert(use->in(0) == rgn, "");
-      _igvn.hash_delete(use);
+      _igvn.rehash_node_delayed(use);
       use->add_req(use->in(proj_index));
-      _igvn._worklist.push(use);
       has_phi = true;
     }
   }
@@ -284,9 +283,8 @@
   for (DUIterator_Fast imax, i = rgn->fast_outs(imax); i < imax; i++) {
     Node* use = rgn->fast_out(i);
     if (use->is_Phi() && use->outcnt() > 0) {
-      hash_delete(use);
+      rehash_node_delayed(use);
       use->add_req(use->in(proj_index));
-      _worklist.push(use);
       has_phi = true;
     }
   }
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -961,9 +961,7 @@
   set_loop(zer_iff, loop->_parent);
 
   // Plug in the false-path, taken if we need to skip post-loop
-  _igvn.hash_delete( main_exit );
-  main_exit->set_req(0, zer_iff);
-  _igvn._worklist.push(main_exit);
+  _igvn.replace_input_of(main_exit, 0, zer_iff);
   set_idom(main_exit, zer_iff, dd_main_exit);
   set_idom(main_exit->unique_out(), zer_iff, dd_main_exit);
   // Make the true-path, must enter the post loop
@@ -1956,9 +1954,7 @@
       C->set_major_progress();
       Node *kill_con = _igvn.intcon( 1-flip );
       set_ctrl(kill_con, C->root());
-      _igvn.hash_delete(iff);
-      iff->set_req(1, kill_con);
-      _igvn._worklist.push(iff);
+      _igvn.replace_input_of(iff, 1, kill_con);
       // Find surviving projection
       assert(iff->is_If(), "");
       ProjNode* dp = ((IfNode*)iff)->proj_out(1-flip);
@@ -1966,11 +1962,9 @@
       for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
         Node* cd = dp->fast_out(i); // Control-dependent node
         if( cd->is_Load() ) {   // Loads can now float around in the loop
-          _igvn.hash_delete(cd);
           // Allow the load to float around in the loop, or before it
           // but NOT before the pre-loop.
-          cd->set_req(0, ctrl);   // ctrl, not NULL
-          _igvn._worklist.push(cd);
+          _igvn.replace_input_of(cd, 0, ctrl); // ctrl, not NULL
           --i;
           --imax;
         }
@@ -2029,14 +2023,10 @@
     main_bol->set_req(1,main_cmp);
   }
   // Hack the now-private loop bounds
-  _igvn.hash_delete(main_cmp);
-  main_cmp->set_req(2, main_limit);
-  _igvn._worklist.push(main_cmp);
+  _igvn.replace_input_of(main_cmp, 2, main_limit);
   // The OpaqueNode is unshared by design
-  _igvn.hash_delete(opqzm);
   assert( opqzm->outcnt() == 1, "cannot hack shared node" );
-  opqzm->set_req(1,main_limit);
-  _igvn._worklist.push(opqzm);
+  _igvn.replace_input_of(opqzm, 1, main_limit);
 }
 
 //------------------------------DCE_loop_body----------------------------------
@@ -2178,9 +2168,7 @@
     Node* cmp = cl->loopexit()->cmp_node();
     assert(cl->limit() == cmp->in(2), "sanity");
     phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist
-    phase->_igvn.hash_delete(cmp);
-    cmp->set_req(2, exact_limit);
-    phase->_igvn._worklist.push(cmp);        // put cmp on worklist
+    phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist
   }
   // Note: the final value after increment should not overflow since
   // counted loop has limit check predicate.
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -174,27 +174,21 @@
       Node* use = worklist.pop();
       Node* nuse = use->clone();
       nuse->set_req(0, invar_proj);
-      _igvn.hash_delete(use);
-      use->set_req(1, nuse);
-      _igvn._worklist.push(use);
+      _igvn.replace_input_of(use, 1, nuse);
       register_new_node(nuse, invar_proj);
       // Same for the clone
       Node* use_clone = old_new[use->_idx];
-      _igvn.hash_delete(use_clone);
-      use_clone->set_req(1, nuse);
-      _igvn._worklist.push(use_clone);
+      _igvn.replace_input_of(use_clone, 1, nuse);
     }
   }
 
   // Hardwire the control paths in the loops into if(true) and if(false)
-  _igvn.hash_delete(unswitch_iff);
+  _igvn.rehash_node_delayed(unswitch_iff);
   short_circuit_if(unswitch_iff, proj_true);
-  _igvn._worklist.push(unswitch_iff);
 
   IfNode* unswitch_iff_clone = old_new[unswitch_iff->_idx]->as_If();
-  _igvn.hash_delete(unswitch_iff_clone);
+  _igvn.rehash_node_delayed(unswitch_iff_clone);
   short_circuit_if(unswitch_iff_clone, proj_false);
-  _igvn._worklist.push(unswitch_iff_clone);
 
   // Reoptimize loops
   loop->record_for_igvn();
@@ -224,8 +218,7 @@
   LoopNode* head  = loop->_head->as_Loop();
   bool counted_loop = head->is_CountedLoop();
   Node*     entry = head->in(LoopNode::EntryControl);
-  _igvn.hash_delete(entry);
-  _igvn._worklist.push(entry);
+  _igvn.rehash_node_delayed(entry);
   IdealLoopTree* outer_loop = loop->_parent;
 
   Node *cont      = _igvn.intcon(1);
@@ -249,18 +242,14 @@
 
   // Fast (true) control
   Node* iffast_pred = clone_loop_predicates(entry, iffast, !counted_loop);
-  _igvn.hash_delete(head);
-  head->set_req(LoopNode::EntryControl, iffast_pred);
+  _igvn.replace_input_of(head, LoopNode::EntryControl, iffast_pred);
   set_idom(head, iffast_pred, dom_depth(head));
-  _igvn._worklist.push(head);
 
   // Slow (false) control
   Node* ifslow_pred = clone_loop_predicates(entry, ifslow, !counted_loop);
   LoopNode* slow_head = old_new[head->_idx]->as_Loop();
-  _igvn.hash_delete(slow_head);
-  slow_head->set_req(LoopNode::EntryControl, ifslow_pred);
+  _igvn.replace_input_of(slow_head, LoopNode::EntryControl, ifslow_pred);
   set_idom(slow_head, ifslow_pred, dom_depth(slow_head));
-  _igvn._worklist.push(slow_head);
 
   recompute_dom_depth();
 
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1129,8 +1129,7 @@
         // I'm mid-iteration over the Region's uses.
         for (DUIterator_Last imin, i = old_phi->last_outs(imin); i >= imin; ) {
           Node* use = old_phi->last_out(i);
-          igvn.hash_delete(use);
-          igvn._worklist.push(use);
+          igvn.rehash_node_delayed(use);
           uint uses_found = 0;
           for (uint j = 0; j < use->len(); j++) {
             if (use->in(j) == old_phi) {
@@ -1186,10 +1185,8 @@
       phi->init_req(LoopNode::LoopBackControl, old_phi->in(outer_idx));
       phi = igvn.register_new_node_with_optimizer(phi, old_phi);
       // Make old Phi point to new Phi on the fall-in path
-      igvn.hash_delete(old_phi);
-      old_phi->set_req(LoopNode::EntryControl, phi);
+      igvn.replace_input_of(old_phi, LoopNode::EntryControl, phi);
       old_phi->del_req(outer_idx);
-      igvn._worklist.push(old_phi);
     }
   }
 
@@ -1992,9 +1989,7 @@
     // we do it here.
     for( uint i = 1; i < C->root()->req(); i++ ) {
       if( !_nodes[C->root()->in(i)->_idx] ) {    // Dead path into Root?
-        _igvn.hash_delete(C->root());
-        C->root()->del_req(i);
-        _igvn._worklist.push(C->root());
+        _igvn.delete_input_of(C->root(), i);
         i--;                      // Rerun same iteration on compressed edges
       }
     }
--- a/hotspot/src/share/vm/opto/loopopts.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/loopopts.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -216,9 +216,7 @@
   Node *con = _igvn.makecon(pop == Op_IfTrue ? TypeInt::ONE : TypeInt::ZERO);
   set_ctrl(con, C->root()); // Constant gets a new use
   // Hack the dominated test
-  _igvn.hash_delete(iff);
-  iff->set_req(1, con);
-  _igvn._worklist.push(iff);
+  _igvn.replace_input_of(iff, 1, con);
 
   // If I dont have a reachable TRUE and FALSE path following the IfNode then
   // I can assume this path reaches an infinite loop.  In this case it's not
@@ -245,10 +243,8 @@
     Node* cd = dp->fast_out(i); // Control-dependent node
     if (cd->depends_only_on_test()) {
       assert(cd->in(0) == dp, "");
-      _igvn.hash_delete(cd);
-      cd->set_req(0, prevdom);
+      _igvn.replace_input_of(cd, 0, prevdom);
       set_early_ctrl(cd);
-      _igvn._worklist.push(cd);
       IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
       if (old_loop != new_loop) {
         if (!old_loop->_child) old_loop->_body.yank(cd);
@@ -952,8 +948,7 @@
         if (!n->is_Load() || late_load_ctrl != n_ctrl) {
           for (DUIterator_Last jmin, j = n->last_outs(jmin); j >= jmin; ) {
             Node *u = n->last_out(j); // Clone private computation per use
-            _igvn.hash_delete(u);
-            _igvn._worklist.push(u);
+            _igvn.rehash_node_delayed(u);
             Node *x = n->clone(); // Clone computation
             Node *x_ctrl = NULL;
             if( u->is_Phi() ) {
@@ -1089,9 +1084,7 @@
   for( i = 1; i < phi->req(); i++ ) {
     Node *b = phi->in(i);
     if( b->is_Phi() ) {
-      _igvn.hash_delete(phi);
-      _igvn._worklist.push(phi);
-      phi->set_req(i, clone_iff( b->as_Phi(), loop ));
+      _igvn.replace_input_of(phi, i, clone_iff( b->as_Phi(), loop ));
     } else {
       assert( b->is_Bool(), "" );
     }
@@ -1161,9 +1154,7 @@
   for( i = 1; i < phi->req(); i++ ) {
     Node *b = phi->in(i);
     if( b->is_Phi() ) {
-      _igvn.hash_delete(phi);
-      _igvn._worklist.push(phi);
-      phi->set_req(i, clone_bool( b->as_Phi(), loop ));
+      _igvn.replace_input_of(phi, i, clone_bool( b->as_Phi(), loop ));
     } else {
       assert( b->is_Cmp() || b->is_top(), "inputs are all Cmp or TOP" );
     }
@@ -1347,8 +1338,7 @@
         // The original user of 'use' uses 'r' instead.
         for (DUIterator_Last lmin, l = use->last_outs(lmin); l >= lmin;) {
           Node* useuse = use->last_out(l);
-          _igvn.hash_delete(useuse);
-          _igvn._worklist.push(useuse);
+          _igvn.rehash_node_delayed(useuse);
           uint uses_found = 0;
           if( useuse->in(0) == use ) {
             useuse->set_req(0, r);
@@ -1435,9 +1425,7 @@
         if( use->is_Phi() )     // Phi use is in prior block
           cfg = prev->in(idx);  // NOT in block of Phi itself
         if (cfg->is_top()) {    // Use is dead?
-          _igvn.hash_delete(use);
-          _igvn._worklist.push(use);
-          use->set_req(idx, C->top());
+          _igvn.replace_input_of(use, idx, C->top());
           continue;
         }
 
@@ -1487,9 +1475,7 @@
           set_ctrl(phi, prev);
         }
         // Make 'use' use the Phi instead of the old loop body exit value
-        _igvn.hash_delete(use);
-        _igvn._worklist.push(use);
-        use->set_req(idx, phi);
+        _igvn.replace_input_of(use, idx, phi);
         if( use->_idx >= new_counter ) { // If updating new phis
           // Not needed for correctness, but prevents a weak assert
           // in AddPNode from tripping (when we end up with different
@@ -1517,9 +1503,7 @@
       Node *iff = split_if_set->pop();
       if( iff->in(1)->is_Phi() ) {
         BoolNode *b = clone_iff( iff->in(1)->as_Phi(), loop );
-        _igvn.hash_delete(iff);
-        _igvn._worklist.push(iff);
-        iff->set_req(1, b);
+        _igvn.replace_input_of(iff, 1, b);
       }
     }
   }
@@ -1529,9 +1513,7 @@
       Node *phi = b->in(1);
       assert( phi->is_Phi(), "" );
       CmpNode *cmp = clone_bool( (PhiNode*)phi, loop );
-      _igvn.hash_delete(b);
-      _igvn._worklist.push(b);
-      b->set_req(1, cmp);
+      _igvn.replace_input_of(b, 1, cmp);
     }
   }
   if( split_cex_set ) {
@@ -1686,10 +1668,8 @@
   ProjNode *other_proj = iff->proj_out(!proj->is_IfTrue())->as_Proj();
   int ddepth = dom_depth(proj);
 
-  _igvn.hash_delete(iff);
-  _igvn._worklist.push(iff);
-  _igvn.hash_delete(proj);
-  _igvn._worklist.push(proj);
+  _igvn.rehash_node_delayed(iff);
+  _igvn.rehash_node_delayed(proj);
 
   proj->set_req(0, NULL);  // temporary disconnect
   ProjNode* proj2 = proj_clone(proj, iff);
@@ -1745,10 +1725,8 @@
   ProjNode *other_proj = iff->proj_out(!proj->is_IfTrue())->as_Proj();
   int ddepth = dom_depth(proj);
 
-  _igvn.hash_delete(iff);
-  _igvn._worklist.push(iff);
-  _igvn.hash_delete(proj);
-  _igvn._worklist.push(proj);
+  _igvn.rehash_node_delayed(iff);
+  _igvn.rehash_node_delayed(proj);
 
   proj->set_req(0, NULL);  // temporary disconnect
   ProjNode* proj2 = proj_clone(proj, iff);
@@ -1970,9 +1948,7 @@
 
     // clone "n" and insert it between the inputs of "n" and the use outside the loop
     Node* n_clone = n->clone();
-    _igvn.hash_delete(use);
-    use->set_req(j, n_clone);
-    _igvn._worklist.push(use);
+    _igvn.replace_input_of(use, j, n_clone);
     Node* use_c;
     if (!use->is_Phi()) {
       use_c = has_ctrl(use) ? get_ctrl(use) : use->in(0);
@@ -2028,8 +2004,7 @@
 #endif
     while( worklist.size() ) {
       Node *use = worklist.pop();
-      _igvn.hash_delete(use);
-      _igvn._worklist.push(use);
+      _igvn.rehash_node_delayed(use);
       for (uint j = 1; j < use->req(); j++) {
         if (use->in(j) == n) {
           use->set_req(j, n_clone);
@@ -2055,9 +2030,7 @@
     _igvn.remove_dead_node(phi);
     phi = hit;
   }
-  _igvn.hash_delete(use);
-  _igvn._worklist.push(use);
-  use->set_req(idx, phi);
+  _igvn.replace_input_of(use, idx, phi);
 }
 
 #ifdef ASSERT
@@ -2630,9 +2603,7 @@
               // use is in loop
               if (old_new[use->_idx] != NULL) { // null for dead code
                 Node* use_clone = old_new[use->_idx];
-                _igvn.hash_delete(use);
-                use->set_req(j, C->top());
-                _igvn._worklist.push(use);
+                _igvn.replace_input_of(use, j, C->top());
                 insert_phi_for_loop( use_clone, j, old_new[def->_idx], def, new_head_clone );
               }
             } else {
@@ -2667,46 +2638,35 @@
     if (!n->is_CFG()           && n->in(0) != NULL        &&
         not_peel.test(n->_idx) && peel.test(n->in(0)->_idx)) {
       Node* n_clone = old_new[n->_idx];
-      _igvn.hash_delete(n_clone);
-      n_clone->set_req(0, new_head_clone);
-      _igvn._worklist.push(n_clone);
+      _igvn.replace_input_of(n_clone, 0, new_head_clone);
     }
   }
 
   // Backedge of the surviving new_head (the clone) is original last_peel
-  _igvn.hash_delete(new_head_clone);
-  new_head_clone->set_req(LoopNode::LoopBackControl, last_peel);
-  _igvn._worklist.push(new_head_clone);
+  _igvn.replace_input_of(new_head_clone, LoopNode::LoopBackControl, last_peel);
 
   // Cut first node in original not_peel set
-  _igvn.hash_delete(new_head);
-  new_head->set_req(LoopNode::EntryControl, C->top());
-  new_head->set_req(LoopNode::LoopBackControl, C->top());
-  _igvn._worklist.push(new_head);
+  _igvn.rehash_node_delayed(new_head);                     // Multiple edge updates:
+  new_head->set_req(LoopNode::EntryControl,    C->top());  //   use rehash_node_delayed / set_req instead of
+  new_head->set_req(LoopNode::LoopBackControl, C->top());  //   multiple replace_input_of calls
 
   // Copy head_clone back-branch info to original head
   // and remove original head's loop entry and
   // clone head's back-branch
-  _igvn.hash_delete(head);
-  _igvn.hash_delete(head_clone);
-  head->set_req(LoopNode::EntryControl, head_clone->in(LoopNode::LoopBackControl));
+  _igvn.rehash_node_delayed(head); // Multiple edge updates
+  head->set_req(LoopNode::EntryControl,    head_clone->in(LoopNode::LoopBackControl));
   head->set_req(LoopNode::LoopBackControl, C->top());
-  head_clone->set_req(LoopNode::LoopBackControl, C->top());
-  _igvn._worklist.push(head);
-  _igvn._worklist.push(head_clone);
+  _igvn.replace_input_of(head_clone, LoopNode::LoopBackControl, C->top());
 
   // Similarly modify the phis
   for (DUIterator_Fast kmax, k = head->fast_outs(kmax); k < kmax; k++) {
     Node* use = head->fast_out(k);
     if (use->is_Phi() && use->outcnt() > 0) {
       Node* use_clone = old_new[use->_idx];
-      _igvn.hash_delete(use);
-      _igvn.hash_delete(use_clone);
-      use->set_req(LoopNode::EntryControl, use_clone->in(LoopNode::LoopBackControl));
+      _igvn.rehash_node_delayed(use); // Multiple edge updates
+      use->set_req(LoopNode::EntryControl,    use_clone->in(LoopNode::LoopBackControl));
       use->set_req(LoopNode::LoopBackControl, C->top());
-      use_clone->set_req(LoopNode::LoopBackControl, C->top());
-      _igvn._worklist.push(use);
-      _igvn._worklist.push(use_clone);
+      _igvn.replace_input_of(use_clone, LoopNode::LoopBackControl, C->top());
     }
   }
 
@@ -2792,8 +2752,7 @@
       set_ctrl(neg_stride, C->root());
       Node *post = new (C, 3) AddINode( opaq, neg_stride);
       register_new_node( post, u_ctrl );
-      _igvn.hash_delete(use);
-      _igvn._worklist.push(use);
+      _igvn.rehash_node_delayed(use);
       for (uint j = 1; j < use->req(); j++) {
         if (use->in(j) == phi)
           use->set_req(j, post);
--- a/hotspot/src/share/vm/opto/macro.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/macro.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1447,9 +1447,8 @@
   if (!always_slow && _memproj_fallthrough != NULL) {
     for (DUIterator_Fast imax, i = _memproj_fallthrough->fast_outs(imax); i < imax; i++) {
       Node *use = _memproj_fallthrough->fast_out(i);
-      _igvn.hash_delete(use);
+      _igvn.rehash_node_delayed(use);
       imax -= replace_input(use, _memproj_fallthrough, result_phi_rawmem);
-      _igvn._worklist.push(use);
       // back up iterator
       --i;
     }
@@ -1463,9 +1462,8 @@
     }
     for (DUIterator_Fast imax, i = _memproj_catchall->fast_outs(imax); i < imax; i++) {
       Node *use = _memproj_catchall->fast_out(i);
-      _igvn.hash_delete(use);
+      _igvn.rehash_node_delayed(use);
       imax -= replace_input(use, _memproj_catchall, _memproj_fallthrough);
-      _igvn._worklist.push(use);
       // back up iterator
       --i;
     }
@@ -1481,9 +1479,8 @@
   if (_ioproj_fallthrough != NULL) {
     for (DUIterator_Fast imax, i = _ioproj_fallthrough->fast_outs(imax); i < imax; i++) {
       Node *use = _ioproj_fallthrough->fast_out(i);
-      _igvn.hash_delete(use);
+      _igvn.rehash_node_delayed(use);
       imax -= replace_input(use, _ioproj_fallthrough, result_phi_i_o);
-      _igvn._worklist.push(use);
       // back up iterator
       --i;
     }
@@ -1497,9 +1494,8 @@
     }
     for (DUIterator_Fast imax, i = _ioproj_catchall->fast_outs(imax); i < imax; i++) {
       Node *use = _ioproj_catchall->fast_out(i);
-      _igvn.hash_delete(use);
+      _igvn.rehash_node_delayed(use);
       imax -= replace_input(use, _ioproj_catchall, _ioproj_fallthrough);
-      _igvn._worklist.push(use);
       // back up iterator
       --i;
     }
@@ -1857,18 +1853,16 @@
       if (alock->box_node() == oldbox && alock->obj_node()->eqv_uncast(obj)) {
         // Replace Box and mark eliminated all related locks and unlocks.
         alock->set_non_esc_obj();
-        _igvn.hash_delete(alock);
+        _igvn.rehash_node_delayed(alock);
         alock->set_box_node(newbox);
-        _igvn._worklist.push(alock);
         next_edge = false;
       }
     }
     if (u->is_FastLock() && u->as_FastLock()->obj_node()->eqv_uncast(obj)) {
       FastLockNode* flock = u->as_FastLock();
       assert(flock->box_node() == oldbox, "sanity");
-      _igvn.hash_delete(flock);
+      _igvn.rehash_node_delayed(flock);
       flock->set_box_node(newbox);
-      _igvn._worklist.push(flock);
       next_edge = false;
     }
 
@@ -1886,9 +1880,7 @@
           Node* box_node = sfn->monitor_box(jvms, idx);
           if (box_node == oldbox && obj_node->eqv_uncast(obj)) {
             int j = jvms->monitor_box_offset(idx);
-            _igvn.hash_delete(u);
-            u->set_req(j, newbox);
-            _igvn._worklist.push(u);
+            _igvn.replace_input_of(u, j, newbox);
             next_edge = false;
           }
         }
--- a/hotspot/src/share/vm/opto/memnode.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -717,6 +717,22 @@
         adr = adr->in(1);
         continue;
 
+      case Op_EncodeP:
+        // EncodeP node's control edge could be set by this method
+        // when EncodeP node depends on CastPP node.
+        //
+        // Use its control edge for memory op because EncodeP may go away
+        // later when it is folded with following or preceding DecodeN node.
+        if (adr->in(0) == NULL) {
+          // Keep looking for cast nodes.
+          adr = adr->in(1);
+          continue;
+        }
+        ccp->hash_delete(n);
+        n->set_req(MemNode::Control, adr->in(0));
+        ccp->hash_insert(n);
+        return n;
+
       case Op_CastPP:
         // If the CastPP is useless, just peek on through it.
         if( ccp->type(adr) == ccp->type(adr->in(1)) ) {
--- a/hotspot/src/share/vm/opto/memnode.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/memnode.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -636,17 +636,6 @@
   virtual bool depends_only_on_test() const { return true; }
 };
 
-//------------------------------LoadLLockedNode---------------------------------
-// Load-locked a pointer from memory (either object or array).
-// On Sparc & Intel this is implemented as a normal long load.
-class LoadLLockedNode : public LoadLNode {
-public:
-  LoadLLockedNode( Node *c, Node *mem, Node *adr )
-    : LoadLNode(c,mem,adr,TypeRawPtr::BOTTOM, TypeLong::LONG) {}
-  virtual int Opcode() const;
-  virtual int store_Opcode() const { return Op_StoreLConditional; }
-};
-
 //------------------------------SCMemProjNode---------------------------------------
 // This class defines a projection of the memory  state of a store conditional node.
 // These nodes return a value, but also update memory.
--- a/hotspot/src/share/vm/opto/parse.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/parse.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -527,6 +527,9 @@
   int     repush_if_args();
   void    adjust_map_after_if(BoolTest::mask btest, Node* c, float prob,
                               Block* path, Block* other_path);
+  void    sharpen_type_after_if(BoolTest::mask btest,
+                                Node* con, const Type* tcon,
+                                Node* val, const Type* tval);
   IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask);
   Node*   jump_if_join(Node* iffalse, Node* iftrue);
   void    jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, int prof_table_index);
--- a/hotspot/src/share/vm/opto/parse2.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -1233,6 +1233,71 @@
   if (!have_con)                        // remaining adjustments need a con
     return;
 
+  sharpen_type_after_if(btest, con, tcon, val, tval);
+}
+
+
+static Node* extract_obj_from_klass_load(PhaseGVN* gvn, Node* n) {
+  Node* ldk;
+  if (n->is_DecodeN()) {
+    if (n->in(1)->Opcode() != Op_LoadNKlass) {
+      return NULL;
+    } else {
+      ldk = n->in(1);
+    }
+  } else if (n->Opcode() != Op_LoadKlass) {
+    return NULL;
+  } else {
+    ldk = n;
+  }
+  assert(ldk != NULL && ldk->is_Load(), "should have found a LoadKlass or LoadNKlass node");
+
+  Node* adr = ldk->in(MemNode::Address);
+  intptr_t off = 0;
+  Node* obj = AddPNode::Ideal_base_and_offset(adr, gvn, off);
+  if (obj == NULL || off != oopDesc::klass_offset_in_bytes()) // loading oopDesc::_klass?
+    return NULL;
+  const TypePtr* tp = gvn->type(obj)->is_ptr();
+  if (tp == NULL || !(tp->isa_instptr() || tp->isa_aryptr())) // is obj a Java object ptr?
+    return NULL;
+
+  return obj;
+}
+
+void Parse::sharpen_type_after_if(BoolTest::mask btest,
+                                  Node* con, const Type* tcon,
+                                  Node* val, const Type* tval) {
+  // Look for opportunities to sharpen the type of a node
+  // whose klass is compared with a constant klass.
+  if (btest == BoolTest::eq && tcon->isa_klassptr()) {
+    Node* obj = extract_obj_from_klass_load(&_gvn, val);
+    const TypeOopPtr* con_type = tcon->isa_klassptr()->as_instance_type();
+    if (obj != NULL && (con_type->isa_instptr() || con_type->isa_aryptr())) {
+       // Found:
+       //   Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq])
+       // or the narrowOop equivalent.
+       const Type* obj_type = _gvn.type(obj);
+       const TypeOopPtr* tboth = obj_type->join(con_type)->isa_oopptr();
+       if (tboth != NULL && tboth != obj_type && tboth->higher_equal(obj_type)) {
+          // obj has to be of the exact type Foo if the CmpP succeeds.
+          assert(tboth->klass_is_exact(), "klass should be exact");
+          int obj_in_map = map()->find_edge(obj);
+          JVMState* jvms = this->jvms();
+          if (obj_in_map >= 0 &&
+              (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) {
+            TypeNode* ccast = new (C, 2) CheckCastPPNode(control(), obj, tboth);
+            const Type* tcc = ccast->as_Type()->type();
+            assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve");
+            // Delay transform() call to allow recovery of pre-cast value
+            // at the control merge.
+            _gvn.set_type_bottom(ccast);
+            record_for_igvn(ccast);
+            // Here's the payoff.
+            replace_in_map(obj, ccast);
+          }
+       }
+    }
+  }
 
   int val_in_map = map()->find_edge(val);
   if (val_in_map < 0)  return;          // replace_in_map would be useless
@@ -1265,6 +1330,7 @@
         // Exclude tests vs float/double 0 as these could be
         // either +0 or -0.  Just because you are equal to +0
         // doesn't mean you ARE +0!
+        // Note, following code also replaces Long and Oop values.
         if ((!tf || tf->_f != 0.0) &&
             (!td || td->_d != 0.0))
           cast = con;                   // Replace non-constant val by con.
--- a/hotspot/src/share/vm/opto/phaseX.hpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/phaseX.hpp	Sun Jun 17 22:07:44 2012 -0700
@@ -460,6 +460,25 @@
     subsume_node(old, nn);
   }
 
+  // Delayed node rehash: remove a node from the hash table and rehash it during
+  // next optimizing pass
+  void rehash_node_delayed(Node* n) {
+    hash_delete(n);
+    _worklist.push(n);
+  }
+
+  // Replace ith edge of "n" with "in"
+  void replace_input_of(Node* n, int i, Node* in) {
+    rehash_node_delayed(n);
+    n->set_req(i, in);
+  }
+
+  // Delete ith edge of "n"
+  void delete_input_of(Node* n, int i) {
+    rehash_node_delayed(n);
+    n->del_req(i);
+  }
+
   bool delay_transform() const { return _delay_transform; }
 
   void set_delay_transform(bool delay) {
--- a/hotspot/src/share/vm/opto/split_if.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/split_if.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -137,9 +137,7 @@
             Node *iff_ctrl = iff->is_If() ? iff->in(0) : get_ctrl(iff);
             Node *x = bol->clone();
             register_new_node(x, iff_ctrl);
-            _igvn.hash_delete(iff);
-            iff->set_req(1, x);
-            _igvn._worklist.push(iff);
+            _igvn.replace_input_of(iff, 1, x);
           }
           _igvn.remove_dead_node( bol );
           --i;
@@ -151,9 +149,7 @@
         assert( bol->in(1) == n, "" );
         Node *x = n->clone();
         register_new_node(x, get_ctrl(bol));
-        _igvn.hash_delete(bol);
-        bol->set_req(1, x);
-        _igvn._worklist.push(bol);
+        _igvn.replace_input_of(bol, 1, x);
       }
       _igvn.remove_dead_node( n );
 
@@ -387,9 +383,7 @@
     if( use->in(i) == def )
       break;
   assert( i < use->req(), "def should be among use's inputs" );
-  _igvn.hash_delete(use);
-  use->set_req(i, new_def);
-  _igvn._worklist.push(use);
+  _igvn.replace_input_of(use, i, new_def);
 }
 
 //------------------------------do_split_if------------------------------------
--- a/hotspot/src/share/vm/opto/subnode.cpp	Thu Jun 14 16:34:43 2012 -0700
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Sun Jun 17 22:07:44 2012 -0700
@@ -702,12 +702,84 @@
     return TypeInt::CC;
 }
 
+static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
+  // Return the klass node for
+  //   LoadP(AddP(foo:Klass, #java_mirror))
+  //   or NULL if not matching.
+  if (n->Opcode() != Op_LoadP) return NULL;
+
+  const TypeInstPtr* tp = phase->type(n)->isa_instptr();
+  if (!tp || tp->klass() != phase->C->env()->Class_klass()) return NULL;
+
+  Node* adr = n->in(MemNode::Address);
+  intptr_t off = 0;
+  Node* k = AddPNode::Ideal_base_and_offset(adr, phase, off);
+  if (k == NULL)  return NULL;
+  const TypeKlassPtr* tkp = phase->type(k)->isa_klassptr();
+  if (!tkp || off != in_bytes(Klass::java_mirror_offset())) return NULL;
+
+  // We've found the klass node of a Java mirror load.
+  return k;
+}
+
+static inline Node* isa_const_java_mirror(PhaseGVN* phase, Node* n) {
+  // for ConP(Foo.class) return ConP(Foo.klass)
+  // otherwise return NULL
+  if (!n->is_Con()) return NULL;
+
+  const TypeInstPtr* tp = phase->type(n)->isa_instptr();
+  if (!tp) return NULL;
+
+  ciType* mirror_type = tp->java_mirror_type();
+  // TypeInstPtr::java_mirror_type() returns non-NULL for compile-
+  // time Class constants only.
+  if (!mirror_type) return NULL;
+
+  // x.getClass() == int.class can never be true (for all primitive types)
+  // Return a ConP(NULL) node for this case.
+  if (mirror_type->is_classless()) {
+    return phase->makecon(TypePtr::NULL_PTR);
+  }
+
+  // return the ConP(Foo.klass)
+  assert(mirror_type->is_klass(), "mirror_type should represent a klassOop");
+  return phase->makecon(TypeKlassPtr::make(mirror_type->as_klass()));
+}
+
 //------------------------------Ideal------------------------------------------
-// Check for the case of comparing an unknown klass loaded from the primary
+// Normalize comparisons between Java mirror loads to compare the klass instead.
+//
+// Also check for the case of comparing an unknown klass loaded from the primary
 // super-type array vs a known klass with no subtypes.  This amounts to
 // checking to see an unknown klass subtypes a known klass with no subtypes;
 // this only happens on an exact match.  We can shorten this test by 1 load.
 Node *CmpPNode::Ideal( PhaseGVN *phase, bool can_reshape ) {
+  // Normalize comparisons between Java mirrors into comparisons of the low-
+  // level klass, where a dependent load could be shortened.
+  //
+  // The new pattern has a nice effect of matching the same pattern used in the
+  // fast path of instanceof/checkcast/Class.isInstance(), which allows
+  // redundant exact type check be optimized away by GVN.
+  // For example, in