changeset 14308:9a5191a2e798

Merge
author lana
date Wed, 31 Oct 2012 09:25:20 -0700
parents 2378cc5c46cc 40cfabf65fc7
children 425e2c6b5941
files jdk/src/share/classes/sun/net/www/protocol/gopher/GopherClient.java jdk/src/share/classes/sun/net/www/protocol/gopher/Handler.java jdk/src/share/classes/sun/security/tools/CertAndKeyGen.java jdk/src/share/classes/sun/security/tools/JarSigner.java jdk/src/share/classes/sun/security/tools/JarSignerResources.java jdk/src/share/classes/sun/security/tools/JarSignerResources_ja.java jdk/src/share/classes/sun/security/tools/JarSignerResources_zh_CN.java jdk/src/share/classes/sun/security/tools/KeyTool.java jdk/src/share/classes/sun/security/tools/TimestampedSigner.java jdk/src/windows/classes/java/io/Win32FileSystem.java jdk/src/windows/native/java/io/Win32FileSystem_md.c jdk/test/com/sun/jndi/ldap/LdapsReadTimeoutTest.java jdk/test/com/sun/jndi/ldap/ReadTimeoutTest.java
diffstat 409 files changed, 66137 insertions(+), 17086 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Oct 30 12:47:35 2012 +0100
+++ b/.hgtags	Wed Oct 31 09:25:20 2012 -0700
@@ -182,3 +182,4 @@
 479d3302a26d7607ba271d66973e59ebf58825b6 jdk8-b58
 3bd874584fc01aae92fbc8827e2bd04d8b6ace04 jdk8-b59
 5e3adc681779037a2d33b7be6f75680619085492 jdk8-b60
+cdaa6122185f9bf512dcd6600f56bfccc4824e8c jdk8-b61
--- a/.hgtags-top-repo	Tue Oct 30 12:47:35 2012 +0100
+++ b/.hgtags-top-repo	Wed Oct 31 09:25:20 2012 -0700
@@ -182,3 +182,4 @@
 9367024804874faf8e958adeb333682bab1c0c47 jdk8-b58
 dae9821589ccd2611bdf7084269b98e819091770 jdk8-b59
 e07f499b9dccb529ecf74172cf6ac11a195ec57a jdk8-b60
+20ff117b509075c3aec4ee3a57990ecd5db5df9c jdk8-b61
--- a/README-builds.html	Tue Oct 30 12:47:35 2012 +0100
+++ b/README-builds.html	Wed Oct 31 09:25:20 2012 -0700
@@ -96,7 +96,8 @@
                                 </li>
                                 <li>Windows only:
                                     <ul>
-                                        <li>Unix Command Tools (<a href="#cygwin">CYGWIN</a>)</li>
+                                        <li>Unix Command Tools (<a href="#cygwin">CYGWIN</a>) <strong>or</strong></li>
+                                        <li>Minimalist GNU for Windows (<a href="#msys">MinGW/MSYS</a>)</li>
                                         <li><a href="#dxsdk">DirectX 9.0 SDK</a> </li>
                                     </ul>
                                 </li>
@@ -161,7 +162,7 @@
         <blockquote>
             This file often describes specific requirements for what we call the
             "minimum build environments" (MBE) for this 
-	    specific release of the JDK,
+            specific release of the JDK,
             Building with the MBE will generate the most compatible
             bits that install on, and run correctly on, the most variations
             of the same base OS and hardware architecture.
@@ -241,16 +242,16 @@
                 </tbody>
             </table>
             <p>
-	    These same sources do indeed build on many more systems than the
-	    above older generation systems, again the above is just a minimum.
+            These same sources do indeed build on many more systems than the
+            above older generation systems, again the above is just a minimum.
             <p>
-	    Compilation problems with newer or different C/C++ compilers is a
-	    common problem.
-	    Similarly, compilation problems related to changes to the
+            Compilation problems with newer or different C/C++ compilers is a
+            common problem.
+            Similarly, compilation problems related to changes to the
                 <tt>/usr/include</tt> or system header files is also a
-	    common problem with newer or unreleased OS versions.
-	    Please report these types of problems as bugs so that they
-	    can be dealt with accordingly.
+            common problem with newer or unreleased OS versions.
+            Please report these types of problems as bugs so that they
+            can be dealt with accordingly.
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <hr>
@@ -266,15 +267,15 @@
             <p>
             <blockquote>
                 After installing <a href="http://fedoraproject.org">Fedora</a> 9
-	      you need to install several build dependencies. The simplest
-	      way to do it is to execute the following commands as user 
+              you need to install several build dependencies. The simplest
+              way to do it is to execute the following commands as user 
                 <tt>root</tt>:
                 <p/>
                 <code>yum-builddep java-1.6.0-openjdk</code>
                 <p/>
                 <code>yum install gcc gcc-c++</code>
                 <p/>
-	      In addition, it's necessary to set a few environment variables for the build:
+              In addition, it's necessary to set a few environment variables for the build:
 
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-openjdk</code>
@@ -283,15 +284,15 @@
             <p>
             <blockquote>
                 After installing <a href="http://fedoraproject.org">Fedora</a> 10
-	      you need to install several build dependencies. The simplest
-	      way to do it is to execute the following commands as user 
+              you need to install several build dependencies. The simplest
+              way to do it is to execute the following commands as user 
                 <tt>root</tt>:
                 <p/>
                 <code>yum-builddep java-1.6.0-openjdk</code>
                 <p/>
                 <code>yum install gcc gcc-c++</code>
                 <p/>
-	      In addition, it's necessary to set a few environment variables for the build:
+              In addition, it's necessary to set a few environment variables for the build:
 
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-openjdk</code>
@@ -300,15 +301,15 @@
             <p>
             <blockquote>
                 After installing <a href="http://fedoraproject.org">Fedora</a> 11
-	      you need to install several build dependencies. The simplest
-	      way to do it is to execute the following commands as user 
+              you need to install several build dependencies. The simplest
+              way to do it is to execute the following commands as user 
                 <tt>root</tt>:
                 <p/>
                 <code>yum-builddep java-1.6.0-openjdk</code>
                 <p/>
                 <code>yum install gcc gcc-c++</code>
                 <p/>
-	      In addition, it's necessary to set a few environment variables for the build:
+              In addition, it's necessary to set a few environment variables for the build:
 
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-openjdk</code>
@@ -360,16 +361,16 @@
             <h4>Debian 5.0 (Lenny)</h4>
             <p>
             <blockquote>
-		After installing <a href="http://debian.org">Debian</a> 5 
-		you need to install several build dependencies. 
-		The simplest way to install the build dependencies is to 
-		execute the following commands as user <tt>root</tt>:
+                After installing <a href="http://debian.org">Debian</a> 5 
+                you need to install several build dependencies. 
+                The simplest way to install the build dependencies is to 
+                execute the following commands as user <tt>root</tt>:
                 <p/>
                 <code>aptitude build-dep openjdk-6</code>
                 <p/>
                 <code>aptitude install openjdk-6-jdk libmotif-dev</code>
                 <p/>
-		In addition, it's necessary to set a few environment variables for the build:
+                In addition, it's necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk</code>
             </blockquote>
@@ -380,52 +381,52 @@
             <h4>Ubuntu 8.04</h4>
             <p>
             <blockquote>
-		After installing <a href="http://ubuntu.org">Ubuntu</a> 8.04 
-		you need to install several build dependencies. 
+                After installing <a href="http://ubuntu.org">Ubuntu</a> 8.04 
+                you need to install several build dependencies. 
                 <p/>
-		First, you need to enable the universe repository in the 
-		Software Sources application and reload the repository 
-		information. The Software Sources application is available 
-		under the System/Administration menu. 
+                First, you need to enable the universe repository in the 
+                Software Sources application and reload the repository 
+                information. The Software Sources application is available 
+                under the System/Administration menu. 
                 <p/>
-		The simplest way to install the build dependencies is to 
-		execute the following commands:
+                The simplest way to install the build dependencies is to 
+                execute the following commands:
                 <p/>
                 <code>sudo aptitude build-dep openjdk-6</code>
                 <p/>
                 <code>sudo aptitude install openjdk-6-jdk</code>
                 <p/>
-		In addition, it's necessary to set a few environment variables for the build:
+                In addition, it's necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk</code>
             </blockquote>
             <h4>Ubuntu 8.10</h4>
             <p>
             <blockquote>
-		After installing <a href="http://ubuntu.org">Ubuntu</a> 8.10 
-		you need to install several build dependencies. The simplest
-		way to do it is to execute the following commands:
+                After installing <a href="http://ubuntu.org">Ubuntu</a> 8.10 
+                you need to install several build dependencies. The simplest
+                way to do it is to execute the following commands:
                 <p/>
                 <code>sudo aptitude build-dep openjdk-6</code>
                 <p/>
                 <code>sudo aptitude install openjdk-6-jdk</code>
                 <p/>
-		In addition, it's necessary to set a few environment variables for the build:
+                In addition, it's necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk</code>
             </blockquote>
             <h4>Ubuntu 9.04</h4>
             <p>
             <blockquote>
-		After installing <a href="http://ubuntu.org">Ubuntu</a> 9.04 
-		you need to install several build dependencies. The simplest
-		way to do it is to execute the following commands:
+                After installing <a href="http://ubuntu.org">Ubuntu</a> 9.04 
+                you need to install several build dependencies. The simplest
+                way to do it is to execute the following commands:
                 <p/>
                 <code>sudo aptitude build-dep openjdk-6</code>
                 <p/>
                 <code>sudo aptitude install openjdk-6-jdk</code>
                 <p/>
-		In addition, it's necessary to set a few environment variables for the build:
+                In addition, it's necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk</code>
             </blockquote>
@@ -436,20 +437,20 @@
             <h4>OpenSUSE 11.1</h4>
             <p>
             <blockquote>
-		After installing <a href="http://opensuse.org">OpenSUSE</a> 11.1 
-		you need to install several build dependencies. 
-		The simplest way to install the build dependencies is to 
-		execute the following commands:
+                After installing <a href="http://opensuse.org">OpenSUSE</a> 11.1 
+                you need to install several build dependencies. 
+                The simplest way to install the build dependencies is to 
+                execute the following commands:
                 <p/>
                 <code>sudo zypper source-install -d java-1_6_0-openjdk</code>
                 <p/>
                 <code>sudo zypper install make</code>
                 <p/>
-		In addition, it is necessary to set a few environment variables for the build:
+                In addition, it is necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-1.6.0-openjdk</code>
                 <p/>
-		Finally, you need to unset the <code>JAVA_HOME</code> environment variable:
+                Finally, you need to unset the <code>JAVA_HOME</code> environment variable:
                 <p/>
                 <code>export -n JAVA_HOME</code>
             </blockquote>
@@ -460,14 +461,14 @@
             <h4>Mandriva Linux One 2009 Spring</h4>
             <p>
             <blockquote>
-		After installing <a href="http://mandriva.org">Mandriva</a> Linux One 2009 Spring 
-		you need to install several build dependencies. 
-		The simplest way to install the build dependencies is to 
-		execute the following commands as user <tt>root</tt>:
+                After installing <a href="http://mandriva.org">Mandriva</a> Linux One 2009 Spring 
+                you need to install several build dependencies. 
+                The simplest way to install the build dependencies is to 
+                execute the following commands as user <tt>root</tt>:
                 <p/>
                 <code>urpmi java-1.6.0-openjdk-devel ant make gcc gcc-c++ freetype-devel zip unzip libcups2-devel libxrender1-devel libalsa2-devel libstc++-static-devel libxtst6-devel libxi-devel</code>
                 <p/>
-		In addition, it is necessary to set a few environment variables for the build:
+                In addition, it is necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-1.6.0-openjdk</code>
             </blockquote>
@@ -478,18 +479,18 @@
             <h4>OpenSolaris 2009.06</h4>
             <p>
             <blockquote>
-		After installing <a href="http://opensolaris.org">OpenSolaris</a> 2009.06 
-		you need to install several build dependencies. 
-		The simplest way to install the build dependencies is to 
-		execute the following commands:
+                After installing <a href="http://opensolaris.org">OpenSolaris</a> 2009.06 
+                you need to install several build dependencies. 
+                The simplest way to install the build dependencies is to 
+                execute the following commands:
                 <p/>
                 <code>pfexec pkg install SUNWgmake SUNWj6dev SUNWant sunstudioexpress SUNWcups SUNWzip SUNWunzip SUNWxwhl SUNWxorg-headers SUNWaudh SUNWfreetype2</code>
                 <p/>
-		In addition, it is necessary to set a few environment variables for the build:
+                In addition, it is necessary to set a few environment variables for the build:
                 <p/>
                 <code>export LANG=C ALT_COMPILER_PATH=/opt/SunStudioExpress/bin/ ALT_CUPS_HEADERS_PATH=/usr/include/</code>
                 <p/>
-		Finally, you need to make sure that the build process can find the Sun Studio compilers:
+                Finally, you need to make sure that the build process can find the Sun Studio compilers:
                 <p/>
                 <code>export PATH=$PATH:/opt/SunStudioExpress/bin/</code>
             </blockquote>
@@ -687,31 +688,20 @@
                 </li>
                 <li>
                     <strong>Windows:</strong>
-                    Make sure you start your build inside a bash/sh/ksh shell
-                    and are using a <tt>make.exe</tt> utility built for that
-                    environment (a cygwin <tt>make.exe</tt> is not the same
-                    as a <tt>make.exe</tt> built for something like
-                    <a href="http://www.mkssoftware.com/">MKS</a>). 
-                    <br>
-                    <b>WARNING:</b> Watch out on some make 3.81 versions, it may
-                    not work due to a lack of support for MS-DOS drive letter paths
-                    like <tt>C:/</tt> or <tt>C:\</tt>.
-                    <br>
-                    You may be able to use the information at the
-                    <a href="http://developer.mozilla.org/en/docs/Windows_build_prerequisites_using_cygwin#make" target="_blank">
-                        mozilla developer center</a>
-                    on this topic.
-                    <br>
-                    It's hoped that when make 3.82 starts shipping in a future cygwin
-                    release that this MS-DOS path issue will be fixed.
-                    <br>
-                    It may be possible to download the version at
-                    <a href="http://www.cmake.org/files/cygwin/make.exe">
-                        www.cmake.org make.exe</a>.
-                    <br>
-                    It might be necessary for you to build your own GNU make 3.81,
-                    see the <a href="#buildgmake">"Building GNU make"</a> section
-                    in that case.
+                    Make sure you start your build inside a bash/sh/ksh shell and are
+                    using a <tt>make.exe</tt> utility built for that environment.<br/>
+                    <strong>MKS</strong> builds need a native Windows version of GNU make
+                    (see <a href="#buildgmake">Building GNU make</a>).<br/>
+                    <strong>Cygwin</strong> builds need
+                    a make version which was specially compiled for the Cygwin environment
+                    (see <a href="#buildgmake">Building GNU make</a>). <strong>WARNING:</strong>
+                    the OpenJDK build with the make utility provided by Cygwin will <strong>not</strong>
+                    work because it does not support drive letters in paths. Make sure that
+                    your version of make will be found before the Cygwins default make by 
+                    setting an appropriate <tt>PATH</tt> environment variable or by removing
+                    Cygwin's make after you built your own make version.<br/>
+                    <strong>MinGW/MSYS</strong> builds can use the default make which 
+                    comes with the environment.
                 </li>
             </ul>
             <p>
@@ -727,7 +717,7 @@
             <!-- ------------------------------------------------------ -->
             <h4><a name="buildgmake">Building GNU make</a></h4>
             <blockquote>
-                First step is to get the GNU make 3.81 source from
+                First step is to get the GNU make 3.81 (or newer) source from
                 <a href="http://ftp.gnu.org/pub/gnu/make/" target="_blank">
                     ftp.gnu.org/pub/gnu/make/</a>.
                 Building is a little different depending on the OS and unix toolset
@@ -742,12 +732,24 @@
                         <tt>./configure && gmake CC=gcc</tt>
                     </li>
                     <li>
-                        <strong>Windows for CYGWIN:</strong>
-                        <tt>./configure && make</tt>
+                        <strong>Windows for CYGWIN:</strong><br/>
+                        <tt>./configure</tt><br/>
+                        Add the line <tt>#define HAVE_CYGWIN_SHELL 1</tt> to the end of <tt>config.h</tt><br/>
+                        <tt>make</tt><br/>
+                        <br/>
+                        This should produce <tt>make.exe</tt> in the current directory.
                     </li>
                     <li>
-                        <strong>Windows for MKS: (CYGWIN is recommended)</strong>
-                        <tt>./configure && make -f Makefile.win32</tt>
+                        <strong>Windows for MKS:</strong><br/>
+                        Edit <tt>config.h.W32</tt> and uncomment the line <tt>#define HAVE_MKS_SHELL 1</tt><br/>
+                        Set the environment for your native compiler (e.g. by calling:<br/>
+                        <tt>"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /Release /xp /x64)</tt>
+                        <tt>nmake -f NMakefile.win32</tt>
+                        <br/>
+                        This should produce <tt>WinDebug/make.exe</tt> and <tt>WinRel/make.exe</tt>
+                        <br/>
+                        If you get the error: <tt>NMAKE : fatal error U1045: spawn failed : Permission denied</tt>
+                        you have to set the <tt>Read &amp; execute</tt> permission for the file <tt>subproc.bat</tt>.
                     </li>
                 </ul>
             </blockquote>
@@ -894,39 +896,135 @@
         <h4><a name="paths">Windows Paths</a></h4>
         <blockquote>
             <strong>Windows:</strong>
-            Note that GNU make is a historic utility and is based very
-            heavily on shell scripting, so it does not tolerate the Windows habit
+            Note that GNU make, the shell and other Unix-tools required during the build
+            do not tolerate the Windows habit
             of having spaces in pathnames or the use of the <tt>\</tt>characters in pathnames.
-            Luckily on most Windows systems, you can use <tt>/</tt>instead of \, and
-            there is always a 'short' pathname without spaces for any path that 
-            contains spaces.
-            Unfortunately, this short pathname can be somewhat dynamic and the
-            formula is difficult to explain.
-            You can use <tt>cygpath</tt> utility to map pathnames with spaces
-            or the <tt>\</tt>character into the <tt>C:/</tt> style of pathname
-            (called 'mixed'), e.g.
-            <tt>cygpath -s -m "<i>path</i>"</tt>.
+            Luckily on most Windows systems, you can use <tt>/</tt>instead of <tt>\</tt>, and
+            there is always a short <a href="http://en.wikipedia.org/wiki/8.3_filename">
+	    "8.3" pathname</a> without spaces for any path that contains spaces.
+            Unfortunately, this short pathname is somewhat dynamic (i.e. dependant on the
+            other files and directories inside a given directory) and can not be 
+            algorithmicly calculated by only looking at a specific path name.
             <p>
                 The makefiles will try to translate any pathnames supplied
                 to it into the <tt>C:/</tt> style automatically.
+            </p>
             <p>
-                Note that use of CYGWIN creates a unique problem with regards to
+                Special care has to be taken if native Windows applications
+                like <tt>nmake</tt> or <tt>cl</tt> are called with file arguments processed
+                by Unix-tools like <tt>make</tt> or <tt>sh</tt>!
+            </p>
+        </blockquote>
+        <!-- ------------------------------------------------------ -->
+        <h4><a name="paths">Windows build environments</a></h4>
+        <blockquote>
+            Building on Windows requires a Unix-like environment, notably a Unix-like shell.
+            There are several such environments available of which 
+            <a href="http://www.mkssoftware.com/products/tk/ds_tkdev.asp">MKS</a>, 
+            <a href="http://www.cygwin.com/">Cygwin</a> and 
+            <a href="http://www.mingw.org/wiki/MSYS">MinGW/MSYS</a> are currently supported for
+            the OpenJDK build. One of the differences of these three systems is the way
+            they handle Windows path names, particularly path names which contain
+            spaces, backslashes as path separators and possibly drive letters. Depending
+            on the use case and the specifics of each environment these path problems can
+            be solved by a combination of quoting whole paths, translating backslashes to
+            forward slashes, escaping backslashes with additional backslashes and
+            translating the path names to their <a href="http://en.wikipedia.org/wiki/8.3_filename">
+	    "8.3" version</a>.
+            <p>
+                As of this writing (MKS ver. 9.4, Cygwin ver. 1.7.9, MinGW/MSYS 1.0.17),
+                MKS builds are known to be the fastest Windows builds while MingGW/MSYS
+                builds are slightly slower (about 10%) than MKS builds and Cygwin builds
+                require nearly twice the time (about 180%) of MKS builds (e.g. on a
+                DualCore i7 notebook with 8GB of RAM, HDD and 64-bit Windows 7 operating system
+                the complete OpenJDK 8 product build takes about 49min with MKS, 54min with
+                MinGW/MSYS and 88min with Cygwin).
+            </p>
+            <p>
+                Mixing tools from the different Unix emulation environments is not a good
+                idea and will probably not work!
+            </p>
+            <p>
+                <strong>MKS:</strong> is a commercial product which includes
+                all the Unix utilities which are required to build the OpenJDK except GNU
+                make. In pre-OpenJDK times it was the only supported build environment on
+                Windows. The MKS tools support Windows paths with drive letters and
+                forward slashes as path separator. Paths in environment variables like (for
+                example) <tt>PATH</tt> are separated by semicolon '<tt>;</tt>'.
+            </p>
+            <p>
+                Recent versions of MKS provide the <tt>dosname</tt> utility to convert paths
+                with spaces to short (8.3) path names,e .g.
+                <tt>dosname -s "<i>path</i>"</tt>.   
+            </p>
+            <p>
+                If you are using the MKS environment, you need a native Windows version
+                of Gnu make <a href="#buildgmake">which you can easily build yourself</a>. 
+            </p>
+            <p>
+                <strong>Cygwin:</strong>
+                is an open source, Linux-like environment which tries to emulate
+                a complete POSIX layer on Windows. It tries to be smart about path names
+                and can usually handle all kinds of paths if they are correctly quoted
+                or escaped although internally it maps drive letters <tt>&lt;drive&gt;:</tt> 
+                to a virtual directory <tt>/cygdrive/&lt;drive&gt;</tt>.
+            </p>
+            <p>
+                You can always use the <tt>cygpath</tt> utility to map pathnames with spaces
+                or the backslash character into the <tt>C:/</tt> style of pathname
+                (called 'mixed'), e.g. <tt>cygpath -s -m "<i>path</i>"</tt>.
+            </p>
+            <p>
+                Note that the use of CYGWIN creates a unique problem with regards to
                 setting <a href="#path"><tt>PATH</tt></a>. Normally on Windows
                 the <tt>PATH</tt> variable contains directories
-                separated with the ";" character (Solaris and Linux uses ":").
+                separated with the ";" character (Solaris and Linux use ":").
                 With CYGWIN, it uses ":", but that means that paths like "C:/path"
                 cannot be placed in the CYGWIN version  of <tt>PATH</tt> and
                 instead CYGWIN uses something like <tt>/cygdrive/c/path</tt>
                 which CYGWIN understands, but only CYGWIN understands.
-                So be careful with paths on Windows.
+            </p>
+            <p>
+                If you are using the Cygwin environment, you need to 
+                <a href="#buildgmake">compile your own version</a>
+                of GNU make because the default Cygwin make can not handle drive letters in paths. 
+            </p>
+            <p>
+                <strong>MinGW/MSYS:</strong> 
+                MinGW ("Minimalist GNU for Windows") is a collection of free Windows
+                specific header files and import libraries combined with GNU toolsets that
+                allow one to produce native Windows programs that do not rely on any
+                3rd-party C runtime DLLs. MSYS is a supplement to MinGW which allows building
+                applications and programs which rely on traditional UNIX tools to
+                be present. Among others this includes tools like <tt>bash</tt> and <tt>make</tt>.
+            </p>
+            <p>
+                Like Cygwin, MinGW/MSYS can handle different types of path formats. They
+                are internally converted to paths with forward slashes and drive letters
+                <tt>&lt;drive&gt;:</tt> replaced by a virtual
+                directory <tt>/&lt;drive&gt;</tt>.  Additionally, MSYS automatically
+                detects binaries compiled for the MSYS environment and feeds them with the
+                internal, Unix-style path names. If native Windows applications are called
+                from within MSYS programs their path arguments are automatically converted
+                back to Windows style path names with drive letters and backslashes as
+                path separators. This may cause problems for Windows applications which
+                use forward slashes as parameter separator (e.g. <tt>cl /nologo /I</tt>)
+                because MSYS may wrongly <a href="http://mingw.org/wiki/Posix_path_conversion">
+                replace such parameters by drive letters</a>.
+            </p>
+            <p>
+                If you are using the MinGW/MSYS system you can use the default make
+                version supplied by the environment.
+            </p>
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <h4><a name="windows_checklist">Basic Windows Check List</a></h4>
         <blockquote>
             <ol>
                 <li>
-                    Install the
-                    <a href="#cygwin">CYGWIN product</a>. 
+                    Install one of the 
+                    <a href="#cygwin">CYGWIN</a>, <a href="#msys">MinGW/MSYS</a> or 
+                    <a href="http://www.mkssoftware.com/products/tk/ds_tkdev.asp">MKS</a> environments. 
                 </li>
                 <li>
                     Install the 
@@ -1097,9 +1195,9 @@
                     <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.htm" target="_blank">
                         Sun Studio 12 Update 1 Compilers</a>
                     (containing version 5.10 of the C and C++ compilers) is required,
-		    including specific patches.
+                    including specific patches.
                     <p>
-		    The Solaris SPARC patch list is:
+                    The Solaris SPARC patch list is:
                     <ul>
                         <li>
                             118683-05: SunOS 5.10: Patch for profiling libraries and assembler
@@ -1286,7 +1384,8 @@
                     The XRender header file is included with the other X11 header files
                     in the package <strong>SFWxwinc</strong> on new enough versions of
                     Solaris and will be installed in
-                    <tt>/usr/X11/include/X11/extensions/Xrender.h</tt>
+                    <tt>/usr/X11/include/X11/extensions/Xrender.h</tt> or
+                    <tt>/usr/openwin/share/include/X11/extensions/Xrender.h</tt>
                 </p><p>
                     <strong>Linux:</strong>
                     XRender header files are required for building the
@@ -1456,7 +1555,9 @@
                                 <td>Devel</td>
                                 <td>make</td>
                                 <td>The GNU version of the 'make' utility built for CYGWIN.<br>
-                                    <b>NOTE</b>: See <a href="#gmake">the GNU make section</a></td>
+                                    <b>NOTE</b>: the Cygwin make can not be used to build the 
+                                    OpenJDK.  You only need it to build your own version of make 
+                                    (see <a href="#gmake">the GNU make section</a>)</td>
                             </tr>
                             <tr>
                                 <td>m4.exe</td>
@@ -1521,6 +1622,21 @@
                     So it's important that the Visual Studio paths in PATH preceed
                     the CYGWIN path <tt>/usr/bin</tt>.
             </blockquote>
+            <strong> Minimalist GNU for Windows (<a name="msys">MinGW/MSYS</a>)</strong>
+            <blockquote> 
+                Alternatively, the set of unix command tools for the OpenJDK build on 
+                Windows can be supplied by 
+                <a href="http://www.mingw.org/wiki/MSYS" target="_blank">MinGW/MSYS</a>.
+                <p>
+                    In addition to the tools which will be installed by default, you have
+                    to manually install the <tt>msys-zip</tt> and <tt>msys-unzip</tt> packages.
+                    This can be easily done with the MinGW command line installer:<br/>
+                    <tt><br/>
+                        mingw-get.exe install msys-zip<br/>
+                        mingw-get.exe install msys-unzip<br/>
+                    </tt>
+                </p>
+            </blockquote>
             <strong><a name="dxsdk">Microsoft DirectX 9.0 SDK header files and libraries</a></strong>
             <blockquote>
                 Microsoft DirectX 9.0 SDK (Summer 2004)
@@ -1781,10 +1897,10 @@
                 </dd>
                 <dt><a name="ALT_OPENWIN_HOME"><tt>ALT_OPENWIN_HOME</tt></a></dt>
                 <dd>
-		    The top-level directory of the libraries and include files for the platform's 
-		    graphical programming environment. The default location is platform specific. 
-		    For example, on Linux it defaults to <tt>/usr/X11R6/</tt>.
-		</dd>
+                    The top-level directory of the libraries and include files for the platform's 
+                    graphical programming environment. The default location is platform specific. 
+                    For example, on Linux it defaults to <tt>/usr/X11R6/</tt>.
+                </dd>
                 <dt><strong>Windows specific:</strong></dt>
                 <dd>
                     <dl>
@@ -1792,9 +1908,9 @@
                         <dd>
                             The location of the 
                             Microsoft Windows SDK where some tools will be
-			    located.
-			    The default is whatever WINDOWSSDKDIR is set to
-			    (or WindowsSdkDir) or the path
+                            located.
+                            The default is whatever WINDOWSSDKDIR is set to
+                            (or WindowsSdkDir) or the path
                             <br>
                             <tt>c:\Program Files\Microsoft SDKs\Windows\v7.0a</tt>
                         </dd>
@@ -1823,17 +1939,17 @@
                             is that <a href="#ALT_COMPILER_PATH"><tt>ALT_COMPILER_PATH</tt></a> is set
                             to point to the cross-compiler and that any cross-compilation specific flags
                             are passed using <a href="#EXTRA_CFLAGS"><tt>EXTRA_CFLAGS</tt></a>.
-			    The <a href="#ALT_OPENWIN_HOME"><tt>ALT_OPENWIN_HOME</tt></a> variable should 
-			    also be set to point to the graphical header files (e.g. X11) provided with 
-			    the cross-compiler.
+                            The <a href="#ALT_OPENWIN_HOME"><tt>ALT_OPENWIN_HOME</tt></a> variable should 
+                            also be set to point to the graphical header files (e.g. X11) provided with 
+                            the cross-compiler.
                             When cross-compiling we skip execution of any demos etc that may be built, and
                             also skip binary-file verification.
                         </dd>
                         <dt><tt><a name="EXTRA_CFLAGS">EXTRA_CFLAGS</a></tt> </dt>
                         <dd>
-			   Used to pass cross-compilation options to the cross-compiler.
+                           Used to pass cross-compilation options to the cross-compiler.
                            These are added to the <tt>CFLAGS</tt> and <tt>CXXFLAGS</tt> variables. 
-			</dd>
+                        </dd>
                         <dt><tt><a name="USE_ONLY_BOOTDIR_TOOLS">USE_ONLY_BOOTDIR_TOOLS</a></tt> </dt>
                         <dd>
                             Used primarily for cross-compilation builds (and always set in that case)
@@ -1868,23 +1984,23 @@
                         <dt><tt><a name="BUILD_HEADLESS_ONLY"></a>BUILD_HEADLESS_ONLY</tt> </dt>
                         <dd>
                             Used when the build environment has no graphical capabilities at all. This
-			    excludes building anything that requires graphical libraries to be available.
+                            excludes building anything that requires graphical libraries to be available.
                         </dd>
                         <dt><tt><a name="JAVASE_EMBEDDED"></a>JAVASE_EMBEDDED</tt> </dt>
                         <dd>
-			    Used to indicate this is a build of the Oracle Java SE Embedded product. 
-			    This will enable the directives included in the SE-Embedded specific build 
-			    files.
+                            Used to indicate this is a build of the Oracle Java SE Embedded product. 
+                            This will enable the directives included in the SE-Embedded specific build 
+                            files.
                         </dd>
                         <dt><tt><a name="LIBZIP_CAN_USE_MMAP">LIBZIP_CAN_USE_MMAP</a></tt> </dt>
                         <dd>
-			    If set to false, disables the use of mmap by the zip utility. Otherwise,
-	                    mmap will be used.
+                            If set to false, disables the use of mmap by the zip utility. Otherwise,
+                            mmap will be used.
                         </dd>
                         <dt><tt><a name="COMPRESS_JARS"></a>COMPRESS_JARS</tt> </dt>
                         <dd>
-			  If set to true, causes certain jar files that would otherwise be built without
-			  compression, to use compression.
+                          If set to true, causes certain jar files that would otherwise be built without
+                          compression, to use compression.
                         </dd>
                     </dl>
                 </dd>
--- a/corba/.hgtags	Tue Oct 30 12:47:35 2012 +0100
+++ b/corba/.hgtags	Wed Oct 31 09:25:20 2012 -0700
@@ -182,3 +182,4 @@
 18462a19f7bd66d38015f61ea549a5e0c0c889a3 jdk8-b58
 d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
 207ef43ba69ead6cbbab415d81834545e4d46747 jdk8-b60
+0e08ba7648fb3faa0986cb217887d7c4990977f3 jdk8-b61
--- a/corba/make/common/shared/Defs-utils.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/corba/make/common/shared/Defs-utils.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -151,16 +151,26 @@
 ifeq ($(PLATFORM),windows)
   ifdef USING_CYGWIN
     # Intrinsic unix command, with backslash-escaped character interpretation
-    ECHO = $(UNIXCOMMAND_PATH)echo -e
-    ZIPEXE = $(UNIXCOMMAND_PATH)zip
-    UNZIP  = $(UNIXCOMMAND_PATH)unzip
+    ECHO     = $(UNIXCOMMAND_PATH)echo -e
+    ZIPEXE   = $(UNIXCOMMAND_PATH)zip
+    UNZIP    = $(UNIXCOMMAND_PATH)unzip
+    # Some CYGWIN nawk versions require BINMODE=w for proper '\r' interpretation
+    NAWK     = $(UNIXCOMMAND_PATH)awk -v BINMODE=w
   else
-    ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
-    UNZIP  = $(UTILS_DEVTOOL_PATH)unzip
+    ifdef USING_MSYS
+      ECHO   = $(UTILS_COMMAND_PATH)echo -e
+      ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
+      UNZIP  = $(UTILS_DEVTOOL_PATH)unzip
+      NAWK   = $(UNIXCOMMAND_PATH)awk
+    else
+      ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
+      UNZIP  = $(UTILS_DEVTOOL_PATH)unzip
+      NAWK   = $(UNIXCOMMAND_PATH)awk
+    endif
   endif
   # Re-define some utilities
   LEX            =# override GNU Make intrinsic: no lex on windows
-  NAWK           = $(UNIXCOMMAND_PATH)awk
+  SHA1SUM        = $(UNIXCOMMAND_PATH)openssl sha1
 endif
 
 # Linux specific
--- a/corba/make/common/shared/Defs-windows.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/corba/make/common/shared/Defs-windows.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -91,6 +91,15 @@
 $(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1"; else echo "$1"; fi)
 endef
 else
+ifdef USING_MSYS
+DOSPATH_CMD:=$(shell cd $(JDK_TOPDIR) 2> $(DEV_NULL) && pwd)/make/tools/msys_build_scripts/dospath.sh
+define FullPath
+$(subst \,/,$(shell $(DOSPATH_CMD) $1))
+endef
+define OptFullPath
+$(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
+endef
+else
 # Temporary until we upgrade to MKS 8.7, MKS pwd returns mixed mode path
 define FullPath
 $(shell cd $1 2> $(DEV_NULL) && pwd)
@@ -99,6 +108,7 @@
 $(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
 endef
 endif
+endif
 
 # System drive
 ifdef SYSTEMDRIVE
@@ -112,14 +122,21 @@
 
 # UNIXCOMMAND_PATH: path to where the most common Unix commands are.
 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
-ifndef UNIXCOMMAND_PATH
-  ifdef ALT_UNIXCOMMAND_PATH
+#        With cygwin, use this as is; don't use FullPath on it.
+ifdef ALT_UNIXCOMMAND_PATH
+  ifdef USING_CYGWIN
+    UNIXCOMMAND_PATH       :=$(call PrefixPath,$(ALT_UNIXCOMMAND_PATH))
+  else
     xALT_UNIXCOMMAND_PATH  :="$(subst \,/,$(ALT_UNIXCOMMAND_PATH))"
     fxALT_UNIXCOMMAND_PATH :=$(call FullPath,$(xALT_UNIXCOMMAND_PATH))
     UNIXCOMMAND_PATH       :=$(call PrefixPath,$(fxALT_UNIXCOMMAND_PATH))
+  endif
+else
+  ifdef USING_CYGWIN
+    UNIXCOMMAND_PATH :=$(call PrefixPath,/usr/bin)
   else
-    ifdef USING_CYGWIN
-      UNIXCOMMAND_PATH :=$(call PrefixPath,/usr/bin)
+    ifdef USING_MSYS
+      UNIXCOMMAND_PATH :=$(call PrefixPath,/bin)
     else
       ifdef ROOTDIR
         xROOTDIR :="$(subst \,/,$(ROOTDIR))"
@@ -131,41 +148,35 @@
       ifneq ($(_rootdir),)
         UNIXCOMMAND_PATH :=$(call PrefixPath,$(_rootdir)/mksnt)
       endif
-    endif
-  endif
-  UNIXCOMMAND_PATH:=$(call AltCheckSpaces,UNIXCOMMAND_PATH)
-  export UNIXCOMMAND_PATH
+    endif # USING_MSYS
+  endif # USING_CYGWIN
 endif
+UNIXCOMMAND_PATH:=$(call AltCheckSpaces,UNIXCOMMAND_PATH)
+export UNIXCOMMAND_PATH
 
 # Get version of MKS or CYGWIN
-ifdef USING_CYGWIN
-  ifndef CYGWIN_VER
-    _CYGWIN_VER :=$(shell $(UNAME))
-    CYGWIN_VER  :=$(call GetVersion,$(_CYGWIN_VER))
-    export CYGWIN_VER
+ifdef USING_MKS
+  _MKS_VER :=$(shell $(MKSINFO) 2>&1 | $(GREP) Release | $(TAIL) -1 | $(SED) -e 's@.*\(Release.*\)@\1@')
+  MKS_VER  :=$(call GetVersion,$(_MKS_VER))
+  # At this point, we can re-define FullPath to use DOSNAME_CMD
+  CHECK_MKS87:=$(call CheckVersions,$(MKS_VER),8.7)
+  TRY_DOSNAME:=false
+  ifeq ($(CHECK_MKS87),same)
+    TRY_DOSNAME:=true
   endif
-else # MKS
-_MKS_VER :=$(shell $(MKSINFO) 2>&1 | $(GREP) Release | $(TAIL) -1 | $(SED) -e 's@.*\(Release.*\)@\1@')
-MKS_VER  :=$(call GetVersion,$(_MKS_VER))
-# At this point, we can re-define FullPath to use DOSNAME_CMD
-CHECK_MKS87:=$(call CheckVersions,$(MKS_VER),8.7)
-TRY_DOSNAME:=false
-ifeq ($(CHECK_MKS87),same)
-TRY_DOSNAME:=true
-endif
-# Newer should be ok
-ifeq ($(CHECK_MKS87),newer)
-TRY_DOSNAME:=true
-endif
-ifeq ($(TRY_DOSNAME),true)
-ifeq ($(shell $(UNIXCOMMAND_PATH)dosname -s $(_system_drive)/ 2> $(DEV_NULL)),$(_system_drive)/)
-_DOSNAME=$(UNIXCOMMAND_PATH)dosname
-DOSNAME_CMD:=$(_DOSNAME) -s
+  # Newer should be ok
+  ifeq ($(CHECK_MKS87),newer)
+    TRY_DOSNAME:=true
+  endif
+  ifeq ($(TRY_DOSNAME),true)
+    ifeq ($(shell $(UNIXCOMMAND_PATH)dosname -s $(_system_drive)/ 2> $(DEV_NULL)),$(_system_drive)/)
+      _DOSNAME=$(UNIXCOMMAND_PATH)dosname
+      DOSNAME_CMD:=$(_DOSNAME) -s
 define FullPath
 $(subst //,/,$(shell echo $1 | $(DOSNAME_CMD) 2> $(DEV_NULL)))
 endef
-endif # test dosname -s
-endif # TRY_DOSNAME
+    endif # test dosname -s
+  endif # TRY_DOSNAME
 endif # MKS
 
 # We try to get references to what we need via the default component
@@ -240,6 +251,8 @@
 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
 ifndef DEVTOOLS_PATH
+  # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
+  #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
   ifdef ALT_DEVTOOLS_PATH
     xALT_DEVTOOLS_PATH  :="$(subst \,/,$(ALT_DEVTOOLS_PATH))"
     fxALT_DEVTOOLS_PATH :=$(call FullPath,$(xALT_DEVTOOLS_PATH))
@@ -248,10 +261,14 @@
     ifdef USING_CYGWIN
       DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH)
     else
-      xDEVTOOLS_PATH  :="$(_system_drive)/utils"
-      fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH))
-      DEVTOOLS_PATH  :=$(call PrefixPath,$(fxDEVTOOLS_PATH))
-    endif
+      ifdef USING_MSYS
+        DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH)
+      else
+        xDEVTOOLS_PATH  :="$(_system_drive)/utils"
+        fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH))
+        DEVTOOLS_PATH  :=$(call PrefixPath,$(fxDEVTOOLS_PATH))
+      endif # USING_MSYS
+    endif # USING_CYGWIN
   endif
   DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH)
   export DEVTOOLS_PATH
--- a/corba/make/common/shared/Platform.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/corba/make/common/shared/Platform.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -65,6 +65,8 @@
 #     REQUIRED_WINDOWS_NAME       windows only: basic name of windows
 #     REQUIRED_WINDOWS_VERSION    windows only: specific version of windows
 #     USING_CYGWIN                windows only: true or false
+#     USING_MSYS                  windows only: true or false
+#     USING_MKS                   windows only: true or false
 #     WINDOWS_NT_VERSION_STRING   windows only: long version name
 #     REQUIRED_OS_VERSION         required OS version, e.g. 5.10, 2.4
 #     REQUIRED_FREE_SPACE         minimum disk space needed for outputdir
@@ -327,6 +329,8 @@
 # Windows with and without CYGWIN will be slightly different
 ifeq ($(SYSTEM_UNAME), Windows_NT)
   PLATFORM = windows
+  USING_MKS = true
+  export USING_MKS
   OS_VERSION := $(shell uname -r)
   WINDOWS_NT_VERSION_STRING=Windows_NT
   REQUIRED_MKS_VER=6.1
@@ -339,6 +343,11 @@
   WINDOWS_NT_VERSION_STRING=CYGWIN_NT
   REQUIRED_CYGWIN_VER=4.0
 endif
+ifneq (,$(findstring MINGW,$(SYSTEM_UNAME)))
+  PLATFORM = windows
+  USING_MSYS = true
+  export USING_MSYS
+endif
 
 # Platform settings specific to Windows
 ifeq ($(PLATFORM), windows)
--- a/hotspot/.hgtags	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/.hgtags	Wed Oct 31 09:25:20 2012 -0700
@@ -285,3 +285,5 @@
 1cc7a2a11d00832e3d07f81f3744a6883422db7e hs25-b04
 3cfd05b2219a29649741a52637696f06acf24a4e jdk8-b60
 b261523fe66c40a02968f0aa7e73602491bb3386 hs25-b05
+4547dc71db765276e027b0c2780b724bae0a07d3 jdk8-b61
+d0337c31c8be7716369b4e7c3bd5f352983c6a06 hs25-b06
--- a/hotspot/make/hotspot_version	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/make/hotspot_version	Wed Oct 31 09:25:20 2012 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=05
+HS_BUILD_NUMBER=06
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -67,7 +67,7 @@
 
 #define JAVA_CLASSFILE_MAGIC              0xCAFEBABE
 #define JAVA_MIN_SUPPORTED_VERSION        45
-#define JAVA_MAX_SUPPORTED_VERSION        51
+#define JAVA_MAX_SUPPORTED_VERSION        52
 #define JAVA_MAX_SUPPORTED_MINOR_VERSION  0
 
 // Used for two backward compatibility reasons:
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -413,8 +413,7 @@
 }
 
 bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
-  assert(SharedSkipVerify ||
-         java_string->klass() == SystemDictionary::String_klass(),
+  assert(java_string->klass() == SystemDictionary::String_klass(),
          "must be java_string");
   typeArrayOop value  = java_lang_String::value(java_string);
   int          offset = java_lang_String::offset(java_string);
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -1699,6 +1699,9 @@
   blk->do_oop(&_system_loader_lock_obj);
 
   dictionary()->always_strong_oops_do(blk);
+
+  // Visit extra methods
+  invoke_method_table()->oops_do(blk);
 }
 
 void SystemDictionary::always_strong_classes_do(KlassClosure* closure) {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -2395,7 +2395,7 @@
 
   if (VerifyBeforeGC &&
       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-    Universe::verify(true);
+    Universe::verify();
   }
 
   // Snapshot the soft reference policy to be used in this collection cycle.
@@ -2419,7 +2419,7 @@
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
           gclog_or_tty->print("Verify before initial mark: ");
-          Universe::verify(true);
+          Universe::verify();
         }
         {
           bool res = markFromRoots(false);
@@ -2431,7 +2431,7 @@
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
           gclog_or_tty->print("Verify before re-mark: ");
-          Universe::verify(true);
+          Universe::verify();
         }
         checkpointRootsFinal(false, clear_all_soft_refs,
                              init_mark_was_synchronous);
@@ -2443,7 +2443,7 @@
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
           gclog_or_tty->print("Verify before sweep: ");
-          Universe::verify(true);
+          Universe::verify();
         }
         sweep(false);
         assert(_collectorState == Resizing, "Incorrect state");
@@ -2459,7 +2459,7 @@
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
           gclog_or_tty->print("Verify before reset: ");
-          Universe::verify(true);
+          Universe::verify();
         }
         reset(false);
         assert(_collectorState == Idling, "Collector state should "
@@ -2486,7 +2486,7 @@
 
   if (VerifyAfterGC &&
       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-    Universe::verify(true);
+    Universe::verify();
   }
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
@@ -5668,7 +5668,7 @@
   if (VerifyDuringGC &&
       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    Universe::verify(true);
+    Universe::verify();
   }
   {
     TraceTime t("root rescan", PrintGCDetails, false, gclog_or_tty);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -64,7 +64,7 @@
     FreelistLocker x(_collector);
     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
     Universe::heap()->prepare_for_verify();
-    Universe::verify(true);
+    Universe::verify();
   }
 }
 
@@ -74,7 +74,7 @@
     HandleMark hm;
     FreelistLocker x(_collector);
     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
-    Universe::verify(true);
+    Universe::verify();
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -426,11 +426,11 @@
   _markStack(this),
   // _finger set in set_non_marking_state
 
-  _max_task_num(MAX2((uint)ParallelGCThreads, 1U)),
+  _max_worker_id(MAX2((uint)ParallelGCThreads, 1U)),
   // _active_tasks set in set_non_marking_state
   // _tasks set inside the constructor
-  _task_queues(new CMTaskQueueSet((int) _max_task_num)),
-  _terminator(ParallelTaskTerminator((int) _max_task_num, _task_queues)),
+  _task_queues(new CMTaskQueueSet((int) _max_worker_id)),
+  _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)),
 
   _has_overflown(false),
   _concurrent(false),
@@ -481,17 +481,17 @@
 
   _root_regions.init(_g1h, this);
 
-  _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_task_num, mtGC);
-  _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_task_num, mtGC);
-
-  _count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap,  _max_task_num, mtGC);
-  _count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_task_num, mtGC);
+  _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC);
+  _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC);
+
+  _count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap,  _max_worker_id, mtGC);
+  _count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC);
 
   BitMap::idx_t card_bm_size = _card_bm.size();
 
   // so that the assertion in MarkingTaskQueue::task_queue doesn't fail
-  _active_tasks = _max_task_num;
-  for (int i = 0; i < (int) _max_task_num; ++i) {
+  _active_tasks = _max_worker_id;
+  for (uint i = 0; i < _max_worker_id; ++i) {
     CMTaskQueue* task_queue = new CMTaskQueue();
     task_queue->initialize();
     _task_queues->register_queue(i, task_queue);
@@ -638,7 +638,7 @@
   // We do reset all of them, since different phases will use
   // different number of active threads. So, it's easiest to have all
   // of them ready.
-  for (int i = 0; i < (int) _max_task_num; ++i) {
+  for (uint i = 0; i < _max_worker_id; ++i) {
     _tasks[i]->reset(_nextMarkBitMap);
   }
 
@@ -648,7 +648,7 @@
 }
 
 void ConcurrentMark::set_phase(uint active_tasks, bool concurrent) {
-  assert(active_tasks <= _max_task_num, "we should not have more");
+  assert(active_tasks <= _max_worker_id, "we should not have more");
 
   _active_tasks = active_tasks;
   // Need to update the three data structures below according to the
@@ -659,7 +659,7 @@
 
   _concurrent = concurrent;
   // We propagate this to all tasks, not just the active ones.
-  for (int i = 0; i < (int) _max_task_num; ++i)
+  for (uint i = 0; i < _max_worker_id; ++i)
     _tasks[i]->set_concurrent(concurrent);
 
   if (concurrent) {
@@ -818,9 +818,9 @@
  * doesn't manipulate any data structures afterwards.
  */
 
-void ConcurrentMark::enter_first_sync_barrier(int task_num) {
+void ConcurrentMark::enter_first_sync_barrier(uint worker_id) {
   if (verbose_low()) {
-    gclog_or_tty->print_cr("[%d] entering first barrier", task_num);
+    gclog_or_tty->print_cr("[%u] entering first barrier", worker_id);
   }
 
   if (concurrent()) {
@@ -834,11 +834,11 @@
   // more work
 
   if (verbose_low()) {
-    gclog_or_tty->print_cr("[%d] leaving first barrier", task_num);
+    gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id);
   }
 
-  // let task 0 do this
-  if (task_num == 0) {
+  // let the task associated with with worker 0 do this
+  if (worker_id == 0) {
     // task 0 is responsible for clearing the global data structures
     // We should be here because of an overflow. During STW we should
     // not clear the overflow flag since we rely on it being true when
@@ -858,9 +858,9 @@
   // then go into the second barrier
 }
 
-void ConcurrentMark::enter_second_sync_barrier(int task_num) {
+void ConcurrentMark::enter_second_sync_barrier(uint worker_id) {
   if (verbose_low()) {
-    gclog_or_tty->print_cr("[%d] entering second barrier", task_num);
+    gclog_or_tty->print_cr("[%u] entering second barrier", worker_id);
   }
 
   if (concurrent()) {
@@ -873,7 +873,7 @@
   // at this point everything should be re-initialised and ready to go
 
   if (verbose_low()) {
-    gclog_or_tty->print_cr("[%d] leaving second barrier", task_num);
+    gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id);
   }
 }
 
@@ -1120,8 +1120,8 @@
     HandleMark hm;  // handle scope
     gclog_or_tty->print(" VerifyDuringGC:(before)");
     Universe::heap()->prepare_for_verify();
-    Universe::verify(/* silent      */ false,
-                     /* option      */ VerifyOption_G1UsePrevMarking);
+    Universe::verify(/* silent */ false,
+                     /* option */ VerifyOption_G1UsePrevMarking);
   }
 
   G1CollectorPolicy* g1p = g1h->g1_policy();
@@ -1159,8 +1159,8 @@
       HandleMark hm;  // handle scope
       gclog_or_tty->print(" VerifyDuringGC:(after)");
       Universe::heap()->prepare_for_verify();
-      Universe::verify(/* silent      */ false,
-                       /* option      */ VerifyOption_G1UseNextMarking);
+      Universe::verify(/* silent */ false,
+                       /* option */ VerifyOption_G1UseNextMarking);
     }
     assert(!restart_for_overflow(), "sanity");
   }
@@ -1811,8 +1811,8 @@
     HandleMark hm;  // handle scope
     gclog_or_tty->print(" VerifyDuringGC:(before)");
     Universe::heap()->prepare_for_verify();
-    Universe::verify(/* silent      */ false,
-                     /* option      */ VerifyOption_G1UsePrevMarking);
+    Universe::verify(/* silent */ false,
+                     /* option */ VerifyOption_G1UsePrevMarking);
   }
 
   G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
@@ -1966,8 +1966,8 @@
     HandleMark hm;  // handle scope
     gclog_or_tty->print(" VerifyDuringGC:(after)");
     Universe::heap()->prepare_for_verify();
-    Universe::verify(/* silent      */ false,
-                     /* option      */ VerifyOption_G1UsePrevMarking);
+    Universe::verify(/* silent */ false,
+                     /* option */ VerifyOption_G1UsePrevMarking);
   }
 
   g1h->verify_region_sets_optional();
@@ -2113,9 +2113,9 @@
     if (!_cm->has_overflown()) {
       oop obj = oopDesc::load_decode_heap_oop(p);
       if (_cm->verbose_high()) {
-        gclog_or_tty->print_cr("\t[%d] we're looking at location "
+        gclog_or_tty->print_cr("\t[%u] we're looking at location "
                                "*"PTR_FORMAT" = "PTR_FORMAT,
-                               _task->task_id(), p, (void*) obj);
+                               _task->worker_id(), p, (void*) obj);
       }
 
       _task->deal_with_reference(obj);
@@ -2144,7 +2144,7 @@
       }
     } else {
       if (_cm->verbose_high()) {
-         gclog_or_tty->print_cr("\t[%d] CM Overflow", _task->task_id());
+         gclog_or_tty->print_cr("\t[%u] CM Overflow", _task->worker_id());
       }
     }
   }
@@ -2160,8 +2160,8 @@
   void do_void() {
     do {
       if (_cm->verbose_high()) {
-        gclog_or_tty->print_cr("\t[%d] Drain: Calling do marking_step",
-                               _task->task_id());
+        gclog_or_tty->print_cr("\t[%u] Drain: Calling do marking_step",
+                               _task->worker_id());
       }
 
       // We call CMTask::do_marking_step() to completely drain the local and
@@ -2300,7 +2300,7 @@
     // We use the work gang from the G1CollectedHeap and we utilize all
     // the worker threads.
     uint active_workers = g1h->workers() ? g1h->workers()->active_workers() : 1U;
-    active_workers = MAX2(MIN2(active_workers, _max_task_num), 1U);
+    active_workers = MAX2(MIN2(active_workers, _max_worker_id), 1U);
 
     G1CMRefProcTaskExecutor par_task_executor(g1h, this,
                                               g1h->workers(), active_workers);
@@ -2619,7 +2619,7 @@
 }
 
 HeapRegion*
-ConcurrentMark::claim_region(int task_num) {
+ConcurrentMark::claim_region(uint worker_id) {
   // "checkpoint" the finger
   HeapWord* finger = _finger;
 
@@ -2657,10 +2657,10 @@
     HeapWord*   limit         = curr_region->next_top_at_mark_start();
 
     if (verbose_low()) {
-      gclog_or_tty->print_cr("[%d] curr_region = "PTR_FORMAT" "
+      gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" "
                              "["PTR_FORMAT", "PTR_FORMAT"), "
                              "limit = "PTR_FORMAT,
-                             task_num, curr_region, bottom, end, limit);
+                             worker_id, curr_region, bottom, end, limit);
     }
 
     // Is the gap between reading the finger and doing the CAS too long?
@@ -2673,22 +2673,22 @@
       assert(_finger >= end, "the finger should have moved forward");
 
       if (verbose_low()) {
-        gclog_or_tty->print_cr("[%d] we were successful with region = "
-                               PTR_FORMAT, task_num, curr_region);
+        gclog_or_tty->print_cr("[%u] we were successful with region = "
+                               PTR_FORMAT, worker_id, curr_region);
       }
 
       if (limit > bottom) {
         if (verbose_low()) {
-          gclog_or_tty->print_cr("[%d] region "PTR_FORMAT" is not empty, "
-                                 "returning it ", task_num, curr_region);
+          gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, "
+                                 "returning it ", worker_id, curr_region);
         }
         return curr_region;
       } else {
         assert(limit == bottom,
                "the region limit should be at bottom");
         if (verbose_low()) {
-          gclog_or_tty->print_cr("[%d] region "PTR_FORMAT" is empty, "
-                                 "returning NULL", task_num, curr_region);
+          gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, "
+                                 "returning NULL", worker_id, curr_region);
         }
         // we return NULL and the caller should try calling
         // claim_region() again.
@@ -2697,10 +2697,10 @@
     } else {
       assert(_finger > finger, "the finger should have moved forward");
       if (verbose_low()) {
-        gclog_or_tty->print_cr("[%d] somebody else moved the finger, "
+        gclog_or_tty->print_cr("[%u] somebody else moved the finger, "
                                "global finger = "PTR_FORMAT", "
                                "our finger = "PTR_FORMAT,
-                               task_num, _finger, finger);
+                               worker_id, _finger, finger);
       }
 
       // read it again
@@ -2783,7 +2783,7 @@
     _markStack.oops_do(&cl);
 
     // Verify entries on the task queues
-    for (int i = 0; i < (int) _max_task_num; i += 1) {
+    for (uint i = 0; i < _max_worker_id; i += 1) {
       cl.set_phase(VerifyNoCSetOopsQueues, i);
       OopTaskQueue* queue = _task_queues->queue(i);
       queue->oops_do(&cl);
@@ -2822,7 +2822,7 @@
     }
 
     // Verify the task fingers
-    assert(parallel_marking_threads() <= _max_task_num, "sanity");
+    assert(parallel_marking_threads() <= _max_worker_id, "sanity");
     for (int i = 0; i < (int) parallel_marking_threads(); i += 1) {
       CMTask* task = _tasks[i];
       HeapWord* task_finger = task->finger();
@@ -2849,7 +2849,7 @@
   }
   _finger = _heap_start;
 
-  for (int i = 0; i < (int)_max_task_num; ++i) {
+  for (uint i = 0; i < _max_worker_id; ++i) {
     OopTaskQueue* queue = _task_queues->queue(i);
     queue->set_empty();
   }
@@ -2862,15 +2862,15 @@
   ConcurrentMark* _cm;
   CardTableModRefBS* _ct_bs;
   BitMap* _cm_card_bm;
-  size_t _max_task_num;
+  uint _max_worker_id;
 
  public:
   AggregateCountDataHRClosure(G1CollectedHeap* g1h,
                               BitMap* cm_card_bm,
-                              size_t max_task_num) :
+                              uint max_worker_id) :
     _g1h(g1h), _cm(g1h->concurrent_mark()),
     _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
-    _cm_card_bm(cm_card_bm), _max_task_num(max_task_num) { }
+    _cm_card_bm(cm_card_bm), _max_worker_id(max_worker_id) { }
 
   bool doHeapRegion(HeapRegion* hr) {
     if (hr->continuesHumongous()) {
@@ -2927,7 +2927,7 @@
     uint hrs_index = hr->hrs_index();
     size_t marked_bytes = 0;
 
-    for (int i = 0; (size_t)i < _max_task_num; i += 1) {
+    for (uint i = 0; i < _max_worker_id; i += 1) {
       size_t* marked_bytes_array = _cm->count_marked_bytes_array_for(i);
       BitMap* task_card_bm = _cm->count_card_bitmap_for(i);
 
@@ -2935,7 +2935,7 @@
       // add it to the running total for this region.
       marked_bytes += marked_bytes_array[hrs_index];
 
-      // Now union the bitmaps[0,max_task_num)[start_idx..limit_idx)
+      // Now union the bitmaps[0,max_worker_id)[start_idx..limit_idx)
       // into the global card bitmap.
       BitMap::idx_t scan_idx = task_card_bm->get_next_one_offset(start_idx, limit_idx);
 
@@ -2967,22 +2967,22 @@
   G1CollectedHeap* _g1h;
   ConcurrentMark* _cm;
   BitMap* _cm_card_bm;
-  size_t _max_task_num;
+  uint _max_worker_id;
   int _active_workers;
 
 public:
   G1AggregateCountDataTask(G1CollectedHeap* g1h,
                            ConcurrentMark* cm,
                            BitMap* cm_card_bm,
-                           size_t max_task_num,
+                           uint max_worker_id,
                            int n_workers) :
     AbstractGangTask("Count Aggregation"),
     _g1h(g1h), _cm(cm), _cm_card_bm(cm_card_bm),
-    _max_task_num(max_task_num),
+    _max_worker_id(max_worker_id),
     _active_workers(n_workers) { }
 
   void work(uint worker_id) {
-    AggregateCountDataHRClosure cl(_g1h, _cm_card_bm, _max_task_num);
+    AggregateCountDataHRClosure cl(_g1h, _cm_card_bm, _max_worker_id);
 
     if (G1CollectedHeap::use_parallel_gc_threads()) {
       _g1h->heap_region_par_iterate_chunked(&cl, worker_id,
@@ -3001,7 +3001,7 @@
                         1);
 
   G1AggregateCountDataTask g1_par_agg_task(_g1h, this, &_card_bm,
-                                           _max_task_num, n_workers);
+                                           _max_worker_id, n_workers);
 
   if (G1CollectedHeap::use_parallel_gc_threads()) {
     assert(_g1h->check_heap_region_claim_values(HeapRegion::InitialClaimValue),
@@ -3030,9 +3030,9 @@
   _region_bm.clear();
 
   uint max_regions = _g1h->max_regions();
-  assert(_max_task_num != 0, "unitialized");
-
-  for (int i = 0; (size_t) i < _max_task_num; i += 1) {
+  assert(_max_worker_id > 0, "uninitialized");
+
+  for (uint i = 0; i < _max_worker_id; i += 1) {
     BitMap* task_card_bm = count_card_bitmap_for(i);
     size_t* marked_bytes_array = count_marked_bytes_array_for(i);
 
@@ -3062,7 +3062,7 @@
   clear_all_count_data();
   // Empty mark stack
   clear_marking_state();
-  for (int i = 0; i < (int)_max_task_num; ++i) {
+  for (uint i = 0; i < _max_worker_id; ++i) {
     _tasks[i]->clear_region_fields();
   }
   _has_aborted = true;
@@ -3154,8 +3154,8 @@
 void ConcurrentMark::print_finger() {
   gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
                          _heap_start, _heap_end, _finger);
-  for (int i = 0; i < (int) _max_task_num; ++i) {
-    gclog_or_tty->print("   %d: "PTR_FORMAT, i, _tasks[i]->finger());
+  for (uint i = 0; i < _max_worker_id; ++i) {
+    gclog_or_tty->print("   %u: "PTR_FORMAT, i, _tasks[i]->finger());
   }
   gclog_or_tty->print_cr("");
 }
@@ -3165,8 +3165,8 @@
   assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
 
   if (_cm->verbose_high()) {
-    gclog_or_tty->print_cr("[%d] we're scanning object "PTR_FORMAT,
-                           _task_id, (void*) obj);
+    gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
+                           _worker_id, (void*) obj);
   }
 
   size_t obj_size = obj->size();
@@ -3245,8 +3245,8 @@
         "claim_region() should have filtered out continues humongous regions");
 
   if (_cm->verbose_low()) {
-    gclog_or_tty->print_cr("[%d] setting up for region "PTR_FORMAT,
-                           _task_id, hr);
+    gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT,
+                           _worker_id, hr);
   }
 
   _curr_region  = hr;
@@ -3261,9 +3261,9 @@
 
   if (limit == bottom) {
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] found an empty region "
+      gclog_or_tty->print_cr("[%u] found an empty region "
                              "["PTR_FORMAT", "PTR_FORMAT")",
-                             _task_id, bottom, limit);
+                             _worker_id, bottom, limit);
     }
     // The region was collected underneath our feet.
     // We set the finger to bottom to ensure that the bitmap
@@ -3294,8 +3294,8 @@
 void CMTask::giveup_current_region() {
   assert(_curr_region != NULL, "invariant");
   if (_cm->verbose_low()) {
-    gclog_or_tty->print_cr("[%d] giving up region "PTR_FORMAT,
-                           _task_id, _curr_region);
+    gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT,
+                           _worker_id, _curr_region);
   }
   clear_region_fields();
 }
@@ -3321,7 +3321,7 @@
   guarantee(nextMarkBitMap != NULL, "invariant");
 
   if (_cm->verbose_low()) {
-    gclog_or_tty->print_cr("[%d] resetting", _task_id);
+    gclog_or_tty->print_cr("[%u] resetting", _worker_id);
   }
 
   _nextMarkBitMap                = nextMarkBitMap;
@@ -3415,9 +3415,9 @@
   _all_clock_intervals_ms.add(last_interval_ms);
 
   if (_cm->verbose_medium()) {
-      gclog_or_tty->print_cr("[%d] regular clock, interval = %1.2lfms, "
+      gclog_or_tty->print_cr("[%u] regular clock, interval = %1.2lfms, "
                         "scanned = %d%s, refs reached = %d%s",
-                        _task_id, last_interval_ms,
+                        _worker_id, last_interval_ms,
                         _words_scanned,
                         (_words_scanned >= _words_scanned_limit) ? " (*)" : "",
                         _refs_reached,
@@ -3449,8 +3449,8 @@
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
   if (!_draining_satb_buffers && satb_mq_set.process_completed_buffers()) {
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] aborting to deal with pending SATB buffers",
-                             _task_id);
+      gclog_or_tty->print_cr("[%u] aborting to deal with pending SATB buffers",
+                             _worker_id);
     }
     // we do need to process SATB buffers, we'll abort and restart
     // the marking task to do so
@@ -3475,7 +3475,7 @@
   // scanning limit so that the clock is called earlier.
 
   if (_cm->verbose_medium()) {
-    gclog_or_tty->print_cr("[%d] decreasing limits", _task_id);
+    gclog_or_tty->print_cr("[%u] decreasing limits", _worker_id);
   }
 
   _words_scanned_limit = _real_words_scanned_limit -
@@ -3503,16 +3503,16 @@
 
     if (!_cm->mark_stack_push(buffer, n)) {
       if (_cm->verbose_low()) {
-        gclog_or_tty->print_cr("[%d] aborting due to global stack overflow",
-                               _task_id);
+        gclog_or_tty->print_cr("[%u] aborting due to global stack overflow",
+                               _worker_id);
       }
       set_has_aborted();
     } else {
       // the transfer was successful
 
       if (_cm->verbose_medium()) {
-        gclog_or_tty->print_cr("[%d] pushed %d entries to the global stack",
-                               _task_id, n);
+        gclog_or_tty->print_cr("[%u] pushed %d entries to the global stack",
+                               _worker_id, n);
       }
       statsOnly( int tmp_size = _cm->mark_stack_size();
                  if (tmp_size > _global_max_size) {
@@ -3539,8 +3539,8 @@
 
     statsOnly( ++_global_transfers_from; _global_pops += n );
     if (_cm->verbose_medium()) {
-      gclog_or_tty->print_cr("[%d] popped %d entries from the global stack",
-                             _task_id, n);
+      gclog_or_tty->print_cr("[%u] popped %d entries from the global stack",
+                             _worker_id, n);
     }
     for (int i = 0; i < n; ++i) {
       bool success = _task_queue->push(buffer[i]);
@@ -3575,8 +3575,8 @@
 
   if (_task_queue->size() > target_size) {
     if (_cm->verbose_high()) {
-      gclog_or_tty->print_cr("[%d] draining local queue, target size = %d",
-                             _task_id, target_size);
+      gclog_or_tty->print_cr("[%u] draining local queue, target size = %d",
+                             _worker_id, target_size);
     }
 
     oop obj;
@@ -3585,7 +3585,7 @@
       statsOnly( ++_local_pops );
 
       if (_cm->verbose_high()) {
-        gclog_or_tty->print_cr("[%d] popped "PTR_FORMAT, _task_id,
+        gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
                                (void*) obj);
       }
 
@@ -3603,8 +3603,8 @@
     }
 
     if (_cm->verbose_high()) {
-      gclog_or_tty->print_cr("[%d] drained local queue, size = %d",
-                             _task_id, _task_queue->size());
+      gclog_or_tty->print_cr("[%u] drained local queue, size = %d",
+                             _worker_id, _task_queue->size());
     }
   }
 }
@@ -3631,8 +3631,8 @@
 
   if (_cm->mark_stack_size() > target_size) {
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] draining global_stack, target size %d",
-                             _task_id, target_size);
+      gclog_or_tty->print_cr("[%u] draining global_stack, target size %d",
+                             _worker_id, target_size);
     }
 
     while (!has_aborted() && _cm->mark_stack_size() > target_size) {
@@ -3641,8 +3641,8 @@
     }
 
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] drained global stack, size = %d",
-                             _task_id, _cm->mark_stack_size());
+      gclog_or_tty->print_cr("[%u] drained global stack, size = %d",
+                             _worker_id, _cm->mark_stack_size());
     }
   }
 }
@@ -3663,7 +3663,7 @@
   CMObjectClosure oc(this);
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
   if (G1CollectedHeap::use_parallel_gc_threads()) {
-    satb_mq_set.set_par_closure(_task_id, &oc);
+    satb_mq_set.set_par_closure(_worker_id, &oc);
   } else {
     satb_mq_set.set_closure(&oc);
   }
@@ -3672,9 +3672,9 @@
   // until we run out of buffers or we need to abort.
   if (G1CollectedHeap::use_parallel_gc_threads()) {
     while (!has_aborted() &&
-           satb_mq_set.par_apply_closure_to_completed_buffer(_task_id)) {
+           satb_mq_set.par_apply_closure_to_completed_buffer(_worker_id)) {
       if (_cm->verbose_medium()) {
-        gclog_or_tty->print_cr("[%d] processed an SATB buffer", _task_id);
+        gclog_or_tty->print_cr("[%u] processed an SATB buffer", _worker_id);
       }
       statsOnly( ++_satb_buffers_processed );
       regular_clock_call();
@@ -3683,7 +3683,7 @@
     while (!has_aborted() &&
            satb_mq_set.apply_closure_to_completed_buffer()) {
       if (_cm->verbose_medium()) {
-        gclog_or_tty->print_cr("[%d] processed an SATB buffer", _task_id);
+        gclog_or_tty->print_cr("[%u] processed an SATB buffer", _worker_id);
       }
       statsOnly( ++_satb_buffers_processed );
       regular_clock_call();
@@ -3693,7 +3693,7 @@
   if (!concurrent() && !has_aborted()) {
     // We should only do this during remark.
     if (G1CollectedHeap::use_parallel_gc_threads()) {
-      satb_mq_set.par_iterate_closure_all_threads(_task_id);
+      satb_mq_set.par_iterate_closure_all_threads(_worker_id);
     } else {
       satb_mq_set.iterate_closure_all_threads();
     }
@@ -3706,7 +3706,7 @@
          satb_mq_set.completed_buffers_num() == 0, "invariant");
 
   if (G1CollectedHeap::use_parallel_gc_threads()) {
-    satb_mq_set.set_par_closure(_task_id, NULL);
+    satb_mq_set.set_par_closure(_worker_id, NULL);
   } else {
     satb_mq_set.set_closure(NULL);
   }
@@ -3717,8 +3717,8 @@
 }
 
 void CMTask::print_stats() {
-  gclog_or_tty->print_cr("Marking Stats, task = %d, calls = %d",
-                         _task_id, _calls);
+  gclog_or_tty->print_cr("Marking Stats, task = %u, calls = %d",
+                         _worker_id, _calls);
   gclog_or_tty->print_cr("  Elapsed time = %1.2lfms, Termination time = %1.2lfms",
                          _elapsed_time_ms, _termination_time_ms);
   gclog_or_tty->print_cr("  Step Times (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
@@ -3866,7 +3866,7 @@
   G1CollectorPolicy* g1_policy = _g1h->g1_policy();
   assert(_task_queues != NULL, "invariant");
   assert(_task_queue != NULL, "invariant");
-  assert(_task_queues->queue(_task_id) == _task_queue, "invariant");
+  assert(_task_queues->queue(_worker_id) == _task_queue, "invariant");
 
   assert(!_claimed,
          "only one thread should claim this task at any one time");
@@ -3898,9 +3898,9 @@
   ++_calls;
 
   if (_cm->verbose_low()) {
-    gclog_or_tty->print_cr("[%d] >>>>>>>>>> START, call = %d, "
+    gclog_or_tty->print_cr("[%u] >>>>>>>>>> START, call = %d, "
                            "target = %1.2lfms >>>>>>>>>>",
-                           _task_id, _calls, _time_target_ms);
+                           _worker_id, _calls, _time_target_ms);
   }
 
   // Set up the bitmap and oop closures. Anything that uses them is
@@ -3948,10 +3948,10 @@
       MemRegion mr = MemRegion(_finger, _region_limit);
 
       if (_cm->verbose_low()) {
-        gclog_or_tty->print_cr("[%d] we're scanning part "
+        gclog_or_tty->print_cr("[%u] we're scanning part "
                                "["PTR_FORMAT", "PTR_FORMAT") "
                                "of region "PTR_FORMAT,
-                               _task_id, _finger, _region_limit, _curr_region);
+                               _worker_id, _finger, _region_limit, _curr_region);
       }
 
       // Let's iterate over the bitmap of the part of the
@@ -4007,17 +4007,17 @@
       assert(_finger       == NULL, "invariant");
       assert(_region_limit == NULL, "invariant");
       if (_cm->verbose_low()) {
-        gclog_or_tty->print_cr("[%d] trying to claim a new region", _task_id);
+        gclog_or_tty->print_cr("[%u] trying to claim a new region", _worker_id);
       }
-      HeapRegion* claimed_region = _cm->claim_region(_task_id);
+      HeapRegion* claimed_region = _cm->claim_region(_worker_id);
       if (claimed_region != NULL) {
         // Yes, we managed to claim one
         statsOnly( ++_regions_claimed );
 
         if (_cm->verbose_low()) {
-          gclog_or_tty->print_cr("[%d] we successfully claimed "
+          gclog_or_tty->print_cr("[%u] we successfully claimed "
                                  "region "PTR_FORMAT,
-                                 _task_id, claimed_region);
+                                 _worker_id, claimed_region);
         }
 
         setup_for_region(claimed_region);
@@ -4044,7 +4044,7 @@
            "at this point we should be out of regions");
 
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] all regions claimed", _task_id);
+      gclog_or_tty->print_cr("[%u] all regions claimed", _worker_id);
     }
 
     // Try to reduce the number of available SATB buffers so that
@@ -4068,17 +4068,17 @@
            "only way to reach here");
 
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] starting to steal", _task_id);
+      gclog_or_tty->print_cr("[%u] starting to steal", _worker_id);
     }
 
     while (!has_aborted()) {
       oop obj;
       statsOnly( ++_steal_attempts );
 
-      if (_cm->try_stealing(_task_id, &_hash_seed, obj)) {
+      if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
         if (_cm->verbose_medium()) {
-          gclog_or_tty->print_cr("[%d] stolen "PTR_FORMAT" successfully",
-                                 _task_id, (void*) obj);
+          gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
+                                 _worker_id, (void*) obj);
         }
 
         statsOnly( ++_steals );
@@ -4116,7 +4116,7 @@
     assert(_task_queue->size() == 0, "only way to reach here");
 
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] starting termination protocol", _task_id);
+      gclog_or_tty->print_cr("[%u] starting termination protocol", _worker_id);
     }
 
     _termination_start_time_ms = os::elapsedVTime() * 1000.0;
@@ -4131,7 +4131,7 @@
     if (finished) {
       // We're all done.
 
-      if (_task_id == 0) {
+      if (_worker_id == 0) {
         // let's allow task 0 to do this
         if (concurrent()) {
           assert(_cm->concurrent_marking_in_progress(), "invariant");
@@ -4153,15 +4153,15 @@
       guarantee(!_cm->mark_stack_overflow(), "only way to reach here");
 
       if (_cm->verbose_low()) {
-        gclog_or_tty->print_cr("[%d] all tasks terminated", _task_id);
+        gclog_or_tty->print_cr("[%u] all tasks terminated", _worker_id);
       }
     } else {
       // Apparently there's more work to do. Let's abort this task. It
       // will restart it and we can hopefully find more things to do.
 
       if (_cm->verbose_low()) {
-        gclog_or_tty->print_cr("[%d] apparently there is more work to do",
-                               _task_id);
+        gclog_or_tty->print_cr("[%u] apparently there is more work to do",
+                               _worker_id);
       }
 
       set_has_aborted();
@@ -4200,10 +4200,10 @@
       // will achieve this with the use of two barrier sync points.
 
       if (_cm->verbose_low()) {
-        gclog_or_tty->print_cr("[%d] detected overflow", _task_id);
+        gclog_or_tty->print_cr("[%u] detected overflow", _worker_id);
       }
 
-      _cm->enter_first_sync_barrier(_task_id);
+      _cm->enter_first_sync_barrier(_worker_id);
       // When we exit this sync barrier we know that all tasks have
       // stopped doing marking work. So, it's now safe to
       // re-initialise our data structures. At the end of this method,
@@ -4215,39 +4215,39 @@
       clear_region_fields();
 
       // ...and enter the second barrier.
-      _cm->enter_second_sync_barrier(_task_id);
+      _cm->enter_second_sync_barrier(_worker_id);
       // At this point everything has bee re-initialised and we're
       // ready to restart.
     }
 
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] <<<<<<<<<< ABORTING, target = %1.2lfms, "
+      gclog_or_tty->print_cr("[%u] <<<<<<<<<< ABORTING, target = %1.2lfms, "
                              "elapsed = %1.2lfms <<<<<<<<<<",
-                             _task_id, _time_target_ms, elapsed_time_ms);
+                             _worker_id, _time_target_ms, elapsed_time_ms);
       if (_cm->has_aborted()) {
-        gclog_or_tty->print_cr("[%d] ========== MARKING ABORTED ==========",
-                               _task_id);
+        gclog_or_tty->print_cr("[%u] ========== MARKING ABORTED ==========",
+                               _worker_id);
       }
     }
   } else {
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%d] <<<<<<<<<< FINISHED, target = %1.2lfms, "
+      gclog_or_tty->print_cr("[%u] <<<<<<<<<< FINISHED, target = %1.2lfms, "
                              "elapsed = %1.2lfms <<<<<<<<<<",
-                             _task_id, _time_target_ms, elapsed_time_ms);
+                             _worker_id, _time_target_ms, elapsed_time_ms);
     }
   }
 
   _claimed = false;
 }
 
-CMTask::CMTask(int task_id,
+CMTask::CMTask(uint worker_id,
                ConcurrentMark* cm,
                size_t* marked_bytes,
                BitMap* card_bm,
                CMTaskQueue* task_queue,
                CMTaskQueueSet* task_queues)
   : _g1h(G1CollectedHeap::heap()),
-    _task_id(task_id), _cm(cm),
+    _worker_id(worker_id), _cm(cm),
     _claimed(false),
     _nextMarkBitMap(NULL), _hash_seed(17),
     _task_queue(task_queue),
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -399,9 +399,9 @@
                                     // last claimed region
 
   // marking tasks
-  uint                    _max_task_num; // maximum task number
+  uint                    _max_worker_id;// maximum worker id
   uint                    _active_tasks; // task num currently active
-  CMTask**                _tasks;        // task queue array (max_task_num len)
+  CMTask**                _tasks;        // task queue array (max_worker_id len)
   CMTaskQueueSet*         _task_queues;  // task queue set
   ParallelTaskTerminator  _terminator;   // for termination
 
@@ -492,10 +492,10 @@
   ParallelTaskTerminator* terminator()    { return &_terminator; }
 
   // It claims the next available region to be scanned by a marking
-  // task. It might return NULL if the next region is empty or we have
-  // run out of regions. In the latter case, out_of_regions()
+  // task/thread. It might return NULL if the next region is empty or
+  // we have run out of regions. In the latter case, out_of_regions()
   // determines whether we've really run out of regions or the task
-  // should call claim_region() again.  This might seem a bit
+  // should call claim_region() again. This might seem a bit
   // awkward. Originally, the code was written so that claim_region()
   // either successfully returned with a non-empty region or there
   // were no more regions to be claimed. The problem with this was
@@ -505,7 +505,7 @@
   // method. So, this way, each task will spend very little time in
   // claim_region() and is allowed to call the regular clock method
   // frequently.
-  HeapRegion* claim_region(int task);
+  HeapRegion* claim_region(uint worker_id);
 
   // It determines whether we've run out of regions to scan.
   bool        out_of_regions() { return _finger == _heap_end; }
@@ -537,8 +537,8 @@
   bool has_aborted()             { return _has_aborted; }
 
   // Methods to enter the two overflow sync barriers
-  void enter_first_sync_barrier(int task_num);
-  void enter_second_sync_barrier(int task_num);
+  void enter_first_sync_barrier(uint worker_id);
+  void enter_second_sync_barrier(uint worker_id);
 
   ForceOverflowSettings* force_overflow_conc() {
     return &_force_overflow_conc;
@@ -626,14 +626,14 @@
 
   double all_task_accum_vtime() {
     double ret = 0.0;
-    for (int i = 0; i < (int)_max_task_num; ++i)
+    for (uint i = 0; i < _max_worker_id; ++i)
       ret += _accum_task_vtime[i];
     return ret;
   }
 
   // Attempts to steal an object from the task queues of other tasks
-  bool try_stealing(int task_num, int* hash_seed, oop& obj) {
-    return _task_queues->steal(task_num, hash_seed, obj);
+  bool try_stealing(uint worker_id, int* hash_seed, oop& obj) {
+    return _task_queues->steal(worker_id, hash_seed, obj);
   }
 
   ConcurrentMark(ReservedSpace rs, uint max_regions);
@@ -823,7 +823,7 @@
 
   // Returns the card bitmap for a given task or worker id.
   BitMap* count_card_bitmap_for(uint worker_id) {
-    assert(0 <= worker_id && worker_id < _max_task_num, "oob");
+    assert(0 <= worker_id && worker_id < _max_worker_id, "oob");
     assert(_count_card_bitmaps != NULL, "uninitialized");
     BitMap* task_card_bm = &_count_card_bitmaps[worker_id];
     assert(task_card_bm->size() == _card_bm.size(), "size mismatch");
@@ -833,7 +833,7 @@
   // Returns the array containing the marked bytes for each region,
   // for the given worker or task id.
   size_t* count_marked_bytes_array_for(uint worker_id) {
-    assert(0 <= worker_id && worker_id < _max_task_num, "oob");
+    assert(0 <= worker_id && worker_id < _max_worker_id, "oob");
     assert(_count_marked_bytes != NULL, "uninitialized");
     size_t* marked_bytes_array = _count_marked_bytes[worker_id];
     assert(marked_bytes_array != NULL, "uninitialized");
@@ -939,7 +939,7 @@
     global_stack_transfer_size    = 16
   };
 
-  int                         _task_id;
+  uint                        _worker_id;
   G1CollectedHeap*            _g1h;
   ConcurrentMark*             _cm;
   CMBitMap*                   _nextMarkBitMap;
@@ -1115,8 +1115,8 @@
     _elapsed_time_ms = os::elapsedTime() * 1000.0 - _elapsed_time_ms;
   }
 
-  // returns the task ID
-  int task_id() { return _task_id; }
+  // returns the worker ID associated with this task.
+  uint worker_id() { return _worker_id; }
 
   // From TerminatorTerminator. It determines whether this task should
   // exit the termination protocol after it's entered it.
@@ -1170,7 +1170,7 @@
     _finger = new_finger;
   }
 
-  CMTask(int task_num, ConcurrentMark *cm,
+  CMTask(uint worker_id, ConcurrentMark *cm,
          size_t* marked_bytes, BitMap* card_bm,
          CMTaskQueue* task_queue, CMTaskQueueSet* task_queues);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -279,7 +279,7 @@
   assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
 
   if (_cm->verbose_high()) {
-    gclog_or_tty->print_cr("[%d] pushing "PTR_FORMAT, _task_id, (void*) obj);
+    gclog_or_tty->print_cr("[%u] pushing "PTR_FORMAT, _worker_id, (void*) obj);
   }
 
   if (!_task_queue->push(obj)) {
@@ -287,9 +287,9 @@
     // to the global stack.
 
     if (_cm->verbose_medium()) {
-      gclog_or_tty->print_cr("[%d] task queue overflow, "
+      gclog_or_tty->print_cr("[%u] task queue overflow, "
                              "moving entries to the global stack",
-                             _task_id);
+                             _worker_id);
     }
     move_entries_to_global_stack();
 
@@ -318,8 +318,8 @@
 
 inline void CMTask::deal_with_reference(oop obj) {
   if (_cm->verbose_high()) {
-    gclog_or_tty->print_cr("[%d] we're dealing with reference = "PTR_FORMAT,
-                           _task_id, (void*) obj);
+    gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT,
+                           _worker_id, (void*) obj);
   }
 
   ++_refs_reached;
@@ -335,8 +335,8 @@
       HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
       if (!hr->obj_allocated_since_next_marking(obj)) {
         if (_cm->verbose_high()) {
-          gclog_or_tty->print_cr("[%d] "PTR_FORMAT" is not considered marked",
-                                 _task_id, (void*) obj);
+          gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked",
+                                 _worker_id, (void*) obj);
         }
 
         // we need to mark it first
@@ -350,8 +350,8 @@
 
           if (_finger != NULL && objAddr < _finger) {
             if (_cm->verbose_high()) {
-              gclog_or_tty->print_cr("[%d] below the local finger ("PTR_FORMAT"), "
-                                     "pushing it", _task_id, _finger);
+              gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), "
+                                     "pushing it", _worker_id, _finger);
             }
             push(obj);
           } else if (_curr_region != NULL && objAddr < _region_limit) {
@@ -367,9 +367,9 @@
             // correctness problems.
 
             if (_cm->verbose_high()) {
-              gclog_or_tty->print_cr("[%d] below the global finger "
+              gclog_or_tty->print_cr("[%u] below the global finger "
                                      "("PTR_FORMAT"), pushing it",
-                                     _task_id, global_finger);
+                                     _worker_id, global_finger);
             }
             push(obj);
           } else {
@@ -382,9 +382,9 @@
             // see long comment above
 
             if (_cm->verbose_high()) {
-              gclog_or_tty->print_cr("[%d] below the global finger "
+              gclog_or_tty->print_cr("[%u] below the global finger "
                                      "("PTR_FORMAT"), pushing it",
-                                     _task_id, global_finger);
+                                     _worker_id, global_finger);
             }
             push(obj);
           }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -3388,6 +3388,7 @@
   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
   st->cr();
+  MetaspaceAux::print_on(st);
 }
 
 void G1CollectedHeap::print_extended_on(outputStream* st) const {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -111,9 +111,9 @@
 
   oop obj = oopDesc::load_decode_heap_oop(p);
   if (_cm->verbose_high()) {
-    gclog_or_tty->print_cr("[%d] we're looking at location "
+    gclog_or_tty->print_cr("[%u] we're looking at location "
                            "*"PTR_FORMAT" = "PTR_FORMAT,
-                           _task->task_id(), p, (void*) obj);
+                           _task->worker_id(), p, (void*) obj);
   }
   _task->deal_with_reference(obj);
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -139,7 +139,7 @@
   if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
     gclog_or_tty->print(" VerifyBeforeGC:");
-    Universe::verify(true);
+    Universe::verify();
   }
 
   // Verify object start arrays
@@ -341,7 +341,7 @@
   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
     gclog_or_tty->print(" VerifyAfterGC:");
-    Universe::verify(false);
+    Universe::verify();
   }
 
   // Re-verify object start arrays
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -983,7 +983,7 @@
   if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
     gclog_or_tty->print(" VerifyBeforeGC:");
-    Universe::verify(true);
+    Universe::verify();
   }
 
   // Verify object start arrays
@@ -2184,7 +2184,7 @@
   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
     gclog_or_tty->print(" VerifyAfterGC:");
-    Universe::verify(false);
+    Universe::verify();
   }
 
   // Re-verify object start arrays
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -315,7 +315,7 @@
   if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
     gclog_or_tty->print(" VerifyBeforeGC:");
-    Universe::verify(true);
+    Universe::verify();
   }
 
   {
@@ -639,7 +639,7 @@
   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
     gclog_or_tty->print(" VerifyAfterGC:");
-    Universe::verify(false);
+    Universe::verify();
   }
 
   heap->print_heap_after_gc();
--- a/hotspot/src/share/vm/memory/allocation.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -92,6 +92,26 @@
   return res;
 }
 
+void* ResourceObj::operator new(size_t size, const std::nothrow_t&  nothrow_constant,
+    allocation_type type, MEMFLAGS flags) {
+  //should only call this with std::nothrow, use other operator new() otherwise
+  address res;
+  switch (type) {
+   case C_HEAP:
+    res = (address)AllocateHeap(size, flags, CALLER_PC, AllocFailStrategy::RETURN_NULL);
+    DEBUG_ONLY(if (res!= NULL) set_allocation_type(res, C_HEAP);)
+    break;
+   case RESOURCE_AREA:
+    // new(size) sets allocation type RESOURCE_AREA.
+    res = (address)operator new(size, std::nothrow);
+    break;
+   default:
+    ShouldNotReachHere();
+  }
+  return res;
+}
+
+
 void ResourceObj::operator delete(void* p) {
   assert(((ResourceObj *)p)->allocated_on_C_heap(),
          "delete only allowed for C_HEAP objects");
@@ -506,7 +526,7 @@
 }
 
 // Grow a new Chunk
-void* Arena::grow( size_t x ) {
+void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
   // Get minimal required size.  Either real big, or even bigger for giant objs
   size_t len = MAX2(x, (size_t) Chunk::size);
 
@@ -514,7 +534,10 @@
   _chunk = new (len) Chunk(len);
 
   if (_chunk == NULL) {
-    signal_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow");
+    if (alloc_failmode == AllocFailStrategy::EXIT_OOM) {
+      signal_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow");
+    }
+    return NULL;
   }
   if (k) k->set_next(_chunk);   // Append new chunk to end of linked list
   else _first = _chunk;
@@ -529,13 +552,16 @@
 
 
 // Reallocate storage in Arena.
-void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size) {
+void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size, AllocFailType alloc_failmode) {
   assert(new_size >= 0, "bad size");
   if (new_size == 0) return NULL;
 #ifdef ASSERT
   if (UseMallocOnly) {
     // always allocate a new object  (otherwise we'll free this one twice)
-    char* copy = (char*)Amalloc(new_size);
+    char* copy = (char*)Amalloc(new_size, alloc_failmode);
+    if (copy == NULL) {
+      return NULL;
+    }
     size_t n = MIN2(old_size, new_size);
     if (n > 0) memcpy(copy, old_ptr, n);
     Afree(old_ptr,old_size);    // Mostly done to keep stats accurate
@@ -561,7 +587,10 @@
   }
 
   // Oops, got to relocate guts
-  void *new_ptr = Amalloc(new_size);
+  void *new_ptr = Amalloc(new_size, alloc_failmode);
+  if (new_ptr == NULL) {
+    return NULL;
+  }
   memcpy( new_ptr, c_old, old_size );
   Afree(c_old,old_size);        // Mostly done to keep stats accurate
   return new_ptr;
--- a/hotspot/src/share/vm/memory/allocation.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/allocation.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -53,6 +53,12 @@
   #endif
 #endif
 
+class AllocFailStrategy {
+public:
+  enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
+};
+typedef AllocFailStrategy::AllocFailEnum AllocFailType;
+
 // All classes in the virtual machine must be subclassed
 // by one of the following allocation classes:
 //
@@ -315,7 +321,8 @@
   Chunk *_first;                // First chunk
   Chunk *_chunk;                // current chunk
   char *_hwm, *_max;            // High water mark and max in current chunk
-  void* grow(size_t x);         // Get a new Chunk of at least size x
+  // Get a new Chunk of at least size x
+  void* grow(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
   size_t _size_in_bytes;        // Size of arena (used for native memory tracking)
 
   NOT_PRODUCT(static julong _bytes_allocated;) // total #bytes allocated since start
@@ -350,14 +357,14 @@
   void  operator delete(void* p);
 
   // Fast allocate in the arena.  Common case is: pointer test + increment.
-  void* Amalloc(size_t x) {
+  void* Amalloc(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
     assert(is_power_of_2(ARENA_AMALLOC_ALIGNMENT) , "should be a power of 2");
     x = ARENA_ALIGN(x);
     debug_only(if (UseMallocOnly) return malloc(x);)
     check_for_overflow(x, "Arena::Amalloc");
     NOT_PRODUCT(inc_bytes_allocated(x);)
     if (_hwm + x > _max) {
-      return grow(x);
+      return grow(x, alloc_failmode);
     } else {
       char *old = _hwm;
       _hwm += x;
@@ -365,13 +372,13 @@
     }
   }
   // Further assume size is padded out to words
-  void *Amalloc_4(size_t x) {
+  void *Amalloc_4(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
     assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
     debug_only(if (UseMallocOnly) return malloc(x);)
     check_for_overflow(x, "Arena::Amalloc_4");
     NOT_PRODUCT(inc_bytes_allocated(x);)
     if (_hwm + x > _max) {
-      return grow(x);
+      return grow(x, alloc_failmode);
     } else {
       char *old = _hwm;
       _hwm += x;
@@ -381,7 +388,7 @@
 
   // Allocate with 'double' alignment. It is 8 bytes on sparc.
   // In other cases Amalloc_D() should be the same as Amalloc_4().
-  void* Amalloc_D(size_t x) {
+  void* Amalloc_D(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
     assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
     debug_only(if (UseMallocOnly) return malloc(x);)
 #if defined(SPARC) && !defined(_LP64)
@@ -392,7 +399,7 @@
     check_for_overflow(x, "Arena::Amalloc_D");
     NOT_PRODUCT(inc_bytes_allocated(x);)
     if (_hwm + x > _max) {
-      return grow(x); // grow() returns a result aligned >= 8 bytes.
+      return grow(x, alloc_failmode); // grow() returns a result aligned >= 8 bytes.
     } else {
       char *old = _hwm;
       _hwm += x;
@@ -412,7 +419,8 @@
     if (((char*)ptr) + size == _hwm) _hwm = (char*)ptr;
   }
 
-  void *Arealloc( void *old_ptr, size_t old_size, size_t new_size );
+  void *Arealloc( void *old_ptr, size_t old_size, size_t new_size,
+      AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
 
   // Move contents of this arena into an empty arena
   Arena *move_contents(Arena *empty_arena);
@@ -458,9 +466,12 @@
 
 
 //%note allocation_1
-extern char* resource_allocate_bytes(size_t size);
-extern char* resource_allocate_bytes(Thread* thread, size_t size);
-extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size);
+extern char* resource_allocate_bytes(size_t size,
+    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+extern char* resource_allocate_bytes(Thread* thread, size_t size,
+    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size,
+    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
 extern void resource_free_bytes( char *old, size_t size );
 
 //----------------------------------------------------------------------
@@ -496,6 +507,8 @@
 
  public:
   void* operator new(size_t size, allocation_type type, MEMFLAGS flags);
+  void* operator new(size_t size, const std::nothrow_t&  nothrow_constant,
+      allocation_type type, MEMFLAGS flags);
   void* operator new(size_t size, Arena *arena) {
       address res = (address)arena->Amalloc(size);
       DEBUG_ONLY(set_allocation_type(res, ARENA);)
@@ -506,6 +519,13 @@
       DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
       return res;
   }
+
+  void* operator new(size_t size, const std::nothrow_t& nothrow_constant) {
+      address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL);
+      DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);)
+      return res;
+  }
+
   void  operator delete(void* p);
 };
 
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -48,7 +48,8 @@
 #endif
 
 // allocate using malloc; will fail if no memory available
-inline char* AllocateHeap(size_t size, MEMFLAGS flags, address pc = 0) {
+inline char* AllocateHeap(size_t size, MEMFLAGS flags, address pc = 0,
+    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
   if (pc == 0) {
     pc = CURRENT_PC;
   }
@@ -56,16 +57,17 @@
   #ifdef ASSERT
   if (PrintMallocFree) trace_heap_malloc(size, "AllocateHeap", p);
   #endif
-  if (p == NULL) vm_exit_out_of_memory(size, "AllocateHeap");
+  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "AllocateHeap");
   return p;
 }
 
-inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flags) {
+inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flags,
+    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
   char* p = (char*) os::realloc(old, size, flags, CURRENT_PC);
   #ifdef ASSERT
   if (PrintMallocFree) trace_heap_malloc(size, "ReallocateHeap", p);
   #endif
-  if (p == NULL) vm_exit_out_of_memory(size, "ReallocateHeap");
+  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "ReallocateHeap");
   return p;
 }
 
@@ -91,11 +93,13 @@
 template <MEMFLAGS F> void* CHeapObj<F>::operator new (size_t size,
   const std::nothrow_t&  nothrow_constant, address caller_pc) {
 #ifdef ASSERT
-    void* p = os::malloc(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
+  void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
+      AllocFailStrategy::RETURN_NULL);
     if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
     return p;
 #else
-    return os::malloc(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
+  return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
+      AllocFailStrategy::RETURN_NULL);
 #endif
 }
 
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -447,7 +447,7 @@
             prepared_for_verification = true;
           }
           gclog_or_tty->print(" VerifyBeforeGC:");
-          Universe::verify(true);
+          Universe::verify();
         }
         COMPILER2_PRESENT(DerivedPointerTable::clear());
 
@@ -519,7 +519,7 @@
             total_collections() >= VerifyGCStartAt) {
           HandleMark hm;  // Discard invalid handles created during verification
           gclog_or_tty->print(" VerifyAfterGC:");
-          Universe::verify(false);
+          Universe::verify();
         }
 
         if (PrintGCDetails) {
--- a/hotspot/src/share/vm/memory/resourceArea.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/resourceArea.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -45,15 +45,15 @@
 // The following routines are declared in allocation.hpp and used everywhere:
 
 // Allocation in thread-local resource area
-extern char* resource_allocate_bytes(size_t size) {
-  return Thread::current()->resource_area()->allocate_bytes(size);
+extern char* resource_allocate_bytes(size_t size, AllocFailType alloc_failmode) {
+  return Thread::current()->resource_area()->allocate_bytes(size, alloc_failmode);
 }
-extern char* resource_allocate_bytes(Thread* thread, size_t size) {
-  return thread->resource_area()->allocate_bytes(size);
+extern char* resource_allocate_bytes(Thread* thread, size_t size, AllocFailType alloc_failmode) {
+  return thread->resource_area()->allocate_bytes(size, alloc_failmode);
 }
 
-extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size){
-  return (char*)Thread::current()->resource_area()->Arealloc(old, old_size, new_size);
+extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size, AllocFailType alloc_failmode){
+  return (char*)Thread::current()->resource_area()->Arealloc(old, old_size, new_size, alloc_failmode);
 }
 
 extern void resource_free_bytes( char *old, size_t size ) {
--- a/hotspot/src/share/vm/memory/resourceArea.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/resourceArea.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -68,7 +68,7 @@
     debug_only(_nesting = 0;);
   }
 
-  char* allocate_bytes(size_t size) {
+  char* allocate_bytes(size_t size, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
 #ifdef ASSERT
     if (_nesting < 1 && !_warned++)
       fatal("memory leak: allocating without ResourceMark");
@@ -78,7 +78,7 @@
       return (*save = (char*)os::malloc(size, mtThread));
     }
 #endif
-    return (char*)Amalloc(size);
+    return (char*)Amalloc(size, alloc_failmode);
   }
 
   debug_only(int nesting() const { return _nesting; });
--- a/hotspot/src/share/vm/memory/universe.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -1268,10 +1268,6 @@
 }
 
 void Universe::verify(bool silent, VerifyOption option) {
-  if (SharedSkipVerify) {
-    return;
-  }
-
   // The use of _verify_in_progress is a temporary work around for
   // 6320749.  Don't bother with a creating a class to set and clear
   // it since it is only used in this method and the control flow is
--- a/hotspot/src/share/vm/memory/universe.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/memory/universe.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -435,8 +435,14 @@
 
   // Debugging
   static bool verify_in_progress() { return _verify_in_progress; }
-  static void verify(bool silent = false,
-                     VerifyOption option = VerifyOption_Default );
+  static void verify(bool silent, VerifyOption option);
+  static void verify(bool silent) {
+    verify(silent, VerifyOption_Default /* option */);
+  }
+  static void verify() {
+    verify(false /* silent */);
+  }
+
   static int  verify_count()       { return _verify_count; }
   // The default behavior is to call print_on() on gclog_or_tty.
   static void print();
--- a/hotspot/src/share/vm/oops/klass.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -356,12 +356,11 @@
 }
 
 void Klass::append_to_sibling_list() {
-  debug_only(if (!SharedSkipVerify) verify();)
+  debug_only(verify();)
   // add ourselves to superklass' subklass list
   InstanceKlass* super = superklass();
   if (super == NULL) return;        // special case: class Object
-  assert(SharedSkipVerify ||
-         (!super->is_interface()    // interfaces cannot be supers
+  assert((!super->is_interface()    // interfaces cannot be supers
           && (super->superklass() == NULL || !is_interface())),
          "an interface can only be a subklass of Object");
   Klass* prev_first_subklass = super->subklass_oop();
@@ -371,7 +370,7 @@
   }
   // make ourselves the superklass' first subklass
   super->set_subklass(this);
-  debug_only(if (!SharedSkipVerify) verify();)
+  debug_only(verify();)
 }
 
 void Klass::remove_from_sibling_list() {
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -1135,7 +1135,7 @@
 
     // get offset and field value
     int offset = field->field_offset();
-    address addr = (address)klass + offset;
+    address addr = (address)klass->java_mirror() + offset;
     jvalue value;
     copy_to_jvalue(&value, addr, value_type);
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -3539,10 +3539,6 @@
   product(uintx, SharedDummyBlockSize, 0,                                   \
           "Size of dummy block used to shift heap addresses (in bytes)")    \
                                                                             \
-  diagnostic(bool, SharedSkipVerify, false,                                 \
-          "Skip assert() and verify() which page-in unwanted shared "       \
-          "objects. ")                                                      \
-                                                                            \
   diagnostic(bool, EnableInvokeDynamic, true,                               \
           "support JSR 292 (method handles, invokedynamic, "                \
           "anonymous classes")                                              \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -48,7 +48,7 @@
 oop* HandleArea::allocate_handle(oop obj) {
   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
   assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
-  assert(SharedSkipVerify || obj->is_oop(), "sanity check");
+  assert(obj->is_oop(), "sanity check");
   return real_allocate_handle(obj);
 }
 
--- a/hotspot/src/share/vm/runtime/handles.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/runtime/handles.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -110,11 +110,11 @@
     /* Constructors */                           \
     type##Handle ()                              : Handle()                 {} \
     type##Handle (type##Oop obj) : Handle((oop)obj) {                         \
-      assert(SharedSkipVerify || is_null() || ((oop)obj)->is_a(),             \
+      assert(is_null() || ((oop)obj)->is_a(),                                 \
              "illegal type");                                                 \
     }                                                                         \
     type##Handle (Thread* thread, type##Oop obj) : Handle(thread, (oop)obj) { \
-      assert(SharedSkipVerify || is_null() || ((oop)obj)->is_a(), "illegal type");  \
+      assert(is_null() || ((oop)obj)->is_a(), "illegal type");                \
     }                                                                         \
     \
     /* Operators for ease of use */              \
@@ -201,11 +201,11 @@
   /* Constructors */
   instanceKlassHandle () : KlassHandle() {}
   instanceKlassHandle (const Klass* k) : KlassHandle(k) {
-    assert(SharedSkipVerify || k == NULL || k->oop_is_instance(),
+    assert(k == NULL || k->oop_is_instance(),
            "illegal type");
   }
   instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) {
-    assert(SharedSkipVerify || k == NULL || k->oop_is_instance(),
+    assert(k == NULL || k->oop_is_instance(),
            "illegal type");
   }
   /* Access to klass part */
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -177,7 +177,8 @@
     const int alignment = markOopDesc::biased_lock_alignment;
     size_t aligned_size = size + (alignment - sizeof(intptr_t));
     void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC)
-                                          : os::malloc(aligned_size, flags, CURRENT_PC);
+                                          : AllocateHeap(aligned_size, flags, CURRENT_PC,
+                                              AllocFailStrategy::RETURN_NULL);
     void* aligned_addr     = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
     assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
            ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
@@ -191,7 +192,7 @@
     return aligned_addr;
   } else {
     return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
-                       : os::malloc(size, flags, CURRENT_PC);
+                       : AllocateHeap(size, flags, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
   }
 }
 
--- a/hotspot/src/share/vm/runtime/thread.hpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Wed Oct 31 09:25:20 2012 -0700
@@ -110,7 +110,7 @@
   void*       _real_malloc_address;
  public:
   void* operator new(size_t size) { return allocate(size, true); }
-  void* operator new(size_t size, std::nothrow_t& nothrow_constant) { return allocate(size, false); }
+  void* operator new(size_t size, const std::nothrow_t& nothrow_constant) { return allocate(size, false); }
   void  operator delete(void* p);
 
  protected:
--- a/hotspot/src/share/vm/utilities/debug.cpp	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed Oct 31 09:25:20 2012 -0700
@@ -477,7 +477,7 @@
   }
   // Ensure Eden top is correct before verification
   Universe::heap()->prepare_for_verify();
-  Universe::verify(true);
+  Universe::verify();
   if (!safe) SafepointSynchronize::set_is_not_at_safepoint();
 }
 
--- a/hotspot/test/runtime/6929067/Test6929067.sh	Tue Oct 30 12:47:35 2012 +0100
+++ b/hotspot/test/runtime/6929067/Test6929067.sh	Wed Oct 31 09:25:20 2012 -0700
@@ -4,6 +4,7 @@
 ## @test Test6929067.sh
 ## @bug 6929067
 ## @summary Stack guard pages should be removed when thread is detached
+## @compile T.java
 ## @run shell Test6929067.sh
 ##
 
@@ -33,31 +34,97 @@
     ;;
 esac
 
-# Choose arch: i386 or amd64 (test is Linux-specific)
+${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1 
+
+# Bitness:
 # Cannot simply look at TESTVMOPTS as -d64 is not
 # passed if there is only a 64-bit JVM available.
 
-${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>1 | grep "64-Bit" >/dev/null
+grep "64-Bit" vm_version.out > ${NULL}
 if [ "$?" = "0" ]
 then
-  ARCH=amd64
+  COMP_FLAG="-m64"
 else
-  ARCH=i386
+  COMP_FLAG="-m32"
 fi
 
-LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${ARCH}/client:/usr/openwin/lib:/usr/dt/lib:/usr/lib:$LD_LIBRARY_PATH
+
+# Architecture:
+# Translate uname output to JVM directory name, but permit testing
+# 32-bit x86 on an x64 platform.
+ARCH=`uname -m`
+case "$ARCH" in
+  x86_64)
+    if [ "$COMP_FLAG" = "-m32" ]; then
+      ARCH=i386
+    else 
+      ARCH=amd64
+    fi
+    ;;
+  ppc64)
+    if [ "$COMP_FLAG" = "-m32" ]; then
+      ARCH=ppc
+    else 
+      ARCH=ppc64
+    fi
+    ;;
+  sparc64)
+    if [ "$COMP_FLAG" = "-m32" ]; then
+      ARCH=sparc
+    else 
+      ARCH=sparc64
+    fi
+    ;;
+  arm*)
+    # 32-bit ARM machine: compiler may not recognise -m32
+    COMP_FLAG=""
+    ARCH=arm
+    ;;
+  aarch64)
+    # 64-bit arm machine, could be testing 32 or 64-bit:
+    if [ "$COMP_FLAG" = "-m32" ]; then
+      ARCH=arm
+    else 
+      ARCH=aarch64
+    fi
+    ;;
+  i586)
+    ARCH=i386
+    ;;
+  i686)
+    ARCH=i386
+    ;;
+  # Assuming other ARCH values need no translation
+esac
+
+
+# VM type: need to know server or client
+VMTYPE=client
+grep Server vm_version.out > ${NULL}
+if [ "$?" = "0" ]
+then
+  VMTYPE=server
+fi
+
+
+LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${ARCH}/${VMTYPE}:/usr/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
 
-THIS_DIR=`pwd`
+cp ${TESTSRC}${FS}invoke.c .
 
-cp ${TESTSRC}${FS}invoke.c ${THIS_DIR}
-cp ${TESTSRC}${FS}T.java ${THIS_DIR}
-
+# Copy the result of our @compile action:
+cp ${TESTCLASSES}${FS}T.class .
 
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
 
-${TESTJAVA}${FS}bin${FS}javac T.java
+echo "Architecture: ${ARCH}"
+echo "Compilation flag: ${COMP_FLAG}"
+echo "VM type: ${VMTYPE}"
 
-gcc -o invoke -I${TESTJAVA}/include -I${TESTJAVA}/include/linux invoke.c ${TESTJAVA}/jre/lib/${ARCH}/client/libjvm.so
+gcc -DLINUX ${COMP_FLAG} -o invoke \
+  -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \
+  -L${TESTJAVA}/jre/lib/${ARCH}/${VMTYPE} \
+  -ljvm -lpthread invoke.c
+
 ./invoke
 exit $?
--- a/jaxp/.hgtags	Tue Oct 30 12:47:35 2012 +0100
+++ b/jaxp/.hgtags	Wed Oct 31 09:25:20 2012 -0700
@@ -182,3 +182,4 @@
 1cb19abb3f7b40bf233b349cd2f51f02d37a9f5b jdk8-b58
 af9e8b0f1900b631a8a0fcccff9f1514fe58c808 jdk8-b59
 2d1dff5310daaf226421a8c92823cb8afcf35f31 jdk8-b60
+6b1db0b41d2f6e2a7b3bdbc8a8db823b47752906 jdk8-b61
--- a/jaxws/.hgtags	Tue Oct 30 12:47:35 2012 +0100
+++ b/jaxws/.hgtags	Wed Oct 31 09:25:20 2012 -0700
@@ -182,3 +182,4 @@
 cac4c393706343df778a13dc6c84cad0f8c237c9 jdk8-b58
 ae107401be116f9e384d3a23192f543828e03da5 jdk8-b59
 5c5a65ad5291b7cefcdc308f627cf2b195cf2b69 jdk8-b60
+97e5e74e2a341d9142ce28043912a3c255e28e03 jdk8-b61
--- a/jdk/.hgtags	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/.hgtags	Wed Oct 31 09:25:20 2012 -0700
@@ -182,3 +182,5 @@
 d94613ac03d8de375ef60493e2bb76dbd30d875d jdk8-b58
 abad1f417bd3df4296631fc943cd3b7f5062c88a jdk8-b59
 cec8fa02f15634acd7d02d04b0b2d8c044cdbaaa jdk8-b60
+61ddb3fd000a09ab05bff1940b0ac211661e94cf jdk8-b61
+50b8b17449d200c66bfd68fb4f3a9197432c9e2b jdk8-b62
--- a/jdk/THIRD_PARTY_README	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/THIRD_PARTY_README	Wed Oct 31 09:25:20 2012 -0700
@@ -2,11 +2,11 @@
 -----------------------------
 
 %% This notice is provided with respect to ASM Bytecode Manipulation 
-Framework v3.1, which is included with JRE 7, JDK 7, and OpenJDK 7.
+Framework v4.0, which is included with JRE 8, and JDK 8.
 
 --- begin of LICENSE ---
 
-Copyright (c) 2000-2005 INRIA, France Telecom
+Copyright (c) 2000-2011 France TÚlÚcom
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
--- a/jdk/make/Makefile	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -233,7 +233,7 @@
 
 all build:: sanity-all post-sanity-all
 
-SUBDIRS       = tools java javax sun com
+SUBDIRS       = tools java javax sun com jdk
 ifeq ($(PLATFORM), macosx)
   SUBDIRS += apple
 endif
--- a/jdk/make/com/sun/java/pack/Makefile	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/com/sun/java/pack/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -94,9 +94,9 @@
   LDOUTPUT = -Fe
 
   # JDK name required here
-  RC_FLAGS += /D "JDK_FNAME=$(PGRM).exe" \
-	/D "JDK_INTERNAL_NAME=$(PGRM)" \
-	/D "JDK_FTYPE=0x1L"
+  RC_FLAGS += -D "JDK_FNAME=$(PGRM).exe" \
+	-D "JDK_INTERNAL_NAME=$(PGRM)" \
+	-D "JDK_FTYPE=0x1L"
 
   RES = $(OBJDIR)/$(PGRM).res
 else
@@ -161,7 +161,7 @@
 	$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
 	$(LINKER)  $(LDDFLAGS) $(sort $(UNPACK_EXE_FILES_o)) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
 ifdef MT
-	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
+	$(MT) -manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest -outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
 endif
 	$(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE)
 	@$(call binary_file_verification,$@)
--- a/jdk/make/common/Defs-windows.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/Defs-windows.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -78,7 +78,7 @@
   MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
 endif
 
-EXTRA_LFLAGS += /LIBPATH:$(DXSDK_LIB_PATH)
+EXTRA_LFLAGS += -LIBPATH:$(DXSDK_LIB_PATH)
 
 # Full Debug Symbols has been enabled on Windows since JDK1.4.1.
 # The Full Debug Symbols (FDS) default for VARIANT == OPT builds is
@@ -198,7 +198,7 @@
 #   -MTd       Use static debug version (better than -MDd, no runtime issues)
 #   -D_DEBUG   Change use of malloc/free/etc to use special debug ones (-MTd)
 #
-#      NOTE: We also will use /D _STATIC_CPPLIB  so we don't need msvcpnn.dll
+#      NOTE: We also will use -D _STATIC_CPPLIB  so we don't need msvcpnn.dll
 #
 # If MS_RUNTIME_STATIC is requested we may have a problem, it is no longer
 #     supported by VS2010
@@ -223,12 +223,12 @@
 endif
 
 # Always add _STATIC_CPPLIB definition
-STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
+STATIC_CPPLIB_OPTION = -D _STATIC_CPPLIB
 
 # Silence the warning about using _STATIC_CPPLIB
 ifneq ($(SHOW_ALL_WARNINGS),true)
   # Needed with VS2010 to turn off the deprecated warning.
-  STATIC_CPPLIB_OPTION += /D _DISABLE_DEPRECATE_STATIC_CPPLIB
+  STATIC_CPPLIB_OPTION += -D _DISABLE_DEPRECATE_STATIC_CPPLIB
 endif
 
 MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
@@ -242,7 +242,7 @@
   #   -Od      Turns off optimization and speeds compilation
   #   -YX -Fp/.../foobar.pch   Use precompiled headers (try someday?)
   #   -nologo  Don't print out startup message
-  #   /D _STATIC_CPPLIB
+  #  -D _STATIC_CPPLIB
   #            Use static link for the C++ runtime (so msvcpnn.dll not needed)
   #   
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@@ -258,12 +258,12 @@
   CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
 
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-    LDEBUG = /debug
+    LDEBUG = -debug
   endif
   
   ifeq ($(VTUNE_SUPPORT), true)
     OTHER_CFLAGS = -Z7 -Ox 
-    LDEBUG += /pdb:NONE
+    LDEBUG += -pdb:NONE
   endif
   
   # VS2010, always need safe exception handlers, not needed on 64bit
@@ -272,7 +272,7 @@
   endif
 
   # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
-  BASELFLAGS = -nologo /opt:REF /incremental:no
+  BASELFLAGS = -nologo -opt:REF -incremental:no
 
   LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
   LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
@@ -404,7 +404,7 @@
   JDK_UPDATE_VER := 0
 endif
 
-RC_FLAGS = /l 0x409 /r
+RC_FLAGS = -l 0x409 -r
 
 ifeq ($(VARIANT), OPT)
   RC_FLAGS += -d NDEBUG 
--- a/jdk/make/common/Demo.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/Demo.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -292,9 +292,9 @@
 
 ifeq ($(PLATFORM),windows)
 # JDK name required here
-RC_FLAGS += /D "JDK_FNAME=$(LIBRARY).dll" \
-            /D "JDK_INTERNAL_NAME=$(LIBRARY)" \
-            /D "JDK_FTYPE=0x2L"
+RC_FLAGS += -D "JDK_FNAME=$(LIBRARY).dll" \
+            -D "JDK_INTERNAL_NAME=$(LIBRARY)" \
+            -D "JDK_FTYPE=0x2L"
 endif
 
 # Native library building
--- a/jdk/make/common/Library.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/Library.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -206,9 +206,9 @@
 	@$(ECHO) Created $@ 
 
 # JDK name required here
-RC_FLAGS += /D "JDK_FNAME=$(LIBRARY).dll" \
-            /D "JDK_INTERNAL_NAME=$(LIBRARY)" \
-            /D "JDK_FTYPE=0x2L"
+RC_FLAGS += -D "JDK_FNAME=$(LIBRARY).dll" \
+            -D "JDK_INTERNAL_NAME=$(LIBRARY)" \
+            -D "JDK_FTYPE=0x2L"
 
 $(OBJDIR)/$(LIBRARY).res: $(VERSIONINFO_RESOURCE)
 ifndef LOCAL_RESOURCE_FILE
--- a/jdk/make/common/Program.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/Program.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -157,9 +157,9 @@
 #
 ifeq ($(PLATFORM), windows)
   # JDK name required here
-  RC_FLAGS += /D "JDK_FNAME=$(PROGRAM)$(EXE_SUFFIX)" \
-              /D "JDK_INTERNAL_NAME=$(PROGRAM)" \
-              /D "JDK_FTYPE=0x1L"
+  RC_FLAGS += -D "JDK_FNAME=$(PROGRAM)$(EXE_SUFFIX)" \
+              -D "JDK_INTERNAL_NAME=$(PROGRAM)" \
+              -D "JDK_FTYPE=0x1L"
 
   $(OBJDIR)/$(PROGRAM).res: $(VERSIONINFO_RESOURCE)
 	@$(prep-target)
@@ -201,11 +201,11 @@
 	@$(prep-target)
 	@set -- $?; \
 	    $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
-	$(LINK) -out:$@ /STACK:$(STACK_SIZE) \
+	$(LINK) -out:$@ -STACK:$(STACK_SIZE) \
 	    $(MAP_OPTION) $(LFLAGS) $(LDFLAGS) \
 	    @$(OBJDIR)/$(PROGRAM).lcf $(LDLIBS)
   ifdef MT
-	$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
+	$(MT) -manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
   endif
 	@$(call binary_file_verification,$@)
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
--- a/jdk/make/common/Release.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/Release.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -348,15 +348,15 @@
 	sun/tools/serialver	\
 	sun/tools/tree		\
 	sun/tools/util		\
-	sun/security/tools/JarBASE64Encoder.class \
-	sun/security/tools/JarSigner.class \
-	sun/security/tools/JarSignerParameters.class \
-	sun/security/tools/JarSignerResources.class \
-	sun/security/tools/JarSignerResources_ja.class \
-	sun/security/tools/JarSignerResources_zh_CN.class \
-	sun/security/tools/SignatureFile\$$Block.class \
-	sun/security/tools/SignatureFile.class \
-	sun/security/tools/TimestampedSigner.class \
+	sun/security/tools/jarsigner/JarBASE64Encoder.class \
+	sun/security/tools/jarsigner/Main.class \
+	sun/security/tools/jarsigner/JarSignerParameters.class \
+	sun/security/tools/jarsigner/Resources.class \
+	sun/security/tools/jarsigner/Resources_ja.class \
+	sun/security/tools/jarsigner/Resources_zh_CN.class \
+	sun/security/tools/jarsigner/SignatureFile\$$Block.class \
+	sun/security/tools/jarsigner/SignatureFile.class \
+	sun/security/tools/jarsigner/TimestampedSigner.class \
 	sun/rmi/rmic		\
 	sun/applet		\
 	sun/jvmstat		\
@@ -572,15 +572,15 @@
 	$(ECHO) "sun/tools/serialver/" >> $@
 	$(ECHO) "sun/tools/tree/" >> $@
 	$(ECHO) "sun/tools/util/" >> $@
-	$(ECHO) "sun/security/tools/JarBASE64Encoder.class" >> $@
-	$(ECHO) "sun/security/tools/JarSigner.class" >> $@
-	$(ECHO) "sun/security/tools/JarSignerParameters.class" >> $@
-	$(ECHO) "sun/security/tools/JarSignerResources.class" >> $@
-	$(ECHO) "sun/security/tools/JarSignerResources_ja.class" >> $@
-	$(ECHO) "sun/security/tools/JarSignerResources_zh_CN.class" >> $@
-	$(ECHO) "sun/security/tools/SignatureFile\$$Block.class" >> $@
-	$(ECHO) "sun/security/tools/SignatureFile.class" >> $@
-	$(ECHO) "sun/security/tools/TimestampedSigner.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/JarBASE64Encoder.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/Main.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/JarSignerParameters.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/Resources.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/Resources_ja.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/Resources_zh_CN.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/SignatureFile\$$Block.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/SignatureFile.class" >> $@
+	$(ECHO) "sun/security/tools/jarsigner/TimestampedSigner.class" >> $@
 	$(ECHO) "sun/security/provider/Sun.class" >> $@
 	$(ECHO) "sun/security/rsa/SunRsaSign.class" >> $@
 	$(ECHO) "sun/security/ssl/" >> $@
@@ -784,11 +784,22 @@
 		    $(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) $(JFR_JAR) \
 		    $(BUILDMETAINDEX_JARFILE)
 	@# Copy in bin directory
+ifeq ($(USING_MSYS),true)
+        # No cpio in MinGW/MSYS
+	$(CD) $(OUTPUTDIR) && $(TAR) -cf - bin | ($(CD) $(JRE_IMAGE_DIR) && $(TAR) -xpf -)
+else
 	$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_IMAGE_DIR)
+endif
 	@# CTE plugin security change require new empty directory lib/applet
 	$(MKDIR) -p $(JRE_IMAGE_DIR)/lib/applet
 	@# Copy in lib directory
+ifeq ($(USING_MSYS),true)
+        # No cpio in MinGW/MSYS
+	$(CD) $(OUTPUTDIR) && $(TAR) -cf - lib | ($(CD) $(JRE_IMAGE_DIR) && $(TAR) -xpf -)
+else
 	$(CD) $(OUTPUTDIR) && $(FIND) lib -depth | $(CPIO) -pdum $(JRE_IMAGE_DIR)
+endif
+
   ifeq ($(USING_CYGWIN),true)
 	  $(RM) -rf $(JRE_IMAGE_DIR)/[A-Za-z]:
 	  $(RM) -rf $(OUTPUTDIR)/[A-Za-z]:
@@ -919,11 +930,17 @@
 # only places from which we copy everything), but because the presence
 # of this file causes cygwin's find to bomb out, thus breaking the build
 # in "install".
+
 initial-image-jdk-setup:
 	$(RM) -r $(JDK_IMAGE_DIR)
 	$(MKDIR) -p $(JDK_IMAGE_DIR)/jre
+ifeq ($(USING_MSYS),true)
+	($(CD) $(JRE_IMAGE_DIR) && $(TAR) -cf - . \
+	      | ($(CD) $(JDK_IMAGE_DIR)/jre && $(TAR) -xpf -))
+else
 	($(CD) $(JRE_IMAGE_DIR) && $(FIND) . -depth -print \
 	      | $(CPIO) -pdum $(JDK_IMAGE_DIR)/jre )
+endif
   ifeq ($(USING_CYGWIN),true)
 	  $(RM) -rf $(JRE_IMAGE_DIR)/[A-Za-z]:
 	  $(RM) -rf $(JDK_IMAGE_DIR)/jre/[A-Za-z]:
--- a/jdk/make/common/internal/Defs-jaxws.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/internal/Defs-jaxws.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -34,6 +34,10 @@
      javax/xml/ws \
      javax/jws \
      javax/annotation \
+     com/sun/org/glassfish \
+     com/sun/istack/internal \
+     com/sun/istack/internal/localization \
+     com/sun/istack/internal/logging \
      com/sun/xml/internal/bind \
      com/sun/xml/internal/fastinfoset \
      com/sun/xml/internal/messaging \
--- a/jdk/make/common/shared/Defs-utils.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/shared/Defs-utils.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -169,15 +169,19 @@
 ifeq ($(PLATFORM),windows)
   ifdef USING_CYGWIN
     # Intrinsic unix command, with backslash-escaped character interpretation
-    ECHO = $(UNIXCOMMAND_PATH)echo -e
-    ZIPEXE = $(UNIXCOMMAND_PATH)zip
-    UNZIP  = $(UNIXCOMMAND_PATH)unzip
+    ECHO     = $(UNIXCOMMAND_PATH)echo -e
+    ZIPEXE   = $(UNIXCOMMAND_PATH)zip
+    UNZIP    = $(UNIXCOMMAND_PATH)unzip
     # Some CYGWIN nawk versions require BINMODE=w for proper '\r' interpretation
-    NAWK   = $(UNIXCOMMAND_PATH)awk -v BINMODE=w
+    NAWK     = $(UNIXCOMMAND_PATH)awk -v BINMODE=w
   else
     ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
     UNZIP  = $(UTILS_DEVTOOL_PATH)unzip
     NAWK   = $(UNIXCOMMAND_PATH)awk
+    ifdef USING_MSYS
+      ECHO   = $(UTILS_COMMAND_PATH)echo -e
+      AR     = $(UTILS_DEVTOOL_PATH)ar
+    endif
   endif
   # Re-define some utilities
   LEX            =# override GNU Make intrinsic: no lex on windows
--- a/jdk/make/common/shared/Defs-windows.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/shared/Defs-windows.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -112,6 +112,15 @@
 $(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1" 2> $(DEV_NULL); else echo "$1"; fi)
 endef
 else
+ifdef USING_MSYS
+DOSPATH_CMD:=$(shell cd $(JDK_TOPDIR) 2> $(DEV_NULL) && pwd)/make/tools/msys_build_scripts/dospath.sh
+define FullPath
+$(subst \,/,$(shell $(DOSPATH_CMD) $1))
+endef
+define OptFullPath
+$(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
+endef
+else
 # Temporary until we upgrade to MKS 8.7, MKS pwd returns mixed mode path
 define FullPath
 $(shell cd $1 2> $(DEV_NULL) && pwd)
@@ -120,6 +129,7 @@
 $(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
 endef
 endif
+endif
 
 # System drive
 ifdef SYSTEMDRIVE
@@ -146,43 +156,47 @@
   ifdef USING_CYGWIN
     UNIXCOMMAND_PATH :=$(call PrefixPath,/usr/bin)
   else
-    ifdef ROOTDIR
-      xROOTDIR :="$(subst \,/,$(ROOTDIR))"
-      _rootdir :=$(call FullPath,$(xROOTDIR))
+    ifdef USING_MSYS
+      UNIXCOMMAND_PATH :=$(call PrefixPath,/bin)
     else
-      xROOTDIR :="$(_system_drive)/mksnt"
-      _rootdir :=$(call FullPath,$(xROOTDIR))
-    endif
-    ifneq ($(_rootdir),)
-      UNIXCOMMAND_PATH :=$(call PrefixPath,$(_rootdir)/mksnt)
-    endif
-  endif
+      ifdef ROOTDIR
+        xROOTDIR :="$(subst \,/,$(ROOTDIR))"
+        _rootdir :=$(call FullPath,$(xROOTDIR))
+      else
+        xROOTDIR :="$(_system_drive)/mksnt"
+        _rootdir :=$(call FullPath,$(xROOTDIR))
+      endif
+      ifneq ($(_rootdir),)
+        UNIXCOMMAND_PATH :=$(call PrefixPath,$(_rootdir)/mksnt)
+      endif
+    endif # USING_MSYS
+  endif # USING_CYGWIN
 endif
 UNIXCOMMAND_PATH:=$(call AltCheckSpaces,UNIXCOMMAND_PATH)
 
 # Get version of MKS or CYGWIN
-ifndef USING_CYGWIN
-_MKS_VER :=$(shell $(MKSINFO) 2>&1 | $(GREP) Release | $(TAIL) -1 | $(SED) -e 's@.*\(Release.*\)@\1@')
-MKS_VER  :=$(call GetVersion,$(_MKS_VER))
-# At this point, we can re-define FullPath to use DOSNAME_CMD
-CHECK_MKS87:=$(call CheckVersions,$(MKS_VER),8.7)
-TRY_DOSNAME:=false
-ifeq ($(CHECK_MKS87),same)
-TRY_DOSNAME:=true
-endif
-# Newer should be ok
-ifeq ($(CHECK_MKS87),newer)
-TRY_DOSNAME:=true
-endif
-ifeq ($(TRY_DOSNAME),true)
-ifeq ($(shell $(UNIXCOMMAND_PATH)dosname -s $(_system_drive)/ 2> $(DEV_NULL)),$(_system_drive)/)
-_DOSNAME=$(UNIXCOMMAND_PATH)dosname
-DOSNAME_CMD:=$(_DOSNAME) -s
+ifdef USING_MKS
+  _MKS_VER :=$(shell $(MKSINFO) 2>&1 | $(GREP) Release | $(TAIL) -1 | $(SED) -e 's@.*\(Release.*\)@\1@')
+  MKS_VER  :=$(call GetVersion,$(_MKS_VER))
+  # At this point, we can re-define FullPath to use DOSNAME_CMD
+  CHECK_MKS87:=$(call CheckVersions,$(MKS_VER),8.7)
+  TRY_DOSNAME:=false
+  ifeq ($(CHECK_MKS87),same)
+    TRY_DOSNAME:=true
+  endif
+  # Newer should be ok
+  ifeq ($(CHECK_MKS87),newer)
+    TRY_DOSNAME:=true
+  endif
+  ifeq ($(TRY_DOSNAME),true)
+    ifeq ($(shell $(UNIXCOMMAND_PATH)dosname -s $(_system_drive)/ 2> $(DEV_NULL)),$(_system_drive)/)
+      _DOSNAME=$(UNIXCOMMAND_PATH)dosname
+      DOSNAME_CMD:=$(_DOSNAME) -s
 define FullPath
 $(subst //,/,$(shell echo $1 | $(DOSNAME_CMD) 2> $(DEV_NULL)))
 endef
-endif # test dosname -s
-endif # TRY_DOSNAME
+    endif # test dosname -s
+  endif # TRY_DOSNAME
 endif # MKS
 
 # We try to get references to what we need via the default component
@@ -440,10 +454,14 @@
   ifdef USING_CYGWIN
     DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH)
   else
-    xDEVTOOLS_PATH  :="$(_system_drive)/utils"
-    fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH))
-    DEVTOOLS_PATH  :=$(call PrefixPath,$(fxDEVTOOLS_PATH))
-  endif
+    ifdef USING_MSYS
+      DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH)
+    else
+      xDEVTOOLS_PATH  :="$(_system_drive)/utils"
+      fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH))
+      DEVTOOLS_PATH  :=$(call PrefixPath,$(fxDEVTOOLS_PATH))
+    endif # USING_MSYS
+  endif # USING_CYGWIN
 endif
 DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH)
 
@@ -636,7 +654,7 @@
 
 # Special define for checking the binaries
 
-# All windows dll and exe files should have been built with /NXCOMPAT
+# All windows dll and exe files should have been built with -NXCOMPAT
 #   and be setup for dynamic base addresses.
 #   In addition, we should not be dependent on certain dll files that
 #   we do not or cannot redistribute.
@@ -648,37 +666,37 @@
   BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
 endif
 
-# Check for /safeseh (only used on 32bit)
+# Check for -safeseh (only used on 32bit)
 define binary_file_safeseh_verification # binary_file
 ( \
-  $(ECHO) "Checking for /SAFESEH usage in: $1" && \
-  if [ "`$(DUMPBIN) /loadconfig $1 | $(EGREP) -i 'Safe Exception Handler Table'`" = "" ] ; then \
+  $(ECHO) "Checking for -SAFESEH usage in: $1" && \
+  if [ "`$(DUMPBIN) -loadconfig $1 | $(EGREP) -i 'Safe Exception Handler Table'`" = "" ] ; then \
     $(ECHO) "ERROR: Did not find 'Safe Exception Handler Table' in loadconfig: $1" ; \
-    $(DUMPBIN) /loadconfig $1 ; \
+    $(DUMPBIN) -loadconfig $1 ; \
     exit 6 ; \
   fi ; \
 )
 endef
 
-# Check for /NXCOMPAT usage
+# Check for -NXCOMPAT usage
 define binary_file_nxcompat_verification # binary_file
 ( \
-  $(ECHO) "Checking for /NXCOMPAT usage in: $1" && \
-  if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \
+  $(ECHO) "Checking for -NXCOMPAT usage in: $1" && \
+  if [ "`$(DUMPBIN) -headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \
     $(ECHO) "ERROR: Did not find 'NX compatible' in headers: $1" ; \
-    $(DUMPBIN) /headers $1 ; \
+    $(DUMPBIN) -headers $1 ; \
     exit 7 ; \
   fi ; \
 )
 endef
 
-# Check for /DYNAMICBASE usage
+# Check for -DYNAMICBASE usage
 define binary_file_dynamicbase_verification # binary_file
 ( \
-  $(ECHO) "Checking for /DYNAMICBASE usage in: $1" && \
-  if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \
+  $(ECHO) "Checking for -DYNAMICBASE usage in: $1" && \
+  if [ "`$(DUMPBIN) -headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \
     $(ECHO) "ERROR: Did not find 'Dynamic base' in headers: $1" ; \
-    $(DUMPBIN) /headers $1 ; \
+    $(DUMPBIN) -headers $1 ; \
     exit 8 ; \
   fi ; \
 )
@@ -688,9 +706,9 @@
 define binary_file_dll_verification # binary_file
 ( \
   $(ECHO) "Checking for banned dependencies in: $1" && \
-  if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
+  if [ "`$(DUMPBIN) -dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
     $(ECHO) "ERROR: Found use of $(BANNED_DLLS)"; \
-    $(DUMPBIN) /dependents $1 ; \
+    $(DUMPBIN) -dependents $1 ; \
     exit 9 ; \
   fi ; \
 )
--- a/jdk/make/common/shared/Platform.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/shared/Platform.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -70,6 +70,8 @@
 #     LIBARCH32                   solaris only: sparc or i386
 #     LIBARCH64                   solaris only: sparcv9 or amd64
 #     USING_CYGWIN                windows only: true or false
+#     USING_MSYS                  windows only: true or false
+#     USING_MKS                   windows only: true or false
 #     ISHIELD_TEMP_MIN            windows only: minimum disk space in temp area
 
 # Only run uname once in this make session.
@@ -306,6 +308,8 @@
 # Windows with and without CYGWIN will be slightly different
 ifeq ($(SYSTEM_UNAME), Windows_NT)
   PLATFORM = windows
+  USING_MKS = true
+  export USING_MKS
 endif
 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
   PLATFORM = windows
@@ -318,6 +322,11 @@
     export CYGWIN_HOME
   endif
 endif
+ifneq (,$(findstring MINGW,$(SYSTEM_UNAME)))
+  PLATFORM = windows
+  USING_MSYS = true
+  export USING_MSYS
+endif
 
 # Platform settings specific to Windows
 ifeq ($(PLATFORM), windows)
@@ -395,11 +404,12 @@
   endif
   ARCH_FAMILY = $(ARCH)
   # Where is unwanted output to be delivered?
-  # MKS uses the special file "NUL", cygwin uses the customary unix file.
-  ifeq ($(USING_CYGWIN),true)
+  # MKS uses the special file "NUL"; Cygwin and MinGW/MSYS use the
+  # customary unix file.
+  ifeq ($(USING_MKS),true)
+    DEV_NULL = NUL
+  else
     DEV_NULL = /dev/null
-  else
-    DEV_NULL = NUL
   endif
   export DEV_NULL
   # Classpath separator
@@ -440,28 +450,11 @@
       _MB_OF_MEMORY := \
 	   $(shell free -m | grep Mem: | awk '{print $$2;}' )
     else
-      # Windows 2000 has the mem utility, but two memory areas
-      #    extended memory is what is beyond 1024M
-      _B_OF_EXT_MEMORY := \
-	   $(shell mem 2> $(DEV_NULL) | \
-		   grep 'total contiguous extended memory' | awk '{print $$1;}')
-      ifeq ($(_B_OF_EXT_MEMORY),)
-          _B_OF_MEMORY := \
-	   $(shell mem 2> $(DEV_NULL) | \
-		   grep 'total conventional memory' | awk '{print $$1;}')
-      else
-        _B_OF_MEMORY := \
-           $(shell expr 1048576 '+' $(_B_OF_EXT_MEMORY) 2> $(DEV_NULL))
-      endif
-      ifeq ($(_B_OF_MEMORY),)
-        # Windows 2003 has the systeminfo utility use it if mem doesn't work
-        _MB_OF_MEMORY := \
-	    $(shell systeminfo 2> $(DEV_NULL) | \
-		    grep 'Total Physical Memory:' | \
-		    awk '{print $$4;}' | sed -e 's@,@@')
-      else
-        _MB_OF_MEMORY := $(shell expr $(_B_OF_MEMORY) '/' 1024 2> $(DEV_NULL))
-      endif
+      # Windows XP and higher has the systeminfo utility
+      _MB_OF_MEMORY := \
+            $(shell systeminfo 2> $(DEV_NULL) | \
+                    grep 'Total Physical Memory:' | \
+                    awk '{print $$4;}' | sed -e 's@,@@')
     endif
     ifeq ($(shell expr $(_MB_OF_MEMORY) '+' 0 2> $(DEV_NULL)), $(_MB_OF_MEMORY))
       MB_OF_MEMORY := $(_MB_OF_MEMORY)
--- a/jdk/make/common/shared/Sanity-Settings.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/shared/Sanity-Settings.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -182,8 +182,13 @@
     ALL_SETTINGS+=$(call addRequiredVersionSetting,CYGWIN_VER)
     ALL_SETTINGS+=$(call addRequiredSetting,CYGPATH_CMD)
   else
-    ALL_SETTINGS+=$(call addRequiredVersionSetting,MKS_VER)
-    ALL_SETTINGS+=$(call addOptionalSetting,DOSNAME_CMD)
+    ifdef USING_MSYS
+      ALL_SETTINGS+=$(call addRequiredSetting,USING_MSYS)
+      ALL_SETTINGS+=$(call addRequiredSetting,DOSPATH_CMD)
+    else
+      ALL_SETTINGS+=$(call addRequiredVersionSetting,MKS_VER)
+      ALL_SETTINGS+=$(call addOptionalSetting,DOSNAME_CMD)
+    endif
   endif
 endif
 ifeq ($(PLATFORM),linux)
--- a/jdk/make/common/shared/Sanity.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/common/shared/Sanity.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -395,7 +395,7 @@
 ifeq ($(PLATFORM), windows)
     MKS_CHECK :=$(call CheckVersions,$(MKS_VER),$(REQUIRED_MKS_VER))
 sane-mks:
-  ifndef USING_CYGWIN
+  ifdef USING_MKS
     ifeq ($(MKS_CHECK),missing)
 	@$(call OfficialErrorMessage,MKS version,$(MKS_VER),$(REQUIRED_MKS_VER))
     endif
@@ -905,14 +905,25 @@
 	    "" >> $(ERROR_FILE) ; \
 	fi
 ifeq ($(PLATFORM), windows)
-	@for utility in cpio ar file m4 ; do \
+ifeq ($(USING_MSYS), true)
+	@for utility in $(AR) $(FILE) $(M4) ; do \
 	  if [ ! -r "`$(WHICH) $${utility}`" ]; then \
 	    $(ECHO) "WARNING: You do not have the utility $${utility} in the \n" \
 	      "      directory $(UNIXCOMMAND_PATH). \n" \
-	      "      The utilities cpio, ar, file, and m4 are required. \n" \
+	      "      The utilities ar, file and m4 are required. \n" \
 	      "" >> $(WARNING_FILE) ; \
 	  fi; \
 	done
+else
+	@for utility in $(AR) $(CPIO) $(FILE) $(M4) ; do \
+	  if [ ! -r "`$(WHICH) $${utility}`" ]; then \
+	    $(ECHO) "WARNING: You do not have the utility $${utility} in the \n" \
+	      "      directory $(UNIXCOMMAND_PATH). \n" \
+	      "      The utilities ar, cpio, file and m4 are required. \n" \
+	      "" >> $(WARNING_FILE) ; \
+	  fi; \
+	done
+endif
 endif
 
 ######################################################
@@ -999,7 +1010,8 @@
 	    "      This is normally obtained from the WINDOWSSDKDIR." \
 	    "" >> $(ERROR_FILE)
   endif
-  ifeq ($(wildcard $(DUMPBIN)),)
+  # MinGW/MSYS make 3.81 will not tolerate a path with a quoted substring
+  ifeq ($(wildcard $(subst ",,$(DUMPBIN))),)
 	@$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
 	    "      This is normally obtained from the COMPILER_PATH." \
 	    "" >> $(ERROR_FILE)
--- a/jdk/make/java/java/Makefile	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/java/java/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -64,13 +64,11 @@
 include Exportedfiles.gmk
 
 ifeq ($(PLATFORM),windows)
-FILES_java += 	java/io/Win32FileSystem.java \
-		java/io/WinNTFileSystem.java \
+FILES_java += 	java/io/WinNTFileSystem.java \
 		java/util/prefs/WindowsPreferences.java \
                 java/util/prefs/WindowsPreferencesFactory.java
 
 FILES_c    +=   ProcessImpl_md.c \
-		Win32FileSystem_md.c \
 		WinNTFileSystem_md.c \
 		canonicalize_md.c \
 		dirent_md.c \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/jdk/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+#
+# Makefile for building all of java
+#
+
+BUILDDIR = ..
+PRODUCT = jdk
+include $(BUILDDIR)/common/Defs.gmk
+
+SUBDIRS = asm
+include $(BUILDDIR)/common/Subdirs.gmk
+
+all build clean clobber::
+	$(SUBDIRS-loop)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/jdk/asm/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 1995, 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.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+BUILDDIR = ../..
+PACKAGE = jdk.internal.org.objectweb.asm
+PRODUCT = jdk
+JAVAC_LINT_OPTIONS=-Xlint:all
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Files to compile
+#
+AUTO_FILES_JAVA_DIRS = jdk/internal/org/objectweb/asm
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
--- a/jdk/make/jdk_generic_profile.sh	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/jdk_generic_profile.sh	Wed Oct 31 09:25:20 2012 -0700
@@ -176,17 +176,38 @@
   else
     windows_arch=i586
   fi
+
+  repo=`hg root | sed -e 's@\\\\@/@g'`
   # We need to check if we are running a CYGWIN shell
-  if [ "$(uname -a | fgrep Cygwin)" != "" -a -f /bin/cygpath ] ; then
+  if [ "$(echo ${osname} | fgrep Cygwin)" != "" -a -f /bin/cygpath ] ; then
     # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
     # Utility to convert to short pathnames without spaces
     cygpath="/usr/bin/cygpath -a -m -s"
+    cygpathp="/usr/bin/cygpath -p"
     # Most unix utilities are in the /usr/bin
     unixcommand_path="/usr/bin"
     # Make the prompt tell you CYGWIN
     export PS1="CYGWIN:${COMPUTERNAME}:${USERNAME}[\!] "
+  elif [ "$(echo ${osname} | fgrep MINGW)" != "" ] ; then
+    # Utility to convert to short pathnames without spaces
+    cygpath="${repo}/make/tools/msys_build_scripts/dospath.sh"
+    if [ ! -f ${cygpath} ] ; then
+        echo "ERROR: Cannot find cygpath or equivalent on this machine"
+        exit 1
+    fi
+    # Utility to fix a path to MinGW/MSYS format - the equivalent of 'cygpath -p'
+    for tfile in "${repo}/make/scripts/fixpath.pl" "${repo}/../make/scripts/fixpath.pl"; do
+        if [ -f ${tfile} ] ; then
+            cygpathp="/bin/perl ${tfile} -m"
+        fi
+    done;
+    if [ -z "${cygpathp}" ] ; then
+        echo "ERROR: Cannot find make/scripts/fixpath.pl on this machine"
+        exit 1
+    fi
+    unixcommand_path="/usr/bin"
   else
-    echo "ERROR: Cannot find CYGWIN on this machine"
+    echo "ERROR: Cannot find CYGWIN or MinGW/MSYS on this machine"
     exit 1
   fi
   if [ "${ALT_UNIXCOMMAND_PATH}" != "" ] ; then
@@ -204,17 +225,18 @@
   else
     sys_root=$(${cygpath} "C:/WINNT")
   fi
-  path4sdk="${unixcommand_path};${sys_root}/system32;${sys_root};${sys_root}/System32/Wbem"
   if [ ! -d "${sys_root}" ] ; then
     echo "WARNING: No system root found at: ${sys_root}"
   fi
 
+  # Build a : separated path making sure each segment is acceptable to ${osname}
+  path4sdk="${unixcommand_path}:"`${cygpathp} "${sys_root}/system32;${sys_root};${sys_root}/System32/Wbem"`
+
   # Compiler setup (nasty part)
   #   NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
   #   NOTE: CYGWIN has a link.exe too, make sure the compilers are first
 
   # Use supplied vsvars.sh
-  repo=`hg root`
   if [ -f "${repo}/make/scripts/vsvars.sh" ] ; then
     eval `sh ${repo}/make/scripts/vsvars.sh -v10`
   elif [ -f "${repo}/../make/scripts/vsvars.sh" ] ; then
--- a/jdk/make/jprt.properties	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/jprt.properties	Wed Oct 31 09:25:20 2012 -0700
@@ -77,20 +77,18 @@
     ${jprt.my.test.target.set:TESTNAME=jdk_util},               \
     ${jprt.my.test.target.set:TESTNAME=jdk_io},                 \
     ${jprt.my.test.target.set:TESTNAME=jdk_net},                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_nio1},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_nio2},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_nio3},               \
+    ${jprt.my.test.target.set:TESTNAME=jdk_nio},                \
     ${jprt.my.test.target.set:TESTNAME=jdk_security1},          \
     ${jprt.my.test.target.set:TESTNAME=jdk_security2},          \
     ${jprt.my.test.target.set:TESTNAME=jdk_security3},          \
     ${jprt.my.test.target.set:TESTNAME=jdk_rmi},                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_management1},        \
-    ${jprt.my.test.target.set:TESTNAME=jdk_management2},        \
+    ${jprt.my.test.target.set:TESTNAME=jdk_management},         \
+    ${jprt.my.test.target.set:TESTNAME=jdk_jmx},                \
     ${jprt.my.test.target.set:TESTNAME=jdk_text},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_tools1},             \
-    ${jprt.my.test.target.set:TESTNAME=jdk_tools2},             \
+    ${jprt.my.test.target.set:TESTNAME=jdk_tools},              \
+    ${jprt.my.test.target.set:TESTNAME=jdk_jdi},                \
     ${jprt.my.test.target.set:TESTNAME=jdk_jfr},                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_misc}
+    ${jprt.my.test.target.set:TESTNAME=jdk_other}
 
 # All vm test targets (testset=all)
 jprt.vm.all.test.targets=                                       \
--- a/jdk/make/launchers/Makefile	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/launchers/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -58,7 +58,7 @@
 $(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , )
 $(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , )
 $(call make-launcher, jar, sun.tools.jar.Main, , )
-$(call make-launcher, jarsigner, sun.security.tools.JarSigner, , )
+$(call make-launcher, jarsigner, sun.security.tools.jarsigner.Main, , )
 $(call make-launcher, javac, com.sun.tools.javac.Main, , )
 $(call make-launcher, javadoc, com.sun.tools.javadoc.Main, , )
 $(call make-launcher, javah, com.sun.tools.javah.Main, , )
--- a/jdk/make/sun/net/FILES_java.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/sun/net/FILES_java.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -128,8 +128,6 @@
 	sun/net/www/content/audio/x_wav.java \
 	sun/net/www/protocol/ftp/Handler.java \
 	sun/net/www/protocol/ftp/FtpURLConnection.java \
-	sun/net/www/protocol/gopher/GopherClient.java \
-	sun/net/www/protocol/gopher/Handler.java \
 	sun/net/www/protocol/mailto/Handler.java \
 	sun/net/www/protocol/mailto/MailToURLConnection.java \
 	sun/net/idn/Punycode.java \
--- a/jdk/make/sun/security/tools/Makefile	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/sun/security/tools/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jdk
-RESOURCE_BUNDLES_JAVA = sun/security/tools/JarSignerResources.java
+RESOURCE_BUNDLES_JAVA = sun/security/tools/jarsigner/Resources.java
 
 #
 # Rules
@@ -45,7 +45,7 @@
 include $(BUILDDIR)/common/Classes.gmk
 
 build:
-	$(call make-launcher, keytool, sun.security.tools.KeyTool, , )
+	$(call make-launcher, keytool, sun.security.tools.keytool.Main, , )
 ifndef BUILD_HEADLESS_ONLY
 	$(call make-launcher, policytool, sun.security.tools.policytool.PolicyTool, , )
 endif
--- a/jdk/make/tools/freetypecheck/Makefile	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/make/tools/freetypecheck/Makefile	Wed Oct 31 09:25:20 2012 -0700
@@ -37,11 +37,11 @@
 
 # Start with CFLAGS (which gets us the required -xarch setting on solaris)
 ifeq ($(PLATFORM), windows)
-  FT_OPTIONS  = /nologo /c
+  FT_OPTIONS  = -nologo -c
   FREETYPE_DLL = $(FREETYPE_LIB_PATH)/freetype.dll
   FT_LD_OPTIONS  = $(FREETYPE_LIB_PATH)/freetype.lib
   ifdef MT
-    FT_LD_OPTIONS += /manifest
+    FT_LD_OPTIONS += -manifest
   endif
 else
   FT_OPTIONS  = $(CFLAGS)
@@ -72,11 +72,11 @@
 	$(prep-target)
 ifeq ($(PLATFORM), windows)
 	$(CC) $(FT_OPTIONS) $(CC_OBJECT_OUTPUT_FLAG)$(FT_OBJ) $<
-	$(LINK) $(FT_LD_OPTIONS) /OUT:$(FT_TEST) $(FT_OBJ)
+	$(LINK) $(FT_LD_OPTIONS) -OUT:$(FT_TEST) $(FT_OBJ)
 	$(CP) $(FREETYPE_DLL) $(@D)/
   ifdef MT
 	$(CP) $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(@D)/
-	$(MT) /manifest $(FT_TEST).manifest /outputresource:$(FT_TEST);#1
+	$(MT) -manifest $(FT_TEST).manifest -outputresource:$(FT_TEST);#1
   endif
 else
 	@$(CC) $(FT_OPTIONS) -o $@ $< $(FT_LD_OPTIONS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/msys_build_scripts/dospath.sh	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,42 @@
+#
+# 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.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+# A shell script which converts its first argument, which must be an existing 
+# path name, into a DOS (aka 8.3) path name. If the path is a file, only the 
+# directory part of the whole path will be converted.
+# This shell script executes the Visual Basic helper script 'dospath.vbs'
+# which must be located in the same directory as this script itself.
+# The Visual Basic script will be invoked trough the "Windows Script Host"
+# which is available by default on Windows since Windows 98.
+
+pushd `dirname "$0"` > /dev/null
+ABS_PATH=`pwd`
+popd > /dev/null
+if [ -d "$1" ]; then
+  echo `cd "$1" && cscript.exe -nologo $ABS_PATH/dospath.vbs`;
+elif [ -f "$1" ]; then
+  DIR=`dirname "$1"`;
+  echo `cd "$DIR" && cscript.exe -nologo $ABS_PATH/dospath.vbs`\\`basename "$1"`;
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/msys_build_scripts/dospath.vbs	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,34 @@
+'
+' 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.  Oracle designates this
+' particular file as subject to the "Classpath" exception as provided
+' by Oracle in the LICENSE file that accompanied this code.
+'
+' 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.
+'
+
+'
+' Visual Basic Script which returns the DOS (aka 8.3) filename of the current
+' directory.
+' Only called from 'dospath.sh' during a Windows build under MinGW/MSYS.
+'
+
+Set fso=CreateObject("Scripting.FileSystemObject")
+Set path = fso.GetFolder(".")
+WScript.Echo path.ShortPath
--- a/jdk/makefiles/CompileLaunchers.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/makefiles/CompileLaunchers.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -232,7 +232,7 @@
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
 
 $(eval $(call SetupLauncher,jarsigner,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.JarSigner"$(COMMA) }'))
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
 
 $(eval $(call SetupLauncher,javac,\
     -DEXPAND_CLASSPATH_WILDCARDS \
@@ -310,7 +310,7 @@
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
 
 $(eval $(call SetupLauncher,keytool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.KeyTool"$(COMMA) }'))
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }'))
 
 $(eval $(call SetupLauncher,native2ascii,\
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -209,7 +209,6 @@
 else
 	LIBJAVA_EXCLUDE_FILES += \
 		ProcessImpl_md.c \
-		Win32FileSystem_md.c \
 		WinNTFileSystem_md.c \
 		dirent_md.c \
 		WindowsPreferences.c \
--- a/jdk/makefiles/CreateJars.gmk	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/makefiles/CreateJars.gmk	Wed Oct 31 09:25:20 2012 -0700
@@ -131,15 +131,15 @@
 	sun/tools/serialver \
 	sun/tools/tree \
 	sun/tools/util \
-	sun/security/tools/JarBASE64Encoder.class \
-	sun/security/tools/JarSigner.class \
-	sun/security/tools/JarSignerParameters.class \
-	sun/security/tools/JarSignerResources.class \
-	sun/security/tools/JarSignerResources_ja.class \
-	sun/security/tools/JarSignerResources_zh_CN.class \
-	sun/security/tools/SignatureFile\$$$$Block.class \
-	sun/security/tools/SignatureFile.class \
-	sun/security/tools/TimestampedSigner.class \
+	sun/security/tools/jarsigner/JarBASE64Encoder.class \
+	sun/security/tools/jarsigner/Main.class \
+	sun/security/tools/jarsigner/JarSignerParameters.class \
+	sun/security/tools/jarsigner/Resources.class \
+	sun/security/tools/jarsigner/Resources_ja.class \
+	sun/security/tools/jarsigner/Resources_zh_CN.class \
+	sun/security/tools/jarsigner/SignatureFile\$$$$Block.class \
+	sun/security/tools/jarsigner/SignatureFile.class \
+	sun/security/tools/jarsigner/TimestampedSigner.class \
 	sun/security/provider/Sun.class \
 	sun/security/rsa/SunRsaSign.class \
 	sun/security/ssl \
--- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java	Wed Oct 31 09:25:20 2012 -0700
@@ -100,7 +100,7 @@
         else
             this.isUser = isUserNode();
         path = isRoot ? absolutePath() : absolutePath() + "/";
-        file = cfFileForNode(isUser);
+        file = cfFileForNode(this.isUser);
         if (isNew)
             newNode = isNew;
         else
--- a/jdk/src/share/classes/com/sun/beans/decoder/DocumentHandler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/beans/decoder/DocumentHandler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -37,6 +37,9 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
@@ -46,6 +49,8 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
+import sun.misc.SharedSecrets;
+
 /**
  * The main class to parse JavaBeans XML archive.
  *
@@ -56,11 +61,10 @@
  * @see ElementHandler
  */
 public final class DocumentHandler extends DefaultHandler {
-    private final Map<String, Class<? extends ElementHandler>> handlers = new HashMap<String, Class<? extends ElementHandler>>();
-
-    private final Map<String, Object> environment = new HashMap<String, Object>();
-
-    private final List<Object> objects = new ArrayList<Object>();
+    private final AccessControlContext acc = AccessController.getContext();
+    private final Map<String, Class<? extends ElementHandler>> handlers = new HashMap<>();
+    private final Map<String, Object> environment = new HashMap<>();
+    private final List<Object> objects = new ArrayList<>();
 
     private Reference<ClassLoader> loader;
     private ExceptionListener listener;
@@ -351,23 +355,32 @@
      *
      * @param input  the input source to parse
      */
-    public void parse(InputSource input) {
-        try {
-            SAXParserFactory.newInstance().newSAXParser().parse(input, this);
+    public void parse(final InputSource input) {
+        if ((this.acc == null) && (null != System.getSecurityManager())) {
+            throw new SecurityException("AccessControlContext is not set");
         }
-        catch (ParserConfigurationException exception) {
-            handleException(exception);
-        }
-        catch (SAXException wrapper) {
-            Exception exception = wrapper.getException();
-            if (exception == null) {
-                exception = wrapper;
+        AccessControlContext stack = AccessController.getContext();
+        SharedSecrets.getJavaSecurityAccess().doIntersectionPrivilege(new PrivilegedAction<Void>() {
+            public Void run() {
+                try {
+                    SAXParserFactory.newInstance().newSAXParser().parse(input, DocumentHandler.this);
+                }
+                catch (ParserConfigurationException exception) {
+                    handleException(exception);
+                }
+                catch (SAXException wrapper) {
+                    Exception exception = wrapper.getException();
+                    if (exception == null) {
+                        exception = wrapper;
+                    }
+                    handleException(exception);
+                }
+                catch (IOException exception) {
+                    handleException(exception);
+                }
+                return null;
             }
-            handleException(exception);
-        }
-        catch (IOException exception) {
-            handleException(exception);
-        }
+        }, stack, this.acc);
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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,6 +35,8 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import sun.reflect.misc.MethodUtil;
+
 /**
  * This class is intended to handle &lt;property&gt; element.
  * This element simplifies access to the properties.
@@ -168,11 +170,11 @@
     private static Object getPropertyValue(Object bean, String name, Integer index) throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException {
         Class<?> type = bean.getClass();
         if (index == null) {
-            return findGetter(type, name).invoke(bean);
+            return MethodUtil.invoke(findGetter(type, name), bean, new Object[] {});
         } else if (type.isArray() && (name == null)) {
             return Array.get(bean, index);
         } else {
-            return findGetter(type, name, int.class).invoke(bean, index);
+            return MethodUtil.invoke(findGetter(type, name, int.class), bean, new Object[] {index});
         }
     }
 
@@ -197,11 +199,11 @@
                 : null;
 
         if (index == null) {
-            findSetter(type, name, param).invoke(bean, value);
+            MethodUtil.invoke(findSetter(type, name, param), bean, new Object[] {value});
         } else if (type.isArray() && (name == null)) {
             Array.set(bean, index, value);
         } else {
-            findSetter(type, name, int.class, param).invoke(bean, index, value);
+            MethodUtil.invoke(findSetter(type, name, int.class, param), bean, new Object[] {index, value});
         }
     }
 
--- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Wed Oct 31 09:25:20 2012 -0700
@@ -68,9 +68,9 @@
         this.notifBuffer = notifBuffer;
         this.connectionId = connectionId;
         connectionTimeout = EnvHelp.getServerConnectionTimeout(env);
-        checkNotificationEmission = EnvHelp.computeBooleanFromString(
-            env,
-            "jmx.remote.x.check.notification.emission",false);
+
+        String stringBoolean = (String) env.get("jmx.remote.x.check.notification.emission");
+        checkNotificationEmission = EnvHelp.computeBooleanFromString( stringBoolean );
         notificationAccessController =
                 EnvHelp.getNotificationAccessController(env);
     }
--- a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java	Wed Oct 31 09:25:20 2012 -0700
@@ -665,97 +665,57 @@
      * Computes a boolean value from a string value retrieved from a
      * property in the given map.
      *
-     * @param env the environment map.
-     * @param prop the name of the property in the environment map whose
-     * returned string value must be converted into a boolean value.
-     * @param systemProperty if true, consult a system property of the
-     * same name if there is no entry in the environment map.
+     * @param stringBoolean the string value that must be converted
+     * into a boolean value.
      *
      * @return
      *   <ul>
-     *   <li>{@code false} if {@code env.get(prop)} is {@code null}</li>
+     *   <li>{@code false} if {@code stringBoolean} is {@code null}</li>
      *   <li>{@code false} if
-     *       {@code ((String)env.get(prop)).equalsIgnoreCase("false")}
+     *       {@code stringBoolean.equalsIgnoreCase("false")}
      *       is {@code true}</li>
      *   <li>{@code true} if
-     *       {@code ((String)env.get(prop)).equalsIgnoreCase("true")}
+     *       {@code stringBoolean.equalsIgnoreCase("true")}
      *       is {@code true}</li>
      *   </ul>
      *
-     * @throws IllegalArgumentException if {@code env} is {@code null} or
-     * {@code env.get(prop)} is not {@code null} and
+     * @throws IllegalArgumentException if
      * {@code ((String)env.get(prop)).equalsIgnoreCase("false")} and
      * {@code ((String)env.get(prop)).equalsIgnoreCase("true")} are
      * {@code false}.
-     * @throws ClassCastException if {@code env.get(prop)} cannot be cast
-     * to {@code String}.
      */
-    public static boolean computeBooleanFromString(
-            Map<String, ?> env, String prop, boolean systemProperty) {
-
-        if (env == null)
-            throw new IllegalArgumentException("env map cannot be null");
-
+    public static boolean computeBooleanFromString(String stringBoolean) {
         // returns a default value of 'false' if no property is found...
-        return computeBooleanFromString(env,prop,systemProperty,false);
+        return computeBooleanFromString(stringBoolean,false);
     }
 
     /**
      * Computes a boolean value from a string value retrieved from a
      * property in the given map.
      *
-     * @param env the environment map.
-     * @param prop the name of the property in the environment map whose
-     * returned string value must be converted into a boolean value.
-     * @param systemProperty if true, consult a system property of the
-     * same name if there is no entry in the environment map.
+     * @param stringBoolean the string value that must be converted
+     * into a boolean value.
      * @param defaultValue a default value to return in case no property
      *        was defined.
      *
      * @return
      *   <ul>
-     *   <li>{@code defaultValue} if {@code env.get(prop)} is {@code null}
-     *       and {@code systemProperty} is {@code false}</li>
-     *   <li>{@code defaultValue} if {@code env.get(prop)} is {@code null}
-     *       and {@code systemProperty} is {@code true} and
-     *       {@code System.getProperty(prop)} is {@code null}</li>
-     *   <li>{@code false} if {@code env.get(prop)} is {@code null}
-     *       and {@code systemProperty} is {@code true} and
-     *       {@code System.getProperty(prop).equalsIgnoreCase("false")}
-     *       is {@code true}</li>
-     *   <li>{@code true} if {@code env.get(prop)} is {@code null}
-     *       and {@code systemProperty} is {@code true} and
-     *       {@code System.getProperty(prop).equalsIgnoreCase("true")}
-     *       is {@code true}</li>
+     *   <li>{@code defaultValue} if {@code stringBoolean}
+     *   is {@code null}</li>
      *   <li>{@code false} if
-     *       {@code ((String)env.get(prop)).equalsIgnoreCase("false")}
+     *       {@code stringBoolean.equalsIgnoreCase("false")}
      *       is {@code true}</li>
      *   <li>{@code true} if
-     *       {@code ((String)env.get(prop)).equalsIgnoreCase("true")}
+     *       {@code stringBoolean.equalsIgnoreCase("true")}
      *       is {@code true}</li>
      *   </ul>
      *
-     * @throws IllegalArgumentException if {@code env} is {@code null} or
-     * {@code env.get(prop)} is not {@code null} and
+     * @throws IllegalArgumentException if
      * {@code ((String)env.get(prop)).equalsIgnoreCase("false")} and
      * {@code ((String)env.get(prop)).equalsIgnoreCase("true")} are
      * {@code false}.
-     * @throws ClassCastException if {@code env.get(prop)} cannot be cast
-     * to {@code String}.
      */
-    public static boolean computeBooleanFromString(
-            Map<String, ?> env, String prop,
-            boolean systemProperty, boolean defaultValue) {
-
-        if (env == null)
-            throw new IllegalArgumentException("env map cannot be null");
-
-        String stringBoolean = (String) env.get(prop);
-        if (stringBoolean == null && systemProperty) {
-            stringBoolean =
-                    AccessController.doPrivileged(new GetPropertyAction(prop));
-        }
-
+    public static boolean computeBooleanFromString( String stringBoolean, boolean defaultValue) {
         if (stringBoolean == null)
             return defaultValue;
         else if (stringBoolean.equalsIgnoreCase("true"))
@@ -763,8 +723,8 @@
         else if (stringBoolean.equalsIgnoreCase("false"))
             return false;
         else
-            throw new IllegalArgumentException(prop +
-                " must be \"true\" or \"false\" instead of \"" +
+            throw new IllegalArgumentException(
+                "Property value must be \"true\" or \"false\" instead of \"" +
                 stringBoolean + "\"");
     }
 
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Wed Oct 31 09:25:20 2012 -0700
@@ -157,7 +157,8 @@
     volatile IOException closureReason = null;
     volatile boolean useable = true;  // is Connection still useable
 
-    private int readTimeout;
+    int readTimeout;
+    int connectTimeout;
 
     // true means v3; false means v2
     // Called in LdapClient.authenticate() (which is synchronized)
@@ -187,6 +188,7 @@
         this.port = port;
         this.parent = parent;
         this.readTimeout = readTimeout;
+        this.connectTimeout = connectTimeout;
 
         if (trace != null) {
             traceFile = trace;
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java	Wed Oct 31 09:25:20 2012 -0700
@@ -150,149 +150,155 @@
         String authMechanism, Control[] ctls,  Hashtable<?,?> env)
         throws NamingException {
 
-        authenticateCalled = true;
+        int readTimeout = conn.readTimeout;
+        conn.readTimeout = conn.connectTimeout;
+        LdapResult res = null;
 
         try {
-            ensureOpen();
-        } catch (IOException e) {
-            NamingException ne = new CommunicationException();
-            ne.setRootCause(e);
-            throw ne;
-        }
+            authenticateCalled = true;
 
-        switch (version) {
-        case LDAP_VERSION3_VERSION2:
-        case LDAP_VERSION3:
-            isLdapv3 = true;
-            break;
-        case LDAP_VERSION2:
-            isLdapv3 = false;
-            break;
-        default:
-            throw new CommunicationException("Protocol version " + version +
-                " not supported");
-        }
+            try {
+                ensureOpen();
+            } catch (IOException e) {
+                NamingException ne = new CommunicationException();
+                ne.setRootCause(e);
+                throw ne;
+            }
 
-        LdapResult res = null;
+            switch (version) {
+            case LDAP_VERSION3_VERSION2:
+            case LDAP_VERSION3:
+                isLdapv3 = true;
+                break;
+            case LDAP_VERSION2:
+                isLdapv3 = false;
+                break;
+            default:
+                throw new CommunicationException("Protocol version " + version +
+                    " not supported");
+            }
 
-        if (authMechanism.equalsIgnoreCase("none") ||
-            authMechanism.equalsIgnoreCase("anonymous")) {
+            if (authMechanism.equalsIgnoreCase("none") ||
+                authMechanism.equalsIgnoreCase("anonymous")) {
 
-            // Perform LDAP bind if we are reauthenticating, using LDAPv2,
-            // supporting failover to LDAPv2, or controls have been supplied.
-            if (!initial ||
-                (version == LDAP_VERSION2) ||
-                (version == LDAP_VERSION3_VERSION2) ||
-                ((ctls != null) && (ctls.length > 0))) {
+                // Perform LDAP bind if we are reauthenticating, using LDAPv2,
+                // supporting failover to LDAPv2, or controls have been supplied.
+                if (!initial ||
+                    (version == LDAP_VERSION2) ||
+                    (version == LDAP_VERSION3_VERSION2) ||
+                    ((ctls != null) && (ctls.length > 0))) {
+                    try {
+                        // anonymous bind; update name/pw for LDAPv2 retry
+                        res = ldapBind(name=null, (byte[])(pw=null), ctls, null,
+                            false);
+                        if (res.status == LdapClient.LDAP_SUCCESS) {
+                            conn.setBound();
+                        }
+                    } catch (IOException e) {
+                        NamingException ne =
+                            new CommunicationException("anonymous bind failed: " +
+                            conn.host + ":" + conn.port);
+                        ne.setRootCause(e);
+                        throw ne;
+                    }
+                } else {
+                    // Skip LDAP bind for LDAPv3 anonymous bind
+                    res = new LdapResult();
+                    res.status = LdapClient.LDAP_SUCCESS;
+                }
+            } else if (authMechanism.equalsIgnoreCase("simple")) {
+                // simple authentication
+                byte[] encodedPw = null;
                 try {
-                    // anonymous bind; update name/pw for LDAPv2 retry
-                    res = ldapBind(name=null, (byte[])(pw=null), ctls, null,
-                        false);
+                    encodedPw = encodePassword(pw, isLdapv3);
+                    res = ldapBind(name, encodedPw, ctls, null, false);
                     if (res.status == LdapClient.LDAP_SUCCESS) {
                         conn.setBound();
                     }
                 } catch (IOException e) {
                     NamingException ne =
-                        new CommunicationException("anonymous bind failed: " +
+                        new CommunicationException("simple bind failed: " +
+                            conn.host + ":" + conn.port);
+                    ne.setRootCause(e);
+                    throw ne;
+                } finally {
+                    // If pw was copied to a new array, clear that array as
+                    // a security precaution.
+                    if (encodedPw != pw && encodedPw != null) {
+                        for (int i = 0; i < encodedPw.length; i++) {
+                            encodedPw[i] = 0;
+                        }
+                    }
+                }
+            } else if (isLdapv3) {
+                // SASL authentication
+                try {
+                    res = LdapSasl.saslBind(this, conn, conn.host, name, pw,
+                        authMechanism, env, ctls);
+                    if (res.status == LdapClient.LDAP_SUCCESS) {
+                        conn.setBound();
+                    }
+                } catch (IOException e) {
+                    NamingException ne =
+                        new CommunicationException("SASL bind failed: " +
                         conn.host + ":" + conn.port);
                     ne.setRootCause(e);
                     throw ne;
                 }
             } else {
-                // Skip LDAP bind for LDAPv3 anonymous bind
-                res = new LdapResult();
-                res.status = LdapClient.LDAP_SUCCESS;
+                throw new AuthenticationNotSupportedException(authMechanism);
             }
-        } else if (authMechanism.equalsIgnoreCase("simple")) {
-            // simple authentication
-            byte[] encodedPw = null;
-            try {
-                encodedPw = encodePassword(pw, isLdapv3);
-                res = ldapBind(name, encodedPw, ctls, null, false);
-                if (res.status == LdapClient.LDAP_SUCCESS) {
-                    conn.setBound();
-                }
-            } catch (IOException e) {
-                NamingException ne =
-                    new CommunicationException("simple bind failed: " +
-                        conn.host + ":" + conn.port);
-                ne.setRootCause(e);
-                throw ne;
-            } finally {
-                // If pw was copied to a new array, clear that array as
-                // a security precaution.
-                if (encodedPw != pw && encodedPw != null) {
-                    for (int i = 0; i < encodedPw.length; i++) {
-                        encodedPw[i] = 0;
+
+            //
+            // re-try login using v2 if failing over
+            //
+            if (initial &&
+                (res.status == LdapClient.LDAP_PROTOCOL_ERROR) &&
+                (version == LdapClient.LDAP_VERSION3_VERSION2) &&
+                (authMechanism.equalsIgnoreCase("none") ||
+                    authMechanism.equalsIgnoreCase("anonymous") ||
+                    authMechanism.equalsIgnoreCase("simple"))) {
+
+                byte[] encodedPw = null;
+                try {
+                    isLdapv3 = false;
+                    encodedPw = encodePassword(pw, false);
+                    res = ldapBind(name, encodedPw, ctls, null, false);
+                    if (res.status == LdapClient.LDAP_SUCCESS) {
+                        conn.setBound();
+                    }
+                } catch (IOException e) {
+                    NamingException ne =
+                        new CommunicationException(authMechanism + ":" +
+                            conn.host +     ":" + conn.port);
+                    ne.setRootCause(e);
+                    throw ne;
+                } finally {
+                    // If pw was copied to a new array, clear that array as
+                    // a security precaution.
+                    if (encodedPw != pw && encodedPw != null) {
+                        for (int i = 0; i < encodedPw.length; i++) {
+                            encodedPw[i] = 0;
+                        }
                     }
                 }
             }
-        } else if (isLdapv3) {
-            // SASL authentication
-            try {
-                res = LdapSasl.saslBind(this, conn, conn.host, name, pw,
-                    authMechanism, env, ctls);
-                if (res.status == LdapClient.LDAP_SUCCESS) {
-                    conn.setBound();
-                }
-            } catch (IOException e) {
-                NamingException ne =
-                    new CommunicationException("SASL bind failed: " +
-                    conn.host + ":" + conn.port);
-                ne.setRootCause(e);
-                throw ne;
+
+            // principal name not found
+            // (map NameNotFoundException to AuthenticationException)
+            // %%% This is a workaround for Netscape servers returning
+            // %%% no such object when the principal name is not found
+            // %%% Note that when this workaround is applied, it does not allow
+            // %%% response controls to be recorded by the calling context
+            if (res.status == LdapClient.LDAP_NO_SUCH_OBJECT) {
+                throw new AuthenticationException(
+                    getErrorMessage(res.status, res.errorMessage));
             }
-        } else {
-            throw new AuthenticationNotSupportedException(authMechanism);
+            conn.setV3(isLdapv3);
+            return res;
+        } finally {
+            conn.readTimeout = readTimeout;
         }
-
-        //
-        // re-try login using v2 if failing over
-        //
-        if (initial &&
-            (res.status == LdapClient.LDAP_PROTOCOL_ERROR) &&
-            (version == LdapClient.LDAP_VERSION3_VERSION2) &&
-            (authMechanism.equalsIgnoreCase("none") ||
-                authMechanism.equalsIgnoreCase("anonymous") ||
-                authMechanism.equalsIgnoreCase("simple"))) {
-
-            byte[] encodedPw = null;
-            try {
-                isLdapv3 = false;
-                encodedPw = encodePassword(pw, false);
-                res = ldapBind(name, encodedPw, ctls, null, false);
-                if (res.status == LdapClient.LDAP_SUCCESS) {
-                    conn.setBound();
-                }
-            } catch (IOException e) {
-                NamingException ne =
-                    new CommunicationException(authMechanism + ":" +
-                        conn.host +     ":" + conn.port);
-                ne.setRootCause(e);
-                throw ne;
-            } finally {
-                // If pw was copied to a new array, clear that array as
-                // a security precaution.
-                if (encodedPw != pw && encodedPw != null) {
-                    for (int i = 0; i < encodedPw.length; i++) {
-                        encodedPw[i] = 0;
-                    }
-                }
-            }
-        }
-
-        // principal name not found
-        // (map NameNotFoundException to AuthenticationException)
-        // %%% This is a workaround for Netscape servers returning
-        // %%% no such object when the principal name is not found
-        // %%% Note that when this workaround is applied, it does not allow
-        // %%% response controls to be recorded by the calling context
-        if (res.status == LdapClient.LDAP_NO_SUCH_OBJECT) {
-            throw new AuthenticationException(
-                getErrorMessage(res.status, res.errorMessage));
-        }
-        conn.setV3(isLdapv3);
-        return res;
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1746,12 +1746,7 @@
 
         // convert to a Double and compare to zero
         try {
-            Double d = new Double(value.toString());
-            if (d.compareTo(new Double((double)0)) == 0) {
-                return false;
-            } else {
-                return true;
-            }
+            return Double.compare(Double.parseDouble(value.toString()), 0) != 0;
         } catch (NumberFormatException ex) {
             throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.boolfail").toString(),
                   new Object[] {value.toString().trim(), columnIndex}));
@@ -2039,6 +2034,7 @@
      *            the cursor is not on a valid row, or this method fails
      * @deprecated
      */
+    @Deprecated
     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
         Object value;
         BigDecimal bDecimal, retVal;
@@ -2374,6 +2370,7 @@
      * @throws SQLException if an error occurs
      * @deprecated
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
         // always free an old stream
         unicodeStream = null;
@@ -2643,6 +2640,7 @@
      * @deprecated Use the <code>getBigDecimal(String columnName)</code>
      *             method instead
      */
+    @Deprecated
     public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
         return getBigDecimal(getColIdxByName(columnName), scale);
     }
@@ -2774,6 +2772,7 @@
      *            this rowset's rows or its insert row
      * @deprecated use the method <code>getCharacterStream</code> instead
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
         return getUnicodeStream(getColIdxByName(columnName));
     }
@@ -4428,7 +4427,7 @@
         // make sure the cursor is on a valid row
         checkCursor();
 
-        Object obj = convertNumeric(new Float(x),
+        Object obj = convertNumeric(Float.valueOf(x),
         java.sql.Types.REAL,
         RowSetMD.getColumnType(columnIndex));
 
@@ -4463,7 +4462,7 @@
         checkIndex(columnIndex);
         // make sure the cursor is on a valid row
         checkCursor();
-        Object obj = convertNumeric(new Double(x),
+        Object obj = convertNumeric(Double.valueOf(x),
         java.sql.Types.DOUBLE,
         RowSetMD.getColumnType(columnIndex));
 
--- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -839,7 +839,7 @@
 
       if(onInsertRow) {
          if(p != null) {
-            bool = p.evaluate(new Float(x) , columnIndex);
+            bool = p.evaluate(Float.valueOf(x), columnIndex);
 
             if(!bool) {
                throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
@@ -906,7 +906,7 @@
 
       if(onInsertRow) {
          if(p != null) {
-            bool = p.evaluate(new Double(x) , columnIndex);
+            bool = p.evaluate(Double.valueOf(x) , columnIndex);
 
             if(!bool) {
                throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1016,6 +1016,7 @@
      *            prepared statement, and result set
      * @deprecated
      */
+    @Deprecated
     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
         checkState();
 
@@ -1154,6 +1155,7 @@
      * @deprecated use <code>getCharacterStream</code> in place of
      *              <code>getUnicodeStream</code>
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
         checkState();
 
@@ -1336,6 +1338,7 @@
      *            prepared statement, and result set
      * @deprecated
      */
+    @Deprecated
     public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
         return getBigDecimal(findColumn(columnName), scale);
     }
@@ -1461,6 +1464,7 @@
      *            prepared statement, and result set
      * @deprecated
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
         return getUnicodeStream(findColumn(columnName));
     }
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1153,6 +1153,7 @@
      *            the cursor is not on a valid row, or this method fails
      * @deprecated
      */
+    @Deprecated
     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
         return crsInternal.getBigDecimal(columnIndex);
     }
@@ -1264,6 +1265,7 @@
      * @throws SQLException if an error occurs
      * @deprecated
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
         return crsInternal.getUnicodeStream(columnIndex);
     }
@@ -1436,6 +1438,7 @@
      * @deprecated use the method <code>getBigDecimal(String columnName)</code>
      *             instead
      */
+    @Deprecated
     public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
         return crsInternal.getBigDecimal(columnName);
     }
@@ -1552,6 +1555,7 @@
      *            this rowset's rows or its insert row
      * @deprecated use the method <code>getCharacterStream</code> instead
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
         return crsInternal.getUnicodeStream(columnName);
     }
--- a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1288,6 +1288,7 @@
      *            the cursor is not on a valid row, or this method fails
      * @deprecated
      */
+    @Deprecated
     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
        throw new UnsupportedOperationException();
     }
@@ -1424,6 +1425,7 @@
      * @throws SQLException if an error occurs
      * @deprecated
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
        throw new UnsupportedOperationException();
     }
@@ -1653,6 +1655,7 @@
      * @deprecated Use the <code>getBigDecimal(String columnName)</code>
      *             method instead
      */
+    @Deprecated
     public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
         throw new UnsupportedOperationException();
     }
@@ -1784,6 +1787,7 @@
      *            this rowset's rows or its insert row
      * @deprecated use the method <code>getCharacterStream</code> instead
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
         throw new UnsupportedOperationException();
     }
--- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Wed Oct 31 09:25:20 2012 -0700
@@ -802,7 +802,7 @@
 
         if (doNotPrompt) {
             throw new LoginException
-                ("Unable to obtain Princpal Name for authentication ");
+                ("Unable to obtain Principal Name for authentication ");
         } else {
             if (callbackHandler == null)
                 throw new LoginException("No CallbackHandler "
--- a/jdk/src/share/classes/java/beans/XMLDecoder.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/beans/XMLDecoder.java	Wed Oct 31 09:25:20 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
@@ -29,6 +29,9 @@
 import java.io.Closeable;
 import java.io.InputStream;
 import java.io.IOException;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import org.xml.sax.InputSource;
 import org.xml.sax.helpers.DefaultHandler;
@@ -61,6 +64,7 @@
  * @author Philip Milne
  */
 public class XMLDecoder implements AutoCloseable {
+    private final AccessControlContext acc = AccessController.getContext();
     private final DocumentHandler handler = new DocumentHandler();
     private final InputSource input;
     private Object owner;
@@ -189,7 +193,15 @@
             return false;
         }
         if (this.array == null) {
-            this.handler.parse(this.input);
+            if ((this.acc == null) && (null != System.getSecurityManager())) {
+                throw new SecurityException("AccessControlContext is not set");
+            }
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                public Void run() {
+                    XMLDecoder.this.handler.parse(XMLDecoder.this.input);
+                    return null;
+                }
+            }, this.acc);
             this.array = this.handler.getObjects();
         }
         return true;
--- a/jdk/src/share/classes/java/io/FilePermission.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/io/FilePermission.java	Wed Oct 31 09:25:20 2012 -0700
@@ -407,7 +407,7 @@
      * @return a hash code value for this object.
      */
     public int hashCode() {
-        return this.cpath.hashCode();
+        return 0;
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Wed Oct 31 09:25:20 2012 -0700
@@ -79,7 +79,7 @@
             default : throw new InternalError("unexpected xtype: " + xtype);
             }
         } catch (Throwable t) {
-            throw new InternalError(t);
+            throw newInternalError(t);
         }
     }
 
@@ -97,7 +97,7 @@
             case 'D': return cloneExtendD(type, form, (double) x);
             }
         } catch (Throwable t) {
-            throw new InternalError(t);
+            throw newInternalError(t);
         }
         throw new InternalError("unexpected type: " + xtype);
     }
@@ -115,7 +115,7 @@
         try {
              return clone(srcType, form);
          } catch (Throwable t) {
-             throw new InternalError(t);
+             throw newInternalError(t);
          }
     }
 
@@ -124,7 +124,7 @@
         try {
              return clone(newType, form.permuteArguments(1, reorder, basicTypes(newType.parameterList())));
          } catch (Throwable t) {
-             throw new InternalError(t);
+             throw newInternalError(t);
          }
     }
 
@@ -166,7 +166,7 @@
             case 'J': return argJ(i);
             }
         } catch (Throwable ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
         throw new InternalError("unexpected type: " + speciesData().types+"."+i);
     }
@@ -192,7 +192,7 @@
         try {
             return (MethodHandle) argL(0);
         } catch (Throwable ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
     }
 
@@ -464,7 +464,7 @@
                     }
                 }
             } catch (Throwable e) {
-                throw new InternalError(e);
+                throw newInternalError(e);
             }
 
             for (SpeciesData d : CACHE.values()) {
@@ -748,7 +748,7 @@
             try {
                 return LOOKUP.findGetter(cbmhClass, fieldName, fieldType);
             } catch (NoSuchFieldException | IllegalAccessException e) {
-                throw new InternalError(e);
+                throw newInternalError(e);
             }
         }
 
@@ -776,7 +776,7 @@
                 Field F_SPECIES_DATA = cbmh.getDeclaredField("SPECIES_DATA");
                 return (SpeciesData) F_SPECIES_DATA.get(null);
             } catch (ReflectiveOperationException ex) {
-                throw new InternalError(ex);
+                throw newInternalError(ex);
             }
         }
 
@@ -802,7 +802,7 @@
             try {
                 return linkConstructor(LOOKUP.findConstructor(cbmh, MethodType.fromMethodDescriptorString(makeSignature(types, true), null)));
             } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | TypeNotPresentException e) {
-                throw new InternalError(e);
+                throw newInternalError(e);
             }
         }
 
@@ -833,7 +833,7 @@
                 linkerMN = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linkerMN, null, NoSuchMethodException.class);
                 assert(linkerMN.isStatic());
             } catch (ReflectiveOperationException ex) {
-                throw new InternalError(ex);
+                throw newInternalError(ex);
             }
             // extend arguments array
             Object[] newArgs = Arrays.copyOf(initName.arguments, initName.arguments.length + 1);
--- a/jdk/src/share/classes/java/lang/invoke/CallSite.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/CallSite.java	Wed Oct 31 09:25:20 2012 -0700
@@ -222,7 +222,7 @@
             GET_TARGET = IMPL_LOOKUP.
                 findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
         } catch (ReflectiveOperationException e) {
-            throw new InternalError(e);
+            throw newInternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Wed Oct 31 09:25:20 2012 -0700
@@ -218,7 +218,7 @@
         try {
             linker = IMPL_NAMES.resolveOrFail(REF_invokeStatic, linker, null, NoSuchMethodException.class);
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
         final int DMH_THIS    = 0;
         final int ARG_BASE    = 1;
@@ -554,7 +554,7 @@
         try {
             linker = IMPL_NAMES.resolveOrFail(REF_invokeVirtual, linker, null, NoSuchMethodException.class);
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
 
         // What is the external type of the lambda form?
@@ -653,7 +653,7 @@
                 nf.resolve();
             }
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
     }
 }
--- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Oct 31 09:25:20 2012 -0700
@@ -138,7 +138,7 @@
                 DUMP_CLASS_FILES_DIR = dumpDir;
                 System.out.println("Dumping class files to "+DUMP_CLASS_FILES_DIR+"/...");
             } catch (Exception e) {
-                throw new InternalError(e);
+                throw newInternalError(e);
             }
         } else {
             DUMP_CLASS_FILES_COUNTERS = null;
@@ -162,7 +162,7 @@
                         file.close();
                         return null;
                     } catch (IOException ex) {
-                        throw new InternalError(ex);
+                        throw newInternalError(ex);
                     }
                 }
             });
@@ -279,7 +279,7 @@
         try {
             member = MEMBERNAME_FACTORY.resolveOrFail(REF_invokeStatic, member, HOST_CLASS, ReflectiveOperationException.class);
         } catch (ReflectiveOperationException e) {
-            throw new InternalError(e);
+            throw newInternalError(e);
         }
         //System.out.println("resolveInvokerMember => "+member);
         return member;
--- a/jdk/src/share/classes/java/lang/invoke/Invokers.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/Invokers.java	Wed Oct 31 09:25:20 2012 -0700
@@ -27,6 +27,7 @@
 
 import java.util.Arrays;
 import sun.invoke.empty.Empty;
+import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
 import static java.lang.invoke.LambdaForm.*;
@@ -128,9 +129,8 @@
         try {
             //Lookup.findVirtual(MethodHandle.class, name, type);
             return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, name, type);
-
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError("JVM cannot find invoker for "+type, ex);
+            throw newInternalError("JVM cannot find invoker for "+type, ex);
         }
     }
 
@@ -176,7 +176,7 @@
                     .findVirtual(MethodHandle.class, "asSpreader",
                         MethodType.methodType(MethodHandle.class, Class.class, int.class));
             } catch (ReflectiveOperationException ex) {
-                throw new InternalError(ex);
+                throw newInternalError(ex);
             }
             makeSpreader = MethodHandles.insertArguments(makeSpreader, 1, Object[].class, spreadArgCount);
             vaInvoker = MethodHandles.filterArgument(arrayInvoker, 0, makeSpreader);
@@ -215,7 +215,7 @@
                     .findStatic(CallSite.class, "uninitializedCallSite",
                                 MethodType.methodType(Empty.class));
             } catch (ReflectiveOperationException ex) {
-                throw new InternalError(ex);
+                throw newInternalError(ex);
             }
         }
         invoker = MethodHandles.explicitCastArguments(invoker, MethodType.methodType(targetType.returnType()));
@@ -389,7 +389,7 @@
             form.genericInvoker = gamh;
             return gamh;
         } catch (Exception ex) {
-            throw new InternalError("Exception while resolving inexact invoke", ex);
+            throw newInternalError("Exception while resolving inexact invoke", ex);
         }
     }
 
@@ -456,7 +456,7 @@
             NF_getCallSiteTarget.resolve();
             // bound
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
     }
 
--- a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java	Wed Oct 31 09:25:20 2012 -0700
@@ -457,7 +457,7 @@
             isCompiled = true;
             return vmentry;
         } catch (Error | Exception ex) {
-            throw new InternalError(this.toString(), ex);
+            throw newInternalError(this.toString(), ex);
         }
     }
 
@@ -1547,7 +1547,7 @@
             try {
                 zmem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zmem, null, NoSuchMethodException.class);
             } catch (IllegalAccessException|NoSuchMethodException ex) {
-                throw new InternalError(ex);
+                throw newInternalError(ex);
             }
             NamedFunction zcon = new NamedFunction(zmem);
             Name n = new Name(zcon).newIndex(0);
--- a/jdk/src/share/classes/java/lang/invoke/MemberName.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MemberName.java	Wed Oct 31 09:25:20 2012 -0700
@@ -558,7 +558,7 @@
         try {
             return (MemberName) super.clone();
         } catch (CloneNotSupportedException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
      }
 
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1372,7 +1372,7 @@
             NF_reinvokerTarget = new LambdaForm.NamedFunction(MethodHandle.class
                 .getDeclaredMethod("reinvokerTarget"));
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
     }
 
@@ -1397,7 +1397,7 @@
         try {
             FORM_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class.getDeclaredField("form"));
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
     }
 }
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -25,13 +25,14 @@
 
 package java.lang.invoke;
 
-import sun.invoke.util.VerifyType;
-
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyType;
 import sun.invoke.util.Wrapper;
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.MethodHandleStatics.*;
@@ -478,7 +479,7 @@
                     .getDeclaredMethod("checkSpreadArgument", Object.class, int.class));
             NF_checkSpreadArgument.resolve();
         } catch (ReflectiveOperationException ex) {
-            throw new InternalError(ex);
+            throw newInternalError(ex);
         }
     }
 
@@ -781,4 +782,168 @@
         return mh;
     }
 
+    /**
+     * Create an alias for the method handle which, when called,
+     * appears to be called from the same class loader and protection domain
+     * as hostClass.
+     * This is an expensive no-op unless the method which is called
+     * is sensitive to its caller.  A small number of system methods
+     * are in this category, including Class.forName and Method.invoke.
+     */
+    static
+    MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
+        return BindCaller.bindCaller(mh, hostClass);
+    }
+
+    // Put the whole mess into its own nested class.
+    // That way we can lazily load the code and set up the constants.
+    private static class BindCaller {
+        static
+        MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
+            // Do not use this function to inject calls into system classes.
+            if (hostClass == null) {
+                hostClass = C_Trampoline;
+            } else if (hostClass.isArray() ||
+                       hostClass.isPrimitive() ||
+                       hostClass.getName().startsWith("java.") ||
+                       hostClass.getName().startsWith("sun.")) {
+                throw new InternalError();  // does not happen, and should not anyway
+            }
+            // For simplicity, convert mh to a varargs-like method.
+            MethodHandle vamh = prepareForInvoker(mh);
+            // Cache the result of makeInjectedInvoker once per argument class.
+            MethodHandle bccInvoker = CV_makeInjectedInvoker.get(hostClass);
+            return restoreToType(bccInvoker.bindTo(vamh), mh.type());
+        }
+
+        // This class ("Trampoline") is known to be inside a dead-end class loader.
+        // Inject all doubtful calls into this class.
+        private static Class<?> C_Trampoline;
+        static {
+            Class<?> tramp = null;
+            try {
+                final int FRAME_COUNT_ARG = 1;  // [0] Reflection [1] Trampoline
+                java.lang.reflect.Method gcc = sun.reflect.Reflection.class.getMethod("getCallerClass", int.class);
+                tramp = (Class<?>) sun.reflect.misc.MethodUtil.invoke(gcc, null, new Object[]{ FRAME_COUNT_ARG });
+                if (tramp.getClassLoader() == BindCaller.class.getClassLoader())
+                    throw new RuntimeException(tramp.getName()+" class loader");
+            } catch (Throwable ex) {
+                throw new InternalError(ex);
+            }
+            C_Trampoline = tramp;
+        }
+
+        private static MethodHandle makeInjectedInvoker(Class<?> hostClass) {
+            Class<?> bcc = UNSAFE.defineAnonymousClass(hostClass, T_BYTES, null);
+            if (hostClass.getClassLoader() != bcc.getClassLoader())
+                throw new InternalError(hostClass.getName()+" (CL)");
+            try {
+                if (hostClass.getProtectionDomain() != bcc.getProtectionDomain())
+                    throw new InternalError(hostClass.getName()+" (PD)");
+            } catch (SecurityException ex) {
+                // Self-check was blocked by security manager.  This is OK.
+                // In fact the whole try body could be turned into an assertion.
+            }
+            try {
+                MethodHandle init = IMPL_LOOKUP.findStatic(bcc, "init", MethodType.methodType(void.class));
+                init.invokeExact();  // force initialization of the class
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
+            MethodHandle bccInvoker;
+            try {
+                MethodType invokerMT = MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
+                bccInvoker = IMPL_LOOKUP.findStatic(bcc, "invoke_V", invokerMT);
+            } catch (ReflectiveOperationException ex) {
+                throw uncaughtException(ex);
+            }
+            // Test the invoker, to ensure that it really injects into the right place.
+            try {
+                MethodHandle vamh = prepareForInvoker(MH_checkCallerClass);
+                Object ok = bccInvoker.invokeExact(vamh, new Object[]{hostClass, bcc});
+            } catch (Throwable ex) {
+                throw new InternalError(ex);
+            }
+            return bccInvoker;
+        }
+        private static ClassValue<MethodHandle> CV_makeInjectedInvoker = new ClassValue<MethodHandle>() {
+            @Override protected MethodHandle computeValue(Class<?> hostClass) {
+                return makeInjectedInvoker(hostClass);
+            }
+        };
+
+        // Adapt mh so that it can be called directly from an injected invoker:
+        private static MethodHandle prepareForInvoker(MethodHandle mh) {
+            mh = mh.asFixedArity();
+            MethodType mt = mh.type();
+            int arity = mt.parameterCount();
+            MethodHandle vamh = mh.asType(mt.generic());
+            vamh.internalForm().compileToBytecode();  // eliminate LFI stack frames
+            vamh = vamh.asSpreader(Object[].class, arity);
+            vamh.internalForm().compileToBytecode();  // eliminate LFI stack frames
+            return vamh;
+        }
+
+        // Undo the adapter effect of prepareForInvoker:
+        private static MethodHandle restoreToType(MethodHandle vamh, MethodType type) {
+            return vamh.asCollector(Object[].class, type.parameterCount()).asType(type);
+        }
+
+        private static final MethodHandle MH_checkCallerClass;
+        static {
+            final Class<?> THIS_CLASS = BindCaller.class;
+            assert(checkCallerClass(THIS_CLASS, THIS_CLASS));
+            try {
+                MH_checkCallerClass = IMPL_LOOKUP
+                    .findStatic(THIS_CLASS, "checkCallerClass",
+                                MethodType.methodType(boolean.class, Class.class, Class.class));
+                assert((boolean) MH_checkCallerClass.invokeExact(THIS_CLASS, THIS_CLASS));
+            } catch (Throwable ex) {
+                throw new InternalError(ex);
+            }
+        }
+
+        private static boolean checkCallerClass(Class<?> expected, Class<?> expected2) {
+            final int FRAME_COUNT_ARG = 2;  // [0] Reflection [1] BindCaller [2] Expected
+            Class<?> actual = sun.reflect.Reflection.getCallerClass(FRAME_COUNT_ARG);
+            if (actual != expected && actual != expected2)
+                throw new InternalError("found "+actual.getName()+", expected "+expected.getName()
+                                        +(expected == expected2 ? "" : ", or else "+expected2.getName()));
+            return true;
+        }
+
+        private static final byte[] T_BYTES;
+        static {
+            final Object[] values = {null};
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                    public Void run() {
+                        try {
+                            Class<T> tClass = T.class;
+                            String tName = tClass.getName();
+                            String tResource = tName.substring(tName.lastIndexOf('.')+1)+".class";
+                            java.net.URLConnection uconn = tClass.getResource(tResource).openConnection();
+                            int len = uconn.getContentLength();
+                            byte[] bytes = new byte[len];
+                            try (java.io.InputStream str = uconn.getInputStream()) {
+                                int nr = str.read(bytes);
+                                if (nr != len)  throw new java.io.IOException(tResource);
+                            }
+                            values[0] = bytes;
+                        } catch (java.io.IOException ex) {
+                            throw new InternalError(ex);
+                        }
+                        return null;
+                    }
+                });
+            T_BYTES = (byte[]) values[0];
+        }
+
+        // The following class is used as a template for Unsafe.defineAnonymousClass:
+        private static class T {
+            static void init() { }  // side effect: initializes this class
+            static Object invoke_V(MethodHandle vamh, Object[] args) throws Throwable {
+                return vamh.invokeExact(args);
+            }
+        }
+    }
 }
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Wed Oct 31 09:25:20 2012 -0700
@@ -385,4 +385,101 @@
             throw err;
         }
     }
+
+    /**
+     * Is this method a caller-sensitive method?
+     * I.e., does it call Reflection.getCallerClass or a similer method
+     * to ask about the identity of its caller?
+     */
+    // FIXME: Replace this pattern match by an annotation @sun.reflect.CallerSensitive.
+    static boolean isCallerSensitive(MemberName mem) {
+        assert(mem.isInvocable());
+        Class<?> defc = mem.getDeclaringClass();
+        switch (mem.getName()) {
+        case "doPrivileged":
+            return defc == java.security.AccessController.class;
+        case "getUnsafe":
+            return defc == sun.misc.Unsafe.class;
+        case "lookup":
+            return defc == java.lang.invoke.MethodHandles.class;
+        case "invoke":
+            return defc == java.lang.reflect.Method.class;
+        case "get":
+        case "getBoolean":
+        case "getByte":
+        case "getChar":
+        case "getShort":
+        case "getInt":
+        case "getLong":
+        case "getFloat":
+        case "getDouble":
+        case "set":
+        case "setBoolean":
+        case "setByte":
+        case "setChar":
+        case "setShort":
+        case "setInt":
+        case "setLong":
+        case "setFloat":
+        case "setDouble":
+            return defc == java.lang.reflect.Field.class;
+        case "newInstance":
+            if (defc == java.lang.reflect.Constructor.class)  return true;
+            if (defc == java.lang.Class.class)  return true;
+            break;
+        case "forName":
+        case "getClassLoader":
+        case "getClasses":
+        case "getFields":
+        case "getMethods":
+        case "getConstructors":
+        case "getDeclaredClasses":
+        case "getDeclaredFields":
+        case "getDeclaredMethods":
+        case "getDeclaredConstructors":
+        case "getField":
+        case "getMethod":
+        case "getConstructor":
+        case "getDeclaredField":
+        case "getDeclaredMethod":
+        case "getDeclaredConstructor":
+            return defc == java.lang.Class.class;
+        case "getConnection":
+        case "getDriver":
+        case "getDrivers":
+        case "deregisterDriver":
+            return defc == java.sql.DriverManager.class;
+        case "newUpdater":
+            if (defc == java.util.concurrent.atomic.AtomicIntegerFieldUpdater.class)  return true;
+            if (defc == java.util.concurrent.atomic.AtomicLongFieldUpdater.class)  return true;
+            if (defc == java.util.concurrent.atomic.AtomicReferenceFieldUpdater.class)  return true;
+            break;
+        case "getContextClassLoader":
+            return defc == java.lang.Thread.class;
+        case "getPackage":
+        case "getPackages":
+            return defc == java.lang.Package.class;
+        case "getParent":
+        case "getSystemClassLoader":
+            return defc == java.lang.ClassLoader.class;
+        case "load":
+        case "loadLibrary":
+            if (defc == java.lang.Runtime.class)  return true;
+            if (defc == java.lang.System.class)  return true;
+            break;
+        case "getCallerClass":
+            if (defc == sun.reflect.Reflection.class)  return true;
+            if (defc == java.lang.System.class)  return true;
+            break;
+        case "getCallerClassLoader":
+            return defc == java.lang.ClassLoader.class;
+        case "getProxyClass":
+        case "newProxyInstance":
+            return defc == java.lang.reflect.Proxy.class;
+        case "getBundle":
+        case "clearCache":
+            return defc == java.util.ResourceBundle.class;
+        }
+        return false;
+    }
 }
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -93,6 +93,12 @@
     }
 
     // handy shared exception makers (they simplify the common case code)
+    /*non-public*/ static InternalError newInternalError(String message, Throwable cause) {
+        return new InternalError(message, cause);
+    }
+    /*non-public*/ static InternalError newInternalError(Throwable cause) {
+        return new InternalError(cause);
+    }
     /*non-public*/ static RuntimeException newIllegalStateException(String message) {
         return new IllegalStateException(message);
     }
@@ -108,8 +114,8 @@
     /*non-public*/ static RuntimeException newIllegalArgumentException(String message, Object obj, Object obj2) {
         return new IllegalArgumentException(message(message, obj, obj2));
     }
-    /*non-public*/ static Error uncaughtException(Exception ex) {
-        throw new InternalError("uncaught exception", ex);
+    /*non-public*/ static Error uncaughtException(Throwable ex) {
+        throw newInternalError("uncaught exception", ex);
     }
     static Error NYI() {
         throw new AssertionError("NYI");
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -329,6 +329,7 @@
      *     where {@code defcPkg} is the package of {@code defc}.
      * </ul>
      */
+    // FIXME in MR1: clarify that the bytecode behavior of a caller-ID method (like Class.forName) is relative to the lookupClass used to create the method handle, not the dynamic caller of the method handle
     public static final
     class Lookup {
         /** The class on behalf of whom the lookup is being performed. */
@@ -1209,6 +1210,7 @@
             if (method.isMethodHandleInvoke())
                 return fakeMethodHandleInvoke(method);
             MethodHandle mh = DirectMethodHandle.make(refc, method);
+            mh = maybeBindCaller(method, mh);
             mh = mh.setVarargs(method);
             if (doRestrict)
                 mh = restrictReceiver(method, mh, lookupClass());
@@ -1217,6 +1219,16 @@
         private MethodHandle fakeMethodHandleInvoke(MemberName method) {
             return throwException(method.getReturnType(), UnsupportedOperationException.class);
         }
+        private MethodHandle maybeBindCaller(MemberName method, MethodHandle mh) throws IllegalAccessException {
+            if (allowedModes == TRUSTED || !MethodHandleNatives.isCallerSensitive(method))
+                return mh;
+            Class<?> hostClass = lookupClass;
+            if ((allowedModes & PRIVATE) == 0)  // caller must use full-power lookup
+                hostClass = null;
+            MethodHandle cbmh = MethodHandleImpl.bindCaller(mh, hostClass);
+            // Note: caller will apply varargs after this step happens.
+            return cbmh;
+        }
         private MethodHandle getDirectField(byte refKind, Class<?> refc, MemberName field) throws IllegalAccessException {
             checkField(refKind, refc, field);
             MethodHandle mh = DirectMethodHandle.make(refc, field);
@@ -1229,6 +1241,7 @@
         private MethodHandle getDirectConstructor(Class<?> refc, MemberName ctor) throws IllegalAccessException {
             assert(ctor.isConstructor());
             checkAccess(REF_newInvokeSpecial, refc, ctor);
+            assert(!MethodHandleNatives.isCallerSensitive(ctor));  // maybeBindCaller not relevant here
             return DirectMethodHandle.make(ctor).setVarargs(ctor);
         }
 
--- a/jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -52,6 +52,7 @@
     private boolean shut_wr = false;
 
     private SocketInputStream socketInputStream = null;
+    private SocketOutputStream socketOutputStream = null;
 
     /* number of threads using the FileDescriptor */
     protected int fdUseCount = 0;
@@ -436,7 +437,10 @@
         if (shut_wr) {
             throw new IOException("Socket output is shutdown");
         }
-        return new SocketOutputStream(this);
+        if (socketOutputStream == null) {
+            socketOutputStream = new SocketOutputStream(this);
+        }
+        return socketOutputStream;
     }
 
     void setFileDescriptor(FileDescriptor fd) {
--- a/jdk/src/share/classes/java/net/ProxySelector.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/net/ProxySelector.java	Wed Oct 31 09:25:20 2012 -0700
@@ -127,7 +127,6 @@
      * <UL>
      * <LI>http URI for http connections</LI>
      * <LI>https URI for https connections
-     * <LI>ftp URI for ftp connections</LI>
      * <LI><code>socket://host:port</code><br>
      *     for tcp client sockets connections</LI>
      * </UL>
--- a/jdk/src/share/classes/java/net/URL.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/net/URL.java	Wed Oct 31 09:25:20 2012 -0700
@@ -274,7 +274,7 @@
      * <p>Protocol handlers for the following protocols are guaranteed
      * to exist on the search path :-
      * <blockquote><pre>
-     *     http, https, ftp, file, and jar
+     *     http, https, file, and jar
      * </pre></blockquote>
      * Protocol handlers for additional protocols may also be
      * available.
--- a/jdk/src/share/classes/java/net/URLStreamHandler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/net/URLStreamHandler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -37,8 +37,7 @@
  * The abstract class <code>URLStreamHandler</code> is the common
  * superclass for all stream protocol handlers. A stream protocol
  * handler knows how to make a connection for a particular protocol
- * type, such as <code>http</code>, <code>ftp</code>, or
- * <code>gopher</code>.
+ * type, such as <code>http</code> or <code>https</code>.
  * <p>
  * In most cases, an instance of a <code>URLStreamHandler</code>
  * subclass is not created directly by an application. Rather, the
--- a/jdk/src/share/classes/java/net/package.html	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/net/package.html	Wed Oct 31 09:25:20 2012 -0700
@@ -72,7 +72,7 @@
 <ul>
       <li>{@link java.net.URI} is the class representing a Universal Resource Identifier, as specified in RFC 2396. As the name indicates, this is just an Identifier and doesn't provide directly the means to access the resource.</li>
       <li>{@link java.net.URL} is the class representing a Universal Resource Locator, which is both an older concept for URIs and a means to access the resources.</li>
-      <li>{@link java.net.URLConnection} is created from a URL and is the communication link used to access the resource pointed by the URL. This abstract class will delegate most of the work to the underlying protocol handlers like http or ftp.</li>
+      <li>{@link java.net.URLConnection} is created from a URL and is the communication link used to access the resource pointed by the URL. This abstract class will delegate most of the work to the underlying protocol handlers like http or https.</li>
       <li>{@link java.net.HttpURLConnection} is a subclass of URLConnection and provides some additional functionalities specific to the HTTP protocol.</li>
 </ul>
 <p>The recommended usage is to use {@link java.net.URI} to identify resources, then convert it into a {@link java.net.URL} when it is time to access the resource. From that URL, you can either get the {@link java.net.URLConnection} for fine control, or get directly the InputStream.<p>
--- a/jdk/src/share/classes/java/security/AccessController.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/security/AccessController.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -290,11 +290,11 @@
      */
     public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) {
 
-        DomainCombiner dc = null;
         AccessControlContext acc = getStackAccessControlContext();
-        if (acc == null || (dc = acc.getAssignedCombiner()) == null) {
+        if (acc == null) {
             return AccessController.doPrivileged(action);
         }
+        DomainCombiner dc = acc.getAssignedCombiner();
         return AccessController.doPrivileged(action, preserveCombiner(dc));
     }
 
@@ -386,11 +386,11 @@
     public static <T> T doPrivilegedWithCombiner
         (PrivilegedExceptionAction<T> action) throws PrivilegedActionException {
 
-        DomainCombiner dc = null;
         AccessControlContext acc = getStackAccessControlContext();
-        if (acc == null || (dc = acc.getAssignedCombiner()) == null) {
+        if (acc == null) {
             return AccessController.doPrivileged(action);
         }
+        DomainCombiner dc = acc.getAssignedCombiner();
         return AccessController.doPrivileged(action, preserveCombiner(dc));
     }
 
@@ -417,7 +417,12 @@
         // perform 'combine' on the caller of doPrivileged,
         // even if the caller is from the bootclasspath
         ProtectionDomain[] pds = new ProtectionDomain[] {callerPd};
-        return new AccessControlContext(combiner.combine(pds, null), combiner);
+        if (combiner == null) {
+            return new AccessControlContext(pds);
+        } else {
+            return new AccessControlContext(combiner.combine(pds, null),
+                                            combiner);
+        }
     }
 
 
--- a/jdk/src/share/classes/java/sql/CallableStatement.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/sql/CallableStatement.java	Wed Oct 31 09:25:20 2012 -0700
@@ -295,6 +295,7 @@
      *             or <code>getBigDecimal(String parameterName)</code>
      * @see #setBigDecimal
      */
+    @Deprecated
     BigDecimal getBigDecimal(int parameterIndex, int scale)
         throws SQLException;
 
--- a/jdk/src/share/classes/java/sql/Date.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/sql/Date.java	Wed Oct 31 09:25:20 2012 -0700
@@ -51,6 +51,7 @@
      * @param day 1 to 31
      * @deprecated instead use the constructor <code>Date(long date)</code>
      */
+    @Deprecated
     public Date(int year, int month, int day) {
         super(year, month, day);
     }
@@ -179,6 +180,7 @@
     * @exception java.lang.IllegalArgumentException if this method is invoked
     * @see #setHours
     */
+    @Deprecated
     public int getHours() {
         throw new java.lang.IllegalArgumentException();
     }
@@ -191,6 +193,7 @@
     * @exception java.lang.IllegalArgumentException if this method is invoked
     * @see #setMinutes
     */
+    @Deprecated
     public int getMinutes() {
         throw new java.lang.IllegalArgumentException();
     }
@@ -203,6 +206,7 @@
     * @exception java.lang.IllegalArgumentException if this method is invoked
     * @see #setSeconds
     */
+    @Deprecated
     public int getSeconds() {
         throw new java.lang.IllegalArgumentException();
     }
@@ -215,6 +219,7 @@
     * @exception java.lang.IllegalArgumentException if this method is invoked
     * @see #getHours
     */
+    @Deprecated
     public void setHours(int i) {
         throw new java.lang.IllegalArgumentException();
     }
@@ -227,6 +232,7 @@
     * @exception java.lang.IllegalArgumentException if this method is invoked
     * @see #getMinutes
     */
+    @Deprecated
     public void setMinutes(int i) {
         throw new java.lang.IllegalArgumentException();
     }
@@ -239,6 +245,7 @@
     * @exception java.lang.IllegalArgumentException if this method is invoked
     * @see #getSeconds
     */
+    @Deprecated
     public void setSeconds(int i) {
         throw new java.lang.IllegalArgumentException();
     }
--- a/jdk/src/share/classes/java/sql/DriverManager.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/sql/DriverManager.java	Wed Oct 31 09:25:20 2012 -0700
@@ -412,13 +412,14 @@
      * method throws a <code>java.lang.SecurityException</code>.
      *
      * @param out the new logging/tracing PrintStream; to disable, set to <code>null</code>
-     * @deprecated
+     * @deprecated Use {@code setLogWriter}
      * @throws SecurityException if a security manager exists and its
      *    <code>checkPermission</code> method denies setting the log stream
      *
      * @see SecurityManager#checkPermission
      * @see #getLogStream
      */
+    @Deprecated
     public static void setLogStream(java.io.PrintStream out) {
 
         SecurityManager sec = System.getSecurityManager();
@@ -438,9 +439,10 @@
      * and all drivers.
      *
      * @return the logging/tracing PrintStream; if disabled, is <code>null</code>
-     * @deprecated
+     * @deprecated  Use {@code getLogWriter}
      * @see #setLogStream
      */
+    @Deprecated
     public static java.io.PrintStream getLogStream() {
         return logStream;
     }
--- a/jdk/src/share/classes/java/sql/PreparedStatement.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/sql/PreparedStatement.java	Wed Oct 31 09:25:20 2012 -0700
@@ -342,8 +342,9 @@
      * this method is called on a closed <code>PreparedStatement</code>
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
-     * @deprecated
+     * @deprecated Use {@code setCharacterStream}
      */
+    @Deprecated
     void setUnicodeStream(int parameterIndex, java.io.InputStream x,
                           int length) throws SQLException;
 
--- a/jdk/src/share/classes/java/sql/ResultSet.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/sql/ResultSet.java	Wed Oct 31 09:25:20 2012 -0700
@@ -356,8 +356,10 @@
      *            called on a closed result set
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
-     * @deprecated
+     * @deprecated Use {@code getBigDecimal(int columnIndex)}
+     *             or {@code getBigDecimal(String columnLabel)}
      */
+    @Deprecated
     BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException;
 
     /**
@@ -477,6 +479,7 @@
      * @deprecated use <code>getCharacterStream</code> in place of
      *              <code>getUnicodeStream</code>
      */
+    @Deprecated
     java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException;
 
     /**
@@ -641,8 +644,10 @@
      *            called on a closed result set
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
-     * @deprecated
+     * @deprecated Use {@code getBigDecimal(int columnIndex)}
+     *             or {@code getBigDecimal(String columnLabel)}
      */
+    @Deprecated
     BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException;
 
     /**
@@ -760,6 +765,7 @@
      * this method
      * @deprecated use <code>getCharacterStream</code> instead
      */
+    @Deprecated
     java.io.InputStream getUnicodeStream(String columnLabel) throws SQLException;
 
     /**
--- a/jdk/src/share/classes/java/text/DateFormatSymbols.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/text/DateFormatSymbols.java	Wed Oct 31 09:25:20 2012 -0700
@@ -45,6 +45,7 @@
 import java.text.spi.DateFormatSymbolsProvider;
 import java.util.Arrays;
 import java.util.Locale;
+import java.util.Objects;
 import java.util.ResourceBundle;
 import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
@@ -366,6 +367,7 @@
      */
     public void setEras(String[] newEras) {
         eras = Arrays.copyOf(newEras, newEras.length);
+        cachedHashCode = 0;
     }
 
     /**
@@ -393,6 +395,7 @@
      */
     public void setMonths(String[] newMonths) {
         months = Arrays.copyOf(newMonths, newMonths.length);
+        cachedHashCode = 0;
     }
 
     /**
@@ -420,6 +423,7 @@
      */
     public void setShortMonths(String[] newShortMonths) {
         shortMonths = Arrays.copyOf(newShortMonths, newShortMonths.length);
+        cachedHashCode = 0;
     }
 
     /**
@@ -439,6 +443,7 @@
      */
     public void setWeekdays(String[] newWeekdays) {
         weekdays = Arrays.copyOf(newWeekdays, newWeekdays.length);
+        cachedHashCode = 0;
     }
 
     /**
@@ -458,6 +463,7 @@
      */
     public void setShortWeekdays(String[] newShortWeekdays) {
         shortWeekdays = Arrays.copyOf(newShortWeekdays, newShortWeekdays.length);
+        cachedHashCode = 0;
     }
 
     /**
@@ -474,6 +480,7 @@
      */
     public void setAmPmStrings(String[] newAmpms) {
         ampms = Arrays.copyOf(newAmpms, newAmpms.length);
+        cachedHashCode = 0;
     }
 
     /**
@@ -558,6 +565,7 @@
         }
         zoneStrings = aCopy;
         isZoneStringsSet = true;
+        cachedHashCode = 0;
     }
 
     /**
@@ -576,6 +584,7 @@
     public void setLocalPatternChars(String newLocalPatternChars) {
         // Call toString() to throw an NPE in case the argument is null
         localPatternChars = newLocalPatternChars.toString();
+        cachedHashCode = 0;
     }
 
     /**
@@ -597,12 +606,23 @@
      * Override hashCode.
      * Generates a hash code for the DateFormatSymbols object.
      */
+    @Override
     public int hashCode() {
-        int hashcode = 0;
-        String[][] zoneStrings = getZoneStringsWrapper();
-        for (int index = 0; index < zoneStrings[0].length; ++index)
-            hashcode ^= zoneStrings[0][index].hashCode();
-        return hashcode;
+        int hashCode = cachedHashCode;
+        if (hashCode == 0) {
+            hashCode = 5;
+            hashCode = 11 * hashCode + Arrays.hashCode(eras);
+            hashCode = 11 * hashCode + Arrays.hashCode(months);
+            hashCode = 11 * hashCode + Arrays.hashCode(shortMonths);
+            hashCode = 11 * hashCode + Arrays.hashCode(weekdays);
+            hashCode = 11 * hashCode + Arrays.hashCode(shortWeekdays);
+            hashCode = 11 * hashCode + Arrays.hashCode(ampms);
+            hashCode = 11 * hashCode + Arrays.deepHashCode(getZoneStringsWrapper());
+            hashCode = 11 * hashCode + Objects.hashCode(localPatternChars);
+            cachedHashCode = hashCode;
+        }
+
+        return hashCode;
     }
 
     /**
@@ -641,6 +661,11 @@
 
     private transient int lastZoneIndex = 0;
 
+    /**
+     * Cached hash code
+     */
+    transient volatile int cachedHashCode = 0;
+
     private void initializeData(Locale desiredLocale) {
         locale = desiredLocale;
 
@@ -782,6 +807,7 @@
             dst.zoneStrings = null;
         }
         dst.localPatternChars = src.localPatternChars;
+        dst.cachedHashCode = 0;
     }
 
     /**
--- a/jdk/src/share/classes/java/util/Hashtable.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/Hashtable.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1059,7 +1059,7 @@
         }
 
         public int hashCode() {
-            return hash ^ (value==null ? 0 : value.hashCode());
+            return (Objects.hashCode(key) ^ Objects.hashCode(value));
         }
 
         public String toString() {
--- a/jdk/src/share/classes/java/util/Properties.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/Properties.java	Wed Oct 31 09:25:20 2012 -0700
@@ -81,8 +81,9 @@
  * <p> The {@link #loadFromXML(InputStream)} and {@link
  * #storeToXML(OutputStream, String, String)} methods load and store properties
  * in a simple XML format.  By default the UTF-8 character encoding is used,
- * however a specific encoding may be specified if required.  An XML properties
- * document has the following DOCTYPE declaration:
+ * however a specific encoding may be specified if required. Implementations
+ * are required to support UTF-8 and UTF-16 and may support other encodings.
+ * An XML properties document has the following DOCTYPE declaration:
  *
  * <pre>
  * &lt;!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"&gt;
@@ -853,23 +854,30 @@
      * Furthermore, the document must satisfy the properties DTD described
      * above.
      *
+     * <p> An implementation is required to read XML documents that use the
+     * "{@code UTF-8}" or "{@code UTF-16}" encoding. An implementation may
+     * support additional encodings.
+     *
      * <p>The specified stream is closed after this method returns.
      *
      * @param in the input stream from which to read the XML document.
      * @throws IOException if reading from the specified input stream
      *         results in an <tt>IOException</tt>.
+     * @throws java.io.UnsupportedEncodingException if the document's encoding
+     *         declaration can be read and it specifies an encoding that is not
+     *         supported
      * @throws InvalidPropertiesFormatException Data on input stream does not
      *         constitute a valid XML document with the mandated document type.
      * @throws NullPointerException if {@code in} is null.
      * @see    #storeToXML(OutputStream, String, String)
+     * @see    <a href="http://www.w3.org/TR/REC-xml/#charencoding">Character
+     *         Encoding in Entities</a>
      * @since 1.5
      */
     public synchronized void loadFromXML(InputStream in)
         throws IOException, InvalidPropertiesFormatException
     {
-        if (in == null)
-            throw new NullPointerException();
-        XmlSupport.load(this, in);
+        XmlSupport.load(this, Objects.requireNonNull(in));
         in.close();
     }
 
@@ -896,8 +904,6 @@
     public void storeToXML(OutputStream os, String comment)
         throws IOException
     {
-        if (os == null)
-            throw new NullPointerException();
         storeToXML(os, comment, "UTF-8");
     }
 
@@ -910,9 +916,13 @@
      * &lt;!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"&gt;
      * </pre>
      *
-     *<p>If the specified comment is {@code null} then no comment
+     * <p>If the specified comment is {@code null} then no comment
      * will be stored in the document.
      *
+     * <p> An implementation is required to support writing of XML documents
+     * that use the "{@code UTF-8}" or "{@code UTF-16}" encoding. An
+     * implementation may support additional encodings.
+     *
      * <p>The specified stream remains open after this method returns.
      *
      * @param os        the output stream on which to emit the XML document.
@@ -924,20 +934,23 @@
      *
      * @throws IOException if writing to the specified output stream
      *         results in an <tt>IOException</tt>.
+     * @throws java.io.UnsupportedEncodingException if the encoding is not
+     *         supported by the implementation.
      * @throws NullPointerException if {@code os} is {@code null},
      *         or if {@code encoding} is {@code null}.
      * @throws ClassCastException  if this {@code Properties} object
      *         contains any keys or values that are not
      *         {@code Strings}.
      * @see    #loadFromXML(InputStream)
+     * @see    <a href="http://www.w3.org/TR/REC-xml/#charencoding">Character
+     *         Encoding in Entities</a>
      * @since 1.5
      */
     public void storeToXML(OutputStream os, String comment, String encoding)
         throws IOException
     {
-        if (os == null)
-            throw new NullPointerException();
-        XmlSupport.save(this, os, comment, encoding);
+        XmlSupport.save(this, Objects.requireNonNull(os), comment,
+                        Objects.requireNonNull(encoding));
     }
 
     /**
--- a/jdk/src/share/classes/java/util/ServiceLoader.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/ServiceLoader.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -214,7 +214,7 @@
 
     private ServiceLoader(Class<S> svc, ClassLoader cl) {
         service = Objects.requireNonNull(svc, "Service interface cannot be null");
-        loader = cl;
+        loader = (cl == null) ? ClassLoader.getSystemClassLoader() : cl;
         reload();
     }
 
@@ -358,14 +358,21 @@
             }
             String cn = nextName;
             nextName = null;
+            Class<?> c = null;
             try {
-                S p = service.cast(Class.forName(cn, true, loader)
-                                   .newInstance());
-                providers.put(cn, p);
-                return p;
+                c = Class.forName(cn, false, loader);
             } catch (ClassNotFoundException x) {
                 fail(service,
                      "Provider " + cn + " not found");
+            }
+            if (!service.isAssignableFrom(c)) {
+                fail(service,
+                     "Provider " + cn  + " not a subtype");
+            }
+            try {
+                S p = service.cast(c.newInstance());
+                providers.put(cn, p);
+                return p;
             } catch (Throwable x) {
                 fail(service,
                      "Provider " + cn + " could not be instantiated: " + x,
--- a/jdk/src/share/classes/java/util/TimeZone.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/TimeZone.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -719,15 +719,16 @@
      * Returns the default TimeZone in an AppContext if any AppContext
      * has ever used. null is returned if any AppContext hasn't been
      * used or if the AppContext doesn't have the default TimeZone.
+     *
+     * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
+     * been loaded. If so, it implies that AWTSecurityManager is not our
+     * SecurityManager and we can use a local static variable.
+     * This works around a build time issue.
      */
-    private synchronized static TimeZone getDefaultInAppContext() {
+    private static TimeZone getDefaultInAppContext() {
         // JavaAWTAccess provides access implementation-private methods without using reflection.
         JavaAWTAccess javaAWTAccess = SharedSecrets.getJavaAWTAccess();
 
-        // Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
-        // been loaded. If so, it implies that AWTSecurityManager is not our
-        // SecurityManager and we can use a local static variable.
-        // This works around a build time issue.
         if (javaAWTAccess == null) {
             return mainAppContextDefault;
         } else {
@@ -749,15 +750,16 @@
      * tz. null is handled special: do nothing if any AppContext
      * hasn't been used, remove the default TimeZone in the
      * AppContext otherwise.
+     *
+     * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
+     * been loaded. If so, it implies that AWTSecurityManager is not our
+     * SecurityManager and we can use a local static variable.
+     * This works around a build time issue.
      */
-    private synchronized static void setDefaultInAppContext(TimeZone tz) {
+    private static void setDefaultInAppContext(TimeZone tz) {
         // JavaAWTAccess provides access implementation-private methods without using reflection.
         JavaAWTAccess javaAWTAccess = SharedSecrets.getJavaAWTAccess();
 
-        // Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
-        // been loaded. If so, it implies that AWTSecurityManager is not our
-        // SecurityManager and we can use a local static variable.
-        // This works around a build time issue.
         if (javaAWTAccess == null) {
             mainAppContextDefault = tz;
         } else {
@@ -822,7 +824,7 @@
     private static final int    GMT_ID_LENGTH = 3;
 
     // a static TimeZone we can reference if no AppContext is in place
-    private static TimeZone mainAppContextDefault;
+    private static volatile TimeZone mainAppContextDefault;
 
     /**
      * Parses a custom time zone identifier and returns a corresponding zone.
--- a/jdk/src/share/classes/java/util/concurrent/Executors.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/concurrent/Executors.java	Wed Oct 31 09:25:20 2012 -0700
@@ -530,18 +530,17 @@
                 return AccessController.doPrivileged(
                     new PrivilegedExceptionAction<T>() {
                         public T run() throws Exception {
-                            ClassLoader savedcl = null;
                             Thread t = Thread.currentThread();
-                            try {
-                                ClassLoader cl = t.getContextClassLoader();
-                                if (ccl != cl) {
-                                    t.setContextClassLoader(ccl);
-                                    savedcl = cl;
+                            ClassLoader cl = t.getContextClassLoader();
+                            if (ccl == cl) {
+                                return task.call();
+                            } else {
+                                t.setContextClassLoader(ccl);
+                                try {
+                                    return task.call();
+                                } finally {
+                                    t.setContextClassLoader(cl);
                                 }
-                                return task.call();
-                            } finally {
-                                if (savedcl != null)
-                                    t.setContextClassLoader(savedcl);
                             }
                         }
                     }, acc);
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003,2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -456,12 +456,12 @@
          * The unpacker's progress as a percentage, as periodically
          * updated by the unpacker.
          * Values of 0 - 100 are normal, and -1 indicates a stall.
-         * Observe this property with a {@link PropertyChangeListener}.
+         * Progress can be monitored by polling the value of this
+         * property.
          * <p>
          * At a minimum, the unpacker must set progress to 0
          * at the beginning of a packing operation, and to 100
          * at the end.
-         * @see  #addPropertyChangeListener
          */
         String PROGRESS                 = "pack.progress";
 
@@ -577,7 +577,15 @@
          * @see #properties
          * @see #PROGRESS
          * @param listener  An object to be invoked when a property is changed.
+         * @deprecated The dependency on {@code PropertyChangeListener} creates
+         *             a significant impediment to future modularization of the
+         *             Java platform. This method will be removed in a future
+         *             release.
+         *             Applications that need to monitor progress of the packer
+         *             can poll the value of the {@link #PROGRESS PROGRESS}
+         *             property instead.
          */
+        @Deprecated
         void addPropertyChangeListener(PropertyChangeListener listener) ;
 
         /**
@@ -586,7 +594,12 @@
          *
          * @see #addPropertyChangeListener
          * @param listener  The PropertyChange listener to be removed.
+         * @deprecated The dependency on {@code PropertyChangeListener} creates
+         *             a significant impediment to future modularization of the
+         *             Java platform. This method will be removed in a future
+         *             release.
          */
+        @Deprecated
         void removePropertyChangeListener(PropertyChangeListener listener);
 
     }
@@ -640,12 +653,12 @@
          * The unpacker's progress as a percentage, as periodically
          * updated by the unpacker.
          * Values of 0 - 100 are normal, and -1 indicates a stall.
-         * Observe this property with a {@link PropertyChangeListener}.
+         * Progress can be monitored by polling the value of this
+         * property.
          * <p>
          * At a minimum, the unpacker must set progress to 0
          * at the beginning of a packing operation, and to 100
          * at the end.
-         * @see #addPropertyChangeListener
          */
         String PROGRESS         = "unpack.progress";
 
@@ -708,7 +721,15 @@
          * @see #properties
          * @see #PROGRESS
          * @param listener  An object to be invoked when a property is changed.
+         * @deprecated The dependency on {@code PropertyChangeListener} creates
+         *             a significant impediment to future modularization of the
+         *             Java platform. This method will be removed in a future
+         *             release.
+         *             Applications that need to monitor progress of the
+         *             unpacker can poll the value of the {@link #PROGRESS
+         *             PROGRESS} property instead.
          */
+        @Deprecated
         void addPropertyChangeListener(PropertyChangeListener listener) ;
 
         /**
@@ -717,7 +738,12 @@
          *
          * @see #addPropertyChangeListener
          * @param listener  The PropertyChange listener to be removed.
+         * @deprecated The dependency on {@code PropertyChangeListener} creates
+         *             a significant impediment to future modularization of the
+         *             Java platform. This method will be removed in a future
+         *             release.
          */
+        @Deprecated
         void removePropertyChangeListener(PropertyChangeListener listener);
     }
 
--- a/jdk/src/share/classes/java/util/logging/FileHandler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/logging/FileHandler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -220,7 +220,7 @@
      * @exception  NullPointerException if pattern property is an empty String.
      */
     public FileHandler() throws IOException, SecurityException {
-        checkAccess();
+        checkPermission();
         configure();
         openFiles();
     }
@@ -246,7 +246,7 @@
         if (pattern.length() < 1 ) {
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
         this.limit = 0;
@@ -278,7 +278,7 @@
         if (pattern.length() < 1 ) {
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
         this.limit = 0;
@@ -315,7 +315,7 @@
         if (limit < 0 || count < 1 || pattern.length() < 1) {
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
         this.limit = limit;
@@ -354,7 +354,7 @@
         if (limit < 0 || count < 1 || pattern.length() < 1) {
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
         this.limit = limit;
@@ -367,7 +367,7 @@
     // configured instance variables.
     private void openFiles() throws IOException {
         LogManager manager = LogManager.getLogManager();
-        manager.checkAccess();
+        manager.checkPermission();
         if (count < 1) {
            throw new IllegalArgumentException("file count = " + count);
         }
--- a/jdk/src/share/classes/java/util/logging/Handler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/logging/Handler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -111,7 +111,7 @@
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
      */
     public void setFormatter(Formatter newFormatter) throws SecurityException {
-        checkAccess();
+        checkPermission();
         // Check for a null pointer:
         newFormatter.getClass();
         formatter = newFormatter;
@@ -140,7 +140,7 @@
      */
     public void setEncoding(String encoding)
                         throws SecurityException, java.io.UnsupportedEncodingException {
-        checkAccess();
+        checkPermission();
         if (encoding != null) {
             try {
                 if(!java.nio.charset.Charset.isSupported(encoding)) {
@@ -175,7 +175,7 @@
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
      */
     public void setFilter(Filter newFilter) throws SecurityException {
-        checkAccess();
+        checkPermission();
         filter = newFilter;
     }
 
@@ -199,7 +199,7 @@
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
      */
     public void setErrorManager(ErrorManager em) {
-        checkAccess();
+        checkPermission();
         if (em == null) {
            throw new NullPointerException();
         }
@@ -213,7 +213,7 @@
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
      */
     public ErrorManager getErrorManager() {
-        checkAccess();
+        checkPermission();
         return errorManager;
     }
 
@@ -253,7 +253,7 @@
         if (newLevel == null) {
             throw new NullPointerException();
         }
-        checkAccess();
+        checkPermission();
         logLevel = newLevel;
     }
 
@@ -296,9 +296,9 @@
     // If "sealed" is true, we check that the caller has
     // appropriate security privileges to update Handler
     // state and if not throw a SecurityException.
-    void checkAccess() throws SecurityException {
+    void checkPermission() throws SecurityException {
         if (sealed) {
-            manager.checkAccess();
+            manager.checkPermission();
         }
     }
 }
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Wed Oct 31 09:25:20 2012 -0700
@@ -311,10 +311,17 @@
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have LoggingPermission("control").
      * @exception NullPointerException if the PropertyChangeListener is null.
+     * @deprecated The dependency on {@code PropertyChangeListener} creates a
+     *             significant impediment to future modularization of the Java
+     *             platform. This method will be removed in a future release.
+     *             The global {@code LogManager} can detect changes to the
+     *             logging configuration by overridding the {@link
+     *             #readConfiguration readConfiguration} method.
      */
+    @Deprecated
     public void addPropertyChangeListener(PropertyChangeListener l) throws SecurityException {
         PropertyChangeListener listener = Objects.requireNonNull(l);
-        checkAccess();
+        checkPermission();
         synchronized (listenerMap) {
             // increment the registration count if already registered
             Integer value = listenerMap.get(listener);
@@ -336,9 +343,16 @@
      * @param l  event listener (can be null)
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have LoggingPermission("control").
+     * @deprecated The dependency on {@code PropertyChangeListener} creates a
+     *             significant impediment to future modularization of the Java
+     *             platform. This method will be removed in a future release.
+     *             The global {@code LogManager} can detect changes to the
+     *             logging configuration by overridding the {@link
+     *             #readConfiguration readConfiguration} method.
      */
+    @Deprecated
     public void removePropertyChangeListener(PropertyChangeListener l) throws SecurityException {
-        checkAccess();
+        checkPermission();
         if (l != null) {
             PropertyChangeListener listener = l;
             synchronized (listenerMap) {
@@ -793,7 +807,7 @@
      * @exception  IOException if there are IO problems reading the configuration.
      */
     public void readConfiguration() throws IOException, SecurityException {
-        checkAccess();
+        checkPermission();
 
         // if a configuration class is specified, load it and use it.
         String cname = System.getProperty("java.util.logging.config.class");
@@ -851,7 +865,7 @@
      */
 
     public void reset() throws SecurityException {
-        checkAccess();
+        checkPermission();
         synchronized (this) {
             props = new Properties();
             // Since we are doing a reset we no longer want to initialize
@@ -936,7 +950,7 @@
      * @exception  IOException if there are problems reading from the stream.
      */
     public void readConfiguration(InputStream ins) throws IOException, SecurityException {
-        checkAccess();
+        checkPermission();
         reset();
 
         // Load the properties
@@ -1113,8 +1127,13 @@
         loadLoggerHandlers(rootLogger, null, "handlers");
     }
 
+    private final Permission controlPermission = new LoggingPermission("control", null);
 
-    private Permission ourPermission = new LoggingPermission("control", null);
+    void checkPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(controlPermission);
+    }
 
     /**
      * Check that the current context is trusted to modify the logging
@@ -1127,11 +1146,7 @@
      *             the caller does not have LoggingPermission("control").
      */
     public void checkAccess() throws SecurityException {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm == null) {
-            return;
-        }
-        sm.checkPermission(ourPermission);
+        checkPermission();
     }
 
     // Nested class to represent a node in our tree of named loggers.
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Wed Oct 31 09:25:20 2012 -0700
@@ -276,13 +276,13 @@
         this.manager = manager;
     }
 
-    private void checkAccess() throws SecurityException {
+    private void checkPermission() throws SecurityException {
         if (!anonymous) {
             if (manager == null) {
                 // Complete initialization of the global Logger.
                 manager = LogManager.getLogManager();
             }
-            manager.checkAccess();
+            manager.checkPermission();
         }
     }
 
@@ -482,7 +482,7 @@
      *             the caller does not have LoggingPermission("control").
      */
     public void setFilter(Filter newFilter) throws SecurityException {
-        checkAccess();
+        checkPermission();
         filter = newFilter;
     }
 
@@ -1168,7 +1168,7 @@
      *             the caller does not have LoggingPermission("control").
      */
     public void setLevel(Level newLevel) throws SecurityException {
-        checkAccess();
+        checkPermission();
         synchronized (treeLock) {
             levelObject = newLevel;
             updateEffectiveLevel();
@@ -1223,7 +1223,7 @@
     public void addHandler(Handler handler) throws SecurityException {
         // Check for null handler
         handler.getClass();
-        checkAccess();
+        checkPermission();
         handlers.add(handler);
     }
 
@@ -1237,7 +1237,7 @@
      *             the caller does not have LoggingPermission("control").
      */
     public void removeHandler(Handler handler) throws SecurityException {
-        checkAccess();
+        checkPermission();
         if (handler == null) {
             return;
         }
@@ -1265,7 +1265,7 @@
      *             the caller does not have LoggingPermission("control").
      */
     public void setUseParentHandlers(boolean useParentHandlers) {
-        checkAccess();
+        checkPermission();
         this.useParentHandlers = useParentHandlers;
     }
 
@@ -1420,7 +1420,7 @@
         if (parent == null) {
             throw new NullPointerException();
         }
-        manager.checkAccess();
+        manager.checkPermission();
         doSetParent(parent);
     }
 
--- a/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -238,7 +238,7 @@
             throw new NullPointerException();
         }
         LogManager manager = LogManager.getLogManager();
-        checkAccess();
+        checkPermission();
         pushLevel = newLevel;
     }
 
--- a/jdk/src/share/classes/java/util/logging/StreamHandler.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/java/util/logging/StreamHandler.java	Wed Oct 31 09:25:20 2012 -0700
@@ -249,7 +249,7 @@
     }
 
     private synchronized void flushAndClose() throws SecurityException {
-        checkAccess();
+        checkPermission();
         if (writer != null) {
             try {
                 if (!doneHeader) {
--- a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1245,13 +1245,12 @@
             return s.substring(1, s.length() - 1);
         }
         final String className = s.substring(1, slash);
+
         final Constructor<?> constr;
         try {
+            ReflectUtil.checkPackageAccess(className);
             final ClassLoader contextClassLoader =
                 Thread.currentThread().getContextClassLoader();
-            if (contextClassLoader == null) {
-                ReflectUtil.checkPackageAccess(className);
-            }
             final Class<?> c =
                 Class.forName(className, false, contextClassLoader);
             constr = c.getConstructor(new Class<?>[] {String.class});
--- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -25,6 +25,30 @@
 
 package javax.management.remote.rmi;
 
+import java.io.IOException;
+import java.rmi.MarshalledObject;
+import java.rmi.UnmarshalException;
+import java.rmi.server.Unreferenced;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.*;
+import javax.management.remote.JMXServerErrorException;
+import javax.management.remote.NotificationResult;
+import javax.management.remote.TargetedNotification;
+import javax.security.auth.Subject;
+
 import static com.sun.jmx.mbeanserver.Util.cast;
 import com.sun.jmx.remote.internal.ServerCommunicatorAdmin;
 import com.sun.jmx.remote.internal.ServerNotifForwarder;
@@ -35,44 +59,6 @@
 import com.sun.jmx.remote.util.EnvHelp;
 import com.sun.jmx.remote.util.OrderClassLoaders;
 
-import java.io.IOException;
-import java.rmi.MarshalledObject;
-import java.rmi.UnmarshalException;
-import java.rmi.server.Unreferenced;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.NotCompliantMBeanException;
-import javax.management.NotificationFilter;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.QueryExp;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-import javax.management.remote.JMXServerErrorException;
-import javax.management.remote.NotificationResult;
-import javax.management.remote.TargetedNotification;
-import javax.security.auth.Subject;
-
 /**
  * <p>Implementation of the {@link RMIConnection} interface.  User
  * code will not usually reference this class.</p>
@@ -143,6 +129,7 @@
         this.mbeanServer = rmiServer.getMBeanServer();
 
         final ClassLoader dcl = defaultClassLoader;
+
         this.classLoaderWithRepository =
             AccessController.doPrivileged(
                 new PrivilegedAction<ClassLoaderWithRepository>() {
@@ -151,13 +138,40 @@
                                       mbeanServer.getClassLoaderRepository(),
                                       dcl);
                     }
+                },
+
+                withPermissions( new MBeanPermission("*", "getClassLoaderRepository"),
+                                 new RuntimePermission("createClassLoader"))
+            );
+
+
+        this.defaultContextClassLoader =
+            AccessController.doPrivileged(
+                new PrivilegedAction<ClassLoader>() {
+            @Override
+                    public ClassLoader run() {
+                        return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
+                                dcl);
+                    }
                 });
+
         serverCommunicatorAdmin = new
           RMIServerCommunicatorAdmin(EnvHelp.getServerConnectionTimeout(env));
 
         this.env = env;
     }
 
+    private static AccessControlContext withPermissions(Permission ... perms){
+        Permissions col = new Permissions();
+
+        for (Permission thePerm : perms ) {
+            col.add(thePerm);
+        }
+
+        final ProtectionDomain pd = new ProtectionDomain(null, col);
+        return new AccessControlContext( new ProtectionDomain[] { pd });
+    }
+
     private synchronized ServerNotifForwarder getServerNotifFwd() {
         // Lazily created when first use. Mainly when
         // addNotificationListener is first called.
@@ -507,7 +521,7 @@
                  "connectionId=" + connectionId
                  +" unwrapping query with defaultClassLoader.");
 
-        queryValue = unwrap(query, defaultClassLoader, QueryExp.class);
+        queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class);
 
         try {
             final Object params[] = new Object[] { name, queryValue };
@@ -542,7 +556,7 @@
                  "connectionId=" + connectionId
                  +" unwrapping query with defaultClassLoader.");
 
-        queryValue = unwrap(query, defaultClassLoader, QueryExp.class);
+        queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class);
 
         try {
             final Object params[] = new Object[] { name, queryValue };
@@ -1330,7 +1344,9 @@
                         public ClassLoader run() throws InstanceNotFoundException {
                             return mbeanServer.getClassLoader(name);
                         }
-                    });
+                    },
+                    withPermissions(new MBeanPermission("*", "getClassLoader"))
+            );
         } catch (PrivilegedActionException pe) {
             throw (InstanceNotFoundException) extractException(pe);
         }
@@ -1345,7 +1361,9 @@
                         public Object run() throws InstanceNotFoundException {
                             return mbeanServer.getClassLoaderFor(name);
                         }
-                    });
+                    },
+                    withPermissions(new MBeanPermission("*", "getClassLoaderFor"))
+            );
         } catch (PrivilegedActionException pe) {
             throw (InstanceNotFoundException) extractException(pe);
         }
@@ -1572,7 +1590,8 @@
             ClassLoader orderCL = AccessController.doPrivileged(
                 new PrivilegedExceptionAction<ClassLoader>() {
                     public ClassLoader run() throws Exception {
-                        return new OrderClassLoaders(cl1, cl2);
+                        return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
+                                new OrderClassLoaders(cl1, cl2));
                     }
                 }
             );
@@ -1664,6 +1683,8 @@
 
     private final ClassLoader defaultClassLoader;
 
+    private final ClassLoader defaultContextClassLoader;
+
     private final ClassLoaderWithRepository classLoaderWithRepository;
 
     private boolean terminated = false;
@@ -1746,4 +1767,43 @@
 
     private static final ClassLogger logger =
         new ClassLogger("javax.management.remote.rmi", "RMIConnectionImpl");
+
+    private static final class CombinedClassLoader extends ClassLoader {
+
+        private final static class ClassLoaderWrapper extends ClassLoader {
+            ClassLoaderWrapper(ClassLoader cl) {
+                super(cl);
+            }
+
+            @Override
+            protected Class<?> loadClass(String name, boolean resolve)
+                    throws ClassNotFoundException {
+                return super.loadClass(name, resolve);
+            }
+        };
+
+        final ClassLoaderWrapper defaultCL;
+
+        private CombinedClassLoader(ClassLoader parent, ClassLoader defaultCL) {
+            super(parent);
+            this.defaultCL = new ClassLoaderWrapper(defaultCL);
+        }
+
+        @Override
+        protected Class<?> loadClass(String name, boolean resolve)
+        throws ClassNotFoundException {
+            try {
+                super.loadClass(name, resolve);
+            } catch(Exception e) {
+                for(Throwable t = e; t != null; t = t.getCause()) {
+                    if(t instanceof SecurityException) {
+                        throw t==e?(SecurityException)t:new SecurityException(t.getMessage(), e);
+                    }
+                }
+            }
+            final Class<?> cl = defaultCL.loadClass(name, resolve);
+            return cl;
+        }
+
+    }
 }
--- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java	Wed Oct 31 09:25:20 2012 -0700
@@ -277,9 +277,9 @@
             // Check for secure RMIServer stub if the corresponding
             // client-side environment property is set to "true".
             //
-            boolean checkStub = EnvHelp.computeBooleanFromString(
-                    usemap,
-                    "jmx.remote.x.check.stub",false);
+            String stringBoolean =  (String) usemap.get("jmx.remote.x.check.stub");
+            boolean checkStub = EnvHelp.computeBooleanFromString(stringBoolean);
+
             if (checkStub) checkStub(stub, rmiServerImplStubClass);
 
             // Connect IIOP Stub if needed.
--- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java	Wed Oct 31 09:25:20 2012 -0700
@@ -412,9 +412,8 @@
                 if (tracing)
                     logger.trace("start", "Using external directory: " + jndiUrl);
 
-                final boolean rebind = EnvHelp.computeBooleanFromString(
-                    attributes,
-                    JNDI_REBIND_ATTRIBUTE,false);
+                String stringBoolean = (String) attributes.get(JNDI_REBIND_ATTRIBUTE);
+                final boolean rebind = EnvHelp.computeBooleanFromString( stringBoolean );
 
                 if (tracing)
                     logger.trace("start", JNDI_REBIND_ATTRIBUTE + "=" + rebind);
--- a/jdk/src/share/classes/javax/management/timer/Timer.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/management/timer/Timer.java	Wed Oct 31 09:25:20 2012 -0700
@@ -28,8 +28,7 @@
 import static com.sun.jmx.defaults.JmxProperties.TIMER_LOGGER;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Hashtable;
-import java.util.Iterator;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
@@ -128,8 +127,8 @@
      * Table containing all the timer notifications of this timer,
      * with the associated date, period and number of occurrences.
      */
-    private Map<Integer,Object[]> timerTable =
-        new Hashtable<Integer,Object[]>();
+    final private Map<Integer,Object[]> timerTable =
+        new HashMap<>();
 
     /**
      * Past notifications sending on/off flag value.
@@ -163,7 +162,7 @@
      * The notification counter ID.
      * Used to keep the max key value inserted into the timer table.
      */
-    private int counterID = 0;
+    volatile private int counterID = 0;
 
     private java.util.Timer timer;
 
@@ -776,7 +775,7 @@
      *
      * @return The number of timer notifications.
      */
-    public int getNbNotifications() {
+    public synchronized int getNbNotifications() {
         return timerTable.size();
     }
 
@@ -824,7 +823,7 @@
      * @return The timer notification type or null if the identifier is not mapped to any
      * timer notification registered for this timer MBean.
      */
-    public String getNotificationType(Integer id) {
+    public synchronized String getNotificationType(Integer id) {
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
@@ -841,7 +840,7 @@
      * @return The timer notification detailed message or null if the identifier is not mapped to any
      * timer notification registered for this timer MBean.
      */
-    public String getNotificationMessage(Integer id) {
+    public synchronized String getNotificationMessage(Integer id) {
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
@@ -862,7 +861,7 @@
     //public Serializable getNotificationUserData(Integer id) {
     // end of NPCTE fix for bugId 4464388
 
-    public Object getNotificationUserData(Integer id) {
+    public synchronized Object getNotificationUserData(Integer id) {
         Object[] obj = timerTable.get(id);
         if (obj != null) {
             return ( ((TimerNotification)obj[TIMER_NOTIF_INDEX]).getUserData() );
@@ -878,7 +877,7 @@
      * @return A copy of the date or null if the identifier is not mapped to any
      * timer notification registered for this timer MBean.
      */
-    public Date getDate(Integer id) {
+    public synchronized Date getDate(Integer id) {
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
@@ -896,7 +895,7 @@
      * @return A copy of the period or null if the identifier is not mapped to any
      * timer notification registered for this timer MBean.
      */
-    public Long getPeriod(Integer id) {
+    public synchronized Long getPeriod(Integer id) {
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
@@ -913,7 +912,7 @@
      * @return A copy of the remaining number of occurrences or null if the identifier is not mapped to any
      * timer notification registered for this timer MBean.
      */
-    public Long getNbOccurences(Integer id) {
+    public synchronized Long getNbOccurences(Integer id) {
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
@@ -931,7 +930,7 @@
      * @return A copy of the flag indicating whether a periodic notification is
      *         executed at <i>fixed-delay</i> or at <i>fixed-rate</i>.
      */
-    public Boolean getFixedRate(Integer id) {
+    public synchronized Boolean getFixedRate(Integer id) {
 
       Object[] obj = timerTable.get(id);
       if (obj != null) {
@@ -982,7 +981,7 @@
      *
      * @return <CODE>true</CODE> if the list of timer notifications is empty, <CODE>false</CODE> otherwise.
      */
-    public boolean isEmpty() {
+    public synchronized boolean isEmpty() {
         return (timerTable.isEmpty());
     }
 
@@ -1184,11 +1183,13 @@
         //
         TimerAlarmClock alarmClock = (TimerAlarmClock)notification.getSource();
 
-        for (Object[] obj : timerTable.values()) {
-            if (obj[ALARM_CLOCK_INDEX] == alarmClock) {
-                timerNotification = (TimerNotification)obj[TIMER_NOTIF_INDEX];
-                timerDate = (Date)obj[TIMER_DATE_INDEX];
-                break;
+        synchronized(Timer.this) {
+            for (Object[] obj : timerTable.values()) {
+                if (obj[ALARM_CLOCK_INDEX] == alarmClock) {
+                    timerNotification = (TimerNotification)obj[TIMER_NOTIF_INDEX];
+                    timerDate = (Date)obj[TIMER_DATE_INDEX];
+                    break;
+                }
             }
         }
 
--- a/jdk/src/share/classes/javax/net/ssl/ExtendedSSLSession.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/ExtendedSSLSession.java	Wed Oct 31 09:25:20 2012 -0700
@@ -25,6 +25,8 @@
 
 package javax.net.ssl;
 
+import java.util.List;
+
 /**
  * Extends the <code>SSLSession</code> interface to support additional
  * session attributes.
@@ -83,4 +85,34 @@
      * @see X509ExtendedKeyManager
      */
     public abstract String[] getPeerSupportedSignatureAlgorithms();
+
+    /**
+     * Obtains a {@link List} containing all {@link SNIServerName}s
+     * of the requested Server Name Indication (SNI) extension.
+     * <P>
+     * In server mode, unless the return {@link List} is empty,
+     * the server should use the requested server names to guide its
+     * selection of an appropriate authentication certificate, and/or
+     * other aspects of security policy.
+     * <P>
+     * In client mode, unless the return {@link List} is empty,
+     * the client should use the requested server names to guide its
+     * endpoint identification of the peer's identity, and/or
+     * other aspects of security policy.
+     *
+     * @return a non-null immutable list of {@link SNIServerName}s of the
+     *         requested server name indications. The returned list may be
+     *         empty if no server name indications were requested.
+     * @throws UnsupportedOperationException if the underlying provider
+     *         does not implement the operation
+     *
+     * @see SNIServerName
+     * @see X509ExtendedTrustManager
+     * @see X509ExtendedKeyManager
+     *
+     * @since 1.8
+     */
+    public List<SNIServerName> getRequestedServerNames() {
+        throw new UnsupportedOperationException();
+    }
 }
--- a/jdk/src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -186,8 +186,7 @@
             // if the provider does not support it, fallback to peer certs.
             // return the X500Principal of the end-entity cert.
             Certificate[] certs = getPeerCertificates();
-            principal = (X500Principal)
-                ((X509Certificate)certs[0]).getSubjectX500Principal();
+            principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
         }
         return principal;
     }
@@ -216,7 +215,7 @@
             // return the X500Principal of the end-entity cert.
             Certificate[] certs = getLocalCertificates();
             if (certs != null) {
-                principal = (X500Principal)
+                principal =
                         ((X509Certificate)certs[0]).getSubjectX500Principal();
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/net/ssl/SNIHostName.java	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,394 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package javax.net.ssl;
+
+import java.net.IDN;
+import java.nio.ByteBuffer;
+import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharacterCodingException;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+/**
+ * Instances of this class represent a server name of type
+ * {@link StandardConstants#SNI_HOST_NAME host_name} in a Server Name
+ * Indication (SNI) extension.
+ * <P>
+ * As described in section 3, "Server Name Indication", of
+ * <A HREF="http://www.ietf.org/rfc/rfc6066.txt">TLS Extensions (RFC 6066)</A>,
+ * "HostName" contains the fully qualified DNS hostname of the server, as
+ * understood by the client.  The encoded server name value of a hostname is
+ * represented as a byte string using ASCII encoding without a trailing dot.
+ * This allows the support of Internationalized Domain Names (IDN) through
+ * the use of A-labels (the ASCII-Compatible Encoding (ACE) form of a valid
+ * string of Internationalized Domain Names for Applications (IDNA)) defined
+ * in <A HREF="http://www.ietf.org/rfc/rfc5890.txt">RFC 5890</A>.
+ * <P>
+ * Note that {@code SNIHostName} objects are immutable.
+ *
+ * @see SNIServerName
+ * @see StandardConstants#SNI_HOST_NAME
+ *
+ * @since 1.8
+ */
+public final class SNIHostName extends SNIServerName {
+
+    // the decoded string value of the server name
+    private final String hostname;
+
+    /**
+     * Creates an {@code SNIHostName} using the specified hostname.
+     * <P>
+     * Note that per <A HREF="http://www.ietf.org/rfc/rfc6066.txt">RFC 6066</A>,
+     * the encoded server name value of a hostname is
+     * {@link StandardCharsets#US_ASCII}-compliant.  In this method,
+     * {@code hostname} can be a user-friendly Internationalized Domain Name
+     * (IDN).  {@link IDN#toASCII(String, int)} is used to enforce the
+     * restrictions on ASCII characters in hostnames (see
+     * <A HREF="http://www.ietf.org/rfc/rfc3490.txt">RFC 3490</A>,
+     * <A HREF="http://www.ietf.org/rfc/rfc1122.txt">RFC 1122</A>,
+     * <A HREF="http://www.ietf.org/rfc/rfc1123.txt">RFC 1123</A>) and
+     * translate the {@code hostname} into ASCII Compatible Encoding (ACE), as:
+     * <pre>
+     *     IDN.toASCII(hostname, IDN.USE_STD3_ASCII_RULES);
+     * </pre>
+     * <P>
+     * The {@code hostname} argument is illegal if it:
+     * <ul>
+     * <li> {@code hostname} is empty,</li>
+     * <li> {@code hostname} ends with a trailing dot,</li>
+     * <li> {@code hostname} is not a valid Internationalized
+     *      Domain Name (IDN) compliant with the RFC 3490 specification.</li>
+     * </ul>
+     * @param  hostname
+     *         the hostname of this server name
+     *
+     * @throws NullPointerException if {@code hostname} is {@code null}
+     * @throws IllegalArgumentException if {@code hostname} is illegal
+     */
+    public SNIHostName(String hostname) {
+        // IllegalArgumentException will be thrown if {@code hostname} is
+        // not a valid IDN.
+        super(StandardConstants.SNI_HOST_NAME,
+                (hostname = IDN.toASCII(
+                    Objects.requireNonNull(hostname,
+                        "Server name value of host_name cannot be null"),
+                    IDN.USE_STD3_ASCII_RULES))
+                .getBytes(StandardCharsets.US_ASCII));
+
+        this.hostname = hostname;
+
+        // check the validity of the string hostname
+        checkHostName();
+    }
+
+    /**
+     * Creates an {@code SNIHostName} using the specified encoded value.
+     * <P>
+     * This method is normally used to parse the encoded name value in a
+     * requested SNI extension.
+     * <P>
+     * Per <A HREF="http://www.ietf.org/rfc/rfc6066.txt">RFC 6066</A>,
+     * the encoded name value of a hostname is
+     * {@link StandardCharsets#US_ASCII}-compliant.  However, in the previous
+     * version of the SNI extension (
+     * <A HREF="http://www.ietf.org/rfc/rfc4366.txt">RFC 4366</A>),
+     * the encoded hostname is represented as a byte string using UTF-8
+     * encoding.  For the purpose of version tolerance, this method allows
+     * that the charset of {@code encoded} argument can be
+     * {@link StandardCharsets#UTF_8}, as well as
+     * {@link StandardCharsets#US_ASCII}.  {@link IDN#toASCII(String)} is used
+     * to translate the {@code encoded} argument into ASCII Compatible
+     * Encoding (ACE) hostname.
+     * <P>
+     * It is strongly recommended that this constructor is only used to parse
+     * the encoded name value in a requested SNI extension.  Otherwise, to
+     * comply with <A HREF="http://www.ietf.org/rfc/rfc6066.txt">RFC 6066</A>,
+     * please always use {@link StandardCharsets#US_ASCII}-compliant charset
+     * and enforce the restrictions on ASCII characters in hostnames (see
+     * <A HREF="http://www.ietf.org/rfc/rfc3490.txt">RFC 3490</A>,
+     * <A HREF="http://www.ietf.org/rfc/rfc1122.txt">RFC 1122</A>,
+     * <A HREF="http://www.ietf.org/rfc/rfc1123.txt">RFC 1123</A>)
+     * for {@code encoded} argument, or use {@link SNIHostName(String)} instead.
+     * <P>
+     * The {@code encoded} argument is illegal if it:
+     * <ul>
+     * <li> {@code encoded} is empty,</li>
+     * <li> {@code encoded} ends with a trailing dot,</li>
+     * <li> {@code encoded} is not encoded in
+     *      {@link StandardCharsets#US_ASCII} or
+     *      {@link StandardCharsets#UTF_8}-compliant charset,</li>
+     * <li> {@code encoded} is not a valid Internationalized
+     *      Domain Name (IDN) compliant with the RFC 3490 specification.</li>
+     * </ul>
+     *
+     * <P>
+     * Note that the {@code encoded} byte array is cloned
+     * to protect against subsequent modification.
+     *
+     * @param  encoded
+     *         the encoded hostname of this server name
+     *
+     * @throws NullPointerException if {@code encoded} is {@code null}
+     * @throws IllegalArgumentException if {@code encoded} is illegal
+     */
+    public SNIHostName(byte[] encoded) {
+        // NullPointerException will be thrown if {@code encoded} is null
+        super(StandardConstants.SNI_HOST_NAME, encoded);
+
+        // Compliance: RFC 4366 requires that the hostname is represented
+        // as a byte string using UTF_8 encoding [UTF8]
+        try {
+            // Please don't use {@link String} constructors because they
+            // do not report coding errors.
+            CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
+                    .onMalformedInput(CodingErrorAction.REPORT)
+                    .onUnmappableCharacter(CodingErrorAction.REPORT);
+
+            this.hostname = IDN.toASCII(
+                    decoder.decode(ByteBuffer.wrap(encoded)).toString());
+        } catch (RuntimeException | CharacterCodingException e) {
+            throw new IllegalArgumentException(
+                        "The encoded server name value is invalid", e);
+        }
+
+        // check the validity of the string hostname
+        checkHostName();
+    }
+
+    /**
+     * Returns the {@link StandardCharsets#US_ASCII}-compliant hostname of
+     * this {@code SNIHostName} object.
+     * <P>
+     * Note that, per
+     * <A HREF="http://www.ietf.org/rfc/rfc6066.txt">RFC 6066</A>, the
+     * returned hostname may be an internationalized domain name that
+     * contains A-labels. See
+     * <A HREF="http://www.ietf.org/rfc/rfc5890.txt">RFC 5890</A>
+     * for more information about the detailed A-label specification.
+     *
+     * @return the {@link StandardCharsets#US_ASCII}-compliant hostname
+     *         of this {@code SNIHostName} object
+     */
+    public String getAsciiName() {
+        return hostname;
+    }
+
+    /**
+     * Compares this server name to the specified object.
+     * <P>
+     * Per <A HREF="http://www.ietf.org/rfc/rfc6066.txt">RFC 6066</A>, DNS
+     * hostnames are case-insensitive.  Two server hostnames are equal if,
+     * and only if, they have the same name type, and the hostnames are
+     * equal in a case-independent comparison.
+     *
+     * @param  other
+     *         the other server name object to compare with.
+     * @return true if, and only if, the {@code other} is considered
+     *         equal to this instance
+     */
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+
+        if (other instanceof SNIHostName) {
+            return hostname.equalsIgnoreCase(((SNIHostName)other).hostname);
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns a hash code value for this {@code SNIHostName}.
+     * <P>
+     * The hash code value is generated using the case-insensitive hostname
+     * of this {@code SNIHostName}.
+     *
+     * @return a hash code value for this {@code SNIHostName}.
+     */
+    @Override
+    public int hashCode() {
+        int result = 17;        // 17/31: prime number to decrease collisions
+        result = 31 * result + hostname.toUpperCase(Locale.ENGLISH).hashCode();
+
+        return result;
+    }
+
+    /**
+     * Returns a string representation of the object, including the DNS
+     * hostname in this {@code SNIHostName} object.
+     * <P>
+     * The exact details of the representation are unspecified and subject
+     * to change, but the following may be regarded as typical:
+     * <pre>
+     *     "type=host_name (0), value={@literal <hostname>}"
+     * </pre>
+     * The "{@literal <hostname>}" is an ASCII representation of the hostname,
+     * which may contains A-labels.  For example, a returned value of an pseudo
+     * hostname may look like:
+     * <pre>
+     *     "type=host_name (0), value=www.example.com"
+     * </pre>
+     * or
+     * <pre>
+     *     "type=host_name (0), value=xn--fsqu00a.xn--0zwm56d"
+     * </pre>
+     * <P>
+     * Please NOTE that the exact details of the representation are unspecified
+     * and subject to change.
+     *
+     * @return a string representation of the object.
+     */
+    @Override
+    public String toString() {
+        return "type=host_name (0), value=" + hostname;
+    }
+
+    /**
+     * Creates an {@link SNIMatcher} object for {@code SNIHostName}s.
+     * <P>
+     * This method can be used by a server to verify the acceptable
+     * {@code SNIHostName}s.  For example,
+     * <pre>
+     *     SNIMatcher matcher =
+     *         SNIHostName.createSNIMatcher("www\\.example\\.com");
+     * </pre>
+     * will accept the hostname "www.example.com".
+     * <pre>
+     *     SNIMatcher matcher =
+     *         SNIHostName.createSNIMatcher("www\\.example\\.(com|org)");
+     * </pre>
+     * will accept hostnames "www.example.com" and "www.example.org".
+     *
+     * @param  regex
+     *         the <a href="{@docRoot}/java/util/regex/Pattern.html#sum">
+     *         regular expression pattern</a>
+     *         representing the hostname(s) to match
+     * @throws NullPointerException if {@code regex} is
+     *         {@code null}
+     * @throws PatternSyntaxException if the regular expression's syntax
+     *         is invalid
+     */
+    public static SNIMatcher createSNIMatcher(String regex) {
+        if (regex == null) {
+            throw new NullPointerException(
+                "The regular expression cannot be null");
+        }
+
+        return new SNIHostNameMatcher(regex);
+    }
+
+    // check the validity of the string hostname
+    private void checkHostName() {
+        if (hostname.isEmpty()) {
+            throw new IllegalArgumentException(
+                "Server name value of host_name cannot be empty");
+        }
+
+        if (hostname.endsWith(".")) {
+            throw new IllegalArgumentException(
+                "Server name value of host_name cannot have the trailing dot");
+        }
+    }
+
+    private final static class SNIHostNameMatcher extends SNIMatcher {
+
+        // the compiled representation of a regular expression.
+        private final Pattern pattern;
+
+        /**
+         * Creates an SNIHostNameMatcher object.
+         *
+         * @param  regex
+         *         the <a href="{@docRoot}/java/util/regex/Pattern.html#sum">
+         *         regular expression pattern</a>
+         *         representing the hostname(s) to match
+         * @throws NullPointerException if {@code regex} is
+         *         {@code null}
+         * @throws PatternSyntaxException if the regular expression's syntax
+         *         is invalid
+         */
+        SNIHostNameMatcher(String regex) {
+            super(StandardConstants.SNI_HOST_NAME);
+            pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
+        }
+
+        /**
+         * Attempts to match the given {@link SNIServerName}.
+         *
+         * @param  serverName
+         *         the {@link SNIServerName} instance on which this matcher
+         *         performs match operations
+         *
+         * @return {@code true} if, and only if, the matcher matches the
+         *         given {@code serverName}
+         *
+         * @throws NullPointerException if {@code serverName} is {@code null}
+         * @throws IllegalArgumentException if {@code serverName} is
+         *         not of {@code StandardConstants#SNI_HOST_NAME} type
+         *
+         * @see SNIServerName
+         */
+        @Override
+        public boolean matches(SNIServerName serverName) {
+            if (serverName == null) {
+                throw new NullPointerException(
+                    "The SNIServerName argument cannot be null");
+            }
+
+            SNIHostName hostname;
+            if (!(serverName instanceof SNIHostName)) {
+                if (serverName.getType() != StandardConstants.SNI_HOST_NAME) {
+                    throw new IllegalArgumentException(
+                        "The server name type is not host_name");
+                }
+
+                try {
+                    hostname = new SNIHostName(serverName.getEncoded());
+                } catch (NullPointerException | IllegalArgumentException e) {
+                    return false;
+                }
+            } else {
+                hostname = (SNIHostName)serverName;
+            }
+
+            // Let's first try the ascii name matching
+            String asciiName = hostname.getAsciiName();
+            if (pattern.matcher(asciiName).matches()) {
+                return true;
+            }
+
+            // May be an internationalized domain name, check the Unicode
+            // representations.
+            return pattern.matcher(IDN.toUnicode(asciiName)).matches();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/net/ssl/SNIMatcher.java	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,105 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package javax.net.ssl;
+
+/**
+ * Instances of this class represent a matcher that performs match
+ * operations on an {@link SNIServerName} instance.
+ * <P>
+ * Servers can use Server Name Indication (SNI) information to decide if
+ * specific {@link SSLSocket} or {@link SSLEngine} instances should accept
+ * a connection.  For example, when multiple "virtual" or "name-based"
+ * servers are hosted on a single underlying network address, the server
+ * application can use SNI information to determine whether this server is
+ * the exact server that the client wants to access.  Instances of this
+ * class can be used by a server to verify the acceptable server names of
+ * a particular type, such as host names.
+ * <P>
+ * {@code SNIMatcher} objects are immutable.  Subclasses should not provide
+ * methods that can change the state of an instance once it has been created.
+ *
+ * @see SNIServerName
+ * @see SNIHostName
+ * @see SSLParameters#getSNIMatchers()
+ * @see SSLParameters#setSNIMatchers(Collection<SNIMatcher>)
+ *
+ * @since 1.8
+ */
+public abstract class SNIMatcher {
+
+    // the type of the server name that this matcher performs on
+    private final int type;
+
+    /**
+     * Creates an {@code SNIMatcher} using the specified server name type.
+     *
+     * @param  type
+     *         the type of the server name that this matcher performs on
+     *
+     * @throws IllegalArgumentException if {@code type} is not in the range
+     *         of 0 to 255, inclusive.
+     */
+    protected SNIMatcher(int type) {
+        if (type < 0) {
+            throw new IllegalArgumentException(
+                "Server name type cannot be less than zero");
+        } else if (type > 255) {
+            throw new IllegalArgumentException(
+                "Server name type cannot be greater than 255");
+        }
+
+        this.type = type;
+    }
+
+    /**
+     * Returns the server name type of this {@code SNIMatcher} object.
+     *
+     * @return the server name type of this {@code SNIMatcher} object.
+     *
+     * @see SNIServerName
+     */
+    public final int getType() {
+        return type;
+    }
+
+    /**
+     * Attempts to match the given {@link SNIServerName}.
+     *
+     * @param  serverName
+     *         the {@link SNIServerName} instance on which this matcher
+     *         performs match operations
+     *
+     * @return {@code true} if, and only if, the matcher matches the
+     *         given {@code serverName}
+     *
+     * @throws NullPointerException if {@code serverName} is {@code null}
+     * @throws IllegalArgumentException if {@code serverName} is
+     *         not of the given server name type of this matcher
+     *
+     * @see SNIServerName
+     */
+    public abstract boolean matches(SNIServerName serverName);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/net/ssl/SNIServerName.java	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,213 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package javax.net.ssl;
+
+import java.util.Arrays;
+
+/**
+ * Instances of this class represent a server name in a Server Name
+ * Indication (SNI) extension.
+ * <P>
+ * The SNI extension is a feature that extends the SSL/TLS protocols to
+ * indicate what server name the client is attempting to connect to during
+ * handshaking.  See section 3, "Server Name Indication", of <A
+ * HREF="http://www.ietf.org/rfc/rfc6066.txt">TLS Extensions (RFC 6066)</A>.
+ * <P>
+ * {@code SNIServerName} objects are immutable.  Subclasses should not provide
+ * methods that can change the state of an instance once it has been created.
+ *
+ * @see SSLParameters#getServerNames()
+ * @see SSLParameters#setServerNames(List<SNIServerName>)
+ *
+ * @since 1.8
+ */
+public abstract class SNIServerName {
+
+    // the type of the server name
+    private final int type;
+
+    // the encoded value of the server name
+    private final byte[] encoded;
+
+    // the hex digitals
+    private static final char[] HEXES = "0123456789ABCDEF".toCharArray();
+
+    /**
+     * Creates an {@code SNIServerName} using the specified name type and
+     * encoded value.
+     * <P>
+     * Note that the {@code encoded} byte array is cloned to protect against
+     * subsequent modification.
+     *
+     * @param  type
+     *         the type of the server name
+     * @param  encoded
+     *         the encoded value of the server name
+     *
+     * @throws IllegalArgumentException if {@code type} is not in the range
+     *         of 0 to 255, inclusive.
+     * @throws NullPointerException if {@code encoded} is null
+     */
+    protected SNIServerName(int type, byte[] encoded) {
+        if (type < 0) {
+            throw new IllegalArgumentException(
+                "Server name type cannot be less than zero");
+        } else if (type > 255) {
+            throw new IllegalArgumentException(
+                "Server name type cannot be greater than 255");
+        }
+        this.type = type;
+
+        if (encoded == null) {
+            throw new NullPointerException(
+                "Server name encoded value cannot be null");
+        }
+        this.encoded = encoded.clone();
+    }
+
+
+    /**
+     * Returns the name type of this server name.
+     *
+     * @return the name type of this server name
+     */
+    public final int getType() {
+        return type;
+    }
+
+    /**
+     * Returns a copy of the encoded server name value of this server name.
+     *
+     * @return a copy of the encoded server name value of this server name
+     */
+    public final byte[] getEncoded() {
+        return encoded.clone();
+    }
+
+    /**
+     * Indicates whether some other object is "equal to" this server name.
+     *
+     * @return true if, and only if, {@code other} is of the same class
+     *         of this object, and has the same name type and
+     *         encoded value as this server name.
+     */
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+
+        if (this.getClass() != other.getClass()) {
+            return false;
+        }
+
+        SNIServerName that = (SNIServerName)other;
+        return (this.type == that.type) &&
+                    Arrays.equals(this.encoded, that.encoded);
+    }
+
+    /**
+     * Returns a hash code value for this server name.
+     * <P>
+     * The hash code value is generated using the name type and encoded
+     * value of this server name.
+     *
+     * @return a hash code value for this server name.
+     */
+    @Override
+    public int hashCode() {
+        int result = 17;    // 17/31: prime number to decrease collisions
+        result = 31 * result + type;
+        result = 31 * result + Arrays.hashCode(encoded);
+
+        return result;
+    }
+
+    /**
+     * Returns a string representation of this server name, including the server
+     * name type and the encoded server name value in this
+     * {@code SNIServerName} object.
+     * <P>
+     * The exact details of the representation are unspecified and subject
+     * to change, but the following may be regarded as typical:
+     * <pre>
+     *     "type={@literal <name type>}, value={@literal <name value>}"
+     * </pre>
+     * <P>
+     * In this class, the format of "{@literal <name type>}" is
+     * "[LITERAL] (INTEGER)", where the optional "LITERAL" is the literal
+     * name, and INTEGER is the integer value of the name type.  The format
+     * of "{@literal <name value>}" is "XX:...:XX", where "XX" is the
+     * hexadecimal digit representation of a byte value. For example, a
+     * returned value of an pseudo server name may look like:
+     * <pre>
+     *     "type=(31), value=77:77:77:2E:65:78:61:6D:70:6C:65:2E:63:6E"
+     * </pre>
+     * or
+     * <pre>
+     *     "type=host_name (0), value=77:77:77:2E:65:78:61:6D:70:6C:65:2E:63:6E"
+     * </pre>
+     *
+     * <P>
+     * Please NOTE that the exact details of the representation are unspecified
+     * and subject to change, and subclasses may override the method with
+     * their own formats.
+     *
+     * @return a string representation of this server name
+     */
+    @Override
+    public String toString() {
+        if (type == StandardConstants.SNI_HOST_NAME) {
+            return "type=host_name (0), value=" + toHexString(encoded);
+        } else {
+            return "type=(" + type + "), value=" + toHexString(encoded);
+        }
+    }
+
+    // convert byte array to hex string
+    private static String toHexString(byte[] bytes) {
+        if (bytes.length == 0) {
+            return "(empty)";
+        }
+
+        StringBuilder sb = new StringBuilder(bytes.length * 3 - 1);
+        boolean isInitial = true;
+        for (byte b : bytes) {
+            if (isInitial) {
+                isInitial = false;
+            } else {
+                sb.append(':');
+            }
+
+            int k = b & 0xFF;
+            sb.append(HEXES[k >>> 4]);
+            sb.append(HEXES[k & 0xF]);
+        }
+
+        return sb.toString();
+    }
+}
+
--- a/jdk/src/share/classes/javax/net/ssl/SSLEngine.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/SSLEngine.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1214,15 +1214,19 @@
      *
      * <p>This means:
      * <ul>
-     * <li>if <code>params.getCipherSuites()</code> is non-null,
-     *   <code>setEnabledCipherSuites()</code> is called with that value
-     * <li>if <code>params.getProtocols()</code> is non-null,
-     *   <code>setEnabledProtocols()</code> is called with that value
-     * <li>if <code>params.getNeedClientAuth()</code> or
-     *   <code>params.getWantClientAuth()</code> return <code>true</code>,
-     *   <code>setNeedClientAuth(true)</code> and
-     *   <code>setWantClientAuth(true)</code> are called, respectively;
-     *   otherwise <code>setWantClientAuth(false)</code> is called.
+     * <li>If {@code params.getCipherSuites()} is non-null,
+     *   {@code setEnabledCipherSuites()} is called with that value.</li>
+     * <li>If {@code params.getProtocols()} is non-null,
+     *   {@code setEnabledProtocols()} is called with that value.</li>
+     * <li>If {@code params.getNeedClientAuth()} or
+     *   {@code params.getWantClientAuth()} return {@code true},
+     *   {@code setNeedClientAuth(true)} and
+     *   {@code setWantClientAuth(true)} are called, respectively;
+     *   otherwise {@code setWantClientAuth(false)} is called.</li>
+     * <li>If {@code params.getServerNames()} is non-null, the engine will
+     *   configure its server names with that value.</li>
+     * <li>If {@code params.getSNIMatchers()} is non-null, the engine will
+     *   configure its SNI matchers with that value.</li>
      * </ul>
      *
      * @param params the parameters
--- a/jdk/src/share/classes/javax/net/ssl/SSLParameters.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/SSLParameters.java	Wed Oct 31 09:25:20 2012 -0700
@@ -26,13 +26,23 @@
 package javax.net.ssl;
 
 import java.security.AlgorithmConstraints;
+import java.util.Map;
+import java.util.List;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.regex.Pattern;
 
 /**
  * Encapsulates parameters for an SSL/TLS connection. The parameters
  * are the list of ciphersuites to be accepted in an SSL/TLS handshake,
  * the list of protocols to be allowed, the endpoint identification
- * algorithm during SSL/TLS handshaking, the algorithm constraints and
- * whether SSL/TLS servers should request or require client authentication.
+ * algorithm during SSL/TLS handshaking, the Server Name Indication (SNI),
+ * the algorithm constraints and whether SSL/TLS servers should request
+ * or require client authentication.
  * <p>
  * SSLParameters can be created via the constructors in this class.
  * Objects can also be obtained using the <code>getSSLParameters()</code>
@@ -47,7 +57,7 @@
  * SSLParameters can be applied to a connection via the methods
  * {@link SSLSocket#setSSLParameters SSLSocket.setSSLParameters()} and
  * {@link SSLServerSocket#setSSLParameters SSLServerSocket.setSSLParameters()}
- * and {@link SSLEngine#setSSLParameters SSLEngine.getSSLParameters()}.
+ * and {@link SSLEngine#setSSLParameters SSLEngine.setSSLParameters()}.
  *
  * @see SSLSocket
  * @see SSLEngine
@@ -63,11 +73,15 @@
     private boolean needClientAuth;
     private String identificationAlgorithm;
     private AlgorithmConstraints algorithmConstraints;
+    private Map<Integer, SNIServerName> sniNames = null;
+    private Map<Integer, SNIMatcher> sniMatchers = null;
 
     /**
      * Constructs SSLParameters.
      * <p>
-     * The cipherSuites and protocols values are set to <code>null</code>,
+     * The values of cipherSuites, protocols, cryptographic algorithm
+     * constraints, endpoint identification algorithm, server names and
+     * server name matchers are set to <code>null</code>,
      * wantClientAuth and needClientAuth are set to <code>false</code>.
      */
     public SSLParameters() {
@@ -254,4 +268,173 @@
         this.identificationAlgorithm = algorithm;
     }
 
+    /**
+     * Sets the desired {@link SNIServerName}s of the Server Name
+     * Indication (SNI) parameter.
+     * <P>
+     * This method is only useful to {@link SSLSocket}s or {@link SSLEngine}s
+     * operating in client mode.
+     * <P>
+     * Note that the {@code serverNames} list is cloned
+     * to protect against subsequent modification.
+     *
+     * @param  serverNames
+     *         the list of desired {@link SNIServerName}s (or null)
+     *
+     * @throws NullPointerException if the {@code serverNames}
+     *         contains {@code null} element
+     * @throws IllegalArgumentException if the {@code serverNames}
+     *         contains more than one name of the same name type
+     *
+     * @see SNIServerName
+     * @see #getServerNames()
+     *
+     * @since 1.8
+     */
+    public final void setServerNames(List<SNIServerName> serverNames) {
+        if (serverNames != null) {
+            if (!serverNames.isEmpty()) {
+                sniNames = new LinkedHashMap<>(serverNames.size());
+                for (SNIServerName serverName : serverNames) {
+                    if (sniNames.put(serverName.getType(),
+                                                serverName) != null) {
+                        throw new IllegalArgumentException(
+                                    "Duplicated server name of type " +
+                                    serverName.getType());
+                    }
+                }
+            } else {
+                sniNames = Collections.<Integer, SNIServerName>emptyMap();
+            }
+        } else {
+            sniNames = null;
+        }
+    }
+
+    /**
+     * Returns a {@link List} containing all {@link SNIServerName}s of the
+     * Server Name Indication (SNI) parameter, or null if none has been set.
+     * <P>
+     * This method is only useful to {@link SSLSocket}s or {@link SSLEngine}s
+     * operating in client mode.
+     * <P>
+     * For SSL/TLS connections, the underlying SSL/TLS provider
+     * may specify a default value for a certain server name type.  In
+     * client mode, it is recommended that, by default, providers should
+     * include the server name indication whenever the server can be located
+     * by a supported server name type.
+     * <P>
+     * It is recommended that providers initialize default Server Name
+     * Indications when creating {@code SSLSocket}/{@code SSLEngine}s.
+     * In the following examples, the server name could be represented by an
+     * instance of {@link SNIHostName} which has been initialized with the
+     * hostname "www.example.com" and type
+     * {@link StandardConstants#SNI_HOST_NAME}.
+     *
+     * <pre>
+     *     Socket socket =
+     *         sslSocketFactory.createSocket("www.example.com", 443);
+     * </pre>
+     * or
+     * <pre>
+     *     SSLEngine engine =
+     *         sslContext.createSSLEngine("www.example.com", 443);
+     * </pre>
+     * <P>
+     *
+     * @return null or an immutable list of non-null {@link SNIServerName}s
+     *
+     * @see List
+     * @see #setServerNames(List<SNIServerName>)
+     *
+     * @since 1.8
+     */
+    public final List<SNIServerName> getServerNames() {
+        if (sniNames != null) {
+            if (!sniNames.isEmpty()) {
+                return Collections.<SNIServerName>unmodifiableList(
+                                        new ArrayList<>(sniNames.values()));
+            } else {
+                return Collections.<SNIServerName>emptyList();
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Sets the {@link SNIMatcher}s of the Server Name Indication (SNI)
+     * parameter.
+     * <P>
+     * This method is only useful to {@link SSLSocket}s or {@link SSLEngine}s
+     * operating in server mode.
+     * <P>
+     * Note that the {@code matchers} collection is cloned to protect
+     * against subsequent modification.
+     *
+     * @param  matchers
+     *         the collection of {@link SNIMatcher}s (or null)
+     *
+     * @throws NullPointerException if the {@code matchers}
+     *         contains {@code null} element
+     * @throws IllegalArgumentException if the {@code matchers}
+     *         contains more than one name of the same name type
+     *
+     * @see Collection
+     * @see SNIMatcher
+     * @see #getSNIMatchers()
+     *
+     * @since 1.8
+     */
+    public final void setSNIMatchers(Collection<SNIMatcher> matchers) {
+        if (matchers != null) {
+            if (!matchers.isEmpty()) {
+                sniMatchers = new HashMap<>(matchers.size());
+                for (SNIMatcher matcher : matchers) {
+                    if (sniMatchers.put(matcher.getType(),
+                                                matcher) != null) {
+                        throw new IllegalArgumentException(
+                                    "Duplicated server name of type " +
+                                    matcher.getType());
+                    }
+                }
+            } else {
+                sniMatchers = Collections.<Integer, SNIMatcher>emptyMap();
+            }
+        } else {
+            sniMatchers = null;
+        }
+    }
+
+    /**
+     * Returns a {@link Collection} containing all {@link SNIMatcher}s of the
+     * Server Name Indication (SNI) parameter, or null if none has been set.
+     * <P>
+     * This method is only useful to {@link SSLSocket}s or {@link SSLEngine}s
+     * operating in server mode.
+     * <P>
+     * For better interoperability, providers generally will not define
+     * default matchers so that by default servers will ignore the SNI
+     * extension and continue the handshake.
+     *
+     * @return null or an immutable collection of non-null {@link SNIMatcher}s
+     *
+     * @see SNIMatcher
+     * @see #setSNIMatchers(Collection<SNIMatcher>)
+     *
+     * @since 1.8
+     */
+    public final Collection<SNIMatcher> getSNIMatchers() {
+        if (sniMatchers != null) {
+            if (!sniMatchers.isEmpty()) {
+                return Collections.<SNIMatcher>unmodifiableList(
+                                        new ArrayList<>(sniMatchers.values()));
+            } else {
+                return Collections.<SNIMatcher>emptyList();
+            }
+        }
+
+        return null;
+    }
 }
+
--- a/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -484,15 +484,19 @@
      *
      * <p>This means:
      * <ul>
-     * <li>if <code>params.getCipherSuites()</code> is non-null,
-     *   <code>setEnabledCipherSuites()</code> is called with that value
-     * <li>if <code>params.getProtocols()</code> is non-null,
-     *   <code>setEnabledProtocols()</code> is called with that value
-     * <li>if <code>params.getNeedClientAuth()</code> or
-     *   <code>params.getWantClientAuth()</code> return <code>true</code>,
-     *   <code>setNeedClientAuth(true)</code> and
-     *   <code>setWantClientAuth(true)</code> are called, respectively;
-     *   otherwise <code>setWantClientAuth(false)</code> is called.
+     * <li>If {@code params.getCipherSuites()} is non-null,
+     *   {@code setEnabledCipherSuites()} is called with that value.</li>
+     * <li>If {@code params.getProtocols()} is non-null,
+     *   {@code setEnabledProtocols()} is called with that value.</li>
+     * <li>If {@code params.getNeedClientAuth()} or
+     *   {@code params.getWantClientAuth()} return {@code true},
+     *   {@code setNeedClientAuth(true)} and
+     *   {@code setWantClientAuth(true)} are called, respectively;
+     *   otherwise {@code setWantClientAuth(false)} is called.</li>
+     * <li>If {@code params.getServerNames()} is non-null, the socket will
+     *   configure its server names with that value.</li>
+     * <li>If {@code params.getSNIMatchers()} is non-null, the socket will
+     *   configure its SNI matchers with that value.</li>
      * </ul>
      *
      * @param params the parameters
--- a/jdk/src/share/classes/javax/net/ssl/SSLSocket.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/SSLSocket.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -626,15 +626,19 @@
      *
      * <p>This means:
      * <ul>
-     * <li>if <code>params.getCipherSuites()</code> is non-null,
-     *   <code>setEnabledCipherSuites()</code> is called with that value
-     * <li>if <code>params.getProtocols()</code> is non-null,
-     *   <code>setEnabledProtocols()</code> is called with that value
-     * <li>if <code>params.getNeedClientAuth()</code> or
-     *   <code>params.getWantClientAuth()</code> return <code>true</code>,
-     *   <code>setNeedClientAuth(true)</code> and
-     *   <code>setWantClientAuth(true)</code> are called, respectively;
-     *   otherwise <code>setWantClientAuth(false)</code> is called.
+     * <li>If {@code params.getCipherSuites()} is non-null,
+     *   {@code setEnabledCipherSuites()} is called with that value.</li>
+     * <li>If {@code params.getProtocols()} is non-null,
+     *   {@code setEnabledProtocols()} is called with that value.</li>
+     * <li>If {@code params.getNeedClientAuth()} or
+     *   {@code params.getWantClientAuth()} return {@code true},
+     *   {@code setNeedClientAuth(true)} and
+     *   {@code setWantClientAuth(true)} are called, respectively;
+     *   otherwise {@code setWantClientAuth(false)} is called.</li>
+     * <li>If {@code params.getServerNames()} is non-null, the socket will
+     *   configure its server names with that value.</li>
+     * <li>If {@code params.getSNIMatchers()} is non-null, the socket will
+     *   configure its SNI matchers with that value.</li>
      * </ul>
      *
      * @param params the parameters
--- a/jdk/src/share/classes/javax/net/ssl/SSLSocketFactory.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/net/ssl/SSLSocketFactory.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.net.*;
 import javax.net.SocketFactory;
 import java.io.IOException;
+import java.io.InputStream;
 import java.security.*;
 import java.util.Locale;
 
@@ -180,8 +181,55 @@
      * @throws NullPointerException if the parameter s is null
      */
     public abstract Socket createSocket(Socket s, String host,
-                                        int port, boolean autoClose)
-    throws IOException;
+            int port, boolean autoClose) throws IOException;
+
+    /**
+     * Creates a server mode {@link Socket} layered over an
+     * existing connected socket, and is able to read data which has
+     * already been consumed/removed from the {@link Socket}'s
+     * underlying {@link InputStream}.
+     * <p>
+     * This method can be used by a server application that needs to
+     * observe the inbound data but still create valid SSL/TLS
+     * connections: for example, inspection of Server Name Indication
+     * (SNI) extensions (See section 3 of <A
+     * HREF="http://www.ietf.org/rfc/rfc6066.txt">TLS Extensions
+     * (RFC6066)</A>).  Data that has been already removed from the
+     * underlying {@link InputStream} should be loaded into the
+     * {@code consumed} stream before this method is called, perhaps
+     * using a {@link ByteArrayInputStream}.  When this {@link Socket}
+     * begins handshaking, it will read all of the data in
+     * {@code consumed} until it reaches {@code EOF}, then all further
+     * data is read from the underlying {@link InputStream} as
+     * usual.
+     * <p>
+     * The returned socket is configured using the socket options
+     * established for this factory, and is set to use server mode when
+     * handshaking (see {@link SSLSocket#setUseClientMode(boolean)}).
+     *
+     * @param  s
+     *         the existing socket
+     * @param  consumed
+     *         the consumed inbound network data that has already been
+     *         removed from the existing {@link Socket}
+     *         {@link InputStream}.  This parameter may be
+     *         {@code null} if no data has been removed.
+     * @param  autoClose close the underlying socket when this socket is closed.
+     *
+     * @return the {@link Socket} compliant with the socket options
+     *         established for this factory
+     *
+     * @throws IOException if an I/O error occurs when creating the socket
+     * @throws UnsupportedOperationException if the underlying provider
+     *         does not implement the operation
+     * @throws NullPointerException if {@code s} is {@code null}
+     *
+     * @since 1.8
+     */
+    public Socket createSocket(Socket s, InputStream consumed,
+            boolean autoClose) throws IOException {
+        throw new UnsupportedOperationException();
+    }
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/net/ssl/StandardConstants.java	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,56 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package javax.net.ssl;
+
+/**
+ * Standard constants definitions
+ *
+ * @since 1.8
+ */
+public final class StandardConstants {
+
+    // Suppress default constructor for noninstantiability
+    private StandardConstants() {
+        throw new AssertionError(
+            "No javax.net.ssl.StandardConstants instances for you!");
+    }
+
+    /**
+     * The "host_name" type representing of a DNS hostname
+     * (see {@link SNIHostName}) in a Server Name Indication (SNI) extension.
+     * <P>
+     * The SNI extension is a feature that extends the SSL/TLS protocols to
+     * indicate what server name the client is attempting to connect to during
+     * handshaking.  See section 3, "Server Name Indication", of <A
+     * HREF="http://www.ietf.org/rfc/rfc6066.txt">TLS Extensions (RFC 6066)</A>.
+     * <P>
+     * The value of this constant is {@value}.
+     *
+     * @see SNIServerName
+     * @see SNIHostName
+     */
+    public static final int SNI_HOST_NAME = 0x00;
+}
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1850,7 +1850,7 @@
         if(params == null){
              throw new SQLException("Set initParams() before setFloat");
         }
-        params.put(Integer.valueOf(parameterIndex - 1), new Float(x));
+        params.put(Integer.valueOf(parameterIndex - 1), Float.valueOf(x));
     }
 
     /**
@@ -1882,7 +1882,7 @@
         if(params == null){
              throw new SQLException("Set initParams() before setDouble");
         }
-        params.put(Integer.valueOf(parameterIndex - 1), new Double(x));
+        params.put(Integer.valueOf(parameterIndex - 1), Double.valueOf(x));
     }
 
     /**
@@ -2389,7 +2389,7 @@
      * @deprecated getCharacterStream should be used in its place
      * @see #getParams
      */
-
+    @Deprecated
     public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException {
         Object unicodeStream[];
         checkParamIndex(parameterIndex);
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java	Wed Oct 31 09:25:20 2012 -0700
@@ -215,7 +215,7 @@
      */
     @SuppressWarnings("unchecked")
     public void writeFloat(float x) throws SQLException {
-        attribs.add(new Float(x));
+        attribs.add(Float.valueOf(x));
     }
 
     /**
@@ -230,7 +230,7 @@
      */
     @SuppressWarnings("unchecked")
     public void writeDouble(double x) throws SQLException{
-        attribs.add(new Double(x));
+        attribs.add(Double.valueOf(x));
     }
 
     /**
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Wed Oct 31 09:25:20 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -229,11 +229,7 @@
      * The standard resource file name.
      */
     private static String ROWSET_PROPERTIES = "rowset.properties";
-    /**
-     * The RI Optimistic Provider.
-     */
-    private static String default_provider =
-            "com.sun.rowset.providers.RIOptimisticProvider";
+
     /**
      *  Permission required to invoke setJNDIContext and setLogger
      */
@@ -248,24 +244,13 @@
      * The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
      */
     private static volatile Logger rsLogger;
-    /**
-     *
-     */
-    private static Level rsLevel;
+
     /**
      * The registry of available <code>SyncProvider</code> implementations.
      * See section 2.0 of the class comment for <code>SyncFactory</code> for an
      * explanation of how a provider can be added to this registry.
      */
     private static Hashtable<String, SyncProvider> implementations;
-    /**
-     * Internal sync object used to maintain the SPI as a singleton
-     */
-    private static Object logSync = new Object();
-    /**
-     * Internal PrintWriter field for logging facility
-     */
-    private static java.io.PrintWriter logWriter = null;
 
     /**
      * Adds the the given synchronization provider to the factory register. Guidelines
--- a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	Tue Oct 30 12:47:35 2012 +0100
+++ b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	Wed Oct 31 09:25:20 2012 -0700
@@ -24,6 +24,8 @@
  */
 package javax.swing.text;
 
+import sun.reflect.misc.ConstructorUtil;
+
 import java.io.Serializable;
 import java.lang.reflect.*;
 import java.text.ParseException;
@@ -245,7 +247,7 @@
             Constructor cons;
 
             try {
-                cons = vc.getConstructor(new Class[] { String.class });
+                cons = ConstructorUtil.getConstructor(vc, new Class[]{String.class});
 
             } catch (NoSuchMethodException nsme) {
                 cons = null;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/AnnotationVisitor.java	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,186 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2011 INRIA, France Telecom
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holders nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package jdk.internal.org.objectweb.asm;
+
+/**
+ * A visitor to visit a Java annotation. The methods of this class must be
+ * called in the following order: ( <tt>visit</tt> | <tt>visitEnum</tt> |
+ * <tt>visitAnnotation</tt> | <tt>visitArray</tt> )* <tt>visitEnd</tt>.
+ *
+ * @author Eric Bruneton
+ * @author Eugene Kuleshov
+ */
+public abstract class AnnotationVisitor {
+
+    /**
+     * The ASM API version implemented by this visitor. The value of this field
+     * must be one of {@link Opcodes#ASM4}.
+     */
+    protected final int api;
+
+    /**
+     * The annotation visitor to which this visitor must delegate method calls.
+     * May be null.
+     */
+    protected AnnotationVisitor av;
+
+    /**
+     * Constructs a new {@link AnnotationVisitor}.
+     *
+     * @param api the ASM API version implemented by this visitor. Must be one
+     *        of {@link Opcodes#ASM4}.
+     */
+    public AnnotationVisitor(final int api) {
+        this(api, null);
+    }
+
+    /**
+     * Constructs a new {@link AnnotationVisitor}.
+     *
+     * @param api the ASM API version implemented by this visitor. Must be one
+     *        of {@link Opcodes#ASM4}.
+     * @param av the annotation visitor to which this visitor must delegate
+     *        method calls. May be null.
+     */
+    public AnnotationVisitor(final int api, final AnnotationVisitor av) {
+        /*if (api != Opcodes.ASM4) {
+            throw new IllegalArgumentException();
+        }*/
+        this.api = api;
+        this.av = av;
+    }
+
+    /**
+     * Visits a primitive value of the annotation.
+     *
+     * @param name the value name.
+     * @param value the actual value, whose type must be {@link Byte},
+     *        {@link Boolean}, {@link Character}, {@link Short}, {@link Integer}
+     *        , {@link Long}, {@link Float}, {@link Double}, {@link String} or
+     *        {@link Type} or OBJECT or ARRAY sort. This value can also be an
+     *        array of byte, boolean, short, char, int, long, float or double
+     *        values (this is equivalent to using {@link #visitArray visitArray}
+     *        and visiting each array element in turn, but is more convenient).
+     */
+    public void visit(String name, Object value) {
+        if (av != null) {
+            av.visit(name, value);
+        }
+    }
+
+    /**
+     * Visits an enumeration value of the annotation.
+     *
+     * @param name the value name.
+     * @param desc the class descriptor of the enumeration class.
+     * @param value the actual enumeration value.
+     */
+    public void visitEnum(String name, String desc, String value) {
+        if (av != null) {
+            av.visitEnum(name, desc, value);
+        }
+    }
+
+    /**
+     * Visits a nested annotation value of the annotation.
+     *
+     * @param name the value name.
+     * @param desc the class descriptor of the nested annotation class.
+     * @return a visitor to visit the actual nested annotation value, or
+     *         <tt>null</tt> if this visitor is not interested in visiting
+     *         this nested annotation. <i>The nested annotation value must be
+     *         fully visited before calling other methods on this annotation
+     *         visitor</i>.
+     */
+    public AnnotationVisitor visitAnnotation(String name, String desc) {
+        if (av != null) {
+            return av.visitAnnotation(name, desc);
+        }
+        return null;
+    }
+
+    /**
+     * Visits an array value of the annotation. Note that arrays of primitive
+     * types (such as byte, boolean, short, char, int, long, float or double)
+     * can be passed as value to {@link #visit visit}. This is what
+     * {@link ClassReader} does.
+     *
+     * @param name the value name.
+     * @return a visitor to visit the actual array value elements, or
+     *         <tt>null</tt> if this visitor is not interested in visiting
+     *         these values. The 'name' parameters passed to the methods of this
+     *         visitor are ignored. <i>All the array values must be visited
+     *         before calling other methods on this annotation visitor</i>.
+     */
+    public AnnotationVisitor visitArray(String name) {
+        if (av != null) {
+            return av.visitArray(name);
+        }
+        return null;
+    }
+
+    /**
+     * Visits the end of the annotation.
+     */
+    public void visitEnd() {
+        if (av != null) {
+            av.visitEnd();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/AnnotationWriter.java	Wed Oct 31 09:25:20 2012 -0700
@@ -0,0 +1,351 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2011 INRIA, France Telecom
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holders nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package jdk.internal.org.objectweb.asm;
+
+/**
+ * An {@link AnnotationVisitor} that generates annotations in bytecode form.
+ *
+ * @author Eric Bruneton
+ * @author Eugene Kuleshov
+ */
+final class AnnotationWriter extends AnnotationVisitor {
+
+    /**
+     * The class writer to which this annotation must be added.
+     */
+    private final ClassWriter cw;
+
+    /**
+     * The number of values in this annotation.
+     */
+    private int size;
+
+    /**
+     * <tt>true<tt> if values are named, <tt>false</tt> otherwise. Annotation
+     * writers used for annotation default and annotation arrays use unnamed
+     * values.
+     */
+    private final boolean named;
+
+    /**
+     * The annotation values in bytecode form. This byte vector only contains
+     * the values themselves, i.e. the number of values must be stored as a
+     * unsigned short just before these bytes.
+     */
+    private final ByteVector bv;
+
+    /**
+     * The byte vector to be used to store the number of values of this
+     * annotation. See {@link #bv}.
+     */
+    private final ByteVector parent;
+
+    /**
+     * Where the number of values of this annotation must be stored in
+     * {@link #parent}.
+     */
+    private final int offset;
+
+    /**
+     * Next annotation writer. This field is used to store annotation lists.
+     */
+    AnnotationWriter next;
+
+    /**
+     * Previous annotation writer. This field is used to store annotation lists.
+     */
+    AnnotationWriter prev;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructs a new {@link AnnotationWriter}.
+     *
+     * @param cw the class writer to which this annotation must be added.
+     * @param named <tt>true<tt> if values are named, <tt>false</tt> otherwise.
+     * @param bv where the annotation values must be stored.
+     * @param parent where the number of annotation values must be stored.
+     * @param offset where in <tt>parent</tt> the number of annotation values must
+     *      be stored.
+     */
+    AnnotationWriter(
+        final ClassWriter cw,
+        final boolean named,
+        final ByteVector bv,
+        final ByteVector parent,
+        final int offset)
+    {
+        super(Opcodes.ASM4);
+        this.cw = cw;
+        this.named = named;
+        this.bv = bv;
+        this.parent = parent;
+        this.offset = offset;
+    }
+
+    // ------------------------------------------------------------------------
+    // Implementation of the AnnotationVisitor abstract class
+    // ------------------------------------------------------------------------
+
+    @Override
+    public void visit(final String name, final Object value) {
+        ++size;
+        if (named) {
+            bv.putShort(cw.newUTF8(name));
+        }
+        if (value instanceof String) {
+            bv.put12('s', cw.newUTF8((String) value));
+        } else if (value instanceof Byte) {
+            bv.put12('B', cw.newInteger(((Byte) value).byteValue()).index);
+        } else if (value instanceof Boolean) {
+            int v = ((Boolean) value).booleanValue() ? 1 : 0;
+            bv.put12('Z', cw.newInteger(v).index);
+        } else if (value instanceof Character) {
+            bv.put12('C', cw.newInteger(((Character) value).charValue()).index);
+        } else if (value instanceof Short) {
+            bv.put12('S', cw.newInteger(((Short) value).shortValue()).index);
+        } else if (value instanceof Type) {
+            bv.put12('c', cw.newUTF8(((Type) value).getDescriptor()));
+        } else if (value instanceof byte[]) {
+            byte[] v = (byte[]) value;
+            bv.put12('[', v.length);
+            for (int i = 0; i < v.length; i++) {
+                bv.put12('B', cw.newInteger(v[i]).index);
+            }
+        } else if (value instanceof boolean[]) {
+            boolean[] v = (boolean[]) value;
+            bv.put12('[', v.length);
+            for (int i = 0; i < v.length; i++) {
+                bv.put12('Z', cw.newInteger(v[i] ? 1 : 0).index);
+            }
+        } else if (value instanceof short[]) {
+            short[] v = (short[]) value;
+            bv.put12('[', v.length);
+            for (int i = 0; i < v.length; i++) {
+                bv.pu