Merge
authorohair
Fri, 08 Jun 2012 17:28:54 -0700
changeset 12803 f77d684825bb
parent 12802 cd7cb0396d1f (current diff)
parent 12801 948f8ad66ee7 (diff)
child 12804 5d9bc9df9263
Merge
--- a/.hgtags	Fri Jun 08 17:25:46 2012 -0700
+++ b/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38
 35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39
 6e4e654931b976304bf6e7b4d0d6db8f75bac5d9 jdk8-b40
+c029c972396cea042a0dc67c0f7ccf2fe68007d4 jdk8-b41
--- a/.hgtags-top-repo	Fri Jun 08 17:25:46 2012 -0700
+++ b/.hgtags-top-repo	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38
 8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39
 a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40
+1a8c7c530f8a9b7f5bdb9b0693b2f5435ca5205e jdk8-b41
--- a/README-builds.html	Fri Jun 08 17:25:46 2012 -0700
+++ b/README-builds.html	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/autogen.sh	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/builddeps.m4	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/configure	Fri Jun 08 17:28:54 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,12 +3171,7 @@
 # questions.
 #
 
-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=
-
+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.
@@ -3197,11 +3214,18 @@
   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=
 
     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,9 +15357,24 @@
 # 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"
-fi
+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 ' '`"
+
 
 
 
@@ -15092,6 +15383,13 @@
 # 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/configure.ac	Fri Jun 08 17:28:54 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)
+
+# 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
+}
 
-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"
+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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/help.m4	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/platform.m4	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/autoconf/spec.gmk.in	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/bin/compareimage.sh	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/bin/diffexec.sh	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/bin/diffjarzip.sh	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/bin/difflib.sh	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/bin/logger.sh	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/makefiles/JavaCompilation.gmk	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/makefiles/MakeBase.gmk	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/makefiles/Makefile	Fri Jun 08 17:28:54 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
+
+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)))
 
-# 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 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
 
-ifeq ($(words $(SPEC)),0)
-    $(error You must run configure!)
+        # 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))
 
-all: jdk
-	@$(call StopTimer)
-	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+# 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
 
-langtools: start-timer
+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
+	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
+	@$(call AtRootMakeEnd)
+
+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)
+
+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)
 
-start-timer:
-	@$(call StartTimer)
+start-make:
+	@$(call AtRootMakeStart)
+
+.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-make
 
-.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-timer
+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	Fri Jun 08 17:25:46 2012 -0700
+++ b/common/makefiles/NativeCompilation.gmk	Fri Jun 08 17:28:54 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	Fri Jun 08 17:25:46 2012 -0700
+++ b/corba/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
 785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39
 56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40
+113f0d5f0a08aa0947b3edf783b603e7f042748a jdk8-b41
--- a/hotspot/.hgtags	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -250,3 +250,5 @@
 14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11
 ff9decc8235d5af80ea45fda4ecbe643ea252564 jdk8-b40
 785573170238f0eae6dc8e22ecf1050fbc9ea055 hs24-b12
+37add4fa0296705f67481e1fd50e2900cd25e39b jdk8-b41
+bd568544be7fcd12a9327e6c448592198d57b043 hs24-b13
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java	Fri Jun 08 17:28:54 2012 -0700
@@ -81,6 +81,7 @@
   // field flags
   public boolean fieldAccessWatched () { return (flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
   public boolean fieldModificationWatched() { return (flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
+  public boolean fieldHasGenericSignature() { return (flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE)!= 0; }
 
   public void printOn(PrintStream tty) {
     // prints only .class flags and not the hotspot internal flags
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Fri Jun 08 17:28:54 2012 -0700
@@ -50,7 +50,6 @@
   private static int INITVAL_INDEX_OFFSET;
   private static int LOW_OFFSET;
   private static int HIGH_OFFSET;
-  private static int GENERIC_SIGNATURE_INDEX_OFFSET;
   private static int FIELD_SLOTS;
 
   // ClassState constants
@@ -99,7 +98,6 @@
     INITVAL_INDEX_OFFSET           = db.lookupIntConstant("FieldInfo::initval_index_offset").intValue();
     LOW_OFFSET                     = db.lookupIntConstant("FieldInfo::low_offset").intValue();
     HIGH_OFFSET                    = db.lookupIntConstant("FieldInfo::high_offset").intValue();
-    GENERIC_SIGNATURE_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::generic_signature_offset").intValue();
     FIELD_SLOTS                    = db.lookupIntConstant("FieldInfo::field_slots").intValue();
     // read ClassState constants
     CLASS_STATE_UNPARSABLE_BY_GC = db.lookupIntConstant("instanceKlass::unparsable_by_gc").intValue();
@@ -279,7 +277,25 @@
   }
 
   public short getFieldGenericSignatureIndex(int index) {
-    return getFields().getShortAt(index * FIELD_SLOTS + GENERIC_SIGNATURE_INDEX_OFFSET);
+    int len = (int)getFields().getLength();
+    int allFieldsCount = getAllFieldsCount();
+    int generic_signature_slot = allFieldsCount * FIELD_SLOTS;
+    for (int i = 0; i < allFieldsCount; i++) {
+      short flags = getFieldAccessFlags(i);
+      AccessFlags access = new AccessFlags(flags);
+      if (i == index) {
+        if (access.fieldHasGenericSignature()) {
+          return getFields().getShortAt(generic_signature_slot);
+        } else {
+          return 0;
+        }
+      } else {
+        if (access.fieldHasGenericSignature()) {
+          generic_signature_slot ++;
+        }
+      }
+    }
+    return 0;
   }
 
   public Symbol getFieldGenericSignature(int index) {
@@ -309,7 +325,18 @@
   public ObjArray  getTransitiveInterfaces() { return (ObjArray)     transitiveInterfaces.getValue(this); }
   public TypeArray getFields()              { return (TypeArray)    fields.getValue(this); }
   public int       getJavaFieldsCount()     { return                (int) javaFieldsCount.getValue(this); }
-  public int       getAllFieldsCount()      { return                (int)getFields().getLength() / FIELD_SLOTS; }
+  public int       getAllFieldsCount()      {
+    int len = (int)getFields().getLength();
+    int allFieldsCount = 0;
+    for (; allFieldsCount*FIELD_SLOTS < len; allFieldsCount++) {
+      short flags = getFieldAccessFlags(allFieldsCount);
+      AccessFlags access = new AccessFlags(flags);
+      if (access.fieldHasGenericSignature()) {
+        len --;
+      }
+    }
+    return allFieldsCount;
+  }
   public ConstantPool getConstants()        { return (ConstantPool) constants.getValue(this); }
   public Oop       getClassLoader()         { return                classLoader.getValue(this); }
   public Oop       getProtectionDomain()    { return                protectionDomain.getValue(this); }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Fri Jun 08 17:28:54 2012 -0700
@@ -153,6 +153,8 @@
     public static final long JVM_ACC_FIELD_ACCESS_WATCHED         = 0x00002000;
     // field modification is watched by JVMTI
     public static final long JVM_ACC_FIELD_MODIFICATION_WATCHED   = 0x00008000;
+    // field has generic signature
+    public static final long JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE  = 0x00000800;
 
     // flags accepted by set_field_flags
     public static final long JVM_ACC_FIELD_FLAGS = 0x00008000 | JVM_ACC_WRITTEN_FLAGS;
--- a/hotspot/make/hotspot_version	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/hotspot_version	Fri Jun 08 17:28:54 2012 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=24
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=12
+HS_BUILD_NUMBER=13
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/make/jprt.properties	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/jprt.properties	Fri Jun 08 17:28:54 2012 -0700
@@ -133,7 +133,8 @@
     ${jprt.my.linux.x64}-{product|fastdebug}, \
     ${jprt.my.macosx.x64}-{product|fastdebug|debug}, \
     ${jprt.my.windows.i586}-{product|fastdebug|debug}, \
-    ${jprt.my.windows.x64}-{product|fastdebug|debug}
+    ${jprt.my.windows.x64}-{product|fastdebug|debug}, \
+    ${jprt.my.linux.armvfp}-{product|fastdebug}
 
 jprt.build.targets.open= \
     ${jprt.my.solaris.i586}-{productOpen}, \
--- a/hotspot/make/solaris/makefiles/defs.make	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/solaris/makefiles/defs.make	Fri Jun 08 17:28:54 2012 -0700
@@ -123,25 +123,10 @@
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
     # Default OBJCOPY comes from the SUNWbinutils package:
     DEF_OBJCOPY=/usr/sfw/bin/gobjcopy
-    ifeq ($(VM_PLATFORM),solaris_amd64)
-      # On Solaris AMD64/X64, gobjcopy is not happy and fails:
-      #
-      # usr/sfw/bin/gobjcopy --add-gnu-debuglink=<lib>.debuginfo <lib>.so
-      # BFD: stKPaiop: Not enough room for program headers, try linking with -N
-      # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
-      # BFD: stKPaiop: Not enough room for program headers, try linking with -N
-      # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value
-      # BFD: stKPaiop: Not enough room for program headers, try linking with -N
-      # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
-      _JUNK_ := $(shell \
-        echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64")
-      OBJCOPY=
-    else
-      OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
-      ifneq ($(ALT_OBJCOPY),)
-        _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
-        OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
-      endif
+    OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
+    ifneq ($(ALT_OBJCOPY),)
+      _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
+      OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
     endif
   else
     OBJCOPY=
--- a/hotspot/make/solaris/makefiles/dtrace.make	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/solaris/makefiles/dtrace.make	Fri Jun 08 17:28:54 2012 -0700
@@ -108,15 +108,24 @@
 XLIBJVM_DTRACE_G_DEBUGINFO = 64/$(LIBJVM_DTRACE_G_DEBUGINFO)
 XLIBJVM_DTRACE_G_DIZ       = 64/$(LIBJVM_DTRACE_G_DIZ)
 
-$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
+$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) mkdir -p 64/ ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 	[ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DB_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -133,15 +142,19 @@
   endif
 endif
 
-$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) mkdir -p 64/ ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 	[ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DTRACE_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -198,14 +211,18 @@
 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
 	$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
 
-$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
+$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 	[ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -222,14 +239,18 @@
   endif
 endif
 
-$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 	[ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make	Fri Jun 08 17:28:54 2012 -0700
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#  
+#
+
+# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris
+
+GENERATED                       = ../generated
+FIX_EMPTY_SEC_HDR_FLAGS         = $(GENERATED)/fix_empty_sec_hdr_flags
+
+FIX_EMPTY_SEC_HDR_FLAGS_DIR     = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags
+FIX_EMPTY_SEC_HDR_FLAGS_SRC     = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c
+FIX_EMPTY_SEC_HDR_FLAGS_FLAGS   = 
+LIBS_FIX_EMPTY_SEC_HDR_FLAGS   += -lelf
+
+ifeq ("${Platform_compiler}", "sparcWorks")
+# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to
+# compare the built ELF objects.
+#
+# The -g option makes static data global and the "-W0,-noglobal"
+# option tells the compiler to not globalize static data using a unique
+# globalization prefix. Instead force the use of a static globalization
+# prefix based on the source filepath so the objects from two identical
+# compilations are the same.
+#
+# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
+#       seem to work. I got "-W0,-noglobal" from Kelly and that works.
+#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal
+endif # Platform_compiler == sparcWorks
+
+$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC)
+	$(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
--- a/hotspot/make/solaris/makefiles/jsig.make	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/solaris/makefiles/jsig.make	Fri Jun 08 17:28:54 2012 -0700
@@ -52,14 +52,23 @@
 LFLAGS_JSIG += -mt -xnolib
 endif
 
-$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
+$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
-                         $(LFLAGS_JSIG) -o $@ $< -ldl
+                         $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
 	[ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
--- a/hotspot/make/solaris/makefiles/saproc.make	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/solaris/makefiles/saproc.make	Fri Jun 08 17:28:54 2012 -0700
@@ -90,7 +90,7 @@
 # when actually building on Nevada-B158 or earlier:
 #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
 
-$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
+$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
 	  exit 1; \
@@ -109,8 +109,17 @@
 	           -ldl -ldemangle -lthread -lc
 	[ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
--- a/hotspot/make/solaris/makefiles/vm.make	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/solaris/makefiles/vm.make	Fri Jun 08 17:28:54 2012 -0700
@@ -149,6 +149,10 @@
 include $(MAKEFILES_DIR)/add_gnu_debuglink.make
 
 #----------------------------------------------------------------------
+# fix_empty_sec_hdr_flags tool
+include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make
+
+#----------------------------------------------------------------------
 # JVM
 
 JVM      = jvm
@@ -280,7 +284,7 @@
 LINK_VM = $(LINK_LIB.CXX)
 endif
 # making the library:
-$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(LIBJVM.o) $(LIBJVM_MAPFILE) 
+$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) 
 ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
 	@echo Linking vm...
 	$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
@@ -290,10 +294,15 @@
 	$(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
 	$(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts the SUNW_dof section
-# in libjvm.so. Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY)
-# is available.
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
 #	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
 	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
--- a/hotspot/make/windows/makefiles/defs.make	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/make/windows/makefiles/defs.make	Fri Jun 08 17:28:54 2012 -0700
@@ -143,14 +143,7 @@
 MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)
 
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  # Disable ZIP_DEBUGINFO_FILES by default because various tests are
-  # failing in nightly when the debug info files are ZIP'ed.
-  #ZIP_DEBUGINFO_FILES ?= 0
-  # The above conditional setting logic is unreliable on Windows for
-  # unknown reasons. We force ZIP_DEBUGINFO_FILES to be disabled on
-  # Windows until we figure out why the various tests are failing
-  # AND why the conditional setting logic is unreliable.
-  ZIP_DEBUGINFO_FILES=0
+  ZIP_DEBUGINFO_FILES ?= 1
 else
   ZIP_DEBUGINFO_FILES=0
 endif
--- a/hotspot/src/os/bsd/vm/osThread_bsd.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os/bsd/vm/osThread_bsd.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -42,26 +42,19 @@
 #ifdef _ALLBSD_SOURCE
 
 #ifdef __APPLE__
-  thread_t  _thread_id;
+  typedef thread_t thread_id_t;
 #else
-  pthread_t _thread_id;
+  typedef pthread_t thread_id_t;
+#endif
+
+#else
+  typedef pid_t thread_id_t;
 #endif
 
   // _pthread_id is the pthread id, which is used by library calls
   // (e.g. pthread_kill).
   pthread_t _pthread_id;
 
-#else
-  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
-  // thread has a unique thread_id (BsdThreads or NPTL). It can be used
-  // to access /proc.
-  pid_t     _thread_id;
-
-  // _pthread_id is the pthread id, which is used by library calls
-  // (e.g. pthread_kill).
-  pthread_t _pthread_id;
-#endif
-
   sigset_t _caller_sigmask; // Caller's signal mask
 
  public:
@@ -70,28 +63,11 @@
   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
 
-#ifdef _ALLBSD_SOURCE
-#ifdef __APPLE__
-  static size_t thread_id_size()         { return sizeof(thread_t); }
-  thread_t thread_id() const {
-    return _thread_id;
-  }
-#else
-  static size_t thread_id_size()         { return sizeof(pthread_t); }
-  pthread_t thread_id() const {
-    return _thread_id;
-  }
-#endif
-#else
-  static size_t thread_id_size()         { return sizeof(pid_t); }
-  pid_t thread_id() const {
-    return _thread_id;
-  }
-#endif
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
   intptr_t thread_identifier() const   { return (intptr_t)_pthread_id; }
 #endif
+
 #ifdef ASSERT
   // We expect no reposition failures so kill vm if we get one.
   //
@@ -99,21 +75,7 @@
     return false;
   }
 #endif // ASSERT
-#ifdef _ALLBSD_SOURCE
-#ifdef __APPLE__
-  void set_thread_id(thread_t id) {
-    _thread_id = id;
-  }
-#else
-  void set_thread_id(pthread_t id) {
-    _thread_id = id;
-  }
-#endif
-#else
-  void set_thread_id(pid_t id) {
-    _thread_id = id;
-  }
-#endif
+
   pthread_t pthread_id() const {
     return _pthread_id;
   }
--- a/hotspot/src/os/linux/vm/osThread_linux.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os/linux/vm/osThread_linux.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -24,6 +24,8 @@
 
 #ifndef OS_LINUX_VM_OSTHREAD_LINUX_HPP
 #define OS_LINUX_VM_OSTHREAD_LINUX_HPP
+ public:
+  typedef pid_t thread_id_t;
 
  private:
   int _thread_type;
@@ -37,13 +39,6 @@
     _thread_type = type;
   }
 
- private:
-
-  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
-  // thread has a unique thread_id (LinuxThreads or NPTL). It can be used
-  // to access /proc.
-  pid_t     _thread_id;
-
   // _pthread_id is the pthread id, which is used by library calls
   // (e.g. pthread_kill).
   pthread_t _pthread_id;
@@ -56,11 +51,6 @@
   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
 
-  static size_t thread_id_size()         { return sizeof(pid_t); }
-
-  pid_t thread_id() const {
-    return _thread_id;
-  }
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
   int thread_identifier() const   { return _thread_id; }
@@ -72,9 +62,6 @@
     return false;
   }
 #endif // ASSERT
-  void set_thread_id(pid_t id) {
-    _thread_id = id;
-  }
   pthread_t pthread_id() const {
     return _pthread_id;
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c	Fri Jun 08 17:28:54 2012 -0700
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * Name:        fix_empty_sec_hdr_flags.c
+ *
+ * Description: Remove the SHF_ALLOC flag from "empty" section headers.
+ *     An "empty" section header has sh_addr == 0 and sh_size == 0.
+ *
+ *     This program is adapted from the example program shown on the
+ *     elf(3elf) man page and from code from the Solaris compiler
+ *     driver.
+ */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <libelf.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void failure(void);
+
+void
+main(int argc, char ** argv) {
+    void *        ehdr;           /* ELF header */
+    unsigned int  i;              /* section counter */
+    int           fd;             /* descriptor for file */
+    Elf *         elf;            /* ELF descriptor */
+    char *        elf_ident;      /* ELF identity string */
+    char *        elf_obj;        /* elf_obj file */
+    int           fix_count;      /* number of flags fixed */
+    int           is_elfclass64;  /* is an ELFCLASS64 file? */
+    Elf_Scn *     scn;            /* ELF section descriptor */
+    void *        shdr;           /* ELF section header */
+    Elf_Data *    shstrtab;       /* ELF section header string table */
+
+    if (argc != 2) {
+        (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
+        exit(2);
+    }
+
+    /* open the elf_obj */
+    elf_obj = argv[1];
+    if ((fd = open(elf_obj, O_RDWR)) == -1) {
+        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
+        exit(3);
+    }
+
+    (void) printf("Opening '%s' for update\n", elf_obj);
+    (void) fflush(stdout);
+    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
+
+    /* obtain the ELF descriptors from the input file */
+    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
+        failure();
+    }
+
+    /* determine if ELFCLASS64 or not? */
+    elf_ident = elf_getident(elf, NULL);
+    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
+
+    /* get the ELF header */
+    if (is_elfclass64) {
+        ehdr = elf64_getehdr(elf);
+    } else {
+        ehdr = elf32_getehdr(elf);
+    }
+    if (ehdr == NULL) {
+        failure();
+    }
+
+    /* get the ELF section descriptor */
+    if (is_elfclass64) {
+        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
+    } else {
+        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
+    }
+    if (scn == NULL) {
+        failure();
+    }
+
+    /* get the section header string table */
+    shstrtab = elf_getdata(scn, NULL);
+    if (shstrtab == NULL) {
+        failure();
+    }
+
+    fix_count = 0;
+
+    /* traverse the sections of the input file */
+    for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
+        int    has_flag_set;  /* is SHF_ALLOC flag set? */
+        int    is_empty;      /* is section empty? */
+        char * name;          /* short hand pointer */
+
+        /* get the section header */
+        if (is_elfclass64) {
+            shdr = elf64_getshdr(scn);
+        } else {
+            shdr = elf32_getshdr(scn);
+        }
+        if (shdr == NULL) {
+            failure();
+        }
+
+        if (is_elfclass64) {
+            name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
+        } else {
+            name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
+        }
+
+        if (is_elfclass64) {
+            has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
+            is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
+                ((Elf64_Shdr *) shdr)->sh_size == 0;
+        } else {
+            has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
+            is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
+                ((Elf32_Shdr *) shdr)->sh_size == 0;
+        }
+
+        if (is_empty && has_flag_set) {
+            (void) printf("section[%u] '%s' is empty, "
+                "but SHF_ALLOC flag is set.\n", i, name);
+            (void) printf("Clearing the SHF_ALLOC flag.\n");
+
+            if (is_elfclass64) {
+                ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
+            } else {
+                ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
+            }
+            fix_count++;
+        }
+    }  /* end for each ELF section */
+
+    if (fix_count > 0) {
+        (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
+        (void) fflush(stdout);
+        (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
+        (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
+    } else {
+        (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
+    }
+
+    (void) elf_end(elf);                  /* done with ELF obj */
+    (void) close(fd);
+
+    (void) printf("Done %s '%s'\n",
+               (fix_count > 0) ? "updating" : "with", elf_obj);
+    (void) fflush(stdout);
+    exit(0);
+}  /* end main */
+
+
+static void
+failure() {
+    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
+    exit(6);
+}
--- a/hotspot/src/os/solaris/vm/osThread_solaris.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os/solaris/vm/osThread_solaris.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -26,9 +26,10 @@
 #define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
 
 // This is embedded via include into the class OSThread
+ public:
+  typedef thread_t thread_id_t;
 
  private:
-  thread_t _thread_id;         // Solaris thread id
   uint     _lwp_id;            // lwp ID, only used with bound threads
   int      _native_priority;   // Saved native priority when starting
                                // a bound thread
@@ -36,8 +37,6 @@
   bool     _vm_created_thread; // true if the VM created this thread,
                                // false if primary thread or attached thread
  public:
-  static size_t thread_id_size()   { return sizeof(thread_t); }
-  thread_t thread_id() const       { return _thread_id; }
   uint     lwp_id() const          { return _lwp_id; }
   int      native_priority() const { return _native_priority; }
 
@@ -63,7 +62,6 @@
     return true;
   }
 #endif
-  void set_thread_id(thread_t id)    { _thread_id = id; }
   void set_lwp_id(uint id)           { _lwp_id = id; }
   void set_native_priority(int prio) { _native_priority = prio; }
 
--- a/hotspot/src/os/windows/vm/osThread_windows.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os/windows/vm/osThread_windows.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -25,12 +25,13 @@
 #ifndef OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
 #define OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
 
-typedef void* HANDLE;
+  typedef void* HANDLE;
+ public:
+  typedef unsigned long thread_id_t;
 
  private:
   // Win32-specific thread information
   HANDLE _thread_handle;        // Win32 thread handle
-  unsigned long _thread_id;     // Win32 thread id
   HANDLE _interrupt_event;      // Event signalled on thread interrupt
   ThreadState _last_state;
 
@@ -42,9 +43,6 @@
   HANDLE interrupt_event() const                   { return _interrupt_event; }
   void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; }
 
-
-  static size_t thread_id_size()                   { return sizeof(unsigned long); }
-  unsigned long thread_id() const                  { return _thread_id; }
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
   int thread_identifier() const                    { return _thread_id; }
@@ -56,8 +54,6 @@
     return false;
   }
 #endif // ASSERT
-  void set_thread_id(unsigned long thread_id)      { _thread_id = thread_id; }
-
   bool is_try_mutex_enter()                        { return false; }
 
   // This is a temporary fix for the thread states during
--- a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -29,18 +29,12 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#ifdef __APPLE__
-#define OS_THREAD_ID_TYPE thread_t
-#else
-#define OS_THREAD_ID_TYPE pthread_t
-#endif
-
 #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
-  nonstatic_field(OSThread,                      _thread_id,                                      OS_THREAD_ID_TYPE)                 \
+  nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
   nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)                         \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -52,7 +46,7 @@
   /* Posix Thread IDs   */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(thread_t)                                 \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
   declare_unsigned_integer_type(pthread_t)                                \
                                                                           \
   /* This must be the last entry, and must be present */                  \
--- a/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -36,7 +36,7 @@
   /******************************/                                                                                                   \
                                                                                                                                      \
   nonstatic_field(JavaThread,                  _base_of_stack_pointer,                        intptr_t*)                             \
-  nonstatic_field(OSThread,                    _thread_id,                                    pid_t)                                 \
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
   nonstatic_field(OSThread,                    _pthread_id,                                   pthread_t)                             \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -48,7 +48,7 @@
   /* POSIX Thread IDs */                                                  \
   /**********************/                                                \
                                                                           \
-  declare_integer_type(pid_t)                                             \
+  declare_integer_type(OSThread::thread_id_t)                             \
   declare_unsigned_integer_type(pthread_t)                                \
                                                                           \
   /* This must be the last entry, and must be present */                  \
--- a/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -34,7 +34,7 @@
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
-  nonstatic_field(OSThread,                      _thread_id,                                      pid_t)                             \
+  nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
   nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)                         \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -46,7 +46,7 @@
   /* Posix Thread IDs   */                                                \
   /**********************/                                                \
                                                                           \
-  declare_integer_type(pid_t)                                             \
+  declare_integer_type(OSThread::thread_id_t)                             \
   declare_unsigned_integer_type(pthread_t)                                \
                                                                           \
   /* This must be the last entry, and must be present */                  \
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -36,7 +36,7 @@
   /******************************/                                                                                                   \
                                                                                                                                      \
   nonstatic_field(JavaThread,                  _base_of_stack_pointer,                        intptr_t*)                             \
-  nonstatic_field(OSThread,                    _thread_id,                                    thread_t)                              \
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
 
@@ -47,7 +47,7 @@
   /* Solaris Thread IDs */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(thread_t)                                 \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
                                                                           \
   /* This must be the last entry, and must be present */                  \
   last_entry()
--- a/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -35,7 +35,7 @@
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
-  nonstatic_field(OSThread,                      _thread_id,                                    thread_t)                              \
+  nonstatic_field(OSThread,                      _thread_id,                                    OSThread::thread_id_t)               \
                                                                                                                                      \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -46,7 +46,7 @@
   /* Solaris Thread IDs */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(thread_t)                                 \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
                                                                           \
   /* This must be the last entry, and must be present */                  \
   last_entry()
--- a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -35,7 +35,7 @@
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
-  nonstatic_field(OSThread,                    _thread_id,                                    unsigned long)                         \
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
   unchecked_nonstatic_field(OSThread,          _thread_handle,                                sizeof(HANDLE)) /* NOTE: no type */    \
                                                                                                                                      \
   /* This must be the last entry, and must be present */                                                                             \
@@ -43,6 +43,7 @@
 
 #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
                                                                           \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
   /* This must be the last entry, and must be present */                  \
   last_entry()
 
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1082,12 +1082,36 @@
 
   int num_injected = 0;
   InjectedField* injected = JavaClasses::get_injected(class_name, &num_injected);
-
-  // Tuples of shorts [access, name index, sig index, initial value index, byte offset, generic signature index]
-  typeArrayOop new_fields = oopFactory::new_permanent_shortArray((length + num_injected) * FieldInfo::field_slots, CHECK_(nullHandle));
-  typeArrayHandle fields(THREAD, new_fields);
+  int total_fields = length + num_injected;
+
+  // The field array starts with tuples of shorts
+  // [access, name index, sig index, initial value index, byte offset].
+  // A generic signature slot only exists for field with generic
+  // signature attribute. And the access flag is set with
+  // JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE for that field. The generic
+  // signature slots are at the end of the field array and after all
+  // other fields data.
+  //
+  //   f1: [access, name index, sig index, initial value index, low_offset, high_offset]
+  //   f2: [access, name index, sig index, initial value index, low_offset, high_offset]
+  //       ...
+  //   fn: [access, name index, sig index, initial value index, low_offset, high_offset]
+  //       [generic signature index]
+  //       [generic signature index]
+  //       ...
+  //
+  // Allocate a temporary resource array for field data. For each field,
+  // a slot is reserved in the temporary array for the generic signature
+  // index. After parsing all fields, the data are copied to a permanent
+  // array and any unused slots will be discarded.
+  ResourceMark rm(THREAD);
+  u2* fa = NEW_RESOURCE_ARRAY_IN_THREAD(
+             THREAD, u2, total_fields * (FieldInfo::field_slots + 1));
 
   typeArrayHandle field_annotations;
+  // The generic signature slots start after all other fields' data.
+  int generic_signature_slot = total_fields * FieldInfo::field_slots;
+  int num_generic_signature = 0;
   for (int n = 0; n < length; n++) {
     cfs->guarantee_more(8, CHECK_(nullHandle));  // access_flags, name_index, descriptor_index, attributes_count
 
@@ -1135,14 +1159,19 @@
       if (is_synthetic) {
         access_flags.set_is_synthetic();
       }
+      if (generic_signature_index != 0) {
+        access_flags.set_field_has_generic_signature();
+        fa[generic_signature_slot] = generic_signature_index;
+        generic_signature_slot ++;
+        num_generic_signature ++;
+      }
     }
 
-    FieldInfo* field = FieldInfo::from_field_array(fields(), n);
+    FieldInfo* field = FieldInfo::from_field_array(fa, n);
     field->initialize(access_flags.as_short(),
                       name_index,
                       signature_index,
                       constantvalue_index,
-                      generic_signature_index,
                       0);
 
     BasicType type = cp->basic_type_for_signature_at(signature_index);
@@ -1155,8 +1184,8 @@
     field->set_offset(atype);
   }
 
+  int index = length;
   if (num_injected != 0) {
-    int index = length;
     for (int n = 0; n < num_injected; n++) {
       // Check for duplicates
       if (injected[n].may_be_java) {
@@ -1164,7 +1193,7 @@
         Symbol* signature = injected[n].signature();
         bool duplicate = false;
         for (int i = 0; i < length; i++) {
-          FieldInfo* f = FieldInfo::from_field_array(fields(), i);
+          FieldInfo* f = FieldInfo::from_field_array(fa, i);
           if (name      == cp->symbol_at(f->name_index()) &&
               signature == cp->symbol_at(f->signature_index())) {
             // Symbol is desclared in Java so skip this one
@@ -1179,12 +1208,11 @@
       }
 
       // Injected field
-      FieldInfo* field = FieldInfo::from_field_array(fields(), index);
+      FieldInfo* field = FieldInfo::from_field_array(fa, index);
       field->initialize(JVM_ACC_FIELD_INTERNAL,
                         injected[n].name_index,
                         injected[n].signature_index,
                         0,
-                        0,
                         0);
 
       BasicType type = FieldType::basic_type(injected[n].signature());
@@ -1197,17 +1225,27 @@
       field->set_offset(atype);
       index++;
     }
-
-    if (index < length + num_injected) {
-      // sometimes injected fields already exist in the Java source so
-      // the fields array could be too long.  In that case trim the
-      // fields array.
-      new_fields = oopFactory::new_permanent_shortArray(index * FieldInfo::field_slots, CHECK_(nullHandle));
-      for (int i = 0; i < index * FieldInfo::field_slots; i++) {
-        new_fields->short_at_put(i, fields->short_at(i));
-      }
-      fields = new_fields;
+  }
+
+  // Now copy the fields' data from the temporary resource array.
+  // Sometimes injected fields already exist in the Java source so
+  // the fields array could be too long.  In that case the
+  // fields array is trimed. Also unused slots that were reserved
+  // for generic signature indexes are discarded.
+  typeArrayOop new_fields = oopFactory::new_permanent_shortArray(
+    index * FieldInfo::field_slots + num_generic_signature,
+    CHECK_(nullHandle));
+  typeArrayHandle fields(THREAD, new_fields);
+  {
+    int i = 0;
+    for (; i < index * FieldInfo::field_slots; i++) {
+      new_fields->short_at_put(i, fa[i]);
     }
+    for (int j = total_fields * FieldInfo::field_slots;
+         j < generic_signature_slot; j++) {
+      new_fields->short_at_put(i++, fa[j]);
+    }
+    assert(i == new_fields->length(), "");
   }
 
   if (_need_verify && length > 1) {
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -2763,7 +2763,7 @@
       class_size += ik->local_interfaces()->size();
       class_size += ik->transitive_interfaces()->size();
       // We do not have to count implementors, since we only store one!
-      class_size += ik->all_fields_count() * FieldInfo::field_slots;
+      class_size += ik->fields()->length();
     }
   }
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -58,8 +58,11 @@
 void CompactibleFreeListSpace::set_cms_values() {
   // Set CMS global values
   assert(MinChunkSize == 0, "already set");
-  #define numQuanta(x,y) ((x+y-1)/y)
-  MinChunkSize = numQuanta(sizeof(FreeChunk), MinObjAlignmentInBytes) * MinObjAlignment;
+
+  // MinChunkSize should be a multiple of MinObjAlignment and be large enough
+  // for chunks to contain a FreeChunk.
+  size_t min_chunk_size_in_bytes = align_size_up(sizeof(FreeChunk), MinObjAlignmentInBytes);
+  MinChunkSize = min_chunk_size_in_bytes / BytesPerWord;
 
   assert(IndexSetStart == 0 && IndexSetStride == 0, "already set");
   IndexSetStart  = MinChunkSize;
@@ -2534,12 +2537,8 @@
     " linear allocation buffers");
   assert(BinaryTreeDictionary<FreeChunk>::min_tree_chunk_size*HeapWordSize == sizeof(TreeChunk<FreeChunk>),
     "else MIN_TREE_CHUNK_SIZE is wrong");
-  assert((IndexSetStride == 2 && IndexSetStart == 4) ||                   // 32-bit
-         (IndexSetStride == 1 && IndexSetStart == 3), "just checking");   // 64-bit
-  assert((IndexSetStride != 2) || (IndexSetStart % 2 == 0),
-      "Some for-loops may be incorrectly initialized");
-  assert((IndexSetStride != 2) || (IndexSetSize % 2 == 1),
-      "For-loops that iterate over IndexSet with stride 2 may be wrong");
+  assert(IndexSetStart != 0, "IndexSetStart not initialized");
+  assert(IndexSetStride != 0, "IndexSetStride not initialized");
 }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -952,9 +952,18 @@
         }
         should_try_gc = false;
       } else {
-        // Read the GC count while still holding the Heap_lock.
-        gc_count_before = total_collections();
-        should_try_gc = true;
+        // The GCLocker may not be active but the GCLocker initiated
+        // GC may not yet have been performed (GCLocker::needs_gc()
+        // returns true). In this case we do not try this GC and
+        // wait until the GCLocker initiated GC is performed, and
+        // then retry the allocation.
+        if (GC_locker::needs_gc()) {
+          should_try_gc = false;
+        } else {
+          // Read the GC count while still holding the Heap_lock.
+          gc_count_before = total_collections();
+          should_try_gc = true;
+        }
       }
     }
 
@@ -975,6 +984,9 @@
         return NULL;
       }
     } else {
+      // The GCLocker is either active or the GCLocker initiated
+      // GC has not yet been performed. Stall until it is and
+      // then retry the allocation.
       GC_locker::stall_until_clear();
     }
 
@@ -1054,9 +1066,18 @@
       if (GC_locker::is_active_and_needs_gc()) {
         should_try_gc = false;
       } else {
-        // Read the GC count while still holding the Heap_lock.
-        gc_count_before = total_collections();
-        should_try_gc = true;
+         // The GCLocker may not be active but the GCLocker initiated
+        // GC may not yet have been performed (GCLocker::needs_gc()
+        // returns true). In this case we do not try this GC and
+        // wait until the GCLocker initiated GC is performed, and
+        // then retry the allocation.
+        if (GC_locker::needs_gc()) {
+          should_try_gc = false;
+        } else {
+          // Read the GC count while still holding the Heap_lock.
+          gc_count_before = total_collections();
+          should_try_gc = true;
+        }
       }
     }
 
@@ -1081,6 +1102,9 @@
         return NULL;
       }
     } else {
+      // The GCLocker is either active or the GCLocker initiated
+      // GC has not yet been performed. Stall until it is and
+      // then retry the allocation.
       GC_locker::stall_until_clear();
     }
 
@@ -3906,12 +3930,6 @@
 
       gc_epilogue(false);
     }
-
-    if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) {
-      gclog_or_tty->print_cr("Stopping after GC #%d", ExitAfterGCNum);
-      print_tracing_info();
-      vm_exit(-1);
-    }
   }
 
   // The closing of the inner scope, immediately above, will complete
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -133,12 +133,7 @@
                         ? ParallelGCThreads : 1),
 
   _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
-  _all_pause_times_ms(new NumberSeq()),
   _stop_world_start(0.0),
-  _all_stop_world_times_ms(new NumberSeq()),
-  _all_yield_times_ms(new NumberSeq()),
-
-  _summary(new Summary()),
 
   _cur_clear_ct_time_ms(0.0),
   _root_region_scan_wait_time_ms(0.0),
@@ -154,12 +149,6 @@
   _num_cc_clears(0L),
 #endif
 
-  _aux_num(10),
-  _all_aux_times_ms(new NumberSeq[_aux_num]),
-  _cur_aux_start_times_ms(new double[_aux_num]),
-  _cur_aux_times_ms(new double[_aux_num]),
-  _cur_aux_times_set(new bool[_aux_num]),
-
   _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
   _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
 
@@ -185,8 +174,6 @@
   _pause_time_target_ms((double) MaxGCPauseMillis),
 
   _gcs_are_young(true),
-  _young_pause_num(0),
-  _mixed_pause_num(0),
 
   _during_marking(false),
   _in_marking_window(false),
@@ -197,8 +184,6 @@
 
   _recent_avg_pause_time_ratio(0.0),
 
-  _all_full_gc_times_ms(new NumberSeq()),
-
   _initiate_conc_mark_if_possible(false),
   _during_initial_mark_pause(false),
   _last_young_gc(false),
@@ -851,7 +836,7 @@
   double full_gc_time_sec = end_sec - _cur_collection_start_sec;
   double full_gc_time_ms = full_gc_time_sec * 1000.0;
 
-  _all_full_gc_times_ms->add(full_gc_time_ms);
+  _trace_gen1_time_data.record_full_collection(full_gc_time_ms);
 
   update_recent_gc_times(end_sec, full_gc_time_ms);
 
@@ -900,7 +885,7 @@
                  _g1->used(), _g1->recalculate_used()));
 
   double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
-  _all_stop_world_times_ms->add(s_w_t_ms);
+  _trace_gen0_time_data.record_start_collection(s_w_t_ms);
   _stop_world_start = 0.0;
 
   _cur_collection_start_sec = start_time_sec;
@@ -937,11 +922,6 @@
   }
 #endif
 
-  for (int i = 0; i < _aux_num; ++i) {
-    _cur_aux_times_ms[i] = 0.0;
-    _cur_aux_times_set[i] = false;
-  }
-
   // This is initialized to zero here and is set during the evacuation
   // pause if we actually waited for the root region scanning to finish.
   _root_region_scan_wait_time_ms = 0.0;
@@ -990,7 +970,7 @@
 void G1CollectorPolicy::record_concurrent_pause() {
   if (_stop_world_start > 0.0) {
     double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0;
-    _all_yield_times_ms->add(yield_ms);
+    _trace_gen0_time_data.record_yield_time(yield_ms);
   }
 }
 
@@ -1197,21 +1177,6 @@
   _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0,
                           end_time_sec, false);
 
-  // This assert is exempted when we're doing parallel collection pauses,
-  // because the fragmentation caused by the parallel GC allocation buffers
-  // can lead to more memory being used during collection than was used
-  // before. Best leave this out until the fragmentation problem is fixed.
-  // Pauses in which evacuation failed can also lead to negative
-  // collections, since no space is reclaimed from a region containing an
-  // object whose evacuation failed.
-  // Further, we're now always doing parallel collection.  But I'm still
-  // leaving this here as a placeholder for a more precise assertion later.
-  // (DLD, 10/05.)
-  assert((true || parallel) // Always using GC LABs now.
-         || _g1->evacuation_failed()
-         || _cur_collection_pause_used_at_start_bytes >= cur_used_bytes,
-         "Negative collection");
-
   size_t freed_bytes =
     _cur_collection_pause_used_at_start_bytes - cur_used_bytes;
   size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes;
@@ -1259,44 +1224,15 @@
   other_time_ms -= _cur_clear_ct_time_ms;
 
   // TraceGen0Time and TraceGen1Time summary info updating.
-  _all_pause_times_ms->add(elapsed_ms);
 
   if (update_stats) {
-    _summary->record_total_time_ms(elapsed_ms);
-    _summary->record_other_time_ms(other_time_ms);
-
-    MainBodySummary* body_summary = _summary->main_body_summary();
-    assert(body_summary != NULL, "should not be null!");
-
-    body_summary->record_root_region_scan_wait_time_ms(
-                                               _root_region_scan_wait_time_ms);
-    body_summary->record_ext_root_scan_time_ms(ext_root_scan_time);
-    body_summary->record_satb_filtering_time_ms(satb_filtering_time);
-    body_summary->record_update_rs_time_ms(update_rs_time);
-    body_summary->record_scan_rs_time_ms(scan_rs_time);
-    body_summary->record_obj_copy_time_ms(obj_copy_time);
-
-    if (parallel) {
-      body_summary->record_parallel_time_ms(_cur_collection_par_time_ms);
-      body_summary->record_termination_time_ms(termination_time);
+    double parallel_known_time = known_time + termination_time;
+    double parallel_other_time = _cur_collection_par_time_ms - parallel_known_time;
 
-      double parallel_known_time = known_time + termination_time;
-      double parallel_other_time = _cur_collection_par_time_ms - parallel_known_time;
-      body_summary->record_parallel_other_time_ms(parallel_other_time);
-    }
-
-    body_summary->record_clear_ct_time_ms(_cur_clear_ct_time_ms);
-
-    // We exempt parallel collection from this check because Alloc Buffer
-    // fragmentation can produce negative collections.  Same with evac
-    // failure.
-    // Further, we're now always doing parallel collection.  But I'm still
-    // leaving this here as a placeholder for a more precise assertion later.
-    // (DLD, 10/05.
-    assert((true || parallel)
-           || _g1->evacuation_failed()
-           || surviving_bytes <= _collection_set_bytes_used_before,
-           "Or else negative collection!");
+    _trace_gen0_time_data.record_end_collection(
+      elapsed_ms, other_time_ms, _root_region_scan_wait_time_ms, _cur_collection_par_time_ms,
+      ext_root_scan_time, satb_filtering_time, update_rs_time, scan_rs_time, obj_copy_time,
+      termination_time, parallel_other_time, _cur_clear_ct_time_ms);
 
     // this is where we update the allocation rate of the application
     double app_time_ms =
@@ -1349,12 +1285,6 @@
     }
   }
 
-  for (int i = 0; i < _aux_num; ++i) {
-    if (_cur_aux_times_set[i]) {
-      _all_aux_times_ms[i].add(_cur_aux_times_ms[i]);
-    }
-  }
-
   if (G1Log::finer()) {
     bool print_marking_info =
       _g1->mark_in_progress() && !last_pause_included_initial_mark;
@@ -1436,14 +1366,6 @@
     print_stats(2, "Free CSet",
                    (_recorded_young_free_cset_time_ms +
                     _recorded_non_young_free_cset_time_ms));
-
-    for (int i = 0; i < _aux_num; ++i) {
-      if (_cur_aux_times_set[i]) {
-        char buffer[96];
-        sprintf(buffer, "Aux%d", i);
-        print_stats(1, buffer, _cur_aux_times_ms[i]);
-      }
-    }
   }
 
   bool new_in_marking_window = _in_marking_window;
@@ -1808,179 +1730,9 @@
   _g1->collection_set_iterate(&cs_closure);
 }
 
-void G1CollectorPolicy::print_summary(int level,
-                                      const char* str,
-                                      NumberSeq* seq) const {
-  double sum = seq->sum();
-  LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)",
-                str, sum / 1000.0, seq->avg());
-}
-
-void G1CollectorPolicy::print_summary_sd(int level,
-                                         const char* str,
-                                         NumberSeq* seq) const {
-  print_summary(level, str, seq);
-  LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
-                seq->num(), seq->sd(), seq->maximum());
-}
-
-void G1CollectorPolicy::check_other_times(int level,
-                                        NumberSeq* other_times_ms,
-                                        NumberSeq* calc_other_times_ms) const {
-  bool should_print = false;
-  LineBuffer buf(level + 2);
-
-  double max_sum = MAX2(fabs(other_times_ms->sum()),
-                        fabs(calc_other_times_ms->sum()));
-  double min_sum = MIN2(fabs(other_times_ms->sum()),
-                        fabs(calc_other_times_ms->sum()));
-  double sum_ratio = max_sum / min_sum;
-  if (sum_ratio > 1.1) {
-    should_print = true;
-    buf.append_and_print_cr("## CALCULATED OTHER SUM DOESN'T MATCH RECORDED ###");
-  }
-
-  double max_avg = MAX2(fabs(other_times_ms->avg()),
-                        fabs(calc_other_times_ms->avg()));
-  double min_avg = MIN2(fabs(other_times_ms->avg()),
-                        fabs(calc_other_times_ms->avg()));
-  double avg_ratio = max_avg / min_avg;
-  if (avg_ratio > 1.1) {
-    should_print = true;
-    buf.append_and_print_cr("## CALCULATED OTHER AVG DOESN'T MATCH RECORDED ###");
-  }
-
-  if (other_times_ms->sum() < -0.01) {
-    buf.append_and_print_cr("## RECORDED OTHER SUM IS NEGATIVE ###");
-  }
-
-  if (other_times_ms->avg() < -0.01) {
-    buf.append_and_print_cr("## RECORDED OTHER AVG IS NEGATIVE ###");
-  }
-
-  if (calc_other_times_ms->sum() < -0.01) {
-    should_print = true;
-    buf.append_and_print_cr("## CALCULATED OTHER SUM IS NEGATIVE ###");
-  }
-
-  if (calc_other_times_ms->avg() < -0.01) {
-    should_print = true;
-    buf.append_and_print_cr("## CALCULATED OTHER AVG IS NEGATIVE ###");
-  }
-
-  if (should_print)
-    print_summary(level, "Other(Calc)", calc_other_times_ms);
-}
-
-void G1CollectorPolicy::print_summary(PauseSummary* summary) const {
-  bool parallel = G1CollectedHeap::use_parallel_gc_threads();
-  MainBodySummary*    body_summary = summary->main_body_summary();
-  if (summary->get_total_seq()->num() > 0) {
-    print_summary_sd(0, "Evacuation Pauses", summary->get_total_seq());
-    if (body_summary != NULL) {
-      print_summary(1, "Root Region Scan Wait", body_summary->get_root_region_scan_wait_seq());
-      if (parallel) {
-        print_summary(1, "Parallel Time", body_summary->get_parallel_seq());
-        print_summary(2, "Ext Root Scanning", body_summary->get_ext_root_scan_seq());
-        print_summary(2, "SATB Filtering", body_summary->get_satb_filtering_seq());
-        print_summary(2, "Update RS", body_summary->get_update_rs_seq());
-        print_summary(2, "Scan RS", body_summary->get_scan_rs_seq());
-        print_summary(2, "Object Copy", body_summary->get_obj_copy_seq());
-        print_summary(2, "Termination", body_summary->get_termination_seq());
-        print_summary(2, "Parallel Other", body_summary->get_parallel_other_seq());
-        {
-          NumberSeq* other_parts[] = {
-            body_summary->get_ext_root_scan_seq(),
-            body_summary->get_satb_filtering_seq(),
-            body_summary->get_update_rs_seq(),
-            body_summary->get_scan_rs_seq(),
-            body_summary->get_obj_copy_seq(),
-            body_summary->get_termination_seq()
-          };
-          NumberSeq calc_other_times_ms(body_summary->get_parallel_seq(),
-                                        6, other_parts);
-          check_other_times(2, body_summary->get_parallel_other_seq(),
-                            &calc_other_times_ms);
-        }
-      } else {
-        print_summary(1, "Ext Root Scanning", body_summary->get_ext_root_scan_seq());
-        print_summary(1, "SATB Filtering", body_summary->get_satb_filtering_seq());
-        print_summary(1, "Update RS", body_summary->get_update_rs_seq());
-        print_summary(1, "Scan RS", body_summary->get_scan_rs_seq());
-        print_summary(1, "Object Copy", body_summary->get_obj_copy_seq());
-      }
-    }
-    print_summary(1, "Clear CT", body_summary->get_clear_ct_seq());
-    print_summary(1, "Other", summary->get_other_seq());
-    {
-      if (body_summary != NULL) {
-        NumberSeq calc_other_times_ms;
-        if (parallel) {
-          // parallel
-          NumberSeq* other_parts[] = {
-            body_summary->get_root_region_scan_wait_seq(),
-            body_summary->get_parallel_seq(),
-            body_summary->get_clear_ct_seq()
-          };
-          calc_other_times_ms = NumberSeq(summary->get_total_seq(),
-                                          3, other_parts);
-        } else {
-          // serial
-          NumberSeq* other_parts[] = {
-            body_summary->get_root_region_scan_wait_seq(),
-            body_summary->get_update_rs_seq(),
-            body_summary->get_ext_root_scan_seq(),
-            body_summary->get_satb_filtering_seq(),
-            body_summary->get_scan_rs_seq(),
-            body_summary->get_obj_copy_seq()
-          };
-          calc_other_times_ms = NumberSeq(summary->get_total_seq(),
-                                          6, other_parts);
-        }
-        check_other_times(1,  summary->get_other_seq(), &calc_other_times_ms);
-      }
-    }
-  } else {
-    LineBuffer(1).append_and_print_cr("none");
-  }
-  LineBuffer(0).append_and_print_cr("");
-}
-
 void G1CollectorPolicy::print_tracing_info() const {
-  if (TraceGen0Time) {
-    gclog_or_tty->print_cr("ALL PAUSES");
-    print_summary_sd(0, "Total", _all_pause_times_ms);
-    gclog_or_tty->print_cr("");
-    gclog_or_tty->print_cr("");
-    gclog_or_tty->print_cr("   Young GC Pauses: %8d", _young_pause_num);
-    gclog_or_tty->print_cr("   Mixed GC Pauses: %8d", _mixed_pause_num);
-    gclog_or_tty->print_cr("");
-
-    gclog_or_tty->print_cr("EVACUATION PAUSES");
-    print_summary(_summary);
-
-    gclog_or_tty->print_cr("MISC");
-    print_summary_sd(0, "Stop World", _all_stop_world_times_ms);
-    print_summary_sd(0, "Yields", _all_yield_times_ms);
-    for (int i = 0; i < _aux_num; ++i) {
-      if (_all_aux_times_ms[i].num() > 0) {
-        char buffer[96];
-        sprintf(buffer, "Aux%d", i);
-        print_summary_sd(0, buffer, &_all_aux_times_ms[i]);
-      }
-    }
-  }
-  if (TraceGen1Time) {
-    if (_all_full_gc_times_ms->num() > 0) {
-      gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s",
-                 _all_full_gc_times_ms->num(),
-                 _all_full_gc_times_ms->sum() / 1000.0);
-      gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times_ms->avg());
-      gclog_or_tty->print_cr("                     [std. dev = %8.2f ms, max = %8.2f ms]",
-                    _all_full_gc_times_ms->sd(),
-                    _all_full_gc_times_ms->maximum());
-    }
-  }
+  _trace_gen0_time_data.print();
+  _trace_gen1_time_data.print();
 }
 
 void G1CollectorPolicy::print_yg_surv_rate_info() const {
@@ -2531,9 +2283,9 @@
   _last_gc_was_young = gcs_are_young() ? true : false;
 
   if (_last_gc_was_young) {
-    ++_young_pause_num;
+    _trace_gen0_time_data.increment_young_collection_count();
   } else {
-    ++_mixed_pause_num;
+    _trace_gen0_time_data.increment_mixed_collection_count();
   }
 
   // The young list is laid with the survivor regions from the previous
@@ -2690,3 +2442,133 @@
   _recorded_non_young_cset_choice_time_ms =
     (non_young_end_time_sec - non_young_start_time_sec) * 1000.0;
 }
+
+void TraceGen0TimeData::record_start_collection(double time_to_stop_the_world_ms) {
+  if(TraceGen0Time) {
+    _all_stop_world_times_ms.add(time_to_stop_the_world_ms);
+  }
+}
+
+void TraceGen0TimeData::record_yield_time(double yield_time_ms) {
+  if(TraceGen0Time) {
+    _all_yield_times_ms.add(yield_time_ms);
+  }
+}
+
+void TraceGen0TimeData::record_end_collection(
+     double total_ms,
+     double other_ms,
+     double root_region_scan_wait_ms,
+     double parallel_ms,
+     double ext_root_scan_ms,
+     double satb_filtering_ms,
+     double update_rs_ms,
+     double scan_rs_ms,
+     double obj_copy_ms,
+     double termination_ms,
+     double parallel_other_ms,
+     double clear_ct_ms)
+{
+  if(TraceGen0Time) {
+    _total.add(total_ms);
+    _other.add(other_ms);
+    _root_region_scan_wait.add(root_region_scan_wait_ms);
+    _parallel.add(parallel_ms);
+    _ext_root_scan.add(ext_root_scan_ms);
+    _satb_filtering.add(satb_filtering_ms);
+    _update_rs.add(update_rs_ms);
+    _scan_rs.add(scan_rs_ms);
+    _obj_copy.add(obj_copy_ms);
+    _termination.add(termination_ms);
+    _parallel_other.add(parallel_other_ms);
+    _clear_ct.add(clear_ct_ms);
+  }
+}
+
+void TraceGen0TimeData::increment_young_collection_count() {
+  if(TraceGen0Time) {
+    ++_young_pause_num;
+  }
+}
+
+void TraceGen0TimeData::increment_mixed_collection_count() {
+  if(TraceGen0Time) {
+    ++_mixed_pause_num;
+  }
+}
+
+void TraceGen0TimeData::print_summary(int level,
+                                      const char* str,
+                                      const NumberSeq* seq) const {
+  double sum = seq->sum();
+  LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)",
+                str, sum / 1000.0, seq->avg());
+}
+
+void TraceGen0TimeData::print_summary_sd(int level,
+                                         const char* str,
+                                         const NumberSeq* seq) const {
+  print_summary(level, str, seq);
+  LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
+                seq->num(), seq->sd(), seq->maximum());
+}
+
+void TraceGen0TimeData::print() const {
+  if (!TraceGen0Time) {
+    return;
+  }
+
+  gclog_or_tty->print_cr("ALL PAUSES");
+  print_summary_sd(0, "Total", &_total);
+  gclog_or_tty->print_cr("");
+  gclog_or_tty->print_cr("");
+  gclog_or_tty->print_cr("   Young GC Pauses: %8d", _young_pause_num);
+  gclog_or_tty->print_cr("   Mixed GC Pauses: %8d", _mixed_pause_num);
+  gclog_or_tty->print_cr("");
+
+  gclog_or_tty->print_cr("EVACUATION PAUSES");
+
+  if (_young_pause_num == 0 && _mixed_pause_num == 0) {
+    gclog_or_tty->print_cr("none");
+  } else {
+    print_summary_sd(0, "Evacuation Pauses", &_total);
+    print_summary(1, "Root Region Scan Wait", &_root_region_scan_wait);
+    print_summary(1, "Parallel Time", &_parallel);
+    print_summary(2, "Ext Root Scanning", &_ext_root_scan);
+    print_summary(2, "SATB Filtering", &_satb_filtering);
+    print_summary(2, "Update RS", &_update_rs);
+    print_summary(2, "Scan RS", &_scan_rs);
+    print_summary(2, "Object Copy", &_obj_copy);
+    print_summary(2, "Termination", &_termination);
+    print_summary(2, "Parallel Other", &_parallel_other);
+    print_summary(1, "Clear CT", &_clear_ct);
+    print_summary(1, "Other", &_other);
+  }
+  gclog_or_tty->print_cr("");
+
+  gclog_or_tty->print_cr("MISC");
+  print_summary_sd(0, "Stop World", &_all_stop_world_times_ms);
+  print_summary_sd(0, "Yields", &_all_yield_times_ms);
+}
+
+void TraceGen1TimeData::record_full_collection(double full_gc_time_ms) {
+  if (TraceGen1Time) {
+    _all_full_gc_times.add(full_gc_time_ms);
+  }
+}
+
+void TraceGen1TimeData::print() const {
+  if (!TraceGen1Time) {
+    return;
+  }
+
+  if (_all_full_gc_times.num() > 0) {
+    gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s",
+      _all_full_gc_times.num(),
+      _all_full_gc_times.sum() / 1000.0);
+    gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times.avg());
+    gclog_or_tty->print_cr("                     [std. dev = %8.2f ms, max = %8.2f ms]",
+      _all_full_gc_times.sd(),
+      _all_full_gc_times.maximum());
+  }
+}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -37,49 +37,62 @@
 class HeapRegion;
 class CollectionSetChooser;
 
-// Yes, this is a bit unpleasant... but it saves replicating the same thing
-// over and over again and introducing subtle problems through small typos and
-// cutting and pasting mistakes. The macros below introduces a number
-// sequnce into the following two classes and the methods that access it.
+// TraceGen0Time collects data on _both_ young and mixed evacuation pauses
+// (the latter may contain non-young regions - i.e. regions that are
+// technically in Gen1) while TraceGen1Time collects data about full GCs.
+class TraceGen0TimeData : public CHeapObj {
+ private:
+  unsigned  _young_pause_num;
+  unsigned  _mixed_pause_num;
+
+  NumberSeq _all_stop_world_times_ms;
+  NumberSeq _all_yield_times_ms;
 
-#define define_num_seq(name)                                                  \
-private:                                                                      \
-  NumberSeq _all_##name##_times_ms;                                           \
-public:                                                                       \
-  void record_##name##_time_ms(double ms) {                                   \
-    _all_##name##_times_ms.add(ms);                                           \
-  }                                                                           \
-  NumberSeq* get_##name##_seq() {                                             \
-    return &_all_##name##_times_ms;                                           \
-  }
+  NumberSeq _total;
+  NumberSeq _other;
+  NumberSeq _root_region_scan_wait;
+  NumberSeq _parallel;
+  NumberSeq _ext_root_scan;
+  NumberSeq _satb_filtering;
+  NumberSeq _update_rs;
+  NumberSeq _scan_rs;
+  NumberSeq _obj_copy;
+  NumberSeq _termination;
+  NumberSeq _parallel_other;
+  NumberSeq _clear_ct;
 
-class MainBodySummary;
-
-class PauseSummary: public CHeapObj {
-  define_num_seq(total)
-    define_num_seq(other)
+  void print_summary (int level, const char* str, const NumberSeq* seq) const;
+  void print_summary_sd (int level, const char* str, const NumberSeq* seq) const;
 
 public:
-  virtual MainBodySummary*    main_body_summary()    { return NULL; }
+   TraceGen0TimeData() : _young_pause_num(0), _mixed_pause_num(0) {};
+  void record_start_collection(double time_to_stop_the_world_ms);
+  void record_yield_time(double yield_time_ms);
+  void record_end_collection(
+     double total_ms,
+     double other_ms,
+     double root_region_scan_wait_ms,
+     double parallel_ms,
+     double ext_root_scan_ms,
+     double satb_filtering_ms,
+     double update_rs_ms,
+     double scan_rs_ms,
+     double obj_copy_ms,
+     double termination_ms,
+     double parallel_other_ms,
+     double clear_ct_ms);
+  void increment_young_collection_count();
+  void increment_mixed_collection_count();
+  void print() const;
 };
 
-class MainBodySummary: public CHeapObj {
-  define_num_seq(root_region_scan_wait)
-  define_num_seq(parallel) // parallel only
-    define_num_seq(ext_root_scan)
-    define_num_seq(satb_filtering)
-    define_num_seq(update_rs)
-    define_num_seq(scan_rs)
-    define_num_seq(obj_copy)
-    define_num_seq(termination) // parallel only
-    define_num_seq(parallel_other) // parallel only
-  define_num_seq(clear_ct)
-};
+class TraceGen1TimeData : public CHeapObj {
+ private:
+  NumberSeq _all_full_gc_times;
 
-class Summary: public PauseSummary,
-               public MainBodySummary {
-public:
-  virtual MainBodySummary*    main_body_summary()    { return this; }
+ public:
+  void record_full_collection(double full_gc_time_ms);
+  void print() const;
 };
 
 // There are three command line options related to the young gen size:
@@ -199,19 +212,10 @@
   TruncatedSeq* _concurrent_mark_remark_times_ms;
   TruncatedSeq* _concurrent_mark_cleanup_times_ms;
 
-  Summary*           _summary;
+  TraceGen0TimeData _trace_gen0_time_data;
+  TraceGen1TimeData _trace_gen1_time_data;
 
-  NumberSeq* _all_pause_times_ms;
-  NumberSeq* _all_full_gc_times_ms;
   double _stop_world_start;
-  NumberSeq* _all_stop_world_times_ms;
-  NumberSeq* _all_yield_times_ms;
-
-  int        _aux_num;
-  NumberSeq* _all_aux_times_ms;
-  double*    _cur_aux_start_times_ms;
-  double*    _cur_aux_times_ms;
-  bool*      _cur_aux_times_set;
 
   double* _par_last_gc_worker_start_times_ms;
   double* _par_last_ext_root_scan_times_ms;
@@ -243,9 +247,6 @@
 
   bool                  _last_gc_was_young;
 
-  unsigned              _young_pause_num;
-  unsigned              _mixed_pause_num;
-
   bool                  _during_marking;
   bool                  _in_marking_window;
   bool                  _in_marking_window_im;
@@ -557,15 +558,6 @@
 
   void print_par_stats(int level, const char* str, double* data, bool showDecimals = true);
 
-  void check_other_times(int level,
-                         NumberSeq* other_times_ms,
-                         NumberSeq* calc_other_times_ms) const;
-
-  void print_summary (PauseSummary* stats) const;
-
-  void print_summary (int level, const char* str, NumberSeq* seq) const;
-  void print_summary_sd (int level, const char* str, NumberSeq* seq) const;
-
   double avg_value (double* data);
   double max_value (double* data);
   double sum_of_values (double* data);
@@ -745,10 +737,6 @@
     return _bytes_in_collection_set_before_gc;
   }
 
-  unsigned calc_gc_alloc_time_stamp() {
-    return _all_pause_times_ms->num() + 1;
-  }
-
   // This should be called after the heap is resized.
   void record_new_heap_size(uint new_number_of_regions);
 
@@ -867,18 +855,6 @@
     _cur_collection_code_root_fixup_time_ms = ms;
   }
 
-  void record_aux_start_time(int i) {
-    guarantee(i < _aux_num, "should be within range");
-    _cur_aux_start_times_ms[i] = os::elapsedTime() * 1000.0;
-  }
-
-  void record_aux_end_time(int i) {
-    guarantee(i < _aux_num, "should be within range");
-    double ms = os::elapsedTime() * 1000.0 - _cur_aux_start_times_ms[i];
-    _cur_aux_times_set[i] = true;
-    _cur_aux_times_ms[i] += ms;
-  }
-
   void record_ref_proc_time(double ms) {
     _cur_ref_proc_time_ms = ms;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -1106,7 +1106,8 @@
 void HeapRegionRemSet::setup_remset_size() {
   // Setup sparse and fine-grain tables sizes.
   // table_size = base * (log(region_size / 1M) + 1)
-  int region_size_log_mb = MAX2((int)HeapRegion::LogOfHRGrainBytes - (int)LOG_M, 0);
+  const int LOG_M = 20;
+  int region_size_log_mb = MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0);
   if (FLAG_IS_DEFAULT(G1RSetSparseRegionEntries)) {
     G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * (region_size_log_mb + 1);
   }
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -677,11 +677,6 @@
 #ifdef TRACESPINNING
   ParallelTaskTerminator::print_termination_counts();
 #endif
-
-  if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) {
-    tty->print_cr("Stopping after GC #%d", ExitAfterGCNum);
-    vm_exit(-1);
-  }
 }
 
 HeapWord* GenCollectedHeap::satisfy_failed_allocation(size_t size, bool is_tlab) {
--- a/hotspot/src/share/vm/oops/fieldInfo.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/oops/fieldInfo.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -50,8 +50,7 @@
     initval_index_offset     = 3,
     low_offset               = 4,
     high_offset              = 5,
-    generic_signature_offset = 6,
-    field_slots              = 7
+    field_slots              = 6
   };
 
  private:
@@ -60,29 +59,28 @@
   void set_name_index(u2 val)                    { _shorts[name_index_offset] = val;         }
   void set_signature_index(u2 val)               { _shorts[signature_index_offset] = val;    }
   void set_initval_index(u2 val)                 { _shorts[initval_index_offset] = val;      }
-  void set_generic_signature_index(u2 val)       { _shorts[generic_signature_offset] = val;  }
 
   u2 name_index() const                          { return _shorts[name_index_offset];        }
   u2 signature_index() const                     { return _shorts[signature_index_offset];   }
   u2 initval_index() const                       { return _shorts[initval_index_offset];     }
-  u2 generic_signature_index() const             { return _shorts[generic_signature_offset]; }
 
  public:
   static FieldInfo* from_field_array(typeArrayOop fields, int index) {
     return ((FieldInfo*)fields->short_at_addr(index * field_slots));
   }
+  static FieldInfo* from_field_array(u2* fields, int index) {
+    return ((FieldInfo*)(fields + index * field_slots));
+  }
 
   void initialize(u2 access_flags,
                   u2 name_index,
                   u2 signature_index,
                   u2 initval_index,
-                  u2 generic_signature_index,
                   u4 offset) {
     _shorts[access_flags_offset] = access_flags;
     _shorts[name_index_offset] = name_index;
     _shorts[signature_index_offset] = signature_index;
     _shorts[initval_index_offset] = initval_index;
-    _shorts[generic_signature_offset] = generic_signature_index;
     set_offset(offset);
   }
 
@@ -105,14 +103,6 @@
     return cp->symbol_at(index);
   }
 
-  Symbol* generic_signature(constantPoolHandle cp) const {
-    int index = generic_signature_index();
-    if (index == 0) {
-      return NULL;
-    }
-    return cp->symbol_at(index);
-  }
-
   void set_access_flags(u2 val)                  { _shorts[access_flags_offset] = val;             }
   void set_offset(u4 val)                        {
     _shorts[low_offset] = extract_low_short_from_int(val);
--- a/hotspot/src/share/vm/oops/fieldStreams.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/oops/fieldStreams.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -42,21 +42,57 @@
   constantPoolHandle  _constants;
   int                 _index;
   int                 _limit;
+  int                 _generic_signature_slot;
 
   FieldInfo* field() const { return FieldInfo::from_field_array(_fields(), _index); }
 
+  int init_generic_signature_start_slot() {
+    int length = _fields->length();
+    int num_fields = 0;
+    int skipped_generic_signature_slots = 0;
+    FieldInfo* fi;
+    AccessFlags flags;
+    /* Scan from 0 to the current _index. Count the number of generic
+       signature slots for field[0] to field[_index - 1]. */
+    for (int i = 0; i < _index; i++) {
+      fi = FieldInfo::from_field_array(_fields(), i);
+      flags.set_flags(fi->access_flags());
+      if (flags.field_has_generic_signature()) {
+        length --;
+        skipped_generic_signature_slots ++;
+      }
+    }
+    /* Scan from the current _index. */
+    for (int i = _index; i*FieldInfo::field_slots < length; i++) {
+      fi = FieldInfo::from_field_array(_fields(), i);
+      flags.set_flags(fi->access_flags());
+      if (flags.field_has_generic_signature()) {
+        length --;
+      }
+      num_fields ++;
+    }
+    _generic_signature_slot = length + skipped_generic_signature_slots;
+    assert(_generic_signature_slot <= _fields->length(), "");
+    return num_fields;
+  }
+
   FieldStreamBase(typeArrayHandle fields, constantPoolHandle constants, int start, int limit) {
     _fields = fields;
     _constants = constants;
     _index = start;
-    _limit = limit;
+    int num_fields = init_generic_signature_start_slot();
+    if (limit < start) {
+      _limit = num_fields;
+    } else {
+      _limit = limit;
+    }
   }
 
   FieldStreamBase(typeArrayHandle fields, constantPoolHandle constants) {
     _fields = fields;
     _constants = constants;
     _index = 0;
-    _limit = fields->length() / FieldInfo::field_slots;
+    _limit = init_generic_signature_start_slot();
   }
 
  public:
@@ -65,18 +101,26 @@
     _constants = klass->constants();
     _index = 0;
     _limit = klass->java_fields_count();
+    init_generic_signature_start_slot();
   }
   FieldStreamBase(instanceKlassHandle klass) {
     _fields = klass->fields();
     _constants = klass->constants();
     _index = 0;
     _limit = klass->java_fields_count();
+    init_generic_signature_start_slot();
   }
 
   // accessors
   int index() const                 { return _index; }
 
-  void next() { _index += 1; }
+  void next() {
+    if (access_flags().field_has_generic_signature()) {
+      _generic_signature_slot ++;
+      assert(_generic_signature_slot <= _fields->length(), "");
+    }
+    _index += 1;
+  }
   bool done() const { return _index >= _limit; }
 
   // Accessors for current field
@@ -103,7 +147,13 @@
   }
 
   Symbol* generic_signature() const {
-    return field()->generic_signature(_constants);
+    if (access_flags().field_has_generic_signature()) {
+      assert(_generic_signature_slot < _fields->length(), "out of bounds");
+      int index = _fields->short_at(_generic_signature_slot);
+      return _constants->symbol_at(index);
+    } else {
+      return NULL;
+    }
   }
 
   int offset() const {
@@ -139,11 +189,19 @@
   }
   int generic_signature_index() const {
     assert(!field()->is_internal(), "regular only");
-    return field()->generic_signature_index();
+    if (access_flags().field_has_generic_signature()) {
+      assert(_generic_signature_slot < _fields->length(), "out of bounds");
+      return _fields->short_at(_generic_signature_slot);
+    } else {
+      return 0;
+    }
   }
   void set_generic_signature_index(int index) {
     assert(!field()->is_internal(), "regular only");
-    field()->set_generic_signature_index(index);
+    if (access_flags().field_has_generic_signature()) {
+      assert(_generic_signature_slot < _fields->length(), "out of bounds");
+      _fields->short_at_put(_generic_signature_slot, index);
+    }
   }
   int initval_index() const {
     assert(!field()->is_internal(), "regular only");
@@ -159,8 +217,8 @@
 // Iterate over only the internal fields
 class InternalFieldStream : public FieldStreamBase {
  public:
-  InternalFieldStream(instanceKlass* k):      FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), k->all_fields_count()) {}
-  InternalFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), k->all_fields_count()) {}
+  InternalFieldStream(instanceKlass* k):      FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), 0) {}
+  InternalFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), 0) {}
 };
 
 
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -168,8 +168,19 @@
   objArrayOop     _local_interfaces;
   // Interface (klassOops) this class implements transitively.
   objArrayOop     _transitive_interfaces;
-  // Instance and static variable information, 5-tuples of shorts [access, name
-  // index, sig index, initval index, offset].
+  // Instance and static variable information, starts with 6-tuples of shorts
+  // [access, name index, sig index, initval index, low_offset, high_offset]
+  // for all fields, followed by the generic signature data at the end of
+  // the array. Only fields with generic signature attributes have the generic
+  // signature data set in the array. The fields array looks like following:
+  //
+  // f1: [access, name index, sig index, initial value index, low_offset, high_offset]
+  // f2: [access, name index, sig index, initial value index, low_offset, high_offset]
+  //      ...
+  // fn: [access, name index, sig index, initial value index, low_offset, high_offset]
+  //     [generic signature index]
+  //     [generic signature index]
+  //     ...
   typeArrayOop    _fields;
   // Constant pool for this class.
   constantPoolOop _constants;
@@ -351,9 +362,6 @@
   // Number of Java declared fields
   int java_fields_count() const           { return (int)_java_fields_count; }
 
-  // Number of fields including any injected fields
-  int all_fields_count() const            { return _fields->length() / FieldInfo::field_slots; }
-
   typeArrayOop fields() const              { return _fields; }
 
   void set_fields(typeArrayOop f, u2 java_fields_count) {
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -515,6 +515,12 @@
 void instanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) {
   // we may enter this with pending exception set
   PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
+
+  // Create a HandleMark in case we retry a GC multiple times.
+  // Each time we attempt the GC, we allocate the handle below
+  // to hold the pending list lock. We want to free this handle.
+  HandleMark hm;
+
   Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
   ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD);
   assert(ObjectSynchronizer::current_thread_holds_lock(
@@ -527,7 +533,12 @@
   BasicLock *pending_list_basic_lock) {
   // we may enter this with pending exception set
   PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
-  //
+
+  // Create a HandleMark in case we retry a GC multiple times.
+  // Each time we attempt the GC, we allocate the handle below
+  // to hold the pending list lock. We want to free this handle.
+  HandleMark hm;
+
   Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
   assert(ObjectSynchronizer::current_thread_holds_lock(
            JavaThread::current(), h_lock),
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -28,6 +28,7 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/fieldStreams.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/signature.hpp"
@@ -37,6 +38,20 @@
   return instanceKlass::cast(_cp->pool_holder())->class_loader();
 }
 
+Symbol* fieldDescriptor::generic_signature() const {
+  int idx = 0;
+  instanceKlass* ik = instanceKlass::cast(field_holder());
+  for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
+    if (idx == _index) {
+      return fs.generic_signature();
+    } else {
+      idx ++;
+    }
+  }
+  assert(false, "should never happen");
+  return NULL;
+}
+
 typeArrayOop fieldDescriptor::annotations() const {
   instanceKlass* ik = instanceKlass::cast(field_holder());
   objArrayOop md = ik->fields_annotations();
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -67,7 +67,7 @@
   oop loader() const;
   // Offset (in words) of field from start of instanceOop / klassOop
   int offset() const                   { return field()->offset(); }
-  Symbol* generic_signature() const    { return field()->generic_signature(_cp); }
+  Symbol* generic_signature() const;
   int index() const                    { return _index; }
   typeArrayOop annotations() const;
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -3285,9 +3285,6 @@
   diagnostic(intx, VerifyGCLevel,     0,                                    \
           "Generation level at which to start +VerifyBefore/AfterGC")       \
                                                                             \
-  develop(uintx, ExitAfterGCNum,   0,                                       \
-          "If non-zero, exit after this GC.")                               \
-                                                                            \
   product(intx, MaxTenuringThreshold,    15,                                \
           "Maximum value for tenuring threshold")                           \
                                                                             \
--- a/hotspot/src/share/vm/runtime/osThread.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/runtime/osThread.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -61,7 +61,6 @@
 class OSThread: public CHeapObj {
   friend class VMStructs;
  private:
-  //void* _start_proc;            // Thread start routine
   OSThreadStartFunc _start_proc;  // Thread start routine
   void* _start_parm;              // Thread start routine parameter
   volatile ThreadState _state;    // Thread state *hint*
@@ -77,10 +76,7 @@
   void set_state(ThreadState state)                { _state = state; }
   ThreadState get_state()                          { return _state; }
 
-  // Constructor
   OSThread(OSThreadStartFunc start_proc, void* start_parm);
-
-  // Destructor
   ~OSThread();
 
   // Accessors
@@ -98,7 +94,6 @@
 
   // For java intrinsics:
   static ByteSize interrupted_offset()            { return byte_offset_of(OSThread, _interrupted); }
-  static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
 
   // Platform dependent stuff
 #ifdef TARGET_OS_FAMILY_linux
@@ -114,6 +109,19 @@
 # include "osThread_bsd.hpp"
 #endif
 
+ public:
+  static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
+  static size_t thread_id_size()                  { return sizeof(thread_id_t); }
+
+  thread_id_t thread_id() const                   { return _thread_id; }
+
+  void set_thread_id(thread_id_t id)              { _thread_id = id; }
+
+ private:
+  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
+  // thread has a unique thread_id (BsdThreads or NPTL). It can be used
+  // to access /proc.
+  thread_id_t _thread_id;
 };
 
 
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -2352,7 +2352,6 @@
   declare_constant(FieldInfo::initval_index_offset)                       \
   declare_constant(FieldInfo::low_offset)                                 \
   declare_constant(FieldInfo::high_offset)                                \
-  declare_constant(FieldInfo::generic_signature_offset)                   \
   declare_constant(FieldInfo::field_slots)                                \
                                                                           \
   /************************************************/                      \
--- a/hotspot/src/share/vm/utilities/accessFlags.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/utilities/accessFlags.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -80,10 +80,12 @@
   JVM_ACC_FIELD_ACCESS_WATCHED       = 0x00002000,  // field access is watched by JVMTI
   JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000,  // field modification is watched by JVMTI
   JVM_ACC_FIELD_INTERNAL             = 0x00000400,  // internal field, same as JVM_ACC_ABSTRACT
+  JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800, // field has generic signature
 
   JVM_ACC_FIELD_INTERNAL_FLAGS       = JVM_ACC_FIELD_ACCESS_WATCHED |
                                        JVM_ACC_FIELD_MODIFICATION_WATCHED |
-                                       JVM_ACC_FIELD_INTERNAL,
+                                       JVM_ACC_FIELD_INTERNAL |
+                                       JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE,
 
                                                     // flags accepted by set_field_flags()
   JVM_ACC_FIELD_FLAGS                = JVM_RECOGNIZED_FIELD_MODIFIERS | JVM_ACC_FIELD_INTERNAL_FLAGS
@@ -156,6 +158,8 @@
   bool is_field_modification_watched() const
                                         { return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
   bool is_internal() const              { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; }
+  bool field_has_generic_signature() const
+                                        { return (_flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) != 0; }
 
   // get .class file flags
   jint get_flags               () const { return (_flags & JVM_ACC_WRITTEN_FLAGS); }
@@ -225,6 +229,10 @@
                                            atomic_clear_bits(JVM_ACC_FIELD_MODIFICATION_WATCHED);
                                          }
                                        }
+  void set_field_has_generic_signature()
+                                       {
+                                         atomic_set_bits(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE);
+                                       }
 
   // Conversion
   jshort as_short() const              { return (jshort)_flags; }
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -161,10 +161,6 @@
 const size_t G                  = M*K;
 const size_t HWperKB            = K / sizeof(HeapWord);
 
-const size_t LOG_K              = 10;
-const size_t LOG_M              = 2 * LOG_K;
-const size_t LOG_G              = 2 * LOG_M;
-
 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint
 const jint max_jint = (juint)min_jint - 1;                     // 0x7FFFFFFF == largest jint
 
--- a/hotspot/src/share/vm/utilities/numberSeq.cpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/utilities/numberSeq.cpp	Fri Jun 08 17:28:54 2012 -0700
@@ -115,24 +115,6 @@
   return true;
 }
 
-NumberSeq::NumberSeq(NumberSeq *total, int n, NumberSeq **parts) {
-  guarantee(check_nums(total, n, parts), "all seq lengths should match");
-  double sum = total->sum();
-  for (int i = 0; i < n; ++i) {
-    if (parts[i] != NULL)
-      sum -= parts[i]->sum();
-  }
-
-  _num = total->num();
-  _sum = sum;
-
-  // we do not calculate these...
-  _sum_of_squares = -1.0;
-  _maximum = -1.0;
-  _davg = -1.0;
-  _dvariance = -1.0;
-}
-
 void NumberSeq::add(double val) {
   AbsSeq::add(val);
 
--- a/hotspot/src/share/vm/utilities/numberSeq.hpp	Fri Jun 08 17:25:46 2012 -0700
+++ b/hotspot/src/share/vm/utilities/numberSeq.hpp	Fri Jun 08 17:28:54 2012 -0700
@@ -93,7 +93,6 @@
 
 public:
   NumberSeq(double alpha = DEFAULT_ALPHA_VALUE);
-  NumberSeq(NumberSeq* total, int n_parts, NumberSeq** parts);
 
   virtual void add(double val);
   virtual double maximum() const { return _maximum; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/7168848/HumongousAlloc.java	Fri Jun 08 17:28:54 2012 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test Humongous.java
+ * @bug 7168848
+ * @summary G1: humongous object allocations should initiate marking cycles when necessary
+ * @run main/othervm -Xms100m -Xmx100m -XX:+PrintGC -XX:G1HeapRegionSize=1m -XX:+UseG1GC  HumongousAlloc
+ *
+ */
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.util.List;
+
+public class HumongousAlloc {
+
+    public static byte[] dummy;
+    private static int sleepFreq = 40;
+    private static int sleepTime = 1000;
+    private static double size = 0.75;
+    private static int iterations = 50;
+    private static int MB = 1024 * 1024;
+
+    public static void allocate(int size, int sleepTime, int sleepFreq) throws InterruptedException {
+        System.out.println("Will allocate objects of size: " + size
+                + " bytes and sleep for " + sleepTime
+                + " ms after every " + sleepFreq + "th allocation.");
+        int count = 0;
+        while (count < iterations) {
+            for (int i = 0; i < sleepFreq; i++) {
+                dummy = new byte[size - 16];
+            }
+            Thread.sleep(sleepTime);
+            count++;
+        }
+    }
+
+    public static void main(String[] args) throws InterruptedException {
+        allocate((int) (size * MB), sleepTime, sleepFreq);
+        List<GarbageCollectorMXBean> collectors = ManagementFactory.getGarbageCollectorMXBeans();
+        for (GarbageCollectorMXBean collector : collectors) {
+            if (collector.getName().contains("G1 Old")) {
+               long count = collector.getCollectionCount();
+                if (count > 0) {
+                    throw new RuntimeException("Failed: FullGCs should not have happened. The number of FullGC run is " + count);
+                }
+                else {
+                    System.out.println("Passed.");
+                }
+            }
+        }
+    }
+}
+
--- a/jaxp/.hgtags	Fri Jun 08 17:25:46 2012 -0700
+++ b/jaxp/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38
 f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39
 9ecfdbd6aed4702674eaede2023b4a19513d6b36 jdk8-b40
+6f5c0e17415de7a9c74900ef4ba12f47accdf88b jdk8-b41
--- a/jaxws/.hgtags	Fri Jun 08 17:25:46 2012 -0700
+++ b/jaxws/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38
 7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39
 09a0ddda03cb36deb6ee9edf789da12aa4674c6b jdk8-b40
+f2072b164b0519227833a2994f78e3988ee67827 jdk8-b41
--- a/jdk/.hgtags	Fri Jun 08 17:25:46 2012 -0700
+++ b/jdk/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38
 b6f52911752110a2889681923992c7a0baa52ccc jdk8-b39
 b88fc3359dc7edabfa8a228855d8cebf8843c055 jdk8-b40
+4eac56f073ea8179b1a35fcd2af9b48b0088be9f jdk8-b41
--- a/langtools/.hgtags	Fri Jun 08 17:25:46 2012 -0700
+++ b/langtools/.hgtags	Fri Jun 08 17:28:54 2012 -0700
@@ -162,3 +162,4 @@
 1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38
 a9f547c218d957306dfc0cdd710be041bb62a555 jdk8-b39
 86e0dad6aadf626bf5755f503aee2d0da525d9d5 jdk8-b40
+179fa85aeefab338cccf1cbe8b494c59bc5df122 jdk8-b41