Merge
authorlana
Thu, 31 Mar 2011 22:07:32 -0700
changeset 9021 5cf29386a520
parent 9020 13b639abc930 (current diff)
parent 8892 3db1444f8ac8 (diff)
child 9022 b2e8758b10fd
child 9023 6175922846a4
child 9025 a72fc1fc4b71
child 9836 3d2b0ec3de09
Merge
hotspot/test/compiler/6987555/Test6987555.java
hotspot/test/compiler/6991596/Test6991596.java
jdk/make/common/Defs.gmk
jdk/make/common/Release.gmk
jdk/make/java/dyn/Makefile
jdk/src/share/classes/java/dyn/CallSite.java
jdk/src/share/classes/java/dyn/ClassValue.java
jdk/src/share/classes/java/dyn/ConstantCallSite.java
jdk/src/share/classes/java/dyn/InvokeDynamic.java
jdk/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java
jdk/src/share/classes/java/dyn/Linkage.java
jdk/src/share/classes/java/dyn/MethodHandle.java
jdk/src/share/classes/java/dyn/MethodHandles.java
jdk/src/share/classes/java/dyn/MethodType.java
jdk/src/share/classes/java/dyn/MethodTypeForm.java
jdk/src/share/classes/java/dyn/MutableCallSite.java
jdk/src/share/classes/java/dyn/SwitchPoint.java
jdk/src/share/classes/java/dyn/VolatileCallSite.java
jdk/src/share/classes/java/dyn/WrongMethodTypeException.java
jdk/src/share/classes/java/dyn/package-info.java
jdk/src/share/classes/sun/dyn/Access.java
jdk/src/share/classes/sun/dyn/AdapterMethodHandle.java
jdk/src/share/classes/sun/dyn/BoundMethodHandle.java
jdk/src/share/classes/sun/dyn/CallSiteImpl.java
jdk/src/share/classes/sun/dyn/DirectMethodHandle.java
jdk/src/share/classes/sun/dyn/FilterGeneric.java
jdk/src/share/classes/sun/dyn/FilterOneArgument.java
jdk/src/share/classes/sun/dyn/FromGeneric.java
jdk/src/share/classes/sun/dyn/InvokeGeneric.java
jdk/src/share/classes/sun/dyn/Invokers.java
jdk/src/share/classes/sun/dyn/MemberName.java
jdk/src/share/classes/sun/dyn/MethodHandleImpl.java
jdk/src/share/classes/sun/dyn/MethodHandleNatives.java
jdk/src/share/classes/sun/dyn/MethodTypeImpl.java
jdk/src/share/classes/sun/dyn/SpreadGeneric.java
jdk/src/share/classes/sun/dyn/ToGeneric.java
jdk/src/share/classes/sun/dyn/WrapperInstance.java
jdk/src/share/classes/sun/dyn/anon/AnonymousClassLoader.java
jdk/src/share/classes/sun/dyn/anon/ConstantPoolParser.java
jdk/src/share/classes/sun/dyn/anon/ConstantPoolPatch.java
jdk/src/share/classes/sun/dyn/anon/ConstantPoolVisitor.java
jdk/src/share/classes/sun/dyn/anon/InvalidConstantPoolFormatException.java
jdk/src/share/classes/sun/dyn/empty/Empty.java
jdk/src/share/classes/sun/dyn/package-info.java
jdk/src/share/classes/sun/dyn/util/BytecodeDescriptor.java
jdk/src/share/classes/sun/dyn/util/BytecodeName.java
jdk/src/share/classes/sun/dyn/util/ValueConversions.java
jdk/src/share/classes/sun/dyn/util/VerifyAccess.java
jdk/src/share/classes/sun/dyn/util/VerifyType.java
jdk/src/share/classes/sun/dyn/util/Wrapper.java
jdk/src/share/classes/sun/dyn/util/package-info.java
jdk/test/java/dyn/ClassValueTest.java
jdk/test/java/dyn/InvokeDynamicPrintArgs.java
jdk/test/java/dyn/InvokeGenericTest.java
jdk/test/java/dyn/JavaDocExamplesTest.java
jdk/test/java/dyn/MethodHandlesTest.java
jdk/test/java/dyn/MethodTypeTest.java
jdk/test/java/dyn/indify/Indify.java
--- a/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -108,3 +108,5 @@
 d8af56da89bc0fc02a6b6ad78f51157a46d665ab jdk7-b131
 d61280d36755d1941fb487f554e8b7a6d0bca6a1 jdk7-b132
 fd444c61e7ed3d92b2a730da7c737b02191b682f jdk7-b133
+def8e16dd237a47fc067d66d4c616d7baaec6001 jdk7-b134
+f75a1efb141210901aabe00a834e0fc32bb8b337 jdk7-b135
--- a/.hgtags-top-repo	Thu Mar 31 19:09:02 2011 -0700
+++ b/.hgtags-top-repo	Thu Mar 31 22:07:32 2011 -0700
@@ -108,3 +108,5 @@
 5d86d951426aaf340b1ba84ae2d5ab5da65a71e2 jdk7-b131
 0f62a65fb666b337caa585015ab6ea2e60e709ca jdk7-b132
 c6f380693342feadccc5fe2c5adf500e861361aa jdk7-b133
+ddc2fcb3682ffd27f44354db666128827be7e3c3 jdk7-b134
+783bd02b4ab4596059c74b10a1793d7bd2f1c157 jdk7-b135
--- a/README	Thu Mar 31 19:09:02 2011 -0700
+++ b/README	Thu Mar 31 22:07:32 2011 -0700
@@ -29,13 +29,14 @@
      Set the environment variable ALT_BOOTDIR to the location of JDK 6.
 
   2. Check the sanity of doing a build with your current system:
-       gnumake sanity
+       make sanity
      See README-builds.html if you run into problems.
   
   3. Do a complete build of the OpenJDK:
-       gnumake all
+       make all
      The resulting JDK image should be found in build/*/j2sdk-image
 
-where gnumake is GNU make 3.81 or newer, /usr/bin/make on Linux and
-/usr/sfw/bin/gmake or /opt/sfw/bin/gmake on Solaris.
+where make is GNU make 3.81 or newer, /usr/bin/make on Linux usually
+is 3.81 or newer.
 
+Complete details are available in README-builds.html.
--- a/README-builds.html	Thu Mar 31 19:09:02 2011 -0700
+++ b/README-builds.html	Thu Mar 31 22:07:32 2011 -0700
@@ -54,7 +54,11 @@
                         <li><a href="#opensolaris">OpenSolaris</a></li>
                     </ul>
                 </li>
-                <li><a href="#directories">Source Directory Structure</a> </li>
+                <li><a href="#directories">Source Directory Structure</a> 
+                    <ul>
+                        <li><a href="#drops">Managing the Source Drops</a></li>
+                    </ul>
+                </li>
                 <li><a href="#building">Build Information</a>
                     <ul>
                         <li><a href="#gmake">GNU Make (<tt><i>gmake</i></tt>)</a> </li>
@@ -65,7 +69,7 @@
                             <ul>
                                 <li><a href="#bootjdk">Bootstrap JDK</a> </li>
                                 <li><a href="#importjdk">Optional Import JDK</a> </li>
-                                <li><a href="#ant">Ant</a> </li>
+                                <li><a href="#ant">Ant 1.7.1</a> </li>
                                 <li><a href="#cacerts">Certificate Authority File (cacert)</a> </li>
                                 <li><a href="#compilers">Compilers</a>
                                     <ul>
@@ -114,13 +118,13 @@
             <a href="http://mercurial.selenic.com/wiki/Mercurial">Mercurial</a>.
             If you are new to Mercurial, please see the
             <a href="http://mercurial.selenic.com/wiki/BeginnersGuides">Beginner Guides</a>
-            or refer to the <a href=""http://hgbook.red-bean.com/">Mercurial Book</a>.
+            or refer to the <a href="http://hgbook.red-bean.com/">Mercurial Book</a>.
             The first few chapters of the book provide an excellent overview of
             Mercurial, what it is and how it works.
             <br>
             For using Mercurial with the OpenJDK refer to the
-            <a href=""http://openjdk.java.net/guide/repositories.html#installConfig">
-               Developer Guide: Installing and Configuring Mercurial</a>
+            <a href="http://openjdk.java.net/guide/repositories.html#installConfig">
+                Developer Guide: Installing and Configuring Mercurial</a>
             section for more information.
             The Forest Extension is not part of the Mercurial install,
             and is optional,
@@ -146,14 +150,14 @@
                 using the Forest Extension:
                 <blockquote>
                     <tt>
-                        hg fclone http://openjdk.java.net/jdk7/jdk7 <i>YourOpenJDK</i>
+                        hg fclone http://hg.openjdk.java.net/jdk7/jdk7 <i>YourOpenJDK</i>
                     </tt>
                 </blockquote>
                 To get the entire set of OpenJDK Mercurial repositories
                 without using the Forest Extension:
                 <blockquote>
                     <tt>
-                        hg clone http://openjdk.java.net/jdk7/jdk7 <i>YourOpenJDK</i>
+                        hg clone http://hg.openjdk.java.net/jdk7/jdk7 <i>YourOpenJDK</i>
                         <br>cd <i>YourOpenJDK</i>
                         <br>sh ./get_source.sh
                     </tt>
@@ -207,66 +211,50 @@
                     <tr>
                         <td>Linux X86 (32-bit)</td>
                         <td>Fedora 9</td>
-                        <td>gcc 4 </td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>gcc 4.3 </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Linux X64 (64-bit)</td>
                         <td>Fedora 9</td>
-                        <td>gcc 4 </td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>gcc 4.3 </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Solaris SPARC (32-bit)</td>
-                        <td>Solaris 10u2 + patches 
-                            <br>
-                            See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
-                                SunSolve</a> for patch downloads.
-                        </td>
+                        <td>Solaris 10 Update 6</td>
                         <td>Sun Studio 12 Update 1 + patches</td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Solaris SPARCV9 (64-bit)</td>
-                        <td>Solaris 10u2 + patches
-                            <br>
-                            See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
-                                SunSolve</a> for patch downloads.
-                        </td>
+                        <td>Solaris 10 Update 6</td>
                         <td>Sun Studio 12 Update 1 + patches</td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Solaris X86 (32-bit)</td>
-                        <td>Solaris 10u2 + patches
-                            <br>
-                            See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
-                                SunSolve</a> for patch downloads.
-                        </td>
+                        <td>Solaris 10 Update 6</td>
                         <td>Sun Studio 12 Update 1 + patches</td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Solaris X64 (64-bit)</td>
-                        <td>Solaris 10u2 + patches
-                            <br>
-                            See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
-                                SunSolve</a> for patch downloads.
-                        </td>
+                        <td>Solaris 10 Update 6</td>
                         <td>Sun Studio 12 Update 1 + patches</td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Windows X86 (32-bit)</td>
                         <td>Windows XP</td>
                         <td>Microsoft Visual Studio C++ 2010 Professional Edition</td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>JDK 6u18</td>
                     </tr>
                     <tr>
                         <td>Windows X64 (64-bit)</td>
                         <td>Windows Server 2003 - Enterprise x64 Edition</td>
                         <td>Microsoft Visual Studio C++ 2010 Professional Edition</td>
-                        <td>JDK 6u14 FCS </td>
+                        <td>JDK 6u18</td>
                     </tr>
                 </tbody>
             </table>
@@ -300,7 +288,7 @@
 	      way to do it is to execute the following commands as user 
                 <tt>root</tt>:
                 <p/>
-                <code>yum-builddep java-openjdk</code>
+                <code>yum-builddep java-1.6.0-openjdk</code>
                 <p/>
                 <code>yum install gcc gcc-c++</code>
                 <p/>
@@ -345,10 +333,10 @@
             </blockquote>
         </blockquote>
         <!-- ------------------------------------------------------ -->
-        <h3><a name="centos">CentOS 5.2</a></h3>
+        <h3><a name="centos">CentOS 5.5</a></h3>
         <blockquote>
             After installing
-            <a href="http://www.centos.org/">CentOS 5.2</a>
+            <a href="http://www.centos.org/">CentOS 5.5</a>
             you need to make sure you have
             the following Development bundles installed:
             <blockquote>
@@ -356,7 +344,7 @@
                     <li>Development Libraries</li>
                     <li>Development Tools</li>
                     <li>Java Development</li>
-                    <li>X Software Development</li>
+                    <li>X Software Development (Including XFree86-devel)</li>
                 </ul>
             </blockquote>
             <p>
@@ -552,15 +540,105 @@
                 building the OpenJDK runtime libraries and misc files.
                 The top level <tt>Makefile</tt>
                 is used to build the entire OpenJDK.
+
+            <h3><a name="drops">Managing the Source Drops</a></h3>
+            <blockquote>
+                <p>
+                    The repositories <tt>jaxp</tt> and <tt>jaxws</tt> actually
+                    do not contain the sources for JAXP or JAX-WS.
+                    These products have their own open source procedures at their
+                    <a href="http://jaxp.java.net/">JAXP</a> and
+                    <a href="http://jax-ws.java.net/">JAX-WS</a> home pages.
+                    The OpenJDK project does need access to these sources to build
+                    a complete JDK image because JAXP and JAX-WS are part of the JDK.
+                    The current process for delivery of the JAXP and JAX-WS sources
+                    involves so called "source drop bundles" downloaded from a public
+                    website.
+                    There are many reasons for this current mechanism, and it is
+                    understood that this is not ideal for the open source community.
+                    It is possible this process could change in the future.
+                    <br>
+                    <b>NOTE:</b> The <a href="http://download.java.net/openjdk/jdk7/">
+                        Complete OpenJDK Source Bundles</a> <u>will</u> contain the JAXP and
+                    JAX-WS sources.
+                </p>
+
+                <h4><a name="dropcreation">Creation of New Source Drop Bundles</a></h4>
+                <blockquote>
+                    <ol>
+                        <li>
+                            The JAXP or JAX-WS team prepares a new zip bundle,
+                            places a copy in a public download area on java.net,
+                            sends us a link and a list of CRs (Change Request Numbers).
+                            The older download bundles should not be deleted.
+                            It is the responsibility of the JAXP and JAX-WS team to
+                            place the proper GPL legal notices on the sources
+                            and do any filtering or java re-packaging for the
+                            OpenJDK instances of these classes.
+                        </li>
+                        <li>
+                            The OpenJDK team copies this new bundle into shared
+                            area (e.g. <tt>/java/devtools/share/jdk7-drops</tt>).
+                            Older bundles are never deleted so we retain the history.
+                        </li>
+                        <li>
+                            The OpenJDK team edits the ant property file
+                            <tt>jaxp/jaxp.properties</tt> or
+                            <tt>jaxws/jaxws.properties</tt> to update the
+                            base URL, the zip bundle name, and the MD5 checksum
+                            of the zip bundle
+                            (on Solaris: <tt>sum -c md5 <i>bundlename</i></tt>)
+                        </li>
+                        <li>
+                            OpenJDK team reviews and commits those changes with the
+                            given CRs.
+                        </li>
+                    </ol>
+                </blockquote>
+
+                <h4><a name="dropusage">Using Source Drop Bundles</a></h4>
+                <blockquote>
+                    <p>
+                        The ant scripts that build <tt>jaxp</tt> and <tt>jaxws</tt>
+                        will attempt to locate these zip bundles from the directory
+                        in the environment variable
+                        <tt><a href="#ALT_DROPS_DIR">ALT_DROPS_DIR</a></tt>.
+                        The checksums protect from getting the wrong, corrupted, or
+                        improperly modified sources.
+                        Once the sources are made available, the population will not
+                        happen again unless a <tt>make clobber</tt> is requested
+                        or the <tt>jaxp/drop/</tt> or <tt>jaxws/drop/</tt>
+                        directory is explicitly deleted.
+                        <br>
+                        <b>NOTE:</b> The default Makefile and ant script behavior
+                        is to NOT download these bundles from the public http site.
+                        In general, doing downloads
+                        during the build process is not advised, it creates too much
+                        unpredictability in the build process.
+                        However, you can use <tt>make ALLOW_DOWNLOADS=true</tt> to
+                        tell the ant script that the download of the zip bundle is
+                        acceptable.
+                    </p>
+                    <p>
+                        The recommended procedure for keeping a cache of these
+                        source bundles would be to download them once, place them
+                        in a directory outside the repositories, and then set
+                        <tt><a href="#ALT_DROPS_DIR">ALT_DROPS_DIR</a></tt> to refer
+                        to that directory.
+                        These drop bundles do change occasionally, so the newer
+                        bundles may need to be added to this area from time to time.
+                    </p>
+                </blockquote>
+            </blockquote>
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <hr>
         <h2><a name="building">Build Information</a></h2>
         <blockquote>
             Building the OpenJDK
-            is done with a <tt><i>gmake</i></tt>
-            command line and various
-            environment or make variable settings that direct the make rules
+            is done with a <a href="#gmake">GNU <tt>make</tt></a> command line
+            and various
+            environment or make variable settings that direct the makefile rules
             to where various components have been installed.
             Where possible the makefiles will attempt to located the various
             components in the default locations or any component specific 
@@ -578,7 +656,7 @@
                 <pre><tt>
                 bash
                 . jdk/make/jdk_generic_profile.sh
-                <i>gmake</i> sanity &amp;&amp; <i>gmake</i>
+                <a href="#gmake"><tt>make</tt></a> sanity &amp;&amp; <a href="#gmake"><tt>make</tt></a>
                 </tt></pre>
             </blockquote>
             <p>
@@ -599,25 +677,31 @@
             A few notes about using GNU make:
             <ul>
                 <li>
-                    In general, you need GNU make version 3.81 or newer.
+                    You need GNU make version 3.81 or newer.
                 </li>
                 <li>
                     Place the location of the GNU make binary in the <tt>PATH</tt>. 
                 </li>
                 <li>
                     <strong>Linux:</strong>
-                    The <tt>/usr/bin/make</tt> command should work fine for you.
+                    The <tt>/usr/bin/make</tt> should be 3.81 or newer
+                    and should work fine for you.
+                    If this version is not 3.81 or newer,
+                    see the <a href="#buildgmake">"Building GNU make"</a> section.
                 </li>
                 <li>
                     <strong>Solaris:</strong>
                     Do NOT use <tt>/usr/bin/make</tt> on Solaris.
                     If your Solaris system has the software
                     from the Solaris Companion CD installed, 
-                    you should use <tt>gmake</tt>
+                    you should try and use <tt>gmake</tt>
                     which will be located in either the <tt>/opt/sfw/bin</tt> or 
                     <tt>/usr/sfw/bin</tt> directory.
-                    In more recent versions of Solaris GNU make can be found
-                    at <tt>/usr/bin/gmake</tt>. 
+                    In more recent versions of Solaris GNU make might be found
+                    at <tt>/usr/bin/gmake</tt>.<br>
+                    <b>NOTE:</b> It is very likely that this <tt>gmake</tt>
+                    could be 3.80, you need 3.81, in which case,
+                    see the <a href="#buildgmake">"Building GNU make"</a> section.
                 </li>
                 <li>
                     <strong>Windows:</strong>
@@ -627,30 +711,25 @@
                     as a <tt>make.exe</tt> built for something like
                     <a href="http://www.mkssoftware.com/">MKS</a>). 
                     <br>
-                    <b>WARNING:</b> Watch out for make version 3.81, it may
+                    <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>.
-                    Use a 3.80 version, or find a newer
-                    version that has this problem fixed.
-                    The older 3.80 version of make.exe can be downloaded with this
-                    <a href="http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2" target="_blank">
-                        link</a>.
-                    Use of this older 3.80 make.exe may require that you install the
-                    libintl2.dll library or libintl2 cygwin package which is
-                    no longer installed by default by the cygwin installer.
                     <br>
-                    Also see the
+                    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.
-                    In addition to the above 3.80 make.exe you can download 
-                    this
+                    <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> which will not have a libintl2.dll
-                    dependency.
+                        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.
                 </li>
             </ul>
             <p>
@@ -662,6 +741,34 @@
                 The latest source to GNU make is available at
                 <a href="http://ftp.gnu.org/pub/gnu/make/" target="_blank">
                     ftp.gnu.org/pub/gnu/make/</a>.
+            </p>
+            <!-- ------------------------------------------------------ -->
+            <h4><a name="buildgmake">Building GNU make</a></h4>
+            <blockquote>
+                First step is to get the GNU make 3.81 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
+                on Windows:
+                <ul>
+                    <li>
+                        <strong>Linux:</strong>
+                        <tt>./configure && make</tt>
+                    </li>
+                    <li>
+                        <strong>Solaris:</strong>
+                        <tt>./configure && gmake CC=gcc</tt>
+                    </li>
+                    <li>
+                        <strong>Windows for CYGWIN:</strong>
+                        <tt>./configure && make</tt>
+                    </li>
+                    <li>
+                        <strong>Windows for MKS: (CYGWIN is recommended)</strong>
+                        <tt>./configure && make -f Makefile.win32</tt>
+                    </li>
+                </ul>
+            </blockquote>
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <hr>
@@ -713,7 +820,7 @@
                 </li>
                 <li>
                     Install
-                    <a href="#ant">Ant</a>, 
+                    <a href="#ant">Ant 1.7.1 or newer</a>,
                     make sure it is in your PATH.
                 </li>
             </ol>
@@ -776,7 +883,7 @@
                 </li>
                 <li>
                     Install
-                    <a href="#ant">Ant</a>, 
+                    <a href="#ant">Ant 1.7.1 or newer</a>,
                     make sure it is in your PATH.
                 </li>
             </ol>
@@ -862,7 +969,7 @@
                 </li>
                 <li>
                     Install
-                    <a href="#ant">Ant</a>, 
+                    <a href="#ant">Ant 1.7.1 or newer</a>,
                     make sure it is in your PATH and set
                     <tt><a href="#ANT_HOME">ANT_HOME</a></tt>.
                 </li>
@@ -923,14 +1030,20 @@
             <blockquote>
                 All OpenJDK builds require access to least Ant 1.7.1.
                 The Ant tool is available from the 
-                <a href="http://ant.apache.org" target="_blank">
-                    Ant download site</a>.
+                <a href="http://archive.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.zip" target="_blank">
+                    Ant 1.7.1 archive download site</a>.
                 You should always make sure <tt>ant</tt> is in your PATH, and
                 on Windows you may also need to set 
                 <tt><a href="#ANT_HOME">ANT_HOME</a></tt>
                 to point to the location of
                 the Ant installation, this is the directory pathname
                 that contains a <tt>bin and lib</tt>.
+                <br>
+                <b>WARNING:</b> Ant versions used from IDE tools like NetBeans
+                or installed via system packages may not operate the same
+                as the one obtained from the Ant download bundles.
+                These system and IDE installers sometimes choose to change
+                the ant installation enough to cause differences.
             </blockquote>
             <!-- ------------------------------------------------------ -->
             <h4><a name="cacerts">Certificate Authority File (cacert)</a></h4>
@@ -962,7 +1075,7 @@
             <blockquote>
                 <strong><a name="gcc">Linux gcc/binutils</a></strong>
                 <blockquote>
-                    The GNU gcc compiler version should be 4 or newer.
+                    The GNU gcc compiler version should be 4.3 or newer.
                     The compiler used should be the default compiler installed
                     in <tt>/usr/bin</tt>.
                 </blockquote>
@@ -1047,21 +1160,16 @@
                 <strong><a name="msvc32">Windows i586: Microsoft Visual Studio 2010 Compilers</a></strong>
                 <blockquote>
                     <p>
-                        <b>BEGIN WARNING</b>: At this time (Spring/Summer 2010) JDK 7 is starting a transition to
-                        use the newest VS2010 Microsoft compilers. These build instructions are updated
-                        to show where we are going. We have a QA process to go through before
-                        official builds actually use VS2010. So for now, official builds are
-                        still using VS2003. No other compilers are known to build the entire JDK,
+                        <b>BEGIN WARNING</b>: JDK 7 has transitioned to
+                        use the newest VS2010 Microsoft compilers.
+                        No other compilers are known to build the entire JDK,
                         including non-open portions.
-                        So for now you should be able to build with either VS2003 or VS2010.
-                        We do not guarantee that VS2008 will work, although there is sufficient
-                        makefile support to make at least basic JDK builds plausible.
                         Visual Studio 2010 Express compilers are now able to build all the
                         open source repositories, but this is 32 bit only. To build 64 bit
-                        Windows binaries use the the 7.1 Windows SDK.<b>END WARNING.</b>
+                        Windows binaries use the the 7.1 Windows SDK.
+                        <b>END WARNING.</b>
                     <p>
-                        The 32-bit OpenJDK Windows build
-                        requires
+                        The 32-bit OpenJDK Windows build requires
                         Microsoft Visual Studio C++ 2010 (VS2010) Professional
                         Edition or Express compiler.
                         The compiler and other tools are expected to reside
@@ -1088,11 +1196,10 @@
                 </blockquote>
                 <strong><a name="msvc64">Windows x64: Microsoft Visual Studio 2010 Professional Compiler</a></strong>
                 <blockquote>
-                    For <b>X64</b>, builds, when using the VS2010 Professional
-                    compiler, the 64 bit build set up is much the same as 32 bit
+                    For <b>X64</b>, the set up is much the same as 32 bit
                     except that you run <tt>amd64\VCVARS64.BAT</tt>
                     to set the compiler environment variables.
-                    Previously 64 bit builds had used the 64 bit compiler in
+                    Previously 64 bit builds had to use the 64 bit compiler in
                     an unbundled Windows SDK but this is no longer necessary if
                     you have VS2010 Professional.
                 </blockquote>
@@ -1614,6 +1721,13 @@
                     and on Windows with CYGWIN
                     <tt>/usr/bin</tt>.
                 </dd>
+                <dt><tt><a name="ALT_DROPS_DIR">ALT_DROPS_DIR</a></tt> </dt>
+                <dd>
+                    The location of any source drop bundles
+                    (see <a href="#drops">Managing the Source Drops</a>).
+                    The default will be
+                    <tt>$(ALT_JDK_DEVTOOLS_PATH)/share/jdk7-drops</tt>.
+                </dd>
                 <dt><a name="ALT_UNIXCCS_PATH"><tt>ALT_UNIXCCS_PATH</tt></a></dt>
                 <dd>
                     <strong>Solaris only:</strong>
@@ -1649,6 +1763,12 @@
                     Where each of these directories contain the import JDK image
                     for that platform.
                 </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>
                 <dt><strong>Windows specific:</strong></dt>
                 <dd>
                     <dl>
@@ -1659,9 +1779,8 @@
 			    located.
 			    The default is whatever WINDOWSSDKDIR is set to
 			    (or WindowsSdkDir) or the path
-			    <pre>
-                            c:\Program Files\Microsoft SDKs\Windows\v6.1a
-			    </pre>
+                            <br>
+                            <tt>c:\Program Files\Microsoft SDKs\Windows\v7.0a</tt>
                         </dd>
                         <dt><tt><a name="ALT_DXSDK_PATH">ALT_DXSDK_PATH</a></tt> </dt>
                         <dd>
@@ -1678,10 +1797,160 @@
                         </dd>
                     </dl>
                 </dd>
+                <dt><strong>Cross-Compilation Support:</strong></dt>
+                <dd>
+                    <dl>
+                        <dt><a name="CROSS_COMPILE_ARCH"><tt>CROSS_COMPILE_ARCH</tt></a> </dt>
+                        <dd>
+                            Set to the target architecture of a cross-compilation build. If set, this
+                            variable is used to signify that we are cross-compiling. The expectation
+                            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.
+                            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.
+                           These are added to the <tt>CFLAGS</tt> and <tt>CXXFLAGS</tt> variables. 
+			</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)
+                            this variable indicates that tools from the boot JDK should be used during
+                            the build process, not the tools (<tt>javac</tt>, <tt>javah</tt>, <tt>jar</tt>)
+                            just built (which can't execute on the build host).
+                        </dd>
+                        <dt><tt><a name="HOST_CC">HOST_CC</a></tt> </dt>
+                        <dd>
+                            The location of the C compiler to generate programs to run on the build host.
+                            Some parts of the build generate programs that are then compiled and executed
+                            to produce other parts of the build. Normally the primary C compiler is used
+                            to do this, but when cross-compiling that would be the cross-compiler and the
+                            resulting program could not be executed. 
+                            On Linux this defaults to <tt>/usr/bin/gcc</tt>; on other platforms it must be
+                            set explicitly.
+                        </dd>
+                    </dl>
+                <dt><strong>Specialized Build Options:</strong></dt>
+                <dd>
+                  Some build variables exist to support specialized build environments and/or specialized
+                  build products. Their use is only supported in those contexts:
+                    <dl>
+                        <dt><tt><a name="BUILD_CLIENT_ONLY">BUILD_CLIENT_ONLY</a></tt> </dt>
+                        <dd>
+                            Indicates this build will only contain the Hotspot client VM. In addition to
+                            controlling the Hotspot build target, it ensures that we don't try to copy
+                            any server VM files/directories, and defines a default <tt>jvm.cfg</tt> file
+                            suitable for a client-only environment. Using this in a 64-bit build will
+                            generate a sanity warning as 64-bit client builds are not directly supported.
+                        </dd>
+                        <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.
+                        </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.
+                        </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.
+                        </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.
+                        </dd>
+                    </dl>
+                </dd>
             </dl>
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <hr>
+        <h2><a name="hints">Hints and Tips</a></h2>
+        <blockquote>
+            You don't have to use all these hints and tips, and in fact people do actually
+            build with systems that contradict these, but they might prove to be
+            helpful to some.
+            <ul>
+                <li>
+                    If <tt>make sanity</tt> does not work, find out why, fix that
+                    before going any further. Or at least understand what the
+                    complaints are from it.
+                </li>
+                <li>
+                    JDK: Keep in mind that you are building a JDK, but you need
+                    a JDK (BOOTDIR JDK) to build this JDK.
+                </li>
+                <li>
+                    Ant: The ant utility is a java application and besides having
+                    ant available to you, it's important that ant finds the right
+                    java to run with. Make sure you can type <tt>ant -version</tt>
+                    and get clean results with no error messages.
+                </li>
+                <li>
+                    Linux: Try and favor the system packages over building your own
+                    or getting packages from other areas.
+                    Most Linux builds should be possible with the system's
+                    available packages.
+                </li>
+                <li>
+                    Solaris: Typically you will need to get compilers on your systems
+                    and occasionally GNU make 3.81 if a gmake binary is not available.
+                    The gmake binary might not be 3.81, be careful.
+                </li>
+                <li>
+                    Windows VS2010:
+                    <ul>
+                        <li>
+                            Only the C++ part of VS2010 is needed.
+                            Try to let the installation go to the default install directory.
+                            Always reboot your system after installing VS2010.
+                            The system environment variable VS100COMNTOOLS should be
+                            set in your environment.
+                        </li>
+                        <li>
+                            Make sure that TMP and TEMP are also set in the environment
+                            and refer to Windows paths that exist, like <tt>C:\temp</tt>,
+                            not <tt>/tmp</tt>, not <tt>/cygdrive/c/temp</tt>, and not <tt>C:/temp</tt>.
+                            <tt>C:\temp</tt> is just an example, it is assumed that this area is
+                            private to the user, so by default after installs you should
+                            see a unique user path in these variables.
+                        </li>
+                        <li>
+                            You need to use vsvars32.bat or vsvars64.bat to get the
+                            PATH, INCLUDE, LIB, LIBPATH, and WINDOWSSDKDIR
+                            variables set in your shell environment.
+                            These bat files are not easy to use from a shell environment.
+                            However, there is a script placed in the root jdk7 repository called
+                            vsvars.sh that can help, it should only be done once in a shell
+                            that will be doing the build, e.g.<br>
+                            <tt>sh ./make/scripts/vsvars.sh -v10 > settings<br>
+                                eval `cat settings`</tt><br>
+                            Or just <tt>eval `sh ./make/scripts/vsvars.sh -v10`</tt>.
+                        </li>
+                    </ul>
+                </li>
+                <li>
+                    Windows: PATH order is critical, see the
+                    <a href="#paths">paths</a> section for more information.
+                </li>
+                <li>
+                    Windows 64bit builds: Use ARCH_DATA_MODEL=64.
+                </li>
+            </ul>
+        </blockquote>
+        <!-- ------------------------------------------------------ -->
+        <hr>
         <h2><a name="troubleshooting">Troubleshooting</a></h2>
         <blockquote>
             A build can fail for any number of reasons. 
@@ -1707,6 +1976,19 @@
                 below, with suggestions for remedies.
             <ul>
                 <li>
+                    <b>Corrupted Bundles on Windows:</b>
+                    <blockquote>
+                        Some virus scanning software has been known to corrupt the
+                        downloading of zip bundles.
+                        It may be necessary to disable the 'on access' or 'real time'
+                        virus scanning features to prevent this corruption.
+                        This type of "real time" virus scanning can also slow down the
+                        build process significantly.
+                        Temporarily disabling the feature, or excluding the build
+                        output directory may be necessary to get correct and faster builds.
+                    </blockquote>
+                </li>
+                <li>
                     <b>Slow Builds:</b>
                     <blockquote>
                         If your build machine seems to be overloaded from too many
@@ -1801,7 +2083,11 @@
                     </blockquote>
                 </li>
                 <li>
-                    <b>Windows Error Message: <tt>*** fatal error - couldn't allocate heap, ... </tt></b>
+                    <b>Windows Error Messages:</b><br>
+                    <tt>*** fatal error - couldn't allocate heap, ... </tt><br>
+                    <tt>rm fails with "Directory not empty"</tt><br>
+                    <tt>unzip fails with "cannot create ... Permission denied"</tt><br>
+                    <tt>unzip fails with "cannot create ... Error 50"</tt><br>
                     <blockquote>
                         The CYGWIN software can conflict with other non-CYGWIN
                         software. See the CYGWIN FAQ section on
@@ -1810,12 +2096,11 @@
                     </blockquote>
                 </li>
                 <li>
-                    <b>Windows Error Message: <tt>*** multiple target patterns.  Stop.</tt></b>
+                    <b>Windows Error Message: <tt>spawn failed</tt></b>
                     <blockquote>
-                        The CYGWIN make version 3.81 may not like the Windows <tt>C:/</tt>
-                        style paths, it may not like the ':' character in the path
-                        when used in a makefile target definition.
-                        See the <a href="#gmake"><tt><i>gmake</i></tt></a> section.
+                        Try rebooting the system, or there could be some kind of
+                        issue with the disk or disk partition being used.
+                        Sometimes it comes with a "Permission Denied" message.
                     </blockquote>
                 </li>
             </ul>
--- a/corba/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/corba/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -108,3 +108,5 @@
 9d6dd2cdfcb92612dbd836ecded87770d52b49db jdk7-b131
 1b1e75e8f476e5c07f0d2b035993895e2603e1f0 jdk7-b132
 671fe2e623ffefb4b7c312be919fc71eb48c1df1 jdk7-b133
+918003855fa0dba5acf4bf1fe36526d2fc4c1ba8 jdk7-b134
+e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135
--- a/hotspot/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -154,3 +154,7 @@
 0e531ab5ba04967a0e9aa6aef65e6eb3a0dcf632 jdk7-b132
 a8d643a4db47c7b58e0bcb49c77b5c3610de86a8 hs21-b03
 1b3a350709e4325d759bb453ff3fb6a463270488 jdk7-b133
+447e6faab4a8755d4860c2366630729dbaec111c jdk7-b134
+3c76374706ea8a77e15aec8310e831e5734f8775 hs21-b04
+b898f0fc3cedc972d884d31a751afd75969531cf jdk7-b135
+b898f0fc3cedc972d884d31a751afd75969531cf hs21-b05
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -62,7 +62,7 @@
 
     // get the value of static field
     ValueImpl getValue() {
-        return getValue(saField.getFieldHolder());
+        return getValue(saField.getFieldHolder().getJavaMirror());
     }
 
     // get the value of this Field from a specific Oop
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java	Thu Mar 31 22:07:32 2011 -0700
@@ -44,12 +44,10 @@
   private static synchronized void initialize(TypeDataBase db) {
     Type type = db.lookupType("StringTable");
     theTableField  = type.getAddressField("_the_table");
-    stringTableSize = db.lookupIntConstant("StringTable::string_table_size").intValue();
   }
 
   // Fields
   private static AddressField theTableField;
-  private static int stringTableSize;
 
   // Accessors
   public static StringTable getTheTable() {
@@ -57,10 +55,6 @@
     return (StringTable) VMObjectFactory.newObject(StringTable.class, tmp);
   }
 
-  public static int getStringTableSize() {
-    return stringTableSize;
-  }
-
   public StringTable(Address addr) {
     super(addr);
   }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -87,7 +87,7 @@
     innerClasses         = new OopField(type.getOopField("_inner_classes"), Oop.getHeaderSize());
     nonstaticFieldSize   = new CIntField(type.getCIntegerField("_nonstatic_field_size"), Oop.getHeaderSize());
     staticFieldSize      = new CIntField(type.getCIntegerField("_static_field_size"), Oop.getHeaderSize());
-    staticOopFieldSize   = new CIntField(type.getCIntegerField("_static_oop_field_size"), Oop.getHeaderSize());
+    staticOopFieldCount   = new CIntField(type.getCIntegerField("_static_oop_field_count"), Oop.getHeaderSize());
     nonstaticOopMapSize  = new CIntField(type.getCIntegerField("_nonstatic_oop_map_size"), Oop.getHeaderSize());
     isMarkedDependent    = new CIntField(type.getCIntegerField("_is_marked_dependent"), Oop.getHeaderSize());
     initState            = new CIntField(type.getCIntegerField("_init_state"), Oop.getHeaderSize());
@@ -140,7 +140,7 @@
   private static OopField  innerClasses;
   private static CIntField nonstaticFieldSize;
   private static CIntField staticFieldSize;
-  private static CIntField staticOopFieldSize;
+  private static CIntField staticOopFieldCount;
   private static CIntField nonstaticOopMapSize;
   private static CIntField isMarkedDependent;
   private static CIntField initState;
@@ -261,8 +261,7 @@
   public Symbol    getSourceDebugExtension(){ return getSymbol(sourceDebugExtension); }
   public TypeArray getInnerClasses()        { return (TypeArray)    innerClasses.getValue(this); }
   public long      getNonstaticFieldSize()  { return                nonstaticFieldSize.getValue(this); }
-  public long      getStaticFieldSize()     { return                staticFieldSize.getValue(this); }
-  public long      getStaticOopFieldSize()  { return                staticOopFieldSize.getValue(this); }
+  public long      getStaticOopFieldCount() { return                staticOopFieldCount.getValue(this); }
   public long      getNonstaticOopMapSize() { return                nonstaticOopMapSize.getValue(this); }
   public boolean   getIsMarkedDependent()   { return                isMarkedDependent.getValue(this) != 0; }
   public long      getVtableLen()           { return                vtableLen.getValue(this); }
@@ -453,7 +452,7 @@
       visitor.doOop(innerClasses, true);
       visitor.doCInt(nonstaticFieldSize, true);
       visitor.doCInt(staticFieldSize, true);
-      visitor.doCInt(staticOopFieldSize, true);
+      visitor.doCInt(staticOopFieldCount, true);
       visitor.doCInt(nonstaticOopMapSize, true);
       visitor.doCInt(isMarkedDependent, true);
       visitor.doCInt(initState, true);
@@ -692,7 +691,7 @@
   public long getObjectSize() {
     long bodySize =    alignObjectOffset(getVtableLen() * getHeap().getOopSize())
                      + alignObjectOffset(getItableLen() * getHeap().getOopSize())
-                     + (getStaticFieldSize() + getNonstaticOopMapSize()) * getHeap().getOopSize();
+                     + (getNonstaticOopMapSize()) * getHeap().getOopSize();
     return alignObjectSize(headerSize + bodySize);
   }
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/IntField.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/IntField.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -40,7 +40,12 @@
     super(holder, fieldArrayIndex);
   }
 
-  public int getValue(Oop obj) { return obj.getHandle().getJIntAt(getOffset()); }
+  public int getValue(Oop obj) {
+    if (!isVMField() && !obj.isInstance() && !obj.isArray()) {
+      throw new InternalError(obj.toString());
+    }
+    return obj.getHandle().getJIntAt(getOffset());
+  }
   public void setValue(Oop obj, int value) throws MutationException {
     // Fix this: setJIntAt is missing in Address
   }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopField.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopField.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,11 +41,17 @@
   }
 
   public Oop getValue(Oop obj) {
+    if (!isVMField() && !obj.isInstance() && !obj.isArray()) {
+      throw new InternalError();
+    }
     return obj.getHeap().newOop(getValueAsOopHandle(obj));
   }
 
   /** Debugging support */
   public OopHandle getValueAsOopHandle(Oop obj) {
+    if (!isVMField() && !obj.isInstance() && !obj.isArray()) {
+      throw new InternalError(obj.toString());
+    }
     return obj.getHandle().getOopHandleAt(getOffset());
   }
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -274,13 +274,7 @@
        // hc_klass is a HotSpot magic field and hence we can't
        // find it from InstanceKlass for java.lang.Class.
        TypeDataBase db = VM.getVM().getTypeDataBase();
-       int hcKlassOffset = (int) Instance.getHeaderSize();
-       try {
-          hcKlassOffset += (db.lookupIntConstant("java_lang_Class::hc_klass_offset").intValue() *
-                           VM.getVM().getHeapOopSize());
-       } catch (RuntimeException re) {
-          // ignore, currently java_lang_Class::hc_klass_offset is zero
-       }
+       int hcKlassOffset = (int) db.lookupType("java_lang_Class").getCIntegerField("klass_offset").getValue();
        if (VM.getVM().isCompressedOopsEnabled()) {
          hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
        } else {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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,13 +839,13 @@
   }
 
   private void readSystemProperties() {
-     InstanceKlass systemKls = getSystemDictionary().getSystemKlass();
+     final InstanceKlass systemKls = getSystemDictionary().getSystemKlass();
      systemKls.iterate(new DefaultOopVisitor() {
                                ObjectReader objReader = new ObjectReader();
                                public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) {
                                   if (field.getID().getName().equals("props")) {
                                      try {
-                                        sysProps = (Properties) objReader.readObject(field.getValue(getObj()));
+                                        sysProps = (Properties) objReader.readObject(field.getValue(systemKls.getJavaMirror()));
                                      } catch (Exception e) {
                                         if (Assert.ASSERTS_ENABLED) {
                                            e.printStackTrace();
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -746,7 +746,7 @@
             out.writeByte((byte)kind);
             if (ik != null) {
                 // static field
-                writeField(field, ik);
+                writeField(field, ik.getJavaMirror());
             }
         }
     }
--- a/hotspot/agent/test/jdi/sasanity.sh	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/agent/test/jdi/sasanity.sh	Thu Mar 31 22:07:32 2011 -0700
@@ -43,6 +43,7 @@
 fi
 
 jdk=$1
+shift
 OS=`uname`
 
 if [ "$OS" != "Linux" ]; then
@@ -68,7 +69,7 @@
 
 tmp=/tmp/sagsetup
 rm -f $tmp
-$jdk/bin/java sagtarg > $tmp &
+$jdk/bin/java $* sagtarg > $tmp &
 pid=$!
 while [ ! -s $tmp ] ; do
   # Kludge alert!
--- a/hotspot/make/hotspot_version	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/make/hotspot_version	Thu Mar 31 22:07:32 2011 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=04
+HS_BUILD_NUMBER=06
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3179,7 +3179,7 @@
                                               Label& wrong_method_type) {
   assert_different_registers(mtype_reg, mh_reg, temp_reg);
   // compare method type against that of the receiver
-  RegisterOrConstant mhtype_offset = delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg);
+  RegisterOrConstant mhtype_offset = delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg);
   load_heap_oop(mh_reg, mhtype_offset, temp_reg);
   cmp(temp_reg, mtype_reg);
   br(Assembler::notEqual, false, Assembler::pn, wrong_method_type);
@@ -3195,14 +3195,14 @@
                                                 Register temp_reg) {
   assert_different_registers(vmslots_reg, mh_reg, temp_reg);
   // load mh.type.form.vmslots
-  if (java_dyn_MethodHandle::vmslots_offset_in_bytes() != 0) {
+  if (java_lang_invoke_MethodHandle::vmslots_offset_in_bytes() != 0) {
     // hoist vmslots into every mh to avoid dependent load chain
-    ld(           Address(mh_reg,    delayed_value(java_dyn_MethodHandle::vmslots_offset_in_bytes, temp_reg)),   vmslots_reg);
+    ld(           Address(mh_reg,    delayed_value(java_lang_invoke_MethodHandle::vmslots_offset_in_bytes, temp_reg)),   vmslots_reg);
   } else {
     Register temp2_reg = vmslots_reg;
-    load_heap_oop(Address(mh_reg,    delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg)),      temp2_reg);
-    load_heap_oop(Address(temp2_reg, delayed_value(java_dyn_MethodType::form_offset_in_bytes, temp_reg)),        temp2_reg);
-    ld(           Address(temp2_reg, delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, temp_reg)), vmslots_reg);
+    load_heap_oop(Address(mh_reg,    delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg)),      temp2_reg);
+    load_heap_oop(Address(temp2_reg, delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, temp_reg)),        temp2_reg);
+    ld(           Address(temp2_reg, delayed_value(java_lang_invoke_MethodTypeForm::vmslots_offset_in_bytes, temp_reg)), vmslots_reg);
   }
 }
 
@@ -3213,7 +3213,7 @@
 
   // pick out the interpreted side of the handler
   // NOTE: vmentry is not an oop!
-  ld_ptr(mh_reg, delayed_value(java_dyn_MethodHandle::vmentry_offset_in_bytes, temp_reg), temp_reg);
+  ld_ptr(mh_reg, delayed_value(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes, temp_reg), temp_reg);
 
   // off we go...
   ld_ptr(temp_reg, MethodHandleEntry::from_interpreted_entry_offset_in_bytes(), temp_reg);
--- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -301,7 +301,8 @@
     // thread.
     assert(_obj != noreg, "must be a valid register");
     assert(_oop_index >= 0, "must have oop index");
-    __ ld_ptr(_obj, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3);
+    __ load_heap_oop(_obj, java_lang_Class::klass_offset_in_bytes(), G3);
+    __ ld_ptr(G3, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3);
     __ cmp(G2_thread, G3);
     __ br(Assembler::notEqual, false, Assembler::pn, call_patch);
     __ delayed()->nop();
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
@@ -1188,7 +1188,7 @@
   __ st_ptr(O2, XXX_STATE(_stack));                // PREPUSH
 
   __ lduh(max_stack, O3);                      // Full size expression stack
-  guarantee(!EnableMethodHandles, "no support yet for java.dyn.MethodHandle"); //6815692
+  guarantee(!EnableMethodHandles, "no support yet for java.lang.invoke.MethodHandle"); //6815692
   //6815692//if (EnableMethodHandles)
   //6815692//  __ inc(O3, methodOopDesc::extra_stack_entries());
   __ sll(O3, LogBytesPerWord, O3);
--- a/hotspot/src/cpu/sparc/vm/dump_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/dump_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -80,13 +80,19 @@
     for (int j = 0; j < num_virtuals; ++j) {
       dummy_vtable[num_virtuals * i + j] = (void*)masm->pc();
       __ save(SP, -256, SP);
+      int offset = (i << 8) + j;
+      Register src = G0;
+      if (!Assembler::is_simm13(offset)) {
+        __ sethi(offset, L0);
+        src = L0;
+        offset = offset & ((1 << 10) - 1);
+      }
       __ brx(Assembler::always, false, Assembler::pt, common_code);
 
       // Load L0 with a value indicating vtable/offset pair.
       // -- bits[ 7..0]  (8 bits) which virtual method in table?
-      // -- bits[12..8]  (5 bits) which virtual method table?
-      // -- must fit in 13-bit instruction immediate field.
-      __ delayed()->set((i << 8) + j, L0);
+      // -- bits[13..8]  (6 bits) which virtual method table?
+      __ delayed()->or3(src, offset, L0);
     }
   }
 
--- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -51,6 +51,7 @@
 define_pd_global(intx, OptoLoopAlignment,     16);  // = 4*wordSize
 define_pd_global(intx, InlineFrequencyCount,  50);  // we can use more inlining on the SPARC
 define_pd_global(intx, InlineSmallCode,       1500);
+
 #ifdef _LP64
 // Stack slots are 2X larger in LP64 than in the 32 bit VM.
 define_pd_global(intx, ThreadStackSize,       1024);
@@ -71,4 +72,6 @@
 
 define_pd_global(bool, UseMembar,            false);
 
+// GC Ergo Flags
+define_pd_global(intx, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
 #endif // CPU_SPARC_VM_GLOBALS_SPARC_HPP
--- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -260,7 +260,7 @@
 
 
 // Method handle invoker
-// Dispatch a method of the form java.dyn.MethodHandles::invoke(...)
+// Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
 address InterpreterGenerator::generate_method_handle_entry(void) {
   if (!EnableMethodHandles) {
     return generate_abstract_entry();
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -112,8 +112,8 @@
   }
 
   // given the MethodType, find out where the MH argument is buried
-  __ load_heap_oop(Address(O0_mtype,   __ delayed_value(java_dyn_MethodType::form_offset_in_bytes,        O1_scratch)), O4_argslot);
-  __ ldsw(         Address(O4_argslot, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O4_argslot);
+  __ load_heap_oop(Address(O0_mtype,   __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes,        O1_scratch)), O4_argslot);
+  __ ldsw(         Address(O4_argslot, __ delayed_value(java_lang_invoke_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O4_argslot);
   __ add(Gargs, __ argument_offset(O4_argslot, 1), O4_argbase);
   // Note: argument_address uses its input as a scratch register!
   __ ld_ptr(Address(O4_argbase, -Interpreter::stackElementSize), G3_method_handle);
@@ -141,10 +141,10 @@
   // load up an adapter from the calling type (Java weaves this)
   Register O2_form    = O2_scratch;
   Register O3_adapter = O3_scratch;
-  __ load_heap_oop(Address(O0_mtype, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes,               O1_scratch)), O2_form);
-  // load_heap_oop(Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
+  __ load_heap_oop(Address(O0_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes,               O1_scratch)), O2_form);
+  // load_heap_oop(Address(O2_form,  __ delayed_value(java_lang_invoke_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
   // deal with old JDK versions:
-  __ add(          Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
+  __ add(          Address(O2_form,  __ delayed_value(java_lang_invoke_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
   __ cmp(O3_adapter, O2_form);
   Label sorry_no_invoke_generic;
   __ brx(Assembler::lessUnsigned, false, Assembler::pn, sorry_no_invoke_generic);
@@ -376,16 +376,16 @@
 
 // which conversion op types are implemented here?
 int MethodHandles::adapter_conversion_ops_supported_mask() {
-  return ((1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_CHECK_CAST)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_ROT_ARGS)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_DUP_ARGS)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_DROP_ARGS)
-         //|(1<<sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
+  return ((1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
+         //|(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
          );
   // FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
 }
@@ -413,22 +413,22 @@
   const Register O1_actual   = O1;
   const Register O2_required = O2;
 
-  guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
+  guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
 
   // Some handy addresses:
   Address G5_method_fie(    G5_method,        in_bytes(methodOopDesc::from_interpreted_offset()));
   Address G5_method_fce(    G5_method,        in_bytes(methodOopDesc::from_compiled_offset()));
 
-  Address G3_mh_vmtarget(   G3_method_handle, java_dyn_MethodHandle::vmtarget_offset_in_bytes());
+  Address G3_mh_vmtarget(   G3_method_handle, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes());
 
-  Address G3_dmh_vmindex(   G3_method_handle, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes());
+  Address G3_dmh_vmindex(   G3_method_handle, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes());
 
-  Address G3_bmh_vmargslot( G3_method_handle, sun_dyn_BoundMethodHandle::vmargslot_offset_in_bytes());
-  Address G3_bmh_argument(  G3_method_handle, sun_dyn_BoundMethodHandle::argument_offset_in_bytes());
+  Address G3_bmh_vmargslot( G3_method_handle, java_lang_invoke_BoundMethodHandle::vmargslot_offset_in_bytes());
+  Address G3_bmh_argument(  G3_method_handle, java_lang_invoke_BoundMethodHandle::argument_offset_in_bytes());
 
-  Address G3_amh_vmargslot( G3_method_handle, sun_dyn_AdapterMethodHandle::vmargslot_offset_in_bytes());
-  Address G3_amh_argument ( G3_method_handle, sun_dyn_AdapterMethodHandle::argument_offset_in_bytes());
-  Address G3_amh_conversion(G3_method_handle, sun_dyn_AdapterMethodHandle::conversion_offset_in_bytes());
+  Address G3_amh_vmargslot( G3_method_handle, java_lang_invoke_AdapterMethodHandle::vmargslot_offset_in_bytes());
+  Address G3_amh_argument ( G3_method_handle, java_lang_invoke_AdapterMethodHandle::argument_offset_in_bytes());
+  Address G3_amh_conversion(G3_method_handle, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes());
 
   const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes();
 
@@ -453,7 +453,7 @@
       __ mov(O5_savedSP, SP);  // Cut the stack back to where the caller started.
 
       Label L_no_method;
-      // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
+      // FIXME: fill in _raise_exception_method with a suitable java.lang.invoke method
       __ set(AddressLiteral((address) &_raise_exception_method), G5_method);
       __ ld_ptr(Address(G5_method, 0), G5_method);
       __ tst(G5_method);
@@ -775,9 +775,13 @@
       switch (ek) {
       case _adapter_opt_i2l:
         {
-          __ ldsw(arg_lsw, O2_scratch);                           // Load LSW
-          NOT_LP64(__ srlx(O2_scratch, BitsPerInt, O3_scratch));  // Move high bits to lower bits for std
-          __ st_long(O2_scratch, arg_msw);                        // Uses O2/O3 on !_LP64
+#ifdef _LP64
+          __ ldsw(arg_lsw, O2_scratch);                 // Load LSW sign-extended
+#else
+          __ ldsw(arg_lsw, O3_scratch);                 // Load LSW sign-extended
+          __ srlx(O3_scratch, BitsPerInt, O2_scratch);  // Move MSW value to lower 32-bits for std
+#endif
+          __ st_long(O2_scratch, arg_msw);              // Uses O2/O3 on !_LP64
         }
         break;
       case _adapter_opt_unboxl:
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -52,6 +52,22 @@
   ICache::invalidate_range(instaddr, 7 * BytesPerInstWord);
 }
 
+void NativeInstruction::verify_data64_sethi(address instaddr, intptr_t x) {
+  ResourceMark rm;
+  unsigned char buffer[10 * BytesPerInstWord];
+  CodeBuffer buf(buffer, 10 * BytesPerInstWord);
+  MacroAssembler masm(&buf);
+
+  Register destreg = inv_rd(*(unsigned int *)instaddr);
+  // Generate the proper sequence into a temporary buffer and compare
+  // it with the original sequence.
+  masm.patchable_sethi(x, destreg);
+  int len = buffer - masm.pc();
+  for (int i = 0; i < len; i++) {
+    assert(instaddr[i] == buffer[i], "instructions must match");
+  }
+}
+
 void NativeInstruction::verify() {
   // make sure code pattern is actually an instruction address
   address addr = addr_at(0);
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -254,6 +254,7 @@
   // sethi.  This only does the sethi.  The disp field (bottom 10 bits)
   // must be handled separately.
   static void set_data64_sethi(address instaddr, intptr_t x);
+  static void verify_data64_sethi(address instaddr, intptr_t x);
 
   // combine the fields of a sethi/simm13 pair (simm13 = or, add, jmpl, ld/st)
   static int data32(int sethi_insn, int arith_insn) {
--- a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -30,7 +30,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/safepoint.hpp"
 
-void Relocation::pd_set_data_value(address x, intptr_t o) {
+void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
   NativeInstruction* ip = nativeInstruction_at(addr());
   jint inst = ip->long_at(0);
   assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint");
@@ -83,7 +83,11 @@
     guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13");
     inst &= ~Assembler::simm(    -1, 13);
     inst |=  Assembler::simm(simm13, 13);
-    ip->set_long_at(0, inst);
+    if (verify_only) {
+      assert(ip->long_at(0) == inst, "instructions must match");
+    } else {
+      ip->set_long_at(0, inst);
+    }
     }
     break;
 
@@ -97,19 +101,36 @@
       jint np = oopDesc::encode_heap_oop((oop)x);
       inst &= ~Assembler::hi22(-1);
       inst |=  Assembler::hi22((intptr_t)np);
-      ip->set_long_at(0, inst);
+      if (verify_only) {
+        assert(ip->long_at(0) == inst, "instructions must match");
+      } else {
+        ip->set_long_at(0, inst);
+      }
       inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
       guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
-      ip->set_long_at(NativeInstruction::nop_instruction_size, ip->set_data32_simm13( inst2, (intptr_t)np));
+      if (verify_only) {
+        assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
+               "instructions must match");
+      } else {
+        ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
+      }
       break;
     }
-    ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x );
+    if (verify_only) {
+      ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x );
+    } else {
+      ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x );
+    }
 #else
     guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
     inst &= ~Assembler::hi22(     -1);
     inst |=  Assembler::hi22((intptr_t)x);
     // (ignore offset; it doesn't play into the sethi)
-    ip->set_long_at(0, inst);
+    if (verify_only) {
+      assert(ip->long_at(0) == inst, "instructions must match");
+    } else {
+      ip->set_long_at(0, inst);
+    }
 #endif
     }
     break;
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3303,7 +3303,7 @@
   __ sll(Rret, LogBytesPerWord, Rret);
   __ ld_ptr(Rtemp, Rret, Rret);  // get return address
 
-  __ load_heap_oop(G5_callsite, __ delayed_value(java_dyn_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle);
+  __ load_heap_oop(G5_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle);
   __ null_check(G3_method_handle);
 
   // Adjust Rret first so Llast_SP can be same as Rret
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -7831,7 +7831,7 @@
 void MacroAssembler::check_method_handle_type(Register mtype_reg, Register mh_reg,
                                               Register temp_reg,
                                               Label& wrong_method_type) {
-  Address type_addr(mh_reg, delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg));
+  Address type_addr(mh_reg, delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg));
   // compare method type against that of the receiver
   if (UseCompressedOops) {
     load_heap_oop(temp_reg, type_addr);
@@ -7851,14 +7851,14 @@
                                                 Register temp_reg) {
   assert_different_registers(vmslots_reg, mh_reg, temp_reg);
   // load mh.type.form.vmslots
-  if (java_dyn_MethodHandle::vmslots_offset_in_bytes() != 0) {
+  if (java_lang_invoke_MethodHandle::vmslots_offset_in_bytes() != 0) {
     // hoist vmslots into every mh to avoid dependent load chain
-    movl(vmslots_reg, Address(mh_reg, delayed_value(java_dyn_MethodHandle::vmslots_offset_in_bytes, temp_reg)));
+    movl(vmslots_reg, Address(mh_reg, delayed_value(java_lang_invoke_MethodHandle::vmslots_offset_in_bytes, temp_reg)));
   } else {
     Register temp2_reg = vmslots_reg;
-    load_heap_oop(temp2_reg, Address(mh_reg,    delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg)));
-    load_heap_oop(temp2_reg, Address(temp2_reg, delayed_value(java_dyn_MethodType::form_offset_in_bytes, temp_reg)));
-    movl(vmslots_reg, Address(temp2_reg, delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, temp_reg)));
+    load_heap_oop(temp2_reg, Address(mh_reg,    delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg)));
+    load_heap_oop(temp2_reg, Address(temp2_reg, delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, temp_reg)));
+    movl(vmslots_reg, Address(temp2_reg, delayed_value(java_lang_invoke_MethodTypeForm::vmslots_offset_in_bytes, temp_reg)));
   }
 }
 
@@ -7873,7 +7873,7 @@
 
   // pick out the interpreted side of the handler
   // NOTE: vmentry is not an oop!
-  movptr(temp_reg, Address(mh_reg, delayed_value(java_dyn_MethodHandle::vmentry_offset_in_bytes, temp_reg)));
+  movptr(temp_reg, Address(mh_reg, delayed_value(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes, temp_reg)));
 
   // off we go...
   jmp(Address(temp_reg, MethodHandleEntry::from_interpreted_entry_offset_in_bytes()));
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -313,10 +313,13 @@
     }
     assert(_obj != noreg, "must be a valid register");
     Register tmp = rax;
-    if (_obj == tmp) tmp = rbx;
+    Register tmp2 = rbx;
     __ push(tmp);
+    __ push(tmp2);
+    __ load_heap_oop(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
     __ get_thread(tmp);
-    __ cmpptr(tmp, Address(_obj, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc)));
+    __ cmpptr(tmp, Address(tmp2, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc)));
+    __ pop(tmp2);
     __ pop(tmp);
     __ jcc(Assembler::notEqual, call_patch);
 
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -72,4 +72,6 @@
 
 define_pd_global(bool, UseMembar,            false);
 
+// GC Ergo Flags
+define_pd_global(intx, CMSYoungGenPerWorker, 64*M);  // default max size of CMS young gen, per GC worker thread
 #endif // CPU_X86_VM_GLOBALS_X86_HPP
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -231,7 +231,7 @@
 
 
 // Method handle invoker
-// Dispatch a method of the form java.dyn.MethodHandles::invoke(...)
+// Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
 address InterpreterGenerator::generate_method_handle_entry(void) {
   if (!EnableMethodHandles) {
     return generate_abstract_entry();
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -318,7 +318,7 @@
 
 
 // Method handle invoker
-// Dispatch a method of the form java.dyn.MethodHandles::invoke(...)
+// Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
 address InterpreterGenerator::generate_method_handle_entry(void) {
   if (!EnableMethodHandles) {
     return generate_abstract_entry();
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -125,9 +125,9 @@
   }
 
   // given the MethodType, find out where the MH argument is buried
-  __ load_heap_oop(rdx_temp, Address(rax_mtype, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, rdi_temp)));
+  __ load_heap_oop(rdx_temp, Address(rax_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, rdi_temp)));
   Register rdx_vmslots = rdx_temp;
-  __ movl(rdx_vmslots, Address(rdx_temp, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, rdi_temp)));
+  __ movl(rdx_vmslots, Address(rdx_temp, __ delayed_value(java_lang_invoke_MethodTypeForm::vmslots_offset_in_bytes, rdi_temp)));
   __ movptr(rcx_recv, __ argument_address(rdx_vmslots));
 
   trace_method_handle(_masm, "invokeExact");
@@ -154,11 +154,11 @@
                    rcx_argslot, rbx_temp, rdx_temp);
 
   // load up an adapter from the calling type (Java weaves this)
-  __ load_heap_oop(rdx_temp, Address(rax_mtype, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, rdi_temp)));
+  __ load_heap_oop(rdx_temp, Address(rax_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, rdi_temp)));
   Register rdx_adapter = rdx_temp;
-  // __ load_heap_oop(rdx_adapter, Address(rdx_temp, java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes()));
+  // __ load_heap_oop(rdx_adapter, Address(rdx_temp, java_lang_invoke_MethodTypeForm::genericInvoker_offset_in_bytes()));
   // deal with old JDK versions:
-  __ lea(rdi_temp, Address(rdx_temp, __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, rdi_temp)));
+  __ lea(rdi_temp, Address(rdx_temp, __ delayed_value(java_lang_invoke_MethodTypeForm::genericInvoker_offset_in_bytes, rdi_temp)));
   __ cmpptr(rdi_temp, rdx_temp);
   Label sorry_no_invoke_generic;
   __ jcc(Assembler::below, sorry_no_invoke_generic);
@@ -371,16 +371,16 @@
 
 // which conversion op types are implemented here?
 int MethodHandles::adapter_conversion_ops_supported_mask() {
-  return ((1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_CHECK_CAST)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_ROT_ARGS)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_DUP_ARGS)
-         |(1<<sun_dyn_AdapterMethodHandle::OP_DROP_ARGS)
-         //|(1<<sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
+  return ((1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
+         //|(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
          );
   // FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
 }
@@ -415,21 +415,21 @@
   const Register rarg2_required = LP64_ONLY(j_rarg2) NOT_LP64(rdi);
   assert_different_registers(rarg0_code, rarg1_actual, rarg2_required, saved_last_sp);
 
-  guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
+  guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
 
   // some handy addresses
   Address rbx_method_fie(     rbx,      methodOopDesc::from_interpreted_offset() );
   Address rbx_method_fce(     rbx,      methodOopDesc::from_compiled_offset() );
 
-  Address rcx_mh_vmtarget(    rcx_recv, java_dyn_MethodHandle::vmtarget_offset_in_bytes() );
-  Address rcx_dmh_vmindex(    rcx_recv, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes() );
+  Address rcx_mh_vmtarget(    rcx_recv, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes() );
+  Address rcx_dmh_vmindex(    rcx_recv, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes() );
 
-  Address rcx_bmh_vmargslot(  rcx_recv, sun_dyn_BoundMethodHandle::vmargslot_offset_in_bytes() );
-  Address rcx_bmh_argument(   rcx_recv, sun_dyn_BoundMethodHandle::argument_offset_in_bytes() );
+  Address rcx_bmh_vmargslot(  rcx_recv, java_lang_invoke_BoundMethodHandle::vmargslot_offset_in_bytes() );
+  Address rcx_bmh_argument(   rcx_recv, java_lang_invoke_BoundMethodHandle::argument_offset_in_bytes() );
 
-  Address rcx_amh_vmargslot(  rcx_recv, sun_dyn_AdapterMethodHandle::vmargslot_offset_in_bytes() );
-  Address rcx_amh_argument(   rcx_recv, sun_dyn_AdapterMethodHandle::argument_offset_in_bytes() );
-  Address rcx_amh_conversion( rcx_recv, sun_dyn_AdapterMethodHandle::conversion_offset_in_bytes() );
+  Address rcx_amh_vmargslot(  rcx_recv, java_lang_invoke_AdapterMethodHandle::vmargslot_offset_in_bytes() );
+  Address rcx_amh_argument(   rcx_recv, java_lang_invoke_AdapterMethodHandle::argument_offset_in_bytes() );
+  Address rcx_amh_conversion( rcx_recv, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes() );
   Address vmarg;                // __ argument_address(vmargslot)
 
   const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes();
@@ -460,7 +460,7 @@
 
       Register rbx_method = rbx_temp;
       Label L_no_method;
-      // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
+      // FIXME: fill in _raise_exception_method with a suitable java.lang.invoke method
       __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method));
       __ testptr(rbx_method, rbx_method);
       __ jccb(Assembler::zero, L_no_method);
--- a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -31,7 +31,7 @@
 #include "runtime/safepoint.hpp"
 
 
-void Relocation::pd_set_data_value(address x, intptr_t o) {
+void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
 #ifdef AMD64
   x += o;
   typedef Assembler::WhichOperand WhichOperand;
@@ -40,19 +40,35 @@
          which == Assembler::narrow_oop_operand ||
          which == Assembler::imm_operand, "format unpacks ok");
   if (which == Assembler::imm_operand) {
-    *pd_address_in_code() = x;
+    if (verify_only) {
+      assert(*pd_address_in_code() == x, "instructions must match");
+    } else {
+      *pd_address_in_code() = x;
+    }
   } else if (which == Assembler::narrow_oop_operand) {
     address disp = Assembler::locate_operand(addr(), which);
-    *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
+    if (verify_only) {
+      assert(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match");
+    } else {
+      *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
+    }
   } else {
     // Note:  Use runtime_call_type relocations for call32_operand.
     address ip = addr();
     address disp = Assembler::locate_operand(ip, which);
     address next_ip = Assembler::locate_next_instruction(ip);
-    *(int32_t*) disp = x - next_ip;
+    if (verify_only) {
+      assert(*(int32_t*) disp == (x - next_ip), "instructions must match");
+    } else {
+      *(int32_t*) disp = x - next_ip;
+    }
   }
 #else
-  *pd_address_in_code() = x + o;
+  if (verify_only) {
+    assert(*pd_address_in_code() == (x + o), "instructions must match");
+  } else {
+    *pd_address_in_code() = x + o;
+  }
 #endif // AMD64
 }
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3110,7 +3110,7 @@
     __ profile_call(rsi);
   }
 
-  __ movptr(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_dyn_CallSite::target_offset_in_bytes, rcx)));
+  __ movptr(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx)));
   __ null_check(rcx_method_handle);
   __ prepare_to_jump_from_interpreted();
   __ jump_to_method_handle_entry(rcx_method_handle, rdx);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3145,7 +3145,7 @@
     __ profile_call(r13);
   }
 
-  __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_dyn_CallSite::target_offset_in_bytes, rcx)));
+  __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx)));
   __ null_check(rcx_method_handle);
   __ prepare_to_jump_from_interpreted();
   __ jump_to_method_handle_entry(rcx_method_handle, rdx);
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -436,6 +436,13 @@
         UseCountLeadingZerosInstruction = true;
       }
     }
+
+    // On family 21 processors default is no sw prefetch
+    if ( cpu_family() == 21 ) {
+      if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
+        AllocatePrefetchStyle = 0;
+      }
+    }
   }
 
   if( is_intel() ) { // Intel cpus specific settings
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -281,7 +281,7 @@
 
     if (method->is_static()) {
       istate->set_oop_temp(
-        method->constants()->pool_holder()->klass_part()->java_mirror());
+        method->constants()->pool_holder()->java_mirror());
       mirror = istate->oop_temp_addr();
       *(dst++) = &mirror;
     }
@@ -667,7 +667,7 @@
       (BasicObjectLock *) stack->alloc(monitor_words * wordSize);
     oop object;
     if (method->is_static())
-      object = method->constants()->pool_holder()->klass_part()->java_mirror();
+      object = method->constants()->pool_holder()->java_mirror();
     else
       object = (oop) locals[0];
     monitor->set_obj(object);
--- a/hotspot/src/os/solaris/dtrace/libjvm_db.c	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c	Thu Mar 31 22:07:32 2011 -0700
@@ -524,6 +524,8 @@
   CHECK_FAIL(err);
   err = read_pointer(J, constantPool + nameIndex * POINTER_SIZE + SIZE_constantPoolOopDesc, &nameSymbol);
   CHECK_FAIL(err);
+  // The symbol is a CPSlot and has lower bit set to indicate metadata
+  nameSymbol &= (~1); // remove metadata lsb
   err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_length, &nameSymbolLength, 2);
   CHECK_FAIL(err);
   nameString = (char*)calloc(nameSymbolLength + 1, 1);
@@ -535,6 +537,7 @@
   CHECK_FAIL(err);
   err = read_pointer(J, constantPool + signatureIndex * POINTER_SIZE + SIZE_constantPoolOopDesc, &signatureSymbol);
   CHECK_FAIL(err);
+  signatureSymbol &= (~1);  // remove metadata lsb
   err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_length, &signatureSymbolLength, 2);
   CHECK_FAIL(err);
   signatureString = (char*)calloc(signatureSymbolLength + 1, 1);
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3297,9 +3297,14 @@
          "possibility of dangling Thread pointer");
 
   OSThread* osthread = thread->osthread();
-  bool interrupted;
-  interrupted = osthread->interrupted();
-  if (clear_interrupted == true) {
+  bool interrupted = osthread->interrupted();
+  // There is no synchronization between the setting of the interrupt
+  // and it being cleared here. It is critical - see 6535709 - that
+  // we only clear the interrupt state, and reset the interrupt event,
+  // if we are going to report that we were indeed interrupted - else
+  // an interrupt can be "lost", leading to spurious wakeups or lost wakeups
+  // depending on the timing
+  if (interrupted && clear_interrupted) {
     osthread->set_interrupted(false);
     ResetEvent(osthread->interrupt_event());
   } // Otherwise leave the interrupted state alone
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -209,7 +209,7 @@
     // limit this optimization to current block
     if (value != NULL && in_current_block(conv)) {
       set_canonical(new StoreField(x->obj(), x->offset(), x->field(), value, x->is_static(),
-                                       x->state_before(), x->is_loaded(), x->is_initialized()));
+                                   x->state_before(), x->needs_patching()));
       return;
     }
   }
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1456,12 +1456,12 @@
   BasicType field_type = field->type()->basic_type();
   ValueType* type = as_ValueType(field_type);
   // call will_link again to determine if the field is valid.
-  const bool is_loaded = holder->is_loaded() &&
-                         field->will_link(method()->holder(), code);
-  const bool is_initialized = is_loaded && holder->is_initialized();
+  const bool needs_patching = !holder->is_loaded() ||
+                              !field->will_link(method()->holder(), code) ||
+                              PatchALot;
 
   ValueStack* state_before = NULL;
-  if (!is_initialized || PatchALot) {
+  if (!holder->is_initialized() || needs_patching) {
     // save state before instruction for debug info when
     // deoptimization happens during patching
     state_before = copy_state_before();
@@ -1469,20 +1469,16 @@
 
   Value obj = NULL;
   if (code == Bytecodes::_getstatic || code == Bytecodes::_putstatic) {
-    // commoning of class constants should only occur if the class is
-    // fully initialized and resolved in this constant pool.  The will_link test
-    // above essentially checks if this class is resolved in this constant pool
-    // so, the is_initialized flag should be suffiect.
     if (state_before != NULL) {
       // build a patching constant
-      obj = new Constant(new ClassConstant(holder), state_before);
+      obj = new Constant(new InstanceConstant(holder->java_mirror()), state_before);
     } else {
-      obj = new Constant(new ClassConstant(holder));
+      obj = new Constant(new InstanceConstant(holder->java_mirror()));
     }
   }
 
 
-  const int offset = is_loaded ? field->offset() : -1;
+  const int offset = !needs_patching ? field->offset() : -1;
   switch (code) {
     case Bytecodes::_getstatic: {
       // check for compile-time constants, i.e., initialized static final fields
@@ -1509,7 +1505,7 @@
           state_before = copy_state_for_exception();
         }
         push(type, append(new LoadField(append(obj), offset, field, true,
-                                        state_before, is_loaded, is_initialized)));
+                                        state_before, needs_patching)));
       }
       break;
     }
@@ -1518,7 +1514,7 @@
         if (state_before == NULL) {
           state_before = copy_state_for_exception();
         }
-        append(new StoreField(append(obj), offset, field, val, true, state_before, is_loaded, is_initialized));
+        append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
       }
       break;
     case Bytecodes::_getfield :
@@ -1526,8 +1522,8 @@
         if (state_before == NULL) {
           state_before = copy_state_for_exception();
         }
-        LoadField* load = new LoadField(apop(), offset, field, false, state_before, is_loaded, true);
-        Value replacement = is_loaded ? _memory->load(load) : load;
+        LoadField* load = new LoadField(apop(), offset, field, false, state_before, needs_patching);
+        Value replacement = !needs_patching ? _memory->load(load) : load;
         if (replacement != load) {
           assert(replacement->is_linked() || !replacement->can_be_linked(), "should already by linked");
           push(type, replacement);
@@ -1542,8 +1538,8 @@
         if (state_before == NULL) {
           state_before = copy_state_for_exception();
         }
-        StoreField* store = new StoreField(apop(), offset, field, val, false, state_before, is_loaded, true);
-        if (is_loaded) store = _memory->store(store);
+        StoreField* store = new StoreField(apop(), offset, field, val, false, state_before, needs_patching);
+        if (!needs_patching) store = _memory->store(store);
         if (store != NULL) {
           append(store);
         }
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -323,8 +323,6 @@
     CanTrapFlag,
     DirectCompareFlag,
     IsEliminatedFlag,
-    IsInitializedFlag,
-    IsLoadedFlag,
     IsSafepointFlag,
     IsStaticFlag,
     IsStrictfpFlag,
@@ -693,7 +691,7 @@
  public:
   // creation
   AccessField(Value obj, int offset, ciField* field, bool is_static,
-              ValueStack* state_before, bool is_loaded, bool is_initialized)
+              ValueStack* state_before, bool needs_patching)
   : Instruction(as_ValueType(field->type()->basic_type()), state_before)
   , _obj(obj)
   , _offset(offset)
@@ -701,16 +699,9 @@
   , _explicit_null_check(NULL)
   {
     set_needs_null_check(!is_static);
-    set_flag(IsLoadedFlag, is_loaded);
-    set_flag(IsInitializedFlag, is_initialized);
     set_flag(IsStaticFlag, is_static);
+    set_flag(NeedsPatchingFlag, needs_patching);
     ASSERT_VALUES
-      if (!is_loaded || (PatchALot && !field->is_volatile())) {
-      // need to patch if the holder wasn't loaded or we're testing
-      // using PatchALot.  Don't allow PatchALot for fields which are
-      // known to be volatile they aren't patchable.
-      set_flag(NeedsPatchingFlag, true);
-    }
     // pin of all instructions with memory access
     pin();
   }
@@ -721,11 +712,14 @@
   ciField* field() const                         { return _field; }
   BasicType field_type() const                   { return _field->type()->basic_type(); }
   bool is_static() const                         { return check_flag(IsStaticFlag); }
-  bool is_loaded() const                         { return check_flag(IsLoadedFlag); }
-  bool is_initialized() const                    { return check_flag(IsInitializedFlag); }
   NullCheck* explicit_null_check() const         { return _explicit_null_check; }
   bool needs_patching() const                    { return check_flag(NeedsPatchingFlag); }
 
+  // Unresolved getstatic and putstatic can cause initialization.
+  // Technically it occurs at the Constant that materializes the base
+  // of the static fields but it's simpler to model it here.
+  bool is_init_point() const                     { return is_static() && (needs_patching() || !_field->holder()->is_initialized()); }
+
   // manipulation
 
   // Under certain circumstances, if a previous NullCheck instruction
@@ -745,15 +739,15 @@
  public:
   // creation
   LoadField(Value obj, int offset, ciField* field, bool is_static,
-            ValueStack* state_before, bool is_loaded, bool is_initialized)
-  : AccessField(obj, offset, field, is_static, state_before, is_loaded, is_initialized)
+            ValueStack* state_before, bool needs_patching)
+  : AccessField(obj, offset, field, is_static, state_before, needs_patching)
   {}
 
   ciType* declared_type() const;
   ciType* exact_type() const;
 
   // generic
-  HASHING2(LoadField, is_loaded() && !field()->is_volatile(), obj()->subst(), offset())  // cannot be eliminated if not yet loaded or if volatile
+  HASHING2(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset())  // cannot be eliminated if needs patching or if volatile
 };
 
 
@@ -764,8 +758,8 @@
  public:
   // creation
   StoreField(Value obj, int offset, ciField* field, Value value, bool is_static,
-             ValueStack* state_before, bool is_loaded, bool is_initialized)
-  : AccessField(obj, offset, field, is_static, state_before, is_loaded, is_initialized)
+             ValueStack* state_before, bool needs_patching)
+  : AccessField(obj, offset, field, is_static, state_before, needs_patching)
   , _value(value)
   {
     set_flag(NeedsWriteBarrierFlag, as_ValueType(field_type())->is_object());
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -1156,7 +1156,7 @@
     return
       is_invokedynamic()  // An invokedynamic is always a MethodHandle call site.
       ||
-      (method()->holder()->name() == ciSymbol::java_dyn_MethodHandle() &&
+      (method()->holder()->name() == ciSymbol::java_lang_invoke_MethodHandle() &&
        methodOopDesc::is_method_handle_invoke_name(method()->name()->sid()));
   }
 
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1559,9 +1559,7 @@
                 (info ? new CodeEmitInfo(info) : NULL));
   }
 
-  if (is_volatile) {
-    assert(!needs_patching && x->is_loaded(),
-           "how do we know it's volatile if it's not loaded");
+  if (is_volatile && !needs_patching) {
     volatile_field_store(value.result(), address, info);
   } else {
     LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
@@ -1627,9 +1625,7 @@
     address = generate_address(object.result(), x->offset(), field_type);
   }
 
-  if (is_volatile) {
-    assert(!needs_patching && x->is_loaded(),
-           "how do we know it's volatile if it's not loaded");
+  if (is_volatile && !needs_patching) {
     volatile_field_load(address, reg, info);
   } else {
     LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
@@ -2516,7 +2512,7 @@
       __ load(new LIR_Address(tmp, call_site_offset, T_OBJECT), tmp);
 
       // Load target MethodHandle from CallSite object.
-      __ load(new LIR_Address(tmp, java_dyn_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
+      __ load(new LIR_Address(tmp, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
 
       __ call_dynamic(target, receiver, result_register,
                       SharedRuntime::get_resolve_opt_virtual_call_stub(),
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -2703,7 +2703,7 @@
       assert(_fpu_stack_allocator != NULL, "must be present");
       opr = _fpu_stack_allocator->to_fpu_stack(opr);
 
-      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrHi is used)");
+      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrLo is used)");
 #endif
 #ifdef SPARC
       assert(opr->fpu_regnrLo() == opr->fpu_regnrHi() + 1, "assumed in calculation (only fpu_regnrHi is used)");
@@ -2715,7 +2715,12 @@
       assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrHi is used)");
 #endif
 
+#ifdef VM_LITTLE_ENDIAN
+      VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrLo());
+#else
       VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi());
+#endif
+
 #ifdef _LP64
       first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
       second = &_int_0_scope_value;
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -808,7 +808,7 @@
         { klassOop klass = resolve_field_return_klass(caller_method, bci, CHECK);
           // Save a reference to the class that has to be checked for initialization
           init_klass = KlassHandle(THREAD, klass);
-          k = klass;
+          k = klass->java_mirror();
         }
         break;
       case Bytecodes::_new:
--- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -141,7 +141,8 @@
 
   // visitor functions
   void do_StoreField     (StoreField*      x) {
-    if (!x->is_initialized()) {
+    if (x->is_init_point()) {
+      // putstatic is an initialization point so treat it as a wide kill
       kill_memory();
     } else {
       kill_field(x->field());
@@ -159,7 +160,8 @@
   void do_Local          (Local*           x) { /* nothing to do */ }
   void do_Constant       (Constant*        x) { /* nothing to do */ }
   void do_LoadField      (LoadField*       x) {
-    if (!x->is_initialized()) {
+    if (x->is_init_point()) {
+      // getstatic is an initialization point so treat it as a wide kill
       kill_memory();
     }
   }
--- a/hotspot/src/share/vm/ci/ciCPCache.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciCPCache.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
@@ -46,8 +46,7 @@
 // ciCPCache::is_f1_null_at
 bool ciCPCache::is_f1_null_at(int index) {
   VM_ENTRY_MARK;
-  oop f1 = entry_at(index)->f1();
-  return (f1 == NULL);
+  return entry_at(index)->is_f1_null();
 }
 
 
--- a/hotspot/src/share/vm/ci/ciCallSite.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciCallSite.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
 // Return the target MethodHandle of this CallSite.
 ciMethodHandle* ciCallSite::get_target() const {
   VM_ENTRY_MARK;
-  oop method_handle_oop = java_dyn_CallSite::target(get_oop());
+  oop method_handle_oop = java_lang_invoke_CallSite::target(get_oop());
   return CURRENT_ENV->get_object(method_handle_oop)->as_method_handle();
 }
 
--- a/hotspot/src/share/vm/ci/ciCallSite.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciCallSite.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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,7 +29,7 @@
 
 // ciCallSite
 //
-// The class represents a java.dyn.CallSite object.
+// The class represents a java.lang.invoke.CallSite object.
 class ciCallSite : public ciInstance {
 public:
   ciCallSite(instanceHandle h_i) : ciInstance(h_i) {}
--- a/hotspot/src/share/vm/ci/ciField.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciField.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -177,7 +177,7 @@
     // Never trust strangely unstable finals:  System.out, etc.
     return false;
   // Even if general trusting is disabled, trust system-built closures in these packages.
-  if (holder->is_in_package("java/dyn") || holder->is_in_package("sun/dyn"))
+  if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke"))
     return true;
   return TrustFinalNonStaticFields;
 }
@@ -191,8 +191,9 @@
   // Check to see if the field is constant.
   if (_holder->is_initialized() && this->is_final()) {
     if (!this->is_static()) {
-      // A field can be constant if it's a final static field or if it's
-      // a final non-static field of a trusted class ({java,sun}.dyn).
+      // A field can be constant if it's a final static field or if
+      // it's a final non-static field of a trusted class (classes in
+      // java.lang.invoke and sun.invoke packages and subpackages).
       if (trust_final_non_static_fields(_holder)) {
         _is_constant = true;
         return;
@@ -212,7 +213,7 @@
     //    may change.  The three examples are java.lang.System.in,
     //    java.lang.System.out, and java.lang.System.err.
 
-    Handle k = _holder->get_klassOop();
+    KlassHandle k = _holder->get_klassOop();
     assert( SystemDictionary::System_klass() != NULL, "Check once per vm");
     if( k() == SystemDictionary::System_klass() ) {
       // Check offsets for case 2: System.in, System.out, or System.err
@@ -224,36 +225,38 @@
       }
     }
 
+    Handle mirror = k->java_mirror();
+
     _is_constant = true;
     switch(type()->basic_type()) {
     case T_BYTE:
-      _constant_value = ciConstant(type()->basic_type(), k->byte_field(_offset));
+      _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset));
       break;
     case T_CHAR:
-      _constant_value = ciConstant(type()->basic_type(), k->char_field(_offset));
+      _constant_value = ciConstant(type()->basic_type(), mirror->char_field(_offset));
       break;
     case T_SHORT:
-      _constant_value = ciConstant(type()->basic_type(), k->short_field(_offset));
+      _constant_value = ciConstant(type()->basic_type(), mirror->short_field(_offset));
       break;
     case T_BOOLEAN:
-      _constant_value = ciConstant(type()->basic_type(), k->bool_field(_offset));
+      _constant_value = ciConstant(type()->basic_type(), mirror->bool_field(_offset));
       break;
     case T_INT:
-      _constant_value = ciConstant(type()->basic_type(), k->int_field(_offset));
+      _constant_value = ciConstant(type()->basic_type(), mirror->int_field(_offset));
       break;
     case T_FLOAT:
-      _constant_value = ciConstant(k->float_field(_offset));
+      _constant_value = ciConstant(mirror->float_field(_offset));
       break;
     case T_DOUBLE:
-      _constant_value = ciConstant(k->double_field(_offset));
+      _constant_value = ciConstant(mirror->double_field(_offset));
       break;
     case T_LONG:
-      _constant_value = ciConstant(k->long_field(_offset));
+      _constant_value = ciConstant(mirror->long_field(_offset));
       break;
     case T_OBJECT:
     case T_ARRAY:
       {
-        oop o = k->obj_field(_offset);
+        oop o = mirror->obj_field(_offset);
 
         // A field will be "constant" if it is known always to be
         // a non-null reference to an instance of a particular class,
--- a/hotspot/src/share/vm/ci/ciInstance.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciInstance.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -138,3 +138,9 @@
   st->print(" type=");
   klass()->print(st);
 }
+
+
+ciKlass* ciInstance::java_lang_Class_klass() {
+  VM_ENTRY_MARK;
+  return CURRENT_ENV->get_object(java_lang_Class::as_klassOop(get_oop()))->as_klass();
+}
--- a/hotspot/src/share/vm/ci/ciInstance.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciInstance.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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,6 +64,8 @@
 
   // Constant value of a field at the specified offset.
   ciConstant field_value_by_offset(int field_offset);
+
+  ciKlass* java_lang_Class_klass();
 };
 
 #endif // SHARE_VM_CI_CIINSTANCE_HPP
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -85,7 +85,6 @@
     if (h_k() != SystemDictionary::Object_klass()) {
       super();
     }
-    java_mirror();
     //compute_nonstatic_fields();  // done outside of constructor
   }
 
@@ -320,6 +319,9 @@
 // Get the instance of java.lang.Class corresponding to this klass.
 // Cache it on this->_java_mirror.
 ciInstance* ciInstanceKlass::java_mirror() {
+  if (is_shared()) {
+    return ciKlass::java_mirror();
+  }
   if (_java_mirror == NULL) {
     _java_mirror = ciKlass::java_mirror();
   }
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -769,7 +769,7 @@
 // signature-polymorphic MethodHandle methods, invokeExact or invokeGeneric.
 bool ciMethod::is_method_handle_invoke() const {
   if (!is_loaded()) {
-    bool flag = (holder()->name() == ciSymbol::java_dyn_MethodHandle() &&
+    bool flag = (holder()->name() == ciSymbol::java_lang_invoke_MethodHandle() &&
                  methodOopDesc::is_method_handle_invoke_name(name()->sid()));
     return flag;
   }
--- a/hotspot/src/share/vm/ci/ciMethodHandle.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciMethodHandle.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
@@ -30,7 +30,7 @@
 
 // ciMethodHandle
 //
-// The class represents a java.dyn.MethodHandle object.
+// The class represents a java.lang.invoke.MethodHandle object.
 class ciMethodHandle : public ciInstance {
 private:
   ciMethod* _callee;
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -342,9 +342,9 @@
     return new (arena()) ciMethodData(h_md);
   } else if (o->is_instance()) {
     instanceHandle h_i(THREAD, (instanceOop)o);
-    if (java_dyn_CallSite::is_instance(o))
+    if (java_lang_invoke_CallSite::is_instance(o))
       return new (arena()) ciCallSite(h_i);
-    else if (java_dyn_MethodHandle::is_instance(o))
+    else if (java_lang_invoke_MethodHandle::is_instance(o))
       return new (arena()) ciMethodHandle(h_i);
     else
       return new (arena()) ciInstance(h_i);
@@ -663,7 +663,7 @@
   if (key->is_perm() && _non_perm_count == 0) {
     return emptyBucket;
   } else if (key->is_instance()) {
-    if (key->klass() == SystemDictionary::Class_klass()) {
+    if (key->klass() == SystemDictionary::Class_klass() && JavaObjectsInPerm) {
       // class mirror instances are always perm
       return emptyBucket;
     }
--- a/hotspot/src/share/vm/ci/ciStreams.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciStreams.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -380,7 +380,7 @@
   bool ignore;
   // report as InvokeDynamic for invokedynamic, which is syntactically classless
   if (cur_bc() == Bytecodes::_invokedynamic)
-    return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_dyn_InvokeDynamic(), false);
+    return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_InvokeDynamic(), false);
   return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder);
 }
 
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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,7 @@
 #include "memory/universe.inline.hpp"
 #include "oops/constantPoolOop.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/klass.inline.hpp"
 #include "oops/klassOop.hpp"
 #include "oops/klassVtable.hpp"
@@ -146,12 +147,14 @@
         break;
       case JVM_CONSTANT_MethodHandle :
       case JVM_CONSTANT_MethodType :
-        if (!EnableMethodHandles ||
-            _major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
+        if (_major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
           classfile_parse_error(
-            (!EnableMethodHandles ?
-             "This JVM does not support constant tag %u in class file %s" :
-             "Class file version does not support constant tag %u in class file %s"),
+            "Class file version does not support constant tag %u in class file %s",
+            tag, CHECK);
+        }
+        if (!EnableMethodHandles) {
+          classfile_parse_error(
+            "This JVM does not support constant tag %u in class file %s",
             tag, CHECK);
         }
         if (tag == JVM_CONSTANT_MethodHandle) {
@@ -170,12 +173,14 @@
       case JVM_CONSTANT_InvokeDynamicTrans :  // this tag appears only in old classfiles
       case JVM_CONSTANT_InvokeDynamic :
         {
-          if (!EnableInvokeDynamic ||
-              _major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
+          if (_major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
             classfile_parse_error(
-              (!EnableInvokeDynamic ?
-               "This JVM does not support constant tag %u in class file %s" :
-               "Class file version does not support constant tag %u in class file %s"),
+              "Class file version does not support constant tag %u in class file %s",
+              tag, CHECK);
+          }
+          if (!EnableInvokeDynamic) {
+            classfile_parse_error(
+              "This JVM does not support constant tag %u in class file %s",
               tag, CHECK);
           }
           cfs->guarantee_more(5, CHECK);  // bsm_index, nt, tag/access_flags
@@ -1616,8 +1621,13 @@
 
   AccessFlags access_flags;
   if (name == vmSymbols::class_initializer_name()) {
-    // We ignore the access flags for a class initializer. (JVM Spec. p. 116)
-    flags = JVM_ACC_STATIC;
+    // We ignore the other access flags for a valid class initializer.
+    // (JVM Spec 2nd ed., chapter 4.6)
+    if (_major_version < 51) { // backward compatibility
+      flags = JVM_ACC_STATIC;
+    } else if ((flags & JVM_ACC_STATIC) == JVM_ACC_STATIC) {
+      flags &= JVM_ACC_STATIC | JVM_ACC_STRICT;
+    }
   } else {
     verify_legal_method_modifiers(flags, is_interface, name, CHECK_(nullHandle));
   }
@@ -2597,54 +2607,6 @@
 }
 
 
-static void initialize_static_field(fieldDescriptor* fd, TRAPS) {
-  KlassHandle h_k (THREAD, fd->field_holder());
-  assert(h_k.not_null() && fd->is_static(), "just checking");
-  if (fd->has_initial_value()) {
-    BasicType t = fd->field_type();
-    switch (t) {
-      case T_BYTE:
-        h_k()->byte_field_put(fd->offset(), fd->int_initial_value());
-              break;
-      case T_BOOLEAN:
-        h_k()->bool_field_put(fd->offset(), fd->int_initial_value());
-              break;
-      case T_CHAR:
-        h_k()->char_field_put(fd->offset(), fd->int_initial_value());
-              break;
-      case T_SHORT:
-        h_k()->short_field_put(fd->offset(), fd->int_initial_value());
-              break;
-      case T_INT:
-        h_k()->int_field_put(fd->offset(), fd->int_initial_value());
-        break;
-      case T_FLOAT:
-        h_k()->float_field_put(fd->offset(), fd->float_initial_value());
-        break;
-      case T_DOUBLE:
-        h_k()->double_field_put(fd->offset(), fd->double_initial_value());
-        break;
-      case T_LONG:
-        h_k()->long_field_put(fd->offset(), fd->long_initial_value());
-        break;
-      case T_OBJECT:
-        {
-          #ifdef ASSERT
-          TempNewSymbol sym = SymbolTable::new_symbol("Ljava/lang/String;", CHECK);
-          assert(fd->signature() == sym, "just checking");
-          #endif
-          oop string = fd->string_initial_value(CHECK);
-          h_k()->obj_field_put(fd->offset(), string);
-        }
-        break;
-      default:
-        THROW_MSG(vmSymbols::java_lang_ClassFormatError(),
-                  "Illegal ConstantValue attribute in class file");
-    }
-  }
-}
-
-
 void ClassFileParser::java_lang_ref_Reference_fix_pre(typeArrayHandle* fields_ptr,
   constantPoolHandle cp, FieldAllocationCount *fac_ptr, TRAPS) {
   // This code is for compatibility with earlier jdk's that do not
@@ -2760,8 +2722,8 @@
 }
 
 
-void ClassFileParser::java_lang_Class_fix_pre(objArrayHandle* methods_ptr,
-  FieldAllocationCount *fac_ptr, TRAPS) {
+void ClassFileParser::java_lang_Class_fix_pre(int* nonstatic_field_size,
+                                              FieldAllocationCount *fac_ptr) {
   // Add fake fields for java.lang.Class instances
   //
   // This is not particularly nice. We should consider adding a
@@ -2778,10 +2740,13 @@
   // versions because when the offsets are computed at bootstrap
   // time we don't know yet which version of the JDK we're running in.
 
-  // The values below are fake but will force two non-static oop fields and
+  // The values below are fake but will force three non-static oop fields and
   // a corresponding non-static oop map block to be allocated.
   const int extra = java_lang_Class::number_of_fake_oop_fields;
   fac_ptr->nonstatic_oop_count += extra;
+
+  // Reserve some leading space for fake ints
+  *nonstatic_field_size += align_size_up(java_lang_Class::hc_number_of_fake_int_fields * BytesPerInt, heapOopSize) / heapOopSize;
 }
 
 
@@ -2797,11 +2762,11 @@
 
 // Force MethodHandle.vmentry to be an unmanaged pointer.
 // There is no way for a classfile to express this, so we must help it.
-void ClassFileParser::java_dyn_MethodHandle_fix_pre(constantPoolHandle cp,
+void ClassFileParser::java_lang_invoke_MethodHandle_fix_pre(constantPoolHandle cp,
                                                     typeArrayHandle fields,
                                                     FieldAllocationCount *fac_ptr,
                                                     TRAPS) {
-  // Add fake fields for java.dyn.MethodHandle instances
+  // Add fake fields for java.lang.invoke.MethodHandle instances
   //
   // This is not particularly nice, but since there is no way to express
   // a native wordSize field in Java, we must do it at this level.
@@ -2818,9 +2783,10 @@
     }
   }
 
+  if (AllowTransitionalJSR292 && word_sig_index == 0)  return;
   if (word_sig_index == 0)
     THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
-              "missing I or J signature (for vmentry) in java.dyn.MethodHandle");
+              "missing I or J signature (for vmentry) in java.lang.invoke.MethodHandle");
 
   // Find vmentry field and change the signature.
   bool found_vmentry = false;
@@ -2857,9 +2823,10 @@
     }
   }
 
+  if (AllowTransitionalJSR292 && !found_vmentry)  return;
   if (!found_vmentry)
     THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
-              "missing vmentry byte field in java.dyn.MethodHandle");
+              "missing vmentry byte field in java.lang.invoke.MethodHandle");
 }
 
 
@@ -3194,9 +3161,7 @@
     int next_nonstatic_field_offset;
 
     // Calculate the starting byte offsets
-    next_static_oop_offset      = (instanceKlass::header_size() +
-                                  align_object_offset(vtable_size) +
-                                  align_object_offset(itable_size)) * wordSize;
+    next_static_oop_offset      = instanceMirrorKlass::offset_of_static_fields();
     next_static_double_offset   = next_static_oop_offset +
                                   (fac.static_oop_count * heapOopSize);
     if ( fac.static_double_count &&
@@ -3215,18 +3180,28 @@
                                   fac.static_byte_count ), wordSize );
     static_field_size           = (next_static_type_offset -
                                   next_static_oop_offset) / wordSize;
-    first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
-                                   nonstatic_field_size * heapOopSize;
-    next_nonstatic_field_offset = first_nonstatic_field_offset;
 
     // Add fake fields for java.lang.Class instances (also see below)
     if (class_name == vmSymbols::java_lang_Class() && class_loader.is_null()) {
-      java_lang_Class_fix_pre(&methods, &fac, CHECK_(nullHandle));
+      java_lang_Class_fix_pre(&nonstatic_field_size, &fac);
     }
 
-    // adjust the vmentry field declaration in java.dyn.MethodHandle
-    if (EnableMethodHandles && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
-      java_dyn_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
+    first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
+                                   nonstatic_field_size * heapOopSize;
+    next_nonstatic_field_offset = first_nonstatic_field_offset;
+
+    // adjust the vmentry field declaration in java.lang.invoke.MethodHandle
+    if (EnableMethodHandles && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
+      java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
+    }
+    if (AllowTransitionalJSR292 &&
+        EnableMethodHandles && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) {
+      java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
+    }
+    if (AllowTransitionalJSR292 &&
+        EnableMethodHandles && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
+      // allow vmentry field in MethodHandleImpl also
+      java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
     }
 
     // Add a fake "discovered" field if it is not present
@@ -3546,7 +3521,7 @@
     }
 
     // We can now create the basic klassOop for this klass
-    klassOop ik = oopFactory::new_instanceKlass(vtable_size, itable_size,
+    klassOop ik = oopFactory::new_instanceKlass(name, vtable_size, itable_size,
                                                 static_field_size,
                                                 total_oop_map_count,
                                                 rt, CHECK_(nullHandle));
@@ -3568,7 +3543,7 @@
     this_klass->set_class_loader(class_loader());
     this_klass->set_nonstatic_field_size(nonstatic_field_size);
     this_klass->set_has_nonstatic_fields(has_nonstatic_fields);
-    this_klass->set_static_oop_field_size(fac.static_oop_count);
+    this_klass->set_static_oop_field_count(fac.static_oop_count);
     cp->set_pool_holder(this_klass());
     error_handler.set_in_error(false);   // turn off error handler for cp
     this_klass->set_constants(cp());
@@ -3629,9 +3604,6 @@
     // Make sure this is the end of class file stream
     guarantee_property(cfs->at_eos(), "Extra bytes at the end of class file %s", CHECK_(nullHandle));
 
-    // Initialize static fields
-    this_klass->do_local_static_fields(&initialize_static_field, CHECK_(nullHandle));
-
     // VerifyOops believes that once this has been set, the object is completely loaded.
     // Compute transitive closure of interfaces this class implements
     this_klass->set_transitive_interfaces(transitive_interfaces());
@@ -3665,6 +3637,9 @@
       check_illegal_static_method(this_klass, CHECK_(nullHandle));
     }
 
+    // Allocate mirror and initialize static fields
+    java_lang_Class::create_mirror(this_klass, CHECK_(nullHandle));
+
     ClassLoadingService::notify_class_loaded(instanceKlass::cast(this_klass()),
                                              false /* not shared class */);
 
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -154,17 +154,18 @@
   // Add the "discovered" field to java.lang.ref.Reference if
   // it does not exist.
   void java_lang_ref_Reference_fix_pre(typeArrayHandle* fields_ptr,
-    constantPoolHandle cp, FieldAllocationCount *fac_ptr, TRAPS);
+                                       constantPoolHandle cp,
+                                       FieldAllocationCount *fac_ptr, TRAPS);
   // Adjust the field allocation counts for java.lang.Class to add
   // fake fields.
-  void java_lang_Class_fix_pre(objArrayHandle* methods_ptr,
-    FieldAllocationCount *fac_ptr, TRAPS);
+  void java_lang_Class_fix_pre(int* nonstatic_field_size,
+                               FieldAllocationCount *fac_ptr);
   // Adjust the next_nonstatic_oop_offset to place the fake fields
   // before any Java fields.
   void java_lang_Class_fix_post(int* next_nonstatic_oop_offset);
-  // Adjust the field allocation counts for java.dyn.MethodHandle to add
+  // Adjust the field allocation counts for java.lang.invoke.MethodHandle to add
   // a fake address (void*) field.
-  void java_dyn_MethodHandle_fix_pre(constantPoolHandle cp,
+  void java_lang_invoke_MethodHandle_fix_pre(constantPoolHandle cp,
                                      typeArrayHandle fields,
                                      FieldAllocationCount *fac_ptr, TRAPS);
 
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -33,6 +33,7 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/klass.hpp"
 #include "oops/klassOop.hpp"
 #include "oops/methodOop.hpp"
@@ -66,6 +67,28 @@
     return ik->find_local_field(name_symbol, signature_symbol, fd);
 }
 
+static bool find_hacked_field(instanceKlass* ik,
+                              Symbol* name_symbol, Symbol* signature_symbol,
+                              fieldDescriptor* fd,
+                              bool allow_super = false) {
+  bool found = find_field(ik, name_symbol, signature_symbol, fd, allow_super);
+  if (!found && AllowTransitionalJSR292) {
+    Symbol* backup_sig = SystemDictionary::find_backup_signature(signature_symbol);
+    if (backup_sig != NULL) {
+      found = find_field(ik, name_symbol, backup_sig, fd, allow_super);
+      if (TraceMethodHandles) {
+        ResourceMark rm;
+        tty->print_cr("MethodHandles: %s.%s: backup for %s => %s%s",
+                      ik->name()->as_C_string(), name_symbol->as_C_string(),
+                      signature_symbol->as_C_string(), backup_sig->as_C_string(),
+                      (found ? "" : " (NOT FOUND)"));
+      }
+    }
+  }
+  return found;
+}
+#define find_field find_hacked_field  /* remove after AllowTransitionalJSR292 */
+
 // Helpful routine for computing field offsets at run time rather than hardcoding them
 static void
 compute_offset(int &dest_offset,
@@ -139,7 +162,7 @@
 }
 
 Handle java_lang_String::create_tenured_from_unicode(jchar* unicode, int length, TRAPS) {
-  return basic_create_from_unicode(unicode, length, true, CHECK_NH);
+  return basic_create_from_unicode(unicode, length, JavaObjectsInPerm, CHECK_NH);
 }
 
 oop java_lang_String::create_oop_from_unicode(jchar* unicode, int length, TRAPS) {
@@ -369,6 +392,75 @@
   }
 }
 
+static void initialize_static_field(fieldDescriptor* fd, TRAPS) {
+  Handle mirror (THREAD, fd->field_holder()->java_mirror());
+  assert(mirror.not_null() && fd->is_static(), "just checking");
+  if (fd->has_initial_value()) {
+    BasicType t = fd->field_type();
+    switch (t) {
+      case T_BYTE:
+        mirror()->byte_field_put(fd->offset(), fd->int_initial_value());
+              break;
+      case T_BOOLEAN:
+        mirror()->bool_field_put(fd->offset(), fd->int_initial_value());
+              break;
+      case T_CHAR:
+        mirror()->char_field_put(fd->offset(), fd->int_initial_value());
+              break;
+      case T_SHORT:
+        mirror()->short_field_put(fd->offset(), fd->int_initial_value());
+              break;
+      case T_INT:
+        mirror()->int_field_put(fd->offset(), fd->int_initial_value());
+        break;
+      case T_FLOAT:
+        mirror()->float_field_put(fd->offset(), fd->float_initial_value());
+        break;
+      case T_DOUBLE:
+        mirror()->double_field_put(fd->offset(), fd->double_initial_value());
+        break;
+      case T_LONG:
+        mirror()->long_field_put(fd->offset(), fd->long_initial_value());
+        break;
+      case T_OBJECT:
+        {
+          #ifdef ASSERT
+          TempNewSymbol sym = SymbolTable::new_symbol("Ljava/lang/String;", CHECK);
+          assert(fd->signature() == sym, "just checking");
+          #endif
+          oop string = fd->string_initial_value(CHECK);
+          mirror()->obj_field_put(fd->offset(), string);
+        }
+        break;
+      default:
+        THROW_MSG(vmSymbols::java_lang_ClassFormatError(),
+                  "Illegal ConstantValue attribute in class file");
+    }
+  }
+}
+
+
+// During bootstrap, java.lang.Class wasn't loaded so static field
+// offsets were computed without the size added it.  Go back and
+// update all the static field offsets to included the size.
+static void fixup_static_field(fieldDescriptor* fd, TRAPS) {
+  if (fd->is_static()) {
+    int real_offset = fd->offset() + instanceMirrorKlass::offset_of_static_fields();
+    typeArrayOop fields = instanceKlass::cast(fd->field_holder())->fields();
+    fields->short_at_put(fd->index() + instanceKlass::low_offset,  extract_low_short_from_int(real_offset));
+    fields->short_at_put(fd->index() + instanceKlass::high_offset, extract_high_short_from_int(real_offset));
+  }
+}
+
+void java_lang_Class::fixup_mirror(KlassHandle k, TRAPS) {
+  assert(instanceMirrorKlass::offset_of_static_fields() != 0, "must have been computed already");
+
+  if (k->oop_is_instance()) {
+    // Fixup the offsets
+    instanceKlass::cast(k())->do_local_static_fields(&fixup_static_field, CHECK);
+  }
+  create_mirror(k, CHECK);
+}
 
 oop java_lang_Class::create_mirror(KlassHandle k, TRAPS) {
   assert(k->java_mirror() == NULL, "should only assign mirror once");
@@ -378,12 +470,17 @@
   // class is put into the system dictionary.
   int computed_modifiers = k->compute_modifier_flags(CHECK_0);
   k->set_modifier_flags(computed_modifiers);
-  if (SystemDictionary::Class_klass_loaded()) {
+  if (SystemDictionary::Class_klass_loaded() && (k->oop_is_instance() || k->oop_is_javaArray())) {
     // Allocate mirror (java.lang.Class instance)
-    Handle mirror = instanceKlass::cast(SystemDictionary::Class_klass())->allocate_permanent_instance(CHECK_0);
+    Handle mirror = instanceMirrorKlass::cast(SystemDictionary::Class_klass())->allocate_instance(k, CHECK_0);
     // Setup indirections
     mirror->obj_field_put(klass_offset,  k());
     k->set_java_mirror(mirror());
+
+    instanceMirrorKlass* mk = instanceMirrorKlass::cast(mirror->klass());
+    java_lang_Class::set_oop_size(mirror(), mk->instance_size(k));
+    java_lang_Class::set_static_oop_field_count(mirror(), mk->compute_static_oop_field_count(mirror()));
+
     // It might also have a component mirror.  This mirror must already exist.
     if (k->oop_is_javaArray()) {
       Handle comp_mirror;
@@ -406,6 +503,9 @@
         arrayKlass::cast(k->as_klassOop())->set_component_mirror(comp_mirror());
         set_array_klass(comp_mirror(), k->as_klassOop());
       }
+    } else if (k->oop_is_instance()) {
+      // Initialize static fields
+      instanceKlass::cast(k())->do_local_static_fields(&initialize_static_field, CHECK_NULL);
     }
     return mirror();
   } else {
@@ -414,21 +514,46 @@
 }
 
 
+
+int  java_lang_Class::oop_size(oop java_class) {
+  assert(oop_size_offset != 0, "must be set");
+  return java_class->int_field(oop_size_offset);
+}
+void java_lang_Class::set_oop_size(oop java_class, int size) {
+  assert(oop_size_offset != 0, "must be set");
+  java_class->int_field_put(oop_size_offset, size);
+}
+int  java_lang_Class::static_oop_field_count(oop java_class) {
+  assert(static_oop_field_count_offset != 0, "must be set");
+  return java_class->int_field(static_oop_field_count_offset);
+}
+void java_lang_Class::set_static_oop_field_count(oop java_class, int size) {
+  assert(static_oop_field_count_offset != 0, "must be set");
+  java_class->int_field_put(static_oop_field_count_offset, size);
+}
+
+
+
+
 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) {
   // This should be improved by adding a field at the Java level or by
   // introducing a new VM klass (see comment in ClassFileParser)
-  oop java_class = instanceKlass::cast(SystemDictionary::Class_klass())->allocate_permanent_instance(CHECK_0);
+  oop java_class = instanceMirrorKlass::cast(SystemDictionary::Class_klass())->allocate_instance((oop)NULL, CHECK_0);
   if (type != T_VOID) {
     klassOop aklass = Universe::typeArrayKlassObj(type);
     assert(aklass != NULL, "correct bootstrap");
     set_array_klass(java_class, aklass);
   }
+  instanceMirrorKlass* mk = instanceMirrorKlass::cast(SystemDictionary::Class_klass());
+  java_lang_Class::set_oop_size(java_class, mk->instance_size(oop(NULL)));
+  java_lang_Class::set_static_oop_field_count(java_class, 0);
   return java_class;
 }
 
 
 klassOop java_lang_Class::as_klassOop(oop java_class) {
   //%note memory_2
+  assert(java_lang_Class::is_instance(java_class), "must be a Class object");
   klassOop k = klassOop(java_class->obj_field(klass_offset));
   assert(k == NULL || k->is_klass(), "type check");
   return k;
@@ -2130,7 +2255,7 @@
 // Support for java_lang_ref_Reference
 oop java_lang_ref_Reference::pending_list_lock() {
   instanceKlass* ik = instanceKlass::cast(SystemDictionary::Reference_klass());
-  char *addr = (((char *)ik->start_of_static_fields()) + static_lock_offset);
+  address addr = ik->static_field_addr(static_lock_offset);
   if (UseCompressedOops) {
     return oopDesc::load_decode_heap_oop((narrowOop *)addr);
   } else {
@@ -2140,7 +2265,7 @@
 
 HeapWord *java_lang_ref_Reference::pending_list_addr() {
   instanceKlass* ik = instanceKlass::cast(SystemDictionary::Reference_klass());
-  char *addr = (((char *)ik->start_of_static_fields()) + static_pending_offset);
+  address addr = ik->static_field_addr(static_pending_offset);
   // XXX This might not be HeapWord aligned, almost rather be char *.
   return (HeapWord*)addr;
 }
@@ -2163,54 +2288,54 @@
 
 jlong java_lang_ref_SoftReference::clock() {
   instanceKlass* ik = instanceKlass::cast(SystemDictionary::SoftReference_klass());
-  int offset = ik->offset_of_static_fields() + static_clock_offset;
-
-  return SystemDictionary::SoftReference_klass()->long_field(offset);
+  jlong* offset = (jlong*)ik->static_field_addr(static_clock_offset);
+  return *offset;
 }
 
 void java_lang_ref_SoftReference::set_clock(jlong value) {
   instanceKlass* ik = instanceKlass::cast(SystemDictionary::SoftReference_klass());
-  int offset = ik->offset_of_static_fields() + static_clock_offset;
-
-  SystemDictionary::SoftReference_klass()->long_field_put(offset, value);
+  jlong* offset = (jlong*)ik->static_field_addr(static_clock_offset);
+  *offset = value;
 }
 
 
-// Support for java_dyn_MethodHandle
-
-int java_dyn_MethodHandle::_type_offset;
-int java_dyn_MethodHandle::_vmtarget_offset;
-int java_dyn_MethodHandle::_vmentry_offset;
-int java_dyn_MethodHandle::_vmslots_offset;
-
-int sun_dyn_MemberName::_clazz_offset;
-int sun_dyn_MemberName::_name_offset;
-int sun_dyn_MemberName::_type_offset;
-int sun_dyn_MemberName::_flags_offset;
-int sun_dyn_MemberName::_vmtarget_offset;
-int sun_dyn_MemberName::_vmindex_offset;
-
-int sun_dyn_DirectMethodHandle::_vmindex_offset;
-
-int sun_dyn_BoundMethodHandle::_argument_offset;
-int sun_dyn_BoundMethodHandle::_vmargslot_offset;
-
-int sun_dyn_AdapterMethodHandle::_conversion_offset;
-
-void java_dyn_MethodHandle::compute_offsets() {
+// Support for java_lang_invoke_MethodHandle
+
+int java_lang_invoke_MethodHandle::_type_offset;
+int java_lang_invoke_MethodHandle::_vmtarget_offset;
+int java_lang_invoke_MethodHandle::_vmentry_offset;
+int java_lang_invoke_MethodHandle::_vmslots_offset;
+
+int java_lang_invoke_MemberName::_clazz_offset;
+int java_lang_invoke_MemberName::_name_offset;
+int java_lang_invoke_MemberName::_type_offset;
+int java_lang_invoke_MemberName::_flags_offset;
+int java_lang_invoke_MemberName::_vmtarget_offset;
+int java_lang_invoke_MemberName::_vmindex_offset;
+
+int java_lang_invoke_DirectMethodHandle::_vmindex_offset;
+
+int java_lang_invoke_BoundMethodHandle::_argument_offset;
+int java_lang_invoke_BoundMethodHandle::_vmargslot_offset;
+
+int java_lang_invoke_AdapterMethodHandle::_conversion_offset;
+
+void java_lang_invoke_MethodHandle::compute_offsets() {
   klassOop k = SystemDictionary::MethodHandle_klass();
   if (k != NULL && EnableMethodHandles) {
-    compute_offset(_type_offset,      k, vmSymbols::type_name(),      vmSymbols::java_dyn_MethodType_signature(), true);
-    compute_offset(_vmtarget_offset,  k, vmSymbols::vmtarget_name(),  vmSymbols::object_signature(), true);
-    compute_offset(_vmentry_offset,   k, vmSymbols::vmentry_name(),   vmSymbols::machine_word_signature(), true);
+    bool allow_super = false;
+    if (AllowTransitionalJSR292)  allow_super = true;  // temporary, to access java.dyn.MethodHandleImpl
+    compute_offset(_type_offset,      k, vmSymbols::type_name(),      vmSymbols::java_lang_invoke_MethodType_signature(), allow_super);
+    compute_offset(_vmtarget_offset,  k, vmSymbols::vmtarget_name(),  vmSymbols::object_signature(),                      allow_super);
+    compute_offset(_vmentry_offset,   k, vmSymbols::vmentry_name(),   vmSymbols::machine_word_signature(),                allow_super);
 
     // Note:  MH.vmslots (if it is present) is a hoisted copy of MH.type.form.vmslots.
     // It is optional pending experiments to keep or toss.
-    compute_optional_offset(_vmslots_offset, k, vmSymbols::vmslots_name(), vmSymbols::int_signature(), true);
+    compute_optional_offset(_vmslots_offset, k, vmSymbols::vmslots_name(), vmSymbols::int_signature(), allow_super);
   }
 }
 
-void sun_dyn_MemberName::compute_offsets() {
+void java_lang_invoke_MemberName::compute_offsets() {
   klassOop k = SystemDictionary::MemberName_klass();
   if (k != NULL && EnableMethodHandles) {
     compute_offset(_clazz_offset,     k, vmSymbols::clazz_name(),     vmSymbols::class_signature());
@@ -2222,14 +2347,14 @@
   }
 }
 
-void sun_dyn_DirectMethodHandle::compute_offsets() {
+void java_lang_invoke_DirectMethodHandle::compute_offsets() {
   klassOop k = SystemDictionary::DirectMethodHandle_klass();
   if (k != NULL && EnableMethodHandles) {
     compute_offset(_vmindex_offset,   k, vmSymbols::vmindex_name(),   vmSymbols::int_signature(),    true);
   }
 }
 
-void sun_dyn_BoundMethodHandle::compute_offsets() {
+void java_lang_invoke_BoundMethodHandle::compute_offsets() {
   klassOop k = SystemDictionary::BoundMethodHandle_klass();
   if (k != NULL && EnableMethodHandles) {
     compute_offset(_vmargslot_offset, k, vmSymbols::vmargslot_name(), vmSymbols::int_signature(),    true);
@@ -2237,22 +2362,22 @@
   }
 }
 
-void sun_dyn_AdapterMethodHandle::compute_offsets() {
+void java_lang_invoke_AdapterMethodHandle::compute_offsets() {
   klassOop k = SystemDictionary::AdapterMethodHandle_klass();
   if (k != NULL && EnableMethodHandles) {
     compute_offset(_conversion_offset, k, vmSymbols::conversion_name(), vmSymbols::int_signature(), true);
   }
 }
 
-oop java_dyn_MethodHandle::type(oop mh) {
+oop java_lang_invoke_MethodHandle::type(oop mh) {
   return mh->obj_field(_type_offset);
 }
 
-void java_dyn_MethodHandle::set_type(oop mh, oop mtype) {
+void java_lang_invoke_MethodHandle::set_type(oop mh, oop mtype) {
   mh->obj_field_put(_type_offset, mtype);
 }
 
-int java_dyn_MethodHandle::vmslots(oop mh) {
+int java_lang_invoke_MethodHandle::vmslots(oop mh) {
   int vmslots_offset = _vmslots_offset;
   if (vmslots_offset != 0) {
 #ifdef ASSERT
@@ -2267,7 +2392,7 @@
 }
 
 // if MH.vmslots exists, hoist into it the value of type.form.vmslots
-void java_dyn_MethodHandle::init_vmslots(oop mh) {
+void java_lang_invoke_MethodHandle::init_vmslots(oop mh) {
   int vmslots_offset = _vmslots_offset;
   if (vmslots_offset != 0) {
     mh->int_field_put(vmslots_offset, compute_vmslots(mh));
@@ -2276,20 +2401,20 @@
 
 // fetch type.form.vmslots, which is the number of JVM stack slots
 // required to carry the arguments of this MH
-int java_dyn_MethodHandle::compute_vmslots(oop mh) {
+int java_lang_invoke_MethodHandle::compute_vmslots(oop mh) {
   oop mtype = type(mh);
   if (mtype == NULL)  return 0;  // Java code would get NPE
-  oop form = java_dyn_MethodType::form(mtype);
+  oop form = java_lang_invoke_MethodType::form(mtype);
   if (form == NULL)   return 0;  // Java code would get NPE
-  return java_dyn_MethodTypeForm::vmslots(form);
+  return java_lang_invoke_MethodTypeForm::vmslots(form);
 }
 
 // fetch the low-level entry point for this mh
-MethodHandleEntry* java_dyn_MethodHandle::vmentry(oop mh) {
+MethodHandleEntry* java_lang_invoke_MethodHandle::vmentry(oop mh) {
   return (MethodHandleEntry*) mh->address_field(_vmentry_offset);
 }
 
-void java_dyn_MethodHandle::set_vmentry(oop mh, MethodHandleEntry* me) {
+void java_lang_invoke_MethodHandle::set_vmentry(oop mh, MethodHandleEntry* me) {
   assert(_vmentry_offset != 0, "must be present");
 
   // This is always the final step that initializes a valid method handle:
@@ -2303,123 +2428,123 @@
 
 /// MemberName accessors
 
-oop sun_dyn_MemberName::clazz(oop mname) {
+oop java_lang_invoke_MemberName::clazz(oop mname) {
   assert(is_instance(mname), "wrong type");
   return mname->obj_field(_clazz_offset);
 }
 
-void sun_dyn_MemberName::set_clazz(oop mname, oop clazz) {
+void java_lang_invoke_MemberName::set_clazz(oop mname, oop clazz) {
   assert(is_instance(mname), "wrong type");
   mname->obj_field_put(_clazz_offset, clazz);
 }
 
-oop sun_dyn_MemberName::name(oop mname) {
+oop java_lang_invoke_MemberName::name(oop mname) {
   assert(is_instance(mname), "wrong type");
   return mname->obj_field(_name_offset);
 }
 
-void sun_dyn_MemberName::set_name(oop mname, oop name) {
+void java_lang_invoke_MemberName::set_name(oop mname, oop name) {
   assert(is_instance(mname), "wrong type");
   mname->obj_field_put(_name_offset, name);
 }
 
-oop sun_dyn_MemberName::type(oop mname) {
+oop java_lang_invoke_MemberName::type(oop mname) {
   assert(is_instance(mname), "wrong type");
   return mname->obj_field(_type_offset);
 }
 
-void sun_dyn_MemberName::set_type(oop mname, oop type) {
+void java_lang_invoke_MemberName::set_type(oop mname, oop type) {
   assert(is_instance(mname), "wrong type");
   mname->obj_field_put(_type_offset, type);
 }
 
-int sun_dyn_MemberName::flags(oop mname) {
+int java_lang_invoke_MemberName::flags(oop mname) {
   assert(is_instance(mname), "wrong type");
   return mname->int_field(_flags_offset);
 }
 
-void sun_dyn_MemberName::set_flags(oop mname, int flags) {
+void java_lang_invoke_MemberName::set_flags(oop mname, int flags) {
   assert(is_instance(mname), "wrong type");
   mname->int_field_put(_flags_offset, flags);
 }
 
-oop sun_dyn_MemberName::vmtarget(oop mname) {
+oop java_lang_invoke_MemberName::vmtarget(oop mname) {
   assert(is_instance(mname), "wrong type");
   return mname->obj_field(_vmtarget_offset);
 }
 
-void sun_dyn_MemberName::set_vmtarget(oop mname, oop ref) {
+void java_lang_invoke_MemberName::set_vmtarget(oop mname, oop ref) {
   assert(is_instance(mname), "wrong type");
   mname->obj_field_put(_vmtarget_offset, ref);
 }
 
-int sun_dyn_MemberName::vmindex(oop mname) {
+int java_lang_invoke_MemberName::vmindex(oop mname) {
   assert(is_instance(mname), "wrong type");
   return mname->int_field(_vmindex_offset);
 }
 
-void sun_dyn_MemberName::set_vmindex(oop mname, int index) {
+void java_lang_invoke_MemberName::set_vmindex(oop mname, int index) {
   assert(is_instance(mname), "wrong type");
   mname->int_field_put(_vmindex_offset, index);
 }
 
-oop java_dyn_MethodHandle::vmtarget(oop mh) {
+oop java_lang_invoke_MethodHandle::vmtarget(oop mh) {
   assert(is_instance(mh), "MH only");
   return mh->obj_field(_vmtarget_offset);
 }
 
-void java_dyn_MethodHandle::set_vmtarget(oop mh, oop ref) {
+void java_lang_invoke_MethodHandle::set_vmtarget(oop mh, oop ref) {
   assert(is_instance(mh), "MH only");
   mh->obj_field_put(_vmtarget_offset, ref);
 }
 
-int sun_dyn_DirectMethodHandle::vmindex(oop mh) {
+int java_lang_invoke_DirectMethodHandle::vmindex(oop mh) {
   assert(is_instance(mh), "DMH only");
   return mh->int_field(_vmindex_offset);
 }
 
-void sun_dyn_DirectMethodHandle::set_vmindex(oop mh, int index) {
+void java_lang_invoke_DirectMethodHandle::set_vmindex(oop mh, int index) {
   assert(is_instance(mh), "DMH only");
   mh->int_field_put(_vmindex_offset, index);
 }
 
-int sun_dyn_BoundMethodHandle::vmargslot(oop mh) {
+int java_lang_invoke_BoundMethodHandle::vmargslot(oop mh) {
   assert(is_instance(mh), "BMH only");
   return mh->int_field(_vmargslot_offset);
 }
 
-oop sun_dyn_BoundMethodHandle::argument(oop mh) {
+oop java_lang_invoke_BoundMethodHandle::argument(oop mh) {
   assert(is_instance(mh), "BMH only");
   return mh->obj_field(_argument_offset);
 }
 
-int sun_dyn_AdapterMethodHandle::conversion(oop mh) {
+int java_lang_invoke_AdapterMethodHandle::conversion(oop mh) {
   assert(is_instance(mh), "AMH only");
   return mh->int_field(_conversion_offset);
 }
 
-void sun_dyn_AdapterMethodHandle::set_conversion(oop mh, int conv) {
+void java_lang_invoke_AdapterMethodHandle::set_conversion(oop mh, int conv) {
   assert(is_instance(mh), "AMH only");
   mh->int_field_put(_conversion_offset, conv);
 }
 
 
-// Support for java_dyn_MethodType
-
-int java_dyn_MethodType::_rtype_offset;
-int java_dyn_MethodType::_ptypes_offset;
-int java_dyn_MethodType::_form_offset;
-
-void java_dyn_MethodType::compute_offsets() {
+// Support for java_lang_invoke_MethodType
+
+int java_lang_invoke_MethodType::_rtype_offset;
+int java_lang_invoke_MethodType::_ptypes_offset;
+int java_lang_invoke_MethodType::_form_offset;
+
+void java_lang_invoke_MethodType::compute_offsets() {
   klassOop k = SystemDictionary::MethodType_klass();
   if (k != NULL) {
     compute_offset(_rtype_offset,  k, vmSymbols::rtype_name(),  vmSymbols::class_signature());
     compute_offset(_ptypes_offset, k, vmSymbols::ptypes_name(), vmSymbols::class_array_signature());
-    compute_offset(_form_offset,   k, vmSymbols::form_name(),   vmSymbols::java_dyn_MethodTypeForm_signature());
+    compute_offset(_form_offset,   k, vmSymbols::form_name(),   vmSymbols::java_lang_invoke_MethodTypeForm_signature());
   }
 }
 
-void java_dyn_MethodType::print_signature(oop mt, outputStream* st) {
+void java_lang_invoke_MethodType::print_signature(oop mt, outputStream* st) {
   st->print("(");
   objArrayOop pts = ptypes(mt);
   for (int i = 0, limit = pts->length(); i < limit; i++) {
@@ -2429,7 +2554,7 @@
   java_lang_Class::print_signature(rtype(mt), st);
 }
 
-Symbol* java_dyn_MethodType::as_signature(oop mt, bool intern_if_not_found, TRAPS) {
+Symbol* java_lang_invoke_MethodType::as_signature(oop mt, bool intern_if_not_found, TRAPS) {
   ResourceMark rm;
   stringStream buffer(128);
   print_signature(mt, &buffer);
@@ -2444,103 +2569,83 @@
   return name;
 }
 
-oop java_dyn_MethodType::rtype(oop mt) {
+oop java_lang_invoke_MethodType::rtype(oop mt) {
   assert(is_instance(mt), "must be a MethodType");
   return mt->obj_field(_rtype_offset);
 }
 
-objArrayOop java_dyn_MethodType::ptypes(oop mt) {
+objArrayOop java_lang_invoke_MethodType::ptypes(oop mt) {
   assert(is_instance(mt), "must be a MethodType");
   return (objArrayOop) mt->obj_field(_ptypes_offset);
 }
 
-oop java_dyn_MethodType::form(oop mt) {
+oop java_lang_invoke_MethodType::form(oop mt) {
   assert(is_instance(mt), "must be a MethodType");
   return mt->obj_field(_form_offset);
 }
 
-oop java_dyn_MethodType::ptype(oop mt, int idx) {
+oop java_lang_invoke_MethodType::ptype(oop mt, int idx) {
   return ptypes(mt)->obj_at(idx);
 }
 
-int java_dyn_MethodType::ptype_count(oop mt) {
+int java_lang_invoke_MethodType::ptype_count(oop mt) {
   return ptypes(mt)->length();
 }
 
 
 
-// Support for java_dyn_MethodTypeForm
-
-int java_dyn_MethodTypeForm::_vmslots_offset;
-int java_dyn_MethodTypeForm::_erasedType_offset;
-int java_dyn_MethodTypeForm::_genericInvoker_offset;
-
-void java_dyn_MethodTypeForm::compute_offsets() {
+// Support for java_lang_invoke_MethodTypeForm
+
+int java_lang_invoke_MethodTypeForm::_vmslots_offset;
+int java_lang_invoke_MethodTypeForm::_erasedType_offset;
+int java_lang_invoke_MethodTypeForm::_genericInvoker_offset;
+
+void java_lang_invoke_MethodTypeForm::compute_offsets() {
   klassOop k = SystemDictionary::MethodTypeForm_klass();
   if (k != NULL) {
     compute_optional_offset(_vmslots_offset,    k, vmSymbols::vmslots_name(),    vmSymbols::int_signature(), true);
-    compute_optional_offset(_erasedType_offset, k, vmSymbols::erasedType_name(), vmSymbols::java_dyn_MethodType_signature(), true);
-    compute_optional_offset(_genericInvoker_offset, k, vmSymbols::genericInvoker_name(), vmSymbols::java_dyn_MethodHandle_signature(), true);
+    compute_optional_offset(_erasedType_offset, k, vmSymbols::erasedType_name(), vmSymbols::java_lang_invoke_MethodType_signature(), true);
+    compute_optional_offset(_genericInvoker_offset, k, vmSymbols::genericInvoker_name(), vmSymbols::java_lang_invoke_MethodHandle_signature(), true);
     if (_genericInvoker_offset == 0)  _genericInvoker_offset = -1;  // set to explicit "empty" value
   }
 }
 
-int java_dyn_MethodTypeForm::vmslots(oop mtform) {
+int java_lang_invoke_MethodTypeForm::vmslots(oop mtform) {
   assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
   return mtform->int_field(_vmslots_offset);
 }
 
-oop java_dyn_MethodTypeForm::erasedType(oop mtform) {
+oop java_lang_invoke_MethodTypeForm::erasedType(oop mtform) {
   assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
   return mtform->obj_field(_erasedType_offset);
 }
 
-oop java_dyn_MethodTypeForm::genericInvoker(oop mtform) {
+oop java_lang_invoke_MethodTypeForm::genericInvoker(oop mtform) {
   assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
   return mtform->obj_field(_genericInvoker_offset);
 }
 
 
-// Support for java_dyn_CallSite
-
-int java_dyn_CallSite::_target_offset;
-int java_dyn_CallSite::_caller_method_offset;
-int java_dyn_CallSite::_caller_bci_offset;
-
-void java_dyn_CallSite::compute_offsets() {
+// Support for java_lang_invoke_CallSite
+
+int java_lang_invoke_CallSite::_target_offset;
+
+void java_lang_invoke_CallSite::compute_offsets() {
   if (!EnableInvokeDynamic)  return;
   klassOop k = SystemDictionary::CallSite_klass();
   if (k != NULL) {
-    compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_dyn_MethodHandle_signature());
-    compute_offset(_caller_method_offset, k, vmSymbols::vmmethod_name(), vmSymbols::sun_dyn_MemberName_signature());
-    compute_offset(_caller_bci_offset, k, vmSymbols::vmindex_name(), vmSymbols::int_signature());
+    compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature());
   }
 }
 
-oop java_dyn_CallSite::target(oop site) {
+oop java_lang_invoke_CallSite::target(oop site) {
   return site->obj_field(_target_offset);
 }
 
-void java_dyn_CallSite::set_target(oop site, oop target) {
+void java_lang_invoke_CallSite::set_target(oop site, oop target) {
   site->obj_field_put(_target_offset, target);
 }
 
-oop java_dyn_CallSite::caller_method(oop site) {
-  return site->obj_field(_caller_method_offset);
-}
-
-void java_dyn_CallSite::set_caller_method(oop site, oop ref) {
-  site->obj_field_put(_caller_method_offset, ref);
-}
-
-jint java_dyn_CallSite::caller_bci(oop site) {
-  return site->int_field(_caller_bci_offset);
-}
-
-void java_dyn_CallSite::set_caller_bci(oop site, jint bci) {
-  site->int_field_put(_caller_bci_offset, bci);
-}
-
 
 // Support for java_security_AccessControlContext
 
@@ -2621,26 +2726,18 @@
 
 
 // Support for java_lang_System
-
-void java_lang_System::compute_offsets() {
-  assert(offset_of_static_fields == 0, "offsets should be initialized only once");
-
-  instanceKlass* ik = instanceKlass::cast(SystemDictionary::System_klass());
-  offset_of_static_fields = ik->offset_of_static_fields();
-}
-
 int java_lang_System::in_offset_in_bytes() {
-  return (offset_of_static_fields + static_in_offset);
+  return (instanceMirrorKlass::offset_of_static_fields() + static_in_offset);
 }
 
 
 int java_lang_System::out_offset_in_bytes() {
-  return (offset_of_static_fields + static_out_offset);
+  return (instanceMirrorKlass::offset_of_static_fields() + static_out_offset);
 }
 
 
 int java_lang_System::err_offset_in_bytes() {
-  return (offset_of_static_fields + static_err_offset);
+  return (instanceMirrorKlass::offset_of_static_fields() + static_err_offset);
 }
 
 
@@ -2653,6 +2750,8 @@
 int java_lang_Class::array_klass_offset;
 int java_lang_Class::resolved_constructor_offset;
 int java_lang_Class::number_of_fake_oop_fields;
+int java_lang_Class::oop_size_offset;
+int java_lang_Class::static_oop_field_count_offset;
 int java_lang_Throwable::backtrace_offset;
 int java_lang_Throwable::detailMessage_offset;
 int java_lang_Throwable::cause_offset;
@@ -2696,7 +2795,6 @@
 int java_lang_ref_SoftReference::timestamp_offset;
 int java_lang_ref_SoftReference::static_clock_offset;
 int java_lang_ClassLoader::parent_offset;
-int java_lang_System::offset_of_static_fields;
 int java_lang_System::static_in_offset;
 int java_lang_System::static_out_offset;
 int java_lang_System::static_err_offset;
@@ -2813,10 +2911,19 @@
   java_lang_String::count_offset  = java_lang_String::offset_offset + sizeof (jint);
   java_lang_String::hash_offset   = java_lang_String::count_offset + sizeof (jint);
 
-  // Do the Class Class
-  java_lang_Class::klass_offset = java_lang_Class::hc_klass_offset * x + header;
-  java_lang_Class::array_klass_offset = java_lang_Class::hc_array_klass_offset * x + header;
-  java_lang_Class::resolved_constructor_offset = java_lang_Class::hc_resolved_constructor_offset * x + header;
+  {
+    // Do the Class Class
+    int offset = header;
+    java_lang_Class::oop_size_offset = header;
+    offset += BytesPerInt;
+    java_lang_Class::static_oop_field_count_offset = offset;
+    offset = align_size_up(offset + BytesPerInt, x);
+    java_lang_Class::klass_offset = offset;
+    offset += x;
+    java_lang_Class::array_klass_offset = offset;
+    offset += x;
+    java_lang_Class::resolved_constructor_offset = offset;
+  }
 
   // This is NOT an offset
   java_lang_Class::number_of_fake_oop_fields = java_lang_Class::hc_number_of_fake_oop_fields;
@@ -2873,20 +2980,19 @@
 void JavaClasses::compute_offsets() {
 
   java_lang_Class::compute_offsets();
-  java_lang_System::compute_offsets();
   java_lang_Thread::compute_offsets();
   java_lang_ThreadGroup::compute_offsets();
   if (EnableMethodHandles) {
-    java_dyn_MethodHandle::compute_offsets();
-    sun_dyn_MemberName::compute_offsets();
-    sun_dyn_DirectMethodHandle::compute_offsets();
-    sun_dyn_BoundMethodHandle::compute_offsets();
-    sun_dyn_AdapterMethodHandle::compute_offsets();
-    java_dyn_MethodType::compute_offsets();
-    java_dyn_MethodTypeForm::compute_offsets();
+    java_lang_invoke_MethodHandle::compute_offsets();
+    java_lang_invoke_MemberName::compute_offsets();
+    java_lang_invoke_DirectMethodHandle::compute_offsets();
+    java_lang_invoke_BoundMethodHandle::compute_offsets();
+    java_lang_invoke_AdapterMethodHandle::compute_offsets();
+    java_lang_invoke_MethodType::compute_offsets();
+    java_lang_invoke_MethodTypeForm::compute_offsets();
   }
   if (EnableInvokeDynamic) {
-    java_dyn_CallSite::compute_offsets();
+    java_lang_invoke_CallSite::compute_offsets();
   }
   java_security_AccessControlContext::compute_offsets();
   // Initialize reflection classes. The layouts of these classes
@@ -2957,10 +3063,10 @@
     tty->print_cr("Static field %s.%s appears to be nonstatic", klass_name, field_name);
     return false;
   }
-  if (fd.offset() == hardcoded_offset + h_klass->offset_of_static_fields()) {
+  if (fd.offset() == hardcoded_offset + instanceMirrorKlass::offset_of_static_fields()) {
     return true;
   } else {
-    tty->print_cr("Offset of static field %s.%s is hardcoded as %d but should really be %d.", klass_name, field_name, hardcoded_offset, fd.offset() - h_klass->offset_of_static_fields());
+    tty->print_cr("Offset of static field %s.%s is hardcoded as %d but should really be %d.", klass_name, field_name, hardcoded_offset, fd.offset() - instanceMirrorKlass::offset_of_static_fields());
     return false;
   }
 }
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -138,10 +138,8 @@
   // The fake offsets are added by the class loader when java.lang.Class is loaded
 
   enum {
-    hc_klass_offset                = 0,
-    hc_array_klass_offset          = 1,
-    hc_resolved_constructor_offset = 2,
-    hc_number_of_fake_oop_fields   = 3
+    hc_number_of_fake_oop_fields   = 3,
+    hc_number_of_fake_int_fields   = 2
   };
 
   static int klass_offset;
@@ -149,6 +147,9 @@
   static int array_klass_offset;
   static int number_of_fake_oop_fields;
 
+  static int oop_size_offset;
+  static int static_oop_field_count_offset;
+
   static void compute_offsets();
   static bool offsets_computed;
   static int classRedefinedCount_offset;
@@ -157,6 +158,7 @@
  public:
   // Instance creation
   static oop  create_mirror(KlassHandle k, TRAPS);
+  static void fixup_mirror(KlassHandle k, TRAPS);
   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
   // Conversion
   static klassOop as_klassOop(oop java_class);
@@ -191,6 +193,12 @@
   static void set_classRedefinedCount(oop the_class_mirror, int value);
   // Support for parallelCapable field
   static bool parallelCapable(oop the_class_mirror);
+
+  static int oop_size(oop java_class);
+  static void set_oop_size(oop java_class, int size);
+  static int static_oop_field_count(oop java_class);
+  static void set_static_oop_field_count(oop java_class, int size);
+
   // Debugging
   friend class JavaClasses;
   friend class instanceKlass;   // verification code accesses offsets
@@ -794,11 +802,11 @@
 };
 
 
-// Interface to java.dyn.MethodHandle objects
+// Interface to java.lang.invoke.MethodHandle objects
 
 class MethodHandleEntry;
 
-class java_dyn_MethodHandle: AllStatic {
+class java_lang_invoke_MethodHandle: AllStatic {
   friend class JavaClasses;
 
  private:
@@ -839,7 +847,7 @@
   static int vmslots_offset_in_bytes()          { return _vmslots_offset; }
 };
 
-class sun_dyn_DirectMethodHandle: public java_dyn_MethodHandle {
+class java_lang_invoke_DirectMethodHandle: public java_lang_invoke_MethodHandle {
   friend class JavaClasses;
 
  private:
@@ -864,7 +872,7 @@
   static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
 };
 
-class sun_dyn_BoundMethodHandle: public java_dyn_MethodHandle {
+class java_lang_invoke_BoundMethodHandle: public java_lang_invoke_MethodHandle {
   friend class JavaClasses;
 
  private:
@@ -891,7 +899,7 @@
   static int vmargslot_offset_in_bytes()        { return _vmargslot_offset; }
 };
 
-class sun_dyn_AdapterMethodHandle: public sun_dyn_BoundMethodHandle {
+class java_lang_invoke_AdapterMethodHandle: public java_lang_invoke_BoundMethodHandle {
   friend class JavaClasses;
 
  private:
@@ -942,14 +950,14 @@
 };
 
 
-// Interface to sun.dyn.MemberName objects
+// Interface to java.lang.invoke.MemberName objects
 // (These are a private interface for Java code to query the class hierarchy.)
 
-class sun_dyn_MemberName: AllStatic {
+class java_lang_invoke_MemberName: AllStatic {
   friend class JavaClasses;
 
  private:
-  // From java.dyn.MemberName:
+  // From java.lang.invoke.MemberName:
   //    private Class<?>   clazz;       // class in which the method is defined
   //    private String     name;        // may be null if not yet materialized
   //    private Object     type;        // may be null if not yet materialized
@@ -1018,9 +1026,9 @@
 };
 
 
-// Interface to java.dyn.MethodType objects
+// Interface to java.lang.invoke.MethodType objects
 
-class java_dyn_MethodType: AllStatic {
+class java_lang_invoke_MethodType: AllStatic {
   friend class JavaClasses;
 
  private:
@@ -1052,7 +1060,7 @@
   static int form_offset_in_bytes()             { return _form_offset; }
 };
 
-class java_dyn_MethodTypeForm: AllStatic {
+class java_lang_invoke_MethodTypeForm: AllStatic {
   friend class JavaClasses;
 
  private:
@@ -1075,9 +1083,9 @@
 };
 
 
-// Interface to java.dyn.CallSite objects
+// Interface to java.lang.invoke.CallSite objects
 
-class java_dyn_CallSite: AllStatic {
+class java_lang_invoke_CallSite: AllStatic {
   friend class JavaClasses;
 
 private:
@@ -1165,13 +1173,10 @@
    hc_static_err_offset = 2
   };
 
-  static int offset_of_static_fields;
   static int  static_in_offset;
   static int static_out_offset;
   static int static_err_offset;
 
-  static void compute_offsets();
-
  public:
   static int  in_offset_in_bytes();
   static int out_offset_in_bytes();
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -88,7 +88,7 @@
 void SymbolTable::unlink() {
   int removed = 0;
   int total = 0;
-  int memory_total = 0;
+  size_t memory_total = 0;
   for (int i = 0; i < the_table()->table_size(); ++i) {
     for (HashtableEntry<Symbol*>** p = the_table()->bucket_addr(i); *p != NULL; ) {
       HashtableEntry<Symbol*>* entry = *p;
@@ -112,8 +112,10 @@
   }
   symbols_removed += removed;
   symbols_counted += total;
-  if (PrintGCDetails) {
-    gclog_or_tty->print(" [Symbols=%d size=%dK] ", total,
+  // Exclude printing for normal PrintGCDetails because people parse
+  // this output.
+  if (PrintGCDetails && Verbose && WizardMode) {
+    gclog_or_tty->print(" [Symbols=%d size=" SIZE_FORMAT "K] ", total,
                         (memory_total*HeapWordSize)/1024);
   }
 }
@@ -528,7 +530,7 @@
 
   Handle string;
   // try to reuse the string if possible
-  if (!string_or_null.is_null() && string_or_null()->is_perm()) {
+  if (!string_or_null.is_null() && (!JavaObjectsInPerm || string_or_null()->is_perm())) {
     string = string_or_null;
   } else {
     string = java_lang_String::create_tenured_from_unicode(name, len, CHECK_NULL);
@@ -660,7 +662,7 @@
     for ( ; p != NULL; p = p->next()) {
       oop s = p->literal();
       guarantee(s != NULL, "interned string is NULL");
-      guarantee(s->is_perm(), "interned string not in permspace");
+      guarantee(s->is_perm() || !JavaObjectsInPerm, "interned string not in permspace");
 
       int length;
       jchar* chars = java_lang_String::as_unicode_string(s, length);
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -216,18 +216,14 @@
   oop basic_add(int index, Handle string_or_null, jchar* name, int len,
                 unsigned int hashValue, TRAPS);
 
-  // Table size
-  enum {
-    string_table_size = 1009
-  };
-
   oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
 
-  StringTable() : Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>)) {}
+  StringTable() : Hashtable<oop>((int)StringTableSize,
+                                 sizeof (HashtableEntry<oop>)) {}
 
   StringTable(HashtableBucket* t, int number_of_entries)
-    : Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>), t,
-                number_of_entries) {}
+    : Hashtable<oop>((int)StringTableSize, sizeof (HashtableEntry<oop>), t,
+                     number_of_entries) {}
 
 public:
   // The string table
@@ -241,7 +237,7 @@
   static void create_table(HashtableBucket* t, int length,
                            int number_of_entries) {
     assert(_the_table == NULL, "One string table allowed.");
-    assert(length == string_table_size * sizeof(HashtableBucket),
+    assert((size_t)length == StringTableSize * sizeof(HashtableBucket),
            "bad shared string size.");
     _the_table = new StringTable(t, number_of_entries);
   }
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -1887,27 +1887,99 @@
   0
 };
 
+Symbol* SystemDictionary::find_backup_symbol(Symbol* symbol,
+                                             const char* from_prefix,
+                                             const char* to_prefix) {
+  assert(AllowTransitionalJSR292, "");  // delete this subroutine
+  Symbol* backup_symbol = NULL;
+  size_t from_len = strlen(from_prefix);
+  if (strncmp((const char*) symbol->base(), from_prefix, from_len) != 0)
+    return NULL;
+  char buf[100];
+  size_t to_len = strlen(to_prefix);
+  size_t tail_len = symbol->utf8_length() - from_len;
+  size_t new_len = to_len + tail_len;
+  guarantee(new_len < sizeof(buf), "buf too small");
+  memcpy(buf, to_prefix, to_len);
+  memcpy(buf + to_len, symbol->base() + from_len, tail_len);
+  buf[new_len] = '\0';
+  vmSymbols::SID backup_sid = vmSymbols::find_sid(buf);
+  if (backup_sid != vmSymbols::NO_SID) {
+    backup_symbol = vmSymbols::symbol_at(backup_sid);
+  }
+  return backup_symbol;
+}
+
+Symbol* SystemDictionary::find_backup_class_name(Symbol* symbol) {
+  assert(AllowTransitionalJSR292, "");  // delete this subroutine
+  if (symbol == NULL)  return NULL;
+  Symbol* backup_symbol = find_backup_symbol(symbol, "java/lang/invoke/", "java/dyn/");  // AllowTransitionalJSR292 ONLY
+  if (backup_symbol == NULL)
+    backup_symbol = find_backup_symbol(symbol, "java/dyn/", "sun/dyn/");  // AllowTransitionalJSR292 ONLY
+  return backup_symbol;
+}
+
+Symbol* SystemDictionary::find_backup_signature(Symbol* symbol) {
+  assert(AllowTransitionalJSR292, "");  // delete this subroutine
+  if (symbol == NULL)  return NULL;
+  return find_backup_symbol(symbol, "Ljava/lang/invoke/", "Ljava/dyn/");
+}
+
 bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
   assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
   int  info = wk_init_info[id - FIRST_WKID];
   int  sid  = (info >> CEIL_LG_OPTION_LIMIT);
   Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
   klassOop*    klassp = &_well_known_klasses[id];
-  bool must_load = (init_opt < SystemDictionary::Opt);
-  bool try_load  = true;
+  bool pre_load = (init_opt < SystemDictionary::Opt);
+  bool try_load = true;
   if (init_opt == SystemDictionary::Opt_Kernel) {
 #ifndef KERNEL
     try_load = false;
 #endif //KERNEL
   }
-  if ((*klassp) == NULL && try_load) {
+  Symbol* backup_symbol = NULL;  // symbol to try if the current symbol fails
+  if (init_opt == SystemDictionary::Pre_JSR292) {
+    if (!EnableMethodHandles)  try_load = false;  // do not bother to load such classes
+    if (AllowTransitionalJSR292) {
+      backup_symbol = find_backup_class_name(symbol);
+      if (try_load && PreferTransitionalJSR292) {
+        while (backup_symbol != NULL) {
+          (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early
+          if (TraceMethodHandles) {
+            ResourceMark rm;
+            tty->print_cr("MethodHandles: try backup first for %s => %s (%s)",
+                          symbol->as_C_string(), backup_symbol->as_C_string(),
+                          ((*klassp) == NULL) ? "no such class" : "backup load succeeded");
+          }
+          if ((*klassp) != NULL)  return true;
+          backup_symbol = find_backup_class_name(backup_symbol);  // find next backup
+        }
+      }
+    }
+  }
+  if ((*klassp) != NULL)  return true;
+  if (!try_load)          return false;
+  while (symbol != NULL) {
+    bool must_load = (pre_load && (backup_symbol == NULL));
     if (must_load) {
       (*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class
     } else {
       (*klassp) = resolve_or_null(symbol,       CHECK_0); // load optional klass
     }
+    if ((*klassp) != NULL)  return true;
+    // Go around again.  Example of long backup sequence:
+    // java.lang.invoke.MemberName, java.dyn.MemberName, sun.dyn.MemberName, ONLY if AllowTransitionalJSR292
+    if (TraceMethodHandles && (backup_symbol != NULL)) {
+      ResourceMark rm;
+      tty->print_cr("MethodHandles: backup for %s => %s",
+                    symbol->as_C_string(), backup_symbol->as_C_string());
+    }
+    symbol = backup_symbol;
+    if (AllowTransitionalJSR292)
+      backup_symbol = find_backup_class_name(symbol);
   }
-  return ((*klassp) != NULL);
+  return false;
 }
 
 void SystemDictionary::initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS) {
@@ -2348,6 +2420,8 @@
     if (THREAD->is_Compiler_thread())
       return NULL;              // do not attempt from within compiler
     bool for_invokeGeneric = (name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name));
+    if (AllowInvokeForInvokeGeneric && name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
+      for_invokeGeneric = true;
     bool found_on_bcp = false;
     Handle mt = find_method_handle_type(signature, accessing_klass,
                                         for_invokeGeneric,
@@ -2376,7 +2450,7 @@
   }
 }
 
-// Ask Java code to find or construct a java.dyn.MethodType for the given
+// Ask Java code to find or construct a java.lang.invoke.MethodType for the given
 // signature, as interpreted relative to the given class loader.
 // Because of class loader constraints, all method handle usage must be
 // consistent with this loader.
@@ -2430,25 +2504,33 @@
   }
   assert(arg == npts, "");
 
-  // call sun.dyn.MethodHandleNatives::findMethodType(Class rt, Class[] pts) -> MethodType
+  // call java.lang.invoke.MethodHandleNatives::findMethodType(Class rt, Class[] pts) -> MethodType
   JavaCallArguments args(Handle(THREAD, rt()));
   args.push_oop(pts());
   JavaValue result(T_OBJECT);
+  Symbol* findMethodHandleType_signature = vmSymbols::findMethodHandleType_signature();
+  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
+    findMethodHandleType_signature = vmSymbols::findMethodHandleType_TRANS_signature();
+  }
   JavaCalls::call_static(&result,
                          SystemDictionary::MethodHandleNatives_klass(),
                          vmSymbols::findMethodHandleType_name(),
-                         vmSymbols::findMethodHandleType_signature(),
+                         findMethodHandleType_signature,
                          &args, CHECK_(empty));
   Handle method_type(THREAD, (oop) result.get_jobject());
 
   if (for_invokeGeneric) {
-    // call sun.dyn.MethodHandleNatives::notifyGenericMethodType(MethodType) -> void
+    // call java.lang.invoke.MethodHandleNatives::notifyGenericMethodType(MethodType) -> void
     JavaCallArguments args(Handle(THREAD, method_type()));
     JavaValue no_result(T_VOID);
+    Symbol* notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_signature();
+    if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
+      notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_TRANS_signature();
+    }
     JavaCalls::call_static(&no_result,
                            SystemDictionary::MethodHandleNatives_klass(),
                            vmSymbols::notifyGenericMethodType_name(),
-                           vmSymbols::notifyGenericMethodType_signature(),
+                           notifyGenericMethodType_signature,
                            &args, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       // If the notification fails, just kill it.
@@ -2489,7 +2571,7 @@
     THROW_MSG_(vmSymbols::java_lang_LinkageError(), "bad signature", empty);
   }
 
-  // call sun.dyn.MethodHandleNatives::linkMethodHandleConstant(Class caller, int refKind, Class callee, String name, Object type) -> MethodHandle
+  // call java.lang.invoke.MethodHandleNatives::linkMethodHandleConstant(Class caller, int refKind, Class callee, String name, Object type) -> MethodHandle
   JavaCallArguments args;
   args.push_oop(caller->java_mirror());  // the referring class
   args.push_int(ref_kind);
@@ -2497,15 +2579,19 @@
   args.push_oop(name());
   args.push_oop(type());
   JavaValue result(T_OBJECT);
+  Symbol* linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_signature();
+  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandle_klass()->name() == vmSymbols::java_dyn_MethodHandle()) {
+    linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_TRANS_signature();
+  }
   JavaCalls::call_static(&result,
                          SystemDictionary::MethodHandleNatives_klass(),
                          vmSymbols::linkMethodHandleConstant_name(),
-                         vmSymbols::linkMethodHandleConstant_signature(),
+                         linkMethodHandleConstant_signature,
                          &args, CHECK_(empty));
   return Handle(THREAD, (oop) result.get_jobject());
 }
 
-// Ask Java code to find or construct a java.dyn.CallSite for the given
+// Ask Java code to find or construct a java.lang.invoke.CallSite for the given
 // name and signature, as interpreted relative to the given class loader.
 Handle SystemDictionary::make_dynamic_call_site(Handle bootstrap_method,
                                                 Symbol* name,
@@ -2516,13 +2602,13 @@
                                                 TRAPS) {
   Handle empty;
   guarantee(bootstrap_method.not_null() &&
-            java_dyn_MethodHandle::is_instance(bootstrap_method()),
+            java_lang_invoke_MethodHandle::is_instance(bootstrap_method()),
             "caller must supply a valid BSM");
 
   Handle caller_mname = MethodHandles::new_MemberName(CHECK_(empty));
   MethodHandles::init_MemberName(caller_mname(), caller_method());
 
-  // call sun.dyn.MethodHandleNatives::makeDynamicCallSite(bootm, name, mtype, info, caller_mname, caller_pos)
+  // call java.lang.invoke.MethodHandleNatives::makeDynamicCallSite(bootm, name, mtype, info, caller_mname, caller_pos)
   oop name_str_oop = StringTable::intern(name, CHECK_(empty)); // not a handle!
   JavaCallArguments args(Handle(THREAD, bootstrap_method()));
   args.push_oop(name_str_oop);
@@ -2531,14 +2617,21 @@
   args.push_oop(caller_mname());
   args.push_int(caller_bci);
   JavaValue result(T_OBJECT);
+  Symbol* makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_signature();
+  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::sun_dyn_MethodHandleNatives()) {
+    makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS_signature();
+  }
+  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::java_dyn_MethodHandleNatives()) {
+    makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS2_signature();
+  }
   JavaCalls::call_static(&result,
                          SystemDictionary::MethodHandleNatives_klass(),
                          vmSymbols::makeDynamicCallSite_name(),
-                         vmSymbols::makeDynamicCallSite_signature(),
+                         makeDynamicCallSite_signature,
                          &args, CHECK_(empty));
   oop call_site_oop = (oop) result.get_jobject();
   assert(call_site_oop->is_oop()
-         /*&& java_dyn_CallSite::is_instance(call_site_oop)*/, "must be sane");
+         /*&& java_lang_invoke_CallSite::is_instance(call_site_oop)*/, "must be sane");
   if (TraceMethodHandles) {
 #ifndef PRODUCT
     tty->print_cr("Linked invokedynamic bci=%d site="INTPTR_FORMAT":", caller_bci, call_site_oop);
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -144,18 +144,18 @@
   template(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt_Only_JDK15) \
                                                                               \
   /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
-  template(MethodHandle_klass,           java_dyn_MethodHandle,          Opt) \
-  template(MemberName_klass,             sun_dyn_MemberName,             Opt) \
-  template(MethodHandleImpl_klass,       sun_dyn_MethodHandleImpl,       Opt) \
-  template(MethodHandleNatives_klass,    sun_dyn_MethodHandleNatives,    Opt) \
-  template(AdapterMethodHandle_klass,    sun_dyn_AdapterMethodHandle,    Opt) \
-  template(BoundMethodHandle_klass,      sun_dyn_BoundMethodHandle,      Opt) \
-  template(DirectMethodHandle_klass,     sun_dyn_DirectMethodHandle,     Opt) \
-  template(MethodType_klass,             java_dyn_MethodType,            Opt) \
-  template(MethodTypeForm_klass,         java_dyn_MethodTypeForm,        Opt) \
-  template(WrongMethodTypeException_klass, java_dyn_WrongMethodTypeException, Opt) \
-  template(Linkage_klass,                java_dyn_Linkage,               Opt) \
-  template(CallSite_klass,               java_dyn_CallSite,              Opt) \
+  template(MethodHandle_klass,           java_lang_invoke_MethodHandle,     Pre_JSR292) \
+  template(MemberName_klass,             java_lang_invoke_MemberName,       Pre_JSR292) \
+  template(MethodHandleImpl_klass,       sun_dyn_MethodHandleImpl,          Opt) /* AllowTransitionalJSR292 ONLY */ \
+  template(MethodHandleNatives_klass,    java_lang_invoke_MethodHandleNatives, Pre_JSR292) \
+  template(AdapterMethodHandle_klass,    java_lang_invoke_AdapterMethodHandle, Pre_JSR292) \
+  template(BoundMethodHandle_klass,      java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
+  template(DirectMethodHandle_klass,     java_lang_invoke_DirectMethodHandle, Pre_JSR292) \
+  template(MethodType_klass,             java_lang_invoke_MethodType,       Pre_JSR292) \
+  template(MethodTypeForm_klass,         java_lang_invoke_MethodTypeForm,   Pre_JSR292) \
+  template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
+  template(Linkage_klass,                java_lang_invoke_Linkage,          Opt) /* AllowTransitionalJSR292 ONLY */ \
+  template(CallSite_klass,               java_lang_invoke_CallSite,         Pre_JSR292) \
   /* Note: MethodHandle must be first, and CallSite last in group */          \
                                                                               \
   template(StringBuffer_klass,           java_lang_StringBuffer,         Pre) \
@@ -207,6 +207,7 @@
 
   enum InitOption {
     Pre,                        // preloaded; error if not present
+    Pre_JSR292,                 // preloaded if EnableMethodHandles
 
     // Order is significant.  Options before this point require resolve_or_fail.
     // Options after this point will use resolve_or_null instead.
@@ -401,6 +402,7 @@
   }
 
   static klassOop check_klass_Pre(klassOop k) { return check_klass(k); }
+  static klassOop check_klass_Pre_JSR292(klassOop k) { return EnableInvokeDynamic ? check_klass(k) : k; }
   static klassOop check_klass_Opt(klassOop k) { return k; }
   static klassOop check_klass_Opt_Kernel(klassOop k) { return k; } //== Opt
   static klassOop check_klass_Opt_Only_JDK15(klassOop k) {
@@ -420,6 +422,8 @@
     initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
   }
 
+  static Symbol* find_backup_symbol(Symbol* symbol, const char* from_prefix, const char* to_prefix);
+
 public:
   #define WK_KLASS_DECLARE(name, ignore_symbol, option) \
     static klassOop name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); }
@@ -441,6 +445,9 @@
 
   static void load_abstract_ownable_synchronizer_klass(TRAPS);
 
+  static Symbol* find_backup_class_name(Symbol* class_name_symbol);
+  static Symbol* find_backup_signature(Symbol* signature_symbol);
+
 private:
   // Tells whether ClassLoader.loadClassInternal is present
   static bool has_loadClassInternal()       { return _has_loadClassInternal; }
@@ -475,18 +482,18 @@
                                        Handle loader2, bool is_method, TRAPS);
 
   // JSR 292
-  // find the java.dyn.MethodHandles::invoke method for a given signature
+  // find the java.lang.invoke.MethodHandles::invoke method for a given signature
   static methodOop find_method_handle_invoke(Symbol* name,
                                              Symbol* signature,
                                              KlassHandle accessing_klass,
                                              TRAPS);
-  // ask Java to compute a java.dyn.MethodType object for a given signature
+  // ask Java to compute a java.lang.invoke.MethodType object for a given signature
   static Handle    find_method_handle_type(Symbol* signature,
                                            KlassHandle accessing_klass,
                                            bool for_invokeGeneric,
                                            bool& return_bcp_flag,
                                            TRAPS);
-  // ask Java to compute a java.dyn.MethodHandle object for a given CP entry
+  // ask Java to compute a java.lang.invoke.MethodHandle object for a given CP entry
   static Handle    link_method_handle_constant(KlassHandle caller,
                                                int ref_kind, //e.g., JVM_REF_invokeVirtual
                                                KlassHandle callee,
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -1671,13 +1671,19 @@
       VerificationType::long_type(),
       VerificationType::long2_type(), CHECK_VERIFY(this));
   } else if (tag.is_method_handle()) {
+    Symbol* methodHandle_name = vmSymbols::java_lang_invoke_MethodHandle();
+    if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
+      methodHandle_name = SystemDictionaryHandles::MethodHandle_klass()->name();
     current_frame->push_stack(
       VerificationType::reference_type(
-        vmSymbols::java_dyn_MethodHandle()), CHECK_VERIFY(this));
+        methodHandle_name), CHECK_VERIFY(this));
   } else if (tag.is_method_type()) {
+    Symbol* methodType_name = vmSymbols::java_lang_invoke_MethodType();
+    if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
+      methodType_name = SystemDictionaryHandles::MethodType_klass()->name();
     current_frame->push_stack(
       VerificationType::reference_type(
-        vmSymbols::java_dyn_MethodType()), CHECK_VERIFY(this));
+        methodType_name), CHECK_VERIFY(this));
   } else {
     verify_error(bci, "Invalid index in ldc");
     return;
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -277,6 +277,12 @@
   return sid;
 }
 
+vmSymbols::SID vmSymbols::find_sid(const char* symbol_name) {
+  Symbol* symbol = SymbolTable::probe(symbol_name, (int) strlen(symbol_name));
+  if (symbol == NULL)  return NO_SID;
+  return find_sid(symbol);
+}
+
 static vmIntrinsics::ID wrapper_intrinsic(BasicType type, bool unboxing) {
 #define TYPE2(type, unboxing) ((int)(type)*2 + ((unboxing) ? 1 : 0))
   switch (TYPE2(type, unboxing)) {
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -229,33 +229,60 @@
   template(base_name,                                 "base")                                     \
                                                                                                   \
   /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */                                   \
-  template(java_dyn_InvokeDynamic,                    "java/dyn/InvokeDynamic")                   \
-  template(java_dyn_Linkage,                          "java/dyn/Linkage")                         \
-  template(java_dyn_CallSite,                         "java/dyn/CallSite")                        \
-  template(java_dyn_MethodHandle,                     "java/dyn/MethodHandle")                    \
-  template(java_dyn_MethodType,                       "java/dyn/MethodType")                      \
-  template(java_dyn_WrongMethodTypeException,         "java/dyn/WrongMethodTypeException")        \
-  template(java_dyn_MethodType_signature,             "Ljava/dyn/MethodType;")                    \
-  template(java_dyn_MethodHandle_signature,           "Ljava/dyn/MethodHandle;")                  \
+  template(java_lang_invoke_InvokeDynamic,            "java/lang/invoke/InvokeDynamic")           \
+  template(java_lang_invoke_Linkage,                  "java/lang/invoke/Linkage")                 \
+  template(java_lang_invoke_CallSite,                 "java/lang/invoke/CallSite")                \
+  template(java_lang_invoke_MethodHandle,             "java/lang/invoke/MethodHandle")            \
+  template(java_lang_invoke_MethodType,               "java/lang/invoke/MethodType")              \
+  template(java_lang_invoke_WrongMethodTypeException, "java/lang/invoke/WrongMethodTypeException") \
+  template(java_lang_invoke_MethodType_signature,     "Ljava/lang/invoke/MethodType;")            \
+  template(java_lang_invoke_MethodHandle_signature,   "Ljava/lang/invoke/MethodHandle;")          \
   /* internal classes known only to the JVM: */                                                   \
-  template(java_dyn_MethodTypeForm,                   "java/dyn/MethodTypeForm")                  \
-  template(java_dyn_MethodTypeForm_signature,         "Ljava/dyn/MethodTypeForm;")                \
-  template(sun_dyn_MemberName,                        "sun/dyn/MemberName")                       \
-  template(sun_dyn_MemberName_signature,              "Lsun/dyn/MemberName;")                     \
-  template(sun_dyn_MethodHandleImpl,                  "sun/dyn/MethodHandleImpl")                 \
-  template(sun_dyn_MethodHandleNatives,               "sun/dyn/MethodHandleNatives")              \
-  template(sun_dyn_AdapterMethodHandle,               "sun/dyn/AdapterMethodHandle")              \
-  template(sun_dyn_BoundMethodHandle,                 "sun/dyn/BoundMethodHandle")                \
-  template(sun_dyn_DirectMethodHandle,                "sun/dyn/DirectMethodHandle")               \
-  /* internal up-calls made only by the JVM, via class sun.dyn.MethodHandleNatives: */            \
+  template(java_lang_invoke_MethodTypeForm,           "java/lang/invoke/MethodTypeForm")          \
+  template(java_lang_invoke_MethodTypeForm_signature, "Ljava/lang/invoke/MethodTypeForm;")        \
+  template(java_lang_invoke_MemberName,               "java/lang/invoke/MemberName")              \
+  template(java_lang_invoke_MethodHandleNatives,      "java/lang/invoke/MethodHandleNatives")     \
+  template(java_lang_invoke_AdapterMethodHandle,      "java/lang/invoke/AdapterMethodHandle")     \
+  template(java_lang_invoke_BoundMethodHandle,        "java/lang/invoke/BoundMethodHandle")       \
+  template(java_lang_invoke_DirectMethodHandle,       "java/lang/invoke/DirectMethodHandle")      \
+  /* temporary transitional public names from 6839872: */                                         \
+  template(java_dyn_InvokeDynamic,                    "java/dyn/InvokeDynamic")         /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_Linkage,                          "java/dyn/Linkage")               /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_CallSite,                         "java/dyn/CallSite")              /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MethodHandle,                     "java/dyn/MethodHandle")          /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MethodType,                       "java/dyn/MethodType")            /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_WrongMethodTypeException,         "java/dyn/WrongMethodTypeException") /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MethodType_signature,             "Ljava/dyn/MethodType;")          /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MethodHandle_signature,           "Ljava/dyn/MethodHandle;")        /* AllowTransitionalJSR292 ONLY */ \
+  /* temporary transitional internal names from 6839872: */                                       \
+  template(java_dyn_MethodTypeForm,                   "java/dyn/MethodTypeForm")        /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MethodTypeForm_signature,         "Ljava/dyn/MethodTypeForm;")      /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MemberName,                       "java/dyn/MemberName")            /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_MethodHandleNatives,              "java/dyn/MethodHandleNatives")   /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_AdapterMethodHandle,              "java/dyn/AdapterMethodHandle")   /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_BoundMethodHandle,                "java/dyn/BoundMethodHandle")     /* AllowTransitionalJSR292 ONLY */ \
+  template(java_dyn_DirectMethodHandle,               "java/dyn/DirectMethodHandle")    /* AllowTransitionalJSR292 ONLY */ \
+  /* temporary transitional internal names from EDR: */                                           \
+  template(sun_dyn_MemberName,                        "sun/dyn/MemberName")             /* AllowTransitionalJSR292 ONLY */ \
+  template(sun_dyn_MethodHandleImpl,                  "sun/dyn/MethodHandleImpl")       /* AllowTransitionalJSR292 ONLY */ \
+  template(sun_dyn_MethodHandleNatives,               "sun/dyn/MethodHandleNatives")    /* AllowTransitionalJSR292 ONLY */ \
+  template(sun_dyn_AdapterMethodHandle,               "sun/dyn/AdapterMethodHandle")    /* AllowTransitionalJSR292 ONLY */ \
+  template(sun_dyn_BoundMethodHandle,                 "sun/dyn/BoundMethodHandle")      /* AllowTransitionalJSR292 ONLY */ \
+  template(sun_dyn_DirectMethodHandle,                "sun/dyn/DirectMethodHandle")     /* AllowTransitionalJSR292 ONLY */ \
+  /* internal up-calls made only by the JVM, via class sun.invoke.MethodHandleNatives: */         \
   template(findMethodHandleType_name,                 "findMethodHandleType")                     \
-  template(findMethodHandleType_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;") \
+  template(findMethodHandleType_signature,       "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/invoke/MethodType;") \
+  template(findMethodHandleType_TRANS_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;") /* AllowTransitionalJSR292 ONLY */ \
   template(notifyGenericMethodType_name,              "notifyGenericMethodType")                  \
-  template(notifyGenericMethodType_signature,         "(Ljava/dyn/MethodType;)V")                 \
+  template(notifyGenericMethodType_signature,         "(Ljava/lang/invoke/MethodType;)V")         \
+  template(notifyGenericMethodType_TRANS_signature,   "(Ljava/dyn/MethodType;)V")       /* AllowTransitionalJSR292 ONLY */ \
   template(linkMethodHandleConstant_name,             "linkMethodHandleConstant")                 \
-  template(linkMethodHandleConstant_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/dyn/MethodHandle;") \
+  template(linkMethodHandleConstant_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;") \
+  template(linkMethodHandleConstant_TRANS_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/dyn/MethodHandle;") /* AllowTransitionalJSR292 ONLY */ \
   template(makeDynamicCallSite_name,                  "makeDynamicCallSite")                      \
-  template(makeDynamicCallSite_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Lsun/dyn/MemberName;I)Ljava/dyn/CallSite;") \
+  template(makeDynamicCallSite_signature, "(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;") \
+  template(makeDynamicCallSite_TRANS_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Lsun/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
+  template(makeDynamicCallSite_TRANS2_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Ljava/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
   NOT_LP64(  do_alias(machine_word_signature,         int_signature)  )                           \
   LP64_ONLY( do_alias(machine_word_signature,         long_signature) )                           \
                                                                                                   \
@@ -882,13 +909,15 @@
                                                                                                                           \
   do_intrinsic(_invoke,                   java_lang_reflect_Method, invoke_name, object_object_array_object_signature, F_R) \
   /*   (symbols invoke_name and invoke_signature defined above) */                                                      \
-  do_intrinsic(_checkSpreadArgument,      sun_dyn_MethodHandleImpl, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) \
+  do_intrinsic(_checkSpreadArgument,      java_lang_invoke_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) \
+  do_intrinsic(_checkSpreadArgument_TRANS,sun_dyn_MethodHandleImpl, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
+  do_intrinsic(_checkSpreadArgument_TRANS2,java_dyn_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
    do_name(    checkSpreadArgument_name,       "checkSpreadArgument")                                                   \
    do_name(    checkSpreadArgument_signature,  "(Ljava/lang/Object;I)V")                                                \
-  do_intrinsic(_invokeExact,              java_dyn_MethodHandle, invokeExact_name,   object_array_object_signature, F_RN) \
-  do_intrinsic(_invokeGeneric,            java_dyn_MethodHandle, invokeGeneric_name, object_array_object_signature, F_RN) \
-  do_intrinsic(_invokeVarargs,            java_dyn_MethodHandle, invokeVarargs_name, object_array_object_signature, F_R)  \
-  do_intrinsic(_invokeDynamic,            java_dyn_InvokeDynamic, star_name,         object_array_object_signature, F_SN) \
+  do_intrinsic(_invokeExact,              java_lang_invoke_MethodHandle, invokeExact_name,   object_array_object_signature, F_RN) \
+  do_intrinsic(_invokeGeneric,            java_lang_invoke_MethodHandle, invokeGeneric_name, object_array_object_signature, F_RN) \
+  do_intrinsic(_invokeVarargs,            java_lang_invoke_MethodHandle, invokeVarargs_name, object_array_object_signature, F_R)  \
+  do_intrinsic(_invokeDynamic,            java_lang_invoke_InvokeDynamic, star_name,         object_array_object_signature, F_SN) \
                                                                                                                         \
   /* unboxing methods: */                                                                                               \
   do_intrinsic(_booleanValue,             java_lang_Boolean,      booleanValue_name, void_boolean_signature, F_R)       \
@@ -995,6 +1024,7 @@
 
   // Returns symbol's SID if one is assigned, else NO_SID.
   static SID find_sid(Symbol* symbol);
+  static SID find_sid(const char* symbol_name);
 
 #ifndef PRODUCT
   // No need for this in the product:
--- a/hotspot/src/share/vm/code/codeCache.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -337,7 +337,6 @@
     if (is_live) {
       // Perform cur->oops_do(f), maybe just once per nmethod.
       f->do_code_blob(cur);
-      cur->fix_oop_relocations();
     }
   }
 
@@ -552,6 +551,19 @@
 }
 
 
+void CodeCache::verify_oops() {
+  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  VerifyOopClosure voc;
+  FOR_ALL_ALIVE_BLOBS(cb) {
+    if (cb->is_nmethod()) {
+      nmethod *nm = (nmethod*)cb;
+      nm->oops_do(&voc);
+      nm->verify_oop_relocations();
+    }
+  }
+}
+
+
 address CodeCache::first_address() {
   assert_locked_or_safepoint(CodeCache_lock);
   return (address)_heap->begin();
@@ -939,9 +951,16 @@
                _heap->high(),
                _heap->high_boundary());
   st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
-               " adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT
+               " adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT "Kb"
                " largest_free_block=" SIZE_FORMAT,
-               CodeCache::nof_blobs(), CodeCache::nof_nmethods(),
-               CodeCache::nof_adapters(), CodeCache::unallocated_capacity(),
-               CodeCache::largest_free_block());
+               nof_blobs(), nof_nmethods(), nof_adapters(),
+               unallocated_capacity()/K, largest_free_block());
 }
+
+void CodeCache::log_state(outputStream* st) {
+  st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
+            " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'"
+            " largest_free_block='" SIZE_FORMAT "'",
+            nof_blobs(), nof_nmethods(), nof_adapters(),
+            unallocated_capacity(), largest_free_block());
+}
--- a/hotspot/src/share/vm/code/codeCache.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -122,6 +122,7 @@
   // GC support
   static void gc_epilogue();
   static void gc_prologue();
+  static void verify_oops();
   // If "unloading_occurred" is true, then unloads (i.e., breaks root links
   // to) any unmarked codeBlobs in the cache.  Sets "marked_for_unloading"
   // to "true" iff some code got unloaded.
@@ -147,6 +148,7 @@
   static void verify();                          // verifies the code cache
   static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
   static void print_bounds(outputStream* st);    // Prints a summary of the bounds of the code cache
+  static void log_state(outputStream* st);
 
   // The full limits of the codeCache
   static address  low_bound()                    { return (address) _heap->low_boundary(); }
@@ -159,7 +161,7 @@
   static size_t  max_capacity()                  { return _heap->max_capacity(); }
   static size_t  unallocated_capacity()          { return _heap->unallocated_capacity(); }
   static size_t  largest_free_block()            { return _heap->largest_free_block(); }
-  static bool    needs_flushing()                { return unallocated_capacity() < CodeCacheFlushingMinimumFreeSpace; }
+  static bool    needs_flushing()                { return largest_free_block() < CodeCacheFlushingMinimumFreeSpace; }
 
   static bool needs_cache_clean()                { return _needs_cache_clean; }
   static void set_needs_cache_clean(bool v)      { _needs_cache_clean = v;    }
--- a/hotspot/src/share/vm/code/nmethod.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -170,7 +170,7 @@
   int pc_desc_resets;   // number of resets (= number of caches)
   int pc_desc_queries;  // queries to nmethod::find_pc_desc
   int pc_desc_approx;   // number of those which have approximate true
-  int pc_desc_repeats;  // number of _last_pc_desc hits
+  int pc_desc_repeats;  // number of _pc_descs[0] hits
   int pc_desc_hits;     // number of LRU cache hits
   int pc_desc_tests;    // total number of PcDesc examinations
   int pc_desc_searches; // total number of quasi-binary search steps
@@ -278,40 +278,44 @@
 
 void PcDescCache::reset_to(PcDesc* initial_pc_desc) {
   if (initial_pc_desc == NULL) {
-    _last_pc_desc = NULL;  // native method
+    _pc_descs[0] = NULL; // native method; no PcDescs at all
     return;
   }
   NOT_PRODUCT(++nmethod_stats.pc_desc_resets);
   // reset the cache by filling it with benign (non-null) values
   assert(initial_pc_desc->pc_offset() < 0, "must be sentinel");
-  _last_pc_desc = initial_pc_desc + 1;  // first valid one is after sentinel
   for (int i = 0; i < cache_size; i++)
     _pc_descs[i] = initial_pc_desc;
 }
 
 PcDesc* PcDescCache::find_pc_desc(int pc_offset, bool approximate) {
   NOT_PRODUCT(++nmethod_stats.pc_desc_queries);
-  NOT_PRODUCT(if (approximate)  ++nmethod_stats.pc_desc_approx);
+  NOT_PRODUCT(if (approximate) ++nmethod_stats.pc_desc_approx);
+
+  // Note: one might think that caching the most recently
+  // read value separately would be a win, but one would be
+  // wrong.  When many threads are updating it, the cache
+  // line it's in would bounce between caches, negating
+  // any benefit.
 
   // In order to prevent race conditions do not load cache elements
   // repeatedly, but use a local copy:
   PcDesc* res;
 
-  // Step one:  Check the most recently returned value.
-  res = _last_pc_desc;
-  if (res == NULL)  return NULL;  // native method; no PcDescs at all
+  // Step one:  Check the most recently added value.
+  res = _pc_descs[0];
+  if (res == NULL) return NULL;  // native method; no PcDescs at all
   if (match_desc(res, pc_offset, approximate)) {
     NOT_PRODUCT(++nmethod_stats.pc_desc_repeats);
     return res;
   }
 
-  // Step two:  Check the LRU cache.
-  for (int i = 0; i < cache_size; i++) {
+  // Step two:  Check the rest of the LRU cache.
+  for (int i = 1; i < cache_size; ++i) {
     res = _pc_descs[i];
-    if (res->pc_offset() < 0)  break;  // optimization: skip empty cache
+    if (res->pc_offset() < 0) break;  // optimization: skip empty cache
     if (match_desc(res, pc_offset, approximate)) {
       NOT_PRODUCT(++nmethod_stats.pc_desc_hits);
-      _last_pc_desc = res;  // record this cache hit in case of repeat
       return res;
     }
   }
@@ -322,24 +326,23 @@
 
 void PcDescCache::add_pc_desc(PcDesc* pc_desc) {
   NOT_PRODUCT(++nmethod_stats.pc_desc_adds);
-  // Update the LRU cache by shifting pc_desc forward:
+  // Update the LRU cache by shifting pc_desc forward.
   for (int i = 0; i < cache_size; i++)  {
     PcDesc* next = _pc_descs[i];
     _pc_descs[i] = pc_desc;
     pc_desc = next;
   }
-  // Note:  Do not update _last_pc_desc.  It fronts for the LRU cache.
 }
 
 // adjust pcs_size so that it is a multiple of both oopSize and
 // sizeof(PcDesc) (assumes that if sizeof(PcDesc) is not a multiple
 // of oopSize, then 2*sizeof(PcDesc) is)
-static int  adjust_pcs_size(int pcs_size) {
+static int adjust_pcs_size(int pcs_size) {
   int nsize = round_to(pcs_size,   oopSize);
   if ((nsize % sizeof(PcDesc)) != 0) {
     nsize = pcs_size + sizeof(PcDesc);
   }
-  assert((nsize %  oopSize) == 0, "correct alignment");
+  assert((nsize % oopSize) == 0, "correct alignment");
   return nsize;
 }
 
@@ -650,6 +653,9 @@
     _pc_desc_cache.reset_to(NULL);
 
     code_buffer->copy_oops_to(this);
+    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
+      CodeCache::add_scavenge_root_nmethod(this);
+    }
     debug_only(verify_scavenge_root_oops());
     CodeCache::commit(this);
   }
@@ -762,7 +768,7 @@
 
 void* nmethod::operator new(size_t size, int nmethod_size) {
   // Always leave some room in the CodeCache for I2C/C2I adapters
-  if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) return NULL;
+  if (CodeCache::largest_free_block() < CodeCacheMinimumFreeSpace) return NULL;
   return CodeCache::allocate(nmethod_size);
 }
 
@@ -1102,6 +1108,20 @@
 }
 
 
+void nmethod::verify_oop_relocations() {
+  // Ensure sure that the code matches the current oop values
+  RelocIterator iter(this, NULL, NULL);
+  while (iter.next()) {
+    if (iter.type() == relocInfo::oop_type) {
+      oop_Relocation* reloc = iter.oop_reloc();
+      if (!reloc->oop_is_immediate()) {
+        reloc->verify_oop_relocation();
+      }
+    }
+  }
+}
+
+
 ScopeDesc* nmethod::scope_desc_at(address pc) {
   PcDesc* pd = pc_desc_at(pc);
   guarantee(pd != NULL, "scope must be present");
@@ -1180,14 +1200,17 @@
   set_stack_traversal_mark(NMethodSweeper::traversal_count());
 }
 
-// Tell if a non-entrant method can be converted to a zombie (i.e., there is no activations on the stack)
+// Tell if a non-entrant method can be converted to a zombie (i.e.,
+// there are no activations on the stack, not in use by the VM,
+// and not in use by the ServiceThread)
 bool nmethod::can_not_entrant_be_converted() {
   assert(is_not_entrant(), "must be a non-entrant method");
 
   // Since the nmethod sweeper only does partial sweep the sweeper's traversal
   // count can be greater than the stack traversal count before it hits the
   // nmethod for the second time.
-  return stack_traversal_mark()+1 < NMethodSweeper::traversal_count();
+  return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() &&
+         !is_locked_by_vm();
 }
 
 void nmethod::inc_decompile_count() {
@@ -1294,6 +1317,7 @@
 // Common functionality for both make_not_entrant and make_zombie
 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
+  assert(!is_zombie(), "should not already be a zombie");
 
   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
   nmethodLocker nml(this);
@@ -1301,11 +1325,6 @@
   No_Safepoint_Verifier nsv;
 
   {
-    // If the method is already zombie there is nothing to do
-    if (is_zombie()) {
-      return false;
-    }
-
     // invalidate osr nmethod before acquiring the patching lock since
     // they both acquire leaf locks and we don't want a deadlock.
     // This logic is equivalent to the logic below for patching the
@@ -1375,13 +1394,12 @@
       flush_dependencies(NULL);
     }
 
-    {
-      // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event
-      // and it hasn't already been reported for this nmethod then report it now.
-      // (the event may have been reported earilier if the GC marked it for unloading).
-      Pause_No_Safepoint_Verifier pnsv(&nsv);
-      post_compiled_method_unload();
-    }
+    // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload
+    // event and it hasn't already been reported for this nmethod then
+    // report it now. The event may have been reported earilier if the GC
+    // marked it for unloading). JvmtiDeferredEventQueue support means
+    // we no longer go to a safepoint here.
+    post_compiled_method_unload();
 
 #ifdef ASSERT
     // It's no longer safe to access the oops section since zombie
@@ -1566,7 +1584,7 @@
   if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) {
     assert(!unload_reported(), "already unloaded");
     JvmtiDeferredEvent event =
-      JvmtiDeferredEvent::compiled_method_unload_event(
+      JvmtiDeferredEvent::compiled_method_unload_event(this,
           _jmethod_id, insts_begin());
     if (SafepointSynchronize::is_at_safepoint()) {
       // Don't want to take the queueing lock. Add it as pending and
@@ -1822,6 +1840,7 @@
     assert(cur != NULL, "not NULL-terminated");
     nmethod* next = cur->_oops_do_mark_link;
     cur->_oops_do_mark_link = NULL;
+    cur->fix_oop_relocations();
     NOT_PRODUCT(if (TraceScavenge)  cur->print_on(tty, "oops_do, unmark\n"));
     cur = next;
   }
@@ -1881,7 +1900,7 @@
 
 
 oop nmethod::embeddedOop_at(u_char* p) {
-  RelocIterator iter(this, p, p + oopSize);
+  RelocIterator iter(this, p, p + 1);
   while (iter.next())
     if (iter.type() == relocInfo::oop_type) {
       return iter.oop_reloc()->oop_value();
@@ -2171,10 +2190,12 @@
   lock_nmethod(_nm);
 }
 
-void nmethodLocker::lock_nmethod(nmethod* nm) {
+// Only JvmtiDeferredEvent::compiled_method_unload_event()
+// should pass zombie_ok == true.
+void nmethodLocker::lock_nmethod(nmethod* nm, bool zombie_ok) {
   if (nm == NULL)  return;
   Atomic::inc(&nm->_lock_count);
-  guarantee(!nm->is_zombie(), "cannot lock a zombie method");
+  guarantee(zombie_ok || !nm->is_zombie(), "cannot lock a zombie method");
 }
 
 void nmethodLocker::unlock_nmethod(nmethod* nm) {
--- a/hotspot/src/share/vm/code/nmethod.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -69,14 +69,13 @@
   friend class VMStructs;
  private:
   enum { cache_size = 4 };
-  PcDesc* _last_pc_desc;         // most recent pc_desc found
   PcDesc* _pc_descs[cache_size]; // last cache_size pc_descs found
  public:
-  PcDescCache() { debug_only(_last_pc_desc = NULL); }
+  PcDescCache() { debug_only(_pc_descs[0] = NULL); }
   void    reset_to(PcDesc* initial_pc_desc);
   PcDesc* find_pc_desc(int pc_offset, bool approximate);
   void    add_pc_desc(PcDesc* pc_desc);
-  PcDesc* last_pc_desc() { return _last_pc_desc; }
+  PcDesc* last_pc_desc() { return _pc_descs[0]; }
 };
 
 
@@ -178,7 +177,7 @@
   unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes?
 
   // Protected by Patching_lock
-  unsigned char _state;                      // {alive, not_entrant, zombie, unloaded)
+  unsigned char _state;                      // {alive, not_entrant, zombie, unloaded}
 
 #ifdef ASSERT
   bool _oops_are_stale;  // indicates that it's no longer safe to access oops section
@@ -194,7 +193,10 @@
 
   NOT_PRODUCT(bool _has_debug_info; )
 
-  // Nmethod Flushing lock (if non-zero, then the nmethod is not removed)
+  // Nmethod Flushing lock. If non-zero, then the nmethod is not removed
+  // and is not made into a zombie. However, once the nmethod is made into
+  // a zombie, it will be locked one final time if CompiledMethodUnload
+  // event processing needs to be done.
   jint  _lock_count;
 
   // not_entrant method removal. Each mark_sweep pass will update
@@ -457,6 +459,7 @@
 public:
   void fix_oop_relocations(address begin, address end) { fix_oop_relocations(begin, end, false); }
   void fix_oop_relocations()                           { fix_oop_relocations(NULL, NULL, false); }
+  void verify_oop_relocations();
 
   bool is_at_poll_return(address pc);
   bool is_at_poll_or_poll_return(address pc);
@@ -522,8 +525,9 @@
   void flush();
 
  public:
-  // If returning true, it is unsafe to remove this nmethod even though it is a zombie
-  // nmethod, since the VM might have a reference to it. Should only be called from a  safepoint.
+  // When true is returned, it is unsafe to remove this nmethod even if
+  // it is a zombie, since the VM or the ServiceThread might still be
+  // using it.
   bool is_locked_by_vm() const                    { return _lock_count >0; }
 
   // See comment at definition of _last_seen_on_stack
@@ -689,13 +693,20 @@
 
 };
 
-// Locks an nmethod so its code will not get removed, even if it is a zombie/not_entrant method
+// Locks an nmethod so its code will not get removed and it will not
+// be made into a zombie, even if it is a not_entrant method. After the
+// nmethod becomes a zombie, if CompiledMethodUnload event processing
+// needs to be done, then lock_nmethod() is used directly to keep the
+// generated code from being reused too early.
 class nmethodLocker : public StackObj {
   nmethod* _nm;
 
  public:
 
-  static void lock_nmethod(nmethod* nm);   // note: nm can be NULL
+  // note: nm can be NULL
+  // Only JvmtiDeferredEvent::compiled_method_unload_event()
+  // should pass zombie_ok == true.
+  static void lock_nmethod(nmethod* nm, bool zombie_ok = false);
   static void unlock_nmethod(nmethod* nm); // (ditto)
 
   nmethodLocker(address pc); // derive nm from pc
--- a/hotspot/src/share/vm/code/relocInfo.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -798,6 +798,14 @@
 }
 
 
+void oop_Relocation::verify_oop_relocation() {
+  if (!oop_is_immediate()) {
+    // get the oop from the pool, and re-insert it into the instruction:
+    verify_value(value());
+  }
+}
+
+
 RelocIterator virtual_call_Relocation::parse_ic(nmethod* &nm, address &ic_call, address &first_oop,
                                                 oop* &oop_addr, bool *is_optimized) {
   assert(ic_call != NULL, "ic_call address must be set");
--- a/hotspot/src/share/vm/code/relocInfo.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/code/relocInfo.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -765,7 +765,8 @@
 
  protected:
   // platform-dependent utilities for decoding and patching instructions
-  void       pd_set_data_value       (address x, intptr_t off); // a set or mem-ref
+  void       pd_set_data_value       (address x, intptr_t off, bool verify_only = false); // a set or mem-ref
+  void       pd_verify_data_value    (address x, intptr_t off) { pd_set_data_value(x, off, true); }
   address    pd_call_destination     (address orig_addr = NULL);
   void       pd_set_call_destination (address x);
   void       pd_swap_in_breakpoint   (address x, short* instrs, int instrlen);
@@ -880,6 +881,12 @@
     else
       pd_set_data_value(x, o);
   }
+  void        verify_value(address x) {
+    if (addr_in_const())
+      assert(*(address*)addr() == x, "must agree");
+    else
+      pd_verify_data_value(x, offset());
+  }
 
   // The "o" (displacement) argument is relevant only to split relocations
   // on RISC machines.  In some CPUs (SPARC), the set-hi and set-lo ins'ns
@@ -950,6 +957,8 @@
 
   void fix_oop_relocation();        // reasserts oop value
 
+  void verify_oop_relocation();
+
   address value()  { return (address) *oop_addr(); }
 
   bool oop_is_immediate()  { return oop_index() == 0; }
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1364,7 +1364,7 @@
       // We need this HandleMark to avoid leaking VM handles.
       HandleMark hm(thread);
 
-      if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) {
+      if (CodeCache::largest_free_block() < CodeCacheMinimumFreeSpace) {
         // the code cache is really full
         handle_full_code_cache();
       } else if (UseCodeCacheFlushing && CodeCache::needs_flushing()) {
@@ -1645,11 +1645,13 @@
   if (UseCompiler || AlwaysCompileLoopMethods ) {
     if (xtty != NULL) {
       xtty->begin_elem("code_cache_full");
+      CodeCache::log_state(xtty);
       xtty->stamp();
       xtty->end_elem();
     }
     warning("CodeCache is full. Compiler has been disabled.");
     warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
+    CodeCache::print_bounds(tty);
 #ifndef PRODUCT
     if (CompileTheWorld || ExitOnFullCodeCache) {
       before_exit(JavaThread::current());
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -292,13 +292,15 @@
 void CMSCollector::ref_processor_init() {
   if (_ref_processor == NULL) {
     // Allocate and initialize a reference processor
-    _ref_processor = ReferenceProcessor::create_ref_processor(
-        _span,                               // span
-        _cmsGen->refs_discovery_is_atomic(), // atomic_discovery
-        _cmsGen->refs_discovery_is_mt(),     // mt_discovery
-        &_is_alive_closure,
-        ParallelGCThreads,
-        ParallelRefProcEnabled);
+    _ref_processor =
+      new ReferenceProcessor(_span,                               // span
+                             (ParallelGCThreads > 1) && ParallelRefProcEnabled, // mt processing
+                             (int) ParallelGCThreads,             // mt processing degree
+                             _cmsGen->refs_discovery_is_mt(),     // mt discovery
+                             (int) MAX2(ConcGCThreads, ParallelGCThreads), // mt discovery degree
+                             _cmsGen->refs_discovery_is_atomic(), // discovery is not atomic
+                             &_is_alive_closure,                  // closure for liveness info
+                             false);                              // next field updates do not need write barrier
     // Initialize the _ref_processor field of CMSGen
     _cmsGen->set_ref_processor(_ref_processor);
 
@@ -641,7 +643,7 @@
   }
 
   // Support for multi-threaded concurrent phases
-  if (CollectedHeap::use_parallel_gc_threads() && CMSConcurrentMTEnabled) {
+  if (CMSConcurrentMTEnabled) {
     if (FLAG_IS_DEFAULT(ConcGCThreads)) {
       // just for now
       FLAG_SET_DEFAULT(ConcGCThreads, (ParallelGCThreads + 3)/4);
@@ -1689,6 +1691,8 @@
     MutexLockerEx y(CGC_lock, Mutex::_no_safepoint_check_flag);
     _full_gc_requested = true;
     CGC_lock->notify();   // nudge CMS thread
+  } else {
+    assert(gc_count > full_gc_count, "Error: causal loop");
   }
 }
 
@@ -1988,17 +1992,16 @@
   // Temporarily widen the span of the weak reference processing to
   // the entire heap.
   MemRegion new_span(GenCollectedHeap::heap()->reserved_region());
-  ReferenceProcessorSpanMutator x(ref_processor(), new_span);
-
+  ReferenceProcessorSpanMutator rp_mut_span(ref_processor(), new_span);
   // Temporarily, clear the "is_alive_non_header" field of the
   // reference processor.
-  ReferenceProcessorIsAliveMutator y(ref_processor(), NULL);
-
+  ReferenceProcessorIsAliveMutator rp_mut_closure(ref_processor(), NULL);
   // Temporarily make reference _processing_ single threaded (non-MT).
-  ReferenceProcessorMTProcMutator z(ref_processor(), false);
-
+  ReferenceProcessorMTProcMutator rp_mut_mt_processing(ref_processor(), false);
   // Temporarily make refs discovery atomic
-  ReferenceProcessorAtomicMutator w(ref_processor(), true);
+  ReferenceProcessorAtomicMutator rp_mut_atomic(ref_processor(), true);
+  // Temporarily make reference _discovery_ single threaded (non-MT)
+  ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false);
 
   ref_processor()->set_enqueuing_is_done(false);
   ref_processor()->enable_discovery();
@@ -4263,9 +4266,7 @@
 
   // Refs discovery is already non-atomic.
   assert(!ref_processor()->discovery_is_atomic(), "Should be non-atomic");
-  // Mutate the Refs discovery so it is MT during the
-  // multi-threaded marking phase.
-  ReferenceProcessorMTMutator mt(ref_processor(), num_workers > 1);
+  assert(ref_processor()->discovery_is_mt(), "Discovery should be MT");
   DEBUG_ONLY(RememberKlassesChecker cmx(should_unload_classes());)
   conc_workers()->start_task(&tsk);
   while (tsk.yielded()) {
@@ -4318,6 +4319,8 @@
   ResourceMark rm;
   HandleMark   hm;
 
+  // Temporarily make refs discovery single threaded (non-MT)
+  ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false);
   MarkFromRootsClosure markFromRootsClosure(this, _span, &_markBitMap,
     &_markStack, &_revisitStack, CMSYield && asynch);
   // the last argument to iterate indicates whether the iteration
@@ -4356,10 +4359,6 @@
   verify_overflow_empty();
   _abort_preclean = false;
   if (CMSPrecleaningEnabled) {
-    // Precleaning is currently not MT but the reference processor
-    // may be set for MT.  Disable it temporarily here.
-    ReferenceProcessor* rp = ref_processor();
-    ReferenceProcessorMTProcMutator z(rp, false);
     _eden_chunk_index = 0;
     size_t used = get_eden_used();
     size_t capacity = get_eden_capacity();
@@ -4502,11 +4501,16 @@
          _collectorState == AbortablePreclean, "incorrect state");
   ResourceMark rm;
   HandleMark   hm;
+
+  // Precleaning is currently not MT but the reference processor
+  // may be set for MT.  Disable it temporarily here.
+  ReferenceProcessor* rp = ref_processor();
+  ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(rp, false);
+
   // Do one pass of scrubbing the discovered reference lists
   // to remove any reference objects with strongly-reachable
   // referents.
   if (clean_refs) {
-    ReferenceProcessor* rp = ref_processor();
     CMSPrecleanRefsYieldClosure yield_cl(this);
     assert(rp->span().equals(_span), "Spans should be equal");
     CMSKeepAliveClosure keep_alive(this, _span, &_markBitMap,
@@ -5576,8 +5580,10 @@
   // in the multi-threaded case, but we special-case n=1 here to get
   // repeatable measurements of the 1-thread overhead of the parallel code.
   if (n_workers > 1) {
-    // Make refs discovery MT-safe
-    ReferenceProcessorMTMutator mt(ref_processor(), true);
+    // Make refs discovery MT-safe, if it isn't already: it may not
+    // necessarily be so, since it's possible that we are doing
+    // ST marking.
+    ReferenceProcessorMTDiscoveryMutator mt(ref_processor(), true);
     GenCollectedHeap::StrongRootsScope srs(gch);
     workers->run_task(&tsk);
   } else {
@@ -5703,14 +5709,19 @@
                       CMSBitMap*       mark_bit_map,
                       AbstractWorkGang* workers,
                       OopTaskQueueSet* task_queues):
+    // XXX Should superclass AGTWOQ also know about AWG since it knows
+    // about the task_queues used by the AWG? Then it could initialize
+    // the terminator() object. See 6984287. The set_for_termination()
+    // below is a temporary band-aid for the regression in 6984287.
     AbstractGangTaskWOopQueues("Process referents by policy in parallel",
       task_queues),
     _task(task),
     _collector(collector), _span(span), _mark_bit_map(mark_bit_map)
-    {
-      assert(_collector->_span.equals(_span) && !_span.is_empty(),
-             "Inconsistency in _span");
-    }
+  {
+    assert(_collector->_span.equals(_span) && !_span.is_empty(),
+           "Inconsistency in _span");
+    set_for_termination(workers->active_workers());
+  }
 
   OopTaskQueueSet* task_queues() { return queues(); }
 
@@ -5872,8 +5883,7 @@
       // That is OK as long as the Reference lists are balanced (see
       // balance_all_queues() and balance_queues()).
 
-
-      rp->set_mt_degree(ParallelGCThreads);
+      rp->set_active_mt_degree(ParallelGCThreads);
       CMSRefProcTaskExecutor task_executor(*this);
       rp->process_discovered_references(&_is_alive_closure,
                                         &cmsKeepAliveClosure,
@@ -5920,14 +5930,18 @@
     }
 
     {
-      TraceTime t("scrub symbol & string tables", PrintGCDetails, false, gclog_or_tty);
-      // Now clean up stale oops in StringTable
-      StringTable::unlink(&_is_alive_closure);
+      TraceTime t("scrub symbol table", PrintGCDetails, false, gclog_or_tty);
       // Clean up unreferenced symbols in symbol table.
       SymbolTable::unlink();
     }
   }
 
+  if (should_unload_classes() || !JavaObjectsInPerm) {
+    TraceTime t("scrub string table", PrintGCDetails, false, gclog_or_tty);
+    // Now clean up stale oops in StringTable
+    StringTable::unlink(&_is_alive_closure);
+  }
+
   verify_work_stacks_empty();
   // Restore any preserved marks as a result of mark stack or
   // work queue overflow
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -1133,7 +1133,7 @@
     // rare that the cost of the CAS's involved is in the
     // noise. That's a measurement that should be done, and
     // the code simplified if that turns out to be the case.
-    return false;
+    return ConcGCThreads > 1;
   }
 
   // Override
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -51,7 +51,7 @@
 volatile jint ConcurrentMarkSweepThread::_pending_yields      = 0;
 volatile jint ConcurrentMarkSweepThread::_pending_decrements  = 0;
 
-volatile bool ConcurrentMarkSweepThread::_icms_enabled   = false;
+volatile jint ConcurrentMarkSweepThread::_icms_disabled   = 0;
 volatile bool ConcurrentMarkSweepThread::_should_run     = false;
 // When icms is enabled, the icms thread is stopped until explicitly
 // started.
@@ -84,7 +84,7 @@
     }
   }
   _sltMonitor = SLT_lock;
-  set_icms_enabled(CMSIncrementalMode);
+  assert(!CMSIncrementalMode || icms_is_enabled(), "Error");
 }
 
 void ConcurrentMarkSweepThread::run() {
@@ -341,11 +341,11 @@
 
 void ConcurrentMarkSweepThread::icms_wait() {
   assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  if (_should_stop && icms_enabled()) {
+  if (_should_stop && icms_is_enabled()) {
     MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
     trace_state("pause_icms");
     _collector->stats().stop_cms_timer();
-    while(!_should_run && icms_enabled()) {
+    while(!_should_run && icms_is_enabled()) {
       iCMS_lock->wait(Mutex::_no_safepoint_check_flag);
     }
     _collector->stats().start_cms_timer();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -40,7 +40,7 @@
 class ConcurrentMarkSweepGeneration;
 class CMSCollector;
 
-// The Concurrent Mark Sweep GC Thread (could be several in the future).
+// The Concurrent Mark Sweep GC Thread
 class ConcurrentMarkSweepThread: public ConcurrentGCThread {
   friend class VMStructs;
   friend class ConcurrentMarkSweepGeneration;   // XXX should remove friendship
@@ -55,8 +55,6 @@
   static SurrogateLockerThread::SLT_msg_type _sltBuffer;
   static Monitor*                       _sltMonitor;
 
-  ConcurrentMarkSweepThread*            _next;
-
   static bool _should_terminate;
 
   enum CMS_flag_type {
@@ -84,7 +82,7 @@
   // Tracing messages, enabled by CMSTraceThreadState.
   static inline void trace_state(const char* desc);
 
-  static volatile bool _icms_enabled;   // iCMS enabled?
+  static volatile int _icms_disabled;   // a counter to track #iCMS disable & enable
   static volatile bool _should_run;     // iCMS may run
   static volatile bool _should_stop;    // iCMS should stop
 
@@ -214,10 +212,25 @@
 
   // Incremental mode is enabled globally by the flag CMSIncrementalMode.  It
   // must also be enabled/disabled dynamically to allow foreground collections.
-  static inline void enable_icms()              { _icms_enabled = true; }
-  static inline void disable_icms()             { _icms_enabled = false; }
-  static inline void set_icms_enabled(bool val) { _icms_enabled = val; }
-  static inline bool icms_enabled()             { return _icms_enabled; }
+#define ICMS_ENABLING_ASSERT                                                      \
+          assert((CMSIncrementalMode  && _icms_disabled >= 0) ||                  \
+                 (!CMSIncrementalMode && _icms_disabled <= 0), "Error")
+
+  static inline void enable_icms() {
+    ICMS_ENABLING_ASSERT;
+    Atomic::dec(&_icms_disabled);
+  }
+  static inline void disable_icms() {
+   ICMS_ENABLING_ASSERT;
+   Atomic::inc(&_icms_disabled);
+  }
+  static inline bool icms_is_disabled() {
+   ICMS_ENABLING_ASSERT;
+   return _icms_disabled > 0;
+  }
+  static inline bool icms_is_enabled() {
+   return !icms_is_disabled();
+  }
 };
 
 inline void ConcurrentMarkSweepThread::trace_state(const char* desc) {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -192,14 +192,18 @@
          "total_collections() should be monotonically increasing");
 
   MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+  assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
   if (gch->total_full_collections() == _full_gc_count_before) {
-    // Disable iCMS until the full collection is done.
+    // Disable iCMS until the full collection is done, and
+    // remember that we did so.
     CMSCollector::disable_icms();
+    _disabled_icms = true;
     // In case CMS thread was in icms_wait(), wake it up.
     CMSCollector::start_icms();
     // Nudge the CMS thread to start a concurrent collection.
     CMSCollector::request_full_gc(_full_gc_count_before);
   } else {
+    assert(_full_gc_count_before < gch->total_full_collections(), "Error");
     FullGCCount_lock->notify_all();  // Inform the Java thread its work is done
   }
 }
@@ -259,6 +263,8 @@
       FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
     }
   }
-  // Enable iCMS back.
-  CMSCollector::enable_icms();
+  // Enable iCMS back if we disabled it earlier.
+  if (_disabled_icms) {
+    CMSCollector::enable_icms();
+  }
 }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -128,11 +128,14 @@
 // VM operation to invoke a concurrent collection of the heap as a
 // GenCollectedHeap heap.
 class VM_GenCollectFullConcurrent: public VM_GC_Operation {
+  bool _disabled_icms;
  public:
   VM_GenCollectFullConcurrent(unsigned int gc_count_before,
                               unsigned int full_gc_count_before,
                               GCCause::Cause gc_cause)
-    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */) {
+    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
+      _disabled_icms(false)
+  {
     assert(FullGCCount_lock != NULL, "Error");
     assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -373,7 +373,7 @@
             // RSet updating while within an evacuation pause.
             // In this case worker_i should be the id of a GC worker thread
             assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause");
-            assert(worker_i < (int) DirtyCardQueueSet::num_par_ids(), "incorrect worker id");
+            assert(worker_i < (int) (ParallelGCThreads == 0 ? 1 : ParallelGCThreads), "incorrect worker id");
             into_cset_dcq->enqueue(entry);
           }
         }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1828,7 +1828,7 @@
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   _cleanup_list.verify_optional();
-  FreeRegionList local_free_list("Local Cleanup List");
+  FreeRegionList tmp_free_list("Tmp Free List");
 
   if (G1ConcRegionFreeingVerbose) {
     gclog_or_tty->print_cr("G1ConcRegionFreeing [complete cleanup] : "
@@ -1842,7 +1842,7 @@
     HeapRegion* hr = _cleanup_list.remove_head();
     assert(hr != NULL, "the list was not empty");
     hr->rem_set()->clear();
-    local_free_list.add_as_tail(hr);
+    tmp_free_list.add_as_tail(hr);
 
     // Instead of adding one region at a time to the secondary_free_list,
     // we accumulate them in the local list and move them a few at a
@@ -1850,20 +1850,20 @@
     // we do during this process. We'll also append the local list when
     // _cleanup_list is empty (which means we just removed the last
     // region from the _cleanup_list).
-    if ((local_free_list.length() % G1SecondaryFreeListAppendLength == 0) ||
+    if ((tmp_free_list.length() % G1SecondaryFreeListAppendLength == 0) ||
         _cleanup_list.is_empty()) {
       if (G1ConcRegionFreeingVerbose) {
         gclog_or_tty->print_cr("G1ConcRegionFreeing [complete cleanup] : "
                                "appending "SIZE_FORMAT" entries to the "
                                "secondary_free_list, clean list still has "
                                SIZE_FORMAT" entries",
-                               local_free_list.length(),
+                               tmp_free_list.length(),
                                _cleanup_list.length());
       }
 
       {
         MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
-        g1h->secondary_free_list_add_as_tail(&local_free_list);
+        g1h->secondary_free_list_add_as_tail(&tmp_free_list);
         SecondaryFreeList_lock->notify_all();
       }
 
@@ -1874,7 +1874,7 @@
       }
     }
   }
-  assert(local_free_list.is_empty(), "post-condition");
+  assert(tmp_free_list.is_empty(), "post-condition");
 }
 
 // Support closures for reference procssing in G1
@@ -2141,21 +2141,22 @@
   G1CMKeepAliveClosure g1_keep_alive(g1h, this, nextMarkBitMap());
   G1CMDrainMarkingStackClosure
     g1_drain_mark_stack(nextMarkBitMap(), &_markStack, &g1_keep_alive);
-
   // We use the work gang from the G1CollectedHeap and we utilize all
   // the worker threads.
-  int active_workers = MAX2(MIN2(g1h->workers()->total_workers(), (int)_max_task_num), 1);
+  int active_workers = g1h->workers() ? g1h->workers()->total_workers() : 1;
+  active_workers = MAX2(MIN2(active_workers, (int)_max_task_num), 1);
 
   G1RefProcTaskExecutor par_task_executor(g1h, this, nextMarkBitMap(),
                                           g1h->workers(), active_workers);
 
+
   if (rp->processing_is_mt()) {
     // Set the degree of MT here.  If the discovery is done MT, there
     // may have been a different number of threads doing the discovery
     // and a different number of discovered lists may have Ref objects.
     // That is OK as long as the Reference lists are balanced (see
     // balance_all_queues() and balance_queues()).
-    rp->set_mt_degree(active_workers);
+    rp->set_active_mt_degree(active_workers);
 
     rp->process_discovered_references(&g1_is_alive,
                                       &g1_keep_alive,
@@ -3182,7 +3183,7 @@
 
   template <class T> void do_oop_work(T* p) {
     assert( _g1h->is_in_g1_reserved((HeapWord*) p), "invariant");
-    assert(!_g1h->is_on_free_list(
+    assert(!_g1h->is_on_master_free_list(
                     _g1h->heap_region_containing((HeapWord*) p)), "invariant");
 
     oop obj = oopDesc::load_decode_heap_oop(p);
@@ -3403,7 +3404,7 @@
 void CMTask::push(oop obj) {
   HeapWord* objAddr = (HeapWord*) obj;
   assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
-  assert(!_g1h->is_on_free_list(
+  assert(!_g1h->is_on_master_free_list(
               _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
   assert(!_g1h->is_obj_ill(obj), "invariant");
   assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
@@ -3649,7 +3650,7 @@
                                (void*) obj);
 
       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );
-      assert(!_g1h->is_on_free_list(
+      assert(!_g1h->is_on_master_free_list(
                   _g1h->heap_region_containing((HeapWord*) obj)), "invariant");
 
       scan_object(obj);
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -237,9 +237,9 @@
         // The following will finish freeing up any regions that we
         // found to be empty during cleanup. We'll do this part
         // without joining the suspendible set. If an evacuation pause
-        // takes places, then we would carry on freeing regions in
+        // takes place, then we would carry on freeing regions in
         // case they are needed by the pause. If a Full GC takes
-        // places, it would wait for us to process the regions
+        // place, it would wait for us to process the regions
         // reclaimed by cleanup.
 
         double cleanup_start_sec = os::elapsedTime();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -479,7 +479,7 @@
 // Private methods.
 
 HeapRegion*
-G1CollectedHeap::new_region_try_secondary_free_list(size_t word_size) {
+G1CollectedHeap::new_region_try_secondary_free_list() {
   MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
   while (!_secondary_free_list.is_empty() || free_regions_coming()) {
     if (!_secondary_free_list.is_empty()) {
@@ -531,7 +531,7 @@
         gclog_or_tty->print_cr("G1ConcRegionFreeing [region alloc] : "
                                "forced to look at the secondary_free_list");
       }
-      res = new_region_try_secondary_free_list(word_size);
+      res = new_region_try_secondary_free_list();
       if (res != NULL) {
         return res;
       }
@@ -543,7 +543,7 @@
       gclog_or_tty->print_cr("G1ConcRegionFreeing [region alloc] : "
                              "res == NULL, trying the secondary_free_list");
     }
-    res = new_region_try_secondary_free_list(word_size);
+    res = new_region_try_secondary_free_list();
   }
   if (res == NULL && do_expand) {
     if (expand(word_size * HeapWordSize)) {
@@ -579,6 +579,9 @@
 
 int G1CollectedHeap::humongous_obj_allocate_find_first(size_t num_regions,
                                                        size_t word_size) {
+  assert(isHumongous(word_size), "word_size should be humongous");
+  assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
+
   int first = -1;
   if (num_regions == 1) {
     // Only one region to allocate, no need to go through the slower
@@ -600,7 +603,7 @@
     // request. If we are only allocating one region we use the common
     // region allocation code (see above).
     wait_while_free_regions_coming();
-    append_secondary_free_list_if_not_empty();
+    append_secondary_free_list_if_not_empty_with_lock();
 
     if (free_regions() >= num_regions) {
       first = _hrs->find_contiguous(num_regions);
@@ -608,7 +611,7 @@
         for (int i = first; i < first + (int) num_regions; ++i) {
           HeapRegion* hr = _hrs->at(i);
           assert(hr->is_empty(), "sanity");
-          assert(is_on_free_list(hr), "sanity");
+          assert(is_on_master_free_list(hr), "sanity");
           hr->set_pending_removal(true);
         }
         _free_list.remove_all_pending(num_regions);
@@ -618,6 +621,126 @@
   return first;
 }
 
+HeapWord*
+G1CollectedHeap::humongous_obj_allocate_initialize_regions(int first,
+                                                           size_t num_regions,
+                                                           size_t word_size) {
+  assert(first != -1, "pre-condition");
+  assert(isHumongous(word_size), "word_size should be humongous");
+  assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
+
+  // Index of last region in the series + 1.
+  int last = first + (int) num_regions;
+
+  // We need to initialize the region(s) we just discovered. This is
+  // a bit tricky given that it can happen concurrently with
+  // refinement threads refining cards on these regions and
+  // potentially wanting to refine the BOT as they are scanning
+  // those cards (this can happen shortly after a cleanup; see CR
+  // 6991377). So we have to set up the region(s) carefully and in
+  // a specific order.
+
+  // The word size sum of all the regions we will allocate.
+  size_t word_size_sum = num_regions * HeapRegion::GrainWords;
+  assert(word_size <= word_size_sum, "sanity");
+
+  // This will be the "starts humongous" region.
+  HeapRegion* first_hr = _hrs->at(first);
+  // The header of the new object will be placed at the bottom of
+  // the first region.
+  HeapWord* new_obj = first_hr->bottom();
+  // This will be the new end of the first region in the series that
+  // should also match the end of the last region in the seriers.
+  HeapWord* new_end = new_obj + word_size_sum;
+  // This will be the new top of the first region that will reflect
+  // this allocation.
+  HeapWord* new_top = new_obj + word_size;
+
+  // First, we need to zero the header of the space that we will be
+  // allocating. When we update top further down, some refinement
+  // threads might try to scan the region. By zeroing the header we
+  // ensure that any thread that will try to scan the region will
+  // come across the zero klass word and bail out.
+  //
+  // NOTE: It would not have been correct to have used
+  // CollectedHeap::fill_with_object() and make the space look like
+  // an int array. The thread that is doing the allocation will
+  // later update the object header to a potentially different array
+  // type and, for a very short period of time, the klass and length
+  // fields will be inconsistent. This could cause a refinement
+  // thread to calculate the object size incorrectly.
+  Copy::fill_to_words(new_obj, oopDesc::header_size(), 0);
+
+  // We will set up the first region as "starts humongous". This
+  // will also update the BOT covering all the regions to reflect
+  // that there is a single object that starts at the bottom of the
+  // first region.
+  first_hr->set_startsHumongous(new_top, new_end);
+
+  // Then, if there are any, we will set up the "continues
+  // humongous" regions.
+  HeapRegion* hr = NULL;
+  for (int i = first + 1; i < last; ++i) {
+    hr = _hrs->at(i);
+    hr->set_continuesHumongous(first_hr);
+  }
+  // If we have "continues humongous" regions (hr != NULL), then the
+  // end of the last one should match new_end.
+  assert(hr == NULL || hr->end() == new_end, "sanity");
+
+  // Up to this point no concurrent thread would have been able to
+  // do any scanning on any region in this series. All the top
+  // fields still point to bottom, so the intersection between
+  // [bottom,top] and [card_start,card_end] will be empty. Before we
+  // update the top fields, we'll do a storestore to make sure that
+  // no thread sees the update to top before the zeroing of the
+  // object header and the BOT initialization.
+  OrderAccess::storestore();
+
+  // Now that the BOT and the object header have been initialized,
+  // we can update top of the "starts humongous" region.
+  assert(first_hr->bottom() < new_top && new_top <= first_hr->end(),
+         "new_top should be in this region");
+  first_hr->set_top(new_top);
+
+  // Now, we will update the top fields of the "continues humongous"
+  // regions. The reason we need to do this is that, otherwise,
+  // these regions would look empty and this will confuse parts of
+  // G1. For example, the code that looks for a consecutive number
+  // of empty regions will consider them empty and try to
+  // re-allocate them. We can extend is_empty() to also include
+  // !continuesHumongous(), but it is easier to just update the top
+  // fields here. The way we set top for all regions (i.e., top ==
+  // end for all regions but the last one, top == new_top for the
+  // last one) is actually used when we will free up the humongous
+  // region in free_humongous_region().
+  hr = NULL;
+  for (int i = first + 1; i < last; ++i) {
+    hr = _hrs->at(i);
+    if ((i + 1) == last) {
+      // last continues humongous region
+      assert(hr->bottom() < new_top && new_top <= hr->end(),
+             "new_top should fall on this region");
+      hr->set_top(new_top);
+    } else {
+      // not last one
+      assert(new_top > hr->end(), "new_top should be above this region");
+      hr->set_top(hr->end());
+    }
+  }
+  // If we have continues humongous regions (hr != NULL), then the
+  // end of the last one should match new_end and its top should
+  // match new_top.
+  assert(hr == NULL ||
+         (hr->end() == new_end && hr->top() == new_top), "sanity");
+
+  assert(first_hr->used() == word_size * HeapWordSize, "invariant");
+  _summary_bytes_used += first_hr->used();
+  _humongous_set.add(first_hr);
+
+  return new_obj;
+}
+
 // If could fit into free regions w/o expansion, try.
 // Otherwise, if can expand, do so.
 // Otherwise, if using ex regions might help, try with ex given back.
@@ -653,121 +776,16 @@
     }
   }
 
+  HeapWord* result = NULL;
   if (first != -1) {
-    // Index of last region in the series + 1.
-    int last = first + (int) num_regions;
-
-    // We need to initialize the region(s) we just discovered. This is
-    // a bit tricky given that it can happen concurrently with
-    // refinement threads refining cards on these regions and
-    // potentially wanting to refine the BOT as they are scanning
-    // those cards (this can happen shortly after a cleanup; see CR
-    // 6991377). So we have to set up the region(s) carefully and in
-    // a specific order.
-
-    // The word size sum of all the regions we will allocate.
-    size_t word_size_sum = num_regions * HeapRegion::GrainWords;
-    assert(word_size <= word_size_sum, "sanity");
-
-    // This will be the "starts humongous" region.
-    HeapRegion* first_hr = _hrs->at(first);
-    // The header of the new object will be placed at the bottom of
-    // the first region.
-    HeapWord* new_obj = first_hr->bottom();
-    // This will be the new end of the first region in the series that
-    // should also match the end of the last region in the seriers.
-    HeapWord* new_end = new_obj + word_size_sum;
-    // This will be the new top of the first region that will reflect
-    // this allocation.
-    HeapWord* new_top = new_obj + word_size;
-
-    // First, we need to zero the header of the space that we will be
-    // allocating. When we update top further down, some refinement
-    // threads might try to scan the region. By zeroing the header we
-    // ensure that any thread that will try to scan the region will
-    // come across the zero klass word and bail out.
-    //
-    // NOTE: It would not have been correct to have used
-    // CollectedHeap::fill_with_object() and make the space look like
-    // an int array. The thread that is doing the allocation will
-    // later update the object header to a potentially different array
-    // type and, for a very short period of time, the klass and length
-    // fields will be inconsistent. This could cause a refinement
-    // thread to calculate the object size incorrectly.
-    Copy::fill_to_words(new_obj, oopDesc::header_size(), 0);
-
-    // We will set up the first region as "starts humongous". This
-    // will also update the BOT covering all the regions to reflect
-    // that there is a single object that starts at the bottom of the
-    // first region.
-    first_hr->set_startsHumongous(new_top, new_end);
-
-    // Then, if there are any, we will set up the "continues
-    // humongous" regions.
-    HeapRegion* hr = NULL;
-    for (int i = first + 1; i < last; ++i) {
-      hr = _hrs->at(i);
-      hr->set_continuesHumongous(first_hr);
-    }
-    // If we have "continues humongous" regions (hr != NULL), then the
-    // end of the last one should match new_end.
-    assert(hr == NULL || hr->end() == new_end, "sanity");
-
-    // Up to this point no concurrent thread would have been able to
-    // do any scanning on any region in this series. All the top
-    // fields still point to bottom, so the intersection between
-    // [bottom,top] and [card_start,card_end] will be empty. Before we
-    // update the top fields, we'll do a storestore to make sure that
-    // no thread sees the update to top before the zeroing of the
-    // object header and the BOT initialization.
-    OrderAccess::storestore();
-
-    // Now that the BOT and the object header have been initialized,
-    // we can update top of the "starts humongous" region.
-    assert(first_hr->bottom() < new_top && new_top <= first_hr->end(),
-           "new_top should be in this region");
-    first_hr->set_top(new_top);
-
-    // Now, we will update the top fields of the "continues humongous"
-    // regions. The reason we need to do this is that, otherwise,
-    // these regions would look empty and this will confuse parts of
-    // G1. For example, the code that looks for a consecutive number
-    // of empty regions will consider them empty and try to
-    // re-allocate them. We can extend is_empty() to also include
-    // !continuesHumongous(), but it is easier to just update the top
-    // fields here. The way we set top for all regions (i.e., top ==
-    // end for all regions but the last one, top == new_top for the
-    // last one) is actually used when we will free up the humongous
-    // region in free_humongous_region().
-    hr = NULL;
-    for (int i = first + 1; i < last; ++i) {
-      hr = _hrs->at(i);
-      if ((i + 1) == last) {
-        // last continues humongous region
-        assert(hr->bottom() < new_top && new_top <= hr->end(),
-               "new_top should fall on this region");
-        hr->set_top(new_top);
-      } else {
-        // not last one
-        assert(new_top > hr->end(), "new_top should be above this region");
-        hr->set_top(hr->end());
-      }
-    }
-    // If we have continues humongous regions (hr != NULL), then the
-    // end of the last one should match new_end and its top should
-    // match new_top.
-    assert(hr == NULL ||
-           (hr->end() == new_end && hr->top() == new_top), "sanity");
-
-    assert(first_hr->used() == word_size * HeapWordSize, "invariant");
-    _summary_bytes_used += first_hr->used();
-    _humongous_set.add(first_hr);
-
-    return new_obj;
+    result =
+      humongous_obj_allocate_initialize_regions(first, num_regions, word_size);
+    assert(result != NULL, "it should always return a valid result");
   }
 
   verify_region_sets_optional();
-  return NULL;
+
+  return result;
 }
 
 void
@@ -1389,7 +1407,7 @@
     g1_policy()->record_full_collection_start();
 
     wait_while_free_regions_coming();
-    append_secondary_free_list_if_not_empty();
+    append_secondary_free_list_if_not_empty_with_lock();
 
     gc_prologue(true);
     increment_total_collections(true /* full gc */);
@@ -1444,7 +1462,7 @@
     // how reference processing currently works in G1.
 
     // Temporarily make reference _discovery_ single threaded (non-MT).
-    ReferenceProcessorMTMutator rp_disc_ser(ref_processor(), false);
+    ReferenceProcessorMTDiscoveryMutator rp_disc_ser(ref_processor(), false);
 
     // Temporarily make refs discovery atomic
     ReferenceProcessorAtomicMutator rp_disc_atomic(ref_processor(), true);
@@ -2201,16 +2219,16 @@
 
   SharedHeap::ref_processing_init();
   MemRegion mr = reserved_region();
-  _ref_processor = ReferenceProcessor::create_ref_processor(
-                                         mr,    // span
-                                         false, // Reference discovery is not atomic
-                                         true,  // mt_discovery
-                                         &_is_alive_closure, // is alive closure
-                                                             // for efficiency
-                                         ParallelGCThreads,
-                                         ParallelRefProcEnabled,
-                                         true); // Setting next fields of discovered
-                                                // lists requires a barrier.
+  _ref_processor =
+    new ReferenceProcessor(mr,    // span
+                           ParallelRefProcEnabled && (ParallelGCThreads > 1),    // mt processing
+                           (int) ParallelGCThreads,   // degree of mt processing
+                           ParallelGCThreads > 1 || ConcGCThreads > 1,  // mt discovery
+                           (int) MAX2(ParallelGCThreads, ConcGCThreads), // degree of mt discovery
+                           false,                     // Reference discovery is not atomic
+                           &_is_alive_closure,        // is alive closure for efficiency
+                           true);                     // Setting next fields of discovered
+                                                      // lists requires a barrier.
 }
 
 size_t G1CollectedHeap::capacity() const {
@@ -3377,15 +3395,14 @@
 
     TraceMemoryManagerStats tms(false /* fullGC */);
 
-    // If there are any free regions available on the secondary_free_list
-    // make sure we append them to the free_list. However, we don't
-    // have to wait for the rest of the cleanup operation to
-    // finish. If it's still going on that's OK. If we run out of
-    // regions, the region allocation code will check the
-    // secondary_free_list and potentially wait if more free regions
-    // are coming (see new_region_try_secondary_free_list()).
+    // If the secondary_free_list is not empty, append it to the
+    // free_list. No need to wait for the cleanup operation to finish;
+    // the region allocation code will check the secondary_free_list
+    // and wait if necessary. If the G1StressConcRegionFreeing flag is
+    // set, skip this step so that the region allocation code has to
+    // get entries from the secondary_free_list.
     if (!G1StressConcRegionFreeing) {
-      append_secondary_free_list_if_not_empty();
+      append_secondary_free_list_if_not_empty_with_lock();
     }
 
     increment_gc_time_stamp();
@@ -5199,7 +5216,7 @@
   size_t rs_lengths = 0;
 
   while (cur != NULL) {
-    assert(!is_on_free_list(cur), "sanity");
+    assert(!is_on_master_free_list(cur), "sanity");
 
     if (non_young) {
       if (cur->is_young()) {
@@ -5543,13 +5560,10 @@
     return;
   }
 
-  {
-    MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
-    // Make sure we append the secondary_free_list on the free_list so
-    // that all free regions we will come across can be safely
-    // attributed to the free_list.
-    append_secondary_free_list();
-  }
+  // Make sure we append the secondary_free_list on the free_list so
+  // that all free regions we will come across can be safely
+  // attributed to the free_list.
+  append_secondary_free_list_if_not_empty_with_lock();
 
   // Finally, make sure that the region accounting in the lists is
   // consistent with what we see in the heap.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -56,7 +56,6 @@
 class ConcurrentMark;
 class ConcurrentMarkThread;
 class ConcurrentG1Refine;
-class ConcurrentZFThread;
 
 typedef OverflowTaskQueue<StarTask>         RefToScanQueue;
 typedef GenericTaskQueueSet<RefToScanQueue> RefToScanQueueSet;
@@ -64,12 +63,6 @@
 typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
 typedef int CardIdx_t;     // needs to hold [ 0..CardsPerRegion )
 
-enum G1GCThreadGroups {
-  G1CRGroup = 0,
-  G1ZFGroup = 1,
-  G1CMGroup = 2
-};
-
 enum GCAllocPurpose {
   GCAllocForTenured,
   GCAllocForSurvived,
@@ -294,9 +287,9 @@
   // These are macros so that, if the assert fires, we get the correct
   // line number, file, etc.
 
-#define heap_locking_asserts_err_msg(__extra_message)                         \
+#define heap_locking_asserts_err_msg(_extra_message_)                         \
   err_msg("%s : Heap_lock locked: %s, at safepoint: %s, is VM thread: %s",    \
-          (__extra_message),                                                  \
+          (_extra_message_),                                                  \
           BOOL_TO_STR(Heap_lock->owned_by_self()),                            \
           BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()),               \
           BOOL_TO_STR(Thread::current()->is_VM_thread()))
@@ -307,11 +300,11 @@
            heap_locking_asserts_err_msg("should be holding the Heap_lock"));  \
   } while (0)
 
-#define assert_heap_locked_or_at_safepoint(__should_be_vm_thread)             \
+#define assert_heap_locked_or_at_safepoint(_should_be_vm_thread_)             \
   do {                                                                        \
     assert(Heap_lock->owned_by_self() ||                                      \
            (SafepointSynchronize::is_at_safepoint() &&                        \
-             ((__should_be_vm_thread) == Thread::current()->is_VM_thread())), \
+             ((_should_be_vm_thread_) == Thread::current()->is_VM_thread())), \
            heap_locking_asserts_err_msg("should be holding the Heap_lock or " \
                                         "should be at a safepoint"));         \
   } while (0)
@@ -338,10 +331,10 @@
                                    "should not be at a safepoint"));          \
   } while (0)
 
-#define assert_at_safepoint(__should_be_vm_thread)                            \
+#define assert_at_safepoint(_should_be_vm_thread_)                            \
   do {                                                                        \
     assert(SafepointSynchronize::is_at_safepoint() &&                         \
-              ((__should_be_vm_thread) == Thread::current()->is_VM_thread()), \
+              ((_should_be_vm_thread_) == Thread::current()->is_VM_thread()), \
            heap_locking_asserts_err_msg("should be at a safepoint"));         \
   } while (0)
 
@@ -371,35 +364,40 @@
   // will check whether there's anything available in the
   // secondary_free_list and/or wait for more regions to appear in that
   // list, if _free_regions_coming is set.
-  HeapRegion* new_region_try_secondary_free_list(size_t word_size);
+  HeapRegion* new_region_try_secondary_free_list();
 
-  // It will try to allocate a single non-humongous HeapRegion
-  // sufficient for an allocation of the given word_size.  If
-  // do_expand is true, it will attempt to expand the heap if
-  // necessary to satisfy the allocation request. Note that word_size
-  // is only used to make sure that we expand sufficiently but, given
-  // that the allocation request is assumed not to be humongous,
-  // having word_size is not strictly necessary (expanding by a single
-  // region will always be sufficient). But let's keep that parameter
-  // in case we need it in the future.
+  // Try to allocate a single non-humongous HeapRegion sufficient for
+  // an allocation of the given word_size. If do_expand is true,
+  // attempt to expand the heap if necessary to satisfy the allocation
+  // request.
   HeapRegion* new_region_work(size_t word_size, bool do_expand);
 
-  // It will try to allocate a new region to be used for allocation by
-  // mutator threads. It will not try to expand the heap if not region
-  // is available.
+  // Try to allocate a new region to be used for allocation by a
+  // mutator thread. Attempt to expand the heap if no region is
+  // available.
   HeapRegion* new_alloc_region(size_t word_size) {
     return new_region_work(word_size, false /* do_expand */);
   }
 
-  // It will try to allocate a new region to be used for allocation by
-  // a GC thread. It will try to expand the heap if no region is
-  // available.
+  // Try to allocate a new region to be used for allocation by a GC
+  // thread. Attempt to expand the heap if no region is available.
   HeapRegion* new_gc_alloc_region(int purpose, size_t word_size);
 
+  // Attempt to satisfy a humongous allocation request of the given
+  // size by finding a contiguous set of free regions of num_regions
+  // length and remove them from the master free list. Return the
+  // index of the first region or -1 if the search was unsuccessful.
   int humongous_obj_allocate_find_first(size_t num_regions, size_t word_size);
 
-  // Attempt to allocate an object of the given (very large) "word_size".
-  // Returns "NULL" on failure.
+  // Initialize a contiguous set of free regions of length num_regions
+  // and starting at index first so that they appear as a single
+  // humongous region.
+  HeapWord* humongous_obj_allocate_initialize_regions(int first,
+                                                      size_t num_regions,
+                                                      size_t word_size);
+
+  // Attempt to allocate a humongous object of the given size. Return
+  // NULL if unsuccessful.
   HeapWord* humongous_obj_allocate(size_t word_size);
 
   // The following two methods, allocate_new_tlab() and
@@ -776,7 +774,7 @@
   // Invoke "save_marks" on all heap regions.
   void save_marks();
 
-  // It frees a non-humongous region by initializing its contents and
+  // Frees a non-humongous region by initializing its contents and
   // adding it to the free list that's passed as a parameter (this is
   // usually a local list which will be appended to the master free
   // list later). The used bytes of freed regions are accumulated in
@@ -787,13 +785,13 @@
                    FreeRegionList* free_list,
                    bool par);
 
-  // It frees a humongous region by collapsing it into individual
-  // regions and calling free_region() for each of them. The freed
-  // regions will be added to the free list that's passed as a parameter
-  // (this is usually a local list which will be appended to the
-  // master free list later). The used bytes of freed regions are
-  // accumulated in pre_used. If par is true, the region's RSet will
-  // not be freed up. The assumption is that this will be done later.
+  // Frees a humongous region by collapsing it into individual regions
+  // and calling free_region() for each of them. The freed regions
+  // will be added to the free list that's passed as a parameter (this
+  // is usually a local list which will be appended to the master free
+  // list later). The used bytes of freed regions are accumulated in
+  // pre_used. If par is true, the region's RSet will not be freed
+  // up. The assumption is that this will be done later.
   void free_humongous_region(HeapRegion* hr,
                              size_t* pre_used,
                              FreeRegionList* free_list,
@@ -1046,13 +1044,13 @@
 #endif // HEAP_REGION_SET_FORCE_VERIFY
 
 #ifdef ASSERT
-  bool is_on_free_list(HeapRegion* hr) {
+  bool is_on_master_free_list(HeapRegion* hr) {
     return hr->containing_set() == &_free_list;
   }
 
-  bool is_on_humongous_set(HeapRegion* hr) {
+  bool is_in_humongous_set(HeapRegion* hr) {
     return hr->containing_set() == &_humongous_set;
-}
+  }
 #endif // ASSERT
 
   // Wrapper for the region list operations that can be called from
@@ -1066,7 +1064,9 @@
     _free_list.add_as_tail(&_secondary_free_list);
   }
 
-  void append_secondary_free_list_if_not_empty() {
+  void append_secondary_free_list_if_not_empty_with_lock() {
+    // If the secondary free list looks empty there's no reason to
+    // take the lock and then try to append it.
     if (!_secondary_free_list.is_empty()) {
       MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
       append_secondary_free_list();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -81,6 +81,57 @@
 
 // </NEW PREDICTION>
 
+// Help class for avoiding interleaved logging
+class LineBuffer: public StackObj {
+
+private:
+  static const int BUFFER_LEN = 1024;
+  static const int INDENT_CHARS = 3;
+  char _buffer[BUFFER_LEN];
+  int _indent_level;
+  int _cur;
+
+  void vappend(const char* format, va_list ap) {
+    int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
+    if (res != -1) {
+      _cur += res;
+    } else {
+      DEBUG_ONLY(warning("buffer too small in LineBuffer");)
+      _buffer[BUFFER_LEN -1] = 0;
+      _cur = BUFFER_LEN; // vsnprintf above should not add to _buffer if we are called again
+    }
+  }
+
+public:
+  explicit LineBuffer(int indent_level): _indent_level(indent_level), _cur(0) {
+    for (; (_cur < BUFFER_LEN && _cur < (_indent_level * INDENT_CHARS)); _cur++) {
+      _buffer[_cur] = ' ';
+    }
+  }
+
+#ifndef PRODUCT
+  ~LineBuffer() {
+    assert(_cur == _indent_level * INDENT_CHARS, "pending data in buffer - append_and_print_cr() not called?");
+  }
+#endif
+
+  void append(const char* format, ...) {
+    va_list ap;
+    va_start(ap, format);
+    vappend(format, ap);
+    va_end(ap);
+  }
+
+  void append_and_print_cr(const char* format, ...) {
+    va_list ap;
+    va_start(ap, format);
+    vappend(format, ap);
+    va_end(ap);
+    gclog_or_tty->print_cr("%s", _buffer);
+    _cur = _indent_level * INDENT_CHARS;
+  }
+};
+
 G1CollectorPolicy::G1CollectorPolicy() :
   _parallel_gc_threads(G1CollectedHeap::use_parallel_gc_threads()
     ? ParallelGCThreads : 1),
@@ -1016,10 +1067,8 @@
                                          bool summary) {
   double min = data[0], max = data[0];
   double total = 0.0;
-  int j;
-  for (j = 0; j < level; ++j)
-    gclog_or_tty->print("   ");
-  gclog_or_tty->print("[%s (ms):", str);
+  LineBuffer buf(level);
+  buf.append("[%s (ms):", str);
   for (uint i = 0; i < ParallelGCThreads; ++i) {
     double val = data[i];
     if (val < min)
@@ -1027,18 +1076,16 @@
     if (val > max)
       max = val;
     total += val;
-    gclog_or_tty->print("  %3.1lf", val);
+    buf.append("  %3.1lf", val);
   }
   if (summary) {
-    gclog_or_tty->print_cr("");
+    buf.append_and_print_cr("");
     double avg = total / (double) ParallelGCThreads;
-    gclog_or_tty->print(" ");
-    for (j = 0; j < level; ++j)
-      gclog_or_tty->print("   ");
-    gclog_or_tty->print("Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf",
+    buf.append(" ");
+    buf.append("Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf",
                         avg, min, max);
   }
-  gclog_or_tty->print_cr("]");
+  buf.append_and_print_cr("]");
 }
 
 void G1CollectorPolicy::print_par_sizes(int level,
@@ -1047,10 +1094,8 @@
                                         bool summary) {
   double min = data[0], max = data[0];
   double total = 0.0;
-  int j;
-  for (j = 0; j < level; ++j)
-    gclog_or_tty->print("   ");
-  gclog_or_tty->print("[%s :", str);
+  LineBuffer buf(level);
+  buf.append("[%s :", str);
   for (uint i = 0; i < ParallelGCThreads; ++i) {
     double val = data[i];
     if (val < min)
@@ -1058,34 +1103,28 @@
     if (val > max)
       max = val;
     total += val;
-    gclog_or_tty->print(" %d", (int) val);
+    buf.append(" %d", (int) val);
   }
   if (summary) {
-    gclog_or_tty->print_cr("");
+    buf.append_and_print_cr("");
     double avg = total / (double) ParallelGCThreads;
-    gclog_or_tty->print(" ");
-    for (j = 0; j < level; ++j)
-      gclog_or_tty->print("   ");
-    gclog_or_tty->print("Sum: %d, Avg: %d, Min: %d, Max: %d",
+    buf.append(" ");
+    buf.append("Sum: %d, Avg: %d, Min: %d, Max: %d",
                (int)total, (int)avg, (int)min, (int)max);
   }
-  gclog_or_tty->print_cr("]");
+  buf.append_and_print_cr("]");
 }
 
 void G1CollectorPolicy::print_stats (int level,
                                      const char* str,
                                      double value) {
-  for (int j = 0; j < level; ++j)
-    gclog_or_tty->print("   ");
-  gclog_or_tty->print_cr("[%s: %5.1lf ms]", str, value);
+  LineBuffer(level).append_and_print_cr("[%s: %5.1lf ms]", str, value);
 }
 
 void G1CollectorPolicy::print_stats (int level,
                                      const char* str,
                                      int value) {
-  for (int j = 0; j < level; ++j)
-    gclog_or_tty->print("   ");
-  gclog_or_tty->print_cr("[%s: %d]", str, value);
+  LineBuffer(level).append_and_print_cr("[%s: %d]", str, value);
 }
 
 double G1CollectorPolicy::avg_value (double* data) {
@@ -2060,17 +2099,11 @@
   _g1->collection_set_iterate(&cs_closure);
 }
 
-static void print_indent(int level) {
-  for (int j = 0; j < level+1; ++j)
-    gclog_or_tty->print("   ");
-}
-
 void G1CollectorPolicy::print_summary (int level,
                                        const char* str,
                                        NumberSeq* seq) const {
   double sum = seq->sum();
-  print_indent(level);
-  gclog_or_tty->print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)",
+  LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)",
                 str, sum / 1000.0, seq->avg());
 }
 
@@ -2078,8 +2111,7 @@
                                           const char* str,
                                           NumberSeq* seq) const {
   print_summary(level, str, seq);
-  print_indent(level + 5);
-  gclog_or_tty->print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
+  LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
                 seq->num(), seq->sd(), seq->maximum());
 }
 
@@ -2087,6 +2119,7 @@
                                         NumberSeq* other_times_ms,
                                         NumberSeq* calc_other_times_ms) const {
   bool should_print = false;
+  LineBuffer buf(level + 2);
 
   double max_sum = MAX2(fabs(other_times_ms->sum()),
                         fabs(calc_other_times_ms->sum()));
@@ -2095,8 +2128,7 @@
   double sum_ratio = max_sum / min_sum;
   if (sum_ratio > 1.1) {
     should_print = true;
-    print_indent(level + 1);
-    gclog_or_tty->print_cr("## CALCULATED OTHER SUM DOESN'T MATCH RECORDED ###");
+    buf.append_and_print_cr("## CALCULATED OTHER SUM DOESN'T MATCH RECORDED ###");
   }
 
   double max_avg = MAX2(fabs(other_times_ms->avg()),
@@ -2106,30 +2138,25 @@
   double avg_ratio = max_avg / min_avg;
   if (avg_ratio > 1.1) {
     should_print = true;
-    print_indent(level + 1);
-    gclog_or_tty->print_cr("## CALCULATED OTHER AVG DOESN'T MATCH RECORDED ###");
+    buf.append_and_print_cr("## CALCULATED OTHER AVG DOESN'T MATCH RECORDED ###");
   }
 
   if (other_times_ms->sum() < -0.01) {
-    print_indent(level + 1);
-    gclog_or_tty->print_cr("## RECORDED OTHER SUM IS NEGATIVE ###");
+    buf.append_and_print_cr("## RECORDED OTHER SUM IS NEGATIVE ###");
   }
 
   if (other_times_ms->avg() < -0.01) {
-    print_indent(level + 1);
-    gclog_or_tty->print_cr("## RECORDED OTHER AVG IS NEGATIVE ###");
+    buf.append_and_print_cr("## RECORDED OTHER AVG IS NEGATIVE ###");
   }
 
   if (calc_other_times_ms->sum() < -0.01) {
     should_print = true;
-    print_indent(level + 1);
-    gclog_or_tty->print_cr("## CALCULATED OTHER SUM IS NEGATIVE ###");
+    buf.append_and_print_cr("## CALCULATED OTHER SUM IS NEGATIVE ###");
   }
 
   if (calc_other_times_ms->avg() < -0.01) {
     should_print = true;
-    print_indent(level + 1);
-    gclog_or_tty->print_cr("## CALCULATED OTHER AVG IS NEGATIVE ###");
+    buf.append_and_print_cr("## CALCULATED OTHER AVG IS NEGATIVE ###");
   }
 
   if (should_print)
@@ -2210,10 +2237,9 @@
       }
     }
   } else {
-    print_indent(0);
-    gclog_or_tty->print_cr("none");
+    LineBuffer(1).append_and_print_cr("none");
   }
-  gclog_or_tty->print_cr("");
+  LineBuffer(0).append_and_print_cr("");
 }
 
 void G1CollectorPolicy::print_tracing_info() const {
@@ -2532,7 +2558,7 @@
     jint regions_added = parKnownGarbageCl.marked_regions_added();
     _hrSorted->incNumMarkedHeapRegions(regions_added);
     if (G1PrintParCleanupStats) {
-      gclog_or_tty->print("     Thread %d called %d times, added %d regions to list.\n",
+      gclog_or_tty->print_cr("     Thread %d called %d times, added %d regions to list.",
                  i, parKnownGarbageCl.invokes(), regions_added);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -185,22 +185,22 @@
   G1CollectedHeap* _g1h;
   ModRefBarrierSet* _mrbs;
   CompactPoint _cp;
-  size_t _pre_used;
-  FreeRegionList _free_list;
   HumongousRegionSet _humongous_proxy_set;
 
   void free_humongous_region(HeapRegion* hr) {
     HeapWord* end = hr->end();
+    size_t dummy_pre_used;
+    FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep");
+
     assert(hr->startsHumongous(),
            "Only the start of a humongous region should be freed.");
-    _g1h->free_humongous_region(hr, &_pre_used, &_free_list,
+    _g1h->free_humongous_region(hr, &dummy_pre_used, &dummy_free_list,
                                 &_humongous_proxy_set, false /* par */);
-    // Do we also need to do this for the continues humongous regions
-    // we just collapsed?
     hr->prepare_for_compaction(&_cp);
     // Also clear the part of the card table that will be unused after
     // compaction.
     _mrbs->clear(MemRegion(hr->compaction_top(), end));
+    dummy_free_list.remove_all();
   }
 
 public:
@@ -208,8 +208,6 @@
   : _g1h(G1CollectedHeap::heap()),
     _mrbs(G1CollectedHeap::heap()->mr_bs()),
     _cp(NULL, cs, cs->initialize_threshold()),
-    _pre_used(0),
-    _free_list("Local Free List for G1MarkSweep"),
     _humongous_proxy_set("G1MarkSweep Humongous Proxy Set") { }
 
   void update_sets() {
@@ -219,7 +217,6 @@
                                             NULL, /* free_list */
                                             &_humongous_proxy_set,
                                             false /* par */);
-    _free_list.remove_all();
   }
 
   bool doHeapRegion(HeapRegion* hr) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -86,28 +86,6 @@
   bool idempotent() { return true; }
 };
 
-class IntoCSRegionClosure: public HeapRegionClosure {
-  IntoCSOopClosure _blk;
-  G1CollectedHeap* _g1;
-public:
-  IntoCSRegionClosure(G1CollectedHeap* g1, OopsInHeapRegionClosure* blk) :
-    _g1(g1), _blk(g1, blk) {}
-  bool doHeapRegion(HeapRegion* r) {
-    if (!r->in_collection_set()) {
-      _blk.set_region(r);
-      if (r->isHumongous()) {
-        if (r->startsHumongous()) {
-          oop obj = oop(r->bottom());
-          obj->oop_iterate(&_blk);
-        }
-      } else {
-        r->oop_before_save_marks_iterate(&_blk);
-      }
-    }
-    return false;
-  }
-};
-
 class VerifyRSCleanCardOopClosure: public OopClosure {
   G1CollectedHeap* _g1;
 public:
@@ -329,7 +307,7 @@
     // is during RSet updating within an evacuation pause.
     // In this case worker_i should be the id of a GC worker thread.
     assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause");
-    assert(worker_i < (int) DirtyCardQueueSet::num_par_ids(), "should be a GC worker");
+    assert(worker_i < (int) (ParallelGCThreads == 0 ? 1 : ParallelGCThreads), "should be a GC worker");
 
     if (_g1rs->concurrentRefineOneCard(card_ptr, worker_i, true)) {
       // 'card_ptr' contains references that point into the collection
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -53,8 +53,8 @@
 class HeapRegionSetBase;
 
 #define HR_FORMAT "%d:["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
-#define HR_FORMAT_PARAMS(__hr) (__hr)->hrs_index(), (__hr)->bottom(), \
-                               (__hr)->top(), (__hr)->end()
+#define HR_FORMAT_PARAMS(_hr_) (_hr_)->hrs_index(), (_hr_)->bottom(), \
+                               (_hr_)->top(), (_hr_)->end()
 
 // A dirty card to oop closure for heap regions. It
 // knows how to get the G1 heap and how to use the bitmap
@@ -518,13 +518,13 @@
                    containing_set, _containing_set));
 
     _containing_set = containing_set;
-}
+  }
 
   HeapRegionSetBase* containing_set() { return _containing_set; }
 #else // ASSERT
   void set_containing_set(HeapRegionSetBase* containing_set) { }
 
-  // containing_set() is only used in asserts so there's not reason
+  // containing_set() is only used in asserts so there's no reason
   // to provide a dummy version of it.
 #endif // ASSERT
 
@@ -535,14 +535,15 @@
   bool pending_removal() { return _pending_removal; }
 
   void set_pending_removal(bool pending_removal) {
-    // We can only set pending_removal to true, if it's false and the
-    // region belongs to a set.
-    assert(!pending_removal ||
-           (!_pending_removal && containing_set() != NULL), "pre-condition");
-    // We can only set pending_removal to false, if it's true and the
-    // region does not belong to a set.
-    assert( pending_removal ||
-           ( _pending_removal && containing_set() == NULL), "pre-condition");
+    if (pending_removal) {
+      assert(!_pending_removal && containing_set() != NULL,
+             "can only set pending removal to true if it's false and "
+             "the region belongs to a region set");
+    } else {
+      assert( _pending_removal && containing_set() == NULL,
+              "can only set pending removal to false if it's true and "
+              "the region does not belong to a region set");
+    }
 
     _pending_removal = pending_removal;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -165,7 +165,7 @@
 
   assert(num_so_far <= num, "post-condition");
   if (num_so_far == num) {
-    // we find enough space for the humongous object
+    // we found enough space for the humongous object
     assert(from <= first && first < _regions.length(), "post-condition");
     assert(first < curr && (curr - first) == (int) num, "post-condition");
     for (int i = first; i < first + (int) num; ++i) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -76,7 +76,8 @@
   // that are available for allocation.
   size_t free_suffix();
 
-  // Finds a contiguous set of empty regions of length num.
+  // Find a contiguous set of empty regions of length num and return
+  // the index of the first region or -1 if the search was unsuccessful.
   int find_contiguous(size_t num);
 
   // Apply the "doHeapRegion" method of "blk" to all regions in "this",
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -42,7 +42,7 @@
   return region_num;
 }
 
-void HeapRegionSetBase::fill_in_ext_msg(hrl_ext_msg* msg, const char* message) {
+void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
   msg->append("[%s] %s "
               "ln: "SIZE_FORMAT" rn: "SIZE_FORMAT" "
               "cy: "SIZE_FORMAT" ud: "SIZE_FORMAT,
@@ -109,30 +109,30 @@
   // for the verification calls. If we do verification without the
   // appropriate locks and the set changes underneath our feet
   // verification might fail and send us on a wild goose chase.
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
 
   guarantee(( is_empty() && length() == 0 && region_num() == 0 &&
               total_used_bytes() == 0 && total_capacity_bytes() == 0) ||
             (!is_empty() && length() >= 0 && region_num() >= 0 &&
               total_used_bytes() >= 0 && total_capacity_bytes() >= 0),
-            hrl_ext_msg(this, "invariant"));
+            hrs_ext_msg(this, "invariant"));
 
   guarantee((!regions_humongous() && region_num() == length()) ||
             ( regions_humongous() && region_num() >= length()),
-            hrl_ext_msg(this, "invariant"));
+            hrs_ext_msg(this, "invariant"));
 
   guarantee(!regions_empty() || total_used_bytes() == 0,
-            hrl_ext_msg(this, "invariant"));
+            hrs_ext_msg(this, "invariant"));
 
   guarantee(total_used_bytes() <= total_capacity_bytes(),
-            hrl_ext_msg(this, "invariant"));
+            hrs_ext_msg(this, "invariant"));
 }
 
 void HeapRegionSetBase::verify_start() {
   // See comment in verify() about MT safety and verification.
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   assert(!_verify_in_progress,
-         hrl_ext_msg(this, "verification should not be in progress"));
+         hrs_ext_msg(this, "verification should not be in progress"));
 
   // Do the basic verification first before we do the checks over the regions.
   HeapRegionSetBase::verify();
@@ -146,11 +146,11 @@
 
 void HeapRegionSetBase::verify_next_region(HeapRegion* hr) {
   // See comment in verify() about MT safety and verification.
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   assert(_verify_in_progress,
-         hrl_ext_msg(this, "verification should be in progress"));
+         hrs_ext_msg(this, "verification should be in progress"));
 
-  guarantee(verify_region(hr, this), hrl_ext_msg(this, "region verification"));
+  guarantee(verify_region(hr, this), hrs_ext_msg(this, "region verification"));
 
   _calc_length               += 1;
   if (!hr->isHumongous()) {
@@ -164,28 +164,28 @@
 
 void HeapRegionSetBase::verify_end() {
   // See comment in verify() about MT safety and verification.
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   assert(_verify_in_progress,
-         hrl_ext_msg(this, "verification should be in progress"));
+         hrs_ext_msg(this, "verification should be in progress"));
 
   guarantee(length() == _calc_length,
-            hrl_err_msg("[%s] length: "SIZE_FORMAT" should be == "
+            hrs_err_msg("[%s] length: "SIZE_FORMAT" should be == "
                         "calc length: "SIZE_FORMAT,
                         name(), length(), _calc_length));
 
   guarantee(region_num() == _calc_region_num,
-            hrl_err_msg("[%s] region num: "SIZE_FORMAT" should be == "
+            hrs_err_msg("[%s] region num: "SIZE_FORMAT" should be == "
                         "calc region num: "SIZE_FORMAT,
                         name(), region_num(), _calc_region_num));
 
   guarantee(total_capacity_bytes() == _calc_total_capacity_bytes,
-            hrl_err_msg("[%s] capacity bytes: "SIZE_FORMAT" should be == "
+            hrs_err_msg("[%s] capacity bytes: "SIZE_FORMAT" should be == "
                         "calc capacity bytes: "SIZE_FORMAT,
                         name(),
                         total_capacity_bytes(), _calc_total_capacity_bytes));
 
   guarantee(total_used_bytes() == _calc_total_used_bytes,
-            hrl_err_msg("[%s] used bytes: "SIZE_FORMAT" should be == "
+            hrs_err_msg("[%s] used bytes: "SIZE_FORMAT" should be == "
                         "calc used bytes: "SIZE_FORMAT,
                         name(), total_used_bytes(), _calc_total_used_bytes));
 
@@ -221,9 +221,9 @@
 //////////////////// HeapRegionSet ////////////////////
 
 void HeapRegionSet::update_from_proxy(HeapRegionSet* proxy_set) {
-  hrl_assert_mt_safety_ok(this);
-  hrl_assert_mt_safety_ok(proxy_set);
-  hrl_assert_sets_match(this, proxy_set);
+  hrs_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(proxy_set);
+  hrs_assert_sets_match(this, proxy_set);
 
   verify_optional();
   proxy_set->verify_optional();
@@ -231,19 +231,19 @@
   if (proxy_set->is_empty()) return;
 
   assert(proxy_set->length() <= _length,
-         hrl_err_msg("[%s] proxy set length: "SIZE_FORMAT" "
+         hrs_err_msg("[%s] proxy set length: "SIZE_FORMAT" "
                      "should be <= length: "SIZE_FORMAT,
                      name(), proxy_set->length(), _length));
   _length -= proxy_set->length();
 
   assert(proxy_set->region_num() <= _region_num,
-         hrl_err_msg("[%s] proxy set region num: "SIZE_FORMAT" "
+         hrs_err_msg("[%s] proxy set region num: "SIZE_FORMAT" "
                      "should be <= region num: "SIZE_FORMAT,
                      name(), proxy_set->region_num(), _region_num));
   _region_num -= proxy_set->region_num();
 
   assert(proxy_set->total_used_bytes() <= _total_used_bytes,
-         hrl_err_msg("[%s] proxy set used bytes: "SIZE_FORMAT" "
+         hrs_err_msg("[%s] proxy set used bytes: "SIZE_FORMAT" "
                      "should be <= used bytes: "SIZE_FORMAT,
                      name(), proxy_set->total_used_bytes(),
                      _total_used_bytes));
@@ -257,13 +257,13 @@
 
 //////////////////// HeapRegionLinkedList ////////////////////
 
-void HeapRegionLinkedList::fill_in_ext_msg_extra(hrl_ext_msg* msg) {
+void HeapRegionLinkedList::fill_in_ext_msg_extra(hrs_ext_msg* msg) {
   msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, head(), tail());
 }
 
 void HeapRegionLinkedList::add_as_tail(HeapRegionLinkedList* from_list) {
-  hrl_assert_mt_safety_ok(this);
-  hrl_assert_mt_safety_ok(from_list);
+  hrs_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(from_list);
 
   verify_optional();
   from_list->verify_optional();
@@ -283,10 +283,10 @@
 #endif // ASSERT
 
   if (_tail != NULL) {
-    assert(length() >  0 && _head != NULL, hrl_ext_msg(this, "invariant"));
+    assert(length() >  0 && _head != NULL, hrs_ext_msg(this, "invariant"));
     _tail->set_next(from_list->_head);
   } else {
-    assert(length() == 0 && _head == NULL, hrl_ext_msg(this, "invariant"));
+    assert(length() == 0 && _head == NULL, hrs_ext_msg(this, "invariant"));
     _head = from_list->_head;
   }
   _tail = from_list->_tail;
@@ -301,12 +301,12 @@
 }
 
 void HeapRegionLinkedList::remove_all() {
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   verify_optional();
 
   HeapRegion* curr = _head;
   while (curr != NULL) {
-    hrl_assert_region_ok(this, curr, this);
+    hrs_assert_region_ok(this, curr, this);
 
     HeapRegion* next = curr->next();
     curr->set_next(NULL);
@@ -319,9 +319,9 @@
 }
 
 void HeapRegionLinkedList::remove_all_pending(size_t target_count) {
-  hrl_assert_mt_safety_ok(this);
-  assert(target_count > 1, hrl_ext_msg(this, "pre-condition"));
-  assert(!is_empty(), hrl_ext_msg(this, "pre-condition"));
+  hrs_assert_mt_safety_ok(this);
+  assert(target_count > 1, hrs_ext_msg(this, "pre-condition"));
+  assert(!is_empty(), hrs_ext_msg(this, "pre-condition"));
 
   verify_optional();
   DEBUG_ONLY(size_t old_length = length();)
@@ -330,27 +330,27 @@
   HeapRegion* prev = NULL;
   size_t count = 0;
   while (curr != NULL) {
-    hrl_assert_region_ok(this, curr, this);
+    hrs_assert_region_ok(this, curr, this);
     HeapRegion* next = curr->next();
 
     if (curr->pending_removal()) {
       assert(count < target_count,
-             hrl_err_msg("[%s] should not come across more regions "
+             hrs_err_msg("[%s] should not come across more regions "
                          "pending for removal than target_count: "SIZE_FORMAT,
                          name(), target_count));
 
       if (prev == NULL) {
-        assert(_head == curr, hrl_ext_msg(this, "invariant"));
+        assert(_head == curr, hrs_ext_msg(this, "invariant"));
         _head = next;
       } else {
-        assert(_head != curr, hrl_ext_msg(this, "invariant"));
+        assert(_head != curr, hrs_ext_msg(this, "invariant"));
         prev->set_next(next);
       }
       if (next == NULL) {
-        assert(_tail == curr, hrl_ext_msg(this, "invariant"));
+        assert(_tail == curr, hrs_ext_msg(this, "invariant"));
         _tail = prev;
       } else {
-        assert(_tail != curr, hrl_ext_msg(this, "invariant"));
+        assert(_tail != curr, hrs_ext_msg(this, "invariant"));
       }
 
       curr->set_next(NULL);
@@ -371,10 +371,10 @@
   }
 
   assert(count == target_count,
-         hrl_err_msg("[%s] count: "SIZE_FORMAT" should be == "
+         hrs_err_msg("[%s] count: "SIZE_FORMAT" should be == "
                      "target_count: "SIZE_FORMAT, name(), count, target_count));
   assert(length() + target_count == old_length,
-         hrl_err_msg("[%s] new length should be consistent "
+         hrs_err_msg("[%s] new length should be consistent "
                      "new length: "SIZE_FORMAT" old length: "SIZE_FORMAT" "
                      "target_count: "SIZE_FORMAT,
                      name(), length(), old_length, target_count));
@@ -385,7 +385,7 @@
 void HeapRegionLinkedList::verify() {
   // See comment in HeapRegionSetBase::verify() about MT safety and
   // verification.
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
 
   // This will also do the basic verification too.
   verify_start();
@@ -399,7 +399,7 @@
 
     count += 1;
     guarantee(count < _unrealistically_long_length,
-              hrl_err_msg("[%s] the calculated length: "SIZE_FORMAT" "
+              hrs_err_msg("[%s] the calculated length: "SIZE_FORMAT" "
                           "seems very long, is there maybe a cycle? "
                           "curr: "PTR_FORMAT" prev0: "PTR_FORMAT" "
                           "prev1: "PTR_FORMAT" length: "SIZE_FORMAT,
@@ -410,7 +410,7 @@
     curr  = curr->next();
   }
 
-  guarantee(_tail == prev0, hrl_ext_msg(this, "post-condition"));
+  guarantee(_tail == prev0, hrs_ext_msg(this, "post-condition"));
 
   verify_end();
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -28,8 +28,8 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 
 // Large buffer for some cases where the output might be larger than normal.
-#define HRL_ERR_MSG_BUFSZ 512
-typedef FormatBuffer<HRL_ERR_MSG_BUFSZ> hrl_err_msg;
+#define HRS_ERR_MSG_BUFSZ 512
+typedef FormatBuffer<HRS_ERR_MSG_BUFSZ> hrs_err_msg;
 
 // Set verification will be forced either if someone defines
 // HEAP_REGION_SET_FORCE_VERIFY to be 1, or in builds in which
@@ -45,10 +45,10 @@
 // (e.g., length, region num, used bytes sum) plus any shared
 // functionality (e.g., verification).
 
-class hrl_ext_msg;
+class hrs_ext_msg;
 
 class HeapRegionSetBase VALUE_OBJ_CLASS_SPEC {
-  friend class hrl_ext_msg;
+  friend class hrs_ext_msg;
 
 protected:
   static size_t calculate_region_num(HeapRegion* hr);
@@ -104,10 +104,10 @@
   virtual bool check_mt_safety() { return true; }
 
   // fill_in_ext_msg() writes the the values of the set's attributes
-  // in the custom err_msg (hrl_ext_msg). fill_in_ext_msg_extra()
+  // in the custom err_msg (hrs_ext_msg). fill_in_ext_msg_extra()
   // allows subclasses to append further information.
-  virtual void fill_in_ext_msg_extra(hrl_ext_msg* msg) { }
-  void fill_in_ext_msg(hrl_ext_msg* msg, const char* message);
+  virtual void fill_in_ext_msg_extra(hrs_ext_msg* msg) { }
+  void fill_in_ext_msg(hrs_ext_msg* msg, const char* message);
 
   // It updates the fields of the set to reflect hr being added to
   // the set.
@@ -170,9 +170,9 @@
 // the fields of the associated set. This can be very helpful in
 // diagnosing failures.
 
-class hrl_ext_msg : public hrl_err_msg {
+class hrs_ext_msg : public hrs_err_msg {
 public:
-  hrl_ext_msg(HeapRegionSetBase* set, const char* message) : hrl_err_msg("") {
+  hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("") {
     set->fill_in_ext_msg(this, message);
   }
 };
@@ -180,25 +180,25 @@
 // These two macros are provided for convenience, to keep the uses of
 // these two asserts a bit more concise.
 
-#define hrl_assert_mt_safety_ok(_set_)                                        \
+#define hrs_assert_mt_safety_ok(_set_)                                        \
   do {                                                                        \
-    assert((_set_)->check_mt_safety(), hrl_ext_msg((_set_), "MT safety"));    \
+    assert((_set_)->check_mt_safety(), hrs_ext_msg((_set_), "MT safety"));    \
   } while (0)
 
-#define hrl_assert_region_ok(_set_, _hr_, _expected_)                         \
+#define hrs_assert_region_ok(_set_, _hr_, _expected_)                         \
   do {                                                                        \
     assert((_set_)->verify_region((_hr_), (_expected_)),                      \
-           hrl_ext_msg((_set_), "region verification"));                      \
+           hrs_ext_msg((_set_), "region verification"));                      \
   } while (0)
 
 //////////////////// HeapRegionSet ////////////////////
 
-#define hrl_assert_sets_match(_set1_, _set2_)                                 \
+#define hrs_assert_sets_match(_set1_, _set2_)                                 \
   do {                                                                        \
     assert(((_set1_)->regions_humongous() ==                                  \
                                             (_set2_)->regions_humongous()) && \
            ((_set1_)->regions_empty() == (_set2_)->regions_empty()),          \
-           hrl_err_msg("the contents of set %s and set %s should match",      \
+           hrs_err_msg("the contents of set %s and set %s should match",      \
                        (_set1_)->name(), (_set2_)->name()));                  \
   } while (0)
 
@@ -267,7 +267,7 @@
   HeapRegion* tail() { return _tail; }
 
 protected:
-  virtual void fill_in_ext_msg_extra(hrl_ext_msg* msg);
+  virtual void fill_in_ext_msg_extra(hrs_ext_msg* msg);
 
   // See the comment for HeapRegionSetBase::clear()
   virtual void clear();
@@ -309,10 +309,10 @@
   virtual void print_on(outputStream* out, bool print_contents = false);
 };
 
-//////////////////// HeapRegionLinkedList ////////////////////
+//////////////////// HeapRegionLinkedListIterator ////////////////////
 
-// Iterator class that provides a convenient way to iterator over the
-// regions in a HeapRegionLinkedList instance.
+// Iterator class that provides a convenient way to iterate over the
+// regions of a HeapRegionLinkedList instance.
 
 class HeapRegionLinkedListIterator : public StackObj {
 private:
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -42,8 +42,8 @@
 }
 
 inline void HeapRegionSetBase::add_internal(HeapRegion* hr) {
-  hrl_assert_region_ok(this, hr, NULL);
-  assert(hr->next() == NULL, hrl_ext_msg(this, "should not already be linked"));
+  hrs_assert_region_ok(this, hr, NULL);
+  assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked"));
 
   update_for_addition(hr);
   hr->set_containing_set(this);
@@ -51,7 +51,7 @@
 
 inline void HeapRegionSetBase::update_for_removal(HeapRegion* hr) {
   // Assumes the caller has already verified the region.
-  assert(_length > 0, hrl_ext_msg(this, "pre-condition"));
+  assert(_length > 0, hrs_ext_msg(this, "pre-condition"));
   _length -= 1;
 
   size_t region_num_diff;
@@ -61,22 +61,22 @@
     region_num_diff = calculate_region_num(hr);
   }
   assert(region_num_diff <= _region_num,
-         hrl_err_msg("[%s] region's region num: "SIZE_FORMAT" "
+         hrs_err_msg("[%s] region's region num: "SIZE_FORMAT" "
                      "should be <= region num: "SIZE_FORMAT,
                      name(), region_num_diff, _region_num));
   _region_num -= region_num_diff;
 
   size_t used_bytes = hr->used();
   assert(used_bytes <= _total_used_bytes,
-         hrl_err_msg("[%s] region's used bytes: "SIZE_FORMAT" "
+         hrs_err_msg("[%s] region's used bytes: "SIZE_FORMAT" "
                      "should be <= used bytes: "SIZE_FORMAT,
                      name(), used_bytes, _total_used_bytes));
   _total_used_bytes -= used_bytes;
 }
 
 inline void HeapRegionSetBase::remove_internal(HeapRegion* hr) {
-  hrl_assert_region_ok(this, hr, this);
-  assert(hr->next() == NULL, hrl_ext_msg(this, "should already be unlinked"));
+  hrs_assert_region_ok(this, hr, this);
+  assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked"));
 
   hr->set_containing_set(NULL);
   update_for_removal(hr);
@@ -85,13 +85,13 @@
 //////////////////// HeapRegionSet ////////////////////
 
 inline void HeapRegionSet::add(HeapRegion* hr) {
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   // add_internal() will verify the region.
   add_internal(hr);
 }
 
 inline void HeapRegionSet::remove(HeapRegion* hr) {
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   // remove_internal() will verify the region.
   remove_internal(hr);
 }
@@ -101,8 +101,8 @@
   // No need to fo the MT safety check here given that this method
   // does not update the contents of the set but instead accumulates
   // the changes in proxy_set which is assumed to be thread-local.
-  hrl_assert_sets_match(this, proxy_set);
-  hrl_assert_region_ok(this, hr, this);
+  hrs_assert_sets_match(this, proxy_set);
+  hrs_assert_region_ok(this, hr, this);
 
   hr->set_containing_set(NULL);
   proxy_set->update_for_addition(hr);
@@ -111,10 +111,10 @@
 //////////////////// HeapRegionLinkedList ////////////////////
 
 inline void HeapRegionLinkedList::add_as_tail(HeapRegion* hr) {
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
   assert((length() == 0 && _head == NULL && _tail == NULL) ||
          (length() >  0 && _head != NULL && _tail != NULL),
-         hrl_ext_msg(this, "invariant"));
+         hrs_ext_msg(this, "invariant"));
   // add_internal() will verify the region.
   add_internal(hr);
 
@@ -128,10 +128,10 @@
 }
 
 inline HeapRegion* HeapRegionLinkedList::remove_head() {
-  hrl_assert_mt_safety_ok(this);
-  assert(!is_empty(), hrl_ext_msg(this, "the list should not be empty"));
+  hrs_assert_mt_safety_ok(this);
+  assert(!is_empty(), hrs_ext_msg(this, "the list should not be empty"));
   assert(length() > 0 && _head != NULL && _tail != NULL,
-         hrl_ext_msg(this, "invariant"));
+         hrs_ext_msg(this, "invariant"));
 
   // We need to unlink it first.
   HeapRegion* hr = _head;
@@ -147,7 +147,7 @@
 }
 
 inline HeapRegion* HeapRegionLinkedList::remove_head_or_null() {
-  hrl_assert_mt_safety_ok(this);
+  hrs_assert_mt_safety_ok(this);
 
   if (!is_empty()) {
     return remove_head();
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSets.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSets.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -52,7 +52,7 @@
                                             FreeList_lock->owned_by_self())) ||
             (!SafepointSynchronize::is_at_safepoint() &&
                                                 Heap_lock->owned_by_self()),
-            hrl_ext_msg(this, "master free list MT safety protocol"));
+            hrs_ext_msg(this, "master free list MT safety protocol"));
 
   return FreeRegionList::check_mt_safety();
 }
@@ -65,7 +65,7 @@
   // while holding the SecondaryFreeList_lock.
 
   guarantee(SecondaryFreeList_lock->owned_by_self(),
-            hrl_ext_msg(this, "secondary free list MT safety protocol"));
+            hrs_ext_msg(this, "secondary free list MT safety protocol"));
 
   return FreeRegionList::check_mt_safety();
 }
@@ -81,7 +81,7 @@
   return HeapRegionSet::verify_region_extra(hr);
 }
 
-//////////////////// HumongousRegionSet ////////////////////
+//////////////////// MasterHumongousRegionSet ////////////////////
 
 bool MasterHumongousRegionSet::check_mt_safety() {
   // Master Humongous Set MT safety protocol:
@@ -97,6 +97,6 @@
                                              OldSets_lock->owned_by_self())) ||
             (!SafepointSynchronize::is_at_safepoint() &&
                                                  Heap_lock->owned_by_self()),
-            hrl_ext_msg(this, "master humongous set MT safety protocol"));
+            hrs_ext_msg(this, "master humongous set MT safety protocol"));
   return HumongousRegionSet::check_mt_safety();
 }
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -1530,13 +1530,15 @@
 {
   if (_ref_processor == NULL) {
     // Allocate and initialize a reference processor
-    _ref_processor = ReferenceProcessor::create_ref_processor(
-        _reserved,                  // span
-        refs_discovery_is_atomic(), // atomic_discovery
-        refs_discovery_is_mt(),     // mt_discovery
-        NULL,                       // is_alive_non_header
-        ParallelGCThreads,
-        ParallelRefProcEnabled);
+    _ref_processor =
+      new ReferenceProcessor(_reserved,                  // span
+                             ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
+                             (int) ParallelGCThreads,    // mt processing degree
+                             refs_discovery_is_mt(),     // mt discovery
+                             (int) ParallelGCThreads,    // mt discovery degree
+                             refs_discovery_is_atomic(), // atomic_discovery
+                             NULL,                       // is_alive_non_header
+                             false);                     // write barrier for next field updates
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -58,9 +58,7 @@
 
 void PSMarkSweep::initialize() {
   MemRegion mr = Universe::heap()->reserved_region();
-  _ref_processor = new ReferenceProcessor(mr,
-                                          true,    // atomic_discovery
-                                          false);  // mt_discovery
+  _ref_processor = new ReferenceProcessor(mr);     // a vanilla ref proc
   _counters = new CollectorCounters("PSMarkSweep", 1);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -827,13 +827,15 @@
   assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
 
   MemRegion mr = heap->reserved_region();
-  _ref_processor = ReferenceProcessor::create_ref_processor(
-    mr,                         // span
-    true,                       // atomic_discovery
-    true,                       // mt_discovery
-    &_is_alive_closure,
-    ParallelGCThreads,
-    ParallelRefProcEnabled);
+  _ref_processor =
+    new ReferenceProcessor(mr,            // span
+                           ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
+                           (int) ParallelGCThreads, // mt processing degree
+                           true,          // mt discovery
+                           (int) ParallelGCThreads, // mt discovery degree
+                           true,          // atomic_discovery
+                           &_is_alive_closure, // non-header is alive closure
+                           false);        // write barrier for next field updates
   _counters = new CollectorCounters("PSParallelCompact", 1);
 
   // Initialize static fields in ParCompactionManager.
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -411,7 +411,7 @@
 template <class T> void PSPromotionManager::process_array_chunk_work(
                                                  oop obj,
                                                  int start, int end) {
-  assert(start < end, "invariant");
+  assert(start <= end, "invariant");
   T* const base      = (T*)objArrayOop(obj)->base();
   T* p               = base + start;
   T* const chunk_end = base + end;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/symbolTable.hpp"
 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
 #include "gc_implementation/parallelScavenge/generationSizer.hpp"
@@ -439,6 +440,14 @@
       reference_processor()->enqueue_discovered_references(NULL);
     }
 
+    if (!JavaObjectsInPerm) {
+      // Unlink any dead interned Strings
+      StringTable::unlink(&_is_alive_closure);
+      // Process the remaining live ones
+      PSScavengeRootsClosure root_closure(promotion_manager);
+      StringTable::oops_do(&root_closure);
+    }
+
     // Finally, flush the promotion_manager's labs, and deallocate its stacks.
     PSPromotionManager::post_scavenge();
 
@@ -796,13 +805,15 @@
 
   // Initialize ref handling object for scavenging.
   MemRegion mr = young_gen->reserved();
-  _ref_processor = ReferenceProcessor::create_ref_processor(
-    mr,                         // span
-    true,                       // atomic_discovery
-    true,                       // mt_discovery
-    NULL,                       // is_alive_non_header
-    ParallelGCThreads,
-    ParallelRefProcEnabled);
+  _ref_processor =
+    new ReferenceProcessor(mr,                         // span
+                           ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
+                           (int) ParallelGCThreads,    // mt processing degree
+                           true,                       // mt discovery
+                           (int) ParallelGCThreads,    // mt discovery degree
+                           true,                       // atomic_discovery
+                           NULL,                       // header provides liveness info
+                           false);                     // next field updates do not need write barrier
 
   // Cache the cardtable
   BarrierSet* bs = Universe::heap()->barrier_set();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -86,4 +86,21 @@
   }
 }
 
+class PSScavengeRootsClosure: public OopClosure {
+ private:
+  PSPromotionManager* _promotion_manager;
+
+ protected:
+  template <class T> void do_oop_work(T *p) {
+    if (PSScavenge::should_scavenge(p)) {
+      // We never card mark roots, maybe call a func without test?
+      PSScavenge::copy_and_push_safe_barrier(_promotion_manager, p);
+    }
+  }
+ public:
+  PSScavengeRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
+  void do_oop(oop* p)       { PSScavengeRootsClosure::do_oop_work(p); }
+  void do_oop(narrowOop* p) { PSScavengeRootsClosure::do_oop_work(p); }
+};
+
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -30,7 +30,7 @@
 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
-#include "gc_implementation/parallelScavenge/psScavenge.hpp"
+#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
 #include "gc_implementation/parallelScavenge/psTasks.hpp"
 #include "memory/iterator.hpp"
 #include "memory/universe.hpp"
@@ -46,24 +46,6 @@
 // ScavengeRootsTask
 //
 
-// Define before use
-class PSScavengeRootsClosure: public OopClosure {
- private:
-  PSPromotionManager* _promotion_manager;
-
- protected:
-  template <class T> void do_oop_work(T *p) {
-    if (PSScavenge::should_scavenge(p)) {
-      // We never card mark roots, maybe call a func without test?
-      PSScavenge::copy_and_push_safe_barrier(_promotion_manager, p);
-    }
-  }
- public:
-  PSScavengeRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
-  void do_oop(oop* p)       { PSScavengeRootsClosure::do_oop_work(p); }
-  void do_oop(narrowOop* p) { PSScavengeRootsClosure::do_oop_work(p); }
-};
-
 void ScavengeRootsTask::do_it(GCTaskManager* manager, uint which) {
   assert(Universe::heap()->is_gc_active(), "called outside gc");
 
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -96,7 +96,7 @@
     empty,                                                      // empty method (code: _return)
     accessor,                                                   // accessor method (code: _aload_0, _getfield, _(a|i)return)
     abstract,                                                   // abstract method (throws an AbstractMethodException)
-    method_handle,                                              // java.dyn.MethodHandles::invoke
+    method_handle,                                              // java.lang.invoke.MethodHandles::invoke
     java_lang_math_sin,                                         // implementation of java.lang.Math.sin   (x)
     java_lang_math_cos,                                         // implementation of java.lang.Math.cos   (x)
     java_lang_math_tan,                                         // implementation of java.lang.Math.tan   (x)
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -656,7 +656,7 @@
           // oop rcvr = locals[0].j.r;
           oop rcvr;
           if (METHOD->is_static()) {
-            rcvr = METHOD->constants()->pool_holder()->klass_part()->java_mirror();
+            rcvr = METHOD->constants()->pool_holder()->java_mirror();
           } else {
             rcvr = LOCALS_OBJECT(0);
             VERIFY_OOP(rcvr);
@@ -2111,8 +2111,8 @@
             break;
 
           case JVM_CONSTANT_Class:
-            VERIFY_OOP(constants->resolved_klass_at(index)->klass_part()->java_mirror());
-            SET_STACK_OBJECT(constants->resolved_klass_at(index)->klass_part()->java_mirror(), 0);
+            VERIFY_OOP(constants->resolved_klass_at(index)->java_mirror());
+            SET_STACK_OBJECT(constants->resolved_klass_at(index)->java_mirror(), 0);
             break;
 
           case JVM_CONSTANT_UnresolvedString:
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -118,7 +118,7 @@
 
   if (tag.is_unresolved_klass() || tag.is_klass()) {
     klassOop klass = pool->klass_at(index, CHECK);
-    oop java_class = klass->klass_part()->java_mirror();
+    oop java_class = klass->java_mirror();
     thread->set_vm_result(java_class);
   } else {
 #ifdef ASSERT
@@ -369,7 +369,10 @@
   }
 
   // create exception
-  THROW_MSG(vmSymbols::java_dyn_WrongMethodTypeException(), message);
+  Symbol* java_lang_invoke_WrongMethodTypeException = vmSymbols::java_lang_invoke_WrongMethodTypeException();
+  if (AllowTransitionalJSR292)
+    java_lang_invoke_WrongMethodTypeException = SystemDictionaryHandles::WrongMethodTypeException_klass()->name();
+  THROW_MSG(java_lang_invoke_WrongMethodTypeException, message);
 }
 IRT_END
 
@@ -794,7 +797,7 @@
   Handle info;  // optional argument(s) in JVM_CONSTANT_InvokeDynamic
   Handle bootm = SystemDictionary::find_bootstrap_method(caller_method, caller_bci,
                                                          main_index, info, CHECK);
-  if (!java_dyn_MethodHandle::is_instance(bootm())) {
+  if (!java_lang_invoke_MethodHandle::is_instance(bootm())) {
     THROW_MSG(vmSymbols::java_lang_IllegalStateException(),
               "no bootstrap method found for invokedynamic");
   }
@@ -980,7 +983,8 @@
 ConstantPoolCacheEntry *cp_entry))
 
   // check the access_flags for the field in the klass
-  instanceKlass* ik = instanceKlass::cast((klassOop)cp_entry->f1());
+
+  instanceKlass* ik = instanceKlass::cast(java_lang_Class::as_klassOop(cp_entry->f1()));
   typeArrayOop fields = ik->fields();
   int index = cp_entry->field_index();
   assert(index < fields->length(), "holders field index is out of range");
@@ -1006,7 +1010,7 @@
     // non-static field accessors have an object, but we need a handle
     h_obj = Handle(thread, obj);
   }
-  instanceKlassHandle h_cp_entry_f1(thread, (klassOop)cp_entry->f1());
+  instanceKlassHandle h_cp_entry_f1(thread, java_lang_Class::as_klassOop(cp_entry->f1()));
   jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2(), is_static);
   JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid);
 IRT_END
@@ -1014,7 +1018,7 @@
 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
 
-  klassOop k = (klassOop)cp_entry->f1();
+  klassOop k = java_lang_Class::as_klassOop(cp_entry->f1());
 
   // check the access_flags for the field in the klass
   instanceKlass* ik = instanceKlass::cast(k);
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -217,11 +217,13 @@
   if (EnableMethodHandles &&
       klass() == SystemDictionary::MethodHandle_klass() &&
       methodOopDesc::is_method_handle_invoke_name(name)) {
-    if (!MethodHandles::enabled()) {
+    if (!THREAD->is_Compiler_thread() && !MethodHandles::enabled()) {
       // Make sure the Java part of the runtime has been booted up.
       klassOop natives = SystemDictionary::MethodHandleNatives_klass();
       if (natives == NULL || instanceKlass::cast(natives)->is_not_initialized()) {
-        SystemDictionary::resolve_or_fail(vmSymbols::sun_dyn_MethodHandleNatives(),
+        Symbol* natives_name = vmSymbols::java_lang_invoke_MethodHandleNatives();
+        if (natives != NULL && AllowTransitionalJSR292)  natives_name = Klass::cast(natives)->name();
+        SystemDictionary::resolve_or_fail(natives_name,
                                           Handle(),
                                           Handle(),
                                           true,
@@ -298,7 +300,7 @@
 }
 
 void LinkResolver::resolve_dynamic_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) {
-  // The class is java.dyn.MethodHandle
+  // The class is java.lang.invoke.MethodHandle
   resolved_klass = SystemDictionaryHandles::MethodHandle_klass();
 
   Symbol* method_name = vmSymbols::invokeExact_name();
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -293,10 +293,11 @@
   // Determine maximum size of gen0
 
   size_t max_new_size = 0;
-  if (FLAG_IS_CMDLINE(MaxNewSize)) {
+  if (FLAG_IS_CMDLINE(MaxNewSize) || FLAG_IS_ERGO(MaxNewSize)) {
     if (MaxNewSize < min_alignment()) {
       max_new_size = min_alignment();
-    } else if (MaxNewSize >= max_heap_byte_size()) {
+    }
+    if (MaxNewSize >= max_heap_byte_size()) {
       max_new_size = align_size_down(max_heap_byte_size() - min_alignment(),
                                      min_alignment());
       warning("MaxNewSize (" SIZE_FORMAT "k) is equal to or "
@@ -333,7 +334,7 @@
   assert(max_new_size > 0, "All paths should set max_new_size");
 
   // Given the maximum gen0 size, determine the initial and
-  // minimum sizes.
+  // minimum gen0 sizes.
 
   if (max_heap_byte_size() == min_heap_byte_size()) {
     // The maximum and minimum heap sizes are the same so
@@ -396,7 +397,7 @@
   }
 
   if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print_cr("Minimum gen0 " SIZE_FORMAT "  Initial gen0 "
+    gclog_or_tty->print_cr("1: Minimum gen0 " SIZE_FORMAT "  Initial gen0 "
       SIZE_FORMAT "  Maximum gen0 " SIZE_FORMAT,
       min_gen0_size(), initial_gen0_size(), max_gen0_size());
   }
@@ -448,7 +449,7 @@
   // At this point the minimum, initial and maximum sizes
   // of the overall heap and of gen0 have been determined.
   // The maximum gen1 size can be determined from the maximum gen0
-  // and maximum heap size since not explicit flags exits
+  // and maximum heap size since no explicit flags exits
   // for setting the gen1 maximum.
   _max_gen1_size = max_heap_byte_size() - _max_gen0_size;
   _max_gen1_size =
@@ -494,13 +495,13 @@
           "generation sizes: using maximum heap = " SIZE_FORMAT
           " -XX:OldSize flag is being ignored",
           max_heap_byte_size());
-  }
+    }
     // If there is an inconsistency between the OldSize and the minimum and/or
     // initial size of gen0, since OldSize was explicitly set, OldSize wins.
     if (adjust_gen0_sizes(&_min_gen0_size, &_min_gen1_size,
                           min_heap_byte_size(), OldSize)) {
       if (PrintGCDetails && Verbose) {
-        gclog_or_tty->print_cr("Minimum gen0 " SIZE_FORMAT "  Initial gen0 "
+        gclog_or_tty->print_cr("2: Minimum gen0 " SIZE_FORMAT "  Initial gen0 "
               SIZE_FORMAT "  Maximum gen0 " SIZE_FORMAT,
               min_gen0_size(), initial_gen0_size(), max_gen0_size());
       }
@@ -509,7 +510,7 @@
     if (adjust_gen0_sizes(&_initial_gen0_size, &_initial_gen1_size,
                          initial_heap_byte_size(), OldSize)) {
       if (PrintGCDetails && Verbose) {
-        gclog_or_tty->print_cr("Minimum gen0 " SIZE_FORMAT "  Initial gen0 "
+        gclog_or_tty->print_cr("3: Minimum gen0 " SIZE_FORMAT "  Initial gen0 "
           SIZE_FORMAT "  Maximum gen0 " SIZE_FORMAT,
           min_gen0_size(), initial_gen0_size(), max_gen0_size());
       }
--- a/hotspot/src/share/vm/memory/compactingPermGenGen.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/compactingPermGenGen.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -105,7 +105,7 @@
 public:
 
   enum {
-    vtbl_list_size = 16, // number of entries in the shared space vtable list.
+    vtbl_list_size = 17, // number of entries in the shared space vtable list.
     num_virtuals = 200   // number of virtual methods in Klass (or
                          // subclass) objects, or greater.
   };
--- a/hotspot/src/share/vm/memory/dump.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/dump.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1561,6 +1561,7 @@
     // thread because it requires object allocation.
     LinkClassesClosure lcc(Thread::current());
     object_iterate(&lcc);
+    ensure_parsability(false); // arg is actually don't care
     tty->print_cr("done. ");
 
     // Create and dump the shared spaces.
--- a/hotspot/src/share/vm/memory/generation.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/generation.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -83,14 +83,11 @@
 }
 
 // By default we get a single threaded default reference processor;
-// generations needing multi-threaded refs discovery override this method.
+// generations needing multi-threaded refs processing or discovery override this method.
 void Generation::ref_processor_init() {
   assert(_ref_processor == NULL, "a reference processor already exists");
   assert(!_reserved.is_empty(), "empty generation?");
-  _ref_processor =
-    new ReferenceProcessor(_reserved,                  // span
-                           refs_discovery_is_atomic(), // atomic_discovery
-                           refs_discovery_is_mt());    // mt_discovery
+  _ref_processor = new ReferenceProcessor(_reserved);    // a vanilla reference processor
   if (_ref_processor == NULL) {
     vm_exit_during_initialization("Could not allocate ReferenceProcessor object");
   }
--- a/hotspot/src/share/vm/memory/heap.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/heap.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -316,12 +316,19 @@
 }
 
 size_t CodeHeap::largest_free_block() const {
+  // First check unused space excluding free blocks.
+  size_t free_sz = size(_free_segments);
+  size_t unused  = max_capacity() - allocated_capacity() - free_sz;
+  if (unused >= free_sz)
+    return unused;
+
+  // Now check largest free block.
   size_t len = 0;
   for (FreeBlock* b = _freelist; b != NULL; b = b->link()) {
     if (b->length() > len)
       len = b->length();
   }
-  return size(len);
+  return MAX2(unused, size(len));
 }
 
 // Free list management
--- a/hotspot/src/share/vm/memory/oopFactory.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/oopFactory.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -117,12 +117,12 @@
 }
 
 
-klassOop oopFactory::new_instanceKlass(int vtable_len, int itable_len,
+klassOop oopFactory::new_instanceKlass(Symbol* name, int vtable_len, int itable_len,
                                        int static_field_size,
                                        unsigned int nonstatic_oop_map_count,
                                        ReferenceType rt, TRAPS) {
   instanceKlassKlass* ikk = instanceKlassKlass::cast(Universe::instanceKlassKlassObj());
-  return ikk->allocate_instance_klass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_count, rt, CHECK_NULL);
+  return ikk->allocate_instance_klass(name, vtable_len, itable_len, static_field_size, nonstatic_oop_map_count, rt, CHECK_NULL);
 }
 
 
--- a/hotspot/src/share/vm/memory/oopFactory.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/oopFactory.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -72,7 +72,8 @@
                                                     TRAPS);
 
   // Instance classes
-  static klassOop        new_instanceKlass(int vtable_len, int itable_len,
+  static klassOop        new_instanceKlass(Symbol* name,
+                                           int vtable_len, int itable_len,
                                            int static_field_size,
                                            unsigned int nonstatic_oop_map_count,
                                            ReferenceType rt, TRAPS);
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -102,40 +102,17 @@
             "Unrecongnized RefDiscoveryPolicy");
 }
 
-ReferenceProcessor*
-ReferenceProcessor::create_ref_processor(MemRegion          span,
-                                         bool               atomic_discovery,
-                                         bool               mt_discovery,
-                                         BoolObjectClosure* is_alive_non_header,
-                                         int                parallel_gc_threads,
-                                         bool               mt_processing,
-                                         bool               dl_needs_barrier) {
-  int mt_degree = 1;
-  if (parallel_gc_threads > 1) {
-    mt_degree = parallel_gc_threads;
-  }
-  ReferenceProcessor* rp =
-    new ReferenceProcessor(span, atomic_discovery,
-                           mt_discovery, mt_degree,
-                           mt_processing && (parallel_gc_threads > 0),
-                           dl_needs_barrier);
-  if (rp == NULL) {
-    vm_exit_during_initialization("Could not allocate ReferenceProcessor object");
-  }
-  rp->set_is_alive_non_header(is_alive_non_header);
-  rp->setup_policy(false /* default soft ref policy */);
-  return rp;
-}
-
 ReferenceProcessor::ReferenceProcessor(MemRegion span,
-                                       bool      atomic_discovery,
+                                       bool      mt_processing,
+                                       int       mt_processing_degree,
                                        bool      mt_discovery,
-                                       int       mt_degree,
-                                       bool      mt_processing,
+                                       int       mt_discovery_degree,
+                                       bool      atomic_discovery,
+                                       BoolObjectClosure* is_alive_non_header,
                                        bool      discovered_list_needs_barrier)  :
   _discovering_refs(false),
   _enqueuing_is_done(false),
-  _is_alive_non_header(NULL),
+  _is_alive_non_header(is_alive_non_header),
   _discovered_list_needs_barrier(discovered_list_needs_barrier),
   _bs(NULL),
   _processing_is_mt(mt_processing),
@@ -144,8 +121,8 @@
   _span = span;
   _discovery_is_atomic = atomic_discovery;
   _discovery_is_mt     = mt_discovery;
-  _num_q               = mt_degree;
-  _max_num_q           = mt_degree;
+  _num_q               = MAX2(1, mt_processing_degree);
+  _max_num_q           = MAX2(_num_q, mt_discovery_degree);
   _discoveredSoftRefs  = NEW_C_HEAP_ARRAY(DiscoveredList, _max_num_q * subclasses_of_ref);
   if (_discoveredSoftRefs == NULL) {
     vm_exit_during_initialization("Could not allocated RefProc Array");
@@ -163,6 +140,7 @@
   if (discovered_list_needs_barrier) {
     _bs = Universe::heap()->barrier_set();
   }
+  setup_policy(false /* default soft ref policy */);
 }
 
 #ifndef PRODUCT
@@ -405,15 +383,14 @@
   { }
 
   virtual void work(unsigned int work_id) {
-    assert(work_id < (unsigned int)_ref_processor.num_q(), "Index out-of-bounds");
+    assert(work_id < (unsigned int)_ref_processor.max_num_q(), "Index out-of-bounds");
     // Simplest first cut: static partitioning.
     int index = work_id;
     // The increment on "index" must correspond to the maximum number of queues
     // (n_queues) with which that ReferenceProcessor was created.  That
     // is because of the "clever" way the discovered references lists were
-    // allocated and are indexed into.  That number is ParallelGCThreads
-    // currently.  Assert that.
-    assert(_n_queues == (int) ParallelGCThreads, "Different number not expected");
+    // allocated and are indexed into.
+    assert(_n_queues == (int) _ref_processor.max_num_q(), "Different number not expected");
     for (int j = 0;
          j < subclasses_of_ref;
          j++, index += _n_queues) {
@@ -672,7 +649,7 @@
     }
   }
   NOT_PRODUCT(
-    if (PrintGCDetails && TraceReferenceGC) {
+    if (PrintGCDetails && TraceReferenceGC && (iter.processed() > 0)) {
       gclog_or_tty->print_cr(" Dropped %d active Refs out of %d "
         "Refs in discovered list " INTPTR_FORMAT,
         iter.removed(), iter.processed(), (address)refs_list.head());
@@ -711,7 +688,7 @@
   // Now close the newly reachable set
   complete_gc->do_void();
   NOT_PRODUCT(
-    if (PrintGCDetails && TraceReferenceGC) {
+    if (PrintGCDetails && TraceReferenceGC && (iter.processed() > 0)) {
       gclog_or_tty->print_cr(" Dropped %d active Refs out of %d "
         "Refs in discovered list " INTPTR_FORMAT,
         iter.removed(), iter.processed(), (address)refs_list.head());
@@ -951,7 +928,7 @@
   }
   if (PrintReferenceGC && PrintGCDetails) {
     size_t total = 0;
-    for (int i = 0; i < _num_q; ++i) {
+    for (int i = 0; i < _max_num_q; ++i) {
       total += refs_lists[i].length();
     }
     gclog_or_tty->print(", %u refs", total);
@@ -967,7 +944,7 @@
       RefProcPhase1Task phase1(*this, refs_lists, policy, true /*marks_oops_alive*/);
       task_executor->execute(phase1);
     } else {
-      for (int i = 0; i < _num_q; i++) {
+      for (int i = 0; i < _max_num_q; i++) {
         process_phase1(refs_lists[i], policy,
                        is_alive, keep_alive, complete_gc);
       }
@@ -983,7 +960,7 @@
     RefProcPhase2Task phase2(*this, refs_lists, !discovery_is_atomic() /*marks_oops_alive*/);
     task_executor->execute(phase2);
   } else {
-    for (int i = 0; i < _num_q; i++) {
+    for (int i = 0; i < _max_num_q; i++) {
       process_phase2(refs_lists[i], is_alive, keep_alive, complete_gc);
     }
   }
@@ -994,7 +971,7 @@
     RefProcPhase3Task phase3(*this, refs_lists, clear_referent, true /*marks_oops_alive*/);
     task_executor->execute(phase3);
   } else {
-    for (int i = 0; i < _num_q; i++) {
+    for (int i = 0; i < _max_num_q; i++) {
       process_phase3(refs_lists[i], clear_referent,
                      is_alive, keep_alive, complete_gc);
     }
@@ -1008,7 +985,7 @@
   //   for (int j = 0; j < _num_q; j++) {
   //     int index = i * _max_num_q + j;
   for (int i = 0; i < _max_num_q * subclasses_of_ref; i++) {
-    if (TraceReferenceGC && PrintGCDetails && ((i % _num_q) == 0)) {
+    if (TraceReferenceGC && PrintGCDetails && ((i % _max_num_q) == 0)) {
       gclog_or_tty->print_cr(
         "\nScrubbing %s discovered list of Null referents",
         list_name(i));
@@ -1350,7 +1327,7 @@
   {
     TraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
               false, gclog_or_tty);
-    for (int i = 0; i < _num_q; i++) {
+    for (int i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
       }
@@ -1363,7 +1340,7 @@
   {
     TraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
               false, gclog_or_tty);
-    for (int i = 0; i < _num_q; i++) {
+    for (int i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
       }
@@ -1376,7 +1353,7 @@
   {
     TraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
               false, gclog_or_tty);
-    for (int i = 0; i < _num_q; i++) {
+    for (int i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
       }
@@ -1433,7 +1410,7 @@
   complete_gc->do_void();
 
   NOT_PRODUCT(
-    if (PrintGCDetails && PrintReferenceGC) {
+    if (PrintGCDetails && PrintReferenceGC && (iter.processed() > 0)) {
       gclog_or_tty->print_cr(" Dropped %d Refs out of %d "
         "Refs in discovered list " INTPTR_FORMAT,
         iter.removed(), iter.processed(), (address)refs_list.head());
--- a/hotspot/src/share/vm/memory/referenceProcessor.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -71,7 +71,7 @@
   bool        _enqueuing_is_done;     // true if all weak references enqueued
   bool        _processing_is_mt;      // true during phases when
                                       // reference processing is MT.
-  int         _next_id;               // round-robin counter in
+  int         _next_id;               // round-robin mod _num_q counter in
                                       // support of work distribution
 
   // For collectors that do not keep GC marking information
@@ -103,7 +103,8 @@
 
  public:
   int num_q()                            { return _num_q; }
-  void set_mt_degree(int v)              { _num_q = v; }
+  int max_num_q()                        { return _max_num_q; }
+  void set_active_mt_degree(int v)       { _num_q = v; }
   DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; }
   static oop  sentinel_ref()             { return _sentinelRef; }
   static oop* adr_sentinel_ref()         { return &_sentinelRef; }
@@ -216,6 +217,7 @@
                                    VoidClosure*       complete_gc,
                                    YieldClosure*      yield);
 
+  // round-robin mod _num_q (not: _not_ mode _max_num_q)
   int next_id() {
     int id = _next_id;
     if (++_next_id == _num_q) {
@@ -256,23 +258,15 @@
     _max_num_q(0),
     _processing_is_mt(false),
     _next_id(0)
-  {}
-
-  ReferenceProcessor(MemRegion span, bool atomic_discovery,
-                     bool mt_discovery,
-                     int mt_degree = 1,
-                     bool mt_processing = false,
-                     bool discovered_list_needs_barrier = false);
+  { }
 
-  // Allocates and initializes a reference processor.
-  static ReferenceProcessor* create_ref_processor(
-    MemRegion          span,
-    bool               atomic_discovery,
-    bool               mt_discovery,
-    BoolObjectClosure* is_alive_non_header = NULL,
-    int                parallel_gc_threads = 1,
-    bool               mt_processing = false,
-    bool               discovered_list_needs_barrier = false);
+  // Default parameters give you a vanilla reference processor.
+  ReferenceProcessor(MemRegion span,
+                     bool mt_processing = false, int mt_processing_degree = 1,
+                     bool mt_discovery  = false, int mt_discovery_degree  = 1,
+                     bool atomic_discovery = true,
+                     BoolObjectClosure* is_alive_non_header = NULL,
+                     bool discovered_list_needs_barrier = false);
 
   // RefDiscoveryPolicy values
   enum DiscoveryPolicy {
@@ -397,20 +391,20 @@
 // A utility class to temporarily change the MT'ness of
 // reference discovery for the given ReferenceProcessor
 // in the scope that contains it.
-class ReferenceProcessorMTMutator: StackObj {
+class ReferenceProcessorMTDiscoveryMutator: StackObj {
  private:
   ReferenceProcessor* _rp;
   bool                _saved_mt;
 
  public:
-  ReferenceProcessorMTMutator(ReferenceProcessor* rp,
-                              bool mt):
+  ReferenceProcessorMTDiscoveryMutator(ReferenceProcessor* rp,
+                                       bool mt):
     _rp(rp) {
     _saved_mt = _rp->discovery_is_mt();
     _rp->set_mt_discovery(mt);
   }
 
-  ~ReferenceProcessorMTMutator() {
+  ~ReferenceProcessorMTDiscoveryMutator() {
     _rp->set_mt_discovery(_saved_mt);
   }
 };
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -171,11 +171,13 @@
   }
 
   if (!_process_strong_tasks->is_task_claimed(SH_PS_StringTable_oops_do)) {
-     if (so & SO_Strings) {
-       StringTable::oops_do(roots);
-     }
-    // Verify if the string table contents are in the perm gen
-    NOT_PRODUCT(StringTable::oops_do(&assert_is_perm_closure));
+    if (so & SO_Strings || (!collecting_perm_gen && !JavaObjectsInPerm)) {
+      StringTable::oops_do(roots);
+    }
+    if (JavaObjectsInPerm) {
+      // Verify the string table contents are in the perm gen
+      NOT_PRODUCT(StringTable::oops_do(&assert_is_perm_closure));
+    }
   }
 
   if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) {
--- a/hotspot/src/share/vm/memory/universe.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -51,6 +51,7 @@
 #include "oops/cpCacheKlass.hpp"
 #include "oops/cpCacheOop.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/instanceKlassKlass.hpp"
 #include "oops/instanceRefKlass.hpp"
 #include "oops/klassKlass.hpp"
@@ -521,6 +522,7 @@
   { objArrayKlassKlass o;     add_vtable(list, &n, &o, count); }
   { instanceKlassKlass o;     add_vtable(list, &n, &o, count); }
   { instanceKlass o;          add_vtable(list, &n, &o, count); }
+  { instanceMirrorKlass o;    add_vtable(list, &n, &o, count); }
   { instanceRefKlass o;       add_vtable(list, &n, &o, count); }
   { typeArrayKlassKlass o;    add_vtable(list, &n, &o, count); }
   { typeArrayKlass o;         add_vtable(list, &n, &o, count); }
@@ -547,7 +549,7 @@
       KlassHandle k(THREAD, klassOop(obj));
       // We will never reach the CATCH below since Exceptions::_throw will cause
       // the VM to exit if an exception is thrown during initialization
-      java_lang_Class::create_mirror(k, CATCH);
+      java_lang_Class::fixup_mirror(k, CATCH);
       // This call unconditionally creates a new mirror for k,
       // and links in k's component_mirror field if k is an array.
       // If k is an objArray, k's element type must already have
@@ -605,6 +607,10 @@
   // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note
   // that the number of objects allocated at this point is very small.
   assert(SystemDictionary::Class_klass_loaded(), "java.lang.Class should be loaded");
+
+  // Cache the start of the static fields
+  instanceMirrorKlass::init_offset_of_static_fields();
+
   FixupMirrorClosure blk;
   Universe::heap()->permanent_object_iterate(&blk);
 }
@@ -1313,6 +1319,8 @@
   JNIHandles::verify();
   if (!silent) gclog_or_tty->print("C-heap ");
   os::check_heap();
+  if (!silent) gclog_or_tty->print("code cache ");
+  CodeCache::verify_oops();
   if (!silent) gclog_or_tty->print_cr("]");
 
   _verify_in_progress = false;
--- a/hotspot/src/share/vm/oops/arrayKlassKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlassKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -28,6 +28,13 @@
 #include "oops/arrayKlassKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
+#ifndef SERIALGC
+#include "gc_implementation/parNew/parOopClosures.inline.hpp"
+#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
+#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
+#include "memory/cardTableRS.hpp"
+#include "oops/oop.pcgc.inline.hpp"
+#endif
 
 
 klassOop arrayKlassKlass::create_klass(TRAPS) {
@@ -104,9 +111,12 @@
 int arrayKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
   assert(obj->is_klass(), "must be klass");
   arrayKlass* ak = arrayKlass::cast(klassOop(obj));
-  blk->do_oop(ak->adr_component_mirror());
-  blk->do_oop(ak->adr_lower_dimension());
-  blk->do_oop(ak->adr_higher_dimension());
+  oop* addr = ak->adr_component_mirror();
+  if (mr.contains(addr)) blk->do_oop(addr);
+  addr = ak->adr_lower_dimension();
+  if (mr.contains(addr)) blk->do_oop(addr);
+  addr = ak->adr_higher_dimension();
+  if (mr.contains(addr)) blk->do_oop(addr);
   ak->vtable()->oop_oop_iterate_m(blk, mr);
   return klassKlass::oop_oop_iterate_m(obj, blk, mr);
 }
@@ -114,6 +124,12 @@
 #ifndef SERIALGC
 void arrayKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
   assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass");
+  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
+  oop* p = ak->adr_component_mirror();
+  if (PSScavenge::should_scavenge(p)) {
+    pm->claim_or_forward_depth(p);
+  }
+  klassKlass::oop_push_contents(pm, obj);
 }
 
 int arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
--- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -285,10 +285,11 @@
 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
   assert(obj->is_constantPool(), "should be constant pool");
   constantPoolOop cp = (constantPoolOop) obj;
-  if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) {
-    oop* base = (oop*)cp->base();
-    for (int i = 0; i < cp->length(); ++i, ++base) {
+  if (cp->tags() != NULL &&
+      (!JavaObjectsInPerm || (AnonymousClasses && cp->has_pseudo_string()))) {
+    for (int i = 1; i < cp->length(); ++i) {
       if (cp->tag_at(i).is_string()) {
+        oop* base = cp->obj_at_addr_raw(i);
         if (PSScavenge::should_scavenge(base)) {
           pm->claim_or_forward_depth(base);
         }
@@ -460,7 +461,8 @@
       if (cp->tag_at(i).is_string()) {
         if (!cp->has_pseudo_string()) {
           if (entry.is_oop()) {
-            guarantee(entry.get_oop()->is_perm(),   "should be in permspace");
+            guarantee(!JavaObjectsInPerm || entry.get_oop()->is_perm(),
+                      "should be in permspace");
             guarantee(entry.get_oop()->is_instance(), "should be instance");
           }
         } else {
--- a/hotspot/src/share/vm/oops/constantPoolOop.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolOop.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -481,7 +481,7 @@
     {
       klassOop resolved = klass_at_impl(this_oop, index, CHECK_NULL);
       // ldc wants the java mirror.
-      result_oop = resolved->klass_part()->java_mirror();
+      result_oop = resolved->java_mirror();
       break;
     }
 
@@ -1175,8 +1175,15 @@
 
   case JVM_CONSTANT_UnresolvedClass:
   {
-    Symbol* k = from_cp->unresolved_klass_at(from_i);
-    to_cp->unresolved_klass_at_put(to_i, k);
+    // Can be resolved after checking tag, so check the slot first.
+    CPSlot entry = from_cp->slot_at(from_i);
+    if (entry.is_oop()) {
+      assert(entry.get_oop()->is_klass(), "must be");
+      // Already resolved
+      to_cp->klass_at_put(to_i, (klassOop)entry.get_oop());
+    } else {
+      to_cp->unresolved_klass_at_put(to_i, entry.get_symbol());
+    }
   } break;
 
   case JVM_CONSTANT_UnresolvedClassInError:
@@ -1189,8 +1196,14 @@
 
   case JVM_CONSTANT_UnresolvedString:
   {
-    Symbol* s = from_cp->unresolved_string_at(from_i);
-    to_cp->unresolved_string_at_put(to_i, s);
+    // Can be resolved after checking tag, so check the slot first.
+    CPSlot entry = from_cp->slot_at(from_i);
+    if (entry.is_oop()) {
+      // Already resolved (either string or pseudo-string)
+      to_cp->string_at_put(to_i, entry.get_oop());
+    } else {
+      to_cp->unresolved_string_at_put(to_i, entry.get_symbol());
+    }
   } break;
 
   case JVM_CONSTANT_Utf8:
--- a/hotspot/src/share/vm/oops/cpCacheKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -168,22 +168,18 @@
 void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm,
                                                oop obj) {
   assert(obj->is_constantPoolCache(), "should be constant pool");
-  if (EnableInvokeDynamic) {
+  if (ScavengeRootsInCode) {
     constantPoolCacheOop cache = (constantPoolCacheOop)obj;
     // during a scavenge, it is safe to inspect my pool, since it is perm
     constantPoolOop pool = cache->constant_pool();
     assert(pool->is_constantPool(), "should be constant pool");
-    if (pool->has_invokedynamic()) {
-      for (int i = 0; i < cache->length(); i++) {
-        ConstantPoolCacheEntry* e = cache->entry_at(i);
-        oop* p = (oop*)&e->_f1;
-        if (e->is_secondary_entry()) {
-          if (PSScavenge::should_scavenge(p))
-            pm->claim_or_forward_depth(p);
-          assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)),
-                 "no live oops here");
-        }
-      }
+    for (int i = 0; i < cache->length(); i++) {
+      ConstantPoolCacheEntry* e = cache->entry_at(i);
+      oop* p = (oop*)&e->_f1;
+      if (PSScavenge::should_scavenge(p))
+        pm->claim_or_forward_depth(p);
+      assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)),
+             "no live oops here");
     }
   }
 }
--- a/hotspot/src/share/vm/oops/cpCacheOop.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheOop.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -133,7 +133,7 @@
                                        TosState field_type,
                                        bool is_final,
                                        bool is_volatile) {
-  set_f1(field_holder());
+  set_f1(field_holder()->java_mirror());
   set_f2(field_offset);
   // The field index is used by jvm/ti and is the index into fields() array
   // in holder instanceKlass.  This is scaled by instanceKlass::next_offset.
--- a/hotspot/src/share/vm/oops/cpCacheOop.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheOop.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -190,7 +190,7 @@
   );
 
   void set_dynamic_call(
-    Handle call_site,                            // Resolved java.dyn.CallSite (f1)
+    Handle call_site,                            // Resolved java.lang.invoke.CallSite (f1)
     methodHandle signature_invoker               // determines signature information
   );
 
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -37,6 +37,7 @@
 #include "memory/oopFactory.hpp"
 #include "memory/permGen.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/instanceOop.hpp"
 #include "oops/methodOop.hpp"
 #include "oops/objArrayKlassKlass.hpp"
@@ -649,6 +650,7 @@
 }
 
 instanceOop instanceKlass::allocate_instance(TRAPS) {
+  assert(!oop_is_instanceMirror(), "wrong allocation path");
   bool has_finalizer_flag = has_finalizer(); // Query before possible GC
   int size = size_helper();  // Query before forming handle.
 
@@ -669,6 +671,7 @@
   // instances so simply disallow finalizable perm objects.  This can
   // be relaxed if a need for it is found.
   assert(!has_finalizer(), "perm objects not allowed to have finalizers");
+  assert(!oop_is_instanceMirror(), "wrong allocation path");
   int size = size_helper();  // Query before forming handle.
   KlassHandle h_k(THREAD, as_klassOop());
   instanceOop i = (instanceOop)
@@ -735,7 +738,12 @@
 static int call_class_initializer_impl_counter = 0;   // for debugging
 
 methodOop instanceKlass::class_initializer() {
-  return find_method(vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
+  methodOop clinit = find_method(
+      vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
+  if (clinit != NULL && clinit->has_valid_initializer_flags()) {
+    return clinit;
+  }
+  return NULL;
 }
 
 void instanceKlass::call_class_initializer_impl(instanceKlassHandle this_oop, TRAPS) {
@@ -893,6 +901,7 @@
   }
 }
 
+
 void instanceKlass::do_local_static_fields(FieldClosure* cl) {
   fieldDescriptor fd;
   int length = fields()->length();
@@ -1604,36 +1613,6 @@
 // The following macros call specialized macros, passing either oop or
 // narrowOop as the specialization type.  These test the UseCompressedOops
 // flag.
-#define InstanceKlass_OOP_ITERATE(start_p, count,    \
-                                  do_oop, assert_fn) \
-{                                                    \
-  if (UseCompressedOops) {                           \
-    InstanceKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \
-      start_p, count,                                \
-      do_oop, assert_fn)                             \
-  } else {                                           \
-    InstanceKlass_SPECIALIZED_OOP_ITERATE(oop,       \
-      start_p, count,                                \
-      do_oop, assert_fn)                             \
-  }                                                  \
-}
-
-#define InstanceKlass_BOUNDED_OOP_ITERATE(start_p, count, low, high,    \
-                                          do_oop, assert_fn) \
-{                                                            \
-  if (UseCompressedOops) {                                   \
-    InstanceKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \
-      start_p, count,                                        \
-      low, high,                                             \
-      do_oop, assert_fn)                                     \
-  } else {                                                   \
-    InstanceKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop,       \
-      start_p, count,                                        \
-      low, high,                                             \
-      do_oop, assert_fn)                                     \
-  }                                                          \
-}
-
 #define InstanceKlass_OOP_MAP_ITERATE(obj, do_oop, assert_fn)            \
 {                                                                        \
   /* Compute oopmap block range. The common case                         \
@@ -1706,38 +1685,6 @@
   }                                                                      \
 }
 
-void instanceKlass::follow_static_fields() {
-  InstanceKlass_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    MarkSweep::mark_and_push(p), \
-    assert_is_in_closed_subset)
-}
-
-#ifndef SERIALGC
-void instanceKlass::follow_static_fields(ParCompactionManager* cm) {
-  InstanceKlass_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    PSParallelCompact::mark_and_push(cm, p), \
-    assert_is_in)
-}
-#endif // SERIALGC
-
-void instanceKlass::adjust_static_fields() {
-  InstanceKlass_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    MarkSweep::adjust_pointer(p), \
-    assert_nothing)
-}
-
-#ifndef SERIALGC
-void instanceKlass::update_static_fields() {
-  InstanceKlass_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    PSParallelCompact::adjust_pointer(p), \
-    assert_nothing)
-}
-#endif // SERIALGC
-
 void instanceKlass::oop_follow_contents(oop obj) {
   assert(obj != NULL, "can't follow the content of NULL object");
   obj->follow_header();
@@ -1824,22 +1771,6 @@
 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
 #endif // !SERIALGC
 
-void instanceKlass::iterate_static_fields(OopClosure* closure) {
-    InstanceKlass_OOP_ITERATE( \
-      start_of_static_fields(), static_oop_field_size(), \
-      closure->do_oop(p), \
-      assert_is_in_reserved)
-}
-
-void instanceKlass::iterate_static_fields(OopClosure* closure,
-                                          MemRegion mr) {
-  InstanceKlass_BOUNDED_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    mr.start(), mr.end(), \
-    (closure)->do_oop_v(p), \
-    assert_is_in_closed_subset)
-}
-
 int instanceKlass::oop_adjust_pointers(oop obj) {
   int size = size_helper();
   InstanceKlass_OOP_MAP_ITERATE( \
@@ -1868,21 +1799,6 @@
   return size_helper();
 }
 
-void instanceKlass::push_static_fields(PSPromotionManager* pm) {
-  InstanceKlass_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    if (PSScavenge::should_scavenge(p)) { \
-      pm->claim_or_forward_depth(p); \
-    }, \
-    assert_nothing )
-}
-
-void instanceKlass::copy_static_fields(ParCompactionManager* cm) {
-  InstanceKlass_OOP_ITERATE( \
-    start_of_static_fields(), static_oop_field_size(), \
-    PSParallelCompact::adjust_pointer(p), \
-    assert_is_in)
-}
 #endif // SERIALGC
 
 // This klass is alive but the implementor link is not followed/updated.
@@ -1997,6 +1913,11 @@
   if (_source_debug_extension != NULL) _source_debug_extension->increment_refcount();
 }
 
+address instanceKlass::static_field_addr(int offset) {
+  return (address)(offset + instanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror());
+}
+
+
 const char* instanceKlass::signature_name() const {
   const char* src = (const char*) (name()->as_C_string());
   const int src_length = (int)strlen(src);
@@ -2364,7 +2285,7 @@
 
 void FieldPrinter::do_field(fieldDescriptor* fd) {
   _st->print(BULLET);
-   if (fd->is_static() || (_obj == NULL)) {
+   if (_obj == NULL) {
      fd->print_on(_st);
      _st->cr();
    } else {
@@ -2394,8 +2315,8 @@
   }
 
   st->print_cr(BULLET"---- fields (total size %d words):", oop_size(obj));
-  FieldPrinter print_nonstatic_field(st, obj);
-  do_nonstatic_fields(&print_nonstatic_field);
+  FieldPrinter print_field(st, obj);
+  do_nonstatic_fields(&print_field);
 
   if (as_klassOop() == SystemDictionary::Class_klass()) {
     st->print(BULLET"signature: ");
@@ -2413,9 +2334,15 @@
     st->print(BULLET"fake entry for array: ");
     array_klass->print_value_on(st);
     st->cr();
+    st->print_cr(BULLET"fake entry for oop_size: %d", java_lang_Class::oop_size(obj));
+    st->print_cr(BULLET"fake entry for static_oop_field_count: %d", java_lang_Class::static_oop_field_count(obj));
+    klassOop real_klass = java_lang_Class::as_klassOop(obj);
+    if (real_klass && real_klass->klass_part()->oop_is_instance()) {
+      instanceKlass::cast(real_klass)->do_local_static_fields(&print_field);
+    }
   } else if (as_klassOop() == SystemDictionary::MethodType_klass()) {
     st->print(BULLET"signature: ");
-    java_dyn_MethodType::print_signature(obj, st);
+    java_lang_invoke_MethodType::print_signature(obj, st);
     st->cr();
   }
 }
@@ -2446,7 +2373,7 @@
     }
   } else if (as_klassOop() == SystemDictionary::MethodType_klass()) {
     st->print(" = ");
-    java_dyn_MethodType::print_signature(obj, st);
+    java_lang_invoke_MethodType::print_signature(obj, st);
   } else if (java_lang_boxing_object::is_instance(obj)) {
     st->print(" = ");
     java_lang_boxing_object::print(obj, st);
@@ -2555,7 +2482,7 @@
 
 
 void JNIid::verify(klassOop holder) {
-  int first_field_offset  = instanceKlass::cast(holder)->offset_of_static_fields();
+  int first_field_offset  = instanceMirrorKlass::offset_of_static_fields();
   int end_field_offset;
   end_field_offset = first_field_offset + (instanceKlass::cast(holder)->static_field_size() * wordSize);
 
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -75,8 +75,6 @@
 //    [Java vtable length         ]
 //    [oop map cache (stack maps) ]
 //    [EMBEDDED Java vtable             ] size in words = vtable_len
-//    [EMBEDDED static oop fields       ] size in words = static_oop_fields_size
-//    [         static non-oop fields   ] size in words = static_field_size - static_oop_fields_size
 //    [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size
 //
 //    The embedded nonstatic oop-map blocks are short pairs (offset, length) indicating
@@ -193,8 +191,8 @@
   typeArrayOop    _inner_classes;
   // Implementors of this interface (not valid if it overflows)
   klassOop        _implementors[implementors_limit];
-  // invokedynamic bootstrap method (a java.dyn.MethodHandle)
-  oop             _bootstrap_method;
+  // invokedynamic bootstrap method (a java.lang.invoke.MethodHandle)
+  oop             _bootstrap_method;  // AllowTransitionalJSR292 ONLY
   // Annotations for this class, or null if none.
   typeArrayOop    _class_annotations;
   // Annotation objects (byte arrays) for fields, or null if no annotations.
@@ -230,7 +228,7 @@
   // (including inherited fields but after header_size()).
   int             _nonstatic_field_size;
   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
-  int             _static_oop_field_size;// number of static oop fields in this klass
+  int             _static_oop_field_count;// number of static oop fields in this klass
   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
   bool            _rewritten;            // methods rewritten.
@@ -281,8 +279,8 @@
   int static_field_size() const            { return _static_field_size; }
   void set_static_field_size(int size)     { _static_field_size = size; }
 
-  int static_oop_field_size() const        { return _static_oop_field_size; }
-  void set_static_oop_field_size(int size) { _static_oop_field_size = size; }
+  int static_oop_field_count() const        { return _static_oop_field_count; }
+  void set_static_oop_field_count(int size) { _static_oop_field_count = size; }
 
   // Java vtable
   int  vtable_length() const               { return _vtable_len; }
@@ -529,7 +527,7 @@
                                                         _enclosing_method_method_index = method_index; }
 
   // JSR 292 support
-  oop bootstrap_method() const                        { return _bootstrap_method; }
+  oop bootstrap_method() const                        { return _bootstrap_method; }  // AllowTransitionalJSR292 ONLY
   void set_bootstrap_method(oop mh)                   { oop_store(&_bootstrap_method, mh); }
 
   // jmethodID support
@@ -660,6 +658,7 @@
 
   // Casting from klassOop
   static instanceKlass* cast(klassOop k) {
+    assert(k->is_klass(), "must be");
     Klass* kp = k->klass_part();
     assert(kp->null_vtbl() || kp->oop_is_instance_slow(), "cast to instanceKlass");
     return (instanceKlass*) kp;
@@ -667,7 +666,7 @@
 
   // Sizing (in words)
   static int header_size()            { return align_object_offset(oopDesc::header_size() + sizeof(instanceKlass)/HeapWordSize); }
-  int object_size() const             { return object_size(align_object_offset(vtable_length()) + align_object_offset(itable_length()) + static_field_size() + nonstatic_oop_map_size()); }
+  int object_size() const             { return object_size(align_object_offset(vtable_length()) + align_object_offset(itable_length()) + nonstatic_oop_map_size()); }
   static int vtable_start_offset()    { return header_size(); }
   static int vtable_length_offset()   { return oopDesc::header_size() + offset_of(instanceKlass, _vtable_len) / HeapWordSize; }
   static int object_size(int extra)   { return align_object_size(header_size() + extra); }
@@ -676,20 +675,12 @@
   intptr_t* start_of_itable() const        { return start_of_vtable() + align_object_offset(vtable_length()); }
   int  itable_offset_in_words() const { return start_of_itable() - (intptr_t*)as_klassOop(); }
 
-  // Static field offset is an offset into the Heap, should be converted by
-  // based on UseCompressedOop for traversal
-  HeapWord* start_of_static_fields() const {
-    return (HeapWord*)(start_of_itable() + align_object_offset(itable_length()));
-  }
-
   intptr_t* end_of_itable() const          { return start_of_itable() + itable_length(); }
 
-  int offset_of_static_fields() const {
-    return (intptr_t)start_of_static_fields() - (intptr_t)as_klassOop();
-  }
+  address static_field_addr(int offset);
 
   OopMapBlock* start_of_nonstatic_oop_maps() const {
-    return (OopMapBlock*) (start_of_static_fields() + static_field_size());
+    return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
   }
 
   // Allocation profiling support
@@ -719,8 +710,6 @@
 
   // Garbage collection
   void oop_follow_contents(oop obj);
-  void follow_static_fields();
-  void adjust_static_fields();
   int  oop_adjust_pointers(oop obj);
   bool object_is_parsable() const { return _init_state != unparsable_by_gc; }
        // Value of _init_state must be zero (unparsable_by_gc) when klass field is set.
@@ -732,16 +721,6 @@
   // Parallel Scavenge and Parallel Old
   PARALLEL_GC_DECLS
 
-#ifndef SERIALGC
-  // Parallel Scavenge
-  void push_static_fields(PSPromotionManager* pm);
-
-  // Parallel Old
-  void follow_static_fields(ParCompactionManager* cm);
-  void copy_static_fields(ParCompactionManager* cm);
-  void update_static_fields();
-#endif // SERIALGC
-
   // Naming
   const char* signature_name() const;
 
@@ -770,9 +749,6 @@
   ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
 #endif // !SERIALGC
 
-  void iterate_static_fields(OopClosure* closure);
-  void iterate_static_fields(OopClosure* closure, MemRegion mr);
-
 private:
   // initialization state
 #ifdef ASSERT
@@ -817,7 +793,7 @@
   oop* adr_signers() const           { return (oop*)&this->_signers;}
   oop* adr_inner_classes() const     { return (oop*)&this->_inner_classes;}
   oop* adr_implementors() const      { return (oop*)&this->_implementors[0];}
-  oop* adr_bootstrap_method() const  { return (oop*)&this->_bootstrap_method;}
+  oop* adr_bootstrap_method() const  { return (oop*)&this->_bootstrap_method;}  // AllowTransitionalJSR292 ONLY
   oop* adr_methods_jmethod_ids() const             { return (oop*)&this->_methods_jmethod_ids;}
   oop* adr_methods_cached_itable_indices() const   { return (oop*)&this->_methods_cached_itable_indices;}
   oop* adr_class_annotations() const   { return (oop*)&this->_class_annotations;}
@@ -926,6 +902,10 @@
   // Identifier lookup
   JNIid* find(int offset);
 
+  bool find_local_field(fieldDescriptor* fd) {
+    return instanceKlass::cast(holder())->find_local_field_from_offset(offset(), true, fd);
+  }
+
   // Garbage collection support
   oop* holder_addr() { return (oop*)&_holder; }
   void oops_do(OopClosure* f);
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -31,6 +31,7 @@
 #include "memory/gcLocker.hpp"
 #include "oops/constantPoolOop.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/instanceKlassKlass.hpp"
 #include "oops/instanceRefKlass.hpp"
 #include "oops/objArrayKlassKlass.hpp"
@@ -86,7 +87,6 @@
   assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
 
   instanceKlass* ik = instanceKlass::cast(klassOop(obj));
-  ik->follow_static_fields();
   {
     HandleMark hm;
     ik->vtable()->oop_follow_contents();
@@ -127,7 +127,6 @@
   assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
 
   instanceKlass* ik = instanceKlass::cast(klassOop(obj));
-  ik->follow_static_fields(cm);
   ik->vtable()->oop_follow_contents(cm);
   ik->itable()->oop_follow_contents(cm);
 
@@ -168,7 +167,6 @@
   // Don't call size() or oop_size() since that is a virtual call.
   int size = ik->object_size();
 
-  ik->iterate_static_fields(blk);
   ik->vtable()->oop_oop_iterate(blk);
   ik->itable()->oop_oop_iterate(blk);
 
@@ -209,7 +207,6 @@
   // Don't call size() or oop_size() since that is a virtual call.
   int size = ik->object_size();
 
-  ik->iterate_static_fields(blk, mr);
   ik->vtable()->oop_oop_iterate_m(blk, mr);
   ik->itable()->oop_oop_iterate_m(blk, mr);
 
@@ -266,7 +263,6 @@
   assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
 
   instanceKlass* ik = instanceKlass::cast(klassOop(obj));
-  ik->adjust_static_fields();
   ik->vtable()->oop_adjust_pointers();
   ik->itable()->oop_adjust_pointers();
 
@@ -300,7 +296,6 @@
 #ifndef SERIALGC
 void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
   instanceKlass* ik = instanceKlass::cast(klassOop(obj));
-  ik->push_static_fields(pm);
 
   oop* loader_addr = ik->adr_class_loader();
   if (PSScavenge::should_scavenge(loader_addr)) {
@@ -336,7 +331,6 @@
          "must be instance klass");
 
   instanceKlass* ik = instanceKlass::cast(klassOop(obj));
-  ik->update_static_fields();
   ik->vtable()->oop_update_pointers(cm);
   ik->itable()->oop_update_pointers(cm);
 
@@ -356,22 +350,28 @@
 #endif // SERIALGC
 
 klassOop
-instanceKlassKlass::allocate_instance_klass(int vtable_len, int itable_len,
+instanceKlassKlass::allocate_instance_klass(Symbol* name, int vtable_len, int itable_len,
                                             int static_field_size,
                                             unsigned nonstatic_oop_map_count,
                                             ReferenceType rt, TRAPS) {
 
   const int nonstatic_oop_map_size =
     instanceKlass::nonstatic_oop_map_size(nonstatic_oop_map_count);
-  int size = instanceKlass::object_size(align_object_offset(vtable_len) + align_object_offset(itable_len) + static_field_size + nonstatic_oop_map_size);
+  int size = instanceKlass::object_size(align_object_offset(vtable_len) + align_object_offset(itable_len) + nonstatic_oop_map_size);
 
   // Allocation
   KlassHandle h_this_klass(THREAD, as_klassOop());
   KlassHandle k;
   if (rt == REF_NONE) {
-    // regular klass
-    instanceKlass o;
-    k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
+    if (name != vmSymbols::java_lang_Class()) {
+      // regular klass
+      instanceKlass o;
+      k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
+    } else {
+      // Class
+      instanceMirrorKlass o;
+      k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
+    }
   } else {
     // reference klass
     instanceRefKlass o;
@@ -408,7 +408,7 @@
     ik->set_source_debug_extension(NULL);
     ik->set_array_name(NULL);
     ik->set_inner_classes(NULL);
-    ik->set_static_oop_field_size(0);
+    ik->set_static_oop_field_count(0);
     ik->set_nonstatic_field_size(0);
     ik->set_is_marked_dependent(false);
     ik->set_init_state(instanceKlass::allocated);
@@ -442,9 +442,6 @@
     // To get verify to work - must be set to partial loaded before first GC point.
     k()->set_partially_loaded();
   }
-
-  // GC can happen here
-  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
   return k();
 }
 
@@ -566,13 +563,6 @@
   FieldPrinter print_nonstatic_field(st);
   ik->do_nonstatic_fields(&print_nonstatic_field);
 
-  st->print(BULLET"static oop maps:     ");
-  if (ik->static_oop_field_size() > 0) {
-    int first_offset = ik->offset_of_static_fields();
-    st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1);
-  }
-  st->cr();
-
   st->print(BULLET"non-static oop maps: ");
   OopMapBlock* map     = ik->start_of_nonstatic_oop_maps();
   OopMapBlock* end_map = map + ik->nonstatic_oop_map_count();
@@ -630,7 +620,6 @@
 
     // Verify static fields
     VerifyFieldClosure blk;
-    ik->iterate_static_fields(&blk);
 
     // Verify vtables
     if (ik->is_linked()) {
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,8 @@
   // Allocation
   DEFINE_ALLOCATE_PERMANENT(instanceKlassKlass);
   static klassOop create_klass(TRAPS);
-  klassOop allocate_instance_klass(int vtable_len,
+  klassOop allocate_instance_klass(Symbol* name,
+                                   int vtable_len,
                                    int itable_len,
                                    int static_field_size,
                                    unsigned int nonstatic_oop_map_count,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/javaClasses.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "gc_implementation/shared/markSweep.inline.hpp"
+#include "gc_interface/collectedHeap.inline.hpp"
+#include "memory/genOopClosures.inline.hpp"
+#include "memory/oopFactory.hpp"
+#include "memory/permGen.hpp"
+#include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
+#include "oops/instanceOop.hpp"
+#include "oops/oop.inline.hpp"
+#include "oops/symbol.hpp"
+#include "runtime/handles.inline.hpp"
+#ifndef SERIALGC
+#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+#include "gc_implementation/g1/g1OopClosures.inline.hpp"
+#include "gc_implementation/g1/g1RemSet.inline.hpp"
+#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
+#include "gc_implementation/parNew/parOopClosures.inline.hpp"
+#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
+#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
+#include "oops/oop.pcgc.inline.hpp"
+#endif
+
+int instanceMirrorKlass::_offset_of_static_fields = 0;
+
+#ifdef ASSERT
+template <class T> void assert_is_in(T *p) {
+  T heap_oop = oopDesc::load_heap_oop(p);
+  if (!oopDesc::is_null(heap_oop)) {
+    oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
+    assert(Universe::heap()->is_in(o), "should be in heap");
+  }
+}
+template <class T> void assert_is_in_closed_subset(T *p) {
+  T heap_oop = oopDesc::load_heap_oop(p);
+  if (!oopDesc::is_null(heap_oop)) {
+    oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
+    assert(Universe::heap()->is_in_closed_subset(o), "should be in closed");
+  }
+}
+template <class T> void assert_is_in_reserved(T *p) {
+  T heap_oop = oopDesc::load_heap_oop(p);
+  if (!oopDesc::is_null(heap_oop)) {
+    oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
+    assert(Universe::heap()->is_in_reserved(o), "should be in reserved");
+  }
+}
+template <class T> void assert_nothing(T *p) {}
+
+#else
+template <class T> void assert_is_in(T *p) {}
+template <class T> void assert_is_in_closed_subset(T *p) {}
+template <class T> void assert_is_in_reserved(T *p) {}
+template <class T> void assert_nothing(T *p) {}
+#endif // ASSERT
+
+#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE( \
+  T, start_p, count, do_oop,                         \
+  assert_fn)                                         \
+{                                                    \
+  T* p         = (T*)(start_p);                      \
+  T* const end = p + (count);                        \
+  while (p < end) {                                  \
+    (assert_fn)(p);                                  \
+    do_oop;                                          \
+    ++p;                                             \
+  }                                                  \
+}
+
+#define InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE( \
+  T, start_p, count, low, high,                              \
+  do_oop, assert_fn)                                         \
+{                                                            \
+  T* const l = (T*)(low);                                    \
+  T* const h = (T*)(high);                                   \
+  assert(mask_bits((intptr_t)l, sizeof(T)-1) == 0 &&         \
+         mask_bits((intptr_t)h, sizeof(T)-1) == 0,           \
+         "bounded region must be properly aligned");         \
+  T* p       = (T*)(start_p);                                \
+  T* end     = p + (count);                                  \
+  if (p < l) p = l;                                          \
+  if (end > h) end = h;                                      \
+  while (p < end) {                                          \
+    (assert_fn)(p);                                          \
+    do_oop;                                                  \
+    ++p;                                                     \
+  }                                                          \
+}
+
+
+#define InstanceMirrorKlass_OOP_ITERATE(start_p, count,    \
+                                  do_oop, assert_fn)       \
+{                                                          \
+  if (UseCompressedOops) {                                 \
+    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \
+      start_p, count,                                      \
+      do_oop, assert_fn)                                   \
+  } else {                                                 \
+    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(oop,       \
+      start_p, count,                                      \
+      do_oop, assert_fn)                                   \
+  }                                                        \
+}
+
+// The following macros call specialized macros, passing either oop or
+// narrowOop as the specialization type.  These test the UseCompressedOops
+// flag.
+#define InstanceMirrorKlass_BOUNDED_OOP_ITERATE(start_p, count, low, high, \
+                                          do_oop, assert_fn)               \
+{                                                                          \
+  if (UseCompressedOops) {                                                 \
+    InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop,         \
+      start_p, count,                                                      \
+      low, high,                                                           \
+      do_oop, assert_fn)                                                   \
+  } else {                                                                 \
+    InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop,               \
+      start_p, count,                                                      \
+      low, high,                                                           \
+      do_oop, assert_fn)                                                   \
+  }                                                                        \
+}
+
+
+void instanceMirrorKlass::oop_follow_contents(oop obj) {
+  instanceKlass::oop_follow_contents(obj);
+  InstanceMirrorKlass_OOP_ITERATE(                                                    \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
+    MarkSweep::mark_and_push(p),                                                      \
+    assert_is_in_closed_subset)
+}
+
+#ifndef SERIALGC
+void instanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm,
+                                              oop obj) {
+  instanceKlass::oop_follow_contents(cm, obj);
+  InstanceMirrorKlass_OOP_ITERATE(                                                    \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
+    PSParallelCompact::mark_and_push(cm, p),                                          \
+    assert_is_in)
+}
+#endif // SERIALGC
+
+int instanceMirrorKlass::oop_adjust_pointers(oop obj) {
+  int size = oop_size(obj);
+  instanceKlass::oop_adjust_pointers(obj);
+  InstanceMirrorKlass_OOP_ITERATE(                                                    \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
+    MarkSweep::adjust_pointer(p),                                                     \
+    assert_nothing)
+  return size;
+}
+
+#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(T, nv_suffix)                \
+  InstanceMirrorKlass_OOP_ITERATE(                                                    \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
+      (closure)->do_oop##nv_suffix(p),                                                \
+    assert_is_in_closed_subset)                                                       \
+  return oop_size(obj);                                                               \
+
+#define InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(T, nv_suffix, mr)         \
+  InstanceMirrorKlass_BOUNDED_OOP_ITERATE(                                            \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
+    mr.start(), mr.end(),                                                             \
+      (closure)->do_oop##nv_suffix(p),                                                \
+    assert_is_in_closed_subset)                                                       \
+  return oop_size(obj);                                                               \
+
+
+// Macro to define instanceMirrorKlass::oop_oop_iterate for virtual/nonvirtual for
+// all closures.  Macros calling macros above for each oop size.
+
+#define InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)           \
+                                                                                      \
+int instanceMirrorKlass::                                                             \
+oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) {                        \
+  /* Get size before changing pointers */                                             \
+  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
+                                                                                      \
+  instanceKlass::oop_oop_iterate##nv_suffix(obj, closure);                            \
+                                                                                      \
+  if (UseCompressedOops) {                                                            \
+    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(narrowOop, nv_suffix);           \
+  } else {                                                                            \
+    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(oop, nv_suffix);                 \
+  }                                                                                   \
+}
+
+#ifndef SERIALGC
+#define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
+                                                                                      \
+int instanceMirrorKlass::                                                             \
+oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) {              \
+  /* Get size before changing pointers */                                             \
+  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
+                                                                                      \
+  instanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure);                  \
+                                                                                      \
+  if (UseCompressedOops) {                                                            \
+    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(narrowOop, nv_suffix);           \
+  } else {                                                                            \
+    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(oop, nv_suffix);                 \
+  }                                                                                   \
+}
+#endif // !SERIALGC
+
+
+#define InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix)         \
+                                                                                      \
+int instanceMirrorKlass::                                                             \
+oop_oop_iterate##nv_suffix##_m(oop obj,                                               \
+                               OopClosureType* closure,                               \
+                               MemRegion mr) {                                        \
+  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
+                                                                                      \
+  instanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr);                    \
+  if (UseCompressedOops) {                                                            \
+    InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr);    \
+  } else {                                                                            \
+    InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr);          \
+  }                                                                                   \
+}
+
+ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
+ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
+#ifndef SERIALGC
+ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
+ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
+#endif // SERIALGC
+ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m)
+ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m)
+
+#ifndef SERIALGC
+void instanceMirrorKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
+  instanceKlass::oop_push_contents(pm, obj);
+  InstanceMirrorKlass_OOP_ITERATE(                                            \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
+    if (PSScavenge::should_scavenge(p)) {                                     \
+      pm->claim_or_forward_depth(p);                                          \
+    },                                                                        \
+    assert_nothing )
+}
+
+int instanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
+  instanceKlass::oop_update_pointers(cm, obj);
+  InstanceMirrorKlass_OOP_ITERATE(                                            \
+    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
+    PSParallelCompact::adjust_pointer(p),                                     \
+    assert_nothing)
+  return oop_size(obj);
+}
+#endif // SERIALGC
+
+int instanceMirrorKlass::instance_size(KlassHandle k) {
+  if (k() != NULL && k->oop_is_instance()) {
+    return align_object_size(size_helper() + instanceKlass::cast(k())->static_field_size());
+  }
+  return size_helper();
+}
+
+instanceOop instanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
+  // Query before forming handle.
+  int size = instance_size(k);
+  KlassHandle h_k(THREAD, as_klassOop());
+  instanceOop i;
+
+  if (JavaObjectsInPerm) {
+    i = (instanceOop) CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL);
+  } else {
+    assert(ScavengeRootsInCode > 0, "must be");
+    i = (instanceOop) CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);
+  }
+
+  return i;
+}
+
+int instanceMirrorKlass::oop_size(oop obj) const {
+  return java_lang_Class::oop_size(obj);
+}
+
+int instanceMirrorKlass::compute_static_oop_field_count(oop obj) {
+  klassOop k = java_lang_Class::as_klassOop(obj);
+  if (k != NULL && k->klass_part()->oop_is_instance()) {
+    return instanceKlass::cast(k)->static_oop_field_count();
+  }
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
+#define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
+
+#include "oops/instanceKlass.hpp"
+
+// An instanceMirrorKlass is a specialized instanceKlass for
+// java.lang.Class instances.  These instances are special because
+// they contain the static fields of the class in addition to the
+// normal fields of Class.  This means they are variable sized
+// instances and need special logic for computing their size and for
+// iteration of their oops.
+
+
+class instanceMirrorKlass: public instanceKlass {
+ private:
+  static int _offset_of_static_fields;
+
+ public:
+  // Type testing
+  bool oop_is_instanceMirror() const             { return true; }
+
+  // Casting from klassOop
+  static instanceMirrorKlass* cast(klassOop k) {
+    assert(k->klass_part()->oop_is_instanceMirror(), "cast to instanceMirrorKlass");
+    return (instanceMirrorKlass*) k->klass_part();
+  }
+
+  // Returns the size of the instance including the extra static fields.
+  virtual int oop_size(oop obj) const;
+
+  // Static field offset is an offset into the Heap, should be converted by
+  // based on UseCompressedOop for traversal
+  static HeapWord* start_of_static_fields(oop obj) {
+    return (HeapWord*)((intptr_t)obj + offset_of_static_fields());
+  }
+
+  static void init_offset_of_static_fields() {
+    // Cache the offset of the static fields in the Class instance
+    assert(_offset_of_static_fields == 0, "once");
+    _offset_of_static_fields = instanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize;
+  }
+
+  static int offset_of_static_fields() {
+    return _offset_of_static_fields;
+  }
+
+  int compute_static_oop_field_count(oop obj);
+
+  // Given a Klass return the size of the instance
+  int instance_size(KlassHandle k);
+
+  // allocation
+  DEFINE_ALLOCATE_PERMANENT(instanceMirrorKlass);
+  instanceOop allocate_instance(KlassHandle k, TRAPS);
+
+  // Garbage collection
+  int  oop_adjust_pointers(oop obj);
+  void oop_follow_contents(oop obj);
+
+  // Parallel Scavenge and Parallel Old
+  PARALLEL_GC_DECLS
+
+  int oop_oop_iterate(oop obj, OopClosure* blk) {
+    return oop_oop_iterate_v(obj, blk);
+  }
+  int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
+    return oop_oop_iterate_v_m(obj, blk, mr);
+  }
+
+#define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix)           \
+  int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk);                       \
+  int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
+
+  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL)
+  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL)
+
+#ifndef SERIALGC
+#define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
+  int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
+
+  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
+  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
+#endif // !SERIALGC
+};
+
+#endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
--- a/hotspot/src/share/vm/oops/klass.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/klass.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -577,6 +577,7 @@
  public:
   // type testing operations
   virtual bool oop_is_instance_slow()       const { return false; }
+  virtual bool oop_is_instanceMirror()      const { return false; }
   virtual bool oop_is_instanceRef()         const { return false; }
   virtual bool oop_is_array()               const { return false; }
   virtual bool oop_is_objArray_slow()       const { return false; }
@@ -811,4 +812,8 @@
 #endif
 };
 
+
+inline oop klassOopDesc::java_mirror() const                        { return klass_part()->java_mirror(); }
+
+
 #endif // SHARE_VM_OOPS_KLASS_HPP
--- a/hotspot/src/share/vm/oops/klassKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/klassKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -41,6 +41,10 @@
 #include "oops/typeArrayKlass.hpp"
 #include "runtime/handles.inline.hpp"
 #ifndef SERIALGC
+#include "gc_implementation/parNew/parOopClosures.inline.hpp"
+#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
+#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
+#include "memory/cardTableRS.hpp"
 #include "oops/oop.pcgc.inline.hpp"
 #endif
 
@@ -175,6 +179,12 @@
 
 #ifndef SERIALGC
 void klassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
+  Klass* k = Klass::cast(klassOop(obj));
+
+  oop* p = k->adr_java_mirror();
+  if (PSScavenge::should_scavenge(p)) {
+    pm->claim_or_forward_depth(p);
+  }
 }
 
 int klassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
@@ -233,7 +243,7 @@
 
   if (k->java_mirror() != NULL || (k->oop_is_instance() && instanceKlass::cast(klassOop(obj))->is_loaded())) {
     guarantee(k->java_mirror() != NULL,          "should be allocated");
-    guarantee(k->java_mirror()->is_perm(),       "should be in permspace");
+    guarantee(k->java_mirror()->is_perm() || !JavaObjectsInPerm,       "should be in permspace");
     guarantee(k->java_mirror()->is_instance(),   "should be instance");
   }
 }
--- a/hotspot/src/share/vm/oops/klassOop.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/klassOop.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -45,7 +45,73 @@
   static int klass_part_offset_in_bytes()        { return sizeof(klassOopDesc); }
 
   // returns the Klass part containing dispatching behavior
-  Klass* klass_part()                            { return (Klass*)((address)this + klass_part_offset_in_bytes()); }
+  Klass* klass_part() const                      { return (Klass*)((address)this + klass_part_offset_in_bytes()); }
+
+  // Convenience wrapper
+  inline oop java_mirror() const;
+
+ private:
+  // These have no implementation since klassOop should never be accessed in this fashion
+  oop obj_field(int offset) const;
+  void obj_field_put(int offset, oop value);
+  void obj_field_raw_put(int offset, oop value);
+
+  jbyte byte_field(int offset) const;
+  void byte_field_put(int offset, jbyte contents);
+
+  jchar char_field(int offset) const;
+  void char_field_put(int offset, jchar contents);
+
+  jboolean bool_field(int offset) const;
+  void bool_field_put(int offset, jboolean contents);
+
+  jint int_field(int offset) const;
+  void int_field_put(int offset, jint contents);
+
+  jshort short_field(int offset) const;
+  void short_field_put(int offset, jshort contents);
+
+  jlong long_field(int offset) const;
+  void long_field_put(int offset, jlong contents);
+
+  jfloat float_field(int offset) const;
+  void float_field_put(int offset, jfloat contents);
+
+  jdouble double_field(int offset) const;
+  void double_field_put(int offset, jdouble contents);
+
+  address address_field(int offset) const;
+  void address_field_put(int offset, address contents);
+
+  oop obj_field_acquire(int offset) const;
+  void release_obj_field_put(int offset, oop value);
+
+  jbyte byte_field_acquire(int offset) const;
+  void release_byte_field_put(int offset, jbyte contents);
+
+  jchar char_field_acquire(int offset) const;
+  void release_char_field_put(int offset, jchar contents);
+
+  jboolean bool_field_acquire(int offset) const;
+  void release_bool_field_put(int offset, jboolean contents);
+
+  jint int_field_acquire(int offset) const;
+  void release_int_field_put(int offset, jint contents);
+
+  jshort short_field_acquire(int offset) const;
+  void release_short_field_put(int offset, jshort contents);
+
+  jlong long_field_acquire(int offset) const;
+  void release_long_field_put(int offset, jlong contents);
+
+  jfloat float_field_acquire(int offset) const;
+  void release_float_field_put(int offset, jfloat contents);
+
+  jdouble double_field_acquire(int offset) const;
+  void release_double_field_put(int offset, jdouble contents);
+
+  address address_field_acquire(int offset) const;
+  void release_address_field_put(int offset, address contents);
 };
 
 #endif // SHARE_VM_OOPS_KLASSOOP_HPP
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -883,7 +883,7 @@
   int ime_num = 0;
 
   // Skip first methodOop if it is a class initializer
-  int i = ((methodOop)methods()->obj_at(0))->name() != vmSymbols::class_initializer_name() ? 0 : 1;
+  int i = ((methodOop)methods()->obj_at(0))->is_static_initializer() ? 1 : 0;
 
   // m, method_name, method_signature, klass reset each loop so they
   // don't need preserving across check_signature_loaders call
@@ -1095,7 +1095,7 @@
   itableOffsetEntry* ioe = (itableOffsetEntry*)klass->start_of_itable();
   itableMethodEntry* ime = (itableMethodEntry*)(ioe + nof_interfaces);
   intptr_t* end               = klass->end_of_itable();
-  assert((oop*)(ime + nof_methods) <= (oop*)klass->start_of_static_fields(), "wrong offset calculation (1)");
+  assert((oop*)(ime + nof_methods) <= (oop*)klass->start_of_nonstatic_oop_maps(), "wrong offset calculation (1)");
   assert((oop*)(end) == (oop*)(ime + nof_methods),                      "wrong offset calculation (2)");
 
   // Visit all interfaces and initialize itable offset table
@@ -1121,7 +1121,7 @@
     assert(index < methods->length(), "should find index for resolve_invoke");
   }
   // Adjust for <clinit>, which is left out of table if first method
-  if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) {
+  if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) {
     index--;
   }
   return index;
@@ -1135,7 +1135,7 @@
 
   int index = itable_index;
   // Adjust for <clinit>, which is left out of table if first method
-  if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) {
+  if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) {
     index++;
   }
 
--- a/hotspot/src/share/vm/oops/methodDataOop.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/methodDataOop.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -228,7 +228,7 @@
     return byte_offset_of(DataLayout, _header._struct._bci);
   }
   static ByteSize cell_offset(int index) {
-    return byte_offset_of(DataLayout, _cells[index]);
+    return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size);
   }
   // Return a value which, when or-ed as a byte into _flags, sets the flag.
   static int flag_number_to_byte_constant(int flag_number) {
--- a/hotspot/src/share/vm/oops/methodKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/methodKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -103,6 +103,12 @@
   m->backedge_counter()->init();
   m->clear_number_of_breakpoints();
 
+#ifdef TIERED
+  m->set_rate(0);
+  m->set_prev_event_count(0);
+  m->set_prev_time(0);
+#endif
+
   assert(m->is_parsable(), "must be parsable here.");
   assert(m->size() == size, "wrong size for object");
   // We should not publish an uprasable object's reference
--- a/hotspot/src/share/vm/oops/methodOop.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -466,7 +466,20 @@
 
 
 bool methodOopDesc::is_initializer() const {
-  return name() == vmSymbols::object_initializer_name() || name() == vmSymbols::class_initializer_name();
+  return name() == vmSymbols::object_initializer_name() || is_static_initializer();
+}
+
+bool methodOopDesc::has_valid_initializer_flags() const {
+  return (is_static() ||
+          instanceKlass::cast(method_holder())->major_version() < 51);
+}
+
+bool methodOopDesc::is_static_initializer() const {
+  // For classfiles version 51 or greater, ensure that the clinit method is
+  // static.  Non-static methods with the name "<clinit>" are not static
+  // initializers. (older classfiles exempted for backward compatibility)
+  return name() == vmSymbols::class_initializer_name() &&
+         has_valid_initializer_flags();
 }
 
 
@@ -842,7 +855,7 @@
   case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
     return true;
   }
-  if (AllowTransitionalJSR292
+  if ((AllowTransitionalJSR292 || AllowInvokeForInvokeGeneric)
       && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
     return true;
   return false;
@@ -852,7 +865,7 @@
 enum {
   _imcp_invoke_name = 1,        // utf8: 'invokeExact' or 'invokeGeneric'
   _imcp_invoke_signature,       // utf8: (variable Symbol*)
-  _imcp_method_type_value,      // string: (variable java/dyn/MethodType, sic)
+  _imcp_method_type_value,      // string: (variable java/lang/invoke/MethodType, sic)
   _imcp_limit
 };
 
@@ -1078,7 +1091,8 @@
   vmSymbols::SID  name_id = vmSymbols::find_sid(name());
   if (name_id == vmSymbols::NO_SID)  return;
   vmSymbols::SID   sig_id = vmSymbols::find_sid(signature());
-  if (klass_id != vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle)
+  if (klass_id != vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle)
+      && !(klass_id == vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle) && AllowTransitionalJSR292)
       && sig_id == vmSymbols::NO_SID)  return;
   jshort flags = access_flags().as_short();
 
@@ -1104,7 +1118,8 @@
     break;
 
   // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle):
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle):  // AllowTransitionalJSR292 ONLY
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
     if (is_static() || !is_native())  break;
     switch (name_id) {
     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
@@ -1114,11 +1129,12 @@
       id = vmIntrinsics::_invokeExact;
       break;
     case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
-      if (AllowTransitionalJSR292)  id = vmIntrinsics::_invokeExact;
+      if (AllowInvokeForInvokeGeneric)   id = vmIntrinsics::_invokeGeneric;
+      else if (AllowTransitionalJSR292)  id = vmIntrinsics::_invokeExact;
       break;
     }
     break;
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_InvokeDynamic):
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InvokeDynamic):
     if (!is_static() || !is_native())  break;
     id = vmIntrinsics::_invokeDynamic;
     break;
--- a/hotspot/src/share/vm/oops/methodOop.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -84,6 +84,11 @@
 // | invocation_counter                                   |
 // | backedge_counter                                     |
 // |------------------------------------------------------|
+// |           prev_time (tiered only, 64 bit wide)       |
+// |                                                      |
+// |------------------------------------------------------|
+// |                  rate (tiered)                       |
+// |------------------------------------------------------|
 // | code                           (pointer)             |
 // | i2i                            (pointer)             |
 // | adapter                        (pointer)             |
@@ -124,6 +129,11 @@
   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
 
+#ifdef TIERED
+  jlong             _prev_time;                   // Previous time the rate was acquired
+  float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
+#endif
+
 #ifndef PRODUCT
   int               _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
 #endif
@@ -304,6 +314,17 @@
   InvocationCounter* invocation_counter() { return &_invocation_counter; }
   InvocationCounter* backedge_counter()   { return &_backedge_counter; }
 
+#ifdef TIERED
+  // We are reusing interpreter_invocation_count as a holder for the previous event count!
+  // We can do that since interpreter_invocation_count is not used in tiered.
+  int prev_event_count() const                   { return _interpreter_invocation_count;  }
+  void set_prev_event_count(int count)           { _interpreter_invocation_count = count; }
+  jlong prev_time() const                        { return _prev_time; }
+  void set_prev_time(jlong time)                 { _prev_time = time; }
+  float rate() const                             { return _rate; }
+  void set_rate(float rate)                      { _rate = rate; }
+#endif
+
   int invocation_count();
   int backedge_count();
 
@@ -497,6 +518,13 @@
   // returns true if the method is an initializer (<init> or <clinit>).
   bool is_initializer() const;
 
+  // returns true if the method is static OR if the classfile version < 51
+  bool has_valid_initializer_flags() const;
+
+  // returns true if the method name is <clinit> and the method has
+  // valid static initializer flags.
+  bool is_static_initializer() const;
+
   // compiled code support
   // NOTE: code() is inherently racy as deopt can be clearing code
   // simultaneously. Use with caution.
--- a/hotspot/src/share/vm/oops/objArrayKlassKlass.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlassKlass.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -31,6 +31,13 @@
 #include "oops/objArrayKlassKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.inline2.hpp"
+#ifndef SERIALGC
+#include "gc_implementation/parNew/parOopClosures.inline.hpp"
+#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
+#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
+#include "memory/cardTableRS.hpp"
+#include "oops/oop.pcgc.inline.hpp"
+#endif
 
 klassOop objArrayKlassKlass::create_klass(TRAPS) {
   objArrayKlassKlass o;
@@ -236,12 +243,23 @@
   addr = oak->bottom_klass_addr();
   if (mr.contains(addr)) blk->do_oop(addr);
 
-  return arrayKlassKlass::oop_oop_iterate(obj, blk);
+  return arrayKlassKlass::oop_oop_iterate_m(obj, blk, mr);
 }
 
 #ifndef SERIALGC
 void objArrayKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
   assert(obj->blueprint()->oop_is_objArrayKlass(),"must be an obj array klass");
+  objArrayKlass* oak = objArrayKlass::cast((klassOop)obj);
+  oop* p = oak->element_klass_addr();
+  if (PSScavenge::should_scavenge(p)) {
+    pm->claim_or_forward_depth(p);
+  }
+  p = oak->bottom_klass_addr();
+  if (PSScavenge::should_scavenge(p)) {
+    pm->claim_or_forward_depth(p);
+  }
+
+  arrayKlassKlass::oop_push_contents(pm, obj);
 }
 
 int objArrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
@@ -287,7 +305,7 @@
 // Verification
 
 void objArrayKlassKlass::oop_verify_on(oop obj, outputStream* st) {
-  klassKlass::oop_verify_on(obj, st);
+  arrayKlassKlass::oop_verify_on(obj, st);
   objArrayKlass* oak = objArrayKlass::cast((klassOop)obj);
   guarantee(oak->element_klass()->is_perm(),  "should be in permspace");
   guarantee(oak->element_klass()->is_klass(), "should be klass");
--- a/hotspot/src/share/vm/oops/oop.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/oop.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -129,6 +129,7 @@
 
   // type test operations (inlined in oop.inline.h)
   bool is_instance()           const;
+  bool is_instanceMirror()     const;
   bool is_instanceRef()        const;
   bool is_array()              const;
   bool is_objArray()           const;
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -141,6 +141,7 @@
 inline bool oopDesc::is_a(klassOop k)        const { return blueprint()->is_subtype_of(k); }
 
 inline bool oopDesc::is_instance()           const { return blueprint()->oop_is_instance(); }
+inline bool oopDesc::is_instanceMirror()     const { return blueprint()->oop_is_instanceMirror(); }
 inline bool oopDesc::is_instanceRef()        const { return blueprint()->oop_is_instanceRef(); }
 inline bool oopDesc::is_array()              const { return blueprint()->oop_is_array(); }
 inline bool oopDesc::is_objArray()           const { return blueprint()->oop_is_objArray(); }
@@ -399,7 +400,7 @@
 
 inline int oopDesc::size_given_klass(Klass* klass)  {
   int lh = klass->layout_helper();
-  int s  = lh >> LogHeapWordSize;  // deliver size scaled by wordSize
+  int s;
 
   // lh is now a value computed at class initialization that may hint
   // at the size.  For instances, this is positive and equal to the
@@ -412,7 +413,13 @@
   // alive or dead.  So the speed here is equal in importance to the
   // speed of allocation.
 
-  if (lh <= Klass::_lh_neutral_value) {
+  if (lh > Klass::_lh_neutral_value) {
+    if (!Klass::layout_helper_needs_slow_path(lh)) {
+      s = lh >> LogHeapWordSize;  // deliver size scaled by wordSize
+    } else {
+      s = klass->oop_size(this);
+    }
+  } else if (lh <= Klass::_lh_neutral_value) {
     // The most common case is instances; fall through if so.
     if (lh < Klass::_lh_neutral_value) {
       // Second most common case is arrays.  We have to fetch the
--- a/hotspot/src/share/vm/oops/oopsHierarchy.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/oops/oopsHierarchy.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -174,6 +174,7 @@
 
 class Klass;
 class   instanceKlass;
+class     instanceMirrorKlass;
 class     instanceRefKlass;
 class   methodKlass;
 class   constMethodKlass;
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -487,7 +487,7 @@
     if (caller_jvms->method()->is_method_handle_adapter())
       new_depth_adjust -= 1;  // don't count actions in MH or indy adapter frames
     else if (callee_method->is_method_handle_invoke()) {
-      new_depth_adjust -= 1;  // don't count method handle calls from java.dyn implem
+      new_depth_adjust -= 1;  // don't count method handle calls from java.lang.invoke implem
     }
     if (new_depth_adjust != 0 && PrintInlining) {
       stringStream nm1; caller_jvms->method()->print_name(&nm1);
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -180,6 +180,9 @@
   develop(bool, TraceLoopPredicate, false,                                  \
           "Trace generation of loop predicates")                            \
                                                                             \
+  develop(bool, TraceLoopOpts, false,                                       \
+          "Trace executed loop optimizations")                              \
+                                                                            \
   product(bool, OptimizeFill, false,                                        \
           "convert fill/copy loops into intrinsic")                         \
                                                                             \
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -199,7 +199,7 @@
   Node* call_site = kit.make_load(kit.control(), call_site_adr, TypeInstPtr::BOTTOM, T_OBJECT, Compile::AliasIdxRaw);
 
   // Load the target MethodHandle from the CallSite object.
-  Node* target_mh_adr = kit.basic_plus_adr(call_site, call_site, java_dyn_CallSite::target_offset_in_bytes());
+  Node* target_mh_adr = kit.basic_plus_adr(call_site, call_site, java_lang_invoke_CallSite::target_offset_in_bytes());
   Node* target_mh = kit.make_load(kit.control(), target_mh_adr, TypeInstPtr::BOTTOM, T_OBJECT);
 
   address resolve_stub = SharedRuntime::get_resolve_opt_virtual_call_stub();
@@ -725,7 +725,7 @@
   Node* call_site     = kit.make_load(kit.control(), call_site_adr, TypeInstPtr::BOTTOM, T_OBJECT, Compile::AliasIdxRaw);
 
   // Load the target MethodHandle from the CallSite object.
-  Node* target_adr = kit.basic_plus_adr(call_site, call_site, java_dyn_CallSite::target_offset_in_bytes());
+  Node* target_adr = kit.basic_plus_adr(call_site, call_site, java_lang_invoke_CallSite::target_offset_in_bytes());
   Node* target_mh  = kit.make_load(kit.control(), target_adr, TypeInstPtr::BOTTOM, T_OBJECT);
 
   // Check if the MethodHandle is still the same.
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -1202,11 +1202,15 @@
   // Oop pointers need some flattening
   const TypeInstPtr *to = tj->isa_instptr();
   if( to && _AliasLevel >= 2 && to != TypeOopPtr::BOTTOM ) {
+    ciInstanceKlass *k = to->klass()->as_instance_klass();
     if( ptr == TypePtr::Constant ) {
-      // No constant oop pointers (such as Strings); they alias with
-      // unknown strings.
-      assert(!is_known_inst, "not scalarizable allocation");
-      tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,offset);
+      if (to->klass() != ciEnv::current()->Class_klass() ||
+          offset < k->size_helper() * wordSize) {
+        // No constant oop pointers (such as Strings); they alias with
+        // unknown strings.
+        assert(!is_known_inst, "not scalarizable allocation");
+        tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,offset);
+      }
     } else if( is_known_inst ) {
       tj = to; // Keep NotNull and klass_is_exact for instance type
     } else if( ptr == TypePtr::NotNull || to->klass_is_exact() ) {
@@ -1216,7 +1220,6 @@
       tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,offset);
     }
     // Canonicalize the holder of this field
-    ciInstanceKlass *k = to->klass()->as_instance_klass();
     if (offset >= 0 && offset < instanceOopDesc::base_offset_in_bytes()) {
       // First handle header references such as a LoadKlassNode, even if the
       // object's klass is unloaded at compile time (4965979).
@@ -1224,9 +1227,13 @@
         tj = to = TypeInstPtr::make(TypePtr::BotPTR, env()->Object_klass(), false, NULL, offset);
       }
     } else if (offset < 0 || offset >= k->size_helper() * wordSize) {
-      to = NULL;
-      tj = TypeOopPtr::BOTTOM;
-      offset = tj->offset();
+      // Static fields are in the space above the normal instance
+      // fields in the java.lang.Class instance.
+      if (to->klass() != ciEnv::current()->Class_klass()) {
+        to = NULL;
+        tj = TypeOopPtr::BOTTOM;
+        offset = tj->offset();
+      }
     } else {
       ciInstanceKlass *canonical_holder = k->get_canonical_holder(offset);
       if (!k->equals(canonical_holder) || tj->offset() != offset) {
@@ -1399,7 +1406,7 @@
 
 
 //--------------------------------find_alias_type------------------------------
-Compile::AliasType* Compile::find_alias_type(const TypePtr* adr_type, bool no_create) {
+Compile::AliasType* Compile::find_alias_type(const TypePtr* adr_type, bool no_create, ciField* original_field) {
   if (_AliasLevel == 0)
     return alias_type(AliasIdxBot);
 
@@ -1464,22 +1471,28 @@
     // but the base pointer type is not distinctive enough to identify
     // references into JavaThread.)
 
-    // Check for final instance fields.
+    // Check for final fields.
     const TypeInstPtr* tinst = flat->isa_instptr();
     if (tinst && tinst->offset() >= instanceOopDesc::base_offset_in_bytes()) {
-      ciInstanceKlass *k = tinst->klass()->as_instance_klass();
-      ciField* field = k->get_field_by_offset(tinst->offset(), false);
+      ciField* field;
+      if (tinst->const_oop() != NULL &&
+          tinst->klass() == ciEnv::current()->Class_klass() &&
+          tinst->offset() >= (tinst->klass()->as_instance_klass()->size_helper() * wordSize)) {
+        // static field
+        ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass();
+        field = k->get_field_by_offset(tinst->offset(), true);
+      } else {
+        ciInstanceKlass *k = tinst->klass()->as_instance_klass();
+        field = k->get_field_by_offset(tinst->offset(), false);
+      }
+      assert(field == NULL ||
+             original_field == NULL ||
+             (field->holder() == original_field->holder() &&
+              field->offset() == original_field->offset() &&
+              field->is_static() == original_field->is_static()), "wrong field?");
       // Set field() and is_rewritable() attributes.
       if (field != NULL)  alias_type(idx)->set_field(field);
     }
-    const TypeKlassPtr* tklass = flat->isa_klassptr();
-    // Check for final static fields.
-    if (tklass && tklass->klass()->is_instance_klass()) {
-      ciInstanceKlass *k = tklass->klass()->as_instance_klass();
-      ciField* field = k->get_field_by_offset(tklass->offset(), true);
-      // Set field() and is_rewritable() attributes.
-      if (field != NULL)   alias_type(idx)->set_field(field);
-    }
   }
 
   // Fill the cache for next time.
@@ -1502,10 +1515,10 @@
 Compile::AliasType* Compile::alias_type(ciField* field) {
   const TypeOopPtr* t;
   if (field->is_static())
-    t = TypeKlassPtr::make(field->holder());
+    t = TypeInstPtr::make(field->holder()->java_mirror());
   else
     t = TypeOopPtr::make_from_klass_raw(field->holder());
-  AliasType* atp = alias_type(t->add_offset(field->offset_in_bytes()));
+  AliasType* atp = alias_type(t->add_offset(field->offset_in_bytes()), field);
   assert(field->is_final() == !atp->is_rewritable(), "must get the rewritable bits correct");
   return atp;
 }
@@ -1522,7 +1535,7 @@
   if (adr_type == NULL)             return true;
   if (adr_type == TypePtr::BOTTOM)  return true;
 
-  return find_alias_type(adr_type, true) != NULL;
+  return find_alias_type(adr_type, true, NULL) != NULL;
 }
 
 //-----------------------------must_alias--------------------------------------
--- a/hotspot/src/share/vm/opto/compile.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -596,7 +596,7 @@
   }
 
   AliasType*        alias_type(int                idx)  { assert(idx < num_alias_types(), "oob"); return _alias_types[idx]; }
-  AliasType*        alias_type(const TypePtr* adr_type) { return find_alias_type(adr_type, false); }
+  AliasType*        alias_type(const TypePtr* adr_type, ciField* field = NULL) { return find_alias_type(adr_type, false, field); }
   bool         have_alias_type(const TypePtr* adr_type);
   AliasType*        alias_type(ciField*         field);
 
@@ -835,7 +835,7 @@
   void grow_alias_types();
   AliasCacheEntry* probe_alias_cache(const TypePtr* adr_type);
   const TypePtr *flatten_alias_type(const TypePtr* adr_type) const;
-  AliasType* find_alias_type(const TypePtr* adr_type, bool no_create);
+  AliasType* find_alias_type(const TypePtr* adr_type, bool no_create, ciField* field);
 
   void verify_top(Node*) const PRODUCT_RETURN;
 
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3338,6 +3338,49 @@
   return NULL;
 }
 
+//----------------------------- loop predicates ---------------------------
+
+//------------------------------add_predicate_impl----------------------------
+void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs) {
+  // Too many traps seen?
+  if (too_many_traps(reason)) {
+#ifdef ASSERT
+    if (TraceLoopPredicate) {
+      int tc = C->trap_count(reason);
+      tty->print("too many traps=%s tcount=%d in ",
+                    Deoptimization::trap_reason_name(reason), tc);
+      method()->print(); // which method has too many predicate traps
+      tty->cr();
+    }
+#endif
+    // We cannot afford to take more traps here,
+    // do not generate predicate.
+    return;
+  }
+
+  Node *cont    = _gvn.intcon(1);
+  Node* opq     = _gvn.transform(new (C, 2) Opaque1Node(C, cont));
+  Node *bol     = _gvn.transform(new (C, 2) Conv2BNode(opq));
+  IfNode* iff   = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
+  Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff));
+  C->add_predicate_opaq(opq);
+  {
+    PreserveJVMState pjvms(this);
+    set_control(iffalse);
+    _sp += nargs;
+    uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
+  }
+  Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff));
+  set_control(iftrue);
+}
+
+//------------------------------add_predicate---------------------------------
+void GraphKit::add_predicate(int nargs) {
+  if (UseLoopPredicate) {
+    add_predicate_impl(Deoptimization::Reason_predicate, nargs);
+  }
+}
+
 //----------------------------- store barriers ----------------------------
 #define __ ideal.
 
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -793,6 +793,10 @@
     if (!tst->is_Con())  record_for_igvn(iff);     // Range-check and Null-check removal is later
     return iff;
   }
+
+  // Insert a loop predicate into the graph
+  void add_predicate(int nargs = 0);
+  void add_predicate_impl(Deoptimization::DeoptReason reason, int nargs);
 };
 
 // Helper class to support building of control flow branches. Upon
--- a/hotspot/src/share/vm/opto/idealKit.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/idealKit.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -154,8 +154,18 @@
 //
 // Pushes the loop top cvstate first, then the else (loop exit) cvstate
 // onto the stack.
-void IdealKit::loop(IdealVariable& iv, Node* init, BoolTest::mask relop, Node* limit, float prob, float cnt) {
+void IdealKit::loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask relop, Node* limit, float prob, float cnt) {
   assert((state() & (BlockS|LoopS|IfThenS|ElseS)), "bad state for new loop");
+
+  // Sync IdealKit and graphKit.
+  gkit->set_all_memory(this->merged_memory());
+  gkit->set_control(this->ctrl());
+  // Add loop predicate.
+  gkit->add_predicate(nargs);
+  // Update IdealKit memory.
+  this->set_all_memory(gkit->merged_memory());
+  this->set_ctrl(gkit->control());
+
   set(iv, init);
   Node* head = make_label(1);
   bind(head);
--- a/hotspot/src/share/vm/opto/idealKit.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/idealKit.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -29,6 +29,7 @@
 #include "opto/cfgnode.hpp"
 #include "opto/connode.hpp"
 #include "opto/divnode.hpp"
+#include "opto/graphKit.hpp"
 #include "opto/mulnode.hpp"
 #include "opto/phaseX.hpp"
 #include "opto/subnode.hpp"
@@ -160,7 +161,7 @@
                bool push_new_state = true);
   void else_();
   void end_if();
-  void loop(IdealVariable& iv, Node* init, BoolTest::mask cmp, Node* limit,
+  void loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask cmp, Node* limit,
             float prob = PROB_LIKELY(0.9), float cnt = COUNT_UNKNOWN);
   void end_loop();
   Node* make_label(int goto_ct);
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1101,6 +1101,8 @@
   float likely   = PROB_LIKELY(0.9);
   float unlikely = PROB_UNLIKELY(0.9);
 
+  const int nargs = 2; // number of arguments to push back for uncommon trap in predicate
+
   const int value_offset  = java_lang_String::value_offset_in_bytes();
   const int count_offset  = java_lang_String::count_offset_in_bytes();
   const int offset_offset = java_lang_String::offset_offset_in_bytes();
@@ -1116,7 +1118,7 @@
   Node* sourcea       = basic_plus_adr(string_object, string_object, value_offset);
   Node* source        = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset));
 
-  Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array)) );
+  Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
   jint target_length = target_array->length();
   const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
   const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
@@ -1138,12 +1140,12 @@
   Node* return_    = __ make_label(1);
 
   __ set(rtn,__ ConI(-1));
-  __ loop(i, sourceOffset, BoolTest::lt, sourceEnd); {
+  __ loop(this, nargs, i, sourceOffset, BoolTest::lt, sourceEnd); {
        Node* i2  = __ AddI(__ value(i), targetCountLess1);
        // pin to prohibit loading of "next iteration" value which may SEGV (rare)
        Node* src = load_array_element(__ ctrl(), source, i2, TypeAryPtr::CHARS);
        __ if_then(src, BoolTest::eq, lastChar, unlikely); {
-         __ loop(j, zero, BoolTest::lt, targetCountLess1); {
+         __ loop(this, nargs, j, zero, BoolTest::lt, targetCountLess1); {
               Node* tpj = __ AddI(targetOffset, __ value(j));
               Node* targ = load_array_element(no_ctrl, target, tpj, target_type);
               Node* ipj  = __ AddI(__ value(i), __ value(j));
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -205,6 +205,8 @@
   }
   phase->register_new_node(addx, phase->get_ctrl(x));
   phase->_igvn.replace_node(n1, addx);
+  assert(phase->get_loop(phase->get_ctrl(n1)) == this, "");
+  _body.yank(n1);
   return addx;
 }
 
@@ -307,15 +309,21 @@
   // iterations adjusted.  Therefore, we need to declare this loop as
   // no longer a 'main' loop; it will need new pre and post loops before
   // we can do further RCE.
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    tty->print("Peel         ");
+    loop->dump_head();
+  }
+#endif
   Node *h = loop->_head;
-  if( h->is_CountedLoop() ) {
+  if (h->is_CountedLoop()) {
     CountedLoopNode *cl = h->as_CountedLoop();
     assert(cl->trip_count() > 0, "peeling a fully unrolled loop");
     cl->set_trip_count(cl->trip_count() - 1);
-    if( cl->is_main_loop() ) {
+    if (cl->is_main_loop()) {
       cl->set_normal_loop();
 #ifndef PRODUCT
-      if( PrintOpto && VerifyLoopOptimizations ) {
+      if (PrintOpto && VerifyLoopOptimizations) {
         tty->print("Peeling a 'main' loop; resetting to 'normal' ");
         loop->dump_head();
       }
@@ -645,6 +653,15 @@
 // alignment.  Useful to unroll loops that do no array accesses.
 void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_new, bool peel_only ) {
 
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    if (peel_only)
+      tty->print("PeelMainPost ");
+    else
+      tty->print("PreMainPost  ");
+    loop->dump_head();
+  }
+#endif
   C->set_major_progress();
 
   // Find common pieces of the loop being guarded with pre & post loops
@@ -897,16 +914,19 @@
 //------------------------------do_unroll--------------------------------------
 // Unroll the loop body one step - make each trip do 2 iterations.
 void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip ) {
-  assert( LoopUnrollLimit, "" );
+  assert(LoopUnrollLimit, "");
+  CountedLoopNode *loop_head = loop->_head->as_CountedLoop();
+  CountedLoopEndNode *loop_end = loop_head->loopexit();
+  assert(loop_end, "");
 #ifndef PRODUCT
-  if( PrintOpto && VerifyLoopOptimizations ) {
+  if (PrintOpto && VerifyLoopOptimizations) {
     tty->print("Unrolling ");
     loop->dump_head();
+  } else if (TraceLoopOpts) {
+    tty->print("Unroll     %d ", loop_head->unrolled_count()*2);
+    loop->dump_head();
   }
 #endif
-  CountedLoopNode *loop_head = loop->_head->as_CountedLoop();
-  CountedLoopEndNode *loop_end = loop_head->loopexit();
-  assert( loop_end, "" );
 
   // Remember loop node count before unrolling to detect
   // if rounds of unroll,optimize are making progress
@@ -915,7 +935,7 @@
   Node *ctrl  = loop_head->in(LoopNode::EntryControl);
   Node *limit = loop_head->limit();
   Node *init  = loop_head->init_trip();
-  Node *strid = loop_head->stride();
+  Node *stride = loop_head->stride();
 
   Node *opaq = NULL;
   if( adjust_min_trip ) {       // If not maximally unrolling, need adjustment
@@ -955,13 +975,13 @@
   // odd iteration: (trip_cnt & ~1).  Then back compute a new limit.
   Node *span = new (C, 3) SubINode( limit, init );
   register_new_node( span, ctrl );
-  Node *trip = new (C, 3) DivINode( 0, span, strid );
+  Node *trip = new (C, 3) DivINode( 0, span, stride );
   register_new_node( trip, ctrl );
   Node *mtwo = _igvn.intcon(-2);
   set_ctrl(mtwo, C->root());
   Node *rond = new (C, 3) AndINode( trip, mtwo );
   register_new_node( rond, ctrl );
-  Node *spn2 = new (C, 3) MulINode( rond, strid );
+  Node *spn2 = new (C, 3) MulINode( rond, stride );
   register_new_node( spn2, ctrl );
   Node *lim2 = new (C, 3) AddINode( spn2, init );
   register_new_node( lim2, ctrl );
@@ -1040,17 +1060,23 @@
 
 void PhaseIdealLoop::do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new ) {
   CountedLoopNode *cl = loop->_head->as_CountedLoop();
-  assert( cl->trip_count() > 0, "");
+  assert(cl->trip_count() > 0, "");
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    tty->print("MaxUnroll  %d ", cl->trip_count());
+    loop->dump_head();
+  }
+#endif
 
   // If loop is tripping an odd number of times, peel odd iteration
-  if( (cl->trip_count() & 1) == 1 ) {
-    do_peeling( loop, old_new );
+  if ((cl->trip_count() & 1) == 1) {
+    do_peeling(loop, old_new);
   }
 
   // Now its tripping an even number of times remaining.  Double loop body.
   // Do not adjust pre-guards; they are not needed and do not exist.
-  if( cl->trip_count() > 0 ) {
-    do_unroll( loop, old_new, false );
+  if (cl->trip_count() > 0) {
+    do_unroll(loop, old_new, false);
   }
 }
 
@@ -1227,35 +1253,55 @@
 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
 void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
 #ifndef PRODUCT
-  if( PrintOpto && VerifyLoopOptimizations ) {
+  if (PrintOpto && VerifyLoopOptimizations) {
     tty->print("Range Check Elimination ");
     loop->dump_head();
+  } else if (TraceLoopOpts) {
+    tty->print("RangeCheck   ");
+    loop->dump_head();
   }
 #endif
-  assert( RangeCheckElimination, "" );
+  assert(RangeCheckElimination, "");
   CountedLoopNode *cl = loop->_head->as_CountedLoop();
-  assert( cl->is_main_loop(), "" );
+  assert(cl->is_main_loop(), "");
+
+  // protect against stride not being a constant
+  if (!cl->stride_is_con())
+    return;
 
   // Find the trip counter; we are iteration splitting based on it
   Node *trip_counter = cl->phi();
   // Find the main loop limit; we will trim it's iterations
   // to not ever trip end tests
   Node *main_limit = cl->limit();
+
+  // Need to find the main-loop zero-trip guard
+  Node *ctrl  = cl->in(LoopNode::EntryControl);
+  assert(ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "");
+  Node *iffm = ctrl->in(0);
+  assert(iffm->Opcode() == Op_If, "");
+  Node *bolzm = iffm->in(1);
+  assert(bolzm->Opcode() == Op_Bool, "");
+  Node *cmpzm = bolzm->in(1);
+  assert(cmpzm->is_Cmp(), "");
+  Node *opqzm = cmpzm->in(2);
+  // Can not optimize a loop if pre-loop Opaque1 node is optimized
+  // away and then another round of loop opts attempted.
+  if (opqzm->Opcode() != Op_Opaque1)
+    return;
+  assert(opqzm->in(1) == main_limit, "do not understand situation");
+
   // Find the pre-loop limit; we will expand it's iterations to
   // not ever trip low tests.
-  Node *ctrl  = cl->in(LoopNode::EntryControl);
-  assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" );
-  Node *iffm = ctrl->in(0);
-  assert( iffm->Opcode() == Op_If, "" );
   Node *p_f = iffm->in(0);
-  assert( p_f->Opcode() == Op_IfFalse, "" );
+  assert(p_f->Opcode() == Op_IfFalse, "");
   CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
-  assert( pre_end->loopnode()->is_pre_loop(), "" );
+  assert(pre_end->loopnode()->is_pre_loop(), "");
   Node *pre_opaq1 = pre_end->limit();
   // Occasionally it's possible for a pre-loop Opaque1 node to be
   // optimized away and then another round of loop opts attempted.
   // We can not optimize this particular loop in that case.
-  if( pre_opaq1->Opcode() != Op_Opaque1 )
+  if (pre_opaq1->Opcode() != Op_Opaque1)
     return;
   Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1;
   Node *pre_limit = pre_opaq->in(1);
@@ -1266,25 +1312,11 @@
   // Ensure the original loop limit is available from the
   // pre-loop Opaque1 node.
   Node *orig_limit = pre_opaq->original_loop_limit();
-  if( orig_limit == NULL || _igvn.type(orig_limit) == Type::TOP )
+  if (orig_limit == NULL || _igvn.type(orig_limit) == Type::TOP)
     return;
 
-  // Need to find the main-loop zero-trip guard
-  Node *bolzm = iffm->in(1);
-  assert( bolzm->Opcode() == Op_Bool, "" );
-  Node *cmpzm = bolzm->in(1);
-  assert( cmpzm->is_Cmp(), "" );
-  Node *opqzm = cmpzm->in(2);
-  if( opqzm->Opcode() != Op_Opaque1 )
-    return;
-  assert( opqzm->in(1) == main_limit, "do not understand situation" );
-
   // Must know if its a count-up or count-down loop
 
-  // protect against stride not being a constant
-  if ( !cl->stride_is_con() ) {
-    return;
-  }
   int stride_con = cl->stride_con();
   Node *zero = _igvn.intcon(0);
   Node *one  = _igvn.intcon(1);
@@ -1566,16 +1598,24 @@
 // have on the last iteration.  This will break the loop.
 bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
   // Minimum size must be empty loop
-  if( _body.size() > 7/*number of nodes in an empty loop*/ ) return false;
+  if (_body.size() > 7/*number of nodes in an empty loop*/)
+    return false;
 
-  if( !_head->is_CountedLoop() ) return false;     // Dead loop
+  if (!_head->is_CountedLoop())
+    return false;     // Dead loop
   CountedLoopNode *cl = _head->as_CountedLoop();
-  if( !cl->loopexit() ) return false; // Malformed loop
-  if( !phase->is_member(this,phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue)) ) )
+  if (!cl->loopexit())
+    return false; // Malformed loop
+  if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue))))
     return false;             // Infinite loop
 #ifndef PRODUCT
-  if( PrintOpto )
-    tty->print_cr("Removing empty loop");
+  if (PrintOpto) {
+    tty->print("Removing empty loop");
+    this->dump_head();
+  } else if (TraceLoopOpts) {
+    tty->print("Empty        ");
+    this->dump_head();
+  }
 #endif
 #ifdef ASSERT
   // Ensure only one phi which is the iv.
@@ -1720,7 +1760,7 @@
 //------------------------------iteration_split--------------------------------
 bool IdealLoopTree::iteration_split( PhaseIdealLoop *phase, Node_List &old_new ) {
   // Recursively iteration split nested loops
-  if( _child && !_child->iteration_split( phase, old_new ))
+  if (_child && !_child->iteration_split(phase, old_new))
     return false;
 
   // Clean out prior deadwood
@@ -1729,21 +1769,20 @@
 
   // Look for loop-exit tests with my 50/50 guesses from the Parsing stage.
   // Replace with a 1-in-10 exit guess.
-  if( _parent /*not the root loop*/ &&
+  if (_parent /*not the root loop*/ &&
       !_irreducible &&
       // Also ignore the occasional dead backedge
-      !tail()->is_top() ) {
+      !tail()->is_top()) {
     adjust_loop_exit_prob(phase);
   }
 
-
   // Gate unrolling, RCE and peeling efforts.
-  if( !_child &&                // If not an inner loop, do not split
+  if (!_child &&                // If not an inner loop, do not split
       !_irreducible &&
       _allow_optimizations &&
-      !tail()->is_top() ) {     // Also ignore the occasional dead backedge
+      !tail()->is_top()) {     // Also ignore the occasional dead backedge
     if (!_has_call) {
-        if (!iteration_split_impl( phase, old_new )) {
+        if (!iteration_split_impl(phase, old_new)) {
           return false;
         }
     } else if (policy_unswitching(phase)) {
@@ -1752,16 +1791,17 @@
   }
 
   // Minor offset re-organization to remove loop-fallout uses of
-  // trip counter.
-  if( _head->is_CountedLoop() ) phase->reorg_offsets( this );
-  if( _next && !_next->iteration_split( phase, old_new ))
+  // trip counter when there was no major reshaping.
+  phase->reorg_offsets(this);
+
+  if (_next && !_next->iteration_split(phase, old_new))
     return false;
   return true;
 }
 
 //-------------------------------is_uncommon_trap_proj----------------------------
 // Return true if proj is the form of "proj->[region->..]call_uct"
-bool PhaseIdealLoop::is_uncommon_trap_proj(ProjNode* proj, bool must_reason_predicate) {
+bool PhaseIdealLoop::is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason) {
   int path_limit = 10;
   assert(proj, "invalid argument");
   Node* out = proj;
@@ -1772,8 +1812,8 @@
     if (out->is_CallStaticJava()) {
       int req = out->as_CallStaticJava()->uncommon_trap_request();
       if (req != 0) {
-        Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(req);
-        if (!must_reason_predicate || reason == Deoptimization::Reason_predicate){
+        Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
+        if (trap_reason == reason || reason == Deoptimization::Reason_none) {
            return true;
         }
       }
@@ -1790,15 +1830,15 @@
 //                      other_proj->[region->..]call_uct"
 //
 // "must_reason_predicate" means the uct reason must be Reason_predicate
-bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, bool must_reason_predicate) {
+bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, Deoptimization::DeoptReason reason) {
   Node *in0 = proj->in(0);
   if (!in0->is_If()) return false;
   // Variation of a dead If node.
   if (in0->outcnt() < 2)  return false;
   IfNode* iff = in0->as_If();
 
-  // we need "If(Conv2B(Opaque1(...)))" pattern for must_reason_predicate
-  if (must_reason_predicate) {
+  // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate
+  if (reason != Deoptimization::Reason_none) {
     if (iff->in(1)->Opcode() != Op_Conv2B ||
        iff->in(1)->in(1)->Opcode() != Op_Opaque1) {
       return false;
@@ -1806,7 +1846,19 @@
   }
 
   ProjNode* other_proj = iff->proj_out(1-proj->_con)->as_Proj();
-  return is_uncommon_trap_proj(other_proj, must_reason_predicate);
+  return is_uncommon_trap_proj(other_proj, reason);
+}
+
+//-------------------------------register_control-------------------------
+void PhaseIdealLoop::register_control(Node* n, IdealLoopTree *loop, Node* pred) {
+  assert(n->is_CFG(), "must be control node");
+  _igvn.register_new_node_with_optimizer(n);
+  loop->_body.push(n);
+  set_loop(n, loop);
+  // When called from beautify_loops() idom is not constructed yet.
+  if (_idom != NULL) {
+    set_idom(n, pred, dom_depth(pred));
+  }
 }
 
 //------------------------------create_new_if_for_predicate------------------------
@@ -1843,8 +1895,10 @@
 //
 // We will create a region to guard the uct call if there is no one there.
 // The true projecttion (if_cont) of the new_iff is returned.
-ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj) {
-  assert(is_uncommon_trap_if_pattern(cont_proj, true), "must be a uct if pattern!");
+// This code is also used to clone predicates to clonned loops.
+ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+                                                      Deoptimization::DeoptReason reason) {
+  assert(is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
   IfNode* iff = cont_proj->in(0)->as_If();
 
   ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
@@ -1854,57 +1908,84 @@
   if (!rgn->is_Region()) { // create a region to guard the call
     assert(rgn->is_Call(), "must be call uct");
     CallNode* call = rgn->as_Call();
+    IdealLoopTree* loop = get_loop(call);
     rgn = new (C, 1) RegionNode(1);
-    _igvn.set_type(rgn, rgn->bottom_type());
     rgn->add_req(uncommon_proj);
-    set_idom(rgn, idom(uncommon_proj), dom_depth(uncommon_proj)+1);
+    register_control(rgn, loop, uncommon_proj);
     _igvn.hash_delete(call);
     call->set_req(0, rgn);
+    // When called from beautify_loops() idom is not constructed yet.
+    if (_idom != NULL) {
+      set_idom(call, rgn, dom_depth(rgn));
+    }
   }
 
+  Node* entry = iff->in(0);
+  if (new_entry != NULL) {
+    // Clonning the predicate to new location.
+    entry = new_entry;
+  }
   // Create new_iff
-  uint  iffdd  = dom_depth(iff);
-  IdealLoopTree* lp = get_loop(iff);
-  IfNode *new_iff = new (C, 2) IfNode(iff->in(0), NULL, iff->_prob, iff->_fcnt);
-  register_node(new_iff, lp, idom(iff), iffdd);
+  IdealLoopTree* lp = get_loop(entry);
+  IfNode *new_iff = new (C, 2) IfNode(entry, NULL, iff->_prob, iff->_fcnt);
+  register_control(new_iff, lp, entry);
   Node *if_cont = new (C, 1) IfTrueNode(new_iff);
   Node *if_uct  = new (C, 1) IfFalseNode(new_iff);
   if (cont_proj->is_IfFalse()) {
     // Swap
     Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
   }
-  register_node(if_cont, lp, new_iff, iffdd);
-  register_node(if_uct, get_loop(rgn), new_iff, iffdd);
-
-  // if_cont to iff
-  _igvn.hash_delete(iff);
-  iff->set_req(0, if_cont);
-  set_idom(iff, if_cont, dom_depth(iff));
+  register_control(if_cont, lp, new_iff);
+  register_control(if_uct, get_loop(rgn), new_iff);
 
   // if_uct to rgn
   _igvn.hash_delete(rgn);
   rgn->add_req(if_uct);
-  Node* ridom = idom(rgn);
-  Node* nrdom = dom_lca(ridom, new_iff);
-  set_idom(rgn, nrdom, dom_depth(rgn));
-
+  // When called from beautify_loops() idom is not constructed yet.
+  if (_idom != NULL) {
+    Node* ridom = idom(rgn);
+    Node* nrdom = dom_lca(ridom, new_iff);
+    set_idom(rgn, nrdom, dom_depth(rgn));
+  }
   // rgn must have no phis
   assert(!rgn->as_Region()->has_phi(), "region must have no phis");
 
+  if (new_entry == NULL) {
+    // Attach if_cont to iff
+    _igvn.hash_delete(iff);
+    iff->set_req(0, if_cont);
+    if (_idom != NULL) {
+      set_idom(iff, if_cont, dom_depth(iff));
+    }
+  }
   return if_cont->as_Proj();
 }
 
-//------------------------------find_predicate_insertion_point--------------------------
+//--------------------------find_predicate_insertion_point-------------------
 // Find a good location to insert a predicate
-ProjNode* PhaseIdealLoop::find_predicate_insertion_point(Node* start_c) {
-  if (start_c == C->root() || !start_c->is_Proj())
+ProjNode* PhaseIdealLoop::find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason) {
+  if (start_c == NULL || !start_c->is_Proj())
     return NULL;
-  if (is_uncommon_trap_if_pattern(start_c->as_Proj(), true/*Reason_Predicate*/)) {
+  if (is_uncommon_trap_if_pattern(start_c->as_Proj(), reason)) {
     return start_c->as_Proj();
   }
   return NULL;
 }
 
+//--------------------------find_predicate------------------------------------
+// Find a predicate
+Node* PhaseIdealLoop::find_predicate(Node* entry) {
+  Node* predicate = NULL;
+  if (UseLoopPredicate) {
+    predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+    if (predicate != NULL) { // right pattern that can be used by loop predication
+      assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+      return entry;
+    }
+  }
+  return NULL;
+}
+
 //------------------------------Invariance-----------------------------------
 // Helper class for loop_predication_impl to compute invariance on the fly and
 // clone invariants.
@@ -2151,6 +2232,11 @@
     return false;
   }
 
+  if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
+    // do nothing for infinite loops
+    return false;
+  }
+
   CountedLoopNode *cl = NULL;
   if (loop->_head->is_CountedLoop()) {
     cl = loop->_head->as_CountedLoop();
@@ -2158,40 +2244,22 @@
     if (!cl->is_normal_loop()) return false;
   }
 
-  // Too many traps seen?
-  bool tmt = C->too_many_traps(C->method(), 0, Deoptimization::Reason_predicate);
-  int tc = C->trap_count(Deoptimization::Reason_predicate);
-  if (tmt || tc > 0) {
-    if (TraceLoopPredicate) {
-      tty->print_cr("too many predicate traps: %d", tc);
-      C->method()->print(); // which method has too many predicate traps
-      tty->print_cr("");
-    }
-    return false;
-  }
-
   LoopNode *lpn  = loop->_head->as_Loop();
   Node* entry = lpn->in(LoopNode::EntryControl);
 
-  ProjNode *predicate_proj = find_predicate_insertion_point(entry);
-  if (!predicate_proj){
+  ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+  if (!predicate_proj) {
 #ifndef PRODUCT
     if (TraceLoopPredicate) {
       tty->print("missing predicate:");
       loop->dump_head();
+      lpn->dump(1);
     }
 #endif
     return false;
   }
-
   ConNode* zero = _igvn.intcon(0);
   set_ctrl(zero, C->root());
-  Node *cond_false = new (C, 2) Conv2BNode(zero);
-  register_new_node(cond_false, C->root());
-  ConNode* one = _igvn.intcon(1);
-  set_ctrl(one, C->root());
-  Node *cond_true = new (C, 2) Conv2BNode(one);
-  register_new_node(cond_true, C->root());
 
   ResourceArea *area = Thread::current()->resource_area();
   Invariance invar(area, loop);
@@ -2218,7 +2286,7 @@
     ProjNode* proj = if_proj_list.pop()->as_Proj();
     IfNode*   iff  = proj->in(0)->as_If();
 
-    if (!is_uncommon_trap_if_pattern(proj)) {
+    if (!is_uncommon_trap_if_pattern(proj, Deoptimization::Reason_none)) {
       if (loop->is_loop_exit(iff)) {
         // stop processing the remaining projs in the list because the execution of them
         // depends on the condition of "iff" (iff->in(1)).
@@ -2242,7 +2310,8 @@
     BoolNode* bol = test->as_Bool();
     if (invar.is_invariant(bol)) {
       // Invariant test
-      new_predicate_proj = create_new_if_for_predicate(predicate_proj);
+      new_predicate_proj = create_new_if_for_predicate(predicate_proj, NULL,
+                                                       Deoptimization::Reason_predicate);
       Node* ctrl = new_predicate_proj->in(0)->as_If()->in(0);
       BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool();
 
@@ -2256,8 +2325,15 @@
       IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If();
       _igvn.hash_delete(new_predicate_iff);
       new_predicate_iff->set_req(1, new_predicate_bol);
-      if (TraceLoopPredicate) tty->print_cr("invariant if%s: %d", negated ? " negated" : "", new_predicate_iff->_idx);
-
+#ifndef PRODUCT
+      if (TraceLoopPredicate) {
+        tty->print("Predicate invariant if%s: %d ", negated ? " negated" : "", new_predicate_iff->_idx);
+        loop->dump_head();
+      } else if (TraceLoopOpts) {
+        tty->print("Predicate IC ");
+        loop->dump_head();
+      }
+#endif
     } else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) {
       assert(proj->_con == predicate_proj->_con, "must match");
 
@@ -2281,8 +2357,8 @@
       // lower_bound test will dominate the upper bound test and all
       // cloned or created nodes will use the lower bound test as
       // their declared control.
-      ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj);
-      ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj);
+      ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
+      ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
       assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
       Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
 
@@ -2311,41 +2387,24 @@
       // Fall through into rest of the clean up code which will move
       // any dependent nodes onto the upper bound test.
       new_predicate_proj = upper_bound_proj;
+
+#ifndef PRODUCT
+      if (TraceLoopOpts && !TraceLoopPredicate) {
+        tty->print("Predicate RC ");
+        loop->dump_head();
+      }
+#endif
     } else {
-      // The other proj of the "iff" is a uncommon trap projection, and we can assume
-      // the other proj will not be executed ("executed" means uct raised).
+      // Loop variant check (for example, range check in non-counted loop)
+      // with uncommon trap.
       continue;
     }
-
+    assert(new_predicate_proj != NULL, "sanity");
     // Success - attach condition (new_predicate_bol) to predicate if
     invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
 
-    // Eliminate the old if in the loop body
-    _igvn.hash_delete(iff);
-    iff->set_req(1, proj->is_IfFalse() ? cond_false : cond_true);
-
-    Node* ctrl = new_predicate_proj; // new control
-    ProjNode* dp = proj;     // old control
-    assert(get_loop(dp) == loop, "guaranteed at the time of collecting proj");
-    // Find nodes (depends only on the test) off the surviving projection;
-    // move them outside the loop with the control of proj_clone
-    for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
-      Node* cd = dp->fast_out(i); // Control-dependent node
-      if (cd->depends_only_on_test()) {
-        assert(cd->in(0) == dp, "");
-        _igvn.hash_delete(cd);
-        cd->set_req(0, ctrl); // ctrl, not NULL
-        set_early_ctrl(cd);
-        _igvn._worklist.push(cd);
-        IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
-        if (new_loop != loop) {
-          if (!loop->_child) loop->_body.yank(cd);
-          if (!new_loop->_child ) new_loop->_body.push(cd);
-        }
-        --i;
-        --imax;
-      }
-    }
+    // Eliminate the old If in the loop body
+    dominated_by( new_predicate_proj, iff, proj->_con != new_predicate_proj->_con );
 
     hoisted = true;
     C->set_major_progress();
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -110,6 +110,13 @@
   IfNode* unswitch_iff = find_unswitching_candidate((const IdealLoopTree *)loop);
   assert(unswitch_iff != NULL, "should be at least one");
 
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    tty->print("Unswitch   %d ", head->unswitch_count()+1);
+    loop->dump_head();
+  }
+#endif
+
   // Need to revert back to normal loop
   if (head->is_CountedLoop() && !head->as_CountedLoop()->is_normal_loop()) {
     head->as_CountedLoop()->set_normal_loop();
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -56,12 +56,32 @@
 // Dump special per-node info
 #ifndef PRODUCT
 void LoopNode::dump_spec(outputStream *st) const {
-  if( is_inner_loop () ) st->print( "inner " );
-  if( is_partial_peel_loop () ) st->print( "partial_peel " );
-  if( partial_peel_has_failed () ) st->print( "partial_peel_failed " );
+  if (is_inner_loop()) st->print( "inner " );
+  if (is_partial_peel_loop()) st->print( "partial_peel " );
+  if (partial_peel_has_failed()) st->print( "partial_peel_failed " );
 }
 #endif
 
+//------------------------------is_valid_counted_loop-------------------------
+bool LoopNode::is_valid_counted_loop() const {
+  if (is_CountedLoop()) {
+    CountedLoopNode*    l  = as_CountedLoop();
+    CountedLoopEndNode* le = l->loopexit();
+    if (le != NULL &&
+        le->proj_out(1 /* true */) == l->in(LoopNode::LoopBackControl)) {
+      Node* phi  = l->phi();
+      Node* exit = le->proj_out(0 /* false */);
+      if (exit != NULL && exit->Opcode() == Op_IfFalse &&
+          phi != NULL && phi->is_Phi() &&
+          phi->in(LoopNode::LoopBackControl) == l->incr() &&
+          le->loopnode() == l && le->stride_is_con()) {
+        return true;
+      }
+    }
+  }
+  return false;
+}
+
 //------------------------------get_early_ctrl---------------------------------
 // Compute earliest legal control
 Node *PhaseIdealLoop::get_early_ctrl( Node *n ) {
@@ -142,43 +162,44 @@
 }
 
 //------------------------------is_counted_loop--------------------------------
-Node *PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
+bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
   PhaseGVN *gvn = &_igvn;
 
   // Counted loop head must be a good RegionNode with only 3 not NULL
   // control input edges: Self, Entry, LoopBack.
-  if ( x->in(LoopNode::Self) == NULL || x->req() != 3 )
-    return NULL;
+  if (x->in(LoopNode::Self) == NULL || x->req() != 3)
+    return false;
 
   Node *init_control = x->in(LoopNode::EntryControl);
   Node *back_control = x->in(LoopNode::LoopBackControl);
-  if( init_control == NULL || back_control == NULL )    // Partially dead
-    return NULL;
+  if (init_control == NULL || back_control == NULL)    // Partially dead
+    return false;
   // Must also check for TOP when looking for a dead loop
-  if( init_control->is_top() || back_control->is_top() )
-    return NULL;
+  if (init_control->is_top() || back_control->is_top())
+    return false;
 
   // Allow funny placement of Safepoint
-  if( back_control->Opcode() == Op_SafePoint )
+  if (back_control->Opcode() == Op_SafePoint)
     back_control = back_control->in(TypeFunc::Control);
 
   // Controlling test for loop
   Node *iftrue = back_control;
   uint iftrue_op = iftrue->Opcode();
-  if( iftrue_op != Op_IfTrue &&
-      iftrue_op != Op_IfFalse )
+  if (iftrue_op != Op_IfTrue &&
+      iftrue_op != Op_IfFalse)
     // I have a weird back-control.  Probably the loop-exit test is in
     // the middle of the loop and I am looking at some trailing control-flow
     // merge point.  To fix this I would have to partially peel the loop.
-    return NULL; // Obscure back-control
+    return false; // Obscure back-control
 
   // Get boolean guarding loop-back test
   Node *iff = iftrue->in(0);
-  if( get_loop(iff) != loop || !iff->in(1)->is_Bool() ) return NULL;
+  if (get_loop(iff) != loop || !iff->in(1)->is_Bool())
+    return false;
   BoolNode *test = iff->in(1)->as_Bool();
   BoolTest::mask bt = test->_test._test;
   float cl_prob = iff->as_If()->_prob;
-  if( iftrue_op == Op_IfFalse ) {
+  if (iftrue_op == Op_IfFalse) {
     bt = BoolTest(bt).negate();
     cl_prob = 1.0 - cl_prob;
   }
@@ -186,7 +207,7 @@
   Node *cmp = test->in(1);
   int cmp_op = cmp->Opcode();
   if( cmp_op != Op_CmpI )
-    return NULL;                // Avoid pointer & float compares
+    return false;                // Avoid pointer & float compares
 
   // Find the trip-counter increment & limit.  Limit must be loop invariant.
   Node *incr  = cmp->in(1);
@@ -196,55 +217,64 @@
   // need 'loop()' test to tell if limit is loop invariant
   // ---------
 
-  if( !is_member( loop, get_ctrl(incr) ) ) { // Swapped trip counter and limit?
-    Node *tmp = incr;           // Then reverse order into the CmpI
+  if (!is_member(loop, get_ctrl(incr))) { // Swapped trip counter and limit?
+    Node *tmp = incr;            // Then reverse order into the CmpI
     incr = limit;
     limit = tmp;
     bt = BoolTest(bt).commute(); // And commute the exit test
   }
-  if( is_member( loop, get_ctrl(limit) ) ) // Limit must loop-invariant
-    return NULL;
+  if (is_member(loop, get_ctrl(limit))) // Limit must be loop-invariant
+    return false;
+  if (!is_member(loop, get_ctrl(incr))) // Trip counter must be loop-variant
+    return false;
 
+  Node* phi_incr = NULL;
   // Trip-counter increment must be commutative & associative.
-  uint incr_op = incr->Opcode();
-  if( incr_op == Op_Phi && incr->req() == 3 ) {
-    incr = incr->in(2);         // Assume incr is on backedge of Phi
-    incr_op = incr->Opcode();
+  if (incr->is_Phi()) {
+    if (incr->as_Phi()->region() != x || incr->req() != 3)
+      return false; // Not simple trip counter expression
+    phi_incr = incr;
+    incr = phi_incr->in(LoopNode::LoopBackControl); // Assume incr is on backedge of Phi
+    if (!is_member(loop, get_ctrl(incr))) // Trip counter must be loop-variant
+      return false;
   }
+
   Node* trunc1 = NULL;
   Node* trunc2 = NULL;
   const TypeInt* iv_trunc_t = NULL;
   if (!(incr = CountedLoopNode::match_incr_with_optional_truncation(incr, &trunc1, &trunc2, &iv_trunc_t))) {
-    return NULL; // Funny increment opcode
+    return false; // Funny increment opcode
   }
+  assert(incr->Opcode() == Op_AddI, "wrong increment code");
 
   // Get merge point
   Node *xphi = incr->in(1);
   Node *stride = incr->in(2);
-  if( !stride->is_Con() ) {     // Oops, swap these
-    if( !xphi->is_Con() )       // Is the other guy a constant?
-      return NULL;              // Nope, unknown stride, bail out
+  if (!stride->is_Con()) {     // Oops, swap these
+    if (!xphi->is_Con())       // Is the other guy a constant?
+      return false;             // Nope, unknown stride, bail out
     Node *tmp = xphi;           // 'incr' is commutative, so ok to swap
     xphi = stride;
     stride = tmp;
   }
-  //if( loop(xphi) != l) return NULL;// Merge point is in inner loop??
-  if( !xphi->is_Phi() ) return NULL; // Too much math on the trip counter
+  // Stride must be constant
+  int stride_con = stride->get_int();
+  assert(stride_con != 0, "missed some peephole opt");
+
+  if (!xphi->is_Phi())
+    return false; // Too much math on the trip counter
+  if (phi_incr != NULL && phi_incr != xphi)
+    return false;
   PhiNode *phi = xphi->as_Phi();
 
-  // Stride must be constant
-  const Type *stride_t = stride->bottom_type();
-  int stride_con = stride_t->is_int()->get_con();
-  assert( stride_con, "missed some peephole opt" );
-
   // Phi must be of loop header; backedge must wrap to increment
-  if( phi->region() != x ) return NULL;
-  if( trunc1 == NULL && phi->in(LoopNode::LoopBackControl) != incr ||
-      trunc1 != NULL && phi->in(LoopNode::LoopBackControl) != trunc1 ) {
-    return NULL;
+  if (phi->region() != x)
+    return false;
+  if (trunc1 == NULL && phi->in(LoopNode::LoopBackControl) != incr ||
+      trunc1 != NULL && phi->in(LoopNode::LoopBackControl) != trunc1) {
+    return false;
   }
   Node *init_trip = phi->in(LoopNode::EntryControl);
-  //if (!init_trip->is_Con()) return NULL; // avoid rolling over MAXINT/MININT
 
   // If iv trunc type is smaller than int, check for possible wrap.
   if (!TypeInt::INT->higher_equal(iv_trunc_t)) {
@@ -267,12 +297,12 @@
     if (stride_con > 0) {
       if (iv_trunc_t->_hi - phi_ft->_hi < stride_con ||
           iv_trunc_t->_lo > phi_ft->_lo) {
-        return NULL;  // truncation may occur
+        return false;  // truncation may occur
       }
     } else if (stride_con < 0) {
       if (iv_trunc_t->_lo - phi_ft->_lo > stride_con ||
           iv_trunc_t->_hi < phi_ft->_hi) {
-        return NULL;  // truncation may occur
+        return false;  // truncation may occur
       }
     }
     // No possibility of wrap so truncation can be discarded
@@ -281,35 +311,45 @@
     assert(trunc1 == NULL && trunc2 == NULL, "no truncation for int");
   }
 
+  // If the condition is inverted and we will be rolling
+  // through MININT to MAXINT, then bail out.
+  if (bt == BoolTest::eq || // Bail out, but this loop trips at most twice!
+      // Odd stride
+      bt == BoolTest::ne && stride_con != 1 && stride_con != -1 ||
+      // Count down loop rolls through MAXINT
+      (bt == BoolTest::le || bt == BoolTest::lt) && stride_con < 0 ||
+      // Count up loop rolls through MININT
+      (bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0 ) {
+    return false; // Bail out
+  }
+
+  const TypeInt* init_t = gvn->type(init_trip)->is_int();
+  const TypeInt* limit_t = gvn->type(limit)->is_int();
+
+  if (stride_con > 0) {
+    long init_p = (long)init_t->_lo + stride_con;
+    if (init_p > (long)max_jint || init_p > (long)limit_t->_hi)
+      return false; // cyclic loop or this loop trips only once
+  } else {
+    long init_p = (long)init_t->_hi + stride_con;
+    if (init_p < (long)min_jint || init_p < (long)limit_t->_lo)
+      return false; // cyclic loop or this loop trips only once
+  }
+
   // =================================================
   // ---- SUCCESS!   Found A Trip-Counted Loop!  -----
   //
-  // Canonicalize the condition on the test.  If we can exactly determine
-  // the trip-counter exit value, then set limit to that value and use
-  // a '!=' test.  Otherwise use condition '<' for count-up loops and
-  // '>' for count-down loops.  If the condition is inverted and we will
-  // be rolling through MININT to MAXINT, then bail out.
-
+  assert(x->Opcode() == Op_Loop, "regular loops only");
   C->print_method("Before CountedLoop", 3);
 
-  // Check for SafePoint on backedge and remove
-  Node *sfpt = x->in(LoopNode::LoopBackControl);
-  if( sfpt->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt)) {
-    lazy_replace( sfpt, iftrue );
-    loop->_tail = iftrue;
-  }
-
-
   // If compare points to incr, we are ok.  Otherwise the compare
   // can directly point to the phi; in this case adjust the compare so that
   // it points to the incr by adjusting the limit.
-  if( cmp->in(1) == phi || cmp->in(2) == phi )
+  if (cmp->in(1) == phi || cmp->in(2) == phi)
     limit = gvn->transform(new (C, 3) AddINode(limit,stride));
 
   // trip-count for +-tive stride should be: (limit - init_trip + stride - 1)/stride.
   // Final value for iterator should be: trip_count * stride + init_trip.
-  const Type *limit_t = limit->bottom_type();
-  const Type *init_t = init_trip->bottom_type();
   Node *one_p = gvn->intcon( 1);
   Node *one_m = gvn->intcon(-1);
 
@@ -317,15 +357,15 @@
   Node *hook = new (C, 6) Node(6);
   switch( bt ) {
   case BoolTest::eq:
-    return NULL;                // Bail out, but this loop trips at most twice!
+    ShouldNotReachHere();
   case BoolTest::ne:            // Ahh, the case we desire
-    if( stride_con == 1 )
+    if (stride_con == 1)
       trip_count = gvn->transform(new (C, 3) SubINode(limit,init_trip));
-    else if( stride_con == -1 )
+    else if (stride_con == -1)
       trip_count = gvn->transform(new (C, 3) SubINode(init_trip,limit));
     else
-      return NULL;              // Odd stride; must prove we hit limit exactly
-    set_subtree_ctrl( trip_count );
+      ShouldNotReachHere();
+    set_subtree_ctrl(trip_count);
     //_loop.map(trip_count->_idx,loop(limit));
     break;
   case BoolTest::le:            // Maybe convert to '<' case
@@ -338,7 +378,8 @@
     //_loop.map(limit->_idx,limit_loop);
     // Fall into next case
   case BoolTest::lt: {          // Maybe convert to '!=' case
-    if( stride_con < 0 ) return NULL; // Count down loop rolls through MAXINT
+    if (stride_con < 0) // Count down loop rolls through MAXINT
+      ShouldNotReachHere();
     Node *range = gvn->transform(new (C, 3) SubINode(limit,init_trip));
     set_subtree_ctrl( range );
     hook->init_req(0, range);
@@ -367,7 +408,8 @@
     //_loop.map(limit->_idx,limit_loop);
     // Fall into next case
   case BoolTest::gt: {          // Maybe convert to '!=' case
-    if( stride_con > 0 ) return NULL; // count up loop rolls through MININT
+    if (stride_con > 0) // count up loop rolls through MININT
+      ShouldNotReachHere();
     Node *range = gvn->transform(new (C, 3) SubINode(limit,init_trip));
     set_subtree_ctrl( range );
     hook->init_req(0, range);
@@ -385,7 +427,7 @@
     hook->init_req(3, trip_count);
     break;
   }
-  }
+  } // switch( bt )
 
   Node *span = gvn->transform(new (C, 3) MulINode(trip_count,stride));
   set_subtree_ctrl( span );
@@ -394,83 +436,82 @@
   limit = gvn->transform(new (C, 3) AddINode(span,init_trip));
   set_subtree_ctrl( limit );
 
+  // Check for SafePoint on backedge and remove
+  Node *sfpt = x->in(LoopNode::LoopBackControl);
+  if (sfpt->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt)) {
+    lazy_replace( sfpt, iftrue );
+    loop->_tail = iftrue;
+  }
+
   // Build a canonical trip test.
   // Clone code, as old values may be in use.
+  Node* nphi = PhiNode::make(x, init_trip, TypeInt::INT);
+  nphi = _igvn.register_new_node_with_optimizer(nphi);
+  set_ctrl(nphi, get_ctrl(phi));
+
   incr = incr->clone();
-  incr->set_req(1,phi);
+  incr->set_req(1,nphi);
   incr->set_req(2,stride);
   incr = _igvn.register_new_node_with_optimizer(incr);
   set_early_ctrl( incr );
-  _igvn.hash_delete(phi);
-  phi->set_req_X( LoopNode::LoopBackControl, incr, &_igvn );
 
-  // If phi type is more restrictive than Int, raise to
-  // Int to prevent (almost) infinite recursion in igvn
-  // which can only handle integer types for constants or minint..maxint.
-  if (!TypeInt::INT->higher_equal(phi->bottom_type())) {
-    Node* nphi = PhiNode::make(phi->in(0), phi->in(LoopNode::EntryControl), TypeInt::INT);
-    nphi->set_req(LoopNode::LoopBackControl, phi->in(LoopNode::LoopBackControl));
-    nphi = _igvn.register_new_node_with_optimizer(nphi);
-    set_ctrl(nphi, get_ctrl(phi));
-    _igvn.replace_node(phi, nphi);
-    phi = nphi->as_Phi();
-  }
+  nphi->set_req(LoopNode::LoopBackControl, incr);
+  _igvn.replace_node(phi, nphi);
+  phi = nphi->as_Phi();
+
   cmp = cmp->clone();
   cmp->set_req(1,incr);
   cmp->set_req(2,limit);
   cmp = _igvn.register_new_node_with_optimizer(cmp);
   set_ctrl(cmp, iff->in(0));
 
-  Node *tmp = test->clone();
-  assert( tmp->is_Bool(), "" );
-  test = (BoolNode*)tmp;
-  (*(BoolTest*)&test->_test)._test = bt; //BoolTest::ne;
+  test = test->clone()->as_Bool();
+  (*(BoolTest*)&test->_test)._test = bt;
   test->set_req(1,cmp);
   _igvn.register_new_node_with_optimizer(test);
   set_ctrl(test, iff->in(0));
-  // If the exit test is dead, STOP!
-  if( test == NULL ) return NULL;
-  _igvn.hash_delete(iff);
-  iff->set_req_X( 1, test, &_igvn );
 
   // Replace the old IfNode with a new LoopEndNode
-  Node *lex = _igvn.register_new_node_with_optimizer(new (C, 2) CountedLoopEndNode( iff->in(0), iff->in(1), cl_prob, iff->as_If()->_fcnt ));
+  Node *lex = _igvn.register_new_node_with_optimizer(new (C, 2) CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt ));
   IfNode *le = lex->as_If();
   uint dd = dom_depth(iff);
   set_idom(le, le->in(0), dd); // Update dominance for loop exit
   set_loop(le, loop);
 
   // Get the loop-exit control
-  Node *if_f = iff->as_If()->proj_out(!(iftrue_op == Op_IfTrue));
+  Node *iffalse = iff->as_If()->proj_out(!(iftrue_op == Op_IfTrue));
 
   // Need to swap loop-exit and loop-back control?
-  if( iftrue_op == Op_IfFalse ) {
+  if (iftrue_op == Op_IfFalse) {
     Node *ift2=_igvn.register_new_node_with_optimizer(new (C, 1) IfTrueNode (le));
     Node *iff2=_igvn.register_new_node_with_optimizer(new (C, 1) IfFalseNode(le));
 
     loop->_tail = back_control = ift2;
     set_loop(ift2, loop);
-    set_loop(iff2, get_loop(if_f));
+    set_loop(iff2, get_loop(iffalse));
 
     // Lazy update of 'get_ctrl' mechanism.
-    lazy_replace_proj( if_f  , iff2 );
-    lazy_replace_proj( iftrue, ift2 );
+    lazy_replace_proj( iffalse, iff2 );
+    lazy_replace_proj( iftrue,  ift2 );
 
     // Swap names
-    if_f   = iff2;
-    iftrue = ift2;
+    iffalse = iff2;
+    iftrue  = ift2;
   } else {
-    _igvn.hash_delete(if_f  );
+    _igvn.hash_delete(iffalse);
     _igvn.hash_delete(iftrue);
-    if_f  ->set_req_X( 0, le, &_igvn );
-    iftrue->set_req_X( 0, le, &_igvn );
+    iffalse->set_req_X( 0, le, &_igvn );
+    iftrue ->set_req_X( 0, le, &_igvn );
   }
 
-  set_idom(iftrue, le, dd+1);
-  set_idom(if_f,   le, dd+1);
+  set_idom(iftrue,  le, dd+1);
+  set_idom(iffalse, le, dd+1);
+  assert(iff->outcnt() == 0, "should be dead now");
+  lazy_replace( iff, le ); // fix 'get_ctrl'
 
   // Now setup a new CountedLoopNode to replace the existing LoopNode
   CountedLoopNode *l = new (C, 3) CountedLoopNode(init_control, back_control);
+  l->set_unswitch_count(x->as_Loop()->unswitch_count()); // Preserve
   // The following assert is approximately true, and defines the intention
   // of can_be_counted_loop.  It fails, however, because phase->type
   // is not yet initialized for this loop and its parts.
@@ -491,10 +532,14 @@
   // Free up intermediate goo
   _igvn.remove_dead_node(hook);
 
+#ifdef ASSERT
+  assert(l->is_valid_counted_loop(), "counted loop shape is messed up");
+  assert(l == loop->_head && l->phi() == phi && l->loopexit() == lex, "" );
+#endif
+
   C->print_method("After CountedLoop", 3);
 
-  // Return trip counter
-  return trip_count;
+  return true;
 }
 
 
@@ -1256,17 +1301,98 @@
   return true;
 }
 
+//---------------------------replace_parallel_iv-------------------------------
+// Replace parallel induction variable (parallel to trip counter)
+void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) {
+  assert(loop->_head->is_CountedLoop(), "");
+  CountedLoopNode *cl = loop->_head->as_CountedLoop();
+  Node *incr = cl->incr();
+  if (incr == NULL)
+    return;         // Dead loop?
+  Node *init = cl->init_trip();
+  Node *phi  = cl->phi();
+  // protect against stride not being a constant
+  if (!cl->stride_is_con())
+    return;
+  int stride_con = cl->stride_con();
+
+  PhaseGVN *gvn = &_igvn;
+
+  // Visit all children, looking for Phis
+  for (DUIterator i = cl->outs(); cl->has_out(i); i++) {
+    Node *out = cl->out(i);
+    // Look for other phis (secondary IVs). Skip dead ones
+    if (!out->is_Phi() || out == phi || !has_node(out))
+      continue;
+    PhiNode* phi2 = out->as_Phi();
+    Node *incr2 = phi2->in( LoopNode::LoopBackControl );
+    // Look for induction variables of the form:  X += constant
+    if (phi2->region() != loop->_head ||
+        incr2->req() != 3 ||
+        incr2->in(1) != phi2 ||
+        incr2 == incr ||
+        incr2->Opcode() != Op_AddI ||
+        !incr2->in(2)->is_Con())
+      continue;
+
+    // Check for parallel induction variable (parallel to trip counter)
+    // via an affine function.  In particular, count-down loops with
+    // count-up array indices are common. We only RCE references off
+    // the trip-counter, so we need to convert all these to trip-counter
+    // expressions.
+    Node *init2 = phi2->in( LoopNode::EntryControl );
+    int stride_con2 = incr2->in(2)->get_int();
+
+    // The general case here gets a little tricky.  We want to find the
+    // GCD of all possible parallel IV's and make a new IV using this
+    // GCD for the loop.  Then all possible IVs are simple multiples of
+    // the GCD.  In practice, this will cover very few extra loops.
+    // Instead we require 'stride_con2' to be a multiple of 'stride_con',
+    // where +/-1 is the common case, but other integer multiples are
+    // also easy to handle.
+    int ratio_con = stride_con2/stride_con;
+
+    if ((ratio_con * stride_con) == stride_con2) { // Check for exact
+      // Convert to using the trip counter.  The parallel induction
+      // variable differs from the trip counter by a loop-invariant
+      // amount, the difference between their respective initial values.
+      // It is scaled by the 'ratio_con'.
+      // Perform local Ideal transformation since in most cases ratio == 1.
+      Node* ratio = _igvn.intcon(ratio_con);
+      set_ctrl(ratio, C->root());
+      Node* hook = new (C, 3) Node(3);
+      Node* ratio_init = gvn->transform(new (C, 3) MulINode(init, ratio));
+      hook->init_req(0, ratio_init);
+      Node* diff = gvn->transform(new (C, 3) SubINode(init2, ratio_init));
+      hook->init_req(1, diff);
+      Node* ratio_idx = gvn->transform(new (C, 3) MulINode(phi, ratio));
+      hook->init_req(2, ratio_idx);
+      Node* add  = gvn->transform(new (C, 3) AddINode(ratio_idx, diff));
+      set_subtree_ctrl(add);
+      _igvn.replace_node( phi2, add );
+      // Free up intermediate goo
+      _igvn.remove_dead_node(hook);
+      // Sometimes an induction variable is unused
+      if (add->outcnt() == 0) {
+        _igvn.remove_dead_node(add);
+      }
+      --i; // deleted this phi; rescan starting with next position
+      continue;
+    }
+  }
+}
+
 //------------------------------counted_loop-----------------------------------
 // Convert to counted loops where possible
 void IdealLoopTree::counted_loop( PhaseIdealLoop *phase ) {
 
   // For grins, set the inner-loop flag here
-  if( !_child ) {
-    if( _head->is_Loop() ) _head->as_Loop()->set_inner_loop();
+  if (!_child) {
+    if (_head->is_Loop()) _head->as_Loop()->set_inner_loop();
   }
 
-  if( _head->is_CountedLoop() ||
-      phase->is_counted_loop( _head, this ) ) {
+  if (_head->is_CountedLoop() ||
+      phase->is_counted_loop(_head, this)) {
     _has_sfpt = 1;              // Indicate we do not need a safepoint here
 
     // Look for a safepoint to remove
@@ -1275,79 +1401,9 @@
           phase->is_deleteable_safept(n))
         phase->lazy_replace(n,n->in(TypeFunc::Control));
 
-    CountedLoopNode *cl = _head->as_CountedLoop();
-    Node *incr = cl->incr();
-    if( !incr ) return;         // Dead loop?
-    Node *init = cl->init_trip();
-    Node *phi  = cl->phi();
-    // protect against stride not being a constant
-    if( !cl->stride_is_con() ) return;
-    int stride_con = cl->stride_con();
-
     // Look for induction variables
-
-    // Visit all children, looking for Phis
-    for (DUIterator i = cl->outs(); cl->has_out(i); i++) {
-      Node *out = cl->out(i);
-      // Look for other phis (secondary IVs). Skip dead ones
-      if (!out->is_Phi() || out == phi || !phase->has_node(out)) continue;
-      PhiNode* phi2 = out->as_Phi();
-      Node *incr2 = phi2->in( LoopNode::LoopBackControl );
-      // Look for induction variables of the form:  X += constant
-      if( phi2->region() != _head ||
-          incr2->req() != 3 ||
-          incr2->in(1) != phi2 ||
-          incr2 == incr ||
-          incr2->Opcode() != Op_AddI ||
-          !incr2->in(2)->is_Con() )
-        continue;
-
-      // Check for parallel induction variable (parallel to trip counter)
-      // via an affine function.  In particular, count-down loops with
-      // count-up array indices are common. We only RCE references off
-      // the trip-counter, so we need to convert all these to trip-counter
-      // expressions.
-      Node *init2 = phi2->in( LoopNode::EntryControl );
-      int stride_con2 = incr2->in(2)->get_int();
+    phase->replace_parallel_iv(this);
 
-      // The general case here gets a little tricky.  We want to find the
-      // GCD of all possible parallel IV's and make a new IV using this
-      // GCD for the loop.  Then all possible IVs are simple multiples of
-      // the GCD.  In practice, this will cover very few extra loops.
-      // Instead we require 'stride_con2' to be a multiple of 'stride_con',
-      // where +/-1 is the common case, but other integer multiples are
-      // also easy to handle.
-      int ratio_con = stride_con2/stride_con;
-
-      if( ratio_con * stride_con == stride_con2 ) { // Check for exact
-        // Convert to using the trip counter.  The parallel induction
-        // variable differs from the trip counter by a loop-invariant
-        // amount, the difference between their respective initial values.
-        // It is scaled by the 'ratio_con'.
-        Compile* C = phase->C;
-        Node* ratio = phase->_igvn.intcon(ratio_con);
-        phase->set_ctrl(ratio, C->root());
-        Node* ratio_init = new (C, 3) MulINode(init, ratio);
-        phase->_igvn.register_new_node_with_optimizer(ratio_init, init);
-        phase->set_early_ctrl(ratio_init);
-        Node* diff = new (C, 3) SubINode(init2, ratio_init);
-        phase->_igvn.register_new_node_with_optimizer(diff, init2);
-        phase->set_early_ctrl(diff);
-        Node* ratio_idx = new (C, 3) MulINode(phi, ratio);
-        phase->_igvn.register_new_node_with_optimizer(ratio_idx, phi);
-        phase->set_ctrl(ratio_idx, cl);
-        Node* add  = new (C, 3) AddINode(ratio_idx, diff);
-        phase->_igvn.register_new_node_with_optimizer(add);
-        phase->set_ctrl(add, cl);
-        phase->_igvn.replace_node( phi2, add );
-        // Sometimes an induction variable is unused
-        if (add->outcnt() == 0) {
-          phase->_igvn.remove_dead_node(add);
-        }
-        --i; // deleted this phi; rescan starting with next position
-        continue;
-      }
-    }
   } else if (_parent != NULL && !_irreducible) {
     // Not a counted loop.
     // Look for a safepoint on the idom-path to remove, preserving the first one
@@ -1366,24 +1422,31 @@
   }
 
   // Recursively
-  if( _child ) _child->counted_loop( phase );
-  if( _next  ) _next ->counted_loop( phase );
+  if (_child) _child->counted_loop( phase );
+  if (_next)  _next ->counted_loop( phase );
 }
 
 #ifndef PRODUCT
 //------------------------------dump_head--------------------------------------
 // Dump 1 liner for loop header info
 void IdealLoopTree::dump_head( ) const {
-  for( uint i=0; i<_nest; i++ )
+  for (uint i=0; i<_nest; i++)
     tty->print("  ");
   tty->print("Loop: N%d/N%d ",_head->_idx,_tail->_idx);
-  if( _irreducible ) tty->print(" IRREDUCIBLE");
-  if( _head->is_CountedLoop() ) {
+  if (_irreducible) tty->print(" IRREDUCIBLE");
+  if (UseLoopPredicate) {
+    Node* entry = _head->in(LoopNode::EntryControl);
+    if (entry != NULL && entry->is_Proj() &&
+        PhaseIdealLoop::is_uncommon_trap_if_pattern(entry->as_Proj(), Deoptimization::Reason_predicate)) {
+      tty->print(" predicated");
+    }
+  }
+  if (_head->is_CountedLoop()) {
     CountedLoopNode *cl = _head->as_CountedLoop();
     tty->print(" counted");
-    if( cl->is_pre_loop () ) tty->print(" pre" );
-    if( cl->is_main_loop() ) tty->print(" main");
-    if( cl->is_post_loop() ) tty->print(" post");
+    if (cl->is_pre_loop ()) tty->print(" pre" );
+    if (cl->is_main_loop()) tty->print(" main");
+    if (cl->is_post_loop()) tty->print(" post");
   }
   tty->cr();
 }
@@ -1392,8 +1455,8 @@
 // Dump loops by loop tree
 void IdealLoopTree::dump( ) const {
   dump_head();
-  if( _child ) _child->dump();
-  if( _next  ) _next ->dump();
+  if (_child) _child->dump();
+  if (_next)  _next ->dump();
 }
 
 #endif
@@ -1439,19 +1502,19 @@
   }
 
   // self (only loops that we can apply loop predication may use their predicates)
-  if (loop->_head->is_Loop()     &&
-      !loop->_irreducible        &&
+  if (loop->_head->is_Loop() &&
+      !loop->_irreducible    &&
       !loop->tail()->is_top()) {
-    LoopNode *lpn  = loop->_head->as_Loop();
+    LoopNode* lpn = loop->_head->as_Loop();
     Node* entry = lpn->in(LoopNode::EntryControl);
-    ProjNode *predicate_proj = find_predicate_insertion_point(entry);
+    Node* predicate_proj = find_predicate(entry);
     if (predicate_proj != NULL ) { // right pattern that can be used by loop predication
-      assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+      assert(entry->in(0)->in(1)->in(1)->Opcode() == Op_Opaque1, "must be");
       useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one
     }
   }
 
-  if ( loop->_next ) { // sibling
+  if (loop->_next) { // sibling
     collect_potentially_useful_predicates(loop->_next, useful_predicates);
   }
 }
@@ -1459,7 +1522,8 @@
 //------------------------eliminate_useless_predicates-----------------------------
 // Eliminate all inserted predicates if they could not be used by loop predication.
 void PhaseIdealLoop::eliminate_useless_predicates() {
-  if (C->predicate_count() == 0) return; // no predicate left
+  if (C->predicate_count() == 0)
+    return; // no predicate left
 
   Unique_Node_List useful_predicates; // to store useful predicates
   if (C->has_loops()) {
@@ -1647,12 +1711,15 @@
 
 #ifndef PRODUCT
   C->verify_graph_edges();
-  if( _verify_me ) {             // Nested verify pass?
+  if (_verify_me) {             // Nested verify pass?
     // Check to see if the verify mode is broken
     assert(C->unique() == unique, "non-optimize mode made Nodes? ? ?");
     return;
   }
-  if( VerifyLoopOptimizations ) verify();
+  if(VerifyLoopOptimizations) verify();
+  if(TraceLoopOpts && C->has_loops()) {
+    _ltree_root->dump();
+  }
 #endif
 
   if (ReassociateInvariants) {
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -93,6 +93,7 @@
       in(1) != NULL && phase->type(in(1)) != Type::TOP &&
       in(2) != NULL && phase->type(in(2)) != Type::TOP;
   }
+  bool is_valid_counted_loop() const;
 #ifndef PRODUCT
   virtual void dump_spec(outputStream *st) const;
 #endif
@@ -101,9 +102,8 @@
 //------------------------------Counted Loops----------------------------------
 // Counted loops are all trip-counted loops, with exactly 1 trip-counter exit
 // path (and maybe some other exit paths).  The trip-counter exit is always
-// last in the loop.  The trip-counter does not have to stride by a constant,
-// but it does have to stride by a loop-invariant amount; the exit value is
-// also loop invariant.
+// last in the loop.  The trip-counter have to stride by a constant;
+// the exit value is also loop invariant.
 
 // CountedLoopNodes and CountedLoopEndNodes come in matched pairs.  The
 // CountedLoopNode has the incoming loop control and the loop-back-control
@@ -112,7 +112,7 @@
 // CountedLoopNode if there is control flow in the loop), the post-increment
 // trip-counter value, and the limit.  The trip-counter value is always of
 // the form (Op old-trip-counter stride).  The old-trip-counter is produced
-// by a Phi connected to the CountedLoopNode.  The stride is loop invariant.
+// by a Phi connected to the CountedLoopNode.  The stride is constant.
 // The Op is any commutable opcode, including Add, Mul, Xor.  The
 // CountedLoopEndNode also takes in the loop-invariant limit value.
 
@@ -696,6 +696,9 @@
   // Is safept not required by an outer loop?
   bool is_deleteable_safept(Node* sfpt);
 
+  // Replace parallel induction variable (parallel to trip counter)
+  void replace_parallel_iv(IdealLoopTree *loop);
+
   // Perform verification that the graph is valid.
   PhaseIdealLoop( PhaseIterGVN &igvn) :
     PhaseTransform(Ideal_Loop),
@@ -751,7 +754,7 @@
   // Per-Node transform
   virtual Node *transform( Node *a_node ) { return 0; }
 
-  Node *is_counted_loop( Node *x, IdealLoopTree *loop );
+  bool is_counted_loop( Node *x, IdealLoopTree *loop );
 
   // Return a post-walked LoopNode
   IdealLoopTree *get_loop( Node *n ) const {
@@ -815,16 +818,22 @@
   bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
 
   // Return true if proj is for "proj->[region->..]call_uct"
-  bool is_uncommon_trap_proj(ProjNode* proj, bool must_reason_predicate = false);
+  // Return true if proj is for "proj->[region->..]call_uct"
+  static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason);
   // Return true for    "if(test)-> proj -> ...
   //                          |
   //                          V
   //                      other_proj->[region->..]call_uct"
-  bool is_uncommon_trap_if_pattern(ProjNode* proj, bool must_reason_predicate = false);
+  static bool is_uncommon_trap_if_pattern(ProjNode* proj, Deoptimization::DeoptReason reason);
   // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
-  ProjNode* create_new_if_for_predicate(ProjNode* cont_proj);
-  // Find a good location to insert a predicate
-  ProjNode* find_predicate_insertion_point(Node* start_c);
+  ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+                                        Deoptimization::DeoptReason reason);
+  void register_control(Node* n, IdealLoopTree *loop, Node* pred);
+
+   // Find a good location to insert a predicate
+  static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
+  // Find a predicate
+  static Node* find_predicate(Node* entry);
   // Construct a range check for a predicate if
   BoolNode* rc_predicate(Node* ctrl,
                          int scale, Node* offset,
@@ -936,7 +945,7 @@
   Node *has_local_phi_input( Node *n );
   // Mark an IfNode as being dominated by a prior test,
   // without actually altering the CFG (and hence IDOM info).
-  void dominated_by( Node *prevdom, Node *iff );
+  void dominated_by( Node *prevdom, Node *iff, bool flip = false );
 
   // Split Node 'n' through merge point
   Node *split_thru_region( Node *n, Node *region );
--- a/hotspot/src/share/vm/opto/loopopts.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopopts.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -42,13 +42,13 @@
     return NULL;
   }
   int wins = 0;
-  assert( !n->is_CFG(), "" );
-  assert( region->is_Region(), "" );
+  assert(!n->is_CFG(), "");
+  assert(region->is_Region(), "");
 
   const Type* type = n->bottom_type();
   const TypeOopPtr *t_oop = _igvn.type(n)->isa_oopptr();
   Node *phi;
-  if( t_oop != NULL && t_oop->is_known_instance_field() ) {
+  if (t_oop != NULL && t_oop->is_known_instance_field()) {
     int iid    = t_oop->instance_id();
     int index  = C->get_alias_index(t_oop);
     int offset = t_oop->offset();
@@ -57,20 +57,20 @@
     phi = PhiNode::make_blank(region, n);
   }
   uint old_unique = C->unique();
-  for( uint i = 1; i < region->req(); i++ ) {
+  for (uint i = 1; i < region->req(); i++) {
     Node *x;
     Node* the_clone = NULL;
-    if( region->in(i) == C->top() ) {
+    if (region->in(i) == C->top()) {
       x = C->top();             // Dead path?  Use a dead data op
     } else {
       x = n->clone();           // Else clone up the data op
       the_clone = x;            // Remember for possible deletion.
       // Alter data node to use pre-phi inputs
-      if( n->in(0) == region )
+      if (n->in(0) == region)
         x->set_req( 0, region->in(i) );
-      for( uint j = 1; j < n->req(); j++ ) {
+      for (uint j = 1; j < n->req(); j++) {
         Node *in = n->in(j);
-        if( in->is_Phi() && in->in(0) == region )
+        if (in->is_Phi() && in->in(0) == region)
           x->set_req( j, in->in(i) ); // Use pre-Phi input for the clone
       }
     }
@@ -85,7 +85,7 @@
     // happen if the singleton occurs on loop entry, as the elimination of
     // the PhiNode may cause the resulting node to migrate back to a previous
     // loop iteration.
-    if( singleton && t == Type::TOP ) {
+    if (singleton && t == Type::TOP) {
       // Is_Loop() == false does not confirm the absence of a loop (e.g., an
       // irreducible loop may not be indicated by an affirmative is_Loop());
       // therefore, the only top we can split thru a phi is on a backedge of
@@ -93,7 +93,7 @@
       singleton &= region->is_Loop() && (i != LoopNode::EntryControl);
     }
 
-    if( singleton ) {
+    if (singleton) {
       wins++;
       x = ((PhaseGVN&)_igvn).makecon(t);
     } else {
@@ -108,12 +108,12 @@
       // igvn->type(x) is set to x->Value() already.
       x->raise_bottom_type(t);
       Node *y = x->Identity(&_igvn);
-      if( y != x ) {
+      if (y != x) {
         wins++;
         x = y;
       } else {
         y = _igvn.hash_find(x);
-        if( y ) {
+        if (y) {
           wins++;
           x = y;
         } else {
@@ -129,7 +129,7 @@
     phi->set_req( i, x );
   }
   // Too few wins?
-  if( wins <= policy ) {
+  if (wins <= policy) {
     _igvn.remove_dead_node(phi);
     return NULL;
   }
@@ -137,7 +137,7 @@
   // Record Phi
   register_new_node( phi, region );
 
-  for( uint i2 = 1; i2 < phi->req(); i2++ ) {
+  for (uint i2 = 1; i2 < phi->req(); i2++) {
     Node *x = phi->in(i2);
     // If we commoned up the cloned 'x' with another existing Node,
     // the existing Node picks up a new use.  We need to make the
@@ -145,24 +145,44 @@
     Node *old_ctrl;
     IdealLoopTree *old_loop;
 
+    if (x->is_Con()) {
+      // Constant's control is always root.
+      set_ctrl(x, C->root());
+      continue;
+    }
     // The occasional new node
-    if( x->_idx >= old_unique ) {   // Found a new, unplaced node?
-      old_ctrl = x->is_Con() ? C->root() : NULL;
-      old_loop = NULL;              // Not in any prior loop
+    if (x->_idx >= old_unique) {     // Found a new, unplaced node?
+      old_ctrl = NULL;
+      old_loop = NULL;               // Not in any prior loop
     } else {
-      old_ctrl = x->is_Con() ? C->root() : get_ctrl(x);
+      old_ctrl = get_ctrl(x);
       old_loop = get_loop(old_ctrl); // Get prior loop
     }
     // New late point must dominate new use
-    Node *new_ctrl = dom_lca( old_ctrl, region->in(i2) );
+    Node *new_ctrl = dom_lca(old_ctrl, region->in(i2));
+    if (new_ctrl == old_ctrl) // Nothing is changed
+      continue;
+
+    IdealLoopTree *new_loop = get_loop(new_ctrl);
+
+    // Don't move x into a loop if its uses are
+    // outside of loop. Otherwise x will be cloned
+    // for each use outside of this loop.
+    IdealLoopTree *use_loop = get_loop(region);
+    if (!new_loop->is_member(use_loop) &&
+        (old_loop == NULL || !new_loop->is_member(old_loop))) {
+      // Take early control, later control will be recalculated
+      // during next iteration of loop optimizations.
+      new_ctrl = get_early_ctrl(x);
+      new_loop = get_loop(new_ctrl);
+    }
     // Set new location
     set_ctrl(x, new_ctrl);
-    IdealLoopTree *new_loop = get_loop( new_ctrl );
     // If changing loop bodies, see if we need to collect into new body
-    if( old_loop != new_loop ) {
-      if( old_loop && !old_loop->_child )
+    if (old_loop != new_loop) {
+      if (old_loop && !old_loop->_child)
         old_loop->_body.yank(x);
-      if( !new_loop->_child )
+      if (!new_loop->_child)
         new_loop->_body.push(x);  // Collect body info
     }
   }
@@ -174,9 +194,9 @@
 // Replace the dominated test with an obvious true or false.  Place it on the
 // IGVN worklist for later cleanup.  Move control-dependent data Nodes on the
 // live path up to the dominating control.
-void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff ) {
+void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip ) {
 #ifndef PRODUCT
-  if( VerifyLoopOptimizations && PrintOpto ) tty->print_cr("dominating test");
+  if (VerifyLoopOptimizations && PrintOpto) tty->print_cr("dominating test");
 #endif
 
 
@@ -185,6 +205,12 @@
   assert( iff->Opcode() == Op_If || iff->Opcode() == Op_CountedLoopEnd, "Check this code when new subtype is added");
   int pop = prevdom->Opcode();
   assert( pop == Op_IfFalse || pop == Op_IfTrue, "" );
+  if (flip) {
+    if (pop == Op_IfTrue)
+      pop = Op_IfFalse;
+    else
+      pop = Op_IfTrue;
+  }
   // 'con' is set to true or false to kill the dominated test.
   Node *con = _igvn.makecon(pop == Op_IfTrue ? TypeInt::ONE : TypeInt::ZERO);
   set_ctrl(con, C->root()); // Constant gets a new use
@@ -197,7 +223,7 @@
   // I can assume this path reaches an infinite loop.  In this case it's not
   // important to optimize the data Nodes - either the whole compilation will
   // be tossed or this path (and all data Nodes) will go dead.
-  if( iff->outcnt() != 2 ) return;
+  if (iff->outcnt() != 2) return;
 
   // Make control-dependent data Nodes on the live path (path that will remain
   // once the dominated IF is removed) become control-dependent on the
@@ -207,16 +233,16 @@
 
   for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
     Node* cd = dp->fast_out(i); // Control-dependent node
-    if( cd->depends_only_on_test() ) {
-      assert( cd->in(0) == dp, "" );
-      _igvn.hash_delete( cd );
+    if (cd->depends_only_on_test()) {
+      assert(cd->in(0) == dp, "");
+      _igvn.hash_delete(cd);
       cd->set_req(0, prevdom);
-      set_early_ctrl( cd );
+      set_early_ctrl(cd);
       _igvn._worklist.push(cd);
       IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
-      if( old_loop != new_loop ) {
-        if( !old_loop->_child ) old_loop->_body.yank(cd);
-        if( !new_loop->_child ) new_loop->_body.push(cd);
+      if (old_loop != new_loop) {
+        if (!old_loop->_child) old_loop->_body.yank(cd);
+        if (!new_loop->_child) new_loop->_body.push(cd);
       }
       --i;
       --imax;
@@ -2338,6 +2364,11 @@
   }
 
 #if !defined(PRODUCT)
+  if (TraceLoopOpts) {
+    tty->print("PartialPeel  ");
+    loop->dump_head();
+  }
+
   if (TracePartialPeeling) {
     tty->print_cr("before partial peel one iteration");
     Node_List wl;
@@ -2481,6 +2512,7 @@
   // Create new loop head for new phis and to hang
   // the nodes being moved (sinked) from the peel region.
   LoopNode* new_head = new (C, 3) LoopNode(last_peel, last_peel);
+  new_head->set_unswitch_count(head->unswitch_count()); // Preserve
   _igvn.register_new_node_with_optimizer(new_head);
   assert(first_not_peeled->in(0) == last_peel, "last_peel <- first_not_peeled");
   first_not_peeled->set_req(0, new_head);
@@ -2651,24 +2683,23 @@
 // prevent loop-fallout uses of the pre-incremented trip counter (which are
 // then alive with the post-incremented trip counter forcing an extra
 // register move)
-void PhaseIdealLoop::reorg_offsets( IdealLoopTree *loop ) {
+void PhaseIdealLoop::reorg_offsets(IdealLoopTree *loop) {
+  // Perform it only for canonical counted loops.
+  // Loop's shape could be messed up by iteration_split_impl.
+  if (!loop->_head->is_CountedLoop())
+    return;
+  if (!loop->_head->as_Loop()->is_valid_counted_loop())
+    return;
 
   CountedLoopNode *cl = loop->_head->as_CountedLoop();
   CountedLoopEndNode *cle = cl->loopexit();
-  if( !cle ) return;            // The occasional dead loop
-  // Find loop exit control
   Node *exit = cle->proj_out(false);
-  assert( exit->Opcode() == Op_IfFalse, "" );
+  Node *phi = cl->phi();
 
   // Check for the special case of folks using the pre-incremented
   // trip-counter on the fall-out path (forces the pre-incremented
   // and post-incremented trip counter to be live at the same time).
   // Fix this by adjusting to use the post-increment trip counter.
-  Node *phi = cl->phi();
-  if( !phi ) return;            // Dead infinite loop
-
-  // Shape messed up, probably by iteration_split_impl
-  if (phi->in(LoopNode::LoopBackControl) != cl->incr()) return;
 
   bool progress = true;
   while (progress) {
@@ -2677,21 +2708,19 @@
       Node* use = phi->fast_out(i);   // User of trip-counter
       if (!has_ctrl(use))  continue;
       Node *u_ctrl = get_ctrl(use);
-      if( use->is_Phi() ) {
+      if (use->is_Phi()) {
         u_ctrl = NULL;
-        for( uint j = 1; j < use->req(); j++ )
-          if( use->in(j) == phi )
-            u_ctrl = dom_lca( u_ctrl, use->in(0)->in(j) );
+        for (uint j = 1; j < use->req(); j++)
+          if (use->in(j) == phi)
+            u_ctrl = dom_lca(u_ctrl, use->in(0)->in(j));
       }
       IdealLoopTree *u_loop = get_loop(u_ctrl);
       // Look for loop-invariant use
-      if( u_loop == loop ) continue;
-      if( loop->is_member( u_loop ) ) continue;
+      if (u_loop == loop) continue;
+      if (loop->is_member(u_loop)) continue;
       // Check that use is live out the bottom.  Assuming the trip-counter
       // update is right at the bottom, uses of of the loop middle are ok.
-      if( dom_lca( exit, u_ctrl ) != exit ) continue;
-      // protect against stride not being a constant
-      if( !cle->stride_is_con() ) continue;
+      if (dom_lca(exit, u_ctrl) != exit) continue;
       // Hit!  Refactor use to use the post-incremented tripcounter.
       // Compute a post-increment tripcounter.
       Node *opaq = new (C, 2) Opaque2Node( C, cle->incr() );
@@ -2702,9 +2731,10 @@
       register_new_node( post, u_ctrl );
       _igvn.hash_delete(use);
       _igvn._worklist.push(use);
-      for( uint j = 1; j < use->req(); j++ )
-        if( use->in(j) == phi )
+      for (uint j = 1; j < use->req(); j++) {
+        if (use->in(j) == phi)
           use->set_req(j, post);
+      }
       // Since DU info changed, rerun loop
       progress = true;
       break;
--- a/hotspot/src/share/vm/opto/memnode.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1573,9 +1573,9 @@
             return TypeInt::make(constant.as_int());
           } else if (constant.basic_type() == T_ARRAY) {
             if (adr->bottom_type()->is_ptr_to_narrowoop()) {
-              return TypeNarrowOop::make_from_constant(constant.as_object());
+              return TypeNarrowOop::make_from_constant(constant.as_object(), true);
             } else {
-              return TypeOopPtr::make_from_constant(constant.as_object());
+              return TypeOopPtr::make_from_constant(constant.as_object(), true);
             }
           }
         }
--- a/hotspot/src/share/vm/opto/output.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/output.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1028,7 +1028,7 @@
 
 // helper for Fill_buffer bailout logic
 static void turn_off_compiler(Compile* C) {
-  if (CodeCache::unallocated_capacity() >= CodeCacheMinimumFreeSpace*10) {
+  if (CodeCache::largest_free_block() >= CodeCacheMinimumFreeSpace*10) {
     // Do not turn off compilation if a single giant method has
     // blown the code cache size.
     C->record_failure("excessive request to CodeCache");
--- a/hotspot/src/share/vm/opto/parse.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/parse.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -136,6 +136,7 @@
     uint               _count;          // how many times executed?  Currently only set by _goto's
     bool               _is_parsed;      // has this block been parsed yet?
     bool               _is_handler;     // is this block an exception handler?
+    bool               _has_merged_backedge; // does this block have merged backedge?
     SafePointNode*     _start_map;      // all values flowing into this block
     MethodLivenessResult _live_locals;  // lazily initialized liveness bitmap
 
@@ -168,6 +169,18 @@
     // True after any predecessor flows control into this block
     bool is_merged() const                 { return _start_map != NULL; }
 
+#ifdef ASSERT
+    // True after backedge predecessor flows control into this block
+    bool has_merged_backedge() const       { return _has_merged_backedge; }
+    void mark_merged_backedge(Block* pred) {
+      assert(is_SEL_head(), "should be loop head");
+      if (pred != NULL && is_SEL_backedge(pred)) {
+        assert(is_parsed(), "block should be parsed before merging backedges");
+        _has_merged_backedge = true;
+      }
+    }
+#endif
+
     // True when all non-exception predecessors have been parsed.
     bool is_ready() const                  { return preds_parsed() == pred_count(); }
 
@@ -441,11 +454,6 @@
     }
   }
 
-  // Return true if the parser should add a loop predicate
-  bool should_add_predicate(int target_bci);
-  // Insert a loop predicate into the graph
-  void add_predicate();
-
   // Note:  Intrinsic generation routines may be found in library_call.cpp.
 
   // Helper function to setup Ideal Call nodes
@@ -483,8 +491,8 @@
   bool static_field_ok_in_clinit(ciField *field, ciMethod *method);
 
   // common code for actually performing the load or store
-  void do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field);
-  void do_put_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field);
+  void do_get_xxx(Node* obj, ciField* field, bool is_field);
+  void do_put_xxx(Node* obj, ciField* field, bool is_field);
 
   // loading from a constant field or the constant pool
   // returns false if push failed (non-perm field constants only, not ldcs)
--- a/hotspot/src/share/vm/opto/parse1.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -637,6 +637,25 @@
         // (Note that dead locals do not get phis built, ever.)
         ensure_phis_everywhere();
 
+        if (block->is_SEL_head() &&
+            UseLoopPredicate) {
+          // Add predicate to single entry (not irreducible) loop head.
+          assert(!block->has_merged_backedge(), "only entry paths should be merged for now");
+          // Need correct bci for predicate.
+          // It is fine to set it here since do_one_block() will set it anyway.
+          set_parse_bci(block->start());
+          add_predicate();
+          // Add new region for back branches.
+          int edges = block->pred_count() - block->preds_parsed() + 1; // +1 for original region
+          RegionNode *r = new (C, edges+1) RegionNode(edges+1);
+          _gvn.set_type(r, Type::CONTROL);
+          record_for_igvn(r);
+          r->init_req(edges, control());
+          set_control(r);
+          // Add new phis.
+          ensure_phis_everywhere();
+        }
+
         // Leave behind an undisturbed copy of the map, for future merges.
         set_map(clone_map());
       }
@@ -1113,7 +1132,7 @@
   _preds_parsed = 0;
   _count = 0;
   assert(pred_count() == 0 && preds_parsed() == 0, "sanity");
-  assert(!(is_merged() || is_parsed() || is_handler()), "sanity");
+  assert(!(is_merged() || is_parsed() || is_handler() || has_merged_backedge()), "sanity");
   assert(_live_locals.size() == 0, "sanity");
 
   // entry point has additional predecessor
@@ -1350,10 +1369,6 @@
     set_parse_bci(iter().cur_bci());
 
     if (bci() == block()->limit()) {
-      // insert a predicate if it falls through to a loop head block
-      if (should_add_predicate(bci())){
-        add_predicate();
-      }
       // Do not walk into the next block until directed by do_all_blocks.
       merge(bci());
       break;
@@ -1498,17 +1513,29 @@
         || target->is_handler()       // These have unpredictable inputs.
         || target->is_loop_head()     // Known multiple inputs
         || control()->is_Region()) {  // We must hide this guy.
+
+      int current_bci = bci();
+      set_parse_bci(target->start()); // Set target bci
+      if (target->is_SEL_head()) {
+        DEBUG_ONLY( target->mark_merged_backedge(block()); )
+        if (target->start() == 0) {
+          // Add loop predicate for the special case when
+          // there are backbranches to the method entry.
+          add_predicate();
+        }
+      }
       // Add a Region to start the new basic block.  Phis will be added
       // later lazily.
       int edges = target->pred_count();
       if (edges < pnum)  edges = pnum;  // might be a new path!
-      Node *r = new (C, edges+1) RegionNode(edges+1);
+      RegionNode *r = new (C, edges+1) RegionNode(edges+1);
       gvn().set_type(r, Type::CONTROL);
       record_for_igvn(r);
       // zap all inputs to NULL for debugging (done in Node(uint) constructor)
       // for (int j = 1; j < edges+1; j++) { r->init_req(j, NULL); }
       r->init_req(pnum, control());
       set_control(r);
+      set_parse_bci(current_bci); // Restore bci
     }
 
     // Convert the existing Parser mapping into a mapping at this bci.
@@ -1517,7 +1544,11 @@
 
   } else {                      // Prior mapping at this bci
     if (TraceOptoParse) {  tty->print(" with previous state"); }
-
+#ifdef ASSERT
+    if (target->is_SEL_head()) {
+      target->mark_merged_backedge(block());
+    }
+#endif
     // We must not manufacture more phis if the target is already parsed.
     bool nophi = target->is_parsed();
 
@@ -2054,37 +2085,6 @@
   }
 }
 
-//------------------------------should_add_predicate--------------------------
-bool Parse::should_add_predicate(int target_bci) {
-  if (!UseLoopPredicate) return false;
-  Block* target = successor_for_bci(target_bci);
-  if (target != NULL          &&
-      target->is_loop_head()  &&
-      block()->rpo() < target->rpo()) {
-    return true;
-  }
-  return false;
-}
-
-//------------------------------add_predicate---------------------------------
-void Parse::add_predicate() {
-  assert(UseLoopPredicate,"use only for loop predicate");
-  Node *cont    = _gvn.intcon(1);
-  Node* opq     = _gvn.transform(new (C, 2) Opaque1Node(C, cont));
-  Node *bol     = _gvn.transform(new (C, 2) Conv2BNode(opq));
-  IfNode* iff   = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
-  Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff));
-  C->add_predicate_opaq(opq);
-  {
-    PreserveJVMState pjvms(this);
-    set_control(iffalse);
-    uncommon_trap(Deoptimization::Reason_predicate,
-                  Deoptimization::Action_maybe_recompile);
-  }
-  Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff));
-  set_control(iftrue);
-}
-
 #ifndef PRODUCT
 //------------------------show_parse_info--------------------------------------
 void Parse::show_parse_info() {
--- a/hotspot/src/share/vm/opto/parse2.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -293,11 +293,6 @@
   if (len < 1) {
     // If this is a backward branch, add safepoint
     maybe_add_safepoint(default_dest);
-    if (should_add_predicate(default_dest)){
-      _sp += 1; // set original stack for use by uncommon_trap
-      add_predicate();
-      _sp -= 1;
-    }
     merge(default_dest);
     return;
   }
@@ -344,11 +339,6 @@
 
   if (len < 1) {    // If this is a backward branch, add safepoint
     maybe_add_safepoint(default_dest);
-    if (should_add_predicate(default_dest)){
-      _sp += 1; // set original stack for use by uncommon_trap
-      add_predicate();
-      _sp -= 1;
-    }
     merge(default_dest);
     return;
   }
@@ -756,9 +746,6 @@
   push(_gvn.makecon(ret_addr));
 
   // Flow to the jsr.
-  if (should_add_predicate(jsr_bci)){
-    add_predicate();
-  }
   merge(jsr_bci);
 }
 
@@ -1040,11 +1027,6 @@
       profile_taken_branch(target_bci);
       adjust_map_after_if(btest, c, prob, branch_block, next_block);
       if (!stopped()) {
-        if (should_add_predicate(target_bci)){ // add a predicate if it branches to a loop
-          int nargs = repush_if_args(); // set original stack for uncommon_trap
-          add_predicate();
-          _sp -= nargs;
-        }
         merge(target_bci);
       }
     }
@@ -1168,11 +1150,6 @@
       profile_taken_branch(target_bci);
       adjust_map_after_if(taken_btest, c, prob, branch_block, next_block);
       if (!stopped()) {
-        if (should_add_predicate(target_bci)){ // add a predicate if it branches to a loop
-          int nargs = repush_if_args(); // set original stack for the uncommon_trap
-          add_predicate();
-          _sp -= nargs;
-        }
         merge(target_bci);
       }
     }
@@ -2166,10 +2143,6 @@
     // Update method data
     profile_taken_branch(target_bci);
 
-    // Add loop predicate if it goes to a loop
-    if (should_add_predicate(target_bci)){
-      add_predicate();
-    }
     // Merge the current control into the target basic block
     merge(target_bci);
 
--- a/hotspot/src/share/vm/opto/parse3.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/parse3.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,29 +112,31 @@
     // Compile-time detect of null-exception?
     if (stopped())  return;
 
+#ifdef ASSERT
     const TypeInstPtr *tjp = TypeInstPtr::make(TypePtr::NotNull, iter().get_declared_field_holder());
     assert(_gvn.type(obj)->higher_equal(tjp), "cast_up is no longer needed");
+#endif
 
     if (is_get) {
       --_sp;  // pop receiver before getting
-      do_get_xxx(tjp, obj, field, is_field);
+      do_get_xxx(obj, field, is_field);
     } else {
-      do_put_xxx(tjp, obj, field, is_field);
+      do_put_xxx(obj, field, is_field);
       --_sp;  // pop receiver after putting
     }
   } else {
-    const TypeKlassPtr* tkp = TypeKlassPtr::make(field_holder);
-    obj = _gvn.makecon(tkp);
+    const TypeInstPtr* tip = TypeInstPtr::make(field_holder->java_mirror());
+    obj = _gvn.makecon(tip);
     if (is_get) {
-      do_get_xxx(tkp, obj, field, is_field);
+      do_get_xxx(obj, field, is_field);
     } else {
-      do_put_xxx(tkp, obj, field, is_field);
+      do_put_xxx(obj, field, is_field);
     }
   }
 }
 
 
-void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
+void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
   // Does this field have a constant value?  If so, just push the value.
   if (field->is_constant()) {
     if (field->is_static()) {
@@ -143,8 +145,8 @@
         return;
     }
     else {
-      // final non-static field of a trusted class ({java,sun}.dyn
-      // classes).
+      // final non-static field of a trusted class (classes in
+      // java.lang.invoke and sun.invoke packages and subpackages).
       if (obj->is_Con()) {
         const TypeOopPtr* oop_ptr = obj->bottom_type()->isa_oopptr();
         ciObject* constant_oop = oop_ptr->const_oop();
@@ -231,7 +233,7 @@
   }
 }
 
-void Parse::do_put_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
+void Parse::do_put_xxx(Node* obj, ciField* field, bool is_field) {
   bool is_vol = field->is_volatile();
   // If reference is volatile, prevent following memory ops from
   // floating down past the volatile write.  Also prevents commoning
--- a/hotspot/src/share/vm/opto/stringopts.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/stringopts.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -910,7 +910,7 @@
       ciObject* con = field->constant_value().as_object();
       // Do not "join" in the previous type; it doesn't add value,
       // and may yield a vacuous result if the field is of interface type.
-      type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
+      type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr();
       assert(type != NULL, "field singleton type must be consistent");
     } else {
       type = TypeOopPtr::make_from_klass(field_klass->as_klass());
@@ -969,6 +969,10 @@
     // for (int i=0; ; i++)
     //   if (x <= sizeTable[i])
     //     return i+1;
+
+    // Add loop predicate first.
+    kit.add_predicate();
+
     RegionNode *loop = new (C, 3) RegionNode(3);
     loop->init_req(1, kit.control());
     kit.gvn().set_type(loop, Type::CONTROL);
@@ -1086,6 +1090,9 @@
   // }
 
   {
+    // Add loop predicate first.
+    kit.add_predicate();
+
     RegionNode *head = new (C, 3) RegionNode(3);
     head->init_req(1, kit.control());
     kit.gvn().set_type(head, Type::CONTROL);
--- a/hotspot/src/share/vm/opto/type.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/type.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -32,6 +32,7 @@
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/klassKlass.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/typeArrayKlass.hpp"
@@ -2241,43 +2242,49 @@
     } else if (this->isa_aryptr()) {
       _is_ptr_to_narrowoop = (klass()->is_obj_array_klass() &&
                              _offset != arrayOopDesc::length_offset_in_bytes());
-    } else if (klass() == ciEnv::current()->Class_klass() &&
-               (_offset == java_lang_Class::klass_offset_in_bytes() ||
-                _offset == java_lang_Class::array_klass_offset_in_bytes())) {
-      // Special hidden fields from the Class.
-      assert(this->isa_instptr(), "must be an instance ptr.");
-      _is_ptr_to_narrowoop = true;
     } else if (klass()->is_instance_klass()) {
       ciInstanceKlass* ik = klass()->as_instance_klass();
       ciField* field = NULL;
       if (this->isa_klassptr()) {
-        // Perm objects don't use compressed references, except for
-        // static fields which are currently compressed.
-        field = ik->get_field_by_offset(_offset, true);
-        if (field != NULL) {
-          BasicType basic_elem_type = field->layout_type();
-          _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT ||
-                                  basic_elem_type == T_ARRAY);
-        }
+        // Perm objects don't use compressed references
       } else if (_offset == OffsetBot || _offset == OffsetTop) {
         // unsafe access
         _is_ptr_to_narrowoop = true;
       } else { // exclude unsafe ops
         assert(this->isa_instptr(), "must be an instance ptr.");
-        // Field which contains a compressed oop references.
-        field = ik->get_field_by_offset(_offset, false);
-        if (field != NULL) {
+
+        if (klass() == ciEnv::current()->Class_klass() &&
+            (_offset == java_lang_Class::klass_offset_in_bytes() ||
+             _offset == java_lang_Class::array_klass_offset_in_bytes())) {
+          // Special hidden fields from the Class.
+          assert(this->isa_instptr(), "must be an instance ptr.");
+          _is_ptr_to_narrowoop = true;
+        } else if (klass() == ciEnv::current()->Class_klass() &&
+                   _offset >= instanceMirrorKlass::offset_of_static_fields()) {
+          // Static fields
+          assert(o != NULL, "must be constant");
+          ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass();
+          ciField* field = k->get_field_by_offset(_offset, true);
+          assert(field != NULL, "missing field");
           BasicType basic_elem_type = field->layout_type();
           _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT ||
                                   basic_elem_type == T_ARRAY);
-        } else if (klass()->equals(ciEnv::current()->Object_klass())) {
-          // Compile::find_alias_type() cast exactness on all types to verify
-          // that it does not affect alias type.
-          _is_ptr_to_narrowoop = true;
         } else {
-          // Type for the copy start in LibraryCallKit::inline_native_clone().
-          assert(!klass_is_exact(), "only non-exact klass");
-          _is_ptr_to_narrowoop = true;
+          // Instance fields which contains a compressed oop references.
+          field = ik->get_field_by_offset(_offset, false);
+          if (field != NULL) {
+            BasicType basic_elem_type = field->layout_type();
+            _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT ||
+                                    basic_elem_type == T_ARRAY);
+          } else if (klass()->equals(ciEnv::current()->Object_klass())) {
+            // Compile::find_alias_type() cast exactness on all types to verify
+            // that it does not affect alias type.
+            _is_ptr_to_narrowoop = true;
+          } else {
+            // Type for the copy start in LibraryCallKit::inline_native_clone().
+            assert(!klass_is_exact(), "only non-exact klass");
+            _is_ptr_to_narrowoop = true;
+          }
         }
       }
     }
@@ -3386,7 +3393,22 @@
         instance_id = InstanceBot;
         tary = TypeAry::make(Type::BOTTOM, tary->_size);
       }
+    } else // Non integral arrays.
+    // Must fall to bottom if exact klasses in upper lattice
+    // are not equal or super klass is exact.
+    if ( above_centerline(ptr) && klass() != tap->klass() &&
+         // meet with top[] and bottom[] are processed further down:
+         tap ->_klass != NULL  && this->_klass != NULL   &&
+         // both are exact and not equal:
+        ((tap ->_klass_is_exact && this->_klass_is_exact) ||
+         // 'tap'  is exact and super or unrelated:
+         (tap ->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) ||
+         // 'this' is exact and super or unrelated:
+         (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) {
+      tary = TypeAry::make(Type::BOTTOM, tary->_size);
+      return make( NotNull, NULL, tary, lazy_klass, false, off, InstanceBot );
     }
+
     bool xk = false;
     switch (tap->ptr()) {
     case AnyNull:
@@ -3766,7 +3788,7 @@
   // Oops, need to compute _klass and cache it
   ciKlass* k_ary = compute_klass();
 
-  if( this != TypeAryPtr::OOPS ) {
+  if( this != TypeAryPtr::OOPS && this->dual() != TypeAryPtr::OOPS ) {
     // The _klass field acts as a cache of the underlying
     // ciKlass for this array type.  In order to set the field,
     // we need to cast away const-ness.
--- a/hotspot/src/share/vm/opto/type.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/opto/type.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -988,8 +988,8 @@
 
   static const TypeNarrowOop *make( const TypePtr* type);
 
-  static const TypeNarrowOop* make_from_constant(ciObject* con) {
-    return make(TypeOopPtr::make_from_constant(con));
+  static const TypeNarrowOop* make_from_constant(ciObject* con, bool require_constant = false) {
+    return make(TypeOopPtr::make_from_constant(con, require_constant));
   }
 
   // returns the equivalent ptr type for this compressed pointer
--- a/hotspot/src/share/vm/prims/jni.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -1858,7 +1858,7 @@
     // Static field. The fieldID a JNIid specifying the field holder and the offset within the klassOop.
     JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID);
     assert(id->is_static_field_id(), "invalid static field id");
-    found = instanceKlass::cast(id->holder())->find_local_field_from_offset(id->offset(), true, &fd);
+    found = id->find_local_field(&fd);
   } else {
     // Non-static field. The fieldID is really the offset of the field within the instanceOop.
     int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID);
@@ -1906,9 +1906,7 @@
   JNIid* id = instanceKlass::cast(fd.field_holder())->jni_id_for(fd.offset());
   debug_only(id->set_is_static_field_id();)
 
-  debug_only(int first_offset = instanceKlass::cast(fd.field_holder())->offset_of_static_fields();)
-  debug_only(int end_offset = first_offset + (instanceKlass::cast(fd.field_holder())->static_field_size() * wordSize);)
-  assert(id->offset() >= first_offset && id->offset() < end_offset, "invalid static field offset");
+  debug_only(id->verify(fd.field_holder()));
 
   ret = jfieldIDWorkaround::to_static_jfieldID(id);
   return ret;
@@ -1928,7 +1926,7 @@
   if (JvmtiExport::should_post_field_access()) {
     JvmtiExport::jni_GetField_probe(thread, NULL, NULL, id->holder(), fieldID, true);
   }
-  jobject ret = JNIHandles::make_local(id->holder()->obj_field(id->offset()));
+  jobject ret = JNIHandles::make_local(id->holder()->java_mirror()->obj_field(id->offset()));
   DTRACE_PROBE1(hotspot_jni, GetStaticObjectField__return, ret);
   return ret;
 JNI_END
@@ -1950,7 +1948,7 @@
   if (JvmtiExport::should_post_field_access()) { \
     JvmtiExport::jni_GetField_probe(thread, NULL, NULL, id->holder(), fieldID, true); \
   } \
-  ret = id->holder()-> Fieldname##_field (id->offset()); \
+  ret = id->holder()->java_mirror()-> Fieldname##_field (id->offset()); \
   return ret;\
 JNI_END
 
@@ -1976,7 +1974,7 @@
     field_value.l = value;
     JvmtiExport::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, 'L', (jvalue *)&field_value);
   }
-  id->holder()->obj_field_put(id->offset(), JNIHandles::resolve(value));
+  id->holder()->java_mirror()->obj_field_put(id->offset(), JNIHandles::resolve(value));
   DTRACE_PROBE(hotspot_jni, SetStaticObjectField__return);
 JNI_END
 
@@ -1999,7 +1997,7 @@
     field_value.unionType = value; \
     JvmtiExport::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, SigType, (jvalue *)&field_value); \
   } \
-  id->holder()-> Fieldname##_field_put (id->offset(), value); \
+  id->holder()->java_mirror()-> Fieldname##_field_put (id->offset(), value); \
   DTRACE_PROBE(hotspot_jni, SetStatic##Result##Field__return);\
 JNI_END
 
--- a/hotspot/src/share/vm/prims/jniCheck.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -224,8 +224,7 @@
     ReportJNIFatalError(thr, fatal_wrong_static_field);
 
   /* check for proper field type */
-  if (!instanceKlass::cast(f_oop)->find_local_field_from_offset(
-          id->offset(), true, &fd))
+  if (!id->find_local_field(&fd))
     ReportJNIFatalError(thr, fatal_static_field_not_found);
   if ((fd.field_type() != ftype) &&
       !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1808,7 +1808,7 @@
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
   }
   klassOop k = cp->klass_at(index, CHECK_NULL);
-  return (jclass) JNIHandles::make_local(k->klass_part()->java_mirror());
+  return (jclass) JNIHandles::make_local(k->java_mirror());
 }
 JVM_END
 
@@ -1824,7 +1824,7 @@
   }
   klassOop k = constantPoolOopDesc::klass_at_if_loaded(cp, index);
   if (k == NULL) return NULL;
-  return (jclass) JNIHandles::make_local(k->klass_part()->java_mirror());
+  return (jclass) JNIHandles::make_local(k->java_mirror());
 }
 JVM_END
 
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -616,9 +616,7 @@
   bool found = false;
   if (jfieldIDWorkaround::is_static_jfieldID(field)) {
     JNIid* id = jfieldIDWorkaround::from_static_jfieldID(field);
-    int offset = id->offset();
-    klassOop holder = id->holder();
-    found = instanceKlass::cast(holder)->find_local_field_from_offset(offset, true, fd);
+    found = id->find_local_field(fd);
   } else {
     // Non-static field. The fieldID is really the offset of the field within the object.
     int offset = jfieldIDWorkaround::from_instance_jfieldID(k, field);
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -919,15 +919,24 @@
     nmethod* nm) {
   JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_LOAD);
   event._event_data.compiled_method_load = nm;
-  nmethodLocker::lock_nmethod(nm); // will be unlocked when posted
+  // Keep the nmethod alive until the ServiceThread can process
+  // this deferred event.
+  nmethodLocker::lock_nmethod(nm);
   return event;
 }
 
 JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_unload_event(
-    jmethodID id, const void* code) {
+    nmethod* nm, jmethodID id, const void* code) {
   JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_UNLOAD);
+  event._event_data.compiled_method_unload.nm = nm;
   event._event_data.compiled_method_unload.method_id = id;
   event._event_data.compiled_method_unload.code_begin = code;
+  // Keep the nmethod alive until the ServiceThread can process
+  // this deferred event. This will keep the memory for the
+  // generated code from being reused too early. We pass
+  // zombie_ok == true here so that our nmethod that was just
+  // made into a zombie can be locked.
+  nmethodLocker::lock_nmethod(nm, true /* zombie_ok */);
   return event;
 }
 JvmtiDeferredEvent JvmtiDeferredEvent::dynamic_code_generated_event(
@@ -946,14 +955,19 @@
     case TYPE_COMPILED_METHOD_LOAD: {
       nmethod* nm = _event_data.compiled_method_load;
       JvmtiExport::post_compiled_method_load(nm);
+      // done with the deferred event so unlock the nmethod
       nmethodLocker::unlock_nmethod(nm);
       break;
     }
-    case TYPE_COMPILED_METHOD_UNLOAD:
+    case TYPE_COMPILED_METHOD_UNLOAD: {
+      nmethod* nm = _event_data.compiled_method_unload.nm;
       JvmtiExport::post_compiled_method_unload(
         _event_data.compiled_method_unload.method_id,
         _event_data.compiled_method_unload.code_begin);
+      // done with the deferred event so unlock the nmethod
+      nmethodLocker::unlock_nmethod(nm);
       break;
+    }
     case TYPE_DYNAMIC_CODE_GENERATED:
       JvmtiExport::post_dynamic_code_generated_internal(
         _event_data.dynamic_code_generated.name,
--- a/hotspot/src/share/vm/prims/jvmtiImpl.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -458,6 +458,7 @@
   union {
     nmethod* compiled_method_load;
     struct {
+      nmethod* nm;
       jmethodID method_id;
       const void* code_begin;
     } compiled_method_unload;
@@ -477,7 +478,7 @@
   // Factory methods
   static JvmtiDeferredEvent compiled_method_load_event(nmethod* nm)
     KERNEL_RETURN_(JvmtiDeferredEvent());
-  static JvmtiDeferredEvent compiled_method_unload_event(
+  static JvmtiDeferredEvent compiled_method_unload_event(nmethod* nm,
       jmethodID id, const void* code) KERNEL_RETURN_(JvmtiDeferredEvent());
   static JvmtiDeferredEvent dynamic_code_generated_event(
       const char* name, const void* begin, const void* end)
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1084,7 +1084,10 @@
       jbyte old_tag = old_cp->tag_at(old_i).value();
       switch (old_tag) {
       case JVM_CONSTANT_Class:
+      case JVM_CONSTANT_UnresolvedClass:
         // revert the copy to JVM_CONSTANT_UnresolvedClass
+        // May be resolving while calling this so do the same for
+        // JVM_CONSTANT_UnresolvedClass (klass_name_at() deals with transition)
         (*merge_cp_p)->unresolved_klass_at_put(old_i,
           old_cp->klass_name_at(old_i));
         break;
@@ -3347,11 +3350,12 @@
 
   for (Klass *subk = ik->subklass(); subk != NULL;
        subk = subk->next_sibling()) {
-    klassOop sub = subk->as_klassOop();
-    instanceKlass *subik = (instanceKlass *)sub->klass_part();
-
-    // recursively do subclasses of the current subclass
-    increment_class_counter(subik, THREAD);
+    if (subk->oop_is_instance()) {
+      // Only update instanceKlasses
+      instanceKlass *subik = (instanceKlass*)subk;
+      // recursively do subclasses of the current subclass
+      increment_class_counter(subik, THREAD);
+    }
   }
 }
 
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -27,6 +27,7 @@
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "jvmtifiles/jvmtiEnv.hpp"
+#include "oops/instanceMirrorKlass.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.inline2.hpp"
 #include "prims/jvmtiEventController.hpp"
@@ -2594,6 +2595,11 @@
     if (o->is_klass()) {
       klassOop k = (klassOop)o;
       o = Klass::cast(k)->java_mirror();
+      if (o == NULL) {
+        // Classes without mirrors don't correspond to real Java
+        // classes so just ignore them.
+        return;
+      }
     } else {
 
       // SystemDictionary::always_strong_oops_do reports the application
@@ -2834,10 +2840,10 @@
 
 // verify that a static oop field is in range
 static inline bool verify_static_oop(instanceKlass* ik,
-                                     klassOop k, int offset) {
-  address obj_p = (address)k + offset;
-  address start = (address)ik->start_of_static_fields();
-  address end = start + (ik->static_oop_field_size() * heapOopSize);
+                                     oop mirror, int offset) {
+  address obj_p = (address)mirror + offset;
+  address start = (address)instanceMirrorKlass::start_of_static_fields(mirror);
+  address end = start + (java_lang_Class::static_oop_field_count(mirror) * heapOopSize);
   assert(end >= start, "sanity check");
 
   if (obj_p >= start && obj_p < end) {
@@ -2938,8 +2944,8 @@
       ClassFieldDescriptor* field = field_map->field_at(i);
       char type = field->field_type();
       if (!is_primitive_field_type(type)) {
-        oop fld_o = k->obj_field(field->field_offset());
-        assert(verify_static_oop(ik, k, field->field_offset()), "sanity check");
+        oop fld_o = mirror->obj_field(field->field_offset());
+        assert(verify_static_oop(ik, mirror, field->field_offset()), "sanity check");
         if (fld_o != NULL) {
           int slot = field->field_index();
           if (!CallbackInvoker::report_static_field_reference(mirror, fld_o, slot)) {
@@ -2949,7 +2955,7 @@
         }
       } else {
          if (is_reporting_primitive_fields()) {
-           address addr = (address)k + field->field_offset();
+           address addr = (address)mirror + field->field_offset();
            int slot = field->field_index();
            if (!CallbackInvoker::report_primitive_static_field(mirror, slot, addr, type)) {
              delete field_map;
--- a/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -36,7 +36,7 @@
 // MethodHandleChain
 
 void MethodHandleChain::set_method_handle(Handle mh, TRAPS) {
-  if (!java_dyn_MethodHandle::is_instance(mh()))  lose("bad method handle", CHECK);
+  if (!java_lang_invoke_MethodHandle::is_instance(mh()))  lose("bad method handle", CHECK);
 
   // set current method handle and unpack partially
   _method_handle = mh;
@@ -47,21 +47,21 @@
   _conversion    = -1;
   _last_invoke   = Bytecodes::_nop;  //arbitrary non-garbage
 
-  if (sun_dyn_DirectMethodHandle::is_instance(mh())) {
+  if (java_lang_invoke_DirectMethodHandle::is_instance(mh())) {
     set_last_method(mh(), THREAD);
     return;
   }
-  if (sun_dyn_AdapterMethodHandle::is_instance(mh())) {
+  if (java_lang_invoke_AdapterMethodHandle::is_instance(mh())) {
     _conversion = AdapterMethodHandle_conversion();
     assert(_conversion != -1, "bad conv value");
-    assert(sun_dyn_BoundMethodHandle::is_instance(mh()), "also BMH");
+    assert(java_lang_invoke_BoundMethodHandle::is_instance(mh()), "also BMH");
   }
-  if (sun_dyn_BoundMethodHandle::is_instance(mh())) {
+  if (java_lang_invoke_BoundMethodHandle::is_instance(mh())) {
     if (!is_adapter())          // keep AMH and BMH separate in this model
       _is_bound = true;
     _arg_slot = BoundMethodHandle_vmargslot();
     oop target = MethodHandle_vmtarget_oop();
-    if (!is_bound() || java_dyn_MethodHandle::is_instance(target)) {
+    if (!is_bound() || java_lang_invoke_MethodHandle::is_instance(target)) {
       _arg_type = compute_bound_arg_type(target, NULL, _arg_slot, CHECK);
     } else if (target != NULL && target->is_method()) {
       methodOop m = (methodOop) target;
@@ -100,13 +100,12 @@
 BasicType MethodHandleChain::compute_bound_arg_type(oop target, methodOop m, int arg_slot, TRAPS) {
   // There is no direct indication of whether the argument is primitive or not.
   // It is implied by the _vmentry code, and by the MethodType of the target.
-  // FIXME: Make it explicit MethodHandleImpl refactors out from MethodHandle
   BasicType arg_type = T_VOID;
   if (target != NULL) {
-    oop mtype = java_dyn_MethodHandle::type(target);
+    oop mtype = java_lang_invoke_MethodHandle::type(target);
     int arg_num = MethodHandles::argument_slot_to_argnum(mtype, arg_slot);
     if (arg_num >= 0) {
-      oop ptype = java_dyn_MethodType::ptype(mtype, arg_num);
+      oop ptype = java_lang_invoke_MethodType::ptype(mtype, arg_num);
       arg_type = java_lang_Class::as_BasicType(ptype);
     }
   } else if (m != NULL) {
@@ -205,28 +204,28 @@
       int arg_slot = chain().adapter_arg_slot();
       SlotState* arg_state = slot_state(arg_slot);
       if (arg_state == NULL
-          && conv_op > sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW) {
+          && conv_op > java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW) {
         lose("bad argument index", CHECK_(empty));
       }
 
       // perform the adapter action
       switch (chain().adapter_conversion_op()) {
-      case sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY:
+      case java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY:
         // No changes to arguments; pass the bits through.
         break;
 
-      case sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW: {
+      case java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW: {
         // To keep the verifier happy, emit bitwise ("raw") conversions as needed.
         // See MethodHandles::same_basic_type_for_arguments for allowed conversions.
         Handle incoming_mtype(THREAD, chain().method_type_oop());
         oop outgoing_mh_oop = chain().vmtarget_oop();
-        if (!java_dyn_MethodHandle::is_instance(outgoing_mh_oop))
+        if (!java_lang_invoke_MethodHandle::is_instance(outgoing_mh_oop))
           lose("outgoing target not a MethodHandle", CHECK_(empty));
-        Handle outgoing_mtype(THREAD, java_dyn_MethodHandle::type(outgoing_mh_oop));
+        Handle outgoing_mtype(THREAD, java_lang_invoke_MethodHandle::type(outgoing_mh_oop));
         outgoing_mh_oop = NULL;  // GC safety
 
-        int nptypes = java_dyn_MethodType::ptype_count(outgoing_mtype());
-        if (nptypes != java_dyn_MethodType::ptype_count(incoming_mtype()))
+        int nptypes = java_lang_invoke_MethodType::ptype_count(outgoing_mtype());
+        if (nptypes != java_lang_invoke_MethodType::ptype_count(incoming_mtype()))
           lose("incoming and outgoing parameter count do not agree", CHECK_(empty));
 
         for (int i = 0, slot = _outgoing.length() - 1; slot >= 0; slot--) {
@@ -236,8 +235,8 @@
 
           klassOop  in_klass  = NULL;
           klassOop  out_klass = NULL;
-          BasicType inpbt  = java_lang_Class::as_BasicType(java_dyn_MethodType::ptype(incoming_mtype(), i), &in_klass);
-          BasicType outpbt = java_lang_Class::as_BasicType(java_dyn_MethodType::ptype(outgoing_mtype(), i), &out_klass);
+          BasicType inpbt  = java_lang_Class::as_BasicType(java_lang_invoke_MethodType::ptype(incoming_mtype(), i), &in_klass);
+          BasicType outpbt = java_lang_Class::as_BasicType(java_lang_invoke_MethodType::ptype(outgoing_mtype(), i), &out_klass);
           assert(inpbt == arg.basic_type(), "sanity");
 
           if (inpbt != outpbt) {
@@ -255,8 +254,8 @@
           i++;  // We need to skip void slots at the top of the loop.
         }
 
-        BasicType inrbt  = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(incoming_mtype()));
-        BasicType outrbt = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(outgoing_mtype()));
+        BasicType inrbt  = java_lang_Class::as_BasicType(java_lang_invoke_MethodType::rtype(incoming_mtype()));
+        BasicType outrbt = java_lang_Class::as_BasicType(java_lang_invoke_MethodType::rtype(outgoing_mtype()));
         if (inrbt != outrbt) {
           if (inrbt == T_INT && outrbt == T_VOID) {
             // See comments in MethodHandles::same_basic_type_for_arguments.
@@ -268,7 +267,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_CHECK_CAST: {
+      case java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST: {
         // checkcast the Nth outgoing argument in place
         klassOop dest_klass = NULL;
         BasicType dest = java_lang_Class::as_BasicType(chain().adapter_arg_oop(), &dest_klass);
@@ -281,7 +280,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM: {
+      case java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM: {
         // i2l, etc., on the Nth outgoing argument in place
         BasicType src = chain().adapter_conversion_src_type(),
                   dest = chain().adapter_conversion_dest_type();
@@ -306,7 +305,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM: {
+      case java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM: {
         // checkcast to wrapper type & call intValue, etc.
         BasicType dest = chain().adapter_conversion_dest_type();
         ArgToken arg = arg_state->_arg;
@@ -324,7 +323,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_PRIM_TO_REF: {
+      case java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF: {
         // call wrapper type.valueOf
         BasicType src = chain().adapter_conversion_src_type();
         ArgToken arg = arg_state->_arg;
@@ -340,7 +339,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS: {
+      case java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS: {
         int dest_arg_slot = chain().adapter_conversion_vminfo();
         if (!slot_has_argument(dest_arg_slot)) {
           lose("bad swap index", CHECK_(empty));
@@ -353,7 +352,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_ROT_ARGS: {
+      case java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS: {
         int dest_arg_slot = chain().adapter_conversion_vminfo();
         if (!slot_has_argument(dest_arg_slot) || arg_slot == dest_arg_slot) {
           lose("bad rotate index", CHECK_(empty));
@@ -379,7 +378,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_DUP_ARGS: {
+      case java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS: {
         int dup_slots = chain().adapter_conversion_stack_pushes();
         if (dup_slots <= 0) {
           lose("bad dup count", CHECK_(empty));
@@ -393,7 +392,7 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_DROP_ARGS: {
+      case java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS: {
         int drop_slots = -chain().adapter_conversion_stack_pushes();
         if (drop_slots <= 0) {
           lose("bad drop count", CHECK_(empty));
@@ -407,12 +406,12 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_COLLECT_ARGS: { //NYI, may GC
+      case java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS: { //NYI, may GC
         lose("unimplemented", CHECK_(empty));
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS: {
+      case java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS: {
         klassOop array_klass_oop = NULL;
         BasicType array_type = java_lang_Class::as_BasicType(chain().adapter_arg_oop(),
                                                              &array_klass_oop);
@@ -470,8 +469,8 @@
         break;
       }
 
-      case sun_dyn_AdapterMethodHandle::OP_FLYBY: //NYI, runs Java code
-      case sun_dyn_AdapterMethodHandle::OP_RICOCHET: //NYI, runs Java code
+      case java_lang_invoke_AdapterMethodHandle::OP_FLYBY: //NYI, runs Java code
+      case java_lang_invoke_AdapterMethodHandle::OP_RICOCHET: //NYI, runs Java code
         lose("unimplemented", CHECK_(empty));
         break;
 
@@ -533,7 +532,7 @@
 //
 void MethodHandleWalker::walk_incoming_state(TRAPS) {
   Handle mtype(THREAD, chain().method_type_oop());
-  int nptypes = java_dyn_MethodType::ptype_count(mtype());
+  int nptypes = java_lang_invoke_MethodType::ptype_count(mtype());
   _outgoing_argc = nptypes;
   int argp = nptypes - 1;
   if (argp >= 0) {
@@ -542,7 +541,7 @@
   for (int i = 0; i < nptypes; i++) {
     klassOop  arg_type_klass = NULL;
     BasicType arg_type = java_lang_Class::as_BasicType(
-                java_dyn_MethodType::ptype(mtype(), i), &arg_type_klass);
+                java_lang_invoke_MethodType::ptype(mtype(), i), &arg_type_klass);
     int index = new_local_index(arg_type);
     ArgToken arg = make_parameter(arg_type, arg_type_klass, index, CHECK);
     debug_only(arg_type_klass = (klassOop) NULL);
@@ -556,7 +555,7 @@
   // call make_parameter at the end of the list for the return type
   klassOop  ret_type_klass = NULL;
   BasicType ret_type = java_lang_Class::as_BasicType(
-              java_dyn_MethodType::rtype(mtype()), &ret_type_klass);
+              java_lang_invoke_MethodType::rtype(mtype()), &ret_type_klass);
   ArgToken  ret = make_parameter(ret_type, ret_type_klass, -1, CHECK);
   // ignore ret; client can catch it if needed
 }
@@ -631,7 +630,7 @@
   // Get return type klass.
   Handle first_mtype(THREAD, chain().method_type_oop());
   // _rklass is NULL for primitives.
-  _rtype = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(first_mtype()), &_rklass);
+  _rtype = java_lang_Class::as_BasicType(java_lang_invoke_MethodType::rtype(first_mtype()), &_rklass);
   if (_rtype == T_ARRAY)  _rtype = T_OBJECT;
 
   int params = _callee->size_of_parameters();  // Incoming arguments plus receiver.
@@ -960,6 +959,16 @@
   if (m == NULL) {
     // Get the intrinsic methodOop.
     m = vmIntrinsics::method_for(iid);
+    if (m == NULL && iid == vmIntrinsics::_checkSpreadArgument && AllowTransitionalJSR292) {
+      m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS);
+      if (m == NULL)
+        // sun.dyn.MethodHandleImpl not found, look for java.dyn.MethodHandleNatives:
+        m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS2);
+    }
+    if (m == NULL) {
+      ArgToken zero;
+      lose(vmIntrinsics::name_at(iid), CHECK_(zero));
+    }
   }
 
   klassOop  klass   = m->method_holder();
@@ -1396,7 +1405,7 @@
 void print_method_handle(oop mh) {
   if (!mh->is_oop()) {
     tty->print_cr("*** not a method handle: "INTPTR_FORMAT, (intptr_t)mh);
-  } else if (java_dyn_MethodHandle::is_instance(mh)) {
+  } else if (java_lang_invoke_MethodHandle::is_instance(mh)) {
     //MethodHandlePrinter::print(mh);
   } else {
     tty->print("*** not a method handle: ");
--- a/hotspot/src/share/vm/prims/methodHandleWalk.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,13 +48,13 @@
   void set_last_method(oop target, TRAPS);
   static BasicType compute_bound_arg_type(oop target, methodOop m, int arg_slot, TRAPS);
 
-  oop MethodHandle_type_oop()     { return java_dyn_MethodHandle::type(method_handle_oop()); }
-  oop MethodHandle_vmtarget_oop() { return java_dyn_MethodHandle::vmtarget(method_handle_oop()); }
-  int MethodHandle_vmslots()      { return java_dyn_MethodHandle::vmslots(method_handle_oop()); }
-  int DirectMethodHandle_vmindex()     { return sun_dyn_DirectMethodHandle::vmindex(method_handle_oop()); }
-  oop BoundMethodHandle_argument_oop() { return sun_dyn_BoundMethodHandle::argument(method_handle_oop()); }
-  int BoundMethodHandle_vmargslot()    { return sun_dyn_BoundMethodHandle::vmargslot(method_handle_oop()); }
-  int AdapterMethodHandle_conversion() { return sun_dyn_AdapterMethodHandle::conversion(method_handle_oop()); }
+  oop MethodHandle_type_oop()          { return java_lang_invoke_MethodHandle::type(method_handle_oop()); }
+  oop MethodHandle_vmtarget_oop()      { return java_lang_invoke_MethodHandle::vmtarget(method_handle_oop()); }
+  int MethodHandle_vmslots()           { return java_lang_invoke_MethodHandle::vmslots(method_handle_oop()); }
+  int DirectMethodHandle_vmindex()     { return java_lang_invoke_DirectMethodHandle::vmindex(method_handle_oop()); }
+  oop BoundMethodHandle_argument_oop() { return java_lang_invoke_BoundMethodHandle::argument(method_handle_oop()); }
+  int BoundMethodHandle_vmargslot()    { return java_lang_invoke_BoundMethodHandle::vmargslot(method_handle_oop()); }
+  int AdapterMethodHandle_conversion() { return java_lang_invoke_AdapterMethodHandle::conversion(method_handle_oop()); }
 
 public:
   MethodHandleChain(Handle root, TRAPS)
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -163,9 +163,9 @@
     // or it may use the klass/index form; both forms mean the same thing.
     methodOop m = decode_methodOop(methodOop(vmtarget), decode_flags_result);
     if ((decode_flags_result & _dmf_has_receiver) != 0
-        && java_dyn_MethodType::is_instance(mtype)) {
+        && java_lang_invoke_MethodType::is_instance(mtype)) {
       // Extract receiver type restriction from mtype.ptypes[0].
-      objArrayOop ptypes = java_dyn_MethodType::ptypes(mtype);
+      objArrayOop ptypes = java_lang_invoke_MethodType::ptypes(mtype);
       oop ptype0 = (ptypes == NULL || ptypes->length() < 1) ? oop(NULL) : ptypes->obj_at(0);
       if (java_lang_Class::is_instance(ptype0))
         receiver_limit_result = java_lang_Class::as_klassOop(ptype0);
@@ -199,18 +199,18 @@
 // (MemberName is the non-operational name used for queries and setup.)
 
 methodOop MethodHandles::decode_DirectMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
-  oop vmtarget = sun_dyn_DirectMethodHandle::vmtarget(mh);
-  int vmindex  = sun_dyn_DirectMethodHandle::vmindex(mh);
-  oop mtype    = sun_dyn_DirectMethodHandle::type(mh);
+  oop vmtarget = java_lang_invoke_DirectMethodHandle::vmtarget(mh);
+  int vmindex  = java_lang_invoke_DirectMethodHandle::vmindex(mh);
+  oop mtype    = java_lang_invoke_DirectMethodHandle::type(mh);
   return decode_vmtarget(vmtarget, vmindex, mtype, receiver_limit_result, decode_flags_result);
 }
 
 methodOop MethodHandles::decode_BoundMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
-  assert(sun_dyn_BoundMethodHandle::is_instance(mh), "");
+  assert(java_lang_invoke_BoundMethodHandle::is_instance(mh), "");
   assert(mh->klass() != SystemDictionary::AdapterMethodHandle_klass(), "");
   for (oop bmh = mh;;) {
     // Bound MHs can be stacked to bind several arguments.
-    oop target = java_dyn_MethodHandle::vmtarget(bmh);
+    oop target = java_lang_invoke_MethodHandle::vmtarget(bmh);
     if (target == NULL)  return NULL;
     decode_flags_result |= MethodHandles::_dmf_binds_argument;
     klassOop tk = target->klass();
@@ -218,7 +218,7 @@
       bmh = target;
       continue;
     } else {
-      if (java_dyn_MethodHandle::is_subclass(tk)) {
+      if (java_lang_invoke_MethodHandle::is_subclass(tk)) {
         //assert(tk == SystemDictionary::DirectMethodHandle_klass(), "end of BMH chain must be DMH");
         return decode_MethodHandle(target, receiver_limit_result, decode_flags_result);
       } else {
@@ -240,9 +240,9 @@
   assert(mh->klass() == SystemDictionary::AdapterMethodHandle_klass(), "");
   for (oop amh = mh;;) {
     // Adapter MHs can be stacked to convert several arguments.
-    int conv_op = adapter_conversion_op(sun_dyn_AdapterMethodHandle::conversion(amh));
+    int conv_op = adapter_conversion_op(java_lang_invoke_AdapterMethodHandle::conversion(amh));
     decode_flags_result |= (_dmf_adapter_lsb << conv_op) & _DMF_ADAPTER_MASK;
-    oop target = java_dyn_MethodHandle::vmtarget(amh);
+    oop target = java_lang_invoke_MethodHandle::vmtarget(amh);
     if (target == NULL)  return NULL;
     klassOop tk = target->klass();
     if (tk == SystemDictionary::AdapterMethodHandle_klass()) {
@@ -258,14 +258,14 @@
 methodOop MethodHandles::decode_MethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
   if (mh == NULL)  return NULL;
   klassOop mhk = mh->klass();
-  assert(java_dyn_MethodHandle::is_subclass(mhk), "must be a MethodHandle");
+  assert(java_lang_invoke_MethodHandle::is_subclass(mhk), "must be a MethodHandle");
   if (mhk == SystemDictionary::DirectMethodHandle_klass()) {
     return decode_DirectMethodHandle(mh, receiver_limit_result, decode_flags_result);
   } else if (mhk == SystemDictionary::BoundMethodHandle_klass()) {
     return decode_BoundMethodHandle(mh, receiver_limit_result, decode_flags_result);
   } else if (mhk == SystemDictionary::AdapterMethodHandle_klass()) {
     return decode_AdapterMethodHandle(mh, receiver_limit_result, decode_flags_result);
-  } else if (sun_dyn_BoundMethodHandle::is_subclass(mhk)) {
+  } else if (java_lang_invoke_BoundMethodHandle::is_subclass(mhk)) {
     // could be a JavaMethodHandle (but not an adapter MH)
     return decode_BoundMethodHandle(mh, receiver_limit_result, decode_flags_result);
   } else {
@@ -308,7 +308,7 @@
   } else if (xk == SystemDictionary::MemberName_klass()) {
     // Note: This only works if the MemberName has already been resolved.
     return decode_MemberName(x, receiver_limit_result, decode_flags_result);
-  } else if (java_dyn_MethodHandle::is_subclass(xk)) {
+  } else if (java_lang_invoke_MethodHandle::is_subclass(xk)) {
     return decode_MethodHandle(x, receiver_limit_result, decode_flags_result);
   } else if (xk == SystemDictionary::reflect_Method_klass()) {
     oop clazz  = java_lang_reflect_Method::clazz(x);
@@ -327,7 +327,7 @@
   } else {
     // unrecognized object
     assert(!x->is_method(), "already checked");
-    assert(!sun_dyn_MemberName::is_instance(x), "already checked");
+    assert(!java_lang_invoke_MemberName::is_instance(x), "already checked");
   }
   return NULL;
 }
@@ -336,15 +336,15 @@
 int MethodHandles::decode_MethodHandle_stack_pushes(oop mh) {
   if (mh->klass() == SystemDictionary::DirectMethodHandle_klass())
     return 0;                   // no push/pop
-  int this_vmslots = java_dyn_MethodHandle::vmslots(mh);
+  int this_vmslots = java_lang_invoke_MethodHandle::vmslots(mh);
   int last_vmslots = 0;
   oop last_mh = mh;
   for (;;) {
-    oop target = java_dyn_MethodHandle::vmtarget(last_mh);
+    oop target = java_lang_invoke_MethodHandle::vmtarget(last_mh);
     if (target->klass() == SystemDictionary::DirectMethodHandle_klass()) {
-      last_vmslots = java_dyn_MethodHandle::vmslots(target);
+      last_vmslots = java_lang_invoke_MethodHandle::vmslots(target);
       break;
-    } else if (!java_dyn_MethodHandle::is_instance(target)) {
+    } else if (!java_lang_invoke_MethodHandle::is_instance(target)) {
       // might be klass or method
       assert(target->is_method(), "must get here with a direct ref to method");
       last_vmslots = methodOop(target)->size_of_parameters();
@@ -361,16 +361,16 @@
 
 // MemberName support
 
-// import sun_dyn_MemberName.*
+// import java_lang_invoke_MemberName.*
 enum {
-  IS_METHOD      = sun_dyn_MemberName::MN_IS_METHOD,
-  IS_CONSTRUCTOR = sun_dyn_MemberName::MN_IS_CONSTRUCTOR,
-  IS_FIELD       = sun_dyn_MemberName::MN_IS_FIELD,
-  IS_TYPE        = sun_dyn_MemberName::MN_IS_TYPE,
-  SEARCH_SUPERCLASSES = sun_dyn_MemberName::MN_SEARCH_SUPERCLASSES,
-  SEARCH_INTERFACES   = sun_dyn_MemberName::MN_SEARCH_INTERFACES,
+  IS_METHOD      = java_lang_invoke_MemberName::MN_IS_METHOD,
+  IS_CONSTRUCTOR = java_lang_invoke_MemberName::MN_IS_CONSTRUCTOR,
+  IS_FIELD       = java_lang_invoke_MemberName::MN_IS_FIELD,
+  IS_TYPE        = java_lang_invoke_MemberName::MN_IS_TYPE,
+  SEARCH_SUPERCLASSES = java_lang_invoke_MemberName::MN_SEARCH_SUPERCLASSES,
+  SEARCH_INTERFACES   = java_lang_invoke_MemberName::MN_SEARCH_INTERFACES,
   ALL_KINDS      = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE,
-  VM_INDEX_UNINITIALIZED = sun_dyn_MemberName::VM_INDEX_UNINITIALIZED
+  VM_INDEX_UNINITIALIZED = java_lang_invoke_MemberName::VM_INDEX_UNINITIALIZED
 };
 
 Handle MethodHandles::new_MemberName(TRAPS) {
@@ -405,10 +405,10 @@
   if (!do_dispatch || (flags & IS_CONSTRUCTOR) || m->can_be_statically_bound())
     vmindex = methodOopDesc::nonvirtual_vtable_index; // implies never any dispatch
   assert(vmindex != VM_INDEX_UNINITIALIZED, "Java sentinel value");
-  sun_dyn_MemberName::set_vmtarget(mname_oop, vmtarget);
-  sun_dyn_MemberName::set_vmindex(mname_oop,  vmindex);
-  sun_dyn_MemberName::set_flags(mname_oop,    flags);
-  sun_dyn_MemberName::set_clazz(mname_oop,    Klass::cast(m->method_holder())->java_mirror());
+  java_lang_invoke_MemberName::set_vmtarget(mname_oop, vmtarget);
+  java_lang_invoke_MemberName::set_vmindex(mname_oop,  vmindex);
+  java_lang_invoke_MemberName::set_flags(mname_oop,    flags);
+  java_lang_invoke_MemberName::set_clazz(mname_oop,    Klass::cast(m->method_holder())->java_mirror());
 }
 
 void MethodHandles::init_MemberName(oop mname_oop, klassOop field_holder, AccessFlags mods, int offset) {
@@ -416,21 +416,21 @@
   oop vmtarget = field_holder;
   int vmindex  = offset;  // determines the field uniquely when combined with static bit
   assert(vmindex != VM_INDEX_UNINITIALIZED, "bad alias on vmindex");
-  sun_dyn_MemberName::set_vmtarget(mname_oop, vmtarget);
-  sun_dyn_MemberName::set_vmindex(mname_oop,  vmindex);
-  sun_dyn_MemberName::set_flags(mname_oop,    flags);
-  sun_dyn_MemberName::set_clazz(mname_oop,    Klass::cast(field_holder)->java_mirror());
+  java_lang_invoke_MemberName::set_vmtarget(mname_oop, vmtarget);
+  java_lang_invoke_MemberName::set_vmindex(mname_oop,  vmindex);
+  java_lang_invoke_MemberName::set_flags(mname_oop,    flags);
+  java_lang_invoke_MemberName::set_clazz(mname_oop,    Klass::cast(field_holder)->java_mirror());
 }
 
 
 methodOop MethodHandles::decode_MemberName(oop mname, klassOop& receiver_limit_result, int& decode_flags_result) {
-  int flags  = sun_dyn_MemberName::flags(mname);
+  int flags  = java_lang_invoke_MemberName::flags(mname);
   if ((flags & (IS_METHOD | IS_CONSTRUCTOR)) == 0)  return NULL;  // not invocable
-  oop vmtarget = sun_dyn_MemberName::vmtarget(mname);
-  int vmindex  = sun_dyn_MemberName::vmindex(mname);
+  oop vmtarget = java_lang_invoke_MemberName::vmtarget(mname);
+  int vmindex  = java_lang_invoke_MemberName::vmindex(mname);
   if (vmindex == VM_INDEX_UNINITIALIZED)  return NULL; // not resolved
   methodOop m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit_result, decode_flags_result);
-  oop clazz = sun_dyn_MemberName::clazz(mname);
+  oop clazz = java_lang_invoke_MemberName::clazz(mname);
   if (clazz != NULL && java_lang_Class::is_instance(clazz)) {
     klassOop klass = java_lang_Class::as_klassOop(clazz);
     if (klass != NULL)  receiver_limit_result = klass;
@@ -442,8 +442,8 @@
 Symbol* MethodHandles::convert_to_signature(oop type_str,
                                             bool polymorphic,
                                             TRAPS) {
-  if (java_dyn_MethodType::is_instance(type_str)) {
-    return java_dyn_MethodType::as_signature(type_str, polymorphic, CHECK_NULL);
+  if (java_lang_invoke_MethodType::is_instance(type_str)) {
+    return java_lang_invoke_MethodType::as_signature(type_str, polymorphic, CHECK_NULL);
   } else if (java_lang_Class::is_instance(type_str)) {
     return java_lang_Class::as_signature(type_str, false, CHECK_NULL);
   } else if (java_lang_String::is_instance(type_str)) {
@@ -461,7 +461,7 @@
 // Resolving it plants a vmtarget/vmindex in it,
 // which refers dirctly to JVM internals.
 void MethodHandles::resolve_MemberName(Handle mname, TRAPS) {
-  assert(sun_dyn_MemberName::is_instance(mname()), "");
+  assert(java_lang_invoke_MemberName::is_instance(mname()), "");
 #ifdef ASSERT
   // If this assert throws, renegotiate the sentinel value used by the Java code,
   // so that it is distinct from any valid vtable index value, and any special
@@ -472,12 +472,12 @@
   const int sentinel_limit = methodOopDesc::highest_unused_vtable_index_value - sentinel_slop;
   assert(VM_INDEX_UNINITIALIZED < sentinel_limit, "Java sentinel != JVM sentinels");
 #endif
-  if (sun_dyn_MemberName::vmindex(mname()) != VM_INDEX_UNINITIALIZED)
+  if (java_lang_invoke_MemberName::vmindex(mname()) != VM_INDEX_UNINITIALIZED)
     return;  // already resolved
-  oop defc_oop = sun_dyn_MemberName::clazz(mname());
-  oop name_str = sun_dyn_MemberName::name(mname());
-  oop type_str = sun_dyn_MemberName::type(mname());
-  int flags    = sun_dyn_MemberName::flags(mname());
+  oop defc_oop = java_lang_invoke_MemberName::clazz(mname());
+  oop name_str = java_lang_invoke_MemberName::name(mname());
+  oop type_str = java_lang_invoke_MemberName::type(mname());
+  int flags    = java_lang_invoke_MemberName::flags(mname());
 
   if (defc_oop == NULL || name_str == NULL || type_str == NULL) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "nothing to resolve");
@@ -510,7 +510,7 @@
 
   // convert the external string or reflective type to an internal signature
   TempNewSymbol type = convert_to_signature(type_str, polymorphic_signature, CHECK);
-  if (java_dyn_MethodType::is_instance(type_str) && polymorphic_signature) {
+  if (java_lang_invoke_MethodType::is_instance(type_str) && polymorphic_signature) {
     polymorphic_method_type = Handle(THREAD, type_str);  //preserve exactly
   }
 
@@ -557,9 +557,9 @@
         vmtarget = result.resolved_klass()->as_klassOop();
       }
       int mods = (m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS);
-      sun_dyn_MemberName::set_vmtarget(mname(), vmtarget);
-      sun_dyn_MemberName::set_vmindex(mname(),  vmindex);
-      sun_dyn_MemberName::set_modifiers(mname(), mods);
+      java_lang_invoke_MemberName::set_vmtarget(mname(), vmtarget);
+      java_lang_invoke_MemberName::set_vmindex(mname(),  vmindex);
+      java_lang_invoke_MemberName::set_modifiers(mname(), mods);
       DEBUG_ONLY(int junk; klassOop junk2);
       assert(decode_MemberName(mname(), junk2, junk) == result.resolved_method()(),
              "properly stored for later decoding");
@@ -586,9 +586,9 @@
       oop vmtarget = m();
       int vmindex  = methodOopDesc::nonvirtual_vtable_index;
       int mods     = (m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS);
-      sun_dyn_MemberName::set_vmtarget(mname(), vmtarget);
-      sun_dyn_MemberName::set_vmindex(mname(),  vmindex);
-      sun_dyn_MemberName::set_modifiers(mname(), mods);
+      java_lang_invoke_MemberName::set_vmtarget(mname(), vmtarget);
+      java_lang_invoke_MemberName::set_vmindex(mname(),  vmindex);
+      java_lang_invoke_MemberName::set_modifiers(mname(), mods);
       DEBUG_ONLY(int junk; klassOop junk2);
       assert(decode_MemberName(mname(), junk2, junk) == result.resolved_method()(),
              "properly stored for later decoding");
@@ -605,9 +605,9 @@
       int vmindex  = fd.offset();
       int mods     = (fd.access_flags().as_short() & JVM_RECOGNIZED_FIELD_MODIFIERS);
       if (vmindex == VM_INDEX_UNINITIALIZED)  break;  // should not happen
-      sun_dyn_MemberName::set_vmtarget(mname(),  vmtarget);
-      sun_dyn_MemberName::set_vmindex(mname(),   vmindex);
-      sun_dyn_MemberName::set_modifiers(mname(), mods);
+      java_lang_invoke_MemberName::set_vmtarget(mname(),  vmtarget);
+      java_lang_invoke_MemberName::set_vmindex(mname(),   vmindex);
+      java_lang_invoke_MemberName::set_modifiers(mname(), mods);
       return;
     }
   default:
@@ -618,11 +618,11 @@
   if (polymorphic_method_type.not_null()) {
     // Look on a non-null class loader.
     Handle cur_class_loader;
-    const int nptypes = java_dyn_MethodType::ptype_count(polymorphic_method_type());
+    const int nptypes = java_lang_invoke_MethodType::ptype_count(polymorphic_method_type());
     for (int i = 0; i <= nptypes; i++) {
       oop type_mirror;
-      if (i < nptypes)  type_mirror = java_dyn_MethodType::ptype(polymorphic_method_type(), i);
-      else              type_mirror = java_dyn_MethodType::rtype(polymorphic_method_type());
+      if (i < nptypes)  type_mirror = java_lang_invoke_MethodType::ptype(polymorphic_method_type(), i);
+      else              type_mirror = java_lang_invoke_MethodType::rtype(polymorphic_method_type());
       klassOop example_type = java_lang_Class::as_klassOop(type_mirror);
       if (example_type == NULL)  continue;
       oop class_loader = Klass::cast(example_type)->class_loader();
@@ -639,9 +639,9 @@
       }
       if (m != NULL) {
         int mods = (m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS);
-        sun_dyn_MemberName::set_vmtarget(mname(),  m);
-        sun_dyn_MemberName::set_vmindex(mname(),   m->vtable_index());
-        sun_dyn_MemberName::set_modifiers(mname(), mods);
+        java_lang_invoke_MemberName::set_vmtarget(mname(),  m);
+        java_lang_invoke_MemberName::set_vmindex(mname(),   m->vtable_index());
+        java_lang_invoke_MemberName::set_modifiers(mname(), mods);
         return;
       }
     }
@@ -653,17 +653,17 @@
 // Resolving it plants a vmtarget/vmindex in it,
 // which refers directly to JVM internals.
 void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) {
-  assert(sun_dyn_MemberName::is_instance(mname()), "");
-  oop vmtarget = sun_dyn_MemberName::vmtarget(mname());
-  int vmindex  = sun_dyn_MemberName::vmindex(mname());
+  assert(java_lang_invoke_MemberName::is_instance(mname()), "");
+  oop vmtarget = java_lang_invoke_MemberName::vmtarget(mname());
+  int vmindex  = java_lang_invoke_MemberName::vmindex(mname());
   if (vmtarget == NULL || vmindex == VM_INDEX_UNINITIALIZED) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "nothing to expand");
   }
 
-  bool have_defc = (sun_dyn_MemberName::clazz(mname()) != NULL);
-  bool have_name = (sun_dyn_MemberName::name(mname()) != NULL);
-  bool have_type = (sun_dyn_MemberName::type(mname()) != NULL);
-  int flags      = sun_dyn_MemberName::flags(mname());
+  bool have_defc = (java_lang_invoke_MemberName::clazz(mname()) != NULL);
+  bool have_name = (java_lang_invoke_MemberName::name(mname()) != NULL);
+  bool have_type = (java_lang_invoke_MemberName::type(mname()) != NULL);
+  int flags      = java_lang_invoke_MemberName::flags(mname());
 
   if (suppress != 0) {
     if (suppress & _suppress_defc)  have_defc = true;
@@ -687,16 +687,16 @@
         if (receiver_limit != NULL && receiver_limit != defc
             && Klass::cast(receiver_limit)->is_subtype_of(defc))
           defc = receiver_limit;
-        sun_dyn_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror());
+        java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror());
       }
       if (!have_name) {
         //not java_lang_String::create_from_symbol; let's intern member names
         Handle name = StringTable::intern(m->name(), CHECK);
-        sun_dyn_MemberName::set_name(mname(), name());
+        java_lang_invoke_MemberName::set_name(mname(), name());
       }
       if (!have_type) {
         Handle type = java_lang_String::create_from_symbol(m->signature(), CHECK);
-        sun_dyn_MemberName::set_type(mname(), type());
+        java_lang_invoke_MemberName::set_type(mname(), type());
       }
       return;
     }
@@ -711,16 +711,16 @@
       if (!defc->find_field_from_offset(vmindex, is_static, &fd))
         break;                  // cannot expand
       if (!have_defc) {
-        sun_dyn_MemberName::set_clazz(mname(), defc->java_mirror());
+        java_lang_invoke_MemberName::set_clazz(mname(), defc->java_mirror());
       }
       if (!have_name) {
         //not java_lang_String::create_from_symbol; let's intern member names
         Handle name = StringTable::intern(fd.name(), CHECK);
-        sun_dyn_MemberName::set_name(mname(), name());
+        java_lang_invoke_MemberName::set_name(mname(), name());
       }
       if (!have_type) {
         Handle type = java_lang_String::create_from_symbol(fd.signature(), CHECK);
-        sun_dyn_MemberName::set_type(mname(), type());
+        java_lang_invoke_MemberName::set_type(mname(), type());
       }
       return;
     }
@@ -775,7 +775,7 @@
         --rskip;
       } else if (rfill < rlimit) {
         oop result = results->obj_at(rfill++);
-        if (!sun_dyn_MemberName::is_instance(result))
+        if (!java_lang_invoke_MemberName::is_instance(result))
           return -99;  // caller bug!
         MethodHandles::init_MemberName(result, st.klass()->as_klassOop(), st.access_flags(), st.offset());
       } else if (++overflow >= overflow_limit) {
@@ -823,7 +823,7 @@
         --rskip;
       } else if (rfill < rlimit) {
         oop result = results->obj_at(rfill++);
-        if (!sun_dyn_MemberName::is_instance(result))
+        if (!java_lang_invoke_MemberName::is_instance(result))
           return -99;  // caller bug!
         MethodHandles::init_MemberName(result, m, true);
       } else if (++overflow >= overflow_limit) {
@@ -857,9 +857,9 @@
 // Sanitize out methodOops, klassOops, and any other non-Java data.
 // This is for debugging and reflection.
 oop MethodHandles::encode_target(Handle mh, int format, TRAPS) {
-  assert(java_dyn_MethodHandle::is_instance(mh()), "must be a MH");
+  assert(java_lang_invoke_MethodHandle::is_instance(mh()), "must be a MH");
   if (format == ETF_HANDLE_OR_METHOD_NAME) {
-    oop target = java_dyn_MethodHandle::vmtarget(mh());
+    oop target = java_lang_invoke_MethodHandle::vmtarget(mh());
     if (target == NULL) {
       return NULL;                // unformed MH
     }
@@ -874,10 +874,10 @@
       if (target->klass() == SystemDictionary::DirectMethodHandle_klass()) {
         return target;
       }
-      if (!java_dyn_MethodHandle::is_instance(target)){
+      if (!java_lang_invoke_MethodHandle::is_instance(target)){
         return NULL;                // unformed MH
       }
-      target = java_dyn_MethodHandle::vmtarget(target);
+      target = java_lang_invoke_MethodHandle::vmtarget(target);
     }
   }
   // cases of metadata in MH.vmtarget:
@@ -904,7 +904,7 @@
       instanceKlassHandle mname_klass(THREAD, SystemDictionary::MemberName_klass());
       mname_klass->initialize(CHECK_NULL);
       Handle mname = mname_klass->allocate_instance_handle(CHECK_NULL);
-      sun_dyn_MemberName::set_vmindex(mname(), VM_INDEX_UNINITIALIZED);
+      java_lang_invoke_MemberName::set_vmindex(mname(), VM_INDEX_UNINITIALIZED);
       bool do_dispatch = ((decode_flags & MethodHandles::_dmf_does_dispatch) != 0);
       init_MemberName(mname(), m, do_dispatch);
       expand_MemberName(mname, 0, CHECK_NULL);
@@ -923,6 +923,7 @@
   "java/lang/Null",
   //"java/lang/Nothing",
   "sun/dyn/empty/Empty",
+  "sun/invoke/empty/Empty",
   NULL
 };
 
@@ -1025,7 +1026,7 @@
                                             int first_ptype_pos,
                                             KlassHandle insert_ptype,
                                             TRAPS) {
-  objArrayHandle ptypes(THREAD, java_dyn_MethodType::ptypes(mtype()));
+  objArrayHandle ptypes(THREAD, java_lang_invoke_MethodType::ptypes(mtype()));
   int pnum = first_ptype_pos;
   int pmax = ptypes->length();
   int mnum = 0;                 // method argument
@@ -1036,7 +1037,7 @@
     if (ss.at_return_type()) {
       if (pnum != pmax)
         { err = "too many arguments"; break; }
-      ptype_oop = java_dyn_MethodType::rtype(mtype());
+      ptype_oop = java_lang_invoke_MethodType::rtype(mtype());
     } else {
       if (pnum >= pmax)
         { err = "not enough arguments"; break; }
@@ -1111,7 +1112,7 @@
   }
 
   if (m_needs_receiver && err == NULL) {
-    objArrayOop ptypes = java_dyn_MethodType::ptypes(mtype());
+    objArrayOop ptypes = java_lang_invoke_MethodType::ptypes(mtype());
     if (ptypes->length() < first_ptype_pos)
       { err = "receiver argument is missing"; goto die; }
     if (has_bound_recv)
@@ -1131,15 +1132,15 @@
 
 void MethodHandles::verify_vmslots(Handle mh, TRAPS) {
   // Verify vmslots.
-  int check_slots = argument_slot_count(java_dyn_MethodHandle::type(mh()));
-  if (java_dyn_MethodHandle::vmslots(mh()) != check_slots) {
+  int check_slots = argument_slot_count(java_lang_invoke_MethodHandle::type(mh()));
+  if (java_lang_invoke_MethodHandle::vmslots(mh()) != check_slots) {
     THROW_MSG(vmSymbols::java_lang_InternalError(), "bad vmslots in BMH");
   }
 }
 
 void MethodHandles::verify_vmargslot(Handle mh, int argnum, int argslot, TRAPS) {
   // Verify that argslot points at the given argnum.
-  int check_slot = argument_slot(java_dyn_MethodHandle::type(mh()), argnum);
+  int check_slot = argument_slot(java_lang_invoke_MethodHandle::type(mh()), argnum);
   if (argslot != check_slot || argslot < 0) {
     const char* fmt = "for argnum of %d, vmargslot is %d, should be %d";
     size_t msglen = strlen(fmt) + 3*11 + 1;
@@ -1160,8 +1161,8 @@
                                                     int delete_argnum,
                                                     oop dst_mtype, int dst_beg, int dst_end,
                                                     bool raw) {
-  objArrayOop src_ptypes = java_dyn_MethodType::ptypes(src_mtype);
-  objArrayOop dst_ptypes = java_dyn_MethodType::ptypes(dst_mtype);
+  objArrayOop src_ptypes = java_lang_invoke_MethodType::ptypes(src_mtype);
+  objArrayOop dst_ptypes = java_lang_invoke_MethodType::ptypes(dst_mtype);
 
   int src_max = src_ptypes->length();
   int dst_max = dst_ptypes->length();
@@ -1224,8 +1225,8 @@
   }
 
   // Now compare return types also.
-  oop src_rtype = java_dyn_MethodType::rtype(src_mtype);
-  oop dst_rtype = java_dyn_MethodType::rtype(dst_mtype);
+  oop src_rtype = java_lang_invoke_MethodType::rtype(src_mtype);
+  oop dst_rtype = java_lang_invoke_MethodType::rtype(dst_mtype);
   if (src_rtype != dst_rtype) {
     err = check_return_type_change(dst_rtype, src_rtype, raw); // note reversal!
     if (err != NULL)  return err;
@@ -1314,7 +1315,7 @@
 // then return a negative number.  Otherwise, the result
 // is in the range [0..vmslots] inclusive.
 int MethodHandles::argument_slot(oop method_type, int arg) {
-  objArrayOop ptypes = java_dyn_MethodType::ptypes(method_type);
+  objArrayOop ptypes = java_lang_invoke_MethodType::ptypes(method_type);
   int argslot = 0;
   int len = ptypes->length();
   if (arg < -1 || arg >= len)  return -99;
@@ -1328,7 +1329,7 @@
 
 // Given a slot number, return the argument number.
 int MethodHandles::argument_slot_to_argnum(oop method_type, int query_argslot) {
-  objArrayOop ptypes = java_dyn_MethodType::ptypes(method_type);
+  objArrayOop ptypes = java_lang_invoke_MethodType::ptypes(method_type);
   int argslot = 0;
   int len = ptypes->length();
   for (int i = len-1; i >= 0; i--) {
@@ -1394,11 +1395,11 @@
 
 void MethodHandles::verify_DirectMethodHandle(Handle mh, methodHandle m, TRAPS) {
   // Verify type.
-  Handle mtype(THREAD, java_dyn_MethodHandle::type(mh()));
+  Handle mtype(THREAD, java_lang_invoke_MethodHandle::type(mh()));
   verify_method_type(m, mtype, false, KlassHandle(), CHECK);
 
   // Verify vmslots.
-  if (java_dyn_MethodHandle::vmslots(mh()) != m->size_of_parameters()) {
+  if (java_lang_invoke_MethodHandle::vmslots(mh()) != m->size_of_parameters()) {
     THROW_MSG(vmSymbols::java_lang_InternalError(), "bad vmslots in DMH");
   }
 }
@@ -1410,7 +1411,7 @@
     THROW(vmSymbols::java_lang_InternalError());
   }
 
-  java_dyn_MethodHandle::init_vmslots(mh());
+  java_lang_invoke_MethodHandle::init_vmslots(mh());
 
   if (VerifyMethodHandles) {
     // The privileged code which invokes this routine should not make
@@ -1470,8 +1471,8 @@
 
   if (me == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
 
-  sun_dyn_DirectMethodHandle::set_vmtarget(mh(), vmtarget);
-  sun_dyn_DirectMethodHandle::set_vmindex(mh(),  vmindex);
+  java_lang_invoke_DirectMethodHandle::set_vmtarget(mh(), vmtarget);
+  java_lang_invoke_DirectMethodHandle::set_vmindex(mh(),  vmindex);
   DEBUG_ONLY(int flags; klassOop rlimit);
   assert(MethodHandles::decode_method(mh(), rlimit, flags) == m(),
          "properly stored for later decoding");
@@ -1482,15 +1483,15 @@
   assert(decode_MethodHandle_stack_pushes(mh()) == 0, "DMH does not move stack");
 
   // Done!
-  java_dyn_MethodHandle::set_vmentry(mh(), me);
+  java_lang_invoke_MethodHandle::set_vmentry(mh(), me);
 }
 
 void MethodHandles::verify_BoundMethodHandle_with_receiver(Handle mh,
                                                            methodHandle m,
                                                            TRAPS) {
   // Verify type.
-  oop receiver = sun_dyn_BoundMethodHandle::argument(mh());
-  Handle mtype(THREAD, java_dyn_MethodHandle::type(mh()));
+  oop receiver = java_lang_invoke_BoundMethodHandle::argument(mh());
+  Handle mtype(THREAD, java_lang_invoke_MethodHandle::type(mh()));
   KlassHandle bound_recv_type;
   if (receiver != NULL)  bound_recv_type = KlassHandle(THREAD, receiver->klass());
   verify_method_type(m, mtype, true, bound_recv_type, CHECK);
@@ -1498,11 +1499,11 @@
   int receiver_pos = m->size_of_parameters() - 1;
 
   // Verify MH.vmargslot, which should point at the bound receiver.
-  verify_vmargslot(mh, -1, sun_dyn_BoundMethodHandle::vmargslot(mh()), CHECK);
+  verify_vmargslot(mh, -1, java_lang_invoke_BoundMethodHandle::vmargslot(mh()), CHECK);
   //verify_vmslots(mh, CHECK);
 
   // Verify vmslots.
-  if (java_dyn_MethodHandle::vmslots(mh()) != receiver_pos) {
+  if (java_lang_invoke_MethodHandle::vmslots(mh()) != receiver_pos) {
     THROW_MSG(vmSymbols::java_lang_InternalError(), "bad vmslots in BMH (receiver)");
   }
 }
@@ -1520,7 +1521,7 @@
 
   KlassHandle receiver_klass;
   {
-    oop receiver_oop = sun_dyn_BoundMethodHandle::argument(mh());
+    oop receiver_oop = java_lang_invoke_BoundMethodHandle::argument(mh());
     if (receiver_oop != NULL)
       receiver_klass = KlassHandle(THREAD, receiver_oop->klass());
   }
@@ -1531,31 +1532,31 @@
   if (m.is_null())      { THROW(vmSymbols::java_lang_InternalError()); }
   if (m->is_abstract()) { THROW(vmSymbols::java_lang_AbstractMethodError()); }
 
-  java_dyn_MethodHandle::init_vmslots(mh());
+  java_lang_invoke_MethodHandle::init_vmslots(mh());
 
   if (VerifyMethodHandles) {
     verify_BoundMethodHandle_with_receiver(mh, m, CHECK);
   }
 
-  sun_dyn_BoundMethodHandle::set_vmtarget(mh(), m());
+  java_lang_invoke_BoundMethodHandle::set_vmtarget(mh(), m());
 
   DEBUG_ONLY(int junk; klassOop junk2);
   assert(MethodHandles::decode_method(mh(), junk2, junk) == m(), "properly stored for later decoding");
   assert(decode_MethodHandle_stack_pushes(mh()) == 1, "BMH pushes one stack slot");
 
   // Done!
-  java_dyn_MethodHandle::set_vmentry(mh(), MethodHandles::entry(MethodHandles::_bound_ref_direct_mh));
+  java_lang_invoke_MethodHandle::set_vmentry(mh(), MethodHandles::entry(MethodHandles::_bound_ref_direct_mh));
 }
 
 void MethodHandles::verify_BoundMethodHandle(Handle mh, Handle target, int argnum,
                                              bool direct_to_method, TRAPS) {
   Handle ptype_handle(THREAD,
-                           java_dyn_MethodType::ptype(java_dyn_MethodHandle::type(target()), argnum));
+                           java_lang_invoke_MethodType::ptype(java_lang_invoke_MethodHandle::type(target()), argnum));
   KlassHandle ptype_klass;
   BasicType ptype = java_lang_Class::as_BasicType(ptype_handle(), &ptype_klass);
   int slots_pushed = type2size[ptype];
 
-  oop argument = sun_dyn_BoundMethodHandle::argument(mh());
+  oop argument = java_lang_invoke_BoundMethodHandle::argument(mh());
 
   const char* err = NULL;
 
@@ -1623,9 +1624,9 @@
 
   if (err == NULL) {
     // Verify the rest of the method type.
-    err = check_method_type_insertion(java_dyn_MethodHandle::type(mh()),
+    err = check_method_type_insertion(java_lang_invoke_MethodHandle::type(mh()),
                                       argnum, ptype_handle(),
-                                      java_dyn_MethodHandle::type(target()));
+                                      java_lang_invoke_MethodHandle::type(target()));
   }
 
   if (err != NULL) {
@@ -1635,20 +1636,20 @@
 
 void MethodHandles::init_BoundMethodHandle(Handle mh, Handle target, int argnum, TRAPS) {
   // Check arguments.
-  if (mh.is_null() || target.is_null() || !java_dyn_MethodHandle::is_instance(target())) {
+  if (mh.is_null() || target.is_null() || !java_lang_invoke_MethodHandle::is_instance(target())) {
     THROW(vmSymbols::java_lang_InternalError());
   }
 
-  java_dyn_MethodHandle::init_vmslots(mh());
+  java_lang_invoke_MethodHandle::init_vmslots(mh());
 
   if (VerifyMethodHandles) {
     int insert_after = argnum - 1;
-    verify_vmargslot(mh, insert_after, sun_dyn_BoundMethodHandle::vmargslot(mh()), CHECK);
+    verify_vmargslot(mh, insert_after, java_lang_invoke_BoundMethodHandle::vmargslot(mh()), CHECK);
     verify_vmslots(mh, CHECK);
   }
 
   // Get bound type and required slots.
-  oop ptype_oop = java_dyn_MethodType::ptype(java_dyn_MethodHandle::type(target()), argnum);
+  oop ptype_oop = java_lang_invoke_MethodType::ptype(java_lang_invoke_MethodHandle::type(target()), argnum);
   BasicType ptype = java_lang_Class::as_BasicType(ptype_oop);
   int slots_pushed = type2size[ptype];
 
@@ -1659,12 +1660,12 @@
   bool direct_to_method = false;
   if (OptimizeMethodHandles &&
       target->klass() == SystemDictionary::DirectMethodHandle_klass() &&
-      (argnum == 0 || sun_dyn_DirectMethodHandle::vmindex(target()) < 0)) {
+      (argnum == 0 || java_lang_invoke_DirectMethodHandle::vmindex(target()) < 0)) {
     int decode_flags = 0; klassOop receiver_limit_oop = NULL;
     methodHandle m(THREAD, decode_method(target(), receiver_limit_oop, decode_flags));
     if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "DMH failed to decode"); }
     DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - slots_pushed); // pos. of 1st arg.
-    assert(sun_dyn_BoundMethodHandle::vmslots(mh()) == m_vmslots, "type w/ m sig");
+    assert(java_lang_invoke_BoundMethodHandle::vmslots(mh()) == m_vmslots, "type w/ m sig");
     if (argnum == 0 && (decode_flags & _dmf_has_receiver) != 0) {
       KlassHandle receiver_limit(THREAD, receiver_limit_oop);
       init_BoundMethodHandle_with_receiver(mh, m,
@@ -1677,11 +1678,11 @@
     // to bind another argument and still invoke the methodOop directly.
     if (!(decode_flags & _dmf_does_dispatch)) {
       direct_to_method = true;
-      sun_dyn_BoundMethodHandle::set_vmtarget(mh(), m());
+      java_lang_invoke_BoundMethodHandle::set_vmtarget(mh(), m());
     }
   }
   if (!direct_to_method)
-    sun_dyn_BoundMethodHandle::set_vmtarget(mh(), target());
+    java_lang_invoke_BoundMethodHandle::set_vmtarget(mh(), target());
 
   if (VerifyMethodHandles) {
     verify_BoundMethodHandle(mh, target, argnum, direct_to_method, CHECK);
@@ -1703,7 +1704,7 @@
   }
 
   // Done!
-  java_dyn_MethodHandle::set_vmentry(mh(), me);
+  java_lang_invoke_MethodHandle::set_vmentry(mh(), me);
 }
 
 static void throw_InternalError_for_bad_conversion(int conversion, const char* err, TRAPS) {
@@ -1713,8 +1714,8 @@
 }
 
 void MethodHandles::verify_AdapterMethodHandle(Handle mh, int argnum, TRAPS) {
-  jint conversion = sun_dyn_AdapterMethodHandle::conversion(mh());
-  int  argslot    = sun_dyn_AdapterMethodHandle::vmargslot(mh());
+  jint conversion = java_lang_invoke_AdapterMethodHandle::conversion(mh());
+  int  argslot    = java_lang_invoke_AdapterMethodHandle::vmargslot(mh());
 
   verify_vmargslot(mh, argnum, argslot, CHECK);
   verify_vmslots(mh, CHECK);
@@ -1731,10 +1732,10 @@
   BasicType dest = adapter_conversion_dest_type(conversion);
   int vminfo     = adapter_conversion_vminfo(conversion); // should be zero
 
-  Handle argument(THREAD,  sun_dyn_AdapterMethodHandle::argument(mh()));
-  Handle target(THREAD,    sun_dyn_AdapterMethodHandle::vmtarget(mh()));
-  Handle src_mtype(THREAD, java_dyn_MethodHandle::type(mh()));
-  Handle dst_mtype(THREAD, java_dyn_MethodHandle::type(target()));
+  Handle argument(THREAD,  java_lang_invoke_AdapterMethodHandle::argument(mh()));
+  Handle target(THREAD,    java_lang_invoke_AdapterMethodHandle::vmtarget(mh()));
+  Handle src_mtype(THREAD, java_lang_invoke_MethodHandle::type(mh()));
+  Handle dst_mtype(THREAD, java_lang_invoke_MethodHandle::type(target()));
 
   const char* err = NULL;
 
@@ -1760,7 +1761,7 @@
       break;
     case _adapter_flyby:
     case _adapter_ricochet:
-      if (!java_dyn_MethodHandle::is_instance(argument()))
+      if (!java_lang_invoke_MethodHandle::is_instance(argument()))
         { err = "MethodHandle adapter argument required"; break; }
       break;
     default:
@@ -1806,9 +1807,9 @@
           err = "adapter requires src/dest conversion subfields for swap"; break;
         }
         int swap_size = type2size[src];
-        oop src_mtype  = sun_dyn_AdapterMethodHandle::type(mh());
-        oop dest_mtype = sun_dyn_AdapterMethodHandle::type(target());
-        int slot_limit = sun_dyn_AdapterMethodHandle::vmslots(target());
+        oop src_mtype  = java_lang_invoke_AdapterMethodHandle::type(mh());
+        oop dest_mtype = java_lang_invoke_AdapterMethodHandle::type(target());
+        int slot_limit = java_lang_invoke_AdapterMethodHandle::vmslots(target());
         int src_slot   = argslot;
         int dest_slot  = vminfo;
         bool rotate_up = (src_slot > dest_slot); // upward rotation
@@ -1821,8 +1822,8 @@
         } else if (ek == _adapter_swap_args && !(src_slot > dest_slot)) {
           err = "source of swap must be deeper in stack";
         } else if (ek == _adapter_swap_args) {
-          err = check_argument_type_change(java_dyn_MethodType::ptype(src_mtype, dest_arg),
-                                           java_dyn_MethodType::ptype(dest_mtype, src_arg),
+          err = check_argument_type_change(java_lang_invoke_MethodType::ptype(src_mtype, dest_arg),
+                                           java_lang_invoke_MethodType::ptype(dest_mtype, src_arg),
                                            dest_arg);
         } else if (ek == _adapter_rot_args) {
           if (rotate_up) {
@@ -1830,8 +1831,8 @@
             // rotate up: [dest_slot..src_slot-ss] --> [dest_slot+ss..src_slot]
             // that is:   [src_arg+1..dest_arg] --> [src_arg..dest_arg-1]
             for (int i = src_arg+1; i <= dest_arg && err == NULL; i++) {
-              err = check_argument_type_change(java_dyn_MethodType::ptype(src_mtype, i),
-                                               java_dyn_MethodType::ptype(dest_mtype, i-1),
+              err = check_argument_type_change(java_lang_invoke_MethodType::ptype(src_mtype, i),
+                                               java_lang_invoke_MethodType::ptype(dest_mtype, i-1),
                                                i);
             }
           } else { // rotate down
@@ -1839,15 +1840,15 @@
             // rotate down: [src_slot+ss..dest_slot] --> [src_slot..dest_slot-ss]
             // that is:     [dest_arg..src_arg-1] --> [dst_arg+1..src_arg]
             for (int i = dest_arg; i <= src_arg-1 && err == NULL; i++) {
-              err = check_argument_type_change(java_dyn_MethodType::ptype(src_mtype, i),
-                                               java_dyn_MethodType::ptype(dest_mtype, i+1),
+              err = check_argument_type_change(java_lang_invoke_MethodType::ptype(src_mtype, i),
+                                               java_lang_invoke_MethodType::ptype(dest_mtype, i+1),
                                                i);
             }
           }
         }
         if (err == NULL)
-          err = check_argument_type_change(java_dyn_MethodType::ptype(src_mtype, src_arg),
-                                           java_dyn_MethodType::ptype(dest_mtype, dest_arg),
+          err = check_argument_type_change(java_lang_invoke_MethodType::ptype(src_mtype, src_arg),
+                                           java_lang_invoke_MethodType::ptype(dest_mtype, dest_arg),
                                            src_arg);
       }
       break;
@@ -1918,8 +1919,8 @@
   if (err == NULL) {
     // Make sure this adapter does not push too deeply.
     int slots_pushed = stack_move / stack_move_unit();
-    int this_vmslots = java_dyn_MethodHandle::vmslots(mh());
-    int target_vmslots = java_dyn_MethodHandle::vmslots(target());
+    int this_vmslots = java_lang_invoke_MethodHandle::vmslots(mh());
+    int target_vmslots = java_lang_invoke_MethodHandle::vmslots(target());
     if (slots_pushed != (target_vmslots - this_vmslots)) {
       err = "stack_move inconsistent with previous and current MethodType vmslots";
     } else if (slots_pushed > 0)  {
@@ -1961,7 +1962,7 @@
     case _adapter_check_cast:
       {
         // The actual value being checked must be a reference:
-        err = check_argument_type_change(java_dyn_MethodType::ptype(src_mtype(), argnum),
+        err = check_argument_type_change(java_lang_invoke_MethodType::ptype(src_mtype(), argnum),
                                          object_java_mirror(), argnum);
         if (err != NULL)  break;
 
@@ -1985,9 +1986,9 @@
 }
 
 void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnum, TRAPS) {
-  oop  argument   = sun_dyn_AdapterMethodHandle::argument(mh());
-  int  argslot    = sun_dyn_AdapterMethodHandle::vmargslot(mh());
-  jint conversion = sun_dyn_AdapterMethodHandle::conversion(mh());
+  oop  argument   = java_lang_invoke_AdapterMethodHandle::argument(mh());
+  int  argslot    = java_lang_invoke_AdapterMethodHandle::vmargslot(mh());
+  jint conversion = java_lang_invoke_AdapterMethodHandle::conversion(mh());
   jint conv_op    = adapter_conversion_op(conversion);
 
   // adjust the adapter code to the internal EntryKind enumeration:
@@ -1995,11 +1996,11 @@
   EntryKind ek_opt  = ek_orig;  // may be optimized
 
   // Finalize the vmtarget field (Java initialized it to null).
-  if (!java_dyn_MethodHandle::is_instance(target())) {
+  if (!java_lang_invoke_MethodHandle::is_instance(target())) {
     throw_InternalError_for_bad_conversion(conversion, "bad target", THREAD);
     return;
   }
-  sun_dyn_AdapterMethodHandle::set_vmtarget(mh(), target());
+  java_lang_invoke_AdapterMethodHandle::set_vmtarget(mh(), target());
 
   if (VerifyMethodHandles) {
     verify_AdapterMethodHandle(mh, argnum, CHECK);
@@ -2083,7 +2084,7 @@
   case _adapter_rot_args:
     {
       int swap_slots = type2size[src];
-      int slot_limit = sun_dyn_AdapterMethodHandle::vmslots(mh());
+      int slot_limit = java_lang_invoke_AdapterMethodHandle::vmslots(mh());
       int src_slot   = argslot;
       int dest_slot  = vminfo;
       int rotate     = (ek_orig == _adapter_swap_args) ? 0 : (src_slot > dest_slot) ? 1 : -1;
@@ -2147,10 +2148,10 @@
   jint new_conversion = adapter_conversion(conv_op, src, dest, stack_move, vminfo);
 
   // Finalize the conversion field.  (Note that it is final to Java code.)
-  sun_dyn_AdapterMethodHandle::set_conversion(mh(), new_conversion);
+  java_lang_invoke_AdapterMethodHandle::set_conversion(mh(), new_conversion);
 
   // Done!
-  java_dyn_MethodHandle::set_vmentry(mh(), entry(ek_opt));
+  java_lang_invoke_MethodHandle::set_vmentry(mh(), entry(ek_opt));
 
   // There should be enough memory barriers on exit from native methods
   // to ensure that the MH is fully initialized to all threads before
@@ -2158,7 +2159,7 @@
 }
 
 //
-// Here are the native methods on sun.dyn.MethodHandleImpl.
+// Here are the native methods on sun.invoke.MethodHandleImpl.
 // They are the private interface between this JVM and the HotSpot-specific
 // Java code that implements JSR 292 method handles.
 //
@@ -2168,7 +2169,7 @@
 
 // direct method handles for invokestatic or invokespecial
 // void init(DirectMethodHandle self, MemberName ref, boolean doDispatch, Class<?> caller);
-JVM_ENTRY(void, MHI_init_DMH(JNIEnv *env, jobject igcls, jobject mh_jh,
+JVM_ENTRY(void, MHN_init_DMH(JNIEnv *env, jobject igcls, jobject mh_jh,
                              jobject target_jh, jboolean do_dispatch, jobject caller_jh)) {
   ResourceMark rm;              // for error messages
 
@@ -2177,13 +2178,13 @@
   Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh));
 
   // Early returns out of this method leave the DMH in an unfinished state.
-  assert(java_dyn_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
+  assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
 
   // which method are we really talking about?
   if (target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
   oop target_oop = JNIHandles::resolve_non_null(target_jh);
-  if (sun_dyn_MemberName::is_instance(target_oop) &&
-      sun_dyn_MemberName::vmindex(target_oop) == VM_INDEX_UNINITIALIZED) {
+  if (java_lang_invoke_MemberName::is_instance(target_oop) &&
+      java_lang_invoke_MemberName::vmindex(target_oop) == VM_INDEX_UNINITIALIZED) {
     Handle mname(THREAD, target_oop);
     MethodHandles::resolve_MemberName(mname, CHECK);
     target_oop = mname(); // in case of GC
@@ -2232,7 +2233,7 @@
 JVM_END
 
 // bound method handles
-JVM_ENTRY(void, MHI_init_BMH(JNIEnv *env, jobject igcls, jobject mh_jh,
+JVM_ENTRY(void, MHN_init_BMH(JNIEnv *env, jobject igcls, jobject mh_jh,
                              jobject target_jh, int argnum)) {
   ResourceMark rm;              // for error messages
 
@@ -2241,12 +2242,12 @@
   Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh));
 
   // Early returns out of this method leave the BMH in an unfinished state.
-  assert(java_dyn_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
+  assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
 
   if (target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
   Handle target(THREAD, JNIHandles::resolve_non_null(target_jh));
 
-  if (!java_dyn_MethodHandle::is_instance(target())) {
+  if (!java_lang_invoke_MethodHandle::is_instance(target())) {
     // Target object is a reflective method.  (%%% Do we need this alternate path?)
     Untested("init_BMH of non-MH");
     if (argnum != 0) { THROW(vmSymbols::java_lang_InternalError()); }
@@ -2269,7 +2270,7 @@
 JVM_END
 
 // adapter method handles
-JVM_ENTRY(void, MHI_init_AMH(JNIEnv *env, jobject igcls, jobject mh_jh,
+JVM_ENTRY(void, MHN_init_AMH(JNIEnv *env, jobject igcls, jobject mh_jh,
                              jobject target_jh, int argnum)) {
   // This is the guy we are initializing:
   if (mh_jh == NULL || target_jh == NULL) {
@@ -2279,14 +2280,14 @@
   Handle target(THREAD, JNIHandles::resolve_non_null(target_jh));
 
   // Early returns out of this method leave the AMH in an unfinished state.
-  assert(java_dyn_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
+  assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
 
   MethodHandles::init_AdapterMethodHandle(mh, target, argnum, CHECK);
 }
 JVM_END
 
 // method type forms
-JVM_ENTRY(void, MHI_init_MT(JNIEnv *env, jobject igcls, jobject erased_jh)) {
+JVM_ENTRY(void, MHN_init_MT(JNIEnv *env, jobject igcls, jobject erased_jh)) {
   if (erased_jh == NULL)  return;
   if (TraceMethodHandles) {
     tty->print("creating MethodType form ");
@@ -2307,9 +2308,9 @@
 JVM_END
 
 // debugging and reflection
-JVM_ENTRY(jobject, MHI_getTarget(JNIEnv *env, jobject igcls, jobject mh_jh, jint format)) {
+JVM_ENTRY(jobject, MHN_getTarget(JNIEnv *env, jobject igcls, jobject mh_jh, jint format)) {
   Handle mh(THREAD, JNIHandles::resolve(mh_jh));
-  if (!java_dyn_MethodHandle::is_instance(mh())) {
+  if (!java_lang_invoke_MethodHandle::is_instance(mh())) {
     THROW_NULL(vmSymbols::java_lang_IllegalArgumentException());
   }
   oop target = MethodHandles::encode_target(mh, format, CHECK_NULL);
@@ -2317,7 +2318,7 @@
 }
 JVM_END
 
-JVM_ENTRY(jint, MHI_getConstant(JNIEnv *env, jobject igcls, jint which)) {
+JVM_ENTRY(jint, MHN_getConstant(JNIEnv *env, jobject igcls, jint which)) {
   switch (which) {
   case MethodHandles::GC_JVM_PUSH_LIMIT:
     guarantee(MethodHandlePushLimit >= 2 && MethodHandlePushLimit <= 0xFF,
@@ -2341,36 +2342,36 @@
     template(MethodHandles,ETF_DIRECT_HANDLE) \
     template(MethodHandles,ETF_METHOD_NAME) \
     template(MethodHandles,ETF_REFLECT_METHOD) \
-    template(sun_dyn_MemberName,MN_IS_METHOD) \
-    template(sun_dyn_MemberName,MN_IS_CONSTRUCTOR) \
-    template(sun_dyn_MemberName,MN_IS_FIELD) \
-    template(sun_dyn_MemberName,MN_IS_TYPE) \
-    template(sun_dyn_MemberName,MN_SEARCH_SUPERCLASSES) \
-    template(sun_dyn_MemberName,MN_SEARCH_INTERFACES) \
-    template(sun_dyn_MemberName,VM_INDEX_UNINITIALIZED) \
-    template(sun_dyn_AdapterMethodHandle,OP_RETYPE_ONLY) \
-    template(sun_dyn_AdapterMethodHandle,OP_RETYPE_RAW) \
-    template(sun_dyn_AdapterMethodHandle,OP_CHECK_CAST) \
-    template(sun_dyn_AdapterMethodHandle,OP_PRIM_TO_PRIM) \
-    template(sun_dyn_AdapterMethodHandle,OP_REF_TO_PRIM) \
-    template(sun_dyn_AdapterMethodHandle,OP_PRIM_TO_REF) \
-    template(sun_dyn_AdapterMethodHandle,OP_SWAP_ARGS) \
-    template(sun_dyn_AdapterMethodHandle,OP_ROT_ARGS) \
-    template(sun_dyn_AdapterMethodHandle,OP_DUP_ARGS) \
-    template(sun_dyn_AdapterMethodHandle,OP_DROP_ARGS) \
-    template(sun_dyn_AdapterMethodHandle,OP_COLLECT_ARGS) \
-    template(sun_dyn_AdapterMethodHandle,OP_SPREAD_ARGS) \
-    template(sun_dyn_AdapterMethodHandle,OP_FLYBY) \
-    template(sun_dyn_AdapterMethodHandle,OP_RICOCHET) \
-    template(sun_dyn_AdapterMethodHandle,CONV_OP_LIMIT) \
-    template(sun_dyn_AdapterMethodHandle,CONV_OP_MASK) \
-    template(sun_dyn_AdapterMethodHandle,CONV_VMINFO_MASK) \
-    template(sun_dyn_AdapterMethodHandle,CONV_VMINFO_SHIFT) \
-    template(sun_dyn_AdapterMethodHandle,CONV_OP_SHIFT) \
-    template(sun_dyn_AdapterMethodHandle,CONV_DEST_TYPE_SHIFT) \
-    template(sun_dyn_AdapterMethodHandle,CONV_SRC_TYPE_SHIFT) \
-    template(sun_dyn_AdapterMethodHandle,CONV_STACK_MOVE_SHIFT) \
-    template(sun_dyn_AdapterMethodHandle,CONV_STACK_MOVE_MASK) \
+    template(java_lang_invoke_MemberName,MN_IS_METHOD) \
+    template(java_lang_invoke_MemberName,MN_IS_CONSTRUCTOR) \
+    template(java_lang_invoke_MemberName,MN_IS_FIELD) \
+    template(java_lang_invoke_MemberName,MN_IS_TYPE) \
+    template(java_lang_invoke_MemberName,MN_SEARCH_SUPERCLASSES) \
+    template(java_lang_invoke_MemberName,MN_SEARCH_INTERFACES) \
+    template(java_lang_invoke_MemberName,VM_INDEX_UNINITIALIZED) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_RETYPE_ONLY) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_RETYPE_RAW) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_CHECK_CAST) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_PRIM_TO_PRIM) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_REF_TO_PRIM) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_PRIM_TO_REF) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_SWAP_ARGS) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_ROT_ARGS) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_DUP_ARGS) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_DROP_ARGS) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_COLLECT_ARGS) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_SPREAD_ARGS) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_FLYBY) \
+    template(java_lang_invoke_AdapterMethodHandle,OP_RICOCHET) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_OP_LIMIT) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_OP_MASK) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_VMINFO_MASK) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_VMINFO_SHIFT) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_OP_SHIFT) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_DEST_TYPE_SHIFT) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_SRC_TYPE_SHIFT) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_STACK_MOVE_SHIFT) \
+    template(java_lang_invoke_AdapterMethodHandle,CONV_STACK_MOVE_MASK) \
     /*end*/
 
 #define ONE_PLUS(scope,value) 1+
@@ -2386,7 +2387,7 @@
 #undef EACH_NAMED_CON
 #endif
 
-JVM_ENTRY(jint, MHI_getNamedCon(JNIEnv *env, jobject igcls, jint which, jobjectArray box_jh)) {
+JVM_ENTRY(jint, MHN_getNamedCon(JNIEnv *env, jobject igcls, jint which, jobjectArray box_jh)) {
 #ifndef PRODUCT
   if (which >= 0 && which < con_value_count) {
     int con = con_values[which];
@@ -2406,7 +2407,7 @@
 JVM_END
 
 // void init(MemberName self, AccessibleObject ref)
-JVM_ENTRY(void, MHI_init_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jobject target_jh)) {
+JVM_ENTRY(void, MHN_init_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jobject target_jh)) {
   if (mname_jh == NULL || target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
   Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh));
   oop target_oop = JNIHandles::resolve_non_null(target_jh);
@@ -2415,7 +2416,7 @@
 JVM_END
 
 // void expand(MemberName self)
-JVM_ENTRY(void, MHI_expand_Mem(JNIEnv *env, jobject igcls, jobject mname_jh)) {
+JVM_ENTRY(void, MHN_expand_Mem(JNIEnv *env, jobject igcls, jobject mname_jh)) {
   if (mname_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
   Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh));
   MethodHandles::expand_MemberName(mname, 0, CHECK);
@@ -2423,14 +2424,14 @@
 JVM_END
 
 // void resolve(MemberName self, Class<?> caller)
-JVM_ENTRY(void, MHI_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jclass caller_jh)) {
+JVM_ENTRY(void, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jclass caller_jh)) {
   if (mname_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
   Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh));
 
   // The trusted Java code that calls this method should already have performed
   // access checks on behalf of the given caller.  But, we can verify this.
   if (VerifyMethodHandles && caller_jh != NULL) {
-    klassOop reference_klass = java_lang_Class::as_klassOop(sun_dyn_MemberName::clazz(mname()));
+    klassOop reference_klass = java_lang_Class::as_klassOop(java_lang_invoke_MemberName::clazz(mname()));
     if (reference_klass != NULL) {
       // Emulate LinkResolver::check_klass_accessability.
       klassOop caller = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(caller_jh));
@@ -2448,7 +2449,7 @@
 
 //  static native int getMembers(Class<?> defc, String matchName, String matchSig,
 //          int matchFlags, Class<?> caller, int skip, MemberName[] results);
-JVM_ENTRY(jint, MHI_getMembers(JNIEnv *env, jobject igcls,
+JVM_ENTRY(jint, MHN_getMembers(JNIEnv *env, jobject igcls,
                                jclass clazz_jh, jstring name_jh, jstring sig_jh,
                                int mflags, jclass caller_jh, jint skip, jobjectArray results_jh)) {
   if (clazz_jh == NULL || results_jh == NULL)  return -1;
@@ -2487,14 +2488,14 @@
 }
 JVM_END
 
-JVM_ENTRY(void, MHI_registerBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh, jobject bsm_jh)) {
+JVM_ENTRY(void, MHN_registerBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh, jobject bsm_jh)) {
   instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
   if (!AllowTransitionalJSR292) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "registerBootstrapMethod is only supported in JSR 292 EDR");
   }
   ik->link_class(CHECK);
-  if (!java_dyn_MethodHandle::is_instance(JNIHandles::resolve(bsm_jh))) {
+  if (!java_lang_invoke_MethodHandle::is_instance(JNIHandles::resolve(bsm_jh))) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "method handle");
   }
   const char* err = NULL;
@@ -2522,29 +2523,28 @@
 }
 JVM_END
 
-JVM_ENTRY(jobject, MHI_getBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh)) {
+JVM_ENTRY(jobject, MHN_getBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh)) {
+  if (!AllowTransitionalJSR292)
+    THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "getBootstrap: transitional only");
   instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
   return JNIHandles::make_local(THREAD, ik->bootstrap_method());
 }
 JVM_END
 
-JVM_ENTRY(void, MHI_setCallSiteTarget(JNIEnv *env, jobject igcls, jobject site_jh, jobject target_jh)) {
-  // No special action required, yet.
-  oop site_oop = JNIHandles::resolve(site_jh);
-  if (!java_dyn_CallSite::is_instance(site_oop))
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "not a CallSite");
-  java_dyn_CallSite::set_target(site_oop, JNIHandles::resolve(target_jh));
+JVM_ENTRY(void, MHN_setCallSiteTarget(JNIEnv *env, jobject igcls, jobject site_jh, jobject target_jh)) {
+  if (!AllowTransitionalJSR292)
+    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "setCallSite: transitional only");
 }
 JVM_END
 
 
 /// JVM_RegisterMethodHandleMethods
 
-#define ADR "J"
-
 #define LANG "Ljava/lang/"
-#define JDYN "Ljava/dyn/"
-#define IDYN "Lsun/dyn/"
+#define JLINV "Ljava/lang/invoke/" /* standard package */
+#define JDYN "Ljava/dyn/" /* alternative package to JLINV if AllowTransitionalJSR292 */
+#define IDYN "Lsun/dyn/"  /* alternative package to JDYN if AllowTransitionalJSR292 */
+// FIXME: After AllowTransitionalJSR292 is removed, replace JDYN and IDYN by JLINV.
 
 #define OBJ   LANG"Object;"
 #define CLS   LANG"Class;"
@@ -2552,7 +2552,6 @@
 #define CST   JDYN"CallSite;"
 #define MT    JDYN"MethodType;"
 #define MH    JDYN"MethodHandle;"
-#define MHI   IDYN"MethodHandleImpl;"
 #define MEM   IDYN"MemberName;"
 #define AMH   IDYN"AdapterMethodHandle;"
 #define BMH   IDYN"BoundMethodHandle;"
@@ -2561,32 +2560,58 @@
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
 
-// These are the native methods on sun.dyn.MethodHandleNatives.
+// These are the native methods on sun.invoke.MethodHandleNatives.
 static JNINativeMethod methods[] = {
   // void init(MemberName self, AccessibleObject ref)
-  {CC"init",                    CC"("AMH""MH"I)V",              FN_PTR(MHI_init_AMH)},
-  {CC"init",                    CC"("BMH""OBJ"I)V",             FN_PTR(MHI_init_BMH)},
-  {CC"init",                    CC"("DMH""OBJ"Z"CLS")V",        FN_PTR(MHI_init_DMH)},
-  {CC"init",                    CC"("MT")V",                    FN_PTR(MHI_init_MT)},
-  {CC"init",                    CC"("MEM""OBJ")V",              FN_PTR(MHI_init_Mem)},
-  {CC"expand",                  CC"("MEM")V",                   FN_PTR(MHI_expand_Mem)},
-  {CC"resolve",                 CC"("MEM""CLS")V",              FN_PTR(MHI_resolve_Mem)},
-  {CC"getTarget",               CC"("MH"I)"OBJ,                 FN_PTR(MHI_getTarget)},
-  {CC"getConstant",             CC"(I)I",                       FN_PTR(MHI_getConstant)},
+  {CC"init",                    CC"("AMH""MH"I)V",              FN_PTR(MHN_init_AMH)},
+  {CC"init",                    CC"("BMH""OBJ"I)V",             FN_PTR(MHN_init_BMH)},
+  {CC"init",                    CC"("DMH""OBJ"Z"CLS")V",        FN_PTR(MHN_init_DMH)},
+  {CC"init",                    CC"("MT")V",                    FN_PTR(MHN_init_MT)},
+  {CC"init",                    CC"("MEM""OBJ")V",              FN_PTR(MHN_init_Mem)},
+  {CC"expand",                  CC"("MEM")V",                   FN_PTR(MHN_expand_Mem)},
+  {CC"resolve",                 CC"("MEM""CLS")V",              FN_PTR(MHN_resolve_Mem)},
+  {CC"getTarget",               CC"("MH"I)"OBJ,                 FN_PTR(MHN_getTarget)},
+  {CC"getConstant",             CC"(I)I",                       FN_PTR(MHN_getConstant)},
   //  static native int getNamedCon(int which, Object[] name)
-  {CC"getNamedCon",             CC"(I["OBJ")I",                 FN_PTR(MHI_getNamedCon)},
+  {CC"getNamedCon",             CC"(I["OBJ")I",                 FN_PTR(MHN_getNamedCon)},
   //  static native int getMembers(Class<?> defc, String matchName, String matchSig,
   //          int matchFlags, Class<?> caller, int skip, MemberName[] results);
-  {CC"getMembers",              CC"("CLS""STRG""STRG"I"CLS"I["MEM")I",  FN_PTR(MHI_getMembers)}
+  {CC"getMembers",              CC"("CLS""STRG""STRG"I"CLS"I["MEM")I",  FN_PTR(MHN_getMembers)}
 };
 
 // More entry points specifically for EnableInvokeDynamic.
+// FIXME: Remove methods2 after AllowTransitionalJSR292 is removed.
 static JNINativeMethod methods2[] = {
-  {CC"registerBootstrap",       CC"("CLS MH")V",                FN_PTR(MHI_registerBootstrap)},
-  {CC"getBootstrap",            CC"("CLS")"MH,                  FN_PTR(MHI_getBootstrap)},
-  {CC"setCallSiteTarget",       CC"("CST MH")V",                FN_PTR(MHI_setCallSiteTarget)}
+  {CC"registerBootstrap",       CC"("CLS MH")V",                FN_PTR(MHN_registerBootstrap)},
+  {CC"getBootstrap",            CC"("CLS")"MH,                  FN_PTR(MHN_getBootstrap)},
+  {CC"setCallSiteTarget",       CC"("CST MH")V",                FN_PTR(MHN_setCallSiteTarget)}
 };
 
+static void hack_signatures(JNINativeMethod* methods, jint num_methods, const char* from_sig, const char* to_sig) {
+  for (int i = 0; i < num_methods; i++) {
+    const char* sig = methods[i].signature;
+    if (!strstr(sig, from_sig))  continue;
+    size_t buflen = strlen(sig) + 100;
+    char* buf = NEW_C_HEAP_ARRAY(char, buflen);
+    char* bufp = buf;
+    const char* sigp = sig;
+    size_t from_len = strlen(from_sig), to_len = strlen(to_sig);
+    while (*sigp != '\0') {
+      assert(bufp < buf + buflen - to_len - 1, "oob");
+      if (strncmp(sigp, from_sig, from_len) != 0) {
+        *bufp++ = *sigp++;
+      } else {
+        strcpy(bufp, to_sig);
+        bufp += to_len;
+        sigp += from_len;
+      }
+    }
+    *bufp = '\0';
+    methods[i].signature = buf;  // replace with new signature
+    if (TraceMethodHandles)
+      tty->print_cr("MethodHandleNatives: %s: change signature %s => %s", methods[i].name, sig, buf);
+  }
+}
 
 // This one function is exported, used by NativeLookup.
 
@@ -2600,45 +2625,78 @@
     return;  // bind nothing
   }
 
+  if (SystemDictionary::MethodHandleNatives_klass() != NULL &&
+      SystemDictionary::MethodHandleNatives_klass() != java_lang_Class::as_klassOop(JNIHandles::resolve(MHN_class))) {
+    warning("multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
+    THROW_MSG(vmSymbols::java_lang_InternalError(), "multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
+  }
+
   bool enable_MH = true;
 
-  {
+  // Loop control.  FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
+  bool registered_natives = false;
+  bool try_plain = true, try_JDYN = true, try_IDYN = true;
+  for (;;) {
     ThreadToNativeFromVM ttnfv(thread);
 
+    if      (try_plain) { try_plain = false; }
+    else if (try_JDYN)  { try_JDYN  = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), IDYN, JDYN); }
+    else if (try_IDYN)  { try_IDYN  = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), JDYN, JLINV); }
+    else                { break; }
     int status = env->RegisterNatives(MHN_class, methods, sizeof(methods)/sizeof(JNINativeMethod));
     if (env->ExceptionOccurred()) {
-      MethodHandles::set_enabled(false);
-      warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
-      enable_MH = false;
       env->ExceptionClear();
+      // and try again...
+    } else {
+      registered_natives = true;
+      break;
     }
   }
+  if (!registered_natives) {
+    MethodHandles::set_enabled(false);
+    warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
+    enable_MH = false;
+  }
 
   if (enable_MH) {
+    bool found_raise_exception = false;
+    KlassHandle MHN_klass = SystemDictionaryHandles::MethodHandleNatives_klass();
     KlassHandle MHI_klass = SystemDictionaryHandles::MethodHandleImpl_klass();
-    if (MHI_klass.not_null()) {
+    // Loop control.  FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
+    bool try_MHN = true, try_MHI = AllowTransitionalJSR292;
+    for (;;) {
+      KlassHandle try_klass;
+      if      (try_MHN) { try_MHN = false; try_klass = MHN_klass; }
+      else if (try_MHI) { try_MHI = false; try_klass = MHI_klass; }
+      else              { break; }
+      if (try_klass.is_null())  continue;
       TempNewSymbol raiseException_name = SymbolTable::new_symbol("raiseException", CHECK);
       TempNewSymbol raiseException_sig = SymbolTable::new_symbol("(ILjava/lang/Object;Ljava/lang/Object;)V", CHECK);
-      methodOop raiseException_method  = instanceKlass::cast(MHI_klass->as_klassOop())
+      methodOop raiseException_method  = instanceKlass::cast(try_klass->as_klassOop())
                     ->find_method(raiseException_name, raiseException_sig);
       if (raiseException_method != NULL && raiseException_method->is_static()) {
         MethodHandles::set_raise_exception_method(raiseException_method);
-      } else {
-        warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
-        enable_MH = false;
+        found_raise_exception = true;
+        break;
       }
-    } else {
+    }
+    if (!found_raise_exception) {
+      warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
       enable_MH = false;
     }
   }
 
   if (enable_MH) {
-    // We need to link the MethodHandleImpl klass before we generate
-    // the method handle adapters as the _raise_exception adapter uses
-    // one of its methods (and its c2i-adapter).
-    KlassHandle    k  = SystemDictionaryHandles::MethodHandleImpl_klass();
-    instanceKlass* ik = instanceKlass::cast(k());
-    ik->link_class(CHECK);
+    if (AllowTransitionalJSR292) {
+      // We need to link the MethodHandleImpl klass before we generate
+      // the method handle adapters as the _raise_exception adapter uses
+      // one of its methods (and its c2i-adapter).
+      klassOop k = SystemDictionary::MethodHandleImpl_klass();
+      if (k != NULL) {
+        instanceKlass* ik = instanceKlass::cast(k);
+        ik->link_class(CHECK);
+      }
+    }
 
     MethodHandles::generate_adapters();
     MethodHandles::set_enabled(true);
@@ -2649,16 +2707,14 @@
     return;  // bind nothing
   }
 
-  {
+  if (AllowTransitionalJSR292) {
     ThreadToNativeFromVM ttnfv(thread);
 
     int status = env->RegisterNatives(MHN_class, methods2, sizeof(methods2)/sizeof(JNINativeMethod));
     if (env->ExceptionOccurred()) {
-      MethodHandles::set_enabled(false);
-      warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
+      // Don't do this, since it's too late:
+      //   MethodHandles::set_enabled(false)
       env->ExceptionClear();
-    } else {
-      MethodHandles::set_enabled(true);
     }
   }
 }
--- a/hotspot/src/share/vm/prims/methodHandles.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -37,8 +37,8 @@
 
 class MethodHandles: AllStatic {
   // JVM support for MethodHandle, MethodType, and related types
-  // in java.dyn and java.dyn.hotspot.
-  // See also  javaClasses for layouts java_dyn_Method{Handle,Type,Type::Form}.
+  // in java.lang.invoke and sun.invoke.
+  // See also  javaClasses for layouts java_lang_invoke_Method{Handle,Type,Type::Form}.
  public:
   enum EntryKind {
     _raise_exception,           // stub for error generation from other stubs
@@ -54,21 +54,21 @@
     _bound_long_direct_mh,
 
     _adapter_mh_first,     // adapter sequence goes here...
-    _adapter_retype_only   = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY,
-    _adapter_retype_raw    = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW,
-    _adapter_check_cast    = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_CHECK_CAST,
-    _adapter_prim_to_prim  = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM,
-    _adapter_ref_to_prim   = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM,
-    _adapter_prim_to_ref   = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_PRIM_TO_REF,
-    _adapter_swap_args     = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS,
-    _adapter_rot_args      = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_ROT_ARGS,
-    _adapter_dup_args      = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_DUP_ARGS,
-    _adapter_drop_args     = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_DROP_ARGS,
-    _adapter_collect_args  = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_COLLECT_ARGS,
-    _adapter_spread_args   = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS,
-    _adapter_flyby         = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_FLYBY,
-    _adapter_ricochet      = _adapter_mh_first + sun_dyn_AdapterMethodHandle::OP_RICOCHET,
-    _adapter_mh_last       = _adapter_mh_first + sun_dyn_AdapterMethodHandle::CONV_OP_LIMIT - 1,
+    _adapter_retype_only   = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY,
+    _adapter_retype_raw    = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW,
+    _adapter_check_cast    = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST,
+    _adapter_prim_to_prim  = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM,
+    _adapter_ref_to_prim   = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM,
+    _adapter_prim_to_ref   = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF,
+    _adapter_swap_args     = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS,
+    _adapter_rot_args      = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS,
+    _adapter_dup_args      = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS,
+    _adapter_drop_args     = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS,
+    _adapter_collect_args  = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS,
+    _adapter_spread_args   = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS,
+    _adapter_flyby         = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_FLYBY,
+    _adapter_ricochet      = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::OP_RICOCHET,
+    _adapter_mh_last       = _adapter_mh_first + java_lang_invoke_AdapterMethodHandle::CONV_OP_LIMIT - 1,
 
     // Optimized adapter types
 
@@ -107,16 +107,16 @@
   static void set_enabled(bool z);
 
  private:
-  enum {  // import sun_dyn_AdapterMethodHandle::CONV_OP_*
-    CONV_OP_LIMIT         = sun_dyn_AdapterMethodHandle::CONV_OP_LIMIT,
-    CONV_OP_MASK          = sun_dyn_AdapterMethodHandle::CONV_OP_MASK,
-    CONV_VMINFO_MASK      = sun_dyn_AdapterMethodHandle::CONV_VMINFO_MASK,
-    CONV_VMINFO_SHIFT     = sun_dyn_AdapterMethodHandle::CONV_VMINFO_SHIFT,
-    CONV_OP_SHIFT         = sun_dyn_AdapterMethodHandle::CONV_OP_SHIFT,
-    CONV_DEST_TYPE_SHIFT  = sun_dyn_AdapterMethodHandle::CONV_DEST_TYPE_SHIFT,
-    CONV_SRC_TYPE_SHIFT   = sun_dyn_AdapterMethodHandle::CONV_SRC_TYPE_SHIFT,
-    CONV_STACK_MOVE_SHIFT = sun_dyn_AdapterMethodHandle::CONV_STACK_MOVE_SHIFT,
-    CONV_STACK_MOVE_MASK  = sun_dyn_AdapterMethodHandle::CONV_STACK_MOVE_MASK
+  enum {  // import java_lang_invoke_AdapterMethodHandle::CONV_OP_*
+    CONV_OP_LIMIT         = java_lang_invoke_AdapterMethodHandle::CONV_OP_LIMIT,
+    CONV_OP_MASK          = java_lang_invoke_AdapterMethodHandle::CONV_OP_MASK,
+    CONV_VMINFO_MASK      = java_lang_invoke_AdapterMethodHandle::CONV_VMINFO_MASK,
+    CONV_VMINFO_SHIFT     = java_lang_invoke_AdapterMethodHandle::CONV_VMINFO_SHIFT,
+    CONV_OP_SHIFT         = java_lang_invoke_AdapterMethodHandle::CONV_OP_SHIFT,
+    CONV_DEST_TYPE_SHIFT  = java_lang_invoke_AdapterMethodHandle::CONV_DEST_TYPE_SHIFT,
+    CONV_SRC_TYPE_SHIFT   = java_lang_invoke_AdapterMethodHandle::CONV_SRC_TYPE_SHIFT,
+    CONV_STACK_MOVE_SHIFT = java_lang_invoke_AdapterMethodHandle::CONV_STACK_MOVE_SHIFT,
+    CONV_STACK_MOVE_MASK  = java_lang_invoke_AdapterMethodHandle::CONV_STACK_MOVE_MASK
   };
 
   static bool _enabled;
@@ -471,7 +471,7 @@
 };
 
 
-// Access methods for the "entry" field of a java.dyn.MethodHandle.
+// Access methods for the "entry" field of a java.lang.invoke.MethodHandle.
 // The field is primarily a jump target for compiled calls.
 // However, we squirrel away some nice pointers for other uses,
 // just before the jump target.
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -107,29 +107,30 @@
   void JNICALL JVM_RegisterPerfMethods(JNIEnv *env, jclass perfclass);
 }
 
+#define CC (char*)  /* cast a literal from (const char*) */
+#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
+
+static JNINativeMethod lookup_special_native_methods[] = {
+  // Next two functions only exist for compatibility with 1.3.1 and earlier.
+  { CC"Java_java_io_ObjectOutputStream_getPrimitiveFieldValues",   NULL, FN_PTR(JVM_GetPrimitiveFieldValues)     },  // intercept ObjectOutputStream getPrimitiveFieldValues for faster serialization
+  { CC"Java_java_io_ObjectInputStream_setPrimitiveFieldValues",    NULL, FN_PTR(JVM_SetPrimitiveFieldValues)     },  // intercept ObjectInputStream setPrimitiveFieldValues for faster serialization
+
+  { CC"Java_sun_misc_Unsafe_registerNatives",                      NULL, FN_PTR(JVM_RegisterUnsafeMethods)       },
+  { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
+  { CC"Java_sun_dyn_MethodHandleNatives_registerNatives",          NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },  // AllowTransitionalJSR292
+  { CC"Java_java_dyn_MethodHandleNatives_registerNatives",         NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },  // AllowTransitionalJSR292
+  { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         }
+};
+
 static address lookup_special_native(char* jni_name) {
-  // NB: To ignore the jni prefix and jni postfix strstr is used matching.
-  if (!JDK_Version::is_gte_jdk14x_version()) {
-    // These functions only exist for compatibility with 1.3.1 and earlier
-    // Intercept ObjectOutputStream getPrimitiveFieldValues for faster serialization
-    if (strstr(jni_name, "Java_java_io_ObjectOutputStream_getPrimitiveFieldValues") != NULL) {
-      return CAST_FROM_FN_PTR(address, JVM_GetPrimitiveFieldValues);
-    }
-    // Intercept ObjectInputStream setPrimitiveFieldValues for faster serialization
-    if (strstr(jni_name, "Java_java_io_ObjectInputStream_setPrimitiveFieldValues") != NULL) {
-      return CAST_FROM_FN_PTR(address, JVM_SetPrimitiveFieldValues);
+  int i = !JDK_Version::is_gte_jdk14x_version() ? 0 : 2;  // see comment in lookup_special_native_methods
+  int count = sizeof(lookup_special_native_methods) / sizeof(JNINativeMethod);
+  for (; i < count; i++) {
+    // NB: To ignore the jni prefix and jni postfix strstr is used matching.
+    if (strstr(jni_name, lookup_special_native_methods[i].name) != NULL) {
+      return CAST_FROM_FN_PTR(address, lookup_special_native_methods[i].fnPtr);
     }
   }
-  if (strstr(jni_name, "Java_sun_misc_Unsafe_registerNatives") != NULL) {
-    return CAST_FROM_FN_PTR(address, JVM_RegisterUnsafeMethods);
-  }
-  if (strstr(jni_name, "Java_sun_dyn_MethodHandleNatives_registerNatives") != NULL) {
-    return CAST_FROM_FN_PTR(address, JVM_RegisterMethodHandleMethods);
-  }
-  if (strstr(jni_name, "Java_sun_misc_Perf_registerNatives") != NULL) {
-    return CAST_FROM_FN_PTR(address, JVM_RegisterPerfMethods);
-  }
-
   return NULL;
 }
 
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -688,7 +688,7 @@
     THROW_0(vmSymbols::java_lang_IllegalArgumentException());
   }
 
-  return JNIHandles::make_local(env, java_lang_Class::as_klassOop(mirror));
+  return JNIHandles::make_local(env, mirror);
 UNSAFE_END
 
 //@deprecated
@@ -706,7 +706,7 @@
   if (clazz == NULL) {
     THROW_0(vmSymbols::java_lang_NullPointerException());
   }
-  return JNIHandles::make_local(env, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz)));
+  return JNIHandles::make_local(env, JNIHandles::resolve_non_null(clazz));
 UNSAFE_END
 
 UNSAFE_ENTRY(void, Unsafe_EnsureClassInitialized(JNIEnv *env, jobject unsafe, jobject clazz))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,450 @@
+/*
+* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
+* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+*/
+
+#include "precompiled.hpp"
+#include "runtime/advancedThresholdPolicy.hpp"
+#include "runtime/simpleThresholdPolicy.inline.hpp"
+
+#ifdef TIERED
+// Print an event.
+void AdvancedThresholdPolicy::print_specific(EventType type, methodHandle mh, methodHandle imh,
+                                             int bci, CompLevel level) {
+  tty->print(" rate: ");
+  if (mh->prev_time() == 0) tty->print("n/a");
+  else tty->print("%f", mh->rate());
+
+  tty->print(" k: %.2lf,%.2lf", threshold_scale(CompLevel_full_profile, Tier3LoadFeedback),
+                                threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
+
+}
+
+void AdvancedThresholdPolicy::initialize() {
+  // Turn on ergonomic compiler count selection
+  if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
+    FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
+  }
+  int count = CICompilerCount;
+  if (CICompilerCountPerCPU) {
+    // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
+    int log_cpu = log2_intptr(os::active_processor_count());
+    int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
+    count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
+  }
+
+  set_c1_count(MAX2(count / 3, 1));
+  set_c2_count(MAX2(count - count / 3, 1));
+
+  // Some inlining tuning
+#ifdef X86
+  if (FLAG_IS_DEFAULT(InlineSmallCode)) {
+    FLAG_SET_DEFAULT(InlineSmallCode, 2000);
+  }
+#endif
+
+#ifdef SPARC
+  if (FLAG_IS_DEFAULT(InlineSmallCode)) {
+    FLAG_SET_DEFAULT(InlineSmallCode, 2500);
+  }
+#endif
+
+
+  set_start_time(os::javaTimeMillis());
+}
+
+// update_rate() is called from select_task() while holding a compile queue lock.
+void AdvancedThresholdPolicy::update_rate(jlong t, methodOop m) {
+  if (is_old(m)) {
+    // We don't remove old methods from the queue,
+    // so we can just zero the rate.
+    m->set_rate(0);
+    return;
+  }
+
+  // We don't update the rate if we've just came out of a safepoint.
+  // delta_s is the time since last safepoint in milliseconds.
+  jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint();
+  jlong delta_t = t - (m->prev_time() != 0 ? m->prev_time() : start_time()); // milliseconds since the last measurement
+  // How many events were there since the last time?
+  int event_count = m->invocation_count() + m->backedge_count();
+  int delta_e = event_count - m->prev_event_count();
+
+  // We should be running for at least 1ms.
+  if (delta_s >= TieredRateUpdateMinTime) {
+    // And we must've taken the previous point at least 1ms before.
+    if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
+      m->set_prev_time(t);
+      m->set_prev_event_count(event_count);
+      m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond
+    } else
+      if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
+        // If nothing happened for 25ms, zero the rate. Don't modify prev values.
+        m->set_rate(0);
+      }
+  }
+}
+
+// Check if this method has been stale from a given number of milliseconds.
+// See select_task().
+bool AdvancedThresholdPolicy::is_stale(jlong t, jlong timeout, methodOop m) {
+  jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint();
+  jlong delta_t = t - m->prev_time();
+  if (delta_t > timeout && delta_s > timeout) {
+    int event_count = m->invocation_count() + m->backedge_count();
+    int delta_e = event_count - m->prev_event_count();
+    // Return true if there were no events.
+    return delta_e == 0;
+  }
+  return false;
+}
+
+// We don't remove old methods from the compile queue even if they have
+// very low activity. See select_task().
+bool AdvancedThresholdPolicy::is_old(methodOop method) {
+  return method->invocation_count() > 50000 || method->backedge_count() > 500000;
+}
+
+double AdvancedThresholdPolicy::weight(methodOop method) {
+  return (method->rate() + 1) * ((method->invocation_count() + 1) *  (method->backedge_count() + 1));
+}
+
+// Apply heuristics and return true if x should be compiled before y
+bool AdvancedThresholdPolicy::compare_methods(methodOop x, methodOop y) {
+  if (x->highest_comp_level() > y->highest_comp_level()) {
+    // recompilation after deopt
+    return true;
+  } else
+    if (x->highest_comp_level() == y->highest_comp_level()) {
+      if (weight(x) > weight(y)) {
+        return true;
+      }
+    }
+  return false;
+}
+
+// Is method profiled enough?
+bool AdvancedThresholdPolicy::is_method_profiled(methodOop method) {
+  methodDataOop mdo = method->method_data();
+  if (mdo != NULL) {
+    int i = mdo->invocation_count_delta();
+    int b = mdo->backedge_count_delta();
+    return call_predicate_helper<CompLevel_full_profile>(i, b, 1);
+  }
+  return false;
+}
+
+// Called with the queue locked and with at least one element
+CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
+  CompileTask *max_task = NULL;
+  methodOop max_method;
+  jlong t = os::javaTimeMillis();
+  // Iterate through the queue and find a method with a maximum rate.
+  for (CompileTask* task = compile_queue->first(); task != NULL;) {
+    CompileTask* next_task = task->next();
+    methodOop method = (methodOop)JNIHandles::resolve(task->method_handle());
+    methodDataOop mdo = method->method_data();
+    update_rate(t, method);
+    if (max_task == NULL) {
+      max_task = task;
+      max_method = method;
+    } else {
+      // If a method has been stale for some time, remove it from the queue.
+      if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) {
+        if (PrintTieredEvents) {
+          print_event(KILL, method, method, task->osr_bci(), (CompLevel)task->comp_level());
+        }
+        CompileTaskWrapper ctw(task); // Frees the task
+        compile_queue->remove(task);
+        method->clear_queued_for_compilation();
+        task = next_task;
+        continue;
+      }
+
+      // Select a method with a higher rate
+      if (compare_methods(method, max_method)) {
+        max_task = task;
+        max_method = method;
+      }
+    }
+    task = next_task;
+  }
+
+  if (max_task->comp_level() == CompLevel_full_profile && is_method_profiled(max_method)) {
+    max_task->set_comp_level(CompLevel_limited_profile);
+    if (PrintTieredEvents) {
+      print_event(UPDATE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level());
+    }
+  }
+
+  return max_task;
+}
+
+double AdvancedThresholdPolicy::threshold_scale(CompLevel level, int feedback_k) {
+  double queue_size = CompileBroker::queue_size(level);
+  int comp_count = compiler_count(level);
+  double k = queue_size / (feedback_k * comp_count) + 1;
+  return k;
+}
+
+// Call and loop predicates determine whether a transition to a higher
+// compilation level should be performed (pointers to predicate functions
+// are passed to common()).
+// Tier?LoadFeedback is basically a coefficient that determines of
+// how many methods per compiler thread can be in the queue before
+// the threshold values double.
+bool AdvancedThresholdPolicy::loop_predicate(int i, int b, CompLevel cur_level) {
+  switch(cur_level) {
+  case CompLevel_none:
+  case CompLevel_limited_profile: {
+    double k = threshold_scale(CompLevel_full_profile, Tier3LoadFeedback);
+    return loop_predicate_helper<CompLevel_none>(i, b, k);
+  }
+  case CompLevel_full_profile: {
+    double k = threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback);
+    return loop_predicate_helper<CompLevel_full_profile>(i, b, k);
+  }
+  default:
+    return true;
+  }
+}
+
+bool AdvancedThresholdPolicy::call_predicate(int i, int b, CompLevel cur_level) {
+  switch(cur_level) {
+  case CompLevel_none:
+  case CompLevel_limited_profile: {
+    double k = threshold_scale(CompLevel_full_profile, Tier3LoadFeedback);
+    return call_predicate_helper<CompLevel_none>(i, b, k);
+  }
+  case CompLevel_full_profile: {
+    double k = threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback);
+    return call_predicate_helper<CompLevel_full_profile>(i, b, k);
+  }
+  default:
+    return true;
+  }
+}
+
+// If a method is old enough and is still in the interpreter we would want to
+// start profiling without waiting for the compiled method to arrive.
+// We also take the load on compilers into the account.
+bool AdvancedThresholdPolicy::should_create_mdo(methodOop method, CompLevel cur_level) {
+  if (cur_level == CompLevel_none &&
+      CompileBroker::queue_size(CompLevel_full_optimization) <=
+      Tier3DelayOn * compiler_count(CompLevel_full_optimization)) {
+    int i = method->invocation_count();
+    int b = method->backedge_count();
+    double k = Tier0ProfilingStartPercentage / 100.0;
+    return call_predicate_helper<CompLevel_none>(i, b, k) || loop_predicate_helper<CompLevel_none>(i, b, k);
+  }
+  return false;
+}
+
+// Create MDO if necessary.
+void AdvancedThresholdPolicy::create_mdo(methodHandle mh, TRAPS) {
+  if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return;
+  if (mh->method_data() == NULL) {
+    methodOopDesc::build_interpreter_method_data(mh, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      CLEAR_PENDING_EXCEPTION;
+    }
+  }
+}
+
+
+/*
+ * Method states:
+ *   0 - interpreter (CompLevel_none)
+ *   1 - pure C1 (CompLevel_simple)
+ *   2 - C1 with invocation and backedge counting (CompLevel_limited_profile)
+ *   3 - C1 with full profiling (CompLevel_full_profile)
+ *   4 - C2 (CompLevel_full_optimization)
+ *
+ * Common state transition patterns:
+ * a. 0 -> 3 -> 4.
+ *    The most common path. But note that even in this straightforward case
+ *    profiling can start at level 0 and finish at level 3.
+ *
+ * b. 0 -> 2 -> 3 -> 4.
+ *    This case occures when the load on C2 is deemed too high. So, instead of transitioning
+ *    into state 3 directly and over-profiling while a method is in the C2 queue we transition to
+ *    level 2 and wait until the load on C2 decreases. This path is disabled for OSRs.
+ *
+ * c. 0 -> (3->2) -> 4.
+ *    In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough
+ *    to enable the profiling to fully occur at level 0. In this case we change the compilation level
+ *    of the method to 2, because it'll allow it to run much faster without full profiling while c2
+ *    is compiling.
+ *
+ * d. 0 -> 3 -> 1 or 0 -> 2 -> 1.
+ *    After a method was once compiled with C1 it can be identified as trivial and be compiled to
+ *    level 1. These transition can also occur if a method can't be compiled with C2 but can with C1.
+ *
+ * e. 0 -> 4.
+ *    This can happen if a method fails C1 compilation (it will still be profiled in the interpreter)
+ *    or because of a deopt that didn't require reprofiling (compilation won't happen in this case because
+ *    the compiled version already exists).
+ *
+ * Note that since state 0 can be reached from any other state via deoptimization different loops
+ * are possible.
+ *
+ */
+
+// Common transition function. Given a predicate determines if a method should transition to another level.
+CompLevel AdvancedThresholdPolicy::common(Predicate p, methodOop method, CompLevel cur_level) {
+  if (is_trivial(method)) return CompLevel_simple;
+
+  CompLevel next_level = cur_level;
+  int i = method->invocation_count();
+  int b = method->backedge_count();
+
+  switch(cur_level) {
+  case CompLevel_none:
+    // If we were at full profile level, would we switch to full opt?
+    if (common(p, method, CompLevel_full_profile) == CompLevel_full_optimization) {
+      next_level = CompLevel_full_optimization;
+    } else if ((this->*p)(i, b, cur_level)) {
+      // C1-generated fully profiled code is about 30% slower than the limited profile
+      // code that has only invocation and backedge counters. The observation is that
+      // if C2 queue is large enough we can spend too much time in the fully profiled code
+      // while waiting for C2 to pick the method from the queue. To alleviate this problem
+      // we introduce a feedback on the C2 queue size. If the C2 queue is sufficiently long
+      // we choose to compile a limited profiled version and then recompile with full profiling
+      // when the load on C2 goes down.
+      if (CompileBroker::queue_size(CompLevel_full_optimization) >
+          Tier3DelayOn * compiler_count(CompLevel_full_optimization)) {
+        next_level = CompLevel_limited_profile;
+      } else {
+        next_level = CompLevel_full_profile;
+      }
+    }
+    break;
+  case CompLevel_limited_profile:
+    if (is_method_profiled(method)) {
+      // Special case: we got here because this method was fully profiled in the interpreter.
+      next_level = CompLevel_full_optimization;
+    } else {
+      methodDataOop mdo = method->method_data();
+      if (mdo != NULL) {
+        if (mdo->would_profile()) {
+          if (CompileBroker::queue_size(CompLevel_full_optimization) <=
+              Tier3DelayOff * compiler_count(CompLevel_full_optimization) &&
+              (this->*p)(i, b, cur_level)) {
+            next_level = CompLevel_full_profile;
+          }
+        } else {
+          next_level = CompLevel_full_optimization;
+        }
+      }
+    }
+    break;
+  case CompLevel_full_profile:
+    {
+      methodDataOop mdo = method->method_data();
+      if (mdo != NULL) {
+        if (mdo->would_profile()) {
+          int mdo_i = mdo->invocation_count_delta();
+          int mdo_b = mdo->backedge_count_delta();
+          if ((this->*p)(mdo_i, mdo_b, cur_level)) {
+            next_level = CompLevel_full_optimization;
+          }
+        } else {
+          next_level = CompLevel_full_optimization;
+        }
+      }
+    }
+    break;
+  }
+  return next_level;
+}
+
+// Determine if a method should be compiled with a normal entry point at a different level.
+CompLevel AdvancedThresholdPolicy::call_event(methodOop method,  CompLevel cur_level) {
+  CompLevel osr_level = (CompLevel) method->highest_osr_comp_level();
+  CompLevel next_level = common(&AdvancedThresholdPolicy::call_predicate, method, cur_level);
+
+  // If OSR method level is greater than the regular method level, the levels should be
+  // equalized by raising the regular method level in order to avoid OSRs during each
+  // invocation of the method.
+  if (osr_level == CompLevel_full_optimization && cur_level == CompLevel_full_profile) {
+    methodDataOop mdo = method->method_data();
+    guarantee(mdo != NULL, "MDO should not be NULL");
+    if (mdo->invocation_count() >= 1) {
+      next_level = CompLevel_full_optimization;
+    }
+  } else {
+    next_level = MAX2(osr_level, next_level);
+  }
+
+  return next_level;
+}
+
+// Determine if we should do an OSR compilation of a given method.
+CompLevel AdvancedThresholdPolicy::loop_event(methodOop method, CompLevel cur_level) {
+  if (cur_level == CompLevel_none) {
+    // If there is a live OSR method that means that we deopted to the interpreter
+    // for the transition.
+    CompLevel osr_level = (CompLevel)method->highest_osr_comp_level();
+    if (osr_level > CompLevel_none) {
+      return osr_level;
+    }
+  }
+  return common(&AdvancedThresholdPolicy::loop_predicate, method, cur_level);
+}
+
+// Update the rate and submit compile
+void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS) {
+  int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
+  update_rate(os::javaTimeMillis(), mh());
+  CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", THREAD);
+}
+
+
+// Handle the invocation event.
+void AdvancedThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
+                                                      CompLevel level, TRAPS) {
+  if (should_create_mdo(mh(), level)) {
+    create_mdo(mh, THREAD);
+  }
+  if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
+    CompLevel next_level = call_event(mh(), level);
+    if (next_level != level) {
+      compile(mh, InvocationEntryBci, next_level, THREAD);
+    }
+  }
+}
+
+// Handle the back branch event. Notice that we can compile the method
+// with a regular entry from here.
+void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
+                                                       int bci, CompLevel level, TRAPS) {
+  if (should_create_mdo(mh(), level)) {
+    create_mdo(mh, THREAD);
+  }
+
+  // If the method is already compiling, quickly bail out.
+  if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) {
+    // Use loop event as an opportinity to also check there's been
+    // enough calls.
+    CompLevel cur_level = comp_level(mh());
+    CompLevel next_level = call_event(mh(), cur_level);
+    CompLevel next_osr_level = loop_event(mh(), level);
+    if (next_osr_level  == CompLevel_limited_profile) {
+      next_osr_level = CompLevel_full_profile; // OSRs are supposed to be for very hot methods.
+    }
+    next_level = MAX2(next_level,
+                      next_osr_level < CompLevel_full_optimization ? next_osr_level : cur_level);
+    bool is_compiling = false;
+    if (next_level != cur_level) {
+      compile(mh, InvocationEntryBci, next_level, THREAD);
+      is_compiling = true;
+    }
+
+    // Do the OSR version
+    if (!is_compiling && next_osr_level != level) {
+      compile(mh, bci, next_osr_level, THREAD);
+    }
+  }
+}
+
+#endif // TIERED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
+* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+*/
+
+#ifndef SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
+#define SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
+
+#include "runtime/simpleThresholdPolicy.hpp"
+
+#ifdef TIERED
+class CompileTask;
+class CompileQueue;
+
+/*
+ *  The system supports 5 execution levels:
+ *  * level 0 - interpreter
+ *  * level 1 - C1 with full optimization (no profiling)
+ *  * level 2 - C1 with invocation and backedge counters
+ *  * level 3 - C1 with full profiling (level 2 + MDO)
+ *  * level 4 - C2
+ *
+ * Levels 0, 2 and 3 periodically notify the runtime about the current value of the counters
+ * (invocation counters and backedge counters). The frequency of these notifications is
+ * different at each level. These notifications are used by the policy to decide what transition
+ * to make.
+ *
+ * Execution starts at level 0 (interpreter), then the policy can decide either to compile the
+ * method at level 3 or level 2. The decision is based on the following factors:
+ *    1. The length of the C2 queue determines the next level. The observation is that level 2
+ * is generally faster than level 3 by about 30%, therefore we would want to minimize the time
+ * a method spends at level 3. We should only spend the time at level 3 that is necessary to get
+ * adequate profiling. So, if the C2 queue is long enough it is more beneficial to go first to
+ * level 2, because if we transitioned to level 3 we would be stuck there until our C2 compile
+ * request makes its way through the long queue. When the load on C2 recedes we are going to
+ * recompile at level 3 and start gathering profiling information.
+ *    2. The length of C1 queue is used to dynamically adjust the thresholds, so as to introduce
+ * additional filtering if the compiler is overloaded. The rationale is that by the time a
+ * method gets compiled it can become unused, so it doesn't make sense to put too much onto the
+ * queue.
+ *
+ * After profiling is completed at level 3 the transition is made to level 4. Again, the length
+ * of the C2 queue is used as a feedback to adjust the thresholds.
+ *
+ * After the first C1 compile some basic information is determined about the code like the number
+ * of the blocks and the number of the loops. Based on that it can be decided that a method
+ * is trivial and compiling it with C1 will yield the same code. In this case the method is
+ * compiled at level 1 instead of 4.
+ *
+ * We also support profiling at level 0. If C1 is slow enough to produce the level 3 version of
+ * the code and the C2 queue is sufficiently small we can decide to start profiling in the
+ * interpreter (and continue profiling in the compiled code once the level 3 version arrives).
+ * If the profiling at level 0 is fully completed before level 3 version is produced, a level 2
+ * version is compiled instead in order to run faster waiting for a level 4 version.
+ *
+ * Compile queues are implemented as priority queues - for each method in the queue we compute
+ * the event rate (the number of invocation and backedge counter increments per unit of time).
+ * When getting an element off the queue we pick the one with the largest rate. Maintaining the
+ * rate also allows us to remove stale methods (the ones that got on the queue but stopped
+ * being used shortly after that).
+*/
+
+/* Command line options:
+ * - Tier?InvokeNotifyFreqLog and Tier?BackedgeNotifyFreqLog control the frequency of method
+ *   invocation and backedge notifications. Basically every n-th invocation or backedge a mutator thread
+ *   makes a call into the runtime.
+ *
+ * - Tier?CompileThreshold, Tier?BackEdgeThreshold, Tier?MinInvocationThreshold control
+ *   compilation thresholds.
+ *   Level 2 thresholds are not used and are provided for option-compatibility and potential future use.
+ *   Other thresholds work as follows:
+ *
+ *   Transition from interpreter (level 0) to C1 with full profiling (level 3) happens when
+ *   the following predicate is true (X is the level):
+ *
+ *   i > TierXInvocationThreshold * s || (i > TierXMinInvocationThreshold * s  && i + b > TierXCompileThreshold * s),
+ *
+ *   where $i$ is the number of method invocations, $b$ number of backedges and $s$ is the scaling
+ *   coefficient that will be discussed further.
+ *   The intuition is to equalize the time that is spend profiling each method.
+ *   The same predicate is used to control the transition from level 3 to level 4 (C2). It should be
+ *   noted though that the thresholds are relative. Moreover i and b for the 0->3 transition come
+ *   from methodOop and for 3->4 transition they come from MDO (since profiled invocations are
+ *   counted separately).
+ *
+ *   OSR transitions are controlled simply with b > TierXBackEdgeThreshold * s predicates.
+ *
+ * - Tier?LoadFeedback options are used to automatically scale the predicates described above depending
+ *   on the compiler load. The scaling coefficients are computed as follows:
+ *
+ *   s = queue_size_X / (TierXLoadFeedback * compiler_count_X) + 1,
+ *
+ *   where queue_size_X is the current size of the compiler queue of level X, and compiler_count_X
+ *   is the number of level X compiler threads.
+ *
+ *   Basically these parameters describe how many methods should be in the compile queue
+ *   per compiler thread before the scaling coefficient increases by one.
+ *
+ *   This feedback provides the mechanism to automatically control the flow of compilation requests
+ *   depending on the machine speed, mutator load and other external factors.
+ *
+ * - Tier3DelayOn and Tier3DelayOff parameters control another important feedback loop.
+ *   Consider the following observation: a method compiled with full profiling (level 3)
+ *   is about 30% slower than a method at level 2 (just invocation and backedge counters, no MDO).
+ *   Normally, the following transitions will occur: 0->3->4. The problem arises when the C2 queue
+ *   gets congested and the 3->4 transition is delayed. While the method is the C2 queue it continues
+ *   executing at level 3 for much longer time than is required by the predicate and at suboptimal speed.
+ *   The idea is to dynamically change the behavior of the system in such a way that if a substantial
+ *   load on C2 is detected we would first do the 0->2 transition allowing a method to run faster.
+ *   And then when the load decreases to allow 2->3 transitions.
+ *
+ *   Tier3Delay* parameters control this switching mechanism.
+ *   Tier3DelayOn is the number of methods in the C2 queue per compiler thread after which the policy
+ *   no longer does 0->3 transitions but does 0->2 transitions instead.
+ *   Tier3DelayOff switches the original behavior back when the number of methods in the C2 queue
+ *   per compiler thread falls below the specified amount.
+ *   The hysteresis is necessary to avoid jitter.
+ *
+ * - TieredCompileTaskTimeout is the amount of time an idle method can spend in the compile queue.
+ *   Basically, since we use the event rate d(i + b)/dt as a value of priority when selecting a method to
+ *   compile from the compile queue, we also can detect stale methods for which the rate has been
+ *   0 for some time in the same iteration. Stale methods can appear in the queue when an application
+ *   abruptly changes its behavior.
+ *
+ * - TieredStopAtLevel, is used mostly for testing. It allows to bypass the policy logic and stick
+ *   to a given level. For example it's useful to set TieredStopAtLevel = 1 in order to compile everything
+ *   with pure c1.
+ *
+ * - Tier0ProfilingStartPercentage allows the interpreter to start profiling when the inequalities in the
+ *   0->3 predicate are already exceeded by the given percentage but the level 3 version of the
+ *   method is still not ready. We can even go directly from level 0 to 4 if c1 doesn't produce a compiled
+ *   version in time. This reduces the overall transition to level 4 and decreases the startup time.
+ *   Note that this behavior is also guarded by the Tier3Delay mechanism: when the c2 queue is too long
+ *   these is not reason to start profiling prematurely.
+ *
+ * - TieredRateUpdateMinTime and TieredRateUpdateMaxTime are parameters of the rate computation.
+ *   Basically, the rate is not computed more frequently than TieredRateUpdateMinTime and is considered
+ *   to be zero if no events occurred in TieredRateUpdateMaxTime.
+ */
+
+
+class AdvancedThresholdPolicy : public SimpleThresholdPolicy {
+  jlong _start_time;
+
+  // Call and loop predicates determine whether a transition to a higher compilation
+  // level should be performed (pointers to predicate functions are passed to common().
+  // Predicates also take compiler load into account.
+  typedef bool (AdvancedThresholdPolicy::*Predicate)(int i, int b, CompLevel cur_level);
+  bool call_predicate(int i, int b, CompLevel cur_level);
+  bool loop_predicate(int i, int b, CompLevel cur_level);
+  // Common transition function. Given a predicate determines if a method should transition to another level.
+  CompLevel common(Predicate p, methodOop method, CompLevel cur_level);
+  // Transition functions.
+  // call_event determines if a method should be compiled at a different
+  // level with a regular invocation entry.
+  CompLevel call_event(methodOop method, CompLevel cur_level);
+  // loop_event checks if a method should be OSR compiled at a different
+  // level.
+  CompLevel loop_event(methodOop method, CompLevel cur_level);
+  // Has a method been long around?
+  // We don't remove old methods from the compile queue even if they have
+  // very low activity (see select_task()).
+  inline bool is_old(methodOop method);
+  // Was a given method inactive for a given number of milliseconds.
+  // If it is, we would remove it from the queue (see select_task()).
+  inline bool is_stale(jlong t, jlong timeout, methodOop m);
+  // Compute the weight of the method for the compilation scheduling
+  inline double weight(methodOop method);
+  // Apply heuristics and return true if x should be compiled before y
+  inline bool compare_methods(methodOop x, methodOop y);
+  // Compute event rate for a given method. The rate is the number of event (invocations + backedges)
+  // per millisecond.
+  inline void update_rate(jlong t, methodOop m);
+  // Compute threshold scaling coefficient
+  inline double threshold_scale(CompLevel level, int feedback_k);
+  // If a method is old enough and is still in the interpreter we would want to
+  // start profiling without waiting for the compiled method to arrive. This function
+  // determines whether we should do that.
+  inline bool should_create_mdo(methodOop method, CompLevel cur_level);
+  // Create MDO if necessary.
+  void create_mdo(methodHandle mh, TRAPS);
+  // Is method profiled enough?
+  bool is_method_profiled(methodOop method);
+
+protected:
+  void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level);
+
+  void set_start_time(jlong t) { _start_time = t;    }
+  jlong start_time() const     { return _start_time; }
+
+  // Submit a given method for compilation (and update the rate).
+  virtual void submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS);
+  // event() from SimpleThresholdPolicy would call these.
+  virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
+                                       CompLevel level, TRAPS);
+  virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
+                                        int bci, CompLevel level, TRAPS);
+public:
+  AdvancedThresholdPolicy() : _start_time(0) { }
+  // Select task is called by CompileBroker. We should return a task or NULL.
+  virtual CompileTask* select_task(CompileQueue* compile_queue);
+  virtual void initialize();
+};
+
+#endif // TIERED
+
+#endif // SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -242,6 +242,7 @@
                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
   { "MaxLiveObjectEvacuationRatio",
                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
+  { "ForceSharedSpaces",   JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
   { NULL, JDK_Version(0), JDK_Version(0) }
 };
 
@@ -1003,31 +1004,10 @@
   }
 }
 
-void Arguments::check_compressed_oops_compat() {
-#ifdef _LP64
-  assert(UseCompressedOops, "Precondition");
-  // Is it on by default or set on ergonomically
-  bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops);
-
-  // If dumping an archive or forcing its use, disable compressed oops if possible
-  if (DumpSharedSpaces || RequireSharedSpaces) {
-    if (is_on_by_default) {
-      FLAG_SET_DEFAULT(UseCompressedOops, false);
-      return;
-    } else {
-      vm_exit_during_initialization(
-        "Class Data Sharing is not supported with compressed oops yet", NULL);
-    }
-  } else if (UseSharedSpaces) {
-    // UseSharedSpaces is on by default. With compressed oops, we turn it off.
-    FLAG_SET_DEFAULT(UseSharedSpaces, false);
-  }
-#endif
-}
-
 void Arguments::set_tiered_flags() {
+  // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
   if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
-    FLAG_SET_DEFAULT(CompilationPolicyChoice, 2);
+    FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
   }
   if (CompilationPolicyChoice < 2) {
     vm_exit_during_initialization(
@@ -1122,40 +1102,28 @@
     set_parnew_gc_flags();
   }
 
+  // MaxHeapSize is aligned down in collectorPolicy
+  size_t max_heap = align_size_down(MaxHeapSize,
+                                    CardTableRS::ct_max_alignment_constraint());
+
   // Now make adjustments for CMS
-  size_t young_gen_per_worker;
-  intx new_ratio;
-  size_t min_new_default;
-  intx tenuring_default;
-  if (CMSUseOldDefaults) {  // old defaults: "old" as of 6.0
-    if FLAG_IS_DEFAULT(CMSYoungGenPerWorker) {
-      FLAG_SET_ERGO(intx, CMSYoungGenPerWorker, 4*M);
-    }
-    young_gen_per_worker = 4*M;
-    new_ratio = (intx)15;
-    min_new_default = 4*M;
-    tenuring_default = (intx)0;
-  } else { // new defaults: "new" as of 6.0
-    young_gen_per_worker = CMSYoungGenPerWorker;
-    new_ratio = (intx)7;
-    min_new_default = 16*M;
-    tenuring_default = (intx)4;
-  }
-
-  // Preferred young gen size for "short" pauses
+  intx   tenuring_default = (intx)6;
+  size_t young_gen_per_worker = CMSYoungGenPerWorker;
+
+  // Preferred young gen size for "short" pauses:
+  // upper bound depends on # of threads and NewRatio.
   const uintx parallel_gc_threads =
     (ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
   const size_t preferred_max_new_size_unaligned =
-    ScaleForWordSize(young_gen_per_worker * parallel_gc_threads);
-  const size_t preferred_max_new_size =
+    MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
+  size_t preferred_max_new_size =
     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
 
   // Unless explicitly requested otherwise, size young gen
-  // for "short" pauses ~ 4M*ParallelGCThreads
+  // for "short" pauses ~ CMSYoungGenPerWorker*ParallelGCThreads
 
   // If either MaxNewSize or NewRatio is set on the command line,
   // assume the user is trying to set the size of the young gen.
-
   if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
 
     // Set MaxNewSize to our calculated preferred_max_new_size unless
@@ -1168,49 +1136,13 @@
     }
     if (PrintGCDetails && Verbose) {
       // Too early to use gclog_or_tty
-      tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
+      tty->print_cr("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
     }
 
-    // Unless explicitly requested otherwise, prefer a large
-    // Old to Young gen size so as to shift the collection load
-    // to the old generation concurrent collector
-
-    // If this is only guarded by FLAG_IS_DEFAULT(NewRatio)
-    // then NewSize and OldSize may be calculated.  That would
-    // generally lead to some differences with ParNewGC for which
-    // there was no obvious reason.  Also limit to the case where
-    // MaxNewSize has not been set.
-
-    FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio));
-
     // Code along this path potentially sets NewSize and OldSize
 
-    // Calculate the desired minimum size of the young gen but if
-    // NewSize has been set on the command line, use it here since
-    // it should be the final value.
-    size_t min_new;
-    if (FLAG_IS_DEFAULT(NewSize)) {
-      min_new = align_size_up(ScaleForWordSize(min_new_default),
-                              os::vm_page_size());
-    } else {
-      min_new = NewSize;
-    }
-    size_t prev_initial_size = InitialHeapSize;
-    if (prev_initial_size != 0 && prev_initial_size < min_new + OldSize) {
-      FLAG_SET_ERGO(uintx, InitialHeapSize, min_new + OldSize);
-      // Currently minimum size and the initial heap sizes are the same.
-      set_min_heap_size(InitialHeapSize);
-      if (PrintGCDetails && Verbose) {
-        warning("Initial heap size increased to " SIZE_FORMAT " M from "
-                SIZE_FORMAT " M; use -XX:NewSize=... for finer control.",
-                InitialHeapSize/M, prev_initial_size/M);
-      }
-    }
-
-    // MaxHeapSize is aligned down in collectorPolicy
-    size_t max_heap =
-      align_size_down(MaxHeapSize,
-                      CardTableRS::ct_max_alignment_constraint());
+    assert(max_heap >= InitialHeapSize, "Error");
+    assert(max_heap >= NewSize, "Error");
 
     if (PrintGCDetails && Verbose) {
       // Too early to use gclog_or_tty
@@ -1219,7 +1151,11 @@
            " max_heap: " SIZE_FORMAT,
            min_heap_size(), InitialHeapSize, max_heap);
     }
-    if (max_heap > min_new) {
+    size_t min_new = preferred_max_new_size;
+    if (FLAG_IS_CMDLINE(NewSize)) {
+      min_new = NewSize;
+    }
+    if (max_heap > min_new && min_heap_size() > min_new) {
       // Unless explicitly requested otherwise, make young gen
       // at least min_new, and at most preferred_max_new_size.
       if (FLAG_IS_DEFAULT(NewSize)) {
@@ -1227,18 +1163,17 @@
         FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
         if (PrintGCDetails && Verbose) {
           // Too early to use gclog_or_tty
-          tty->print_cr("Ergo set NewSize: " SIZE_FORMAT, NewSize);
+          tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
         }
       }
       // Unless explicitly requested otherwise, size old gen
-      // so that it's at least 3X of NewSize to begin with;
-      // later NewRatio will decide how it grows; see above.
+      // so it's NewRatio x of NewSize.
       if (FLAG_IS_DEFAULT(OldSize)) {
         if (max_heap > NewSize) {
-          FLAG_SET_ERGO(uintx, OldSize, MIN2(3*NewSize, max_heap - NewSize));
+          FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
           if (PrintGCDetails && Verbose) {
             // Too early to use gclog_or_tty
-            tty->print_cr("Ergo set OldSize: " SIZE_FORMAT, OldSize);
+            tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
           }
         }
       }
@@ -1382,7 +1317,7 @@
 void Arguments::set_ergonomics_flags() {
   // Parallel GC is not compatible with sharing. If one specifies
   // that they want sharing explicitly, do not set ergonomics flags.
-  if (DumpSharedSpaces || ForceSharedSpaces) {
+  if (DumpSharedSpaces || RequireSharedSpaces) {
     return;
   }
 
@@ -1689,13 +1624,13 @@
 }
 
 bool Arguments::verify_min_value(intx val, intx min, const char* name) {
-  // Returns true if given value is greater than specified min threshold
+  // Returns true if given value is at least specified min threshold
   // false, otherwise.
   if (val >= min ) {
       return true;
   }
   jio_fprintf(defaultStream::error_stream(),
-              "%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n",
+              "%s of " INTX_FORMAT " is invalid; must be at least " INTX_FORMAT "\n",
               name, val, min);
   return false;
 }
@@ -1845,33 +1780,6 @@
 
   status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
 
-  // Check whether user-specified sharing option conflicts with GC or page size.
-  // Both sharing and large pages are enabled by default on some platforms;
-  // large pages override sharing only if explicitly set on the command line.
-  const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
-          UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
-          UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
-  if (cannot_share) {
-    // Either force sharing on by forcing the other options off, or
-    // force sharing off.
-    if (DumpSharedSpaces || ForceSharedSpaces) {
-      jio_fprintf(defaultStream::error_stream(),
-                  "Using Serial GC and default page size because of %s\n",
-                  ForceSharedSpaces ? "-Xshare:on" : "-Xshare:dump");
-      force_serial_gc();
-      FLAG_SET_DEFAULT(UseLargePages, false);
-    } else {
-      if (UseSharedSpaces && Verbose) {
-        jio_fprintf(defaultStream::error_stream(),
-                    "Turning off use of shared archive because of "
-                    "choice of garbage collector or large pages\n");
-      }
-      no_shared_spaces();
-    }
-  } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) {
-    FLAG_SET_DEFAULT(UseLargePages, false);
-  }
-
   status = status && check_gc_consistency();
   status = status && check_stack_pages();
 
@@ -1949,6 +1857,8 @@
     status = false;
   }
 
+  status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
+
 #ifndef SERIALGC
   if (UseG1GC) {
     status = status && verify_percentage(InitiatingHeapOccupancyPercent,
@@ -2412,9 +2322,6 @@
     } else if (match_option(option, "-Xshare:on", &tail)) {
       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
-#ifdef TIERED
-      FLAG_SET_CMDLINE(bool, ForceSharedSpaces, true);
-#endif // TIERED
     // -Xshare:auto
     } else if (match_option(option, "-Xshare:auto", &tail)) {
       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
@@ -2911,6 +2818,52 @@
   return JNI_OK;
 }
 
+void Arguments::set_shared_spaces_flags() {
+  const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
+  const bool might_share = must_share || UseSharedSpaces;
+
+  // The string table is part of the shared archive so the size must match.
+  if (!FLAG_IS_DEFAULT(StringTableSize)) {
+    // Disable sharing.
+    if (must_share) {
+      warning("disabling shared archive %s because of non-default "
+              "StringTableSize", DumpSharedSpaces ? "creation" : "use");
+    }
+    if (might_share) {
+      FLAG_SET_DEFAULT(DumpSharedSpaces, false);
+      FLAG_SET_DEFAULT(RequireSharedSpaces, false);
+      FLAG_SET_DEFAULT(UseSharedSpaces, false);
+    }
+    return;
+  }
+
+  // Check whether class data sharing settings conflict with GC, compressed oops
+  // or page size, and fix them up.  Explicit sharing options override other
+  // settings.
+  const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
+    UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
+    UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
+  if (cannot_share) {
+    if (must_share) {
+        warning("selecting serial gc and disabling large pages %s"
+                "because of %s", "" LP64_ONLY("and compressed oops "),
+                DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
+        force_serial_gc();
+        FLAG_SET_CMDLINE(bool, UseLargePages, false);
+        LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
+    } else {
+      if (UseSharedSpaces && Verbose) {
+        warning("turning off use of shared archive because of "
+                "choice of garbage collector or large pages");
+      }
+      no_shared_spaces();
+    }
+  } else if (UseLargePages && might_share) {
+    // Disable large pages to allow shared spaces.  This is sub-optimal, since
+    // there may not even be a shared archive to use.
+    FLAG_SET_DEFAULT(UseLargePages, false);
+  }
+}
 
 // Parse entry point called from JNI_CreateJavaVM
 
@@ -3039,6 +2992,12 @@
     }
     ScavengeRootsInCode = 1;
   }
+  if (!JavaObjectsInPerm && ScavengeRootsInCode == 0) {
+    if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
+      warning("forcing ScavengeRootsInCode non-zero because JavaObjectsInPerm is false");
+    }
+    ScavengeRootsInCode = 1;
+  }
 
   if (PrintGCDetails) {
     // Turn on -verbose:gc options as well
@@ -3058,9 +3017,7 @@
   // Set flags based on ergonomics.
   set_ergonomics_flags();
 
-  if (UseCompressedOops) {
-    check_compressed_oops_compat();
-  }
+  set_shared_spaces_flags();
 
   // Check the GC selections again.
   if (!check_gc_consistency()) {
@@ -3078,22 +3035,17 @@
   }
 
 #ifndef KERNEL
-  if (UseConcMarkSweepGC) {
-    // Set flags for CMS and ParNew.  Check UseConcMarkSweep first
-    // to ensure that when both UseConcMarkSweepGC and UseParNewGC
-    // are true, we don't call set_parnew_gc_flags() as well.
+  // Set heap size based on available physical memory
+  set_heap_size();
+  // Set per-collector flags
+  if (UseParallelGC || UseParallelOldGC) {
+    set_parallel_gc_flags();
+  } else if (UseConcMarkSweepGC) { // should be done before ParNew check below
     set_cms_and_parnew_gc_flags();
-  } else {
-    // Set heap size based on available physical memory
-    set_heap_size();
-    // Set per-collector flags
-    if (UseParallelGC || UseParallelOldGC) {
-      set_parallel_gc_flags();
-    } else if (UseParNewGC) {
-      set_parnew_gc_flags();
-    } else if (UseG1GC) {
-      set_g1_gc_flags();
-    }
+  } else if (UseParNewGC) {  // skipped if CMS is set above
+    set_parnew_gc_flags();
+  } else if (UseG1GC) {
+    set_g1_gc_flags();
   }
 #endif // KERNEL
 
@@ -3110,7 +3062,11 @@
   // Turn off biased locking for locking debug mode flags,
   // which are subtlely different from each other but neither works with
   // biased locking.
-  if (!UseFastLocking || UseHeavyMonitors) {
+  if (UseHeavyMonitors
+#ifdef COMPILER1
+      || !UseFastLocking
+#endif // COMPILER1
+    ) {
     if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
       // flag set to true on command line; warn the user that they
       // can't enable biased locking here
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -301,8 +301,6 @@
 
   // Tiered
   static void set_tiered_flags();
-  // Check compressed oops compatibility with other flags
-  static void check_compressed_oops_compat();
   // CMS/ParNew garbage collectors
   static void set_parnew_gc_flags();
   static void set_cms_and_parnew_gc_flags();
@@ -312,6 +310,7 @@
   static void set_g1_gc_flags();
   // GC ergonomics
   static void set_ergonomics_flags();
+  static void set_shared_spaces_flags();
   // Setup heap size
   static void set_heap_size();
   // Based on automatic selection criteria, should the
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -32,6 +32,7 @@
 #include "oops/methodOop.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/nativeLookup.hpp"
+#include "runtime/advancedThresholdPolicy.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/handles.inline.hpp"
@@ -72,8 +73,15 @@
     Unimplemented();
 #endif
     break;
+  case 3:
+#ifdef TIERED
+    CompilationPolicy::set_policy(new AdvancedThresholdPolicy());
+#else
+    Unimplemented();
+#endif
+    break;
   default:
-    fatal("CompilationPolicyChoice must be in the range: [0-2]");
+    fatal("CompilationPolicyChoice must be in the range: [0-3]");
   }
   CompilationPolicy::policy()->initialize();
 }
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -101,9 +101,9 @@
   _frame_pcs                 = frame_pcs;
   _register_block            = NEW_C_HEAP_ARRAY(intptr_t, RegisterMap::reg_count * 2);
   _return_type               = return_type;
+  _initial_fp                = 0;
   // PD (x86 only)
   _counter_temp              = 0;
-  _initial_fp                = 0;
   _unpack_kind               = 0;
   _sender_sp_temp            = 0;
 
@@ -459,18 +459,9 @@
                                       frame_sizes,
                                       frame_pcs,
                                       return_type);
-#if defined(IA32) || defined(AMD64)
-  // We need a way to pass fp to the unpacking code so the skeletal frames
-  // come out correct. This is only needed for x86 because of c2 using ebp
-  // as an allocatable register. So this update is useless (and harmless)
-  // on the other platforms. It would be nice to do this in a different
-  // way but even the old style deoptimization had a problem with deriving
-  // this value. NEEDS_CLEANUP
-  // Note: now that c1 is using c2's deopt blob we must do this on all
-  // x86 based platforms
-  intptr_t** fp_addr = (intptr_t**) (((address)info) + info->initial_fp_offset_in_bytes());
-  *fp_addr = array->sender().fp(); // was adapter_caller
-#endif /* IA32 || AMD64 */
+  // On some platforms, we need a way to pass fp to the unpacking code
+  // so the skeletal frames come out correct.
+  info->set_initial_fp((intptr_t) array->sender().fp());
 
   if (array->frames() > 1) {
     if (VerifyStack && TraceDeoptimization) {
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -136,12 +136,12 @@
     address*  _frame_pcs;                 // Array of frame pc's, in bytes, for unrolling the stack
     intptr_t* _register_block;            // Block for storing callee-saved registers.
     BasicType _return_type;               // Tells if we have to restore double or long return value
+    intptr_t  _initial_fp;                // FP of the sender frame
     // The following fields are used as temps during the unpacking phase
     // (which is tight on registers, especially on x86). They really ought
     // to be PD variables but that involves moving this class into its own
     // file to use the pd include mechanism. Maybe in a later cleanup ...
     intptr_t  _counter_temp;              // SHOULD BE PD VARIABLE (x86 frame count temp)
-    intptr_t  _initial_fp;                // SHOULD BE PD VARIABLE (x86/c2 initial ebp)
     intptr_t  _unpack_kind;               // SHOULD BE PD VARIABLE (x86 unpack kind)
     intptr_t  _sender_sp_temp;            // SHOULD BE PD VARIABLE (x86 sender_sp)
    public:
@@ -165,6 +165,8 @@
     // Returns the total size of frames
     int size_of_frames() const;
 
+    void set_initial_fp(intptr_t fp) { _initial_fp = fp; }
+
     // Accessors used by the code generator for the unpack stub.
     static int size_of_deoptimized_frame_offset_in_bytes() { return offset_of(UnrollBlock, _size_of_deoptimized_frame); }
     static int caller_adjustment_offset_in_bytes()         { return offset_of(UnrollBlock, _caller_adjustment);         }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -851,7 +851,7 @@
   diagnostic(bool, TraceNMethodInstalls, false,                             \
              "Trace nmethod intallation")                                   \
                                                                             \
-  diagnostic(intx, ScavengeRootsInCode, 0,                                  \
+  diagnostic(intx, ScavengeRootsInCode, 1,                                  \
              "0: do not allow scavengable oops in the code cache; "         \
              "1: allow scavenging from the code cache; "                    \
              "2: emit as many constants as the compiler can see")           \
@@ -1221,6 +1221,11 @@
           "Decay time (in milliseconds) to re-enable bulk rebiasing of a "  \
           "type after previous bulk rebias")                                \
                                                                             \
+  develop(bool, JavaObjectsInPerm, false,                                   \
+          "controls whether Classes and interned Strings are allocated"     \
+          "in perm.  This purely intended to allow debugging issues"        \
+          "in production.")                                                 \
+                                                                            \
   /* tracing */                                                             \
                                                                             \
   notproduct(bool, TraceRuntimeCalls, false,                                \
@@ -1540,12 +1545,8 @@
   product(bool, AlwaysPreTouch, false,                                      \
           "It forces all freshly committed pages to be pre-touched.")       \
                                                                             \
-  product(bool, CMSUseOldDefaults, false,                                   \
-          "A flag temporarily introduced to allow reverting to some "       \
-          "older default settings; older as of 6.0")                        \
-                                                                            \
-  product(intx, CMSYoungGenPerWorker, 16*M,                                 \
-          "The amount of young gen chosen by default per GC worker "        \
+  product_pd(intx, CMSYoungGenPerWorker,                                    \
+          "The maximum size of young gen chosen by default per GC worker "  \
           "thread available")                                               \
                                                                             \
   product(bool, GCOverheadReporting, false,                                 \
@@ -3653,9 +3654,6 @@
   product(bool, RequireSharedSpaces, false,                                 \
           "Require shared spaces in the permanent generation")              \
                                                                             \
-  product(bool, ForceSharedSpaces, false,                                   \
-          "Require shared spaces in the permanent generation")              \
-                                                                            \
   product(bool, DumpSharedSpaces, false,                                    \
            "Special mode: JVM reads a class list, loads classes, builds "   \
             "shared spaces, and dumps the shared spaces to a file to be "   \
@@ -3719,6 +3717,13 @@
   experimental(bool, AllowTransitionalJSR292, true,                         \
           "recognize pre-PFD formats of invokedynamic")                     \
                                                                             \
+  experimental(bool, PreferTransitionalJSR292, false,                       \
+          "prefer pre-PFD APIs on boot class path, if they exist")          \
+                                                                            \
+  experimental(bool, AllowInvokeForInvokeGeneric, false,                    \
+          "accept MethodHandle.invoke and MethodHandle.invokeGeneric "      \
+          "as equivalent methods")                                          \
+                                                                            \
   develop(bool, TraceInvokeDynamic, false,                                  \
           "trace internal invoke dynamic operations")                       \
                                                                             \
@@ -3751,6 +3756,9 @@
   diagnostic(bool, PrintDTraceDOF, false,                                   \
              "Print the DTrace DOF passed to the system for JSDT probes")   \
                                                                             \
+  product(uintx, StringTableSize, 1009,                                     \
+          "Number of buckets in the interned String table")                 \
+                                                                            \
   product(bool, UseVMInterruptibleIO, false,                                \
           "(Unstable, Solaris-specific) Thread interrupt before or with "   \
           "EINTR for I/O operations results in OS_INTRPT. The default value"\
--- a/hotspot/src/share/vm/runtime/os.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -633,10 +633,10 @@
       *q = (u_char)freeBlockPad;
     }
     if (PrintMalloc && tty != NULL)
-      fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, memblock);
+      fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (uintptr_t)memblock);
   } else if (PrintMalloc && tty != NULL) {
     // tty->print_cr("os::free %p", memblock);
-    fprintf(stderr, "os::free " PTR_FORMAT "\n", memblock);
+    fprintf(stderr, "os::free " PTR_FORMAT "\n", (uintptr_t)memblock);
   }
 #endif
   ::free((char*)memblock - space_before);
@@ -1079,11 +1079,6 @@
         "%/lib/jsse.jar:"
         "%/lib/jce.jar:"
         "%/lib/charsets.jar:"
-
-        // ## TEMPORARY hack to keep the legacy launcher working when
-        // ## only the boot module is installed (cf. j.l.ClassLoader)
-        "%/lib/modules/jdk.boot.jar:"
-
         "%/classes";
     char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep);
     if (sysclasspath == NULL) return false;
--- a/hotspot/src/share/vm/runtime/osThread.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/osThread.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -65,7 +65,7 @@
   OSThreadStartFunc _start_proc;  // Thread start routine
   void* _start_parm;              // Thread start routine parameter
   volatile ThreadState _state;    // Thread state *hint*
-  jint _interrupted;              // Thread.isInterrupted state
+  volatile jint _interrupted;     // Thread.isInterrupted state
 
   // Note:  _interrupted must be jint, so that Java intrinsics can access it.
   // The value stored there must be either 0 or 1.  It must be possible
@@ -89,7 +89,7 @@
   void* start_parm() const                          { return _start_parm; }
   void set_start_parm(void* start_parm)             { _start_parm = start_parm; }
 
-  bool interrupted() const                          { return _interrupted != 0; }
+  volatile bool interrupted() const                 { return _interrupted != 0; }
   void set_interrupted(bool z)                      { _interrupted = z ? 1 : 0; }
 
   // Printing
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -649,7 +649,7 @@
       if (TraceClassResolution) {
         trace_class_resolution(k);
       }
-      return k->klass_part()->java_mirror();
+      return k->java_mirror();
   };
 }
 
--- a/hotspot/src/share/vm/runtime/serviceThread.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/serviceThread.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -70,11 +70,10 @@
     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
     java_lang_Thread::set_daemon(thread_oop());
     thread->set_threadObj(thread_oop());
+    _instance = thread;
 
     Threads::add(thread);
     Thread::start(thread);
-
-    _instance = thread;
   }
 }
 
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -426,9 +426,7 @@
       tty->vprint(format, ap);
       va_end(ap);
     }
-    tty->print_cr(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
-                  " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
-                  CodeCache::nof_blobs(), CodeCache::nof_nmethods(), CodeCache::nof_adapters(), CodeCache::unallocated_capacity());
+    CodeCache::log_state(tty); tty->cr();
   }
 
   if (LogCompilation && (xtty != NULL)) {
@@ -440,9 +438,7 @@
       xtty->vprint(format, ap);
       va_end(ap);
     }
-    xtty->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
-                " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
-                CodeCache::nof_blobs(), CodeCache::nof_nmethods(), CodeCache::nof_adapters(), CodeCache::unallocated_capacity());
+    CodeCache::log_state(xtty);
     xtty->stamp();
     xtty->end_elem();
   }
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3166,7 +3166,7 @@
         fieldDescriptor fd;
         // Possible we might not find this field; if so, don't break
         if (ik->find_local_field(vmSymbols::frontCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
-          k()->bool_field_put(fd.offset(), true);
+          k()->java_mirror()->bool_field_put(fd.offset(), true);
         }
       }
 
@@ -3182,7 +3182,7 @@
           fieldDescriptor fd;
           // Possible we might not find this field: if so, silently don't break
           if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
-            k()->bool_field_put(fd.offset(), true);
+            k()->java_mirror()->bool_field_put(fd.offset(), true);
           }
         }
       }
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -269,7 +269,7 @@
   nonstatic_field(instanceKlass,               _inner_classes,                                typeArrayOop)                          \
   nonstatic_field(instanceKlass,               _nonstatic_field_size,                         int)                                   \
   nonstatic_field(instanceKlass,               _static_field_size,                            int)                                   \
-  nonstatic_field(instanceKlass,               _static_oop_field_size,                        int)                                   \
+  nonstatic_field(instanceKlass,               _static_oop_field_count,                       int)                                   \
   nonstatic_field(instanceKlass,               _nonstatic_oop_map_size,                       int)                                   \
   nonstatic_field(instanceKlass,               _is_marked_dependent,                          bool)                                  \
   nonstatic_field(instanceKlass,               _minor_version,                                u2)                                    \
@@ -840,7 +840,7 @@
   /* OSThread */                                                                                                                     \
   /************/                                                                                                                     \
                                                                                                                                      \
-  nonstatic_field(OSThread,                    _interrupted,                                  jint)                                  \
+  volatile_nonstatic_field(OSThread,           _interrupted,                                  jint)                                  \
                                                                                                                                      \
   /************************/                                                                                                         \
   /* OopMap and OopMapSet */                                                                                                         \
@@ -945,6 +945,15 @@
   static_field(Arguments,                      _num_jvm_args,                                 int)                                   \
   static_field(Arguments,                      _java_command,                                 char*)                                 \
                                                                                                                                      \
+  /*********************************/                                                                                                \
+  /* java_lang_Class fields        */                                                                                                \
+  /*********************************/                                                                                                \
+                                                                                                                                     \
+  static_field(java_lang_Class,                klass_offset,                                  int)                                   \
+  static_field(java_lang_Class,                resolved_constructor_offset,                   int)                                   \
+  static_field(java_lang_Class,                array_klass_offset,                            int)                                   \
+  static_field(java_lang_Class,                oop_size_offset,                               int)                                   \
+  static_field(java_lang_Class,                static_oop_field_count_offset,                 int)                                   \
                                                                                                                                      \
   /************************/                                                                                                         \
   /* Miscellaneous fields */                                                                                                         \
@@ -1414,6 +1423,7 @@
   declare_toplevel_type(intptr_t*)                                        \
    declare_unsigned_integer_type(InvocationCounter) /* FIXME: wrong type (not integer) */ \
   declare_toplevel_type(JavaThread*)                                      \
+  declare_toplevel_type(java_lang_Class)                                  \
   declare_toplevel_type(jbyte*)                                           \
   declare_toplevel_type(jbyte**)                                          \
   declare_toplevel_type(jint*)                                            \
@@ -1543,12 +1553,6 @@
                                                                           \
   declare_constant(SymbolTable::symbol_table_size)                        \
                                                                           \
-  /***************/                                                       \
-  /* StringTable */                                                       \
-  /***************/                                                       \
-                                                                          \
-  declare_constant(StringTable::string_table_size)                        \
-                                                                          \
   /********************/                                                  \
   /* SystemDictionary */                                                  \
   /********************/                                                  \
@@ -1700,15 +1704,6 @@
                                                                           \
   declare_constant(ConstantPoolCacheEntry::tosBits)                       \
                                                                           \
-  /*********************************/                                     \
-  /* java_lang_Class field offsets */                                     \
-  /*********************************/                                     \
-                                                                          \
-  declare_constant(java_lang_Class::hc_klass_offset)                      \
-  declare_constant(java_lang_Class::hc_array_klass_offset)                \
-  declare_constant(java_lang_Class::hc_resolved_constructor_offset)       \
-  declare_constant(java_lang_Class::hc_number_of_fake_oop_fields)         \
-                                                                          \
   /***************************************/                               \
   /* java_lang_Thread::ThreadStatus enum */                               \
   /***************************************/                               \
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -832,7 +832,7 @@
 
       // value
       int offset = fld.offset();
-      address addr = (address)k + offset;
+      address addr = (address)ikh->java_mirror() + offset;
 
       dump_field_value(writer, sig->byte_at(0), addr);
     }
--- a/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -101,7 +101,7 @@
     builder()->CreateStore(
       builder()->CreateInlineOop(
         JNIHandles::make_local(
-          target()->method_holder()->klass_part()->java_mirror())),
+          target()->method_holder()->java_mirror())),
       oop_tmp_slot());
 
     param_types.push_back(box_type);
--- a/hotspot/src/share/vm/utilities/debug.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_UTILITIES_DEBUG_HPP
 #define SHARE_VM_UTILITIES_DEBUG_HPP
 
+#include "prims/jvm.h"
 #include "utilities/globalDefinitions.hpp"
 
 #include <stdarg.h>
@@ -48,7 +49,7 @@
 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) {
   va_list argp;
   va_start(argp, format);
-  vsnprintf(_buf, bufsz, format, argp);
+  jio_vsnprintf(_buf, bufsz, format, argp);
   va_end(argp);
 }
 
@@ -61,7 +62,7 @@
 
   va_list argp;
   va_start(argp, format);
-  vsnprintf(buf_end, bufsz - len, format, argp);
+  jio_vsnprintf(buf_end, bufsz - len, format, argp);
   va_end(argp);
 }
 
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1185,7 +1185,7 @@
 // '%d' formats to indicate a 64-bit quantity; commonly "l" (in LP64) or "ll"
 // (in ILP32).
 
-#define BOOL_TO_STR(__b) (__b) ? "true" : "false"
+#define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false")
 
 // Format 32-bit quantities.
 #define INT32_FORMAT  "%d"
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -156,7 +156,7 @@
     tty->print_cr("/nFinished work gang %s: %d/%d sequence %d",
                   name(), finished_workers(), total_workers(),
                   _sequence_number);
-    }
+  }
 }
 
 void AbstractWorkGang::stop() {
--- a/hotspot/src/share/vm/utilities/workgroup.hpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/hotspot/src/share/vm/utilities/workgroup.hpp	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,20 @@
 # include "thread_windows.inline.hpp"
 #endif
 
+// Task class hierarchy:
+//   AbstractGangTask
+//     AbstractGangTaskWOopQueues
+//
+// Gang/Group class hierarchy:
+//   AbstractWorkGang
+//     WorkGang
+//       FlexibleWorkGang
+//         YieldingFlexibleWorkGang (defined in another file)
+//
+// Worker class hierarchy:
+//   GangWorker (subclass of WorkerThread)
+//     YieldingFlexibleGangWorker   (defined in another file)
+
 // Forward declarations of classes defined here
 
 class WorkGang;
--- a/hotspot/test/compiler/6987555/Test6987555.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6987555
- * @summary JSR 292 unboxing to a boolean value fails on big-endian SPARC
- *
- * @run main/othervm -Xint -ea -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6987555
- */
-
-import java.dyn.*;
-
-public class Test6987555 {
-    private static final Class   CLASS = Test6987555.class;
-    private static final String  NAME  = "foo";
-    private static final boolean DEBUG = false;
-
-    public static void main(String[] args) throws Throwable {
-        testboolean();
-        testbyte();
-        testchar();
-        testshort();
-        testint();
-    }
-
-    // boolean
-    static void testboolean() throws Throwable {
-        doboolean(false);
-        doboolean(true);
-    }
-    static void doboolean(boolean x) throws Throwable {
-        if (DEBUG)  System.out.println("boolean=" + x);
-        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(boolean.class, boolean.class));
-        MethodHandle mh2 = mh1.asType(MethodType.methodType(boolean.class, Boolean.class));
-        boolean a = (boolean) mh1.invokeExact(x);
-        boolean b = (boolean) mh2.invokeExact(Boolean.valueOf(x));
-        assert a == b : a + " != " + b;
-    }
-
-    // byte
-    static void testbyte() throws Throwable {
-        byte[] a = new byte[] {
-            Byte.MIN_VALUE,
-            Byte.MIN_VALUE + 1,
-            -0x0F,
-            -1,
-            0,
-            1,
-            0x0F,
-            Byte.MAX_VALUE - 1,
-            Byte.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            dobyte(a[i]);
-        }
-    }
-    static void dobyte(byte x) throws Throwable {
-        if (DEBUG)  System.out.println("byte=" + x);
-        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(byte.class, byte.class));
-        MethodHandle mh2 = mh1.asType(MethodType.methodType(byte.class, Byte.class));
-        byte a = (byte) mh1.invokeExact(x);
-        byte b = (byte) mh2.invokeExact(Byte.valueOf(x));
-        assert a == b : a + " != " + b;
-    }
-
-    // char
-    static void testchar() throws Throwable {
-        char[] a = new char[] {
-            Character.MIN_VALUE,
-            Character.MIN_VALUE + 1,
-            0x000F,
-            0x00FF,
-            0x0FFF,
-            Character.MAX_VALUE - 1,
-            Character.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            dochar(a[i]);
-        }
-    }
-    static void dochar(char x) throws Throwable {
-        if (DEBUG)  System.out.println("char=" + x);
-        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(char.class, char.class));
-        MethodHandle mh2 = mh1.asType(MethodType.methodType(char.class, Character.class));
-        char a = (char) mh1.invokeExact(x);
-        char b = (char) mh2.invokeExact(Character.valueOf(x));
-        assert a == b : a + " != " + b;
-    }
-
-    // short
-    static void testshort() throws Throwable {
-        short[] a = new short[] {
-            Short.MIN_VALUE,
-            Short.MIN_VALUE + 1,
-            -0x0FFF,
-            -0x00FF,
-            -0x000F,
-            -1,
-            0,
-            1,
-            0x000F,
-            0x00FF,
-            0x0FFF,
-            Short.MAX_VALUE - 1,
-            Short.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            doshort(a[i]);
-        }
-    }
-    static void doshort(short x) throws Throwable {
-        if (DEBUG)  System.out.println("short=" + x);
-        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(short.class, short.class));
-        MethodHandle mh2 = mh1.asType(MethodType.methodType(short.class, Short.class));
-        short a = (short) mh1.invokeExact(x);
-        short b = (short) mh2.invokeExact(Short.valueOf(x));
-        assert a == b : a + " != " + b;
-    }
-
-    // int
-    static void testint() throws Throwable {
-        int[] a = new int[] {
-            Integer.MIN_VALUE,
-            Integer.MIN_VALUE + 1,
-            -0x00000FFF,
-            -0x000000FF,
-            -0x0000000F,
-            -1,
-            0,
-            1,
-            0x0000000F,
-            0x000000FF,
-            0x00000FFF,
-            Integer.MAX_VALUE - 1,
-            Integer.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            doint(a[i]);
-        }
-    }
-    static void doint(int x) throws Throwable {
-        if (DEBUG)  System.out.println("int=" + x);
-        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(int.class, int.class));
-        MethodHandle mh2 = mh1.asType(MethodType.methodType(int.class, Integer.class));
-        int a = (int) mh1.invokeExact(x);
-        int b = (int) mh2.invokeExact(Integer.valueOf(x));
-        assert a == b : a + " != " + b;
-    }
-
-    public static boolean foo(boolean i) { return i; }
-    public static byte    foo(byte    i) { return i; }
-    public static char    foo(char    i) { return i; }
-    public static short   foo(short   i) { return i; }
-    public static int     foo(int     i) { return i; }
-}
--- a/hotspot/test/compiler/6991596/Test6991596.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,465 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/**
- * @test
- * @bug 6991596
- * @summary JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
- *
- * @run main/othervm -ea -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6991596
- */
-
-import java.dyn.*;
-
-public class Test6991596 {
-    private static final Class   CLASS = Test6991596.class;
-    private static final String  NAME  = "foo";
-    private static final boolean DEBUG = System.getProperty("DEBUG", "false").equals("true");
-
-    public static void main(String[] args) throws Throwable {
-        testboolean();
-        testbyte();
-        testchar();
-        testshort();
-        testint();
-        testlong();
-    }
-
-    // Helpers to get various methods.
-    static MethodHandle getmh1(Class ret, Class arg) throws NoAccessException {
-        return MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(ret, arg));
-    }
-    static MethodHandle getmh2(MethodHandle mh1, Class ret, Class arg) {
-        return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg));
-    }
-    static MethodHandle getmh3(MethodHandle mh1, Class ret, Class arg) {
-        return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg));
-    }
-
-    // test adapter_opt_i2i
-    static void testboolean() throws Throwable {
-        boolean[] a = new boolean[] {
-            true,
-            false
-        };
-        for (int i = 0; i < a.length; i++) {
-            doboolean(a[i]);
-        }
-    }
-    static void doboolean(boolean x) throws Throwable {
-        if (DEBUG)  System.out.println("boolean=" + x);
-
-        // boolean
-        {
-            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
-            MethodHandle mh2 = getmh2(mh1, boolean.class, boolean.class);
-            // TODO add this for all cases when the bugs are fixed.
-            //MethodHandle mh3 = getmh3(mh1, boolean.class, boolean.class);
-            boolean a = (boolean) mh1.invokeExact((boolean) x);
-            boolean b = (boolean) mh2.invokeExact(x);
-            //boolean c = mh3.<boolean>invokeExact((boolean) x);
-            check(x, a, b);
-            //check(x, c, x);
-        }
-
-        // byte
-        {
-            MethodHandle mh1 = getmh1(     byte.class,    byte.class   );
-            MethodHandle mh2 = getmh2(mh1, byte.class,    boolean.class);
-            byte a = (byte) mh1.invokeExact((byte) (x ? 1 : 0));
-            byte b = (byte) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // char
-        {
-            MethodHandle mh1 = getmh1(     char.class, char.class);
-            MethodHandle mh2 = getmh2(mh1, char.class, boolean.class);
-            char a = (char) mh1.invokeExact((char) (x ? 1 : 0));
-            char b = (char) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // short
-        {
-            MethodHandle mh1 = getmh1(     short.class, short.class);
-            MethodHandle mh2 = getmh2(mh1, short.class, boolean.class);
-            short a = (short) mh1.invokeExact((short) (x ? 1 : 0));
-            short b = (short) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-    }
-
-    static void testbyte() throws Throwable {
-        byte[] a = new byte[] {
-            Byte.MIN_VALUE,
-            Byte.MIN_VALUE + 1,
-            -0x0F,
-            -1,
-            0,
-            1,
-            0x0F,
-            Byte.MAX_VALUE - 1,
-            Byte.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            dobyte(a[i]);
-        }
-    }
-    static void dobyte(byte x) throws Throwable {
-        if (DEBUG)  System.out.println("byte=" + x);
-
-        // boolean
-        {
-            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
-            MethodHandle mh2 = getmh2(mh1, boolean.class, byte.class);
-            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
-            boolean b = (boolean) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // byte
-        {
-            MethodHandle mh1 = getmh1(     byte.class, byte.class);
-            MethodHandle mh2 = getmh2(mh1, byte.class, byte.class);
-            byte a = (byte) mh1.invokeExact((byte) x);
-            byte b = (byte) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // char
-        {
-            MethodHandle mh1 = getmh1(     char.class, char.class);
-            MethodHandle mh2 = getmh2(mh1, char.class, byte.class);
-            char a = (char) mh1.invokeExact((char) x);
-            char b = (char) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // short
-        {
-            MethodHandle mh1 = getmh1(     short.class, short.class);
-            MethodHandle mh2 = getmh2(mh1, short.class, byte.class);
-            short a = (short) mh1.invokeExact((short) x);
-            short b = (short) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-    }
-
-    static void testchar() throws Throwable {
-        char[] a = new char[] {
-            Character.MIN_VALUE,
-            Character.MIN_VALUE + 1,
-            0x000F,
-            0x00FF,
-            0x0FFF,
-            Character.MAX_VALUE - 1,
-            Character.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            dochar(a[i]);
-        }
-    }
-    static void dochar(char x) throws Throwable {
-        if (DEBUG)  System.out.println("char=" + x);
-
-        // boolean
-        {
-            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
-            MethodHandle mh2 = getmh2(mh1, boolean.class, char.class);
-            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
-            boolean b = (boolean) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // byte
-        {
-            MethodHandle mh1 = getmh1(     byte.class, byte.class);
-            MethodHandle mh2 = getmh2(mh1, byte.class, char.class);
-            byte a = (byte) mh1.invokeExact((byte) x);
-            byte b = (byte) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // char
-        {
-            MethodHandle mh1 = getmh1(     char.class, char.class);
-            MethodHandle mh2 = getmh2(mh1, char.class, char.class);
-            char a = (char) mh1.invokeExact((char) x);
-            char b = (char) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // short
-        {
-            MethodHandle mh1 = getmh1(     short.class, short.class);
-            MethodHandle mh2 = getmh2(mh1, short.class, char.class);
-            short a = (short) mh1.invokeExact((short) x);
-            short b = (short) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-    }
-
-    static void testshort() throws Throwable {
-        short[] a = new short[] {
-            Short.MIN_VALUE,
-            Short.MIN_VALUE + 1,
-            -0x0FFF,
-            -0x00FF,
-            -0x000F,
-            -1,
-            0,
-            1,
-            0x000F,
-            0x00FF,
-            0x0FFF,
-            Short.MAX_VALUE - 1,
-            Short.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            doshort(a[i]);
-        }
-    }
-    static void doshort(short x) throws Throwable {
-        if (DEBUG)  System.out.println("short=" + x);
-
-        // boolean
-        {
-            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
-            MethodHandle mh2 = getmh2(mh1, boolean.class, short.class);
-            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
-            boolean b = (boolean) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // byte
-        {
-            MethodHandle mh1 = getmh1(     byte.class, byte.class);
-            MethodHandle mh2 = getmh2(mh1, byte.class, short.class);
-            byte a = (byte) mh1.invokeExact((byte) x);
-            byte b = (byte) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // char
-        {
-            MethodHandle mh1 = getmh1(     char.class, char.class);
-            MethodHandle mh2 = getmh2(mh1, char.class, short.class);
-            char a = (char) mh1.invokeExact((char) x);
-            char b = (char) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // short
-        {
-            MethodHandle mh1 = getmh1(     short.class, short.class);
-            MethodHandle mh2 = getmh2(mh1, short.class, short.class);
-            short a = (short) mh1.invokeExact((short) x);
-            short b = (short) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-    }
-
-    static void testint() throws Throwable {
-        int[] a = new int[] {
-            Integer.MIN_VALUE,
-            Integer.MIN_VALUE + 1,
-            -0x0FFFFFFF,
-            -0x00FFFFFF,
-            -0x000FFFFF,
-            -0x0000FFFF,
-            -0x00000FFF,
-            -0x000000FF,
-            -0x0000000F,
-            -1,
-            0,
-            1,
-            0x0000000F,
-            0x000000FF,
-            0x00000FFF,
-            0x0000FFFF,
-            0x000FFFFF,
-            0x00FFFFFF,
-            0x0FFFFFFF,
-            Integer.MAX_VALUE - 1,
-            Integer.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            doint(a[i]);
-        }
-    }
-    static void doint(int x) throws Throwable {
-        if (DEBUG)  System.out.println("int=" + x);
-
-        // boolean
-        {
-            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
-            MethodHandle mh2 = getmh2(mh1, boolean.class, int.class);
-            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
-            boolean b = (boolean) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // byte
-        {
-            MethodHandle mh1 = getmh1(     byte.class, byte.class);
-            MethodHandle mh2 = getmh2(mh1, byte.class, int.class);
-            byte a = (byte) mh1.invokeExact((byte) x);
-            byte b = (byte) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // char
-        {
-            MethodHandle mh1 = getmh1(     char.class, char.class);
-            MethodHandle mh2 = getmh2(mh1, char.class, int.class);
-            char a = (char) mh1.invokeExact((char) x);
-            char b = (char) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // short
-        {
-            MethodHandle mh1 = getmh1(     short.class, short.class);
-            MethodHandle mh2 = getmh2(mh1, short.class, int.class);
-            short a = (short) mh1.invokeExact((short) x);
-            short b = (short) mh2.invokeExact(x);
-            assert a == b : a + " != " + b;
-            check(x, a, b);
-        }
-
-        // int
-        {
-            MethodHandle mh1 = getmh1(     int.class, int.class);
-            MethodHandle mh2 = getmh2(mh1, int.class, int.class);
-            int a = (int) mh1.invokeExact((int) x);
-            int b = (int) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-    }
-
-    // test adapter_opt_l2i
-    static void testlong() throws Throwable {
-        long[] a = new long[] {
-            Long.MIN_VALUE,
-            Long.MIN_VALUE + 1,
-            -0x000000000FFFFFFFL,
-            -0x0000000000FFFFFFL,
-            -0x00000000000FFFFFL,
-            -0x000000000000FFFFL,
-            -0x0000000000000FFFL,
-            -0x00000000000000FFL,
-            -0x000000000000000FL,
-            -1L,
-            0L,
-            1L,
-            0x000000000000000FL,
-            0x00000000000000FFL,
-            0x0000000000000FFFL,
-            0x0000000000000FFFL,
-            0x000000000000FFFFL,
-            0x00000000000FFFFFL,
-            0x0000000000FFFFFFL,
-            0x000000000FFFFFFFL,
-            Long.MAX_VALUE - 1,
-            Long.MAX_VALUE
-        };
-        for (int i = 0; i < a.length; i++) {
-            dolong(a[i]);
-        }
-    }
-    static void dolong(long x) throws Throwable {
-        if (DEBUG)  System.out.println("long=" + x);
-
-        // boolean
-        {
-            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
-            MethodHandle mh2 = getmh2(mh1, boolean.class, long.class);
-            boolean a = (boolean) mh1.invokeExact((x & 1L) == 1L);
-            boolean b = (boolean) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // byte
-        {
-            MethodHandle mh1 = getmh1(     byte.class, byte.class);
-            MethodHandle mh2 = getmh2(mh1, byte.class, long.class);
-            byte a = (byte) mh1.invokeExact((byte) x);
-            byte b = (byte) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // char
-        {
-            MethodHandle mh1 = getmh1(     char.class, char.class);
-            MethodHandle mh2 = getmh2(mh1, char.class, long.class);
-            char a = (char) mh1.invokeExact((char) x);
-            char b = (char) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // short
-        {
-            MethodHandle mh1 = getmh1(     short.class, short.class);
-            MethodHandle mh2 = getmh2(mh1, short.class, long.class);
-            short a = (short) mh1.invokeExact((short) x);
-            short b = (short) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-
-        // int
-        {
-            MethodHandle mh1 = getmh1(     int.class, int.class);
-            MethodHandle mh2 = getmh2(mh1, int.class, long.class);
-            int a = (int) mh1.invokeExact((int) x);
-            int b = (int) mh2.invokeExact(x);
-            check(x, a, b);
-        }
-    }
-
-    static void check(boolean x, boolean e, boolean a) { p(z2h(x), z2h(e), z2h(a)); assert e == a : z2h(x) + ": " + z2h(e) + " != " + z2h(a); }
-    static void check(boolean x, byte    e, byte    a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); }
-    static void check(boolean x, int     e, int     a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); }
-
-    static void check(int     x, boolean e, boolean a) { p(i2h(x), z2h(e), z2h(a)); assert e == a : i2h(x) + ": " + z2h(e) + " != " + z2h(a); }
-    static void check(int     x, byte    e, byte    a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
-    static void check(int     x, int     e, int     a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
-
-    static void check(long    x, boolean e, boolean a) { p(l2h(x), z2h(e), z2h(a)); assert e == a : l2h(x) + ": " + z2h(e) + " != " + z2h(a); }
-    static void check(long    x, byte    e, byte    a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); }
-    static void check(long    x, int     e, int     a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); }
-
-    static void p(String x, String e, String a) { if (DEBUG)  System.out.println(x + ": expected: " + e + ", actual: " + a); }
-
-    static String z2h(boolean x) { return x ? "1" : "0"; }
-    static String i2h(int     x) { return Integer.toHexString(x); }
-    static String l2h(long    x) { return Long.toHexString(x); }
-
-    // to int
-    public static boolean foo(boolean i) { return i; }
-    public static byte    foo(byte    i) { return i; }
-    public static char    foo(char    i) { return i; }
-    public static short   foo(short   i) { return i; }
-    public static int     foo(int     i) { return i; }
-}
--- a/jaxp/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/jaxp/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -108,3 +108,5 @@
 eab6f27131e4e2f0af0016b35b18ae65cdd249d9 jdk7-b131
 abe04c59a556a3821c30bd8839e3c74f5d4281d1 jdk7-b132
 8e1148c7911b02e00a727461525f239da025cab7 jdk7-b133
+d56b326ae0544fc16c3e0d0285876f3c82054db2 jdk7-b134
+4aa9916693dc1078580c1865e6f2584046851e5a jdk7-b135
--- a/jaxws/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/jaxws/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -108,3 +108,5 @@
 438abc0356cd97d91b25f67cd1abc9883e22f6ed jdk7-b131
 0e57c3272d377eee04cc32c898e9a558051516b0 jdk7-b132
 359d0c8c00a02d3a094c19f8a485b2217c99a4e0 jdk7-b133
+545de8303fec939db3892f7c324dd7df197e8f09 jdk7-b134
+d5fc61f18043765705ef22b57a68c924ab2f1a5b jdk7-b135
--- a/jdk/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -109,3 +109,5 @@
 6bbc7a4734952ae7604578f270e1566639fa8752 jdk7-b132
 5e5f68a01d12a4432172f384d5201f3a05254493 jdk7-b133
 554adcfb615e63e62af530b1c10fcf7813a75b26 jdk7-b134
+d8ced728159fbb2caa8b6adb477fd8efdbbdf179 jdk7-b135
+aa13e7702cd9d8aca9aa38f1227f966990866944 jdk7-b136
--- a/jdk/make/common/Defs-windows.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/Defs-windows.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -68,40 +68,10 @@
 # The following DLL's are considered MS runtime libraries and should
 #     not to be REBASEd, see deploy/make/common/Release.gmk.
 #     msvcr*.dll: Microsoft runtimes
-ifeq ($(ARCH_DATA_MODEL), 32)
-  ifeq ($(COMPILER_VERSION), VS2003)
-    MSVCRNN_DLL = msvcr71.dll
-    MSVCPNN_DLL = msvcp71.dll
-    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
-  endif
-  ifeq ($(COMPILER_VERSION), VS2005)
-    MSVCRNN_DLL = msvcr80.dll
-    MSVCPNN_DLL = msvcp80.dll
-    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
-  endif
-  ifeq ($(COMPILER_VERSION), VS2008)
-    MSVCRNN_DLL = msvcr90.dll
-    MSVCPNN_DLL = msvcp90.dll
-    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
-  endif
-  ifeq ($(COMPILER_VERSION), VS2010)
-    MSVCRNN_DLL = msvcr100.dll
-    MSVCPNN_DLL = msvcp100.dll
-    MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
-  endif
-endif
-
-ifeq ($(ARCH_DATA_MODEL), 64)
-  ifeq ($(COMPILER_VERSION), VS2008)
-    MSVCRNN_DLL = msvcr90.dll
-    MSVCPNN_DLL = msvcp90.dll
-    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
-  endif
-  ifeq ($(COMPILER_VERSION), VS2010)
-    MSVCRNN_DLL = msvcr100.dll
-    MSVCPNN_DLL = msvcp100.dll
-    MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
-  endif
+ifeq ($(COMPILER_VERSION), VS2010)
+  MSVCRNN_DLL = msvcr100.dll
+  MSVCPNN_DLL = msvcp100.dll
+  MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
 endif
 
 EXTRA_LFLAGS += /LIBPATH:$(DXSDK_LIB_PATH)
@@ -124,109 +94,31 @@
 endif
 
 ifeq ($(CC_VERSION),msvc)
-  # Visual Studio .NET 2003 or VS2003 compiler option definitions:
+  # Visual Studio compiler option definitions:
   #   -O1      Favors reduced size over speed (-Og     -Os -Oy -Ob2 -Gs -GF -Gy)
   #   -O2      Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
-  #   -Ox      Full optimization (use -O2)    (-Og -Oi -Ot -Oy -Ob2)
-  #              (Removed in Visual Studio 2005 or VS2005)
   #   -Ob2     More aggressive inlining
   #   -Og      Global optimizations
   #   -Oi      Replace some functions with intrinsic or special forms
-  #   -Op      Improve floating point calculations (disables some optimizations)
-  #              (Replaced with -fp:precise in VS2005, /Op is default now)
+  #   -fp:precise (should be the default)
+  #            Improve floating point calculations (disables some optimizations)
   #   -Os      Favor small code
   #   -Ot      Favor faster code
   #   -Oy      Frame pointer omission
-  #   -GB      Optimize for pentium (old VC6 option?)
-  #   -G6      VS2003 version of -GB?
+  #   -G6      Used to be -GB?
   #   -GF      Pool strings in read-only memory
   #   -Gf      Pool strings in read-write memory (the default)
   #   -Gs      Controls stack probess
-  #   -GS      Adds buffer overflow checks on stacks
-  #              (Default in VS2005)
-  #   -GX      Enables exception handling 
-  #              (Replaced with /EHsc in VS2005)
+  #   -GS      Adds buffer overflow checks on stacks (the default)
+  #   -EHsc    Enables exception handling 
   #   -Gy      Function level linking only
   #
-  # NOTE: With VC6, -Ox included -Gs.
-  # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
-  # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
-  #
 
   CC_OPT/NONE    = -Od
   CC_OPT/LOWER   = -O2
   CC_OPT/HIGHER  = -O3
   CC_OPT/HIGHEST = -O3
   
-  ifeq ($(COMPILER_VERSION), VC6)
-    # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
-    # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
-    AUTOMATIC_PCH_OPTION =
-    GX_OPTION = -GX
-    GZ_OPTION = -GZ
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      CC_OPT/HIGHEST = -Ox -Gy -Os -GB
-      CC_OPT/HIGHER  = -Ox -Gy -Os -GB
-      CC_OPT/LOWER   = -Ox -Gy -Os -GB
-    else
-      CC_OPT/HIGHEST = -Ox -Gy -Op
-      CC_OPT/HIGHER  = -Ox -Gy -Op
-      CC_OPT/LOWER   = -Ox -Gy -Op
-    endif
-  endif
-  
-  ifeq ($(COMPILER_VERSION), VS2003)
-    # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
-    AUTOMATIC_PCH_OPTION = -YX
-    # Also known as VC7 compiler
-    GX_OPTION = -GX
-    GZ_OPTION = -GZ
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      # Lowered opt level to try and reduce footprint, dll size especially.
-      #     Was: CC_OPT/HIGHEST = -O2 -G6
-      #     Was: CC_OPT/HIGHER  = -O2
-      CC_OPT/HIGHEST = -O2
-      CC_OPT/HIGHER  = -O1
-      CC_OPT/LOWER   = -O1
-    else
-      CC_OPT/HIGHEST = -O2 -Op
-      CC_OPT/HIGHER  = -O2 -Op
-      CC_OPT/LOWER   = -O1 -Op
-    endif
-  endif
-  
-  ifeq ($(COMPILER_VERSION), VS2005)
-    # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
-    AUTOMATIC_PCH_OPTION =
-    # VS2005 compiler, only with Platform SDK right now?
-    GX_OPTION = -EHsc
-    GZ_OPTION = -RTC1
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      CC_OPT/HIGHEST = -O2
-      CC_OPT/HIGHER  = -O1
-      CC_OPT/LOWER   = -O1
-    else
-      CC_OPT/HIGHEST = -O2
-      CC_OPT/HIGHER  = -O1
-      CC_OPT/LOWER   = -O1
-    endif
-  endif
-  ifeq ($(COMPILER_VERSION), VS2008)
-    # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
-    AUTOMATIC_PCH_OPTION =
-    GX_OPTION = -EHsc
-    GZ_OPTION = -RTC1
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      CC_OPT/HIGHEST = -O2
-      CC_OPT/HIGHER  = -O1
-      CC_OPT/LOWER   = -O1
-    else
-      CC_OPT/HIGHEST = -O2
-      CC_OPT/HIGHER  = -O1
-      CC_OPT/LOWER   = -O1
-    endif
-  endif
-
   ifeq ($(COMPILER_VERSION), VS2010)
     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
     AUTOMATIC_PCH_OPTION =
@@ -256,7 +148,7 @@
 
 # Select the runtime support library carefully, need to be consistent
 #
-# VS2003 compiler option definitions:
+# Visual Studio Runtime compiler option definitions:
 #   -MD        Use dynamic multi-threaded runtime library
 #   -MDd       Use debug version (don't use, doesn't mix with -MD DLL's)
 #   -MT        Use static multi-threaded runtime library (-ML is going away)
@@ -265,12 +157,9 @@
 #
 #      NOTE: We also will use /D _STATIC_CPPLIB  so we don't need msvcpnn.dll
 #
-# If MS_RUNTIME_STATIC is requested, use -MT only with VS2003.
-ifeq ($(MS_RUNTIME_STATIC),true)
-  ifeq ($(COMPILER_VERSION), VS2003)
-    MS_RUNTIME_OPTION=-MT
-  endif
-else
+# If MS_RUNTIME_STATIC is requested we may have a problem, it is no longer
+#     supported by VS2010
+ifneq ($(MS_RUNTIME_STATIC),true)
   MS_RUNTIME_OPTION=-MD
 endif
 # The _DEBUG macro option (changes things like malloc to use debug version)
@@ -302,7 +191,7 @@
 MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
 
 ifeq ($(CC_VERSION),msvc)
-  # VS2003 compiler option definitions:
+  # Visual Studio compiler option definitions:
   #   -Zi      Cause *.pdb file to be created, full debug information
   #   -Z7      Full debug inside the .obj, no .pdb
   #   -Zd      Basic debug, no local variables? In the .obj
@@ -317,31 +206,10 @@
   CFLAGS_OPT      = $(CC_OPT)
   CFLAGS_DBG      = -Od $(MS_RUNTIME_DEBUG_OPTION)
 
-  # REMIND: I don't see where CFLAGS_VS2005 is used. I suspect its
-  # pulled in as a combined "CFLAGS_$(COMPILER_VERSION)" string
-  # but the lack of this isn't causing any apparent build problems
-  # with VS 2010 but it could be causing compiler warnings.
-  # For now, I  will add it for all cases :
   CFLAGS_VS2010 += -Zc:wchar_t-
-  #
-  # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
-  # by default. However, we expect the wchar_t to be a typedef to the
-  # unsigned short data type. The -Zc:wchar_t- option restores the old
-  # behavior (as seen in VS2003) to avoid massive code modifications.
-  # When/if our code will be "C/C++ Standard"-compliant (at least in the area
-  # of handling the wchar_t type), the option won't be necessary.
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    CFLAGS_VS2005 += -Zc:wchar_t-
-  else
-    # The 64bit Platform SDK we use (April 2005) doesn't like this option
-    ifneq ($(CC_VER), 14.00.40310.41)
-      CFLAGS_VS2005 += -Zc:wchar_t-
-    endif
-  endif
 
   # All builds get the same runtime setting
   CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
-  
 
   LDEBUG = /debug
   
@@ -350,21 +218,9 @@
     LDEBUG += /pdb:NONE
   endif
   
-  # The new Platform SDK and VS2005 has /GS as a default and requires 
-  #    bufferoverflowU.lib on the link command line, otherwise 
-  #    we get missing __security_check_cookie externals at link time. 
-  BUFFEROVERFLOWLIB = bufferoverflowU.lib
-  # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
-  LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
-
-  # VS2008 has bufferoverflow baked in:
-  LFLAGS_VS2008 = 
-
   # VS2010, always need safe exception handlers, not needed on 64bit
   ifeq ($(ARCH_DATA_MODEL), 32)
-    LFLAGS_VS2010 =  -SAFESEH
-  else
-    LFLAGS_VS2010 =
+    LFLAGS_VS2010 +=  -SAFESEH
   endif
 
   # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
--- a/jdk/make/common/Defs.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/Defs.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -524,6 +524,10 @@
   COPYRIGHT_YEAR := $(shell $(DATE) '+%Y')
 endif
 
+ifndef OPENJDK
+include $(JDK_TOPDIR)/make/closed/common/Defs.gmk
+endif
+
 # Install of imported file (JDK_IMPORT_PATH, or some other external location)
 define install-importonly-file
 @$(ECHO) "ASSEMBLY_IMPORT: $@"
--- a/jdk/make/common/Release.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/Release.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -54,9 +54,6 @@
                         com.sun.java.swing.plaf.motif    \
                         com.sun.java.swing.plaf.gtk
 
-# This is a stopgap until 6839872 is fixed.
-EXCLUDE_PROPWARN_PKGS += sun.dyn
-
 #
 # Include the exported private packages in ct.sym.
 # This is an interim solution until the ct.sym is replaced
@@ -86,14 +83,7 @@
   IMAGE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
   IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
 else
-  # Where to find these files
-  ifeq ($(J4B), true)
-      SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdkfb
-      SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jrefb
-  else
-      SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk
-      SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre
-  endif
+  # make/closed/common/Defs.gmk for closed location of SHARE_JDK_DOC_SRC
 
   IMAGE_DOCLIST_JDK = COPYRIGHT README.html  THIRDPARTYLICENSEREADME.txt
   IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt
@@ -932,11 +922,6 @@
     ifeq ($(COMPILER_VERSION), VS2010)
 	$(CP) $(BINDIR)/msvc*100.$(LIBRARY_SUFFIX) $(JDK_IMAGE_DIR)/bin
     endif
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      ifeq ($(COMPILER_VERSION), VS2003)
-	$(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_IMAGE_DIR)/bin
-      endif
-    endif
   else # PLATFORM
 	@#
 	@# bin/
--- a/jdk/make/common/shared/Compiler-msvc.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/shared/Compiler-msvc.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -47,82 +47,8 @@
   # Compiler version and type (Always get word after "Version")
   CC_VER  := $(shell $(CC) 2>&1 | $(HEAD) -n 1 | $(SED) 's/.*\(Version.*\)/\1/' | $(NAWK) '{print $$2}')
 
-  # The MSDEVTOOLS_PATH is for older compilers, place for rc, mt, etc.
-  _OTHER_TOOLS_PATH = $(MSDEVTOOLS_PATH)
-
-  # SDK-64 and MSVC6 put REBASE.EXE in a different places - go figure...
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
-    CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
-    ifeq ($(CC_MAJORVER), 13)
-      # This should be: CC_VER=13.10.3077 LINK_VER=7.10.3077
-      COMPILER_NAME=Visual Studio .NET 2003 Professional C++
-      COMPILER_VERSION=VS2003
-      RC         = $(_OTHER_TOOLS_PATH)rc
-      REBASE     = $(COMPILER_PATH)../../Common7/Tools/Bin/rebase
-      MTL        = $(COMPILER_PATH)../../Common7/Tools/Bin/midl
-    endif
-    ifeq ($(CC_MAJORVER), 14)
-      COMPILER_NAME=Visual Studio 8
-      COMPILER_VERSION=VS2005
-      RC         = $(_OTHER_TOOLS_PATH)rc
-      REBASE     = $(COMPILER_PATH)../../Common8/Tools/Bin/rebase
-      MTL        = $(COMPILER_PATH)../../Common8/Tools/Bin/midl
-      MT         = $(_OTHER_TOOLS_PATH)/mt
-    endif
-    ifeq ($(CC_MAJORVER), 15)
-      COMPILER_NAME=Visual Studio 9
-      COMPILER_VERSION=VS2008
-      RC         = $(_OTHER_TOOLS_PATH)rc
-      #rebase and midl moved out of Visual Studio into the SDK:
-      REBASE     = $(_OTHER_TOOLS_PATH)/rebase
-      MTL        = $(_OTHER_TOOLS_PATH)/midl.exe
-      MT         = $(_OTHER_TOOLS_PATH)mt
-    endif
-  else
-    # else ARCH_DATA_MODEL is 64
-    LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
-    CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
-    CC_MINORVER :=$(call MinorVersion,$(CC_VER))
-    CC_MICROVER :=$(call MicroVersion,$(CC_VER))
-    ifeq ($(CC_MAJORVER), 13)
-      ifeq ($(ARCH), ia64)
-        # This should be: CC_VER=13.00.9337.7 LINK_VER=7.00.9337.7
-        COMPILER_NAME=Microsoft Platform SDK - November 2001 Edition
-        COMPILER_VERSION=VS2003
-        RC = $(_OTHER_TOOLS_PATH)rc
-      endif
-    endif
-    ifeq ($(CC_MAJORVER), 14)
-      ifeq ($(ARCH), amd64)
-        #rebase and midl moved out of Visual Studio into the SDK:
-        RC         = $(_OTHER_TOOLS_PATH)/rc
-        REBASE     = $(_OTHER_TOOLS_PATH)/rebase
-        MTL        = $(_OTHER_TOOLS_PATH)/midl.exe
-        ifeq ($(CC_MICROVER), 30701)
-          # This should be: CC_VER=14.00.30701 LINK_VER=8.00.30701
-	  # WARNING: it says 14, but it is such an early build it doesn't
-	  #          have all the VS2005 compiler option changes, so treat
-	  #          this like a VS2003 compiler.
-          COMPILER_NAME=Microsoft Platform SDK - February 2003 Edition
-          COMPILER_VERSION=VS2003
-        else
-          # This should be: CC_VER=14.00.40310.41 LINK_VER=8.00.40310.39
-	  COMPILER_NAME=Microsoft Platform SDK - April 2005 Edition (3790.1830)
-          COMPILER_VERSION=VS2005
-        endif
-      else
-        REBASE         = $(COMPILER_PATH)../rebase
-      endif
-    endif
-    ifeq ($(CC_MAJORVER), 15)
-      COMPILER_NAME=Microsoft Windows SDK with Visual Studio 9 (6001.18000.367)
-      COMPILER_VERSION=VS2008
-      RC = $(MSSDK61)/Bin/X64/rc.exe
-      MT = $(MSSDK61)/Bin/X64/mt.exe
-      MTL = $(MSSDK61)/Bin/X64/midl.exe
-    endif
-  endif
+  LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
+  CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
   
   # The VS2010 compiler is the same one used on both 32bit and 64bit
   ifeq ($(CC_MAJORVER), 16)
--- a/jdk/make/common/shared/Defs-versions.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/shared/Defs-versions.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -190,25 +190,10 @@
   REQUIRED_FREE_SPACE         = 500000
   REQUIRED_DXSDK_VER          = 0x0900
   ifeq ($(CC_VERSION),msvc)
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      REQUIRED_COMPILER_NAME    = Visual Studio 10
-      REQUIRED_COMPILER_VERSION = VS2010
-      REQUIRED_CC_VER           = 16.00.30319.01
-      REQUIRED_LINK_VER         = 10.00.30319.01
-    else
-      ifeq ($(ARCH), ia64)
-        REQUIRED_COMPILER_NAME    = Microsoft Platform SDK - November 2001 Edition
-        REQUIRED_COMPILER_VERSION = VS2003
-        REQUIRED_CC_VER           = 13.00.9337.7
-        REQUIRED_LINK_VER         = 7.00.9337.7
-      endif
-      ifeq ($(ARCH), amd64)
-        REQUIRED_COMPILER_NAME    = Visual Studio 10
-        REQUIRED_COMPILER_VERSION = VS2010
-        REQUIRED_CC_VER           = 16.00.30319.01
-        REQUIRED_LINK_VER         = 10.00.30319.01
-      endif
-    endif
+    REQUIRED_COMPILER_NAME    = Visual Studio 10
+    REQUIRED_COMPILER_VERSION = VS2010
+    REQUIRED_CC_VER           = 16.00.30319.01
+    REQUIRED_LINK_VER         = 10.00.30319.01
   endif
   ifeq ($(CC_VERSION),gcc)
     REQUIRED_CC_VER           = 3.4.3
--- a/jdk/make/common/shared/Defs-windows.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/shared/Defs-windows.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -333,136 +333,26 @@
   export WINDOWSSDKDIR
 endif
 
-# Setup for VS2010 is simple, others logic is historic
-ifeq ($(VS2010_EXISTS),true)
-  
-  # VS2010 Compiler root directory
-  _msvc_dir :=$(VS100COMNTOOLS)/../../Vc
-  # SDK root directory
-  _ms_sdk   :=$(WINDOWSSDKDIR)
-  # Compiler bin directory and redist directory
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    _compiler_bin :=$(_msvc_dir)/Bin
-    _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT)
-  endif
-  ifeq ($(ARCH_DATA_MODEL), 64)
-    _compiler_bin :=$(_msvc_dir)/bin/amd64
-    _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT)
-  endif
-  ifeq ($(_redist_sdk),)
-    _redist_sdk   :=$(_system_root)/system32
-  endif
-
-else # Not VS2010
-
-  # Compilers, SDK, and Visual Studio (MSDEV) [32bit is different from 64bit]
-  ifeq ($(ARCH_DATA_MODEL), 32)
+ifneq ($(VS2010_EXISTS),true)
+  x:=$(error ERROR: No VS2010 found on system.)
+endif 
 
-    # Try looking in MSVCDIR or MSVCDir area first 
-    # (set by vcvars32.bat for VC .NET, not defined in the VC 2008/2010)
-    ifdef MSVCDIR
-      xMSVCDIR  :="$(subst \,/,$(MSVCDIR))"
-      _msvc_dir :=$(call FullPath,$(xMSVCDIR))
-    else
-      ifdef MSVCDir
-        xMSVCDIR  :="$(subst \,/,$(MSVCDir))"
-        _msvc_dir :=$(call FullPath,$(xMSVCDIR))
-      endif
-    endif
-    # If we still don't have it, look for VSnnCOMNTOOLS (newest first),
-    # set by installer?
-    ifeq ($(_msvc_dir),)
-      ifdef VS90COMNTOOLS  # /Common/Tools directory, use ../../Vc
-        xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))"
-        _vs90tools     :=$(call FullPath,$(xVS90COMNTOOLS))
-      endif
-      ifneq ($(_vs90tools),)
-        _msvc_dir   :=$(_vs90tools)/../../Vc
-      else
-        ifdef VS80COMNTOOLS  # /Common/Tools directory, use ../../Vc
-          xVS80COMNTOOLS :="$(subst \,/,$(VS80COMNTOOLS))"
-          _vs80tools     :=$(call FullPath,$(xVS80COMNTOOLS))
-        endif
-        ifneq ($(_vs80tools),)
-          _msvc_dir   :=$(_vs80tools)/../../Vc
-        else
-          ifdef VS71COMNTOOLS  # /Common/Tools directory, use ../../Vc7
-            xVS71COMNTOOLS :="$(subst \,/,$(VS71COMNTOOLS))"
-            _vs71tools     :=$(call FullPath,$(xVS71COMNTOOLS))
-          endif
-          ifneq ($(_vs71tools),)
-            _msvc_dir   :=$(_vs71tools)/../../Vc7
-          endif
-        endif
-      endif
-    endif
-  
-    ifneq ($(_msvc_dir),)
-      _compiler_bin :=$(_msvc_dir)/Bin
-      # Assume PlatformSDK is in VS71 (will be empty if VS90)
-      _ms_sdk       :=$(call FullPath,$(_msvc_dir)/PlatformSDK)
-      _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC90.CRT)
-      ifeq ($(_redist_sdk),)
-        _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC80.CRT)
-        ifeq ($(_redist_sdk),)
-          _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v1.1/Bin)
-        endif
-      endif
-    endif
-  endif
-
-  # The Microsoft Platform SDK installed by itself
-  ifneq ($(_program_files),)
-    _PSDK :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
-    _psdk :=$(call FullPath,$(xMSSDK61))
-    ifeq ($(_psdk),)
-      xPSDK  :="$(_program_files)/Microsoft Platform SDK"
-      _psdk  :=$(call FullPath,$(xPSDK))
-      ifeq ($(_psdk),)
-        xPSDK  :="$(_program_files)/Microsoft SDK"
-        _psdk :=$(call FullPath,$(xMSSDK))
-      endif
-    endif
-  endif
-
-  # If no SDK found yet, look in other places
-  ifeq ($(_ms_sdk),)
-    ifdef MSSDK
-    xMSSDK  :="$(subst \,/,$(MSSDK))"
-    _ms_sdk :=$(call FullPath,$(xMSSDK))
-  else
-    ifdef MSSdk
-      xMSSDK  :="$(subst \,/,$(MSSdk))"
-      _ms_sdk :=$(call FullPath,$(xMSSDK))
-    else
-        _ms_sdk :=$(_psdk)
-      endif
-    endif
-  endif
-  
-  # Compilers for 64bit may be from the free SDK, or Visual Studio Professional.
-  ifeq ($(ARCH_DATA_MODEL), 64)
-    xVS2008 :="$(_program_files32)/Microsoft Visual Studio 9.0/"
-    VS2008 :=$(call FullPath,$(xVS2008))
-    ifneq ($(VS2008),)
-      _compiler_bin :=$(VS2008)/VC/Bin/$(ARCH)
-      xMSSDK61      :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
-      MSSDK61       :=$(call FullPath,$(xMSSDK61))
-      _redist_sdk   :=$(VS2008)/VC/redist/x64/Microsoft.VC90.CRT
-    else
-      ifneq ($(_ms_sdk),)
-        ifeq ($(ARCH), ia64)
-          _compiler_bin :=$(_ms_sdk)/Bin/Win64
-        endif
-        ifeq ($(ARCH), amd64)
-          _compiler_bin :=$(_ms_sdk)/Bin/Win64/x86/$(ARCH)
-          _redist_sdk   :=$(_ms_sdk)/redist/win64/AMD64
-        endif
-      endif
-    endif
-  endif
-
-endif # VS2010_EXISTS
+# VS2010 Compiler root directory
+_msvc_dir :=$(VS100COMNTOOLS)/../../Vc
+# SDK root directory
+_ms_sdk   :=$(WINDOWSSDKDIR)
+# Compiler bin directory and redist directory
+ifeq ($(ARCH_DATA_MODEL), 32)
+  _compiler_bin :=$(_msvc_dir)/Bin
+  _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT)
+endif
+ifeq ($(ARCH_DATA_MODEL), 64)
+  _compiler_bin :=$(_msvc_dir)/bin/amd64
+  _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT)
+endif
+ifeq ($(_redist_sdk),)
+  _redist_sdk   :=$(_system_root)/system32
+endif
 
 # Location on system where jdk installs might be
 ifneq ($(_program_files),)
@@ -566,20 +456,8 @@
   _BOOTDIR3  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 endif
 
-# 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008
-ifeq ($(ARCH_DATA_MODEL), 32)
-  _NEEDS_MSVCRNN = true
-else
-  ifeq ($(VS2010_EXISTS),true)
-    _NEEDS_MSVCRNN = true
-  else 
-    ifneq ($(VS2008),)
-      _NEEDS_MSVCRNN = true
-    else
-      _NEEDS_MSVCRNN = false
-    endif
-  endif
-endif
+# Everybody needs the MSVCRNN runtime starting with VS2010
+_NEEDS_MSVCRNN = true
 
 ifeq ($(_NEEDS_MSVCRNN), true)
   # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed
@@ -758,8 +636,6 @@
 
 # Special define for checking the binaries
 
-ifeq ($(VS2010_EXISTS),true)
-
 # 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
@@ -841,12 +717,3 @@
 endef
 endif
 
-else
-
-# Macro to check it's input file for banned dependencies and verify the
-#   binary was built properly. Relies on process exit code.
-define binary_file_verification # binary_file
-endef
-
-endif
-
--- a/jdk/make/common/shared/Sanity.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/common/shared/Sanity.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -996,25 +996,15 @@
 ######################################################
 sane-msdevtools_path:
 ifeq ($(PLATFORM), windows)
-  ifneq ($(COMPILER_VERSION), VS2010)
-	@if [ "$(MSDEVTOOLS_PATH)" != "" -a ! -r "$(MSDEVTOOLS_PATH)" ]; then \
-	  $(ECHO) "ERROR: You do not have a valid MSDEVTOOLS_PATH setting. \n" \
-	    "      Please check your access to \n" \
-	    "          $(MSDEVTOOLS_PATH) \n" \
-	    "      and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
-	    "" >> $(ERROR_FILE) ; \
-	fi
-  else
-    ifeq ($(wildcard $(RC)),)
+  ifeq ($(wildcard $(RC)),)
 	@$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \
 	    "      This is normally obtained from the WINDOWSSDKDIR." \
 	    "" >> $(ERROR_FILE)
-    endif
-    ifeq ($(wildcard $(DUMPBIN)),)
+  endif
+  ifeq ($(wildcard $(DUMPBIN)),)
 	@$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
 	    "      This is normally obtained from the COMPILER_PATH." \
 	    "" >> $(ERROR_FILE)
-    endif
   endif
 endif
 
@@ -1432,7 +1422,6 @@
 ######################################################
 sane-install-mssdk_path:
 ifeq ($(PLATFORM), windows)
-  ifeq ($(COMPILER_VERSION), VS2010)
 	@if [ -z "$(WINDOWSSDKDIR)" ]; then \
 	  $(ECHO) "WARNING: Your WINDOWSSDKDIR setting is empty.\n" \
 	    "        It is recommended to set ALT_WINDOWSSDKDIR.\n" \
@@ -1445,7 +1434,6 @@
 	    "      and/or check your value of ALT_WINDOWSSDKDIR. \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
-  endif
 	@if [ -z "$(INSTALL_MSSDK)" ]; then \
 	  $(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \
 	    "        It is recommended to set ALT_INSTALL_MSSDK.\n" \
--- a/jdk/make/docs/CORE_PKGS.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/docs/CORE_PKGS.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2011, 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
@@ -55,7 +55,7 @@
 # This is a list of regular expressions. So foo.* matches "foo" and "foo.bar".
 #
 ACTIVE_JSR_PKGS= \
-  java.dyn \
+  java.lang.invoke \
   java.sql  \
   javax.activation  \
   javax.annotation.*  \
@@ -97,11 +97,11 @@
   java.awt.print                                 \
   java.beans                                     \
   java.beans.beancontext                         \
-  java.dyn                                       \
   java.io                                        \
   java.lang                                      \
   java.lang.annotation                           \
   java.lang.instrument                           \
+  java.lang.invoke                               \
   java.lang.management                           \
   java.lang.ref                                  \
   java.lang.reflect                              \
--- a/jdk/make/java/Makefile	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/java/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2011, 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
@@ -44,7 +44,7 @@
 SUBDIRS_desktop    = awt applet beans
 SUBDIRS_management = management
 SUBDIRS_misc       = npt java_crw_demo java_hprof_demo \
-                     logging instrument dyn sql rmi
+                     logging instrument invoke sql rmi
 
 
 ifeq ($(PLATFORM), solaris)
--- a/jdk/make/java/dyn/Makefile	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# Copyright (c) 2008, 2010, 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 = java.dyn
-PRODUCT = java
-include $(BUILDDIR)/common/Defs.gmk
-
-AUTO_FILES_JAVA_DIRS = java/dyn sun/dyn
-
-# The sources built here use new language syntax to generate
-# method handle calls.  Let's be sure we are using that format.
-LANGUAGE_VERSION = -source 7
-CLASS_VERSION = -target 7
-
-# Tell the compiler not to accept transitional forms.
-OTHER_JAVACFLAGS = -XDallowTransitionalJSR292=no
-
-include $(BUILDDIR)/common/Classes.gmk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/java/invoke/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 2008, 2011, 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 = java.lang.invoke
+PRODUCT = java
+include $(BUILDDIR)/common/Defs.gmk
+
+AUTO_FILES_JAVA_DIRS = java/lang/invoke sun/invoke
+FILES_java = \
+    java/lang/ClassValue.java \
+    java/lang/BootstrapMethodError.java
+
+# The sources built here use new language syntax to generate
+# method handle calls.  Let's be sure we are using that format.
+LANGUAGE_VERSION = -source 7
+CLASS_VERSION = -target 7
+
+include $(BUILDDIR)/common/Classes.gmk
--- a/jdk/make/java/text/base/FILES_java.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/java/text/base/FILES_java.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -136,6 +136,7 @@
         sun/text/resources/CollationData_sl.java \
         sun/text/resources/CollationData_sq.java \
         sun/text/resources/CollationData_sr.java \
+        sun/text/resources/CollationData_sr_Latn.java \
         sun/text/resources/CollationData_sv.java \
         sun/text/resources/CollationData_tr.java \
         sun/text/resources/CollationData_uk.java \
@@ -251,6 +252,10 @@
         sun/text/resources/FormatData_sr_CS.java \
         sun/text/resources/FormatData_sr_ME.java \
         sun/text/resources/FormatData_sr_RS.java \
+        sun/text/resources/FormatData_sr_Latn.java \
+        sun/text/resources/FormatData_sr_Latn_BA.java \
+        sun/text/resources/FormatData_sr_Latn_ME.java \
+        sun/text/resources/FormatData_sr_Latn_RS.java \
         sun/text/resources/FormatData_sv.java \
         sun/text/resources/FormatData_sv_SE.java \
         sun/text/resources/FormatData_tr.java \
--- a/jdk/make/java/util/FILES_properties.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/java/util/FILES_properties.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -65,6 +65,7 @@
         sun/util/resources/LocaleNames_sl.properties \
         sun/util/resources/LocaleNames_sq.properties \
         sun/util/resources/LocaleNames_sr.properties \
+        sun/util/resources/LocaleNames_sr_Latn.properties \
         sun/util/resources/LocaleNames_sv.properties \
         sun/util/resources/LocaleNames_tr.properties \
         sun/util/resources/LocaleNames_uk.properties \
@@ -111,6 +112,9 @@
         sun/util/resources/CalendarData_sl.properties \
         sun/util/resources/CalendarData_sq.properties \
         sun/util/resources/CalendarData_sr.properties \
+        sun/util/resources/CalendarData_sr_Latn_BA.properties \
+        sun/util/resources/CalendarData_sr_Latn_ME.properties \
+        sun/util/resources/CalendarData_sr_Latn_RS.properties \
         sun/util/resources/CalendarData_sv.properties \
         sun/util/resources/CalendarData_tr.properties \
         sun/util/resources/CalendarData_uk.properties \
@@ -186,6 +190,7 @@
         sun/util/resources/CurrencyNames_nl_NL.properties \
         sun/util/resources/CurrencyNames_no_NO.properties \
         sun/util/resources/CurrencyNames_pl_PL.properties \
+        sun/util/resources/CurrencyNames_pt.properties \
         sun/util/resources/CurrencyNames_pt_BR.properties \
         sun/util/resources/CurrencyNames_pt_PT.properties \
         sun/util/resources/CurrencyNames_ro_RO.properties \
@@ -196,6 +201,10 @@
         sun/util/resources/CurrencyNames_sr_BA.properties \
         sun/util/resources/CurrencyNames_sr_CS.properties \
         sun/util/resources/CurrencyNames_sr_ME.properties \
+        sun/util/resources/CurrencyNames_sr_RS.properties \
+        sun/util/resources/CurrencyNames_sr_Latn_BA.properties \
+        sun/util/resources/CurrencyNames_sr_Latn_ME.properties \
+        sun/util/resources/CurrencyNames_sr_Latn_RS.properties \
         sun/util/resources/CurrencyNames_sv.properties \
         sun/util/resources/CurrencyNames_sv_SE.properties \
         sun/util/resources/CurrencyNames_tr_TR.properties \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mkdemo/jfc/Laffy/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2011, 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 to build the Laffy demo.
+#
+
+BUILDDIR = ../../..
+PRODUCT = demo/jfc
+DEMONAME = Laffy
+include $(BUILDDIR)/common/Defs.gmk
+
+DEMO_ROOT       = $(CLOSED_SRC)/share/demo/jfc/$(DEMONAME)
+DEMO_DESTDIR    = $(DEMODIR)/jfc/$(DEMONAME)
+DEMO_TOPFILES	= ./readme.html ./laffy.png
+DEMO_SKIP_SRCZIP = true
+
+#
+# Demo jar building rules.
+#
+include $(BUILDDIR)/common/Demo.gmk
--- a/jdk/make/mkdemo/jfc/Makefile	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/mkdemo/jfc/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -43,7 +43,7 @@
 
 # Some demos aren't currently included in OpenJDK
 ifndef OPENJDK
-  SUBDIRS += Java2D SwingSet2 SwingSet3 Stylepad
+  SUBDIRS += Java2D Laffy SwingSet2 SwingSet3 Stylepad
 endif
 
 include $(BUILDDIR)/common/Subdirs.gmk
--- a/jdk/make/sun/cmm/kcms/Makefile	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/cmm/kcms/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -71,7 +71,8 @@
 # Extra rules
 #
 ifeq  ($(PLATFORM), linux)
-LDLIBS += -lpthread
+    LDLIBS += -lpthread
+    OTHER_CFLAGS += -Wno-missing-field-initializers
 endif
 
 clean clobber:: 
@@ -103,6 +104,5 @@
 
 endif # PLATFORM
 
-#CFLAGS += -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST
-CFLAGS += -DFUT_CALC_EX -DNO_FUT_GCONST
+CFLAGS += -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST
 
--- a/jdk/make/sun/cmm/lcms/Makefile	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/cmm/lcms/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -81,10 +81,6 @@
 ifeq ($(PLATFORM), windows)
 OTHER_CFLAGS += -DCMS_IS_WINDOWS_
 
-ifeq ($(COMPILER_VERSION), VS2003)
-OTHER_CFLAGS += -Dsqrtf=sqrt
-endif
-
 OTHER_LDLIBS = $(OBJDIR)/../../../sun.awt/awt/$(OBJDIRNAME)/awt.lib
 OTHER_INCLUDES += -I$(SHARE_SRC)/native/sun/java2d \
                   -I$(SHARE_SRC)/native/sun/awt/debug
--- a/jdk/make/sun/javazic/tzdata/VERSION	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/VERSION	Thu Mar 31 22:07:32 2011 -0700
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2011b
+tzdata2011d
--- a/jdk/make/sun/javazic/tzdata/australasia	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/australasia	Thu Mar 31 22:07:32 2011 -0700
@@ -531,11 +531,31 @@
 # to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
 # backwards from 1:00am to 12:00am"
 
+# From Raymond Hughes (2011-03-07)
+# I believe this will be posted shortly on the website
+# <a href="http://www.mcil.gov.ws">
+# www.mcil.gov.ws
+# </a>
+#
+# PUBLIC NOTICE ON DAYLIGHT SAVING TIME
+#
+# Pursuant to the Daylight Saving Act 2009 and Cabinets decision,
+# businesses and the general public are hereby advised that daylight
+# saving time is on the first Saturday of April 2011 (02/04/11).
+#
+# The public is therefore advised that when the standard time strikes
+# the hour of four oclock (4.00am or 0400 Hours) on the 2nd April 2011,
+# then all instruments used to measure standard time are to be
+# adjusted/changed to three oclock (3:00am or 0300Hrs).
+#
+# Margaret Fruean ACTING CHIEF EXECUTIVE OFFICER MINISTRY OF COMMERCE,
+# INDUSTRY AND LABOUR 28th February 2011
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
 			-11:00	-	WST	2010 Sep 26
-			-11:00	1:00	WSDT	2011 Apr 3 1:00
+			-11:00	1:00	WSDT	2011 Apr 2 4:00
 			-11:00	-	WST
 
 # Solomon Is
--- a/jdk/make/sun/javazic/tzdata/etcetera	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/etcetera	Thu Mar 31 22:07:32 2011 -0700
@@ -58,8 +58,7 @@
 # (i.e. west of Greenwich) even though many people would expect it to
 # mean 4 hours ahead of UTC (i.e. east of Greenwich).
 #
-# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation
-# (which is not yet supported by the tz code) allows for
+# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
 # TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
 # ISO 8601 you can use TZ='<-0400>+4'.  Thus the commonly-expected
 # offset is kept within the angle bracket (and is used for display)
--- a/jdk/make/sun/javazic/tzdata/europe	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/europe	Thu Mar 31 22:07:32 2011 -0700
@@ -2505,25 +2505,18 @@
 # (on a non-government server though) describing dates between 2002 and 2006:
 # http://www.alomaliye.com/bkk_2002_3769.htm
 
-# From Sue Williams (2008-08-11):
-# I spotted this news article about a potential change in Turkey.
-#
-# <a href="http://www.hurriyet.com.tr/english/domestic/9626174.asp?scr=1">
-# http://www.hurriyet.com.tr/english/domestic/9626174.asp?scr=1
+# From G&ouml;kdeniz Karada&#x011f; (2011-03-10):
+# 
+# According to the articles linked below, Turkey will change into summer
+# time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
+# This change is due to a nationwide exam on 27th.
+# 
+# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
+# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
 # </a>
-
-# From Sue Williams (2008-08-20):
-# This article says that around the end of March 2011, Turkey wants to
-# adjust the clocks forward by 1/2 hour and stay that way permanently.
-# The article indicates that this is a change in timezone offset in addition
-# to stopping observance of DST.
-# This proposal has not yet been approved.
-#
-# Read more here...
-#
-# Turkey to abandon daylight saving time in 2011
-# <a href="http://www.turkishdailynews.com.tr/article.php?enewsid=112989">
-# http://www.turkishdailynews.com.tr/article.php?enewsid=112989
+# Turkish:
+# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
+# http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
 # </a>
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -2591,6 +2584,8 @@
 			2:00	Turkey	EE%sT	1978 Oct 15
 			3:00	Turkey	TR%sT	1985 Apr 20 # Turkey Time
 			2:00	Turkey	EE%sT	2007
+			2:00	EU	EE%sT	2011 Mar 27 1:00u
+			2:00	-	EET	2011 Mar 28 1:00u
 			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
--- a/jdk/make/sun/javazic/tzdata/leapseconds	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/leapseconds	Thu Mar 31 22:07:32 2011 -0700
@@ -78,13 +78,13 @@
 # SERVICE DE LA ROTATION TERRESTRE
 # OBSERVATOIRE DE PARIS
 # 61, Av. de l'Observatoire 75014 PARIS (France)
-# Tel.      : 33 (0) 1 40 51 22 26
+# Tel.      : 33 (0) 1 40 51 22 29
 # FAX       : 33 (0) 1 40 51 22 91
 # Internet  : services.iers@obspm.fr
 #
-# Paris, 14 July 2010
+# Paris, 2 February 2011
 #
-# Bulletin C 40
+# Bulletin C 41
 #
 # To authorities responsible
 # for the measurement and
@@ -92,9 +92,9 @@
 #
 # INFORMATION ON UTC - TAI
 #
-# NO positive leap second will be introduced at the end of December 2010.
+# NO positive leap second will be introduced at the end of June 2011.
 # The difference between Coordinated Universal Time UTC and the
-# International Atomic Time TAI is :
+# International Atomic Time TAI is :		
 #
 # from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
@@ -104,6 +104,6 @@
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Director
-# Earth Orientation Center of IERS
+# Head			
+# Earth Orientation Center of the IERS
 # Observatoire de Paris, France
--- a/jdk/make/sun/javazic/tzdata/northamerica	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/northamerica	Thu Mar 31 22:07:32 2011 -0700
@@ -448,15 +448,74 @@
 # were nearby inhabitants in some cases and for our purposes perhaps
 # it's best to simply use the official transition.
 #
+
+# From Steve Ferguson (2011-01-31):
+# The author lives in Alaska and many of the references listed are only
+# available to Alaskan residents.
+#
+# <a href="http://www.alaskahistoricalsociety.org/index.cfm?section=discover%20alaska&page=Glimpses%20of%20the%20Past&viewpost=2&ContentId=98">
+# http://www.alaskahistoricalsociety.org/index.cfm?section=discover%20alaska&page=Glimpses%20of%20the%20Past&viewpost=2&ContentId=98
+# </a>
+
+# From Arthur David Olson (2011-02-01):
+# Here's database-relevant material from the 2001 "Alaska History" article:
+#
+# On September 20 [1979]...DOT...officials decreed that on April 27,
+# 1980, Juneau and other nearby communities would move to Yukon Time.
+# Sitka, Petersburg, Wrangell, and Ketchikan, however, would remain on
+# Pacific Time.
+#
+# ...on September 22, 1980, DOT Secretary Neil E. Goldschmidt rescinded the
+# Department's September 1979 decision. Juneau and other communities in
+# northern Southeast reverted to Pacific Time on October 26.
+#
+# On October 28 [1983]...the Metlakatla Indian Community Council voted
+# unanimously to keep the reservation on Pacific Time.
+#
+# According to DOT official Joanne Petrie, Indian reservations are not
+# bound to follow time zones imposed by neighboring jurisdictions.
+#
+# (The last is consistent with how the database now handles the Navajo
+# Nation.)
+
+# From Arthur David Olson (2011-02-09):
+# I just spoke by phone with a staff member at the Metlakatla Indian
+# Community office (using contact information available at
+# <a href="http://www.commerce.state.ak.us/dca/commdb/CIS.cfm?Comm_Boro_name=Metlakatla">
+# http://www.commerce.state.ak.us/dca/commdb/CIS.cfm?Comm_Boro_name=Metlakatla
+# </a>).
+# It's shortly after 1:00 here on the east coast of the United States;
+# the staffer said it was shortly after 10:00 there. When I asked whether
+# that meant they were on Pacific time, they said no--they were on their
+# own time. I asked about daylight saving; they said it wasn't used. I
+# did not inquire about practices in the past.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Juneau	 15:02:19 -	LMT	1867 Oct 18
 			 -8:57:41 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
 			 -8:00	-	PST	1969
+			 -8:00	US	P%sT	1980 Apr 27 2:00
+			 -9:00	US	Y%sT	1980 Oct 26 2:00	
 			 -8:00	US	P%sT	1983 Oct 30 2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
+Zone America/Sitka	 -14:58:47 -	LMT	1867 Oct 18
+			 -9:01:13 -	LMT	1900 Aug 20 12:00
+			 -8:00	-	PST	1942
+			 -8:00	US	P%sT	1946
+			 -8:00	-	PST	1969
+			 -8:00	US	P%sT	1983 Oct 30 2:00
+			 -9:00	US	Y%sT	1983 Nov 30
+			 -9:00	US	AK%sT
+Zone America/Metlakatla	 15:13:42 -	LMT	1867 Oct 18
+			 -8:46:18 -	LMT	1900 Aug 20 12:00
+			 -8:00	-	PST	1942
+			 -8:00	US	P%sT	1946
+			 -8:00	-	PST	1969
+			 -8:00	US	P%sT	1983 Oct 30 2:00
+			 -8:00	US	MeST
 Zone America/Yakutat	 14:41:05 -	LMT	1867 Oct 18
 			 -9:18:55 -	LMT	1900 Aug 20 12:00
 			 -9:00	-	YST	1942
@@ -2569,6 +2628,21 @@
 # the time was announced as "diez cinco"--the same time as here, indicating
 # that has indeed switched to DST. Assume second Sunday from 2009 forward.
 
+# From Steffen Thorsen (2011-03-08):
+# Granma announced that Cuba is going to start DST on 2011-03-20 00:00:00
+# this year. Nothing about the end date known so far (if that has
+# changed at all).
+#
+# Source:
+# <a href="http://granma.co.cu/2011/03/08/nacional/artic01.html">
+# http://granma.co.cu/2011/03/08/nacional/artic01.html
+# </a>
+#
+# Our info:
+# <a href="http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html">
+# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
+# </a>
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
 Rule	Cuba	1928	only	-	Oct	10	0:00	0	S
@@ -2602,7 +2676,9 @@
 Rule	Cuba	2006	max	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2007	only	-	Mar	Sun>=8	0:00s	1:00	D
 Rule	Cuba	2008	only	-	Mar	Sun>=15	0:00s	1:00	D
-Rule	Cuba	2009	max	-	Mar	Sun>=8	0:00s	1:00	D
+Rule	Cuba	2009	2010	-	Mar	Sun>=8	0:00s	1:00	D
+Rule	Cuba	2011	only	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2012	max	-	Mar	Sun>=8	0:00s	1:00	D
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Havana	-5:29:28 -	LMT	1890
--- a/jdk/make/sun/javazic/tzdata/southamerica	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/southamerica	Thu Mar 31 22:07:32 2011 -0700
@@ -1176,6 +1176,23 @@
 # From Arthur Daivd Olson (2010-03-06):
 # Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch.
 
+# From Glenn Eychaner (2011-03-02): [geychaner@mac.com]
+# It appears that the Chilean government has decided to postpone the
+# change from summer time to winter time again, by three weeks to April
+# 2nd:
+# <a href="http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651">
+# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651
+# </a>
+#
+# This is not yet reflected in the offical "cambio de hora" site, but
+# probably will be soon:
+# <a href="http://www.horaoficial.cl/cambio.htm">
+# http://www.horaoficial.cl/cambio.htm
+# </a>
+
+# From Arthur David Olson (2011-03-02):
+# The emol.com article mentions a water shortage as the cause of the
+# postponement, which may mean that it's not a permanent change.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Chile	1927	1932	-	Sep	 1	0:00	1:00	S
 Rule	Chile	1928	1932	-	Apr	 1	0:00	0	-
@@ -1211,8 +1228,8 @@
 # which is used below in specifying the transition.
 Rule	Chile	2008	only	-	Mar	30	3:00u	0	-
 Rule	Chile	2009	only	-	Mar	Sun>=9	3:00u	0	-
-Rule	Chile	2010	only	-	Apr	 4	3:00u	0	-
-Rule	Chile	2011	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	Chile	2010	2011	-	Apr	Sun>=1	3:00u	0	-
+Rule	Chile	2012	max	-	Mar	Sun>=9	3:00u	0	-
 # IATA SSIM anomalies: (1992-02) says 1992-03-14;
 # (1996-09) says 1998-03-08.  Ignore these.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
--- a/jdk/make/sun/javazic/tzdata/zone.tab	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/zone.tab	Thu Mar 31 22:07:32 2011 -0700
@@ -434,9 +434,11 @@
 US	+340308-1181434	America/Los_Angeles	Pacific Time
 US	+611305-1495401	America/Anchorage	Alaska Time
 US	+581807-1342511	America/Juneau	Alaska Time - Alaska panhandle
+US	+571035-1351807	America/Sitka	Alaska Time - southeast Alaska panhandle
 US	+593249-1394338	America/Yakutat	Alaska Time - Alaska panhandle neck
 US	+643004-1652423	America/Nome	Alaska Time - west Alaska
 US	+515248-1763929	America/Adak	Aleutian Islands
+US	+550737-1313435	America/Metlakatla	Metlakatla Time - Annette Island
 US	+211825-1575130	Pacific/Honolulu	Hawaii
 UY	-3453-05611	America/Montevideo
 UZ	+3940+06648	Asia/Samarkand	west Uzbekistan
--- a/jdk/make/sun/net/FILES_java.gmk	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/make/sun/net/FILES_java.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 	sun/net/ProgressListener.java \
 	sun/net/ProgressMeteringPolicy.java \
 	sun/net/SocksProxy.java \
+	sun/net/ResourceManager.java \
 	sun/net/TelnetInputStream.java \
 	sun/net/TelnetOutputStream.java \
 	sun/net/TelnetProtocolException.java \
@@ -100,6 +101,7 @@
 	sun/net/www/protocol/http/NegotiateAuthentication.java \
 	sun/net/www/protocol/http/Negotiator.java \
 	sun/net/www/protocol/http/ntlm/NTLMAuthentication.java \
+	sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java \
 	sun/net/www/protocol/http/spnego/NegotiatorImpl.java \
 	sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java \
 	sun/net/www/protocol/http/logging/HttpLogFormatter.java \
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java	Thu Mar 31 22:07:32 2011 -0700
@@ -210,6 +210,8 @@
     public static void init() {
         if (!alreadyInitialized) {
             transformClassHash = new HashMap(10);
+            // make sure builtin algorithms are all registered first
+            com.sun.org.apache.xml.internal.security.Init.init();
             alreadyInitialized = true;
         }
     }
@@ -236,12 +238,7 @@
                "algorithm.alreadyRegistered", exArgs);
         }
 
-        ClassLoader cl = (ClassLoader) AccessController.doPrivileged(
-            new PrivilegedAction() {
-                public Object run() {
-                    return Thread.currentThread().getContextClassLoader();
-                }
-            });
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
 
         try {
             transformClassHash.put
--- a/jdk/src/share/classes/java/awt/AWTEvent.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/AWTEvent.java	Thu Mar 31 22:07:32 2011 -0700
@@ -33,6 +33,11 @@
 import sun.awt.AWTAccessor;
 import sun.util.logging.PlatformLogger;
 
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
 /**
  * The root event class for all AWT events.
  * This class and its subclasses supercede the original
@@ -97,6 +102,22 @@
      */
     protected boolean consumed = false;
 
+   /*
+    * The event's AccessControlContext.
+    */
+    private transient volatile AccessControlContext acc =
+        AccessController.getContext();
+
+   /*
+    * Returns the acc this event was constructed with.
+    */
+    final AccessControlContext getAccessControlContext() {
+        if (acc == null) {
+            throw new SecurityException("AWTEvent is missing AccessControlContext");
+        }
+        return acc;
+    }
+
     transient boolean focusManagerIsDispatching = false;
     transient boolean isPosted;
 
@@ -247,6 +268,10 @@
                 public boolean isSystemGenerated(AWTEvent ev) {
                     return ev.isSystemGenerated;
                 }
+
+                public AccessControlContext getAccessControlContext(AWTEvent ev) {
+                    return ev.getAccessControlContext();
+                }
             });
     }
 
--- a/jdk/src/share/classes/java/awt/Component.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java	Thu Mar 31 22:07:32 2011 -0700
@@ -59,6 +59,7 @@
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.AccessControlContext;
 import javax.accessibility.*;
 import java.applet.Applet;
 
@@ -471,6 +472,12 @@
     static final Object LOCK = new AWTTreeLock();
     static class AWTTreeLock {}
 
+    /*
+     * The component's AccessControlContext.
+     */
+    private transient volatile AccessControlContext acc =
+        AccessController.getContext();
+
     /**
      * Minimum size.
      * (This field perhaps should have been transient).
@@ -671,6 +678,16 @@
         return objectLock;
     }
 
+    /*
+     * Returns the acc this component was constructed with.
+     */
+    final AccessControlContext getAccessControlContext() {
+        if (acc == null) {
+            throw new SecurityException("Component is missing AccessControlContext");
+        }
+        return acc;
+    }
+
     boolean isPacked = false;
 
     /**
@@ -950,6 +967,10 @@
             public void processEvent(Component comp, AWTEvent e) {
                 comp.processEvent(e);
             }
+
+            public AccessControlContext getAccessControlContext(Component comp) {
+                return comp.getAccessControlContext();
+            }
         });
     }
 
@@ -3873,6 +3894,11 @@
          * supported or met
          * @exception ClassCastException if the component is not a canvas or
          * window.
+         * @exception IllegalStateException if the component has no peer
+         * @exception IllegalArgumentException if {@code numBuffers} is less than two,
+         * or if {@code BufferCapabilities.isPageFlipping} is not
+         * {@code true}.
+         * @see #createBuffers(int, BufferCapabilities)
          */
         protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
             throws AWTException
@@ -8608,6 +8634,8 @@
     {
         objectLock = new Object();
 
+        acc = AccessController.getContext();
+
         s.defaultReadObject();
 
         appContext = AppContext.getAppContext();
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Thu Mar 31 22:07:32 2011 -0700
@@ -48,6 +48,12 @@
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 
+import java.security.AccessControlContext;
+import java.security.ProtectionDomain;
+
+import sun.misc.SharedSecrets;
+import sun.misc.JavaSecurityAccess;
+
 /**
  * <code>EventQueue</code> is a platform-independent class
  * that queues events, both from the underlying peer classes
@@ -612,6 +618,9 @@
         return null;
     }
 
+    private static final JavaSecurityAccess javaSecurityAccess =
+        SharedSecrets.getJavaSecurityAccess();
+
     /**
      * Dispatches an event. The manner in which the event is
      * dispatched depends upon the type of the event and the
@@ -650,13 +659,49 @@
      * @throws NullPointerException if <code>event</code> is <code>null</code>
      * @since           1.2
      */
-    protected void dispatchEvent(AWTEvent event) {
+    protected void dispatchEvent(final AWTEvent event) {
+        final Object src = event.getSource();
+        final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
+            public Void run() {
+                dispatchEventImpl(event, src);
+                return null;
+            }
+        };
+
+        final AccessControlContext stack = AccessController.getContext();
+        final AccessControlContext srcAcc = getAccessControlContextFrom(src);
+        final AccessControlContext eventAcc = event.getAccessControlContext();
+        if (srcAcc == null) {
+            javaSecurityAccess.doIntersectionPrivilege(action, stack, eventAcc);
+        } else {
+            javaSecurityAccess.doIntersectionPrivilege(
+                new PrivilegedAction<Void>() {
+                    public Void run() {
+                        javaSecurityAccess.doIntersectionPrivilege(action, eventAcc);
+                        return null;
+                    }
+                }, stack, srcAcc);
+        }
+    }
+
+    private static AccessControlContext getAccessControlContextFrom(Object src) {
+        return src instanceof Component ?
+            ((Component)src).getAccessControlContext() :
+            src instanceof MenuComponent ?
+                ((MenuComponent)src).getAccessControlContext() :
+                src instanceof TrayIcon ?
+                    ((TrayIcon)src).getAccessControlContext() :
+                    null;
+    }
+
+    /**
+     * Called from dispatchEvent() under a correct AccessControlContext
+     */
+    private void dispatchEventImpl(final AWTEvent event, final Object src) {
         event.isPosted = true;
-        Object src = event.getSource();
         if (event instanceof ActiveEvent) {
             // This could become the sole method of dispatching in time.
             setCurrentEventAndMostRecentTimeImpl(event);
-
             ((ActiveEvent)event).dispatch();
         } else if (src instanceof Component) {
             ((Component)src).dispatchEvent(event);
--- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java	Thu Mar 31 22:07:32 2011 -0700
@@ -57,8 +57,14 @@
  * </pre>
  *
  * <p>
- * The user may also select what action the {@code LinearGradientPaint}
- * should take when filling color outside the start and end points.
+ * The user may also select what action the {@code LinearGradientPaint} object
+ * takes when it is filling the space outside the start and end points by
+ * setting {@code CycleMethod} to either {@code REFLECTION} or {@code REPEAT}.
+ * The distances between any two colors in any of the reflected or repeated
+ * copies of the gradient are the same as the distance between those same two
+ * colors between the start and end points.
+ * Note that some minor variations in distances may occur due to sampling at
+ * the granularity of a pixel.
  * If no cycle method is specified, {@code NO_CYCLE} will be chosen by
  * default, which means the endpoint colors will be used to fill the
  * remaining area.
--- a/jdk/src/share/classes/java/awt/MenuComponent.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/MenuComponent.java	Thu Mar 31 22:07:32 2011 -0700
@@ -33,6 +33,9 @@
 import sun.awt.AWTAccessor;
 import javax.accessibility.*;
 
+import java.security.AccessControlContext;
+import java.security.AccessController;
+
 /**
  * The abstract class <code>MenuComponent</code> is the superclass
  * of all menu-related components. In this respect, the class
@@ -100,6 +103,23 @@
     boolean newEventsOnly = false;
 
     /*
+     * The menu's AccessControlContext.
+     */
+    private transient volatile AccessControlContext acc =
+            AccessController.getContext();
+
+    /*
+     * Returns the acc this menu component was constructed with.
+     */
+    final AccessControlContext getAccessControlContext() {
+        if (acc == null) {
+            throw new SecurityException(
+                    "MenuComponent is missing AccessControlContext");
+        }
+        return acc;
+    }
+
+    /*
      * Internal constants for serialization.
      */
     final static String actionListenerK = Component.actionListenerK;
@@ -402,6 +422,9 @@
         throws ClassNotFoundException, IOException, HeadlessException
     {
         GraphicsEnvironment.checkHeadless();
+
+        acc = AccessController.getContext();
+
         s.defaultReadObject();
 
         appContext = AppContext.getAppContext();
--- a/jdk/src/share/classes/java/awt/MultipleGradientPaint.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/MultipleGradientPaint.java	Thu Mar 31 22:07:32 2011 -0700
@@ -286,6 +286,10 @@
     /**
      * Returns a copy of the transform applied to the gradient.
      *
+     * <p>
+     * Note that if no transform is applied to the gradient
+     * when it is created, the identity transform is used.
+     *
      * @return a copy of the transform applied to the gradient
      */
     public final AffineTransform getTransform() {
@@ -293,10 +297,12 @@
     }
 
     /**
-     * Returns the transparency mode for this Paint object.
+     * Returns the transparency mode for this {@code Paint} object.
      *
-     * @return an integer value representing the transparency mode for
-     * this Paint object
+     * @return {@code OPAQUE} if all colors used by this
+     *         {@code Paint} object are opaque,
+     *         {@code TRANSLUCENT} if at least one of the
+     *         colors used by this {@code Paint} object is not opaque.
      * @see java.awt.Transparency
      */
     public final int getTransparency() {
--- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java	Thu Mar 31 22:07:32 2011 -0700
@@ -71,8 +71,24 @@
  * </pre>
  *
  * <p>
- * The user may also select what action the {@code RadialGradientPaint}
- * should take when filling color outside the bounds of the circle's radius.
+ * The user may also select what action the {@code RadialGradientPaint} object
+ * takes when it is filling the space outside the circle's radius by
+ * setting {@code CycleMethod} to either {@code REFLECTION} or {@code REPEAT}.
+ * The gradient color proportions are equal for any particular line drawn
+ * from the focus point. The following figure shows that the distance AB
+ * is equal to the distance BC, and the distance AD is equal to the distance DE.
+ * <center>
+ * <img src = "doc-files/RadialGradientPaint-3.png">
+ * </center>
+ * If the gradient and graphics rendering transforms are uniformly scaled and
+ * the user sets the focus so that it coincides with the center of the circle,
+ * the gradient color proportions are equal for any line drawn from the center.
+ * The following figure shows the distances AB, BC, AD, and DE. They are all equal.
+ * <center>
+ * <img src = "doc-files/RadialGradientPaint-4.png">
+ * </center>
+ * Note that some minor variations in distances may occur due to sampling at
+ * the granularity of a pixel.
  * If no cycle method is specified, {@code NO_CYCLE} will be chosen by
  * default, which means the the last keyframe color will be used to fill the
  * remaining area.
@@ -604,7 +620,7 @@
     }
 
     /**
-     * Returns a copy of the end point of the gradient axis.
+     * Returns a copy of the focus point of the radial gradient.
      *
      * @return a {@code Point2D} object that is a copy of the focus point
      */
--- a/jdk/src/share/classes/java/awt/TrayIcon.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/TrayIcon.java	Thu Mar 31 22:07:32 2011 -0700
@@ -40,6 +40,8 @@
 import sun.awt.SunToolkit;
 import sun.awt.HeadlessToolkit;
 import java.util.EventObject;
+import java.security.AccessControlContext;
+import java.security.AccessController;
 
 /**
  * A <code>TrayIcon</code> object represents a tray icon that can be
@@ -90,6 +92,7 @@
  * @author Anton Tarasov
  */
 public class TrayIcon {
+
     private Image image;
     private String tooltip;
     private PopupMenu popup;
@@ -103,6 +106,24 @@
     transient MouseMotionListener mouseMotionListener;
     transient ActionListener actionListener;
 
+    /*
+     * The tray icon's AccessControlContext.
+     *
+     * Unlike the acc in Component, this field is made final
+     * because TrayIcon is not serializable.
+     */
+    private final AccessControlContext acc = AccessController.getContext();
+
+    /*
+     * Returns the acc this tray icon was constructed with.
+     */
+    final AccessControlContext getAccessControlContext() {
+        if (acc == null) {
+            throw new SecurityException("TrayIcon is missing AccessControlContext");
+        }
+        return acc;
+    }
+
     static {
         Toolkit.loadLibraries();
         if (!GraphicsEnvironment.isHeadless()) {
Binary file jdk/src/share/classes/java/awt/doc-files/RadialGradientPaint-3.png has changed
Binary file jdk/src/share/classes/java/awt/doc-files/RadialGradientPaint-4.png has changed
--- a/jdk/src/share/classes/java/awt/image/PackedColorModel.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/awt/image/PackedColorModel.java	Thu Mar 31 22:07:32 2011 -0700
@@ -343,8 +343,13 @@
         if (bitMasks.length != maskArray.length) {
             return false;
         }
+
+        /* compare 'effective' masks only, i.e. only part of the mask
+         * which fits the capacity of the transfer type.
+         */
+        int maxMask = (int)((1L << DataBuffer.getDataTypeSize(transferType)) - 1);
         for (int i=0; i < bitMasks.length; i++) {
-            if (bitMasks[i] != maskArray[i]) {
+            if ((maxMask & bitMasks[i]) != (maxMask & maskArray[i])) {
                 return false;
             }
         }
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Thu Mar 31 22:07:32 2011 -0700
@@ -35,7 +35,7 @@
  * is the delegate used by default for classes about
  * which no information is available. The <code>DefaultPersistenceDelegate</code>
  * provides, version resilient, public API-based persistence for
- * classes that follow the JavaBeans conventions without any class specific
+ * classes that follow the JavaBeans&trade; conventions without any class specific
  * configuration.
  * <p>
  * The key assumptions are that the class has a nullary constructor
--- a/jdk/src/share/classes/java/beans/DesignMode.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/beans/DesignMode.java	Thu Mar 31 22:07:32 2011 -0700
@@ -31,7 +31,7 @@
  * of java.beans.beancontext.BeanContext, in order to propagate to its nested hierarchy
  * of java.beans.beancontext.BeanContextChild instances, the current "designTime" property.
  * <p>
- * The JavaBeans specification defines the notion of design time as is a
+ * The JavaBeans&trade; specification defines the notion of design time as is a
  * mode in which JavaBeans instances should function during their composition
  * and customization in a interactive design, composition or construction tool,
  * as opposed to runtime when the JavaBean is part of an applet, application,
--- a/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,7 +26,7 @@
 
 /**
  * An "IndexedPropertyChange" event gets delivered whenever a component that
- * conforms to the JavaBeans<TM> specification (a "bean") changes a bound
+ * conforms to the JavaBeans&trade; specification (a "bean") changes a bound
  * indexed property. This class is an extension of <code>PropertyChangeEvent</code>
  * but contains the index of the property that has changed.
  * <P>
--- a/jdk/src/share/classes/java/beans/Introspector.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/beans/Introspector.java	Thu Mar 31 22:07:32 2011 -0700
@@ -87,7 +87,7 @@
  * <p>
  * For more information about introspection and design patterns, please
  * consult the
- *  <a href="http://java.sun.com/products/javabeans/docs/index.html">JavaBeans specification</a>.
+ *  <a href="http://java.sun.com/products/javabeans/docs/index.html">JavaBeans&trade; specification</a>.
  */
 
 public class Introspector {
@@ -1245,7 +1245,7 @@
         try {
             type = ClassFinder.findClass(name, type.getClassLoader());
             // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
-            // according to the section 9.3 of JavaBeans specification
+            // according to the section 9.3 of JavaBeans&trade; specification
             if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
                 return type;
             }
--- a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java	Thu Mar 31 22:07:32 2011 -0700
@@ -474,7 +474,7 @@
     /**
      * @serialField children                                   Hashtable
      * @serialField source                                     Object
-     * @serialField propertyChangeSupportSerializedDataVersion int
+     * @serialField vetoableChangeSupportSerializedDataVersion int
      */
     private static final ObjectStreamField[] serialPersistentFields = {
             new ObjectStreamField("children", Hashtable.class),
--- a/jdk/src/share/classes/java/beans/package.html	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/beans/package.html	Thu Mar 31 22:07:32 2011 -0700
@@ -29,7 +29,7 @@
 
 Contains classes related to developing
 <em>beans</em> -- components
-based on the JavaBeans<sup><font size=-2>TM</font></sup> architecture.
+based on the JavaBeans&trade; architecture.
 A few of the
 classes are used by beans while they run in an application. 
 For example, the event classes are
--- a/jdk/src/share/classes/java/dyn/CallSite.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 java.dyn;
-
-import sun.dyn.*;
-import sun.dyn.empty.Empty;
-import sun.misc.Unsafe;
-import java.util.Collection;
-
-/**
- * A {@code CallSite} is a holder for a variable {@link MethodHandle},
- * which is called its {@code target}.
- * An {@code invokedynamic} instruction linked to a {@code CallSite} delegates
- * all calls to the site's current target.
- * A {@code CallSite} may be associated with several {@code invokedynamic}
- * instructions, or it may be "free floating", associated with none.
- * In any case, it may be invoked through an associated method handle
- * called its {@linkplain #dynamicInvoker dynamic invoker}.
- * <p>
- * {@code CallSite} is an abstract class which does not allow
- * direct subclassing by users.  It has three immediate,
- * concrete subclasses that may be either instantiated or subclassed.
- * <ul>
- * <li>If a mutable target is not required, an {@code invokedynamic} instruction
- * may be permanently bound by means of a {@linkplain ConstantCallSite constant call site}.
- * <li>If a mutable target is required which has volatile variable semantics,
- * because updates to the target must be immediately and reliably witnessed by other threads,
- * a {@linkplain VolatileCallSite volatile call site} may be used.
- * <li>Otherwise, if a mutable target is required,
- * a {@linkplain MutableCallSite mutable call site} may be used.
- * </ul>
- * <p>
- * A non-constant call site may be <em>relinked</em> by changing its target.
- * The new target must have the same {@linkplain MethodHandle#type() type}
- * as the previous target.
- * Thus, though a call site can be relinked to a series of
- * successive targets, it cannot change its type.
- * <p>
- * Here is a sample use of call sites and bootstrap methods which links every
- * dynamic call site to print its arguments:
-<blockquote><pre><!-- see indy-demo/src/PrintArgsDemo.java -->
-static void test() throws Throwable {
-    // THE FOLLOWING LINE IS PSEUDOCODE FOR A JVM INSTRUCTION
-    InvokeDynamic[#bootstrapDynamic].baz("baz arg", 2, 3.14);
-}
-private static void printArgs(Object... args) {
-  System.out.println(java.util.Arrays.deepToString(args));
-}
-private static final MethodHandle printArgs;
-static {
-  MethodHandles.Lookup lookup = MethodHandles.lookup();
-  Class thisClass = lookup.lookupClass();  // (who am I?)
-  printArgs = lookup.findStatic(thisClass,
-      "printArgs", MethodType.methodType(void.class, Object[].class));
-}
-private static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String name, MethodType type) {
-  // ignore caller and name, but match the type:
-  return new ConstantCallSite(printArgs.asType(type));
-}
-</pre></blockquote>
- * @author John Rose, JSR 292 EG
- */
-abstract
-public class CallSite {
-    private static final Access IMPL_TOKEN = Access.getToken();
-    static { MethodHandleImpl.initStatics(); }
-
-    // Fields used only by the JVM.  Do not use or change.
-    private MemberName vmmethod; // supplied by the JVM (ref. to calling method)
-    private int        vmindex;  // supplied by the JVM (BCI within calling method)
-
-    // The actual payload of this call site:
-    /*package-private*/
-    MethodHandle target;
-
-    // Remove this field for PFD and delete deprecated methods:
-    private MemberName calleeNameRemoveForPFD;
-
-    /**
-     * Make a blank call site object with the given method type.
-     * An initial target method is supplied which will throw
-     * an {@link IllegalStateException} if called.
-     * <p>
-     * Before this {@code CallSite} object is returned from a bootstrap method,
-     * it is usually provided with a more useful target method,
-     * via a call to {@link CallSite#setTarget(MethodHandle) setTarget}.
-     * @throws NullPointerException if the proposed type is null
-     */
-    /*package-private*/
-    CallSite(MethodType type) {
-        target = MethodHandles.invokers(type).uninitializedCallSite();
-    }
-
-    /**
-     * Make a blank call site object, possibly equipped with an initial target method handle.
-     * @param target the method handle which will be the initial target of the call site
-     * @throws NullPointerException if the proposed target is null
-     */
-    /*package-private*/
-    CallSite(MethodHandle target) {
-        target.type();  // null check
-        this.target = target;
-    }
-
-    /**
-     * Returns the type of this call site's target.
-     * Although targets may change, any call site's type is permanent, and can never change to an unequal type.
-     * The {@code setTarget} method enforces this invariant by refusing any new target that does
-     * not have the previous target's type.
-     * @return the type of the current target, which is also the type of any future target
-     */
-    public MethodType type() {
-        return target.type();
-    }
-
-    /** Called from JVM (or low-level Java code) after the BSM returns the newly created CallSite.
-     *  The parameters are JVM-specific.
-     */
-    void initializeFromJVM(String name,
-                           MethodType type,
-                           MemberName callerMethod,
-                           int        callerBCI) {
-        if (this.vmmethod != null) {
-            // FIXME
-            throw new InvokeDynamicBootstrapError("call site has already been linked to an invokedynamic instruction");
-        }
-        if (!this.type().equals(type)) {
-            throw wrongTargetType(target, type);
-        }
-        this.vmindex  = callerBCI;
-        this.vmmethod = callerMethod;
-    }
-
-    /**
-     * Returns the target method of the call site, according to the
-     * behavior defined by this call site's specific class.
-     * The immediate subclasses of {@code CallSite} document the
-     * class-specific behaviors of this method.
-     *
-     * @return the current linkage state of the call site, its target method handle
-     * @see ConstantCallSite
-     * @see VolatileCallSite
-     * @see #setTarget
-     * @see ConstantCallSite#getTarget
-     * @see MutableCallSite#getTarget
-     * @see VolatileCallSite#getTarget
-     */
-    public abstract MethodHandle getTarget();
-
-    /**
-     * Updates the target method of this call site, according to the
-     * behavior defined by this call site's specific class.
-     * The immediate subclasses of {@code CallSite} document the
-     * class-specific behaviors of this method.
-     * <p>
-     * The type of the new target must be {@linkplain MethodType#equals equal to}
-     * the type of the old target.
-     *
-     * @param newTarget the new target
-     * @throws NullPointerException if the proposed new target is null
-     * @throws WrongMethodTypeException if the proposed new target
-     *         has a method type that differs from the previous target
-     * @see CallSite#getTarget
-     * @see ConstantCallSite#setTarget
-     * @see MutableCallSite#setTarget
-     * @see VolatileCallSite#setTarget
-     */
-    public abstract void setTarget(MethodHandle newTarget);
-
-    void checkTargetChange(MethodHandle oldTarget, MethodHandle newTarget) {
-        MethodType oldType = oldTarget.type();
-        MethodType newType = newTarget.type();  // null check!
-        if (!newType.equals(oldType))
-            throw wrongTargetType(newTarget, oldType);
-    }
-
-    private static WrongMethodTypeException wrongTargetType(MethodHandle target, MethodType type) {
-        return new WrongMethodTypeException(String.valueOf(target)+" should be of type "+type);
-    }
-
-    /**
-     * Produce a method handle equivalent to an invokedynamic instruction
-     * which has been linked to this call site.
-     * <p>
-     * This method is equivalent to the following code:
-     * <blockquote><pre>
-     * MethodHandle getTarget, invoker, result;
-     * getTarget = MethodHandles.publicLookup().bind(this, "getTarget", MethodType.methodType(MethodHandle.class));
-     * invoker = MethodHandles.exactInvoker(this.type());
-     * result = MethodHandles.foldArguments(invoker, getTarget)
-     * </pre></blockquote>
-     *
-     * @return a method handle which always invokes this call site's current target
-     */
-    public abstract MethodHandle dynamicInvoker();
-
-    /*non-public*/ MethodHandle makeDynamicInvoker() {
-        MethodHandle getTarget = MethodHandleImpl.bindReceiver(IMPL_TOKEN, GET_TARGET, this);
-        MethodHandle invoker = MethodHandles.exactInvoker(this.type());
-        return MethodHandles.foldArguments(invoker, getTarget);
-    }
-
-    private static final MethodHandle GET_TARGET;
-    static {
-        try {
-            GET_TARGET = MethodHandles.Lookup.IMPL_LOOKUP.
-                findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
-        } catch (ReflectiveOperationException ignore) {
-            throw new InternalError();
-        }
-    }
-
-    /** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
-    /*package-private*/
-    static Empty uninitializedCallSite() {
-        throw new IllegalStateException("uninitialized call site");
-    }
-
-    // unsafe stuff:
-    private static final Unsafe unsafe = Unsafe.getUnsafe();
-    private static final long TARGET_OFFSET;
-
-    static {
-        try {
-            TARGET_OFFSET = unsafe.objectFieldOffset(CallSite.class.getDeclaredField("target"));
-        } catch (Exception ex) { throw new Error(ex); }
-    }
-
-    /*package-private*/
-    void setTargetNormal(MethodHandle newTarget) {
-        target = newTarget;
-        //CallSiteImpl.setCallSiteTarget(IMPL_TOKEN, this, newTarget);
-    }
-    /*package-private*/
-    MethodHandle getTargetVolatile() {
-        return (MethodHandle) unsafe.getObjectVolatile(this, TARGET_OFFSET);
-    }
-    /*package-private*/
-    void setTargetVolatile(MethodHandle newTarget) {
-        unsafe.putObjectVolatile(this, TARGET_OFFSET, newTarget);
-        //CallSiteImpl.setCallSiteTarget(IMPL_TOKEN, this, newTarget);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/ClassValue.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, 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 java.dyn;
-
-import java.util.WeakHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-import java.lang.reflect.UndeclaredThrowableException;
-
-/**
- * Lazily associate a computed value with (potentially) every type.
- * For example, if a dynamic language needs to construct a message dispatch
- * table for each class encountered at a message send call site,
- * it can use a {@code ClassValue} to cache information needed to
- * perform the message send quickly, for each class encountered.
- * @author John Rose, JSR 292 EG
- */
-public abstract class ClassValue<T> {
-    /**
-     * Compute the given class's derived value for this {@code ClassValue}.
-     * <p>
-     * This method will be invoked within the first thread that accesses
-     * the value with the {@link #get get} method.
-     * <p>
-     * Normally, this method is invoked at most once per class,
-     * but it may be invoked again if there has been a call to
-     * {@link #remove remove}.
-     * <p>
-     * If this method throws an exception, the corresponding call to {@code get}
-     * will terminate abnormally with that exception, and no class value will be recorded.
-     *
-     * @param type the type whose class value must be computed
-     * @return the newly computed value associated with this {@code ClassValue}, for the given class or interface
-     * @see #get
-     * @see #remove
-     */
-    protected abstract T computeValue(Class<?> type);
-
-    /**
-     * Returns the value for the given class.
-     * If no value has yet been computed, it is obtained by
-     * an invocation of the {@link #computeValue computeValue} method.
-     * <p>
-     * The actual installation of the value on the class
-     * is performed atomically.
-     * At that point, if several racing threads have
-     * computed values, one is chosen, and returned to
-     * all the racing threads.
-     * <p>
-     * The {@code type} parameter is typically a class, but it may be any type,
-     * such as an interface, a primitive type (like {@code int.class}), or {@code void.class}.
-     * <p>
-     * In the absence of {@code remove} calls, a class value has a simple
-     * state diagram:  uninitialized and initialized.
-     * When {@code remove} calls are made,
-     * the rules for value observation are more complex.
-     * See the documentation for {@link #remove remove} for more information.
-     *
-     * @param type the type whose class value must be computed or retrieved
-     * @return the current value associated with this {@code ClassValue}, for the given class or interface
-     * @throws NullPointerException if the argument is null
-     * @see #remove
-     * @see #computeValue
-     */
-    public T get(Class<?> type) {
-        ClassValueMap map = getMap(type);
-        if (map != null) {
-            Object x = map.get(this);
-            if (x != null) {
-                return (T) map.unmaskNull(x);
-            }
-        }
-        return setComputedValue(type);
-    }
-
-    /**
-     * Removes the associated value for the given class.
-     * If this value is subsequently {@linkplain #get read} for the same class,
-     * its value will be reinitialized by invoking its {@link #computeValue computeValue} method.
-     * This may result in an additional invocation of the
-     * {@code computeValue computeValue} method for the given class.
-     * <p>
-     * In order to explain the interaction between {@code get} and {@code remove} calls,
-     * we must model the state transitions of a class value to take into account
-     * the alternation between uninitialized and initialized states.
-     * To do this, number these states sequentially from zero, and note that
-     * uninitialized (or removed) states are numbered with even numbers,
-     * while initialized (or re-initialized) states have odd numbers.
-     * <p>
-     * When a thread {@code T} removes a class value in state {@code 2N},
-     * nothing happens, since the class value is already uninitialized.
-     * Otherwise, the state is advanced atomically to {@code 2N+1}.
-     * <p>
-     * When a thread {@code T} queries a class value in state {@code 2N},
-     * the thread first attempts to initialize the class value to state {@code 2N+1}
-     * by invoking {@code computeValue} and installing the resulting value.
-     * <p>
-     * When {@code T} attempts to install the newly computed value,
-     * if the state is still at {@code 2N}, the class value will be initialized
-     * with the computed value, advancing it to state {@code 2N+1}.
-     * <p>
-     * Otherwise, whether the new state is even or odd,
-     * {@code T} will discard the newly computed value
-     * and retry the {@code get} operation.
-     * <p>
-     * Discarding and retrying is an important proviso,
-     * since otherwise {@code T} could potentially install
-     * a disastrously stale value.  For example:
-     * <ul>
-     * <li>{@code T} calls {@code CV.get(C)} and sees state {@code 2N}
-     * <li>{@code T} quickly computes a time-dependent value {@code V0} and gets ready to install it
-     * <li>{@code T} is hit by an unlucky paging or scheduling event, and goes to sleep for a long time
-     * <li>...meanwhile, {@code T2} also calls {@code CV.get(C)} and sees state {@code 2N}
-     * <li>{@code T2} quickly computes a similar time-dependent value {@code V1} and installs it on {@code CV.get(C)}
-     * <li>{@code T2} (or a third thread) then calls {@code CV.remove(C)}, undoing {@code T2}'s work
-     * <li> the previous actions of {@code T2} are repeated several times
-     * <li> also, the relevant computed values change over time: {@code V1}, {@code V2}, ...
-     * <li>...meanwhile, {@code T} wakes up and attempts to install {@code V0}; <em>this must fail</em>
-     * </ul>
-     * We can assume in the above scenario that {@code CV.computeValue} uses locks to properly
-     * observe the time-dependent states as it computes {@code V1}, etc.
-     * This does not remove the threat of a stale value, since there is a window of time
-     * between the return of {@code computeValue} in {@code T} and the installation
-     * of the the new value.  No user synchronization is possible during this time.
-     *
-     * @param type the type whose class value must be removed
-     * @throws NullPointerException if the argument is null
-     */
-    public void remove(Class<?> type) {
-        ClassValueMap map = getMap(type);
-        if (map != null) {
-            synchronized (map) {
-                map.remove(this);
-            }
-        }
-    }
-
-    /// Implementation...
-
-    // The hash code for this type is based on the identity of the object,
-    // and is well-dispersed for power-of-two tables.
-    /** @deprecated This override, which is implementation-specific, will be removed for PFD. */
-    public final int hashCode() { return hashCode; }
-    private final int hashCode = HASH_CODES.getAndAdd(0x61c88647);
-    private static final AtomicInteger HASH_CODES = new AtomicInteger();
-
-    private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
-
-    /** Slow path for {@link #get}. */
-    private T setComputedValue(Class<?> type) {
-        ClassValueMap map = getMap(type);
-        if (map == null) {
-            map = initializeMap(type);
-        }
-        T value = computeValue(type);
-        STORE_BARRIER.lazySet(0);
-        // All stores pending from computeValue are completed.
-        synchronized (map) {
-            // Warm up the table with a null entry.
-            map.preInitializeEntry(this);
-        }
-        STORE_BARRIER.lazySet(0);
-        // All stores pending from table expansion are completed.
-        synchronized (map) {
-            value = (T) map.initializeEntry(this, value);
-            // One might fear a possible race condition here
-            // if the code for map.put has flushed the write
-            // to map.table[*] before the writes to the Map.Entry
-            // are done.  This is not possible, since we have
-            // warmed up the table with an empty entry.
-        }
-        return value;
-    }
-
-    // Replace this map by a per-class slot.
-    private static final WeakHashMap<Class<?>, ClassValueMap> ROOT
-        = new WeakHashMap<Class<?>, ClassValueMap>();
-
-    private static ClassValueMap getMap(Class<?> type) {
-        return ROOT.get(type);
-    }
-
-    private static ClassValueMap initializeMap(Class<?> type) {
-        synchronized (ClassValue.class) {
-            ClassValueMap map = ROOT.get(type);
-            if (map == null)
-                ROOT.put(type, map = new ClassValueMap());
-            return map;
-        }
-    }
-
-    static class ClassValueMap extends WeakHashMap<ClassValue, Object> {
-        /** Make sure this table contains an Entry for the given key, even if it is empty. */
-        void preInitializeEntry(ClassValue key) {
-            if (!this.containsKey(key))
-                this.put(key, null);
-        }
-        /** Make sure this table contains a non-empty Entry for the given key. */
-        Object initializeEntry(ClassValue key, Object value) {
-            Object prior = this.get(key);
-            if (prior != null) {
-                return unmaskNull(prior);
-            }
-            this.put(key, maskNull(value));
-            return value;
-        }
-
-        Object maskNull(Object x) {
-            return x == null ? this : x;
-        }
-        Object unmaskNull(Object x) {
-            return x == this ? null : x;
-        }
-    }
-}
--- a/jdk/src/share/classes/java/dyn/ConstantCallSite.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, 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 java.dyn;
-
-/**
- * A {@code ConstantCallSite} is a {@link CallSite} whose target is permanent, and can never be changed.
- * An {@code invokedynamic} instruction linked to a {@code ConstantCallSite} is permanently
- * bound to the call site's target.
- * @author John Rose, JSR 292 EG
- */
-public class ConstantCallSite extends CallSite {
-    /**
-     * Creates a call site with a permanent target.
-     * @param target the target to be permanently associated with this call site
-     * @throws NullPointerException if the proposed target is null
-     */
-    public ConstantCallSite(MethodHandle target) {
-        super(target);
-    }
-
-    /**
-     * Returns the target method of the call site, which behaves
-     * like a {@code final} field of the {@code ConstantCallSite}.
-     * That is, the the target is always the original value passed
-     * to the constructor call which created this instance.
-     *
-     * @return the immutable linkage state of this call site, a constant method handle
-     * @throws UnsupportedOperationException because this kind of call site cannot change its target
-     */
-    @Override public final MethodHandle getTarget() {
-        return target;
-    }
-
-    /**
-     * Always throws an {@link UnsupportedOperationException}.
-     * This kind of call site cannot change its target.
-     * @param ignore a new target proposed for the call site, which is ignored
-     * @throws UnsupportedOperationException because this kind of call site cannot change its target
-     */
-    @Override public final void setTarget(MethodHandle ignore) {
-        throw new UnsupportedOperationException("ConstantCallSite");
-    }
-
-    /**
-     * Returns this call site's permanent target.
-     * Since that target will never change, this is a correct implementation
-     * of {@link CallSite#dynamicInvoker CallSite.dynamicInvoker}.
-     * @return the immutable linkage state of this call site, a constant method handle
-     */
-    @Override
-    public final MethodHandle dynamicInvoker() {
-        return getTarget();
-    }
-}
--- a/jdk/src/share/classes/java/dyn/InvokeDynamic.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 java.dyn;
-
-/**
- * This is a place-holder class.  Some HotSpot implementations need to see it.
- */
-final class InvokeDynamic {
-    private InvokeDynamic() { throw new InternalError(); }  // do not instantiate
-}
--- a/jdk/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 java.dyn;
-
-/**
- * Thrown to indicate that an {@code invokedynamic} instruction has
- * failed to find its
- * {@linkplain BootstrapMethod bootstrap method},
- * or the bootstrap method has
- * failed to provide a
- * {@linkplain CallSite call site} with a {@linkplain CallSite#getTarget target}
- * of the correct {@linkplain MethodHandle#type method type}.
- *
- * @author John Rose, JSR 292 EG
- * @since 1.7
- */
-public class InvokeDynamicBootstrapError extends LinkageError {
-    private static final long serialVersionUID = 292L;
-
-    /**
-     * Constructs an {@code InvokeDynamicBootstrapError} with no detail message.
-     */
-    public InvokeDynamicBootstrapError() {
-        super();
-    }
-
-    /**
-     * Constructs an {@code InvokeDynamicBootstrapError} with the specified
-     * detail message.
-     *
-     * @param s the detail message.
-     */
-    public InvokeDynamicBootstrapError(String s) {
-        super(s);
-    }
-
-    /**
-     * Constructs a {@code InvokeDynamicBootstrapError} with the specified
-     * detail message and cause.
-     *
-     * @param s the detail message.
-     * @param cause the cause, may be {@code null}.
-     */
-    public InvokeDynamicBootstrapError(String s, Throwable cause) {
-        super(s, cause);
-    }
-
-    /**
-     * Constructs a {@code InvokeDynamicBootstrapError} with the specified
-     * cause.
-     *
-     * @param cause the cause, may be {@code null}.
-     */
-    public InvokeDynamicBootstrapError(Throwable cause) {
-        // cf. Throwable(Throwable cause) constructor.
-        super(cause == null ? null : cause.toString());
-        initCause(cause);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/Linkage.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 java.dyn;
-
-import java.dyn.MethodHandles.Lookup;
-import java.util.WeakHashMap;
-import sun.dyn.Access;
-import sun.dyn.MethodHandleImpl;
-import sun.dyn.util.VerifyAccess;
-import sun.reflect.Reflection;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * <em>CLASS WILL BE REMOVED FOR PFD:</em>
- * Static routines for controlling invokedynamic behavior.
- * Replaced by non-static APIs.
- * @author John Rose, JSR 292 EG
- * @deprecated This class will be removed in the Public Final Draft.
- */
-public class Linkage {
-    private static final Access IMPL_TOKEN = Access.getToken();
-
-    private Linkage() {}  // do not instantiate
-
-    /**
-     * <em>METHOD WILL BE REMOVED FOR PFD:</em>
-     * Register a <em>bootstrap method</em> to use when linking dynamic call sites within
-     * a given caller class.
-     * @deprecated Use @{@link BootstrapMethod} annotations instead.
-     */
-    public static
-    void registerBootstrapMethod(Class callerClass, MethodHandle bootstrapMethod) {
-        Class callc = Reflection.getCallerClass(2);
-        if (callc != null && !VerifyAccess.isSamePackage(callerClass, callc))
-            throw new IllegalArgumentException("cannot set bootstrap method on "+callerClass);
-        MethodHandleImpl.registerBootstrap(IMPL_TOKEN, callerClass, bootstrapMethod);
-    }
-
-    /**
-     * <em>METHOD WILL BE REMOVED FOR PFD:</em>
-     * Simplified version of {@code registerBootstrapMethod} for self-registration,
-     * to be called from a static initializer.
-     * @deprecated Use @{@link BootstrapMethod} annotations instead.
-     */
-    public static
-    void registerBootstrapMethod(Class<?> runtime, String name) {
-        Class callerClass = Reflection.getCallerClass(2);
-        registerBootstrapMethodLookup(callerClass, runtime, name);
-    }
-
-    /**
-     * <em>METHOD WILL BE REMOVED FOR PFD:</em>
-     * Simplified version of {@code registerBootstrapMethod} for self-registration,
-     * @deprecated Use @{@link BootstrapMethod} annotations instead.
-     */
-    public static
-    void registerBootstrapMethod(String name) {
-        Class callerClass = Reflection.getCallerClass(2);
-        registerBootstrapMethodLookup(callerClass, callerClass, name);
-    }
-
-    private static
-    void registerBootstrapMethodLookup(Class<?> callerClass, Class<?> runtime, String name) {
-        Lookup lookup = new Lookup(IMPL_TOKEN, callerClass);
-        MethodHandle bootstrapMethod;
-        try {
-            bootstrapMethod = lookup.findStatic(runtime, name, BOOTSTRAP_METHOD_TYPE);
-        } catch (ReflectiveOperationException ex) {
-            throw new IllegalArgumentException("no such bootstrap method in "+runtime+": "+name, ex);
-        }
-        MethodHandleImpl.registerBootstrap(IMPL_TOKEN, callerClass, bootstrapMethod);
-    }
-
-    private static final MethodType BOOTSTRAP_METHOD_TYPE
-            = MethodType.methodType(CallSite.class,
-                                    Class.class, String.class, MethodType.class);
-
-    /**
-     * <em>METHOD WILL BE REMOVED FOR PFD:</em>
-     * Invalidate all <code>invokedynamic</code> call sites everywhere.
-     * @deprecated Use {@linkplain MutableCallSite#setTarget call site target setting},
-     * {@link MutableCallSite#syncAll call site update pushing},
-     * and {@link SwitchPoint#guardWithTest target switching} instead.
-     */
-    public static
-    Object invalidateAll() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * <em>METHOD WILL BE REMOVED FOR PFD:</em>
-     * Invalidate all {@code invokedynamic} call sites in the bytecodes
-     * of any methods of the given class.
-     * @deprecated Use {@linkplain MutableCallSite#setTarget call site target setting},
-     * {@link MutableCallSite#syncAll call site update pushing},
-     * and {@link SwitchPoint#guardWithTest target switching} instead.
-     */
-    public static
-    Object invalidateCallerClass(Class<?> callerClass) {
-        throw new UnsupportedOperationException();
-    }
-}
--- a/jdk/src/share/classes/java/dyn/MethodHandle.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1009 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 java.dyn;
-
-//import sun.dyn.*;
-
-import sun.dyn.Access;
-import sun.dyn.MethodHandleImpl;
-
-import static java.dyn.MethodHandles.invokers;  // package-private API
-import static sun.dyn.MemberName.newIllegalArgumentException;  // utility
-
-/**
- * A method handle is a typed, directly executable reference to an underlying method,
- * constructor, field, or similar low-level operation, with optional
- * transformations of arguments or return values.
- * These transformations are quite general, and include such patterns as
- * {@linkplain #asType conversion},
- * {@linkplain #bindTo insertion},
- * {@linkplain java.dyn.MethodHandles#dropArguments deletion},
- * and {@linkplain java.dyn.MethodHandles#filterArguments substitution}.
- * <p>
- * <em>Note: The super-class of MethodHandle is Object.
- *     Any other super-class visible in the Reference Implementation
- *     will be removed before the Proposed Final Draft.
- *     Also, the final version will not include any public or
- *     protected constructors.</em>
- *
- * <h3>Method handle contents</h3>
- * Method handles are dynamically and strongly typed according to type descriptor.
- * They are not distinguished by the name or defining class of their underlying methods.
- * A method handle must be invoked using type descriptor which matches
- * the method handle's own {@linkplain #type method type}.
- * <p>
- * Every method handle reports its type via the {@link #type type} accessor.
- * This type descriptor is a {@link java.dyn.MethodType MethodType} object,
- * whose structure is a series of classes, one of which is
- * the return type of the method (or {@code void.class} if none).
- * <p>
- * A method handle's type controls the types of invocations it accepts,
- * and the kinds of transformations that apply to it.
- * <p>
- * A method handle contains a pair of special invoker methods
- * called {@link #invokeExact invokeExact} and {@link #invokeGeneric invokeGeneric}.
- * Both invoker methods provide direct access to the method handle's
- * underlying method, constructor, field, or other operation,
- * as modified by transformations of arguments and return values.
- * Both invokers accept calls which exactly match the method handle's own type.
- * The {@code invokeGeneric} invoker also accepts a range of other call types.
- * <p>
- * Method handles are immutable and have no visible state.
- * Of course, they can be bound to underlying methods or data which exhibit state.
- * With respect to the Java Memory Model, any method handle will behave
- * as if all of its (internal) fields are final variables.  This means that any method
- * handle made visible to the application will always be fully formed.
- * This is true even if the method handle is published through a shared
- * variable in a data race.
- * <p>
- * Method handles cannot be subclassed by the user.
- * Implementations may (or may not) create internal subclasses of {@code MethodHandle}
- * which may be visible via the {@link java.lang.Object#getClass Object.getClass}
- * operation.  The programmer should not draw conclusions about a method handle
- * from its specific class, as the method handle class hierarchy (if any)
- * may change from time to time or across implementations from different vendors.
- *
- * <h3>Method handle compilation</h3>
- * A Java method call expression naming {@code invokeExact} or {@code invokeGeneric}
- * can invoke a method handle from Java source code.
- * From the viewpoint of source code, these methods can take any arguments
- * and their result can be cast to any return type.
- * Formally this is accomplished by giving the invoker methods
- * {@code Object} return types and variable-arity {@code Object} arguments,
- * but they have an additional quality called <em>signature polymorphism</em>
- * which connects this freedom of invocation directly to the JVM execution stack.
- * <p>
- * As is usual with virtual methods, source-level calls to {@code invokeExact}
- * and {@code invokeGeneric} compile to an {@code invokevirtual} instruction.
- * More unusually, the compiler must record the actual argument types,
- * and may not perform method invocation conversions on the arguments.
- * Instead, it must push them on the stack according to their own unconverted types.
- * The method handle object itself is pushed on the stack before the arguments.
- * The compiler then calls the method handle with a type descriptor which
- * describes the argument and return types.
- * <p>
- * To issue a complete type descriptor, the compiler must also determine
- * the return type.  This is based on a cast on the method invocation expression,
- * if there is one, or else {@code Object} if the invocation is an expression
- * or else {@code void} if the invocation is a statement.
- * The cast may be to a primitive type (but not {@code void}).
- * <p>
- * As a corner case, an uncasted {@code null} argument is given
- * a type descriptor of {@code java.lang.Void}.
- * The ambiguity with the type {@code Void} is harmless, since there are no references of type
- * {@code Void} except the null reference.
- *
- * <h3>Method handle invocation</h3>
- * The first time a {@code invokevirtual} instruction is executed
- * it is linked, by symbolically resolving the names in the instruction
- * and verifying that the method call is statically legal.
- * This is true of calls to {@code invokeExact} and {@code invokeGeneric}.
- * In this case, the type descriptor emitted by the compiler is checked for
- * correct syntax and names it contains are resolved.
- * Thus, an {@code invokevirtual} instruction which invokes
- * a method handle will always link, as long
- * as the type descriptor is syntactically well-formed
- * and the types exist.
- * <p>
- * When the {@code invokevirtual} is executed after linking,
- * the receiving method handle's type is first checked by the JVM
- * to ensure that it matches the descriptor.
- * If the type match fails, it means that the method which the
- * caller is invoking is not present on the individual
- * method handle being invoked.
- * <p>
- * In the case of {@code invokeExact}, the type descriptor of the invocation
- * (after resolving symbolic type names) must exactly match the method type
- * of the receiving method handle.
- * In the case of {@code invokeGeneric}, the resolved type descriptor
- * must be a valid argument to the receiver's {@link #asType asType} method.
- * Thus, {@code invokeGeneric} is more permissive than {@code invokeExact}.
- * <p>
- * After type matching, a call to {@code invokeExact} directly
- * and immediately invoke the method handle's underlying method
- * (or other behavior, as the case may be).
- * <p>
- * A call to {@code invokeGeneric} works the same as a call to
- * {@code invokeExact}, if the type descriptor specified by the caller
- * exactly matches the method handle's own type.
- * If there is a type mismatch, {@code invokeGeneric} attempts
- * to adjust the type of the receiving method handle,
- * as if by a call to {@link #asType asType},
- * to obtain an exactly invokable method handle {@code M2}.
- * This allows a more powerful negotiation of method type
- * between caller and callee.
- * <p>
- * (Note: The adjusted method handle {@code M2} is not directly observable,
- * and implementations are therefore not required to materialize it.)
- *
- * <h3>Invocation checking</h3>
- * In typical programs, method handle type matching will usually succeed.
- * But if a match fails, the JVM will throw a {@link WrongMethodTypeException},
- * either directly (in the case of {@code invokeExact}) or indirectly as if
- * by a failed call to {@code asType} (in the case of {@code invokeGeneric}).
- * <p>
- * Thus, a method type mismatch which might show up as a linkage error
- * in a statically typed program can show up as
- * a dynamic {@code WrongMethodTypeException}
- * in a program which uses method handles.
- * <p>
- * Because method types contain "live" {@code Class} objects,
- * method type matching takes into account both types names and class loaders.
- * Thus, even if a method handle {@code M} is created in one
- * class loader {@code L1} and used in another {@code L2},
- * method handle calls are type-safe, because the caller's type
- * descriptor, as resolved in {@code L2},
- * is matched against the original callee method's type descriptor,
- * as resolved in {@code L1}.
- * The resolution in {@code L1} happens when {@code M} is created
- * and its type is assigned, while the resolution in {@code L2} happens
- * when the {@code invokevirtual} instruction is linked.
- * <p>
- * Apart from the checking of type descriptors,
- * a method handle's capability to call its underlying method is unrestricted.
- * If a method handle is formed on a non-public method by a class
- * that has access to that method, the resulting handle can be used
- * in any place by any caller who receives a reference to it.
- * <p>
- * Unlike with the Core Reflection API, where access is checked every time
- * a reflective method is invoked,
- * method handle access checking is performed
- * <a href="MethodHandles.Lookup.html#access">when the method handle is created</a>.
- * In the case of {@code ldc} (see below), access checking is performed as part of linking
- * the constant pool entry underlying the constant method handle.
- * <p>
- * Thus, handles to non-public methods, or to methods in non-public classes,
- * should generally be kept secret.
- * They should not be passed to untrusted code unless their use from
- * the untrusted code would be harmless.
- *
- * <h3>Method handle creation</h3>
- * Java code can create a method handle that directly accesses
- * any method, constructor, or field that is accessible to that code.
- * This is done via a reflective, capability-based API called
- * {@link java.dyn.MethodHandles.Lookup MethodHandles.Lookup}
- * For example, a static method handle can be obtained
- * from {@link java.dyn.MethodHandles.Lookup#findStatic Lookup.findStatic}.
- * There are also conversion methods from Core Reflection API objects,
- * such as {@link java.dyn.MethodHandles.Lookup#unreflect Lookup.unreflect}.
- * <p>
- * Like classes and strings, method handles that correspond to accessible
- * fields, methods, and constructors can also be represented directly
- * in a class file's constant pool as constants to be loaded by {@code ldc} bytecodes.
- * A new type of constant pool entry, {@code CONSTANT_MethodHandle},
- * refers directly to an associated {@code CONSTANT_Methodref},
- * {@code CONSTANT_InterfaceMethodref}, or {@code CONSTANT_Fieldref}
- * constant pool entry.
- * (For more details on method handle constants,
- * see the <a href="package-summary.html#mhcon">package summary</a>.)
- * <p>
- * Method handles produced by lookups or constant loads from methods or
- * constructors with the variable arity modifier bit ({@code 0x0080})
- * have a corresponding variable arity, as if they were defined with
- * the help of {@link #asVarargsCollector asVarargsCollector}.
- * <p>
- * A method reference may refer either to a static or non-static method.
- * In the non-static case, the method handle type includes an explicit
- * receiver argument, prepended before any other arguments.
- * In the method handle's type, the initial receiver argument is typed
- * according to the class under which the method was initially requested.
- * (E.g., if a non-static method handle is obtained via {@code ldc},
- * the type of the receiver is the class named in the constant pool entry.)
- * <p>
- * When a method handle to a virtual method is invoked, the method is
- * always looked up in the receiver (that is, the first argument).
- * <p>
- * A non-virtual method handle to a specific virtual method implementation
- * can also be created.  These do not perform virtual lookup based on
- * receiver type.  Such a method handle simulates the effect of
- * an {@code invokespecial} instruction to the same method.
- *
- * <h3>Usage examples</h3>
- * Here are some examples of usage:
- * <p><blockquote><pre>
-Object x, y; String s; int i;
-MethodType mt; MethodHandle mh;
-MethodHandles.Lookup lookup = MethodHandles.lookup();
-// mt is (char,char)String
-mt = MethodType.methodType(String.class, char.class, char.class);
-mh = lookup.findVirtual(String.class, "replace", mt);
-s = (String) mh.invokeExact("daddy",'d','n');
-// invokeExact(Ljava/lang/String;CC)Ljava/lang/String;
-assert(s.equals("nanny"));
-// weakly typed invocation (using MHs.invoke)
-s = (String) mh.invokeWithArguments("sappy", 'p', 'v');
-assert(s.equals("savvy"));
-// mt is (Object[])List
-mt = MethodType.methodType(java.util.List.class, Object[].class);
-mh = lookup.findStatic(java.util.Arrays.class, "asList", mt);
-assert(mh.isVarargsCollector());
-x = mh.invokeGeneric("one", "two");
-// invokeGeneric(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
-assert(x.equals(java.util.Arrays.asList("one","two")));
-// mt is (Object,Object,Object)Object
-mt = MethodType.genericMethodType(3);
-mh = mh.asType(mt);
-x = mh.invokeExact((Object)1, (Object)2, (Object)3);
-// invokeExact(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
-assert(x.equals(java.util.Arrays.asList(1,2,3)));
-// mt is { =&gt; int}
-mt = MethodType.methodType(int.class);
-mh = lookup.findVirtual(java.util.List.class, "size", mt);
-i = (int) mh.invokeExact(java.util.Arrays.asList(1,2,3));
-// invokeExact(Ljava/util/List;)I
-assert(i == 3);
-mt = MethodType.methodType(void.class, String.class);
-mh = lookup.findVirtual(java.io.PrintStream.class, "println", mt);
-mh.invokeExact(System.out, "Hello, world.");
-// invokeExact(Ljava/io/PrintStream;Ljava/lang/String;)V
- * </pre></blockquote>
- * Each of the above calls to {@code invokeExact} or {@code invokeGeneric}
- * generates a single invokevirtual instruction with
- * the type descriptor indicated in the following comment.
- *
- * <h3>Exceptions</h3>
- * The methods {@code invokeExact} and {@code invokeGeneric} are declared
- * to throw {@link java.lang.Throwable Throwable},
- * which is to say that there is no static restriction on what a method handle
- * can throw.  Since the JVM does not distinguish between checked
- * and unchecked exceptions (other than by their class, of course),
- * there is no particular effect on bytecode shape from ascribing
- * checked exceptions to method handle invocations.  But in Java source
- * code, methods which perform method handle calls must either explicitly
- * throw {@code java.lang.Throwable Throwable}, or else must catch all
- * throwables locally, rethrowing only those which are legal in the context,
- * and wrapping ones which are illegal.
- *
- * <h3><a name="sigpoly"></a>Signature polymorphism</h3>
- * The unusual compilation and linkage behavior of
- * {@code invokeExact} and {@code invokeGeneric}
- * is referenced by the term <em>signature polymorphism</em>.
- * A signature polymorphic method is one which can operate with
- * any of a wide range of call signatures and return types.
- * In order to make this work, both the Java compiler and the JVM must
- * give special treatment to signature polymorphic methods.
- * <p>
- * In source code, a call to a signature polymorphic method will
- * compile, regardless of the requested type descriptor.
- * As usual, the Java compiler emits an {@code invokevirtual}
- * instruction with the given type descriptor against the named method.
- * The unusual part is that the type descriptor is derived from
- * the actual argument and return types, not from the method declaration.
- * <p>
- * When the JVM processes bytecode containing signature polymorphic calls,
- * it will successfully link any such call, regardless of its type descriptor.
- * (In order to retain type safety, the JVM will guard such calls with suitable
- * dynamic type checks, as described elsewhere.)
- * <p>
- * Bytecode generators, including the compiler back end, are required to emit
- * untransformed type descriptors for these methods.
- * Tools which determine symbolic linkage are required to accept such
- * untransformed descriptors, without reporting linkage errors.
- * <p>
- * For the sake of tools (but not as a programming API), the signature polymorphic
- * methods are marked with a private yet standard annotation,
- * {@code @java.dyn.MethodHandle.PolymorphicSignature}.
- * The annotation's retention is {@code RUNTIME}, so that all tools can see it.
- *
- * <h3>Formal rules for processing signature polymorphic methods</h3>
- * <p>
- * The following methods (and no others) are signature polymorphic:
- * <ul>
- * <li>{@link java.dyn.MethodHandle#invokeExact   MethodHandle.invokeExact}
- * <li>{@link java.dyn.MethodHandle#invokeGeneric MethodHandle.invokeGeneric}
- * </ul>
- * <p>
- * A signature polymorphic method will be declared with the following properties:
- * <ul>
- * <li>It must be native.
- * <li>It must take a single varargs parameter of the form {@code Object...}.
- * <li>It must produce a return value of type {@code Object}.
- * <li>It must be contained within the {@code java.dyn} package.
- * </ul>
- * Because of these requirements, a signature polymorphic method is able to accept
- * any number and type of actual arguments, and can, with a cast, produce a value of any type.
- * However, the JVM will treat these declaration features as a documentation convention,
- * rather than a description of the actual structure of the methods as executed.
- * <p>
- * When a call to a signature polymorphic method is compiled, the associated linkage information for
- * its arguments is not array of {@code Object} (as for other similar varargs methods)
- * but rather the erasure of the static types of all the arguments.
- * <p>
- * In an argument position of a method invocation on a signature polymorphic method,
- * a null literal has type {@code java.lang.Void}, unless cast to a reference type.
- * (Note: This typing rule allows the null type to have its own encoding in linkage information
- * distinct from other types.
- * <p>
- * The linkage information for the return type is derived from a context-dependent target typing convention.
- * The return type for a signature polymorphic method invocation is determined as follows:
- * <ul>
- * <li>If the method invocation expression is an expression statement, the method is {@code void}.
- * <li>Otherwise, if the method invocation expression is the immediate operand of a cast,
- * the return type is the erasure of the cast type.
- * <li>Otherwise, the return type is the method's nominal return type, {@code Object}.
- * </ul>
- * (Programmers are encouraged to use explicit casts unless it is clear that a signature polymorphic
- * call will be used as a plain {@code Object} expression.)
- * <p>
- * The linkage information for argument and return types is stored in the descriptor for the
- * compiled (bytecode) call site. As for any invocation instruction, the arguments and return value
- * will be passed directly on the JVM stack, in accordance with the descriptor,
- * and without implicit boxing or unboxing.
- *
- * <h3>Interoperation between method handles and the Core Reflection API</h3>
- * Using factory methods in the {@link java.dyn.MethodHandles.Lookup Lookup} API,
- * any class member represented by a Core Reflection API object
- * can be converted to a behaviorally equivalent method handle.
- * For example, a reflective {@link java.lang.reflect.Method Method} can
- * be converted to a method handle using
- * {@link java.dyn.MethodHandles.Lookup#unreflect Lookup.unreflect}.
- * The resulting method handles generally provide more direct and efficient
- * access to the underlying class members.
- * <p>
- * As a special case,
- * when the Core Reflection API is used to view the signature polymorphic
- * methods {@code invokeExact} or {@code invokeGeneric} in this class,
- * they appear as single, non-polymorphic native methods.
- * Calls to these native methods do not result in method handle invocations.
- * Since {@code invokevirtual} instructions can natively
- * invoke method handles under any type descriptor, this reflective view conflicts
- * with the normal presentation via bytecodes.
- * Thus, these two native methods, as viewed by
- * {@link java.lang.Class#getDeclaredMethod Class.getDeclaredMethod},
- * are placeholders only.
- * If invoked via {@link java.lang.reflect.Method#invoke Method.invoke},
- * they will throw {@code UnsupportedOperationException}.
- * <p>
- * In order to obtain an invoker method for a particular type descriptor,
- * use {@link java.dyn.MethodHandles#exactInvoker MethodHandles.exactInvoker},
- * or {@link java.dyn.MethodHandles#genericInvoker MethodHandles.genericInvoker}.
- * The {@link java.dyn.MethodHandles.Lookup#findVirtual Lookup.findVirtual}
- * API is also able to return a method handle
- * to call {@code invokeExact} or {@code invokeGeneric},
- * for any specified type descriptor .
- *
- * <h3>Interoperation between method handles and Java generics</h3>
- * A method handle can be obtained on a method, constructor, or field
- * which is declared with Java generic types.
- * As with the Core Reflection API, the type of the method handle
- * will constructed from the erasure of the source-level type.
- * When a method handle is invoked, the types of its arguments
- * or the return value cast type may be generic types or type instances.
- * If this occurs, the compiler will replace those
- * types by their erasures when when it constructs the type descriptor
- * for the {@code invokevirtual} instruction.
- * <p>
- * Method handles do not represent
- * their function-like types in terms of Java parameterized (generic) types,
- * because there are three mismatches between function-like types and parameterized
- * Java types.
- * <ul>
- * <li>Method types range over all possible arities,
- * from no arguments to up to 255 of arguments (a limit imposed by the JVM).
- * Generics are not variadic, and so cannot represent this.</li>
- * <li>Method types can specify arguments of primitive types,
- * which Java generic types cannot range over.</li>
- * <li>Higher order functions over method handles (combinators) are
- * often generic across a wide range of function types, including
- * those of multiple arities.  It is impossible to represent such
- * genericity with a Java type parameter.</li>
- * </ul>
- *
- * @see MethodType
- * @see MethodHandles
- * @author John Rose, JSR 292 EG
- */
-public abstract class MethodHandle
-        // Note: This is an implementation inheritance hack, and will be removed
-        // with a JVM change which moves the required hidden state onto this class.
-        extends MethodHandleImpl
-{
-    private static Access IMPL_TOKEN = Access.getToken();
-    static { MethodHandleImpl.initStatics(); }
-
-    // interface MethodHandle<R throws X extends Exception,A...>
-    // { MethodType<R throws X,A...> type(); public R invokeExact(A...) throws X; }
-
-    /**
-     * Internal marker interface which distinguishes (to the Java compiler)
-     * those methods which are <a href="MethodHandle.html#sigpoly">signature polymorphic</a>.
-     */
-    @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})
-    @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
-    @interface PolymorphicSignature { }
-
-    private MethodType type;
-
-    /**
-     * Report the type of this method handle.
-     * Every invocation of this method handle via {@code invokeExact} must exactly match this type.
-     * @return the method handle type
-     */
-    public MethodType type() {
-        return type;
-    }
-
-    /**
-     * <em>CONSTRUCTOR WILL BE REMOVED FOR PFD:</em>
-     * Temporary constructor in early versions of the Reference Implementation.
-     * Method handle inheritance (if any) will be contained completely within
-     * the {@code java.dyn} package.
-     */
-    // The constructor for MethodHandle may only be called by privileged code.
-    // Subclasses may be in other packages, but must possess
-    // a token which they obtained from MH with a security check.
-    // @param token non-null object which proves access permission
-    // @param type type (permanently assigned) of the new method handle
-    protected MethodHandle(Access token, MethodType type) {
-        super(token);
-        Access.check(token);
-        this.type = type;
-    }
-
-    private void initType(MethodType type) {
-        type.getClass();  // elicit NPE
-        if (this.type != null)  throw new InternalError();
-        this.type = type;
-    }
-
-    static {
-        // This hack allows the implementation package special access to
-        // the internals of MethodHandle.  In particular, the MTImpl has all sorts
-        // of cached information useful to the implementation code.
-        MethodHandleImpl.setMethodHandleFriend(IMPL_TOKEN, new MethodHandleImpl.MethodHandleFriend() {
-            public void initType(MethodHandle mh, MethodType type) { mh.initType(type); }
-        });
-    }
-
-    /**
-     * Invoke the method handle, allowing any caller type descriptor, but requiring an exact type match.
-     * The type descriptor at the call site of {@code invokeExact} must
-     * exactly match this method handle's {@link #type type}.
-     * No conversions are allowed on arguments or return values.
-     * <p>
-     * When this method is observed via the Core Reflection API,
-     * it will appear as a single native method, taking an object array and returning an object.
-     * If this native method is invoked directly via
-     * {@link java.lang.reflect.Method#invoke Method.invoke}, via JNI,
-     * or indirectly via {@link java.dyn.MethodHandles.Lookup#unreflect Lookup.unreflect},
-     * it will throw an {@code UnsupportedOperationException}.
-     * @throws WrongMethodTypeException if the target's type is not identical with the caller's type descriptor
-     * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
-     */
-    public final native @PolymorphicSignature Object invokeExact(Object... args) throws Throwable;
-
-    /**
-     * Invoke the method handle, allowing any caller type descriptor,
-     * and optionally performing conversions on arguments and return values.
-     * <p>
-     * If the call site type descriptor exactly matches this method handle's {@link #type type},
-     * the call proceeds as if by {@link #invokeExact invokeExact}.
-     * <p>
-     * Otherwise, the call proceeds as if this method handle were first
-     * adjusted by calling {@link #asType asType} to adjust this method handle
-     * to the required type, and then the call proceeds as if by
-     * {@link #invokeExact invokeExact} on the adjusted method handle.
-     * <p>
-     * There is no guarantee that the {@code asType} call is actually made.
-     * If the JVM can predict the results of making the call, it may perform
-     * adaptations directly on the caller's arguments,
-     * and call the target method handle according to its own exact type.
-     * <p>
-     * The type descriptor at the call site of {@code invokeGeneric} must
-     * be a valid argument to the receivers {@code asType} method.
-     * In particular, the caller must specify the same argument arity
-     * as the callee's type,
-     * if the callee is not a {@linkplain #asVarargsCollector variable arity collector}.
-     * <p>
-     * When this method is observed via the Core Reflection API,
-     * it will appear as a single native method, taking an object array and returning an object.
-     * If this native method is invoked directly via
-     * {@link java.lang.reflect.Method#invoke Method.invoke}, via JNI,
-     * or indirectly via {@link java.dyn.MethodHandles.Lookup#unreflect Lookup.unreflect},
-     * it will throw an {@code UnsupportedOperationException}.
-     * @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's type descriptor
-     * @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails
-     * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
-     */
-    public final native @PolymorphicSignature Object invokeGeneric(Object... args) throws Throwable;
-
-    /**
-     * Perform a varargs invocation, passing the arguments in the given array
-     * to the method handle, as if via {@link #invokeGeneric invokeGeneric} from a call site
-     * which mentions only the type {@code Object}, and whose arity is the length
-     * of the argument array.
-     * <p>
-     * Specifically, execution proceeds as if by the following steps,
-     * although the methods are not guaranteed to be called if the JVM
-     * can predict their effects.
-     * <ul>
-     * <li>Determine the length of the argument array as {@code N}.
-     *     For a null reference, {@code N=0}. </li>
-     * <li>Determine the generic type {@code TN} of {@code N} arguments as
-     *     as {@code TN=MethodType.genericMethodType(N)}.</li>
-     * <li>Force the original target method handle {@code MH0} to the
-     *     required type, as {@code MH1 = MH0.asType(TN)}. </li>
-     * <li>Spread the array into {@code N} separate arguments {@code A0, ...}. </li>
-     * <li>Invoke the type-adjusted method handle on the unpacked arguments:
-     *     MH1.invokeExact(A0, ...). </li>
-     * <li>Take the return value as an {@code Object} reference. </li>
-     * </ul>
-     * <p>
-     * Because of the action of the {@code asType} step, the following argument
-     * conversions are applied as necessary:
-     * <ul>
-     * <li>reference casting
-     * <li>unboxing
-     * <li>widening primitive conversions
-     * </ul>
-     * <p>
-     * The result returned by the call is boxed if it is a primitive,
-     * or forced to null if the return type is void.
-     * <p>
-     * This call is equivalent to the following code:
-     * <p><blockquote><pre>
-     * MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
-     * Object result = invoker.invokeExact(this, arguments);
-     * </pre></blockquote>
-     * <p>
-     * Unlike the signature polymorphic methods {@code invokeExact} and {@code invokeGeneric},
-     * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
-     * It can therefore be used as a bridge between native or reflective code and method handles.
-     *
-     * @param arguments the arguments to pass to the target
-     * @return the result returned by the target
-     * @throws ClassCastException if an argument cannot be converted by reference casting
-     * @throws WrongMethodTypeException if the target's type cannot be adjusted to take the given number of {@code Object} arguments
-     * @throws Throwable anything thrown by the target method invocation
-     * @see MethodHandles#spreadInvoker
-     */
-    public Object invokeWithArguments(Object... arguments) throws Throwable {
-        int argc = arguments == null ? 0 : arguments.length;
-        MethodType type = type();
-        if (type.parameterCount() != argc) {
-            // simulate invokeGeneric
-            return asType(MethodType.genericMethodType(argc)).invokeWithArguments(arguments);
-        }
-        if (argc <= 10) {
-            MethodHandle invoker = invokers(type).genericInvoker();
-            switch (argc) {
-                case 0:  return invoker.invokeExact(this);
-                case 1:  return invoker.invokeExact(this,
-                                    arguments[0]);
-                case 2:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1]);
-                case 3:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2]);
-                case 4:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3]);
-                case 5:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3], arguments[4]);
-                case 6:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3], arguments[4], arguments[5]);
-                case 7:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3], arguments[4], arguments[5],
-                                    arguments[6]);
-                case 8:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3], arguments[4], arguments[5],
-                                    arguments[6], arguments[7]);
-                case 9:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3], arguments[4], arguments[5],
-                                    arguments[6], arguments[7], arguments[8]);
-                case 10:  return invoker.invokeExact(this,
-                                    arguments[0], arguments[1], arguments[2],
-                                    arguments[3], arguments[4], arguments[5],
-                                    arguments[6], arguments[7], arguments[8],
-                                    arguments[9]);
-            }
-        }
-
-        // more than ten arguments get boxed in a varargs list:
-        MethodHandle invoker = invokers(type).spreadInvoker(0);
-        return invoker.invokeExact(this, arguments);
-    }
-    /** Equivalent to {@code invokeWithArguments(arguments.toArray())}. */
-    public Object invokeWithArguments(java.util.List<?> arguments) throws Throwable {
-        return invokeWithArguments(arguments.toArray());
-    }
-
-    /**
-     * Produce an adapter method handle which adapts the type of the
-     * current method handle to a new type
-     * The resulting method handle is guaranteed to report a type
-     * which is equal to the desired new type.
-     * <p>
-     * If the original type and new type are equal, returns {@code this}.
-     * <p>
-     * This method provides the crucial behavioral difference between
-     * {@link #invokeExact invokeExact} and {@link #invokeGeneric invokeGeneric}.  The two methods
-     * perform the same steps when the caller's type descriptor is identical
-     * with the callee's, but when the types differ, {@link #invokeGeneric invokeGeneric}
-     * also calls {@code asType} (or some internal equivalent) in order
-     * to match up the caller's and callee's types.
-     * <p>
-     * This method is equivalent to {@link MethodHandles#convertArguments convertArguments},
-     * except for variable arity method handles produced by {@link #asVarargsCollector asVarargsCollector}.
-     *
-     * @param newType the expected type of the new method handle
-     * @return a method handle which delegates to {@code this} after performing
-     *           any necessary argument conversions, and arranges for any
-     *           necessary return value conversions
-     * @throws WrongMethodTypeException if the conversion cannot be made
-     * @see MethodHandles#convertArguments
-     */
-    public MethodHandle asType(MethodType newType) {
-        return MethodHandles.convertArguments(this, newType);
-    }
-
-    /**
-     * Make an adapter which accepts a trailing array argument
-     * and spreads its elements as positional arguments.
-     * The new method handle adapts, as its <i>target</i>,
-     * the current method handle.  The type of the adapter will be
-     * the same as the type of the target, except that the final
-     * {@code arrayLength} parameters of the target's type are replaced
-     * by a single array parameter of type {@code arrayType}.
-     * <p>
-     * If the array element type differs from any of the corresponding
-     * argument types on the original target,
-     * the original target is adapted to take the array elements directly,
-     * as if by a call to {@link #asType asType}.
-     * <p>
-     * When called, the adapter replaces a trailing array argument
-     * by the array's elements, each as its own argument to the target.
-     * (The order of the arguments is preserved.)
-     * They are converted pairwise by casting and/or unboxing
-     * to the types of the trailing parameters of the target.
-     * Finally the target is called.
-     * What the target eventually returns is returned unchanged by the adapter.
-     * <p>
-     * Before calling the target, the adapter verifies that the array
-     * contains exactly enough elements to provide a correct argument count
-     * to the target method handle.
-     * (The array may also be null when zero elements are required.)
-     * @param arrayType usually {@code Object[]}, the type of the array argument from which to extract the spread arguments
-     * @param arrayLength the number of arguments to spread from an incoming array argument
-     * @return a new method handle which spreads its final array argument,
-     *         before calling the original method handle
-     * @throws IllegalArgumentException if {@code arrayType} is not an array type
-     * @throws IllegalArgumentException if target does not have at least
-     *         {@code arrayLength} parameter types
-     * @throws WrongMethodTypeException if the implied {@code asType} call fails
-     * @see #asCollector
-     */
-    public MethodHandle asSpreader(Class<?> arrayType, int arrayLength) {
-        Class<?> arrayElement = arrayType.getComponentType();
-        if (arrayElement == null)  throw newIllegalArgumentException("not an array type");
-        MethodType oldType = type();
-        int nargs = oldType.parameterCount();
-        if (nargs < arrayLength)  throw newIllegalArgumentException("bad spread array length");
-        int keepPosArgs = nargs - arrayLength;
-        MethodType newType = oldType.dropParameterTypes(keepPosArgs, nargs);
-        newType = newType.insertParameterTypes(keepPosArgs, arrayType);
-        return MethodHandles.spreadArguments(this, newType);
-    }
-
-    /**
-     * Make an adapter which accepts a given number of trailing
-     * positional arguments and collects them into an array argument.
-     * The new method handle adapts, as its <i>target</i>,
-     * the current method handle.  The type of the adapter will be
-     * the same as the type of the target, except that a single trailing
-     * parameter (usually of type {@code arrayType}) is replaced by
-     * {@code arrayLength} parameters whose type is element type of {@code arrayType}.
-     * <p>
-     * If the array type differs from the final argument type on the original target,
-     * the original target is adapted to take the array type directly,
-     * as if by a call to {@link #asType asType}.
-     * <p>
-     * When called, the adapter replaces its trailing {@code arrayLength}
-     * arguments by a single new array of type {@code arrayType}, whose elements
-     * comprise (in order) the replaced arguments.
-     * Finally the target is called.
-     * What the target eventually returns is returned unchanged by the adapter.
-     * <p>
-     * (The array may also be a shared constant when {@code arrayLength} is zero.)
-     * <p>
-     * (<em>Note:</em> The {@code arrayType} is often identical to the last
-     * parameter type of the original target.
-     * It is an explicit argument for symmetry with {@code asSpreader}, and also
-     * to allow the target to use a simple {@code Object} as its last parameter type.)
-     * <p>
-     * In order to create a collecting adapter which is not restricted to a particular
-     * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector} instead.
-     * @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments
-     * @param arrayLength the number of arguments to collect into a new array argument
-     * @return a new method handle which collects some trailing argument
-     *         into an array, before calling the original method handle
-     * @throws IllegalArgumentException if {@code arrayType} is not an array type
-     *         or {@code arrayType} is not assignable to this method handle's trailing parameter type,
-     *         or {@code arrayLength} is not a legal array size
-     * @throws WrongMethodTypeException if the implied {@code asType} call fails
-     * @see #asSpreader
-     * @see #asVarargsCollector
-     */
-    public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
-        Class<?> arrayElement = arrayType.getComponentType();
-        if (arrayElement == null)  throw newIllegalArgumentException("not an array type");
-        MethodType oldType = type();
-        int nargs = oldType.parameterCount();
-        if (nargs == 0)  throw newIllegalArgumentException("no trailing argument");
-        MethodType newType = oldType.dropParameterTypes(nargs-1, nargs);
-        newType = newType.insertParameterTypes(nargs-1,
-                    java.util.Collections.<Class<?>>nCopies(arrayLength, arrayElement));
-        return MethodHandles.collectArguments(this, newType);
-    }
-
-    /**
-     * Make a <em>variable arity</em> adapter which is able to accept
-     * any number of trailing positional arguments and collect them
-     * into an array argument.
-     * <p>
-     * The type and behavior of the adapter will be the same as
-     * the type and behavior of the target, except that certain
-     * {@code invokeGeneric} and {@code asType} requests can lead to
-     * trailing positional arguments being collected into target's
-     * trailing parameter.
-     * Also, the last parameter type of the adapter will be
-     * {@code arrayType}, even if the target has a different
-     * last parameter type.
-     * <p>
-     * When called with {@link #invokeExact invokeExact}, the adapter invokes
-     * the target with no argument changes.
-     * (<em>Note:</em> This behavior is different from a
-     * {@linkplain #asCollector fixed arity collector},
-     * since it accepts a whole array of indeterminate length,
-     * rather than a fixed number of arguments.)
-     * <p>
-     * When called with {@link #invokeGeneric invokeGeneric}, if the caller
-     * type is the same as the adapter, the adapter invokes the target as with
-     * {@code invokeExact}.
-     * (This is the normal behavior for {@code invokeGeneric} when types match.)
-     * <p>
-     * Otherwise, if the caller and adapter arity are the same, and the
-     * trailing parameter type of the caller is a reference type identical to
-     * or assignable to the trailing parameter type of the adapter,
-     * the arguments and return values are converted pairwise,
-     * as if by {@link MethodHandles#convertArguments convertArguments}.
-     * (This is also normal behavior for {@code invokeGeneric} in such a case.)
-     * <p>
-     * Otherwise, the arities differ, or the adapter's trailing parameter
-     * type is not assignable from the corresponding caller type.
-     * In this case, the adapter replaces all trailing arguments from
-     * the original trailing argument position onward, by
-     * a new array of type {@code arrayType}, whose elements
-     * comprise (in order) the replaced arguments.
-     * <p>
-     * The caller type must provides as least enough arguments,
-     * and of the correct type, to satisfy the target's requirement for
-     * positional arguments before the trailing array argument.
-     * Thus, the caller must supply, at a minimum, {@code N-1} arguments,
-     * where {@code N} is the arity of the target.
-     * Also, there must exist conversions from the incoming arguments
-     * to the target's arguments.
-     * As with other uses of {@code invokeGeneric}, if these basic
-     * requirements are not fulfilled, a {@code WrongMethodTypeException}
-     * may be thrown.
-     * <p>
-     * In all cases, what the target eventually returns is returned unchanged by the adapter.
-     * <p>
-     * In the final case, it is exactly as if the target method handle were
-     * temporarily adapted with a {@linkplain #asCollector fixed arity collector}
-     * to the arity required by the caller type.
-     * (As with {@code asCollector}, if the array length is zero,
-     * a shared constant may be used instead of a new array.
-     * If the implied call to {@code asCollector} would throw
-     * an {@code IllegalArgumentException} or {@code WrongMethodTypeException},
-     * the call to the variable arity adapter must throw
-     * {@code WrongMethodTypeException}.)
-     * <p>
-     * The behavior of {@link #asType asType} is also specialized for
-     * variable arity adapters, to maintain the invariant that
-     * {@code invokeGeneric} is always equivalent to an {@code asType}
-     * call to adjust the target type, followed by {@code invokeExact}.
-     * Therefore, a variable arity adapter responds
-     * to an {@code asType} request by building a fixed arity collector,
-     * if and only if the adapter and requested type differ either
-     * in arity or trailing argument type.
-     * The resulting fixed arity collector has its type further adjusted
-     * (if necessary) to the requested type by pairwise conversion,
-     * as if by another application of {@code asType}.
-     * <p>
-     * When a method handle is obtained by executing an {@code ldc} instruction
-     * of a {@code CONSTANT_MethodHandle} constant, and the target method is marked
-     * as a variable arity method (with the modifier bit {@code 0x0080}),
-     * the method handle will accept multiple arities, as if the method handle
-     * constant were created by means of a call to {@code asVarargsCollector}.
-     * <p>
-     * In order to create a collecting adapter which collects a predetermined
-     * number of arguments, and whose type reflects this predetermined number,
-     * use {@link #asCollector asCollector} instead.
-     * <p>
-     * No method handle transformations produce new method handles with
-     * variable arity, unless they are documented as doing so.
-     * Therefore, besides {@code asVarargsCollector},
-     * all methods in {@code MethodHandle} and {@code MethodHandles}
-     * will return a method handle with fixed arity,
-     * except in the cases where they are specified to return their original
-     * operand (e.g., {@code asType} of the method handle's own type).
-     * <p>
-     * Calling {@code asVarargsCollector} on a method handle which is already
-     * of variable arity will produce a method handle with the same type and behavior.
-     * It may (or may not) return the original variable arity method handle.
-     * <p>
-     * Here is an example, of a list-making variable arity method handle:
-     * <blockquote><pre>
-MethodHandle asList = publicLookup()
-  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
-  .asVarargsCollector(Object[].class);
-assertEquals("[]", asList.invokeGeneric().toString());
-assertEquals("[1]", asList.invokeGeneric(1).toString());
-assertEquals("[two, too]", asList.invokeGeneric("two", "too").toString());
-Object[] argv = { "three", "thee", "tee" };
-assertEquals("[three, thee, tee]", asList.invokeGeneric(argv).toString());
-List ls = (List) asList.invokeGeneric((Object)argv);
-assertEquals(1, ls.size());
-assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
-     * </pre></blockquote>
-     * <p style="font-size:smaller;">
-     * <em>Discussion:</em>
-     * These rules are designed as a dynamically-typed variation
-     * of the Java rules for variable arity methods.
-     * In both cases, callers to a variable arity method or method handle
-     * can either pass zero or more positional arguments, or else pass
-     * pre-collected arrays of any length.  Users should be aware of the
-     * special role of the final argument, and of the effect of a
-     * type match on that final argument, which determines whether
-     * or not a single trailing argument is interpreted as a whole
-     * array or a single element of an array to be collected.
-     * Note that the dynamic type of the trailing argument has no
-     * effect on this decision, only a comparison between the static
-     * type descriptor of the call site and the type of the method handle.)
-     * <p style="font-size:smaller;">
-     * As a result of the previously stated rules, the variable arity behavior
-     * of a method handle may be suppressed, by binding it to the exact invoker
-     * of its own type, as follows:
-     * <blockquote><pre>
-MethodHandle vamh = publicLookup()
-  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
-  .asVarargsCollector(Object[].class);
-MethodHandle mh = MethodHandles.exactInvoker(vamh.type()).bindTo(vamh);
-assert(vamh.type().equals(mh.type()));
-assertEquals("[1, 2, 3]", vamh.invokeGeneric(1,2,3).toString());
-boolean failed = false;
-try { mh.invokeGeneric(1,2,3); }
-catch (WrongMethodTypeException ex) { failed = true; }
-assert(failed);
-     * </pre></blockquote>
-     * This transformation has no behavioral effect if the method handle is
-     * not of variable arity.
-     *
-     * @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments
-     * @return a new method handle which can collect any number of trailing arguments
-     *         into an array, before calling the original method handle
-     * @throws IllegalArgumentException if {@code arrayType} is not an array type
-     *         or {@code arrayType} is not assignable to this method handle's trailing parameter type
-     * @see #asCollector
-     * @see #isVarargsCollector
-     */
-    public MethodHandle asVarargsCollector(Class<?> arrayType) {
-        Class<?> arrayElement = arrayType.getComponentType();
-        if (arrayElement == null)  throw newIllegalArgumentException("not an array type");
-        return MethodHandles.asVarargsCollector(this, arrayType);
-    }
-
-    /**
-     * Determine if this method handle
-     * supports {@linkplain #asVarargsCollector variable arity} calls.
-     * Such method handles arise from the following sources:
-     * <ul>
-     * <li>a call to {@linkplain #asVarargsCollector asVarargsCollector}
-     * <li>a call to a {@linkplain java.dyn.MethodHandles.Lookup lookup method}
-     *     which resolves to a variable arity Java method or constructor
-     * <li>an {@code ldc} instruction of a {@code CONSTANT_MethodHandle}
-     *     which resolves to a variable arity Java method or constructor
-     * </ul>
-     * @return true if this method handle accepts more than one arity of {@code invokeGeneric} calls
-     * @see #asVarargsCollector
-     */
-    public boolean isVarargsCollector() {
-        return false;
-    }
-
-    /**
-     * Bind a value {@code x} to the first argument of a method handle, without invoking it.
-     * The new method handle adapts, as its <i>target</i>,
-     * to the current method handle.
-     * The type of the bound handle will be
-     * the same as the type of the target, except that a single leading
-     * reference parameter will be omitted.
-     * <p>
-     * When called, the bound handle inserts the given value {@code x}
-     * as a new leading argument to the target.  The other arguments are
-     * also passed unchanged.
-     * What the target eventually returns is returned unchanged by the bound handle.
-     * <p>
-     * The reference {@code x} must be convertible to the first parameter
-     * type of the target.
-     * @param x  the value to bind to the first argument of the target
-     * @return a new method handle which collects some trailing argument
-     *         into an array, before calling the original method handle
-     * @throws IllegalArgumentException if the target does not have a
-     *         leading parameter type that is a reference type
-     * @throws ClassCastException if {@code x} cannot be converted
-     *         to the leading parameter type of the target
-     * @see MethodHandles#insertArguments
-     */
-    public MethodHandle bindTo(Object x) {
-        return MethodHandles.insertArguments(this, 0, x);
-    }
-
-    /**
-     * Returns a string representation of the method handle,
-     * starting with the string {@code "MethodHandle"} and
-     * ending with the string representation of the method handle's type.
-     * In other words, this method returns a string equal to the value of:
-     * <blockquote><pre>
-     * "MethodHandle" + type().toString()
-     * </pre></blockquote>
-     * <p>
-     * Note:  Future releases of this API may add further information
-     * to the string representation.
-     * Therefore, the present syntax should not be parsed by applications.
-     *
-     * @return a string representation of the method handle
-     */
-    @Override
-    public String toString() {
-        return MethodHandleImpl.getNameString(IMPL_TOKEN, this);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/MethodHandles.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2339 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 java.dyn;
-
-import java.lang.reflect.*;
-import sun.dyn.Access;
-import sun.dyn.MemberName;
-import sun.dyn.MethodHandleImpl;
-import sun.dyn.WrapperInstance;
-import sun.dyn.util.ValueConversions;
-import sun.dyn.util.VerifyAccess;
-import sun.dyn.util.Wrapper;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import sun.dyn.Invokers;
-import sun.dyn.MethodTypeImpl;
-import sun.reflect.Reflection;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-import static sun.dyn.MemberName.newNoAccessException;
-
-/**
- * This class consists exclusively of static methods that operate on or return
- * method handles. They fall into several categories:
- * <ul>
- * <li>Lookup methods which help create method handles for methods and fields.
- * <li>Combinator methods, which combine or transform pre-existing method handles into new ones.
- * <li>Other factory methods to create method handles that emulate other common JVM operations or control flow patterns.
- * <li>Wrapper methods which can convert between method handles and other function-like "SAM types".
- * </ul>
- * <p>
- * @author John Rose, JSR 292 EG
- */
-public class MethodHandles {
-
-    private MethodHandles() { }  // do not instantiate
-
-    private static final Access IMPL_TOKEN = Access.getToken();
-    private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory(IMPL_TOKEN);
-    static { MethodHandleImpl.initStatics(); }
-    // See IMPL_LOOKUP below.
-
-    //// Method handle creation from ordinary methods.
-
-    /**
-     * Return a {@link Lookup lookup object} on the caller,
-     * which has the capability to access any method handle that the caller has access to,
-     * including direct method handles to private fields and methods.
-     * This lookup object is a <em>capability</em> which may be delegated to trusted agents.
-     * Do not store it in place where untrusted code can access it.
-     */
-    public static Lookup lookup() {
-        return new Lookup();
-    }
-
-    /**
-     * Return a {@link Lookup lookup object} which is trusted minimally.
-     * It can only be used to create method handles to
-     * publicly accessible fields and methods.
-     * <p>
-     * As a matter of pure convention, the {@linkplain Lookup#lookupClass lookup class}
-     * of this lookup object will be {@link java.lang.Object}.
-     * <p>
-     * The lookup class can be changed to any other class {@code C} using an expression of the form
-     * {@linkplain Lookup#in <code>publicLookup().in(C.class)</code>}.
-     * Since all classes have equal access to public names,
-     * such a change would confer no new access rights.
-     */
-    public static Lookup publicLookup() {
-        return Lookup.PUBLIC_LOOKUP;
-    }
-
-    /**
-     * A <em>lookup object</em> is a factory for creating method handles,
-     * when the creation requires access checking.
-     * Method handles do not perform
-     * access checks when they are called, but rather when they are created.
-     * Therefore, method handle access
-     * restrictions must be enforced when a method handle is created.
-     * The caller class against which those restrictions are enforced
-     * is known as the {@linkplain #lookupClass lookup class}.
-     * <p>
-     * A lookup class which needs to create method handles will call
-     * {@link MethodHandles#lookup MethodHandles.lookup} to create a factory for itself.
-     * When the {@code Lookup} factory object is created, the identity of the lookup class is
-     * determined, and securely stored in the {@code Lookup} object.
-     * The lookup class (or its delegates) may then use factory methods
-     * on the {@code Lookup} object to create method handles for access-checked members.
-     * This includes all methods, constructors, and fields which are allowed to the lookup class,
-     * even private ones.
-     * <p>
-     * The factory methods on a {@code Lookup} object correspond to all major
-     * use cases for methods, constructors, and fields.
-     * Here is a summary of the correspondence between these factory methods and
-     * the behavior the resulting method handles:
-     * <code>
-     * <table border=1 cellpadding=5 summary="lookup method behaviors">
-     * <tr><th>lookup expression</th><th>member</th><th>behavior</th></tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td>
-     *     <td>FT f;</td><td>(T) this.f;</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</td>
-     *     <td>static<br>FT f;</td><td>(T) C.f;</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</td>
-     *     <td>FT f;</td><td>this.f = x;</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}</td>
-     *     <td>static<br>FT f;</td><td>C.f = arg;</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}</td>
-     *     <td>T m(A*);</td><td>(T) this.m(arg*);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}</td>
-     *     <td>static<br>T m(A*);</td><td>(T) C.m(arg*);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}</td>
-     *     <td>T m(A*);</td><td>(T) super.m(arg*);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}</td>
-     *     <td>C(A*);</td><td>(T) new C(arg*);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}</td>
-     *     <td>(static)?<br>FT f;</td><td>(FT) aField.get(thisOrNull);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}</td>
-     *     <td>(static)?<br>FT f;</td><td>aField.set(thisOrNull, arg);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
-     *     <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}</td>
-     *     <td>C(A*);</td><td>(C) aConstructor.newInstance(arg*);</td>
-     * </tr>
-     * <tr>
-     *     <td>{@linkplain java.dyn.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
-     *     <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td>
-     * </tr>
-     * </table>
-     * </code>
-     * Here, the type {@code C} is the class or interface being searched for a member,
-     * documented as a parameter named {@code refc} in the lookup methods.
-     * The method or constructor type {@code MT} is composed from the return type {@code T}
-     * and the sequence of argument types {@code A*}.
-     * Both {@code MT} and the field type {@code FT} are documented as a parameter named {@code type}.
-     * The formal parameter {@code this} stands for the self-reference of type {@code C};
-     * if it is present, it is always the leading argument to the method handle invocation.
-     * The name {@code arg} stands for all the other method handle arguments.
-     * In the code examples for the Core Reflection API, the name {@code thisOrNull}
-     * stands for a null reference if the accessed method or field is static,
-     * and {@code this} otherwise.
-     * The names {@code aMethod}, {@code aField}, and {@code aConstructor} stand
-     * for reflective objects corresponding to the given members.
-     * <p>
-     * The equivalence between looked-up method handles and underlying
-     * class members can break down in a few ways:
-     * <ul>
-     * <li>If {@code C} is not symbolically accessible from the lookup class's loader,
-     * the lookup can still succeed, even when there is no equivalent
-     * Java expression or bytecoded constant.
-     * <li>Likewise, if {@code T} or {@code MT}
-     * is not symbolically accessible from the lookup class's loader,
-     * the lookup can still succeed.
-     * For example, lookups for {@code MethodHandle.invokeExact} and
-     * {@code MethodHandle.invokeGeneric} will always succeed, regardless of requested type.
-     * <li>If there is a security manager installed, it can forbid the lookup
-     * on various grounds (<a href="#secmgr">see below</a>).
-     * By contrast, the {@code ldc} instruction is not subject to
-     * security manager checks.
-     * </ul>
-     *
-     * <h3><a name="access"></a>Access checking</h3>
-     * Access checks are applied in the factory methods of {@code Lookup},
-     * when a method handle is created.
-     * This is a key difference from the Core Reflection API, since
-     * {@link java.lang.reflect.Method#invoke Method.invoke}
-     * performs access checking against every caller, on every call.
-     * <p>
-     * All access checks start from a {@code Lookup} object, which
-     * compares its recorded lookup class against all requests to
-     * create method handles.
-     * A single {@code Lookup} object can be used to create any number
-     * of access-checked method handles, all checked against a single
-     * lookup class.
-     * <p>
-     * A {@code Lookup} object can be shared with other trusted code,
-     * such as a metaobject protocol.
-     * A shared {@code Lookup} object delegates the capability
-     * to create method handles on private members of the lookup class.
-     * Even if privileged code uses the {@code Lookup} object,
-     * the access checking is confined to the privileges of the
-     * original lookup class.
-     * <p>
-     * A lookup can fail, because
-     * the containing class is not accessible to the lookup class, or
-     * because the desired class member is missing, or because the
-     * desired class member is not accessible to the lookup class.
-     * In any of these cases, a {@code ReflectiveOperationException} will be
-     * thrown from the attempted lookup.  The exact class will be one of
-     * the following:
-     * <ul>
-     * <li>NoSuchMethodException &mdash; if a method is requested but does not exist
-     * <li>NoSuchFieldException &mdash; if a field is requested but does not exist
-     * <li>IllegalAccessException &mdash; if the member exists but an access check fails
-     * </ul>
-     * <p>
-     * In general, the conditions under which a method handle may be
-     * looked up for a method {@code M} are exactly equivalent to the conditions
-     * under which the lookup class could have compiled and resolved a call to {@code M}.
-     * And the effect of invoking the method handle resulting from the lookup
-     * is exactly equivalent to executing the compiled and resolved call to {@code M}.
-     * The same point is true of fields and constructors.
-     * <p>
-     * In some cases, access between nested classes is obtained by the Java compiler by creating
-     * an wrapper method to access a private method of another class
-     * in the same top-level declaration.
-     * For example, a nested class {@code C.D}
-     * can access private members within other related classes such as
-     * {@code C}, {@code C.D.E}, or {@code C.B},
-     * but the Java compiler may need to generate wrapper methods in
-     * those related classes.  In such cases, a {@code Lookup} object on
-     * {@code C.E} would be unable to those private members.
-     * A workaround for this limitation is the {@link Lookup#in Lookup.in} method,
-     * which can transform a lookup on {@code C.E} into one on any of those other
-     * classes, without special elevation of privilege.
-     * <p>
-     * Although bytecode instructions can only refer to classes in
-     * a related class loader, this API can search for methods in any
-     * class, as long as a reference to its {@code Class} object is
-     * available.  Such cross-loader references are also possible with the
-     * Core Reflection API, and are impossible to bytecode instructions
-     * such as {@code invokestatic} or {@code getfield}.
-     * There is a {@linkplain java.lang.SecurityManager security manager API}
-     * to allow applications to check such cross-loader references.
-     * These checks apply to both the {@code MethodHandles.Lookup} API
-     * and the Core Reflection API
-     * (as found on {@link java.lang.Class Class}).
-     * <p>
-     * Access checks only apply to named and reflected methods,
-     * constructors, and fields.
-     * Other method handle creation methods, such as
-     * {@link #convertArguments MethodHandles.convertArguments},
-     * do not require any access checks, and are done
-     * with static methods of {@link MethodHandles},
-     * independently of any {@code Lookup} object.
-     *
-     * <h3>Security manager interactions</h3>
-     * <a name="secmgr"></a>
-     * If a security manager is present, member lookups are subject to
-     * additional checks.
-     * From one to four calls are made to the security manager.
-     * Any of these calls can refuse access by throwing a
-     * {@link java.lang.SecurityException SecurityException}.
-     * Define {@code smgr} as the security manager,
-     * {@code refc} as the containing class in which the member
-     * is being sought, and {@code defc} as the class in which the
-     * member is actually defined.
-     * The calls are made according to the following rules:
-     * <ul>
-     * <li>In all cases, {@link SecurityManager#checkMemberAccess
-     *     smgr.checkMemberAccess(refc, Member.PUBLIC)} is called.
-     * <li>If the class loader of the lookup class is not
-     *     the same as or an ancestor of the class loader of {@code refc},
-     *     then {@link SecurityManager#checkPackageAccess
-     *     smgr.checkPackageAccess(refcPkg)} is called,
-     *     where {@code refcPkg} is the package of {@code refc}.
-     * <li>If the retrieved member is not public,
-     *     {@link SecurityManager#checkMemberAccess
-     *     smgr.checkMemberAccess(defc, Member.DECLARED)} is called.
-     *     (Note that {@code defc} might be the same as {@code refc}.)
-     * <li>If the retrieved member is not public,
-     *     and if {@code defc} and {@code refc} are in different class loaders,
-     *     and if the class loader of the lookup class is not
-     *     the same as or an ancestor of the class loader of {@code defc},
-     *     then {@link SecurityManager#checkPackageAccess
-     *     smgr.checkPackageAccess(defcPkg)} is called,
-     *     where {@code defcPkg} is the package of {@code defc}.
-     * </ul>
-     * In all cases, the requesting class presented to the security
-     * manager will be the lookup class from the current {@code Lookup} object.
-     */
-    public static final
-    class Lookup {
-        /** The class on behalf of whom the lookup is being performed. */
-        private final Class<?> lookupClass;
-
-        /** The allowed sorts of members which may be looked up (PUBLIC, etc.). */
-        private final int allowedModes;
-
-        /** A single-bit mask representing {@code public} access,
-         *  which may contribute to the result of {@link #lookupModes lookupModes}.
-         *  The value, {@code 0x01}, happens to be the same as the value of the
-         *  {@code public} {@linkplain java.lang.reflect.Modifier#PUBLIC modifier bit}.
-         */
-        public static final int PUBLIC = Modifier.PUBLIC;
-
-        /** A single-bit mask representing {@code private} access,
-         *  which may contribute to the result of {@link #lookupModes lookupModes}.
-         *  The value, {@code 0x02}, happens to be the same as the value of the
-         *  {@code private} {@linkplain java.lang.reflect.Modifier#PRIVATE modifier bit}.
-         */
-        public static final int PRIVATE = Modifier.PRIVATE;
-
-        /** A single-bit mask representing {@code protected} access,
-         *  which may contribute to the result of {@link #lookupModes lookupModes}.
-         *  The value, {@code 0x04}, happens to be the same as the value of the
-         *  {@code protected} {@linkplain java.lang.reflect.Modifier#PROTECTED modifier bit}.
-         */
-        public static final int PROTECTED = Modifier.PROTECTED;
-
-        /** A single-bit mask representing {@code package} access (default access),
-         *  which may contribute to the result of {@link #lookupModes lookupModes}.
-         *  The value is {@code 0x08}, which does not correspond meaningfully to
-         *  any particular {@linkplain java.lang.reflect.Modifier modifier bit}.
-         */
-        public static final int PACKAGE = Modifier.STATIC;
-
-        private static final int ALL_MODES = (PUBLIC | PRIVATE | PROTECTED | PACKAGE);
-        private static final int TRUSTED   = -1;
-
-        private static int fixmods(int mods) {
-            mods &= (ALL_MODES - PACKAGE);
-            return (mods != 0) ? mods : PACKAGE;
-        }
-
-        /** Tells which class is performing the lookup.  It is this class against
-         *  which checks are performed for visibility and access permissions.
-         *  <p>
-         *  The class implies a maximum level of access permission,
-         *  but the permissions may be additionally limited by the bitmask
-         *  {@link #lookupModes lookupModes}, which controls whether non-public members
-         *  can be accessed.
-         */
-        public Class<?> lookupClass() {
-            return lookupClass;
-        }
-
-        // This is just for calling out to MethodHandleImpl.
-        private Class<?> lookupClassOrNull() {
-            return (allowedModes == TRUSTED) ? null : lookupClass;
-        }
-
-        /** Tells which access-protection classes of members this lookup object can produce.
-         *  The result is a bit-mask of the bits
-         *  {@linkplain #PUBLIC PUBLIC (0x01)},
-         *  {@linkplain #PRIVATE PRIVATE (0x02)},
-         *  {@linkplain #PROTECTED PROTECTED (0x04)},
-         *  and {@linkplain #PACKAGE PACKAGE (0x08)}.
-         *  <p>
-         *  A freshly-created lookup object
-         *  on the {@linkplain java.dyn.MethodHandles#lookup() caller's class}
-         *  has all possible bits set, since the caller class can access all its own members.
-         *  A lookup object on a new lookup class
-         *  {@linkplain java.dyn.MethodHandles.Lookup#in created from a previous lookup object}
-         *  may have some mode bits set to zero.
-         *  The purpose of this is to restrict access via the new lookup object,
-         *  so that it can access only names which can be reached by the original
-         *  lookup object, and also by the new lookup class.
-         */
-        public int lookupModes() {
-            return allowedModes & ALL_MODES;
-        }
-
-        /** Embody the current class (the lookupClass) as a lookup class
-         * for method handle creation.
-         * Must be called by from a method in this package,
-         * which in turn is called by a method not in this package.
-         * <p>
-         * Also, don't make it private, lest javac interpose
-         * an access$N method.
-         */
-        Lookup() {
-            this(getCallerClassAtEntryPoint(), ALL_MODES);
-            // make sure we haven't accidentally picked up a privileged class:
-            checkUnprivilegedlookupClass(lookupClass);
-        }
-
-        Lookup(Access token, Class<?> lookupClass) {
-            this(lookupClass, ALL_MODES);
-            Access.check(token);
-        }
-
-        private Lookup(Class<?> lookupClass, int allowedModes) {
-            this.lookupClass = lookupClass;
-            this.allowedModes = allowedModes;
-        }
-
-        /**
-         * Creates a lookup on the specified new lookup class.
-         * The resulting object will report the specified
-         * class as its own {@link #lookupClass lookupClass}.
-         * <p>
-         * However, the resulting {@code Lookup} object is guaranteed
-         * to have no more access capabilities than the original.
-         * In particular, access capabilities can be lost as follows:<ul>
-         * <li>If the new lookup class differs from the old one,
-         * protected members will not be accessible by virtue of inheritance.
-         * (Protected members may continue to be accessible because of package sharing.)
-         * <li>If the new lookup class is in a different package
-         * than the old one, protected and default (package) members will not be accessible.
-         * <li>If the new lookup class is not within the same package member
-         * as the old one, private members will not be accessible.
-         * <li>If the new lookup class is not accessible to the old lookup class,
-         * then no members, not even public members, will be accessible.
-         * (In all other cases, public members will continue to be accessible.)
-         * </ul>
-         *
-         * @param requestedLookupClass the desired lookup class for the new lookup object
-         * @return a lookup object which reports the desired lookup class
-         * @throws NullPointerException if the argument is null
-         */
-        public Lookup in(Class<?> requestedLookupClass) {
-            requestedLookupClass.getClass();  // null check
-            if (allowedModes == TRUSTED)  // IMPL_LOOKUP can make any lookup at all
-                return new Lookup(requestedLookupClass, ALL_MODES);
-            if (requestedLookupClass == this.lookupClass)
-                return this;  // keep same capabilities
-            int newModes = (allowedModes & (ALL_MODES & ~PROTECTED));
-            if ((newModes & PACKAGE) != 0
-                && !VerifyAccess.isSamePackage(this.lookupClass, requestedLookupClass)) {
-                newModes &= ~(PACKAGE|PRIVATE);
-            }
-            // Allow nestmate lookups to be created without special privilege:
-            if ((newModes & PRIVATE) != 0
-                && !VerifyAccess.isSamePackageMember(this.lookupClass, requestedLookupClass)) {
-                newModes &= ~PRIVATE;
-            }
-            if (newModes == PUBLIC
-                && !VerifyAccess.isClassAccessible(requestedLookupClass, this.lookupClass)) {
-                // The requested class it not accessible from the lookup class.
-                // No permissions.
-                newModes = 0;
-            }
-            checkUnprivilegedlookupClass(requestedLookupClass);
-            return new Lookup(requestedLookupClass, newModes);
-        }
-
-        // Make sure outer class is initialized first.
-        static { IMPL_TOKEN.getClass(); }
-
-        /** Version of lookup which is trusted minimally.
-         *  It can only be used to create method handles to
-         *  publicly accessible members.
-         */
-        static final Lookup PUBLIC_LOOKUP = new Lookup(Object.class, PUBLIC);
-
-        /** Package-private version of lookup which is trusted. */
-        static final Lookup IMPL_LOOKUP = new Lookup(Object.class, TRUSTED);
-        static { MethodHandleImpl.initLookup(IMPL_TOKEN, IMPL_LOOKUP); }
-
-        private static void checkUnprivilegedlookupClass(Class<?> lookupClass) {
-            String name = lookupClass.getName();
-            if (name.startsWith("java.dyn.") || name.startsWith("sun.dyn."))
-                throw newIllegalArgumentException("illegal lookupClass: "+lookupClass);
-        }
-
-        /**
-         * Displays the name of the class from which lookups are to be made.
-         * (The name is the one reported by {@link java.lang.Class#getName() Class.getName}.)
-         * If there are restrictions on the access permitted to this lookup,
-         * this is indicated by adding a suffix to the class name, consisting
-         * of a slash and a keyword.  The keyword represents the strongest
-         * allowed access, and is chosen as follows:
-         * <ul>
-         * <li>If no access is allowed, the suffix is "/noaccess".
-         * <li>If only public access is allowed, the suffix is "/public".
-         * <li>If only public and package access are allowed, the suffix is "/package".
-         * <li>If only public, package, and private access are allowed, the suffix is "/private".
-         * </ul>
-         * If none of the above cases apply, it is the case that full
-         * access (public, package, private, and protected) is allowed.
-         * In this case, no suffix is added.
-         * This is true only of an object obtained originally from
-         * {@link java.dyn.MethodHandles#lookup MethodHandles.lookup}.
-         * Objects created by {@link java.dyn.MethodHandles.Lookup#in Lookup.in}
-         * always have restricted access, and will display a suffix.
-         * <p>
-         * (It may seem strange that protected access should be
-         * stronger than private access.  Viewed independently from
-         * package access, protected access is the first to be lost,
-         * because it requires a direct subclass relationship between
-         * caller and callee.)
-         * @see #in
-         */
-        @Override
-        public String toString() {
-            String cname = lookupClass.getName();
-            switch (allowedModes) {
-            case 0:  // no privileges
-                return cname + "/noaccess";
-            case PUBLIC:
-                return cname + "/public";
-            case PUBLIC|PACKAGE:
-                return cname + "/package";
-            case ALL_MODES & ~PROTECTED:
-                return cname + "/private";
-            case ALL_MODES:
-                return cname;
-            case TRUSTED:
-                return "/trusted";  // internal only; not exported
-            default:  // Should not happen, but it's a bitfield...
-                cname = cname + "/" + Integer.toHexString(allowedModes);
-                assert(false) : cname;
-                return cname;
-            }
-        }
-
-        // call this from an entry point method in Lookup with extraFrames=0.
-        private static Class<?> getCallerClassAtEntryPoint() {
-            final int CALLER_DEPTH = 4;
-            // 0: Reflection.getCC, 1: getCallerClassAtEntryPoint,
-            // 2: Lookup.<init>, 3: MethodHandles.*, 4: caller
-            // Note:  This should be the only use of getCallerClass in this file.
-            assert(Reflection.getCallerClass(CALLER_DEPTH-1) == MethodHandles.class);
-            return Reflection.getCallerClass(CALLER_DEPTH);
-        }
-
-        /**
-         * Produces a method handle for a static method.
-         * The type of the method handle will be that of the method.
-         * (Since static methods do not take receivers, there is no
-         * additional receiver argument inserted into the method handle type,
-         * as there would be with {@link #findVirtual findVirtual} or {@link #findSpecial findSpecial}.)
-         * The method and all its argument types must be accessible to the lookup class.
-         * If the method's class has not yet been initialized, that is done
-         * immediately, before the method handle is returned.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the method's variable arity modifier bit ({@code 0x0080}) is set.
-         * @param refc the class from which the method is accessed
-         * @param name the name of the method
-         * @param type the type of the method
-         * @return the desired method handle
-         * @throws NoSuchMethodException if the method does not exist
-         * @throws IllegalAccessException if access checking fails, or if the method is not {@code static}
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public
-        MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
-            MemberName method = resolveOrFail(refc, name, type, true);
-            checkMethod(refc, method, true);
-            return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, lookupClassOrNull());
-        }
-
-        /**
-         * Produces a method handle for a virtual method.
-         * The type of the method handle will be that of the method,
-         * with the receiver type (usually {@code refc}) prepended.
-         * The method and all its argument types must be accessible to the lookup class.
-         * <p>
-         * When called, the handle will treat the first argument as a receiver
-         * and dispatch on the receiver's type to determine which method
-         * implementation to enter.
-         * (The dispatching action is identical with that performed by an
-         * {@code invokevirtual} or {@code invokeinterface} instruction.)
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the method's variable arity modifier bit ({@code 0x0080}) is set.
-         * <p>
-         * Because of the general equivalence between {@code invokevirtual}
-         * instructions and method handles produced by {@code findVirtual},
-         * if the class is {@code MethodHandle} and the name string is
-         * {@code invokeExact} or {@code invokeGeneric}, the resulting
-         * method handle is equivalent to one produced by
-         * {@link java.dyn.MethodHandles#exactInvoker MethodHandles.exactInvoker} or
-         * {@link java.dyn.MethodHandles#genericInvoker MethodHandles.genericInvoker}
-         * with the same {@code type} argument.
-         *
-         * @param refc the class or interface from which the method is accessed
-         * @param name the name of the method
-         * @param type the type of the method, with the receiver argument omitted
-         * @return the desired method handle
-         * @throws NoSuchMethodException if the method does not exist
-         * @throws IllegalAccessException if access checking fails, or if the method is {@code static}
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findVirtual(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
-            MemberName method = resolveOrFail(refc, name, type, false);
-            checkMethod(refc, method, false);
-            MethodHandle mh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClassOrNull());
-            return restrictProtectedReceiver(method, mh);
-        }
-
-        /**
-         * Produces a method handle which creates an object and initializes it, using
-         * the constructor of the specified type.
-         * The parameter types of the method handle will be those of the constructor,
-         * while the return type will be a reference to the constructor's class.
-         * The constructor and all its argument types must be accessible to the lookup class.
-         * If the constructor's class has not yet been initialized, that is done
-         * immediately, before the method handle is returned.
-         * <p>
-         * Note:  The requested type must have a return type of {@code void}.
-         * This is consistent with the JVM's treatment of constructor type descriptors.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the constructor's variable arity modifier bit ({@code 0x0080}) is set.
-         * @param refc the class or interface from which the method is accessed
-         * @param type the type of the method, with the receiver argument omitted, and a void return type
-         * @return the desired method handle
-         * @throws NoSuchMethodException if the constructor does not exist
-         * @throws IllegalAccessException if access checking fails
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuchMethodException, IllegalAccessException {
-            String name = "<init>";
-            MemberName ctor = resolveOrFail(refc, name, type, false, false, lookupClassOrNull());
-            assert(ctor.isConstructor());
-            checkAccess(refc, ctor);
-            MethodHandle rawMH = MethodHandleImpl.findMethod(IMPL_TOKEN, ctor, false, lookupClassOrNull());
-            MethodHandle allocMH = MethodHandleImpl.makeAllocator(IMPL_TOKEN, rawMH);
-            return fixVarargs(allocMH, rawMH);
-        }
-
-        /** Return a version of MH which matches matchMH w.r.t. isVarargsCollector. */
-        private static MethodHandle fixVarargs(MethodHandle mh, MethodHandle matchMH) {
-            boolean va1 = mh.isVarargsCollector();
-            boolean va2 = matchMH.isVarargsCollector();
-            if (va1 == va2) {
-                return mh;
-            } else if (va2) {
-                MethodType type = mh.type();
-                int arity = type.parameterCount();
-                return mh.asVarargsCollector(type.parameterType(arity-1));
-            } else {
-                throw new InternalError("already varargs, but template is not: "+mh);
-            }
-        }
-
-        /**
-         * Produces an early-bound method handle for a virtual method,
-         * as if called from an {@code invokespecial}
-         * instruction from {@code caller}.
-         * The type of the method handle will be that of the method,
-         * with a suitably restricted receiver type (such as {@code caller}) prepended.
-         * The method and all its argument types must be accessible
-         * to the caller.
-         * <p>
-         * When called, the handle will treat the first argument as a receiver,
-         * but will not dispatch on the receiver's type.
-         * (This direct invocation action is identical with that performed by an
-         * {@code invokespecial} instruction.)
-         * <p>
-         * If the explicitly specified caller class is not identical with the
-         * lookup class, or if this lookup object does not have private access
-         * privileges, the access fails.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the method's variable arity modifier bit ({@code 0x0080}) is set.
-         * @param refc the class or interface from which the method is accessed
-         * @param name the name of the method (which must not be "&lt;init&gt;")
-         * @param type the type of the method, with the receiver argument omitted
-         * @param specialCaller the proposed calling class to perform the {@code invokespecial}
-         * @return the desired method handle
-         * @throws NoSuchMethodException if the method does not exist
-         * @throws IllegalAccessException if access checking fails
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findSpecial(Class<?> refc, String name, MethodType type,
-                                        Class<?> specialCaller) throws NoSuchMethodException, IllegalAccessException {
-            checkSpecialCaller(specialCaller);
-            MemberName method = resolveOrFail(refc, name, type, false, false, specialCaller);
-            checkMethod(refc, method, false);
-            MethodHandle mh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, specialCaller);
-            return restrictReceiver(method, mh, specialCaller);
-        }
-
-        /**
-         * Produces a method handle giving read access to a non-static field.
-         * The type of the method handle will have a return type of the field's
-         * value type.
-         * The method handle's single argument will be the instance containing
-         * the field.
-         * Access checking is performed immediately on behalf of the lookup class.
-         * @param refc the class or interface from which the method is accessed
-         * @param name the field's name
-         * @param type the field's type
-         * @return a method handle which can load values from the field
-         * @throws NoSuchFieldException if the field does not exist
-         * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
-            return makeAccessor(refc, name, type, false, false);
-        }
-
-        /**
-         * Produces a method handle giving write access to a non-static field.
-         * The type of the method handle will have a void return type.
-         * The method handle will take two arguments, the instance containing
-         * the field, and the value to be stored.
-         * The second argument will be of the field's value type.
-         * Access checking is performed immediately on behalf of the lookup class.
-         * @param refc the class or interface from which the method is accessed
-         * @param name the field's name
-         * @param type the field's type
-         * @return a method handle which can store values into the field
-         * @throws NoSuchFieldException if the field does not exist
-         * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
-            return makeAccessor(refc, name, type, false, true);
-        }
-
-        /**
-         * Produces a method handle giving read access to a static field.
-         * The type of the method handle will have a return type of the field's
-         * value type.
-         * The method handle will take no arguments.
-         * Access checking is performed immediately on behalf of the lookup class.
-         * @param refc the class or interface from which the method is accessed
-         * @param name the field's name
-         * @param type the field's type
-         * @return a method handle which can load values from the field
-         * @throws NoSuchFieldException if the field does not exist
-         * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findStaticGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
-            return makeAccessor(refc, name, type, true, false);
-        }
-
-        /**
-         * Produces a method handle giving write access to a static field.
-         * The type of the method handle will have a void return type.
-         * The method handle will take a single
-         * argument, of the field's value type, the value to be stored.
-         * Access checking is performed immediately on behalf of the lookup class.
-         * @param refc the class or interface from which the method is accessed
-         * @param name the field's name
-         * @param type the field's type
-         * @return a method handle which can store values into the field
-         * @throws NoSuchFieldException if the field does not exist
-         * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle findStaticSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
-            return makeAccessor(refc, name, type, true, true);
-        }
-
-        /**
-         * Produces an early-bound method handle for a non-static method.
-         * The receiver must have a supertype {@code defc} in which a method
-         * of the given name and type is accessible to the lookup class.
-         * The method and all its argument types must be accessible to the lookup class.
-         * The type of the method handle will be that of the method,
-         * without any insertion of an additional receiver parameter.
-         * The given receiver will be bound into the method handle,
-         * so that every call to the method handle will invoke the
-         * requested method on the given receiver.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the method's variable arity modifier bit ({@code 0x0080}) is set
-         * <em>and</em> the trailing array argument is not the only argument.
-         * (If the trailing array argument is the only argument,
-         * the given receiver value will be bound to it.)
-         * <p>
-         * This is equivalent to the following code:
-         * <blockquote><pre>
-MethodHandle mh0 = {@link #findVirtual findVirtual}(defc, name, type);
-MethodHandle mh1 = mh0.{@link MethodHandle#bindTo bindTo}(receiver);
-MethodType mt1 = mh1.type();
-if (mh0.isVarargsCollector() && mt1.parameterCount() > 0) {
-  mh1 = mh1.asVarargsCollector(mt1.parameterType(mt1.parameterCount()-1));
-return mh1;
-         * </pre></blockquote>
-         * where {@code defc} is either {@code receiver.getClass()} or a super
-         * type of that class, in which the requested method is accessible
-         * to the lookup class.
-         * (Note that {@code bindTo} does not preserve variable arity.)
-         * @param receiver the object from which the method is accessed
-         * @param name the name of the method
-         * @param type the type of the method, with the receiver argument omitted
-         * @return the desired method handle
-         * @throws NoSuchMethodException if the method does not exist
-         * @throws IllegalAccessException if access checking fails
-         * @exception SecurityException if a security manager is present and it
-         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle bind(Object receiver, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
-            Class<? extends Object> refc = receiver.getClass(); // may get NPE
-            MemberName method = resolveOrFail(refc, name, type, false);
-            checkMethod(refc, method, false);
-            MethodHandle dmh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClassOrNull());
-            MethodHandle bmh = MethodHandleImpl.bindReceiver(IMPL_TOKEN, dmh, receiver);
-            if (bmh == null)
-                throw newNoAccessException(method, this);
-            if (dmh.type().parameterCount() == 0)
-                return dmh;  // bound the trailing parameter; no varargs possible
-            return fixVarargs(bmh, dmh);
-        }
-
-        /**
-         * Make a direct method handle to <i>m</i>, if the lookup class has permission.
-         * If <i>m</i> is non-static, the receiver argument is treated as an initial argument.
-         * If <i>m</i> is virtual, overriding is respected on every call.
-         * Unlike the Core Reflection API, exceptions are <em>not</em> wrapped.
-         * The type of the method handle will be that of the method,
-         * with the receiver type prepended (but only if it is non-static).
-         * If the method's {@code accessible} flag is not set,
-         * access checking is performed immediately on behalf of the lookup class.
-         * If <i>m</i> is not public, do not share the resulting handle with untrusted parties.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the method's variable arity modifier bit ({@code 0x0080}) is set.
-         * @param m the reflected method
-         * @return a method handle which can invoke the reflected method
-         * @throws IllegalAccessException if access checking fails
-         * @throws NullPointerException if the argument is null
-         */
-        public MethodHandle unreflect(Method m) throws IllegalAccessException {
-            MemberName method = new MemberName(m);
-            assert(method.isMethod());
-            if (!m.isAccessible())  checkMethod(method.getDeclaringClass(), method, method.isStatic());
-            MethodHandle mh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClassOrNull());
-            if (!m.isAccessible())  mh = restrictProtectedReceiver(method, mh);
-            return mh;
-        }
-
-        /**
-         * Produces a method handle for a reflected method.
-         * It will bypass checks for overriding methods on the receiver,
-         * as if by a {@code invokespecial} instruction from within the {@code specialCaller}.
-         * The type of the method handle will be that of the method,
-         * with the special caller type prepended (and <em>not</em> the receiver of the method).
-         * If the method's {@code accessible} flag is not set,
-         * access checking is performed immediately on behalf of the lookup class,
-         * as if {@code invokespecial} instruction were being linked.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the method's variable arity modifier bit ({@code 0x0080}) is set.
-         * @param m the reflected method
-         * @param specialCaller the class nominally calling the method
-         * @return a method handle which can invoke the reflected method
-         * @throws IllegalAccessException if access checking fails
-         * @throws NullPointerException if any argument is null
-         */
-        public MethodHandle unreflectSpecial(Method m, Class<?> specialCaller) throws IllegalAccessException {
-            checkSpecialCaller(specialCaller);
-            MemberName method = new MemberName(m);
-            assert(method.isMethod());
-            // ignore m.isAccessible:  this is a new kind of access
-            checkMethod(m.getDeclaringClass(), method, false);
-            MethodHandle mh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, lookupClassOrNull());
-            return restrictReceiver(method, mh, specialCaller);
-        }
-
-        /**
-         * Produces a method handle for a reflected constructor.
-         * The type of the method handle will be that of the constructor,
-         * with the return type changed to the declaring class.
-         * The method handle will perform a {@code newInstance} operation,
-         * creating a new instance of the constructor's class on the
-         * arguments passed to the method handle.
-         * <p>
-         * If the constructor's {@code accessible} flag is not set,
-         * access checking is performed immediately on behalf of the lookup class.
-         * <p>
-         * The returned method handle will have
-         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
-         * the constructor's variable arity modifier bit ({@code 0x0080}) is set.
-         * @param c the reflected constructor
-         * @return a method handle which can invoke the reflected constructor
-         * @throws IllegalAccessException if access checking fails
-         * @throws NullPointerException if the argument is null
-         */
-        public MethodHandle unreflectConstructor(Constructor c) throws IllegalAccessException {
-            MemberName ctor = new MemberName(c);
-            assert(ctor.isConstructor());
-            if (!c.isAccessible())  checkAccess(c.getDeclaringClass(), ctor);
-            MethodHandle rawCtor = MethodHandleImpl.findMethod(IMPL_TOKEN, ctor, false, lookupClassOrNull());
-            MethodHandle allocator = MethodHandleImpl.makeAllocator(IMPL_TOKEN, rawCtor);
-            return fixVarargs(allocator, rawCtor);
-        }
-
-        /**
-         * Produces a method handle giving read access to a reflected field.
-         * The type of the method handle will have a return type of the field's
-         * value type.
-         * If the field is static, the method handle will take no arguments.
-         * Otherwise, its single argument will be the instance containing
-         * the field.
-         * If the method's {@code accessible} flag is not set,
-         * access checking is performed immediately on behalf of the lookup class.
-         * @param f the reflected field
-         * @return a method handle which can load values from the reflected field
-         * @throws IllegalAccessException if access checking fails
-         * @throws NullPointerException if the argument is null
-         */
-        public MethodHandle unreflectGetter(Field f) throws IllegalAccessException {
-            return makeAccessor(f.getDeclaringClass(), new MemberName(f), f.isAccessible(), false);
-        }
-
-        /**
-         * Produces a method handle giving write access to a reflected field.
-         * The type of the method handle will have a void return type.
-         * If the field is static, the method handle will take a single
-         * argument, of the field's value type, the value to be stored.
-         * Otherwise, the two arguments will be the instance containing
-         * the field, and the value to be stored.
-         * If the method's {@code accessible} flag is not set,
-         * access checking is performed immediately on behalf of the lookup class.
-         * @param f the reflected field
-         * @return a method handle which can store values into the reflected field
-         * @throws IllegalAccessException if access checking fails
-         * @throws NullPointerException if the argument is null
-         */
-        public MethodHandle unreflectSetter(Field f) throws IllegalAccessException {
-            return makeAccessor(f.getDeclaringClass(), new MemberName(f), f.isAccessible(), true);
-        }
-
-        /// Helper methods, all package-private.
-
-        MemberName resolveOrFail(Class<?> refc, String name, Class<?> type, boolean isStatic) throws NoSuchFieldException, IllegalAccessException {
-            checkSymbolicClass(refc);  // do this before attempting to resolve
-            name.getClass(); type.getClass();  // NPE
-            int mods = (isStatic ? Modifier.STATIC : 0);
-            return IMPL_NAMES.resolveOrFail(new MemberName(refc, name, type, mods), true, lookupClassOrNull(),
-                                            NoSuchFieldException.class);
-        }
-
-        MemberName resolveOrFail(Class<?> refc, String name, MethodType type, boolean isStatic) throws NoSuchMethodException, IllegalAccessException {
-            checkSymbolicClass(refc);  // do this before attempting to resolve
-            name.getClass(); type.getClass();  // NPE
-            int mods = (isStatic ? Modifier.STATIC : 0);
-            return IMPL_NAMES.resolveOrFail(new MemberName(refc, name, type, mods), true, lookupClassOrNull(),
-                                            NoSuchMethodException.class);
-        }
-
-        MemberName resolveOrFail(Class<?> refc, String name, MethodType type, boolean isStatic,
-                                 boolean searchSupers, Class<?> specialCaller) throws NoSuchMethodException, IllegalAccessException {
-            checkSymbolicClass(refc);  // do this before attempting to resolve
-            name.getClass(); type.getClass();  // NPE
-            int mods = (isStatic ? Modifier.STATIC : 0);
-            return IMPL_NAMES.resolveOrFail(new MemberName(refc, name, type, mods), searchSupers, specialCaller,
-                                            NoSuchMethodException.class);
-        }
-
-        void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
-            Class<?> caller = lookupClassOrNull();
-            if (caller != null && !VerifyAccess.isClassAccessible(refc, caller))
-                throw newNoAccessException("symbolic reference class is not public", new MemberName(refc), this);
-        }
-
-        void checkMethod(Class<?> refc, MemberName m, boolean wantStatic) throws IllegalAccessException {
-            String message;
-            if (m.isConstructor())
-                message = "expected a method, not a constructor";
-            else if (!m.isMethod())
-                message = "expected a method";
-            else if (wantStatic != m.isStatic())
-                message = wantStatic ? "expected a static method" : "expected a non-static method";
-            else
-                { checkAccess(refc, m); return; }
-            throw newNoAccessException(message, m, this);
-        }
-
-        void checkAccess(Class<?> refc, MemberName m) throws IllegalAccessException {
-            int allowedModes = this.allowedModes;
-            if (allowedModes == TRUSTED)  return;
-            int mods = m.getModifiers();
-            if (Modifier.isPublic(mods) && Modifier.isPublic(refc.getModifiers()) && allowedModes != 0)
-                return;  // common case
-            int requestedModes = fixmods(mods);  // adjust 0 => PACKAGE
-            if ((requestedModes & allowedModes) != 0
-                && VerifyAccess.isMemberAccessible(refc, m.getDeclaringClass(),
-                                                   mods, lookupClass()))
-                return;
-            if (((requestedModes & ~allowedModes) & PROTECTED) != 0
-                && VerifyAccess.isSamePackage(m.getDeclaringClass(), lookupClass()))
-                // Protected members can also be checked as if they were package-private.
-                return;
-            throw newNoAccessException(accessFailedMessage(refc, m), m, this);
-        }
-
-        String accessFailedMessage(Class<?> refc, MemberName m) {
-            Class<?> defc = m.getDeclaringClass();
-            int mods = m.getModifiers();
-            // check the class first:
-            boolean classOK = (Modifier.isPublic(defc.getModifiers()) &&
-                               (defc == refc ||
-                                Modifier.isPublic(refc.getModifiers())));
-            if (!classOK && (allowedModes & PACKAGE) != 0) {
-                classOK = (VerifyAccess.isClassAccessible(defc, lookupClass()) &&
-                           (defc == refc ||
-                            VerifyAccess.isClassAccessible(refc, lookupClass())));
-            }
-            if (!classOK)
-                return "class is not public";
-            if (Modifier.isPublic(mods))
-                return "access to public member failed";  // (how?)
-            if (Modifier.isPrivate(mods))
-                return "member is private";
-            if (Modifier.isProtected(mods))
-                return "member is protected";
-            return "member is private to package";
-        }
-
-        private static final boolean ALLOW_NESTMATE_ACCESS = false;
-
-        void checkSpecialCaller(Class<?> specialCaller) throws IllegalAccessException {
-            if (allowedModes == TRUSTED)  return;
-            if ((allowedModes & PRIVATE) == 0
-                || (specialCaller != lookupClass()
-                    && !(ALLOW_NESTMATE_ACCESS &&
-                         VerifyAccess.isSamePackageMember(specialCaller, lookupClass()))))
-                throw newNoAccessException("no private access for invokespecial",
-                                           new MemberName(specialCaller), this);
-        }
-
-        MethodHandle restrictProtectedReceiver(MemberName method, MethodHandle mh) throws IllegalAccessException {
-            // The accessing class only has the right to use a protected member
-            // on itself or a subclass.  Enforce that restriction, from JVMS 5.4.4, etc.
-            if (!method.isProtected() || method.isStatic()
-                || allowedModes == TRUSTED
-                || method.getDeclaringClass() == lookupClass()
-                || (ALLOW_NESTMATE_ACCESS &&
-                    VerifyAccess.isSamePackageMember(method.getDeclaringClass(), lookupClass())))
-                return mh;
-            else
-                return restrictReceiver(method, mh, lookupClass());
-        }
-        MethodHandle restrictReceiver(MemberName method, MethodHandle mh, Class<?> caller) throws IllegalAccessException {
-            assert(!method.isStatic());
-            Class<?> defc = method.getDeclaringClass();  // receiver type of mh is too wide
-            if (defc.isInterface() || !defc.isAssignableFrom(caller)) {
-                throw newNoAccessException("caller class must be a subclass below the method", method, caller);
-            }
-            MethodType rawType = mh.type();
-            if (rawType.parameterType(0) == caller)  return mh;
-            MethodType narrowType = rawType.changeParameterType(0, caller);
-            MethodHandle narrowMH = MethodHandleImpl.convertArguments(IMPL_TOKEN, mh, narrowType, rawType, null);
-            return fixVarargs(narrowMH, mh);
-        }
-
-        MethodHandle makeAccessor(Class<?> refc, String name, Class<?> type,
-                                  boolean isStatic, boolean isSetter) throws NoSuchFieldException, IllegalAccessException {
-            MemberName field = resolveOrFail(refc, name, type, isStatic);
-            if (isStatic != field.isStatic())
-                throw newNoAccessException(isStatic
-                                           ? "expected a static field"
-                                           : "expected a non-static field",
-                                           field, this);
-            return makeAccessor(refc, field, false, isSetter);
-        }
-
-        MethodHandle makeAccessor(Class<?> refc, MemberName field,
-                                  boolean trusted, boolean isSetter) throws IllegalAccessException {
-            assert(field.isField());
-            if (trusted)
-                return MethodHandleImpl.accessField(IMPL_TOKEN, field, isSetter, lookupClassOrNull());
-            checkAccess(refc, field);
-            MethodHandle mh = MethodHandleImpl.accessField(IMPL_TOKEN, field, isSetter, lookupClassOrNull());
-            return restrictProtectedReceiver(field, mh);
-        }
-    }
-
-    /**
-     * Produces a method handle giving read access to elements of an array.
-     * The type of the method handle will have a return type of the array's
-     * element type.  Its first argument will be the array type,
-     * and the second will be {@code int}.
-     * @param arrayClass an array type
-     * @return a method handle which can load values from the given array type
-     * @throws NullPointerException if the argument is null
-     * @throws  IllegalArgumentException if arrayClass is not an array type
-     */
-    public static
-    MethodHandle arrayElementGetter(Class<?> arrayClass) throws IllegalArgumentException {
-        return MethodHandleImpl.accessArrayElement(IMPL_TOKEN, arrayClass, false);
-    }
-
-    /**
-     * Produces a method handle giving write access to elements of an array.
-     * The type of the method handle will have a void return type.
-     * Its last argument will be the array's element type.
-     * The first and second arguments will be the array type and int.
-     * @return a method handle which can store values into the array type
-     * @throws NullPointerException if the argument is null
-     * @throws IllegalArgumentException if arrayClass is not an array type
-     */
-    public static
-    MethodHandle arrayElementSetter(Class<?> arrayClass) throws IllegalArgumentException {
-        return MethodHandleImpl.accessArrayElement(IMPL_TOKEN, arrayClass, true);
-    }
-
-    /// method handle invocation (reflective style)
-
-    /**
-     * Produces a method handle which will invoke any method handle of the
-     * given {@code type} on a standard set of {@code Object} type arguments
-     * and a single trailing {@code Object[]} array.
-     * The resulting invoker will be a method handle with the following
-     * arguments:
-     * <ul>
-     * <li>a single {@code MethodHandle} target
-     * <li>zero or more {@code Object} values (counted by {@code objectArgCount})
-     * <li>an {@code Object[]} array containing more arguments
-     * </ul>
-     * <p>
-     * The invoker will behave like a call to {@link MethodHandle#invokeGeneric invokeGeneric} with
-     * the indicated {@code type}.
-     * That is, if the target is exactly of the given {@code type}, it will behave
-     * like {@code invokeExact}; otherwise it behave as if {@link MethodHandle#asType asType}
-     * is used to convert the target to the required {@code type}.
-     * <p>
-     * The type of the returned invoker will not be the given {@code type}, but rather
-     * will have all parameter and return types replaced by {@code Object}, except for
-     * the last parameter type, which will be the array type {@code Object[]}.
-     * <p>
-     * Before invoking its target, the invoker will spread the varargs array, apply
-     * reference casts as necessary, and unbox and widen primitive arguments.
-     * The return value of the invoker will be an {@code Object} reference,
-     * boxing a primitive value if the original type returns a primitive,
-     * and always null if the original type returns void.
-     * <p>
-     * This method is equivalent to the following code (though it may be more efficient):
-     * <p><blockquote><pre>
-MethodHandle invoker = MethodHandles.genericInvoker(type);
-int spreadArgCount = type.parameterCount - objectArgCount;
-invoker = invoker.asSpreader(Object[].class, spreadArgCount);
-return invoker;
-     * </pre></blockquote>
-     * <p>
-     * This method throws no reflective or security exceptions.
-     * @param type the desired target type
-     * @param objectArgCount number of fixed (non-varargs) {@code Object} arguments
-     * @return a method handle suitable for invoking any method handle of the given type
-     */
-    static public
-    MethodHandle spreadInvoker(MethodType type, int objectArgCount) {
-        if (objectArgCount < 0 || objectArgCount > type.parameterCount())
-            throw new IllegalArgumentException("bad argument count "+objectArgCount);
-        return invokers(type).spreadInvoker(objectArgCount);
-    }
-
-    /**
-     * Produces a special <em>invoker method handle</em> which can be used to
-     * invoke any method handle of the given type, as if by {@code invokeExact}.
-     * The resulting invoker will have a type which is
-     * exactly equal to the desired type, except that it will accept
-     * an additional leading argument of type {@code MethodHandle}.
-     * <p>
-     * This method is equivalent to the following code (though it may be more efficient):
-     * <p><blockquote><pre>
-publicLookup().findVirtual(MethodHandle.class, "invokeExact", type)
-     * </pre></blockquote>
-     *
-     * <p style="font-size:smaller;">
-     * <em>Discussion:</em>
-     * Invoker method handles can be useful when working with variable method handles
-     * of unknown types.
-     * For example, to emulate an {@code invokeExact} call to a variable method
-     * handle {@code M}, extract its type {@code T},
-     * look up the invoker method {@code X} for {@code T},
-     * and call the invoker method, as {@code X.invokeGeneric(T, A...)}.
-     * (It would not work to call {@code X.invokeExact}, since the type {@code T}
-     * is unknown.)
-     * If spreading, collecting, or other argument transformations are required,
-     * they can be applied once to the invoker {@code X} and reused on many {@code M}
-     * method handle values, as long as they are compatible with the type of {@code X}.
-     * <p>
-     * <em>(Note:  The invoker method is not available via the Core Reflection API.
-     * An attempt to call {@linkplain java.lang.reflect.Method#invoke Method.invoke}
-     * on the declared {@code invokeExact} or {@code invokeGeneric} method will raise an
-     * {@link java.lang.UnsupportedOperationException UnsupportedOperationException}.)</em>
-     * <p>
-     * This method throws no reflective or security exceptions.
-     * @param type the desired target type
-     * @return a method handle suitable for invoking any method handle of the given type
-     */
-    static public
-    MethodHandle exactInvoker(MethodType type) {
-        return invokers(type).exactInvoker();
-    }
-
-    /**
-     * Produces a special <em>invoker method handle</em> which can be used to
-     * invoke any method handle of the given type, as if by {@code invokeGeneric}.
-     * The resulting invoker will have a type which is
-     * exactly equal to the desired type, except that it will accept
-     * an additional leading argument of type {@code MethodHandle}.
-     * <p>
-     * Before invoking its target, the invoker will apply reference casts as
-     * necessary and unbox and widen primitive arguments, as if by {@link #convertArguments convertArguments}.
-     * The return value of the invoker will be an {@code Object} reference,
-     * boxing a primitive value if the original type returns a primitive,
-     * and always null if the original type returns void.
-     * <p>
-     * This method is equivalent to the following code (though it may be more efficient):
-     * <p><blockquote><pre>
-publicLookup().findVirtual(MethodHandle.class, "invokeGeneric", type)
-     * </pre></blockquote>
-     * <p>
-     * This method throws no reflective or security exceptions.
-     * @param type the desired target type
-     * @return a method handle suitable for invoking any method handle convertible to the given type
-     */
-    static public
-    MethodHandle genericInvoker(MethodType type) {
-        return invokers(type).genericInvoker();
-    }
-
-    static Invokers invokers(MethodType type) {
-        return MethodTypeImpl.invokers(IMPL_TOKEN, type);
-    }
-
-    /**
-     * Perform value checking, exactly as if for an adapted method handle.
-     * It is assumed that the given value is either null, of type T0,
-     * or (if T0 is primitive) of the wrapper type corresponding to T0.
-     * The following checks and conversions are made:
-     * <ul>
-     * <li>If T0 and T1 are references, then a cast to T1 is applied.
-     *     (The types do not need to be related in any particular way.)
-     * <li>If T0 and T1 are primitives, then a widening or narrowing
-     *     conversion is applied, if one exists.
-     * <li>If T0 is a primitive and T1 a reference, and
-     *     T0 has a wrapper type TW, a boxing conversion to TW is applied,
-     *     possibly followed by a reference conversion.
-     *     T1 must be TW or a supertype.
-     * <li>If T0 is a reference and T1 a primitive, and
-     *     T1 has a wrapper type TW, an unboxing conversion is applied,
-     *     possibly preceded by a reference conversion.
-     *     T0 must be TW or a supertype.
-     * <li>If T1 is void, the return value is discarded
-     * <li>If T0 is void and T1 a reference, a null value is introduced.
-     * <li>If T0 is void and T1 a primitive, a zero value is introduced.
-     * </ul>
-     * If the value is discarded, null will be returned.
-     * @param valueType
-     * @param value
-     * @return the value, converted if necessary
-     * @throws java.lang.ClassCastException if a cast fails
-     */
-    static
-    <T0, T1> T1 checkValue(Class<T0> t0, Class<T1> t1, Object value)
-       throws ClassCastException
-    {
-        if (t0 == t1) {
-            // no conversion needed; just reassert the same type
-            if (t0.isPrimitive())
-                return Wrapper.asPrimitiveType(t1).cast(value);
-            else
-                return Wrapper.OBJECT.convert(value, t1);
-        }
-        boolean prim0 = t0.isPrimitive(), prim1 = t1.isPrimitive();
-        if (!prim0) {
-            // check contract with caller
-            Wrapper.OBJECT.convert(value, t0);
-            if (!prim1) {
-                return Wrapper.OBJECT.convert(value, t1);
-            }
-            // convert reference to primitive by unboxing
-            Wrapper w1 = Wrapper.forPrimitiveType(t1);
-            return w1.convert(value, t1);
-        }
-        // check contract with caller:
-        Wrapper.asWrapperType(t0).cast(value);
-        Wrapper w1 = Wrapper.forPrimitiveType(t1);
-        return w1.convert(value, t1);
-    }
-
-    static
-    Object checkValue(Class<?> T1, Object value)
-       throws ClassCastException
-    {
-        Class<?> T0;
-        if (value == null)
-            T0 = Object.class;
-        else
-            T0 = value.getClass();
-        return checkValue(T0, T1, value);
-    }
-
-    /// method handle modification (creation from other method handles)
-
-    /**
-     * Produces a method handle which adapts the type of the
-     * given method handle to a new type by pairwise argument conversion.
-     * The original type and new type must have the same number of arguments.
-     * The resulting method handle is guaranteed to report a type
-     * which is equal to the desired new type.
-     * <p>
-     * If the original type and new type are equal, returns target.
-     * <p>
-     * The following conversions are applied as needed both to
-     * arguments and return types.  Let T0 and T1 be the differing
-     * new and old parameter types (or old and new return types)
-     * for corresponding values passed by the new and old method types.
-     * Given those types T0, T1, one of the following conversions is applied
-     * if possible:
-     * <ul>
-     * <li>If T0 and T1 are references, then a cast to T1 is applied.
-     *     (The types do not need to be related in any particular way.)
-     * <li>If T0 and T1 are primitives, then a Java method invocation
-     *     conversion (JLS 5.3) is applied, if one exists.
-     * <li>If T0 is a primitive and T1 a reference, a boxing
-     *     conversion is applied if one exists, possibly followed by
-     *     a reference conversion to a superclass.
-     *     T1 must be a wrapper class or a supertype of one.
-     * <li>If T0 is a reference and T1 a primitive, an unboxing
-     *     conversion will be applied at runtime, possibly followed
-     *     by a Java method invocation conversion (JLS 5.3)
-     *     on the primitive value.  (These are the widening conversions.)
-     *     T0 must be a wrapper class or a supertype of one.
-     *     (In the case where T0 is Object, these are the conversions
-     *     allowed by java.lang.reflect.Method.invoke.)
-     * <li>If the return type T1 is void, any returned value is discarded
-     * <li>If the return type T0 is void and T1 a reference, a null value is introduced.
-     * <li>If the return type T0 is void and T1 a primitive, a zero value is introduced.
-     * </ul>
-     * @param target the method handle to invoke after arguments are retyped
-     * @param newType the expected type of the new method handle
-     * @return a method handle which delegates to {@code target} after performing
-     *           any necessary argument conversions, and arranges for any
-     *           necessary return value conversions
-     * @throws NullPointerException if either argument is null
-     * @throws WrongMethodTypeException if the conversion cannot be made
-     * @see MethodHandle#asType
-     * @see MethodHandles#explicitCastArguments
-     */
-    public static
-    MethodHandle convertArguments(MethodHandle target, MethodType newType) {
-        MethodType oldType = target.type();
-        if (oldType.equals(newType))
-            return target;
-        MethodHandle res = null;
-        try {
-            res = MethodHandleImpl.convertArguments(IMPL_TOKEN, target,
-                                                    newType, oldType, null);
-        } catch (IllegalArgumentException ex) {
-        }
-        if (res == null)
-            throw new WrongMethodTypeException("cannot convert to "+newType+": "+target);
-        return res;
-    }
-
-    /**
-     * Produces a method handle which adapts the type of the
-     * given method handle to a new type by pairwise argument conversion.
-     * The original type and new type must have the same number of arguments.
-     * The resulting method handle is guaranteed to report a type
-     * which is equal to the desired new type.
-     * <p>
-     * If the original type and new type are equal, returns target.
-     * <p>
-     * The same conversions are allowed as for {@link #convertArguments convertArguments},
-     * and some additional conversions are also applied if those conversions fail.
-     * Given types T0, T1, one of the following conversions is applied
-     * in addition, if the conversions specified for {@code convertArguments}
-     * would be insufficient:
-     * <ul>
-     * <li>If T0 and T1 are references, and T1 is an interface type,
-     *     then the value of type T0 is passed as a T1 without a cast.
-     *     (This treatment of interfaces follows the usage of the bytecode verifier.)
-     * <li>If T0 and T1 are primitives and one is boolean,
-     *     the boolean is treated as a one-bit unsigned integer.
-     *     (This treatment follows the usage of the bytecode verifier.)
-     *     A conversion from another primitive type behaves as if
-     *     it first converts to byte, and then masks all but the low bit.
-     * <li>If a primitive value would be converted by {@code convertArguments}
-     *     using Java method invocation conversion (JLS 5.3),
-     *     Java casting conversion (JLS 5.5) may be used also.
-     *     This allows primitives to be narrowed as well as widened.
-     * </ul>
-     * @param target the method handle to invoke after arguments are retyped
-     * @param newType the expected type of the new method handle
-     * @return a method handle which delegates to {@code target} after performing
-     *           any necessary argument conversions, and arranges for any
-     *           necessary return value conversions
-     * @throws NullPointerException if either argument is null
-     * @throws WrongMethodTypeException if the conversion cannot be made
-     * @see MethodHandle#asType
-     * @see MethodHandles#convertArguments
-     */
-    public static
-    MethodHandle explicitCastArguments(MethodHandle target, MethodType newType) {
-        return convertArguments(target, newType);  // FIXME!
-    }
-
-    /*
-      FIXME: Reconcile javadoc with 10/22/2010 EG notes on conversion:
-
-      Both converters arrange for their method handles to convert arguments
-      and return values.  The conversion rules are the same for arguments
-      and return values, and depend only on source and target types, S and
-      T.  The conversions allowed by castConvertArguments are a strict
-      superset of those performed by convertArguments.
-
-      In all cases, if S and T are references, a simple checkcast is done.
-      If neither S nor T is a primitive, no attempt is made to unbox and
-      box.  A failed conversion throws ClassCastException.
-
-      If T is void, the value is dropped.
-
-      For compatibility with reflection, if S is void and T is a reference,
-      a null value is produced.
-
-      For compatibility with reflection, if S is a reference and T is a
-      primitive, S is first unboxed and then undergoes primitive conversion.
-      In the case of 'convertArguments', only assignment conversion is
-      performed (no narrowing primitive conversion).
-
-      If S is a primitive, S is boxed, and then the above rules are applied.
-      If S and T are both primitives, the boxing will be undetectable; only
-      the primitive conversions will be apparent to the user.  The key point
-      is that if S is a primitive type, the implementation may box it and
-      treat is as Object, without loss of information, or it may use a "fast
-      path" which does not use boxing.
-
-      Notwithstanding the rules above, for compatibility with the verifier,
-      if T is an interface, it is treated as if it were Object.  [KEEP THIS?]
-
-      Also, for compatibility with the verifier, a boolean may be undergo
-      widening or narrowing conversion to any other primitive type.  [KEEP THIS?]
-    */
-
-    /**
-     * Produces a method handle which adapts the calling sequence of the
-     * given method handle to a new type, by reordering the arguments.
-     * The resulting method handle is guaranteed to report a type
-     * which is equal to the desired new type.
-     * <p>
-     * The given array controls the reordering.
-     * Call {@code #I} the number of incoming parameters (the value
-     * {@code newType.parameterCount()}, and call {@code #O} the number
-     * of outgoing parameters (the value {@code target.type().parameterCount()}).
-     * Then the length of the reordering array must be {@code #O},
-     * and each element must be a non-negative number less than {@code #I}.
-     * For every {@code N} less than {@code #O}, the {@code N}-th
-     * outgoing argument will be taken from the {@code I}-th incoming
-     * argument, where {@code I} is {@code reorder[N]}.
-     * <p>
-     * No argument or return value conversions are applied.
-     * The type of each incoming argument, as determined by {@code newType},
-     * must be identical to the type of the corresponding outgoing argument
-     * or arguments in the target method handle.
-     * The return type of {@code newType} must be identical to the return
-     * type of the original target.
-     * <p>
-     * The reordering array need not specify an actual permutation.
-     * An incoming argument will be duplicated if its index appears
-     * more than once in the array, and an incoming argument will be dropped
-     * if its index does not appear in the array.
-     * As in the case of {@link #dropArguments(MethodHandle,int,List) dropArguments},
-     * incoming arguments which are not mentioned in the reordering array
-     * are may be any type, as determined only by {@code newType}.
-     * <blockquote><pre>
-MethodType intfn1 = MethodType.methodType(int.class, int.class);
-MethodType intfn2 = MethodType.methodType(int.class, int.class, int.class);
-MethodHandle sub = ... {int x, int y => x-y} ...;
-assert(sub.type().equals(intfn2));
-MethodHandle sub1 = MethodHandles.permuteArguments(sub, intfn2, 0, 1);
-MethodHandle rsub = MethodHandles.permuteArguments(sub, intfn2, 1, 0);
-assert((int)rsub.invokeExact(1, 100) == 99);
-MethodHandle add = ... {int x, int y => x+y} ...;
-assert(add.type().equals(intfn2));
-MethodHandle twice = MethodHandles.permuteArguments(add, intfn1, 0, 0);
-assert(twice.type().equals(intfn1));
-assert((int)twice.invokeExact(21) == 42);
-     * </pre></blockquote>
-     * @param target the method handle to invoke after arguments are reordered
-     * @param newType the expected type of the new method handle
-     * @param reorder a string which controls the reordering
-     * @return a method handle which delegates to {@code target} after it
-     *           drops unused arguments and moves and/or duplicates the other arguments
-     * @throws NullPointerException if any argument is null
-     */
-    public static
-    MethodHandle permuteArguments(MethodHandle target, MethodType newType, int... reorder) {
-        MethodType oldType = target.type();
-        checkReorder(reorder, newType, oldType);
-        return MethodHandleImpl.convertArguments(IMPL_TOKEN, target,
-                                                 newType, oldType,
-                                                 reorder);
-    }
-
-    private static void checkReorder(int[] reorder, MethodType newType, MethodType oldType) {
-        if (reorder.length == oldType.parameterCount()) {
-            int limit = newType.parameterCount();
-            boolean bad = false;
-            for (int i : reorder) {
-                if (i < 0 || i >= limit) {
-                    bad = true; break;
-                }
-            }
-            if (!bad)  return;
-        }
-        throw newIllegalArgumentException("bad reorder array");
-    }
-
-    /**
-     * Equivalent to the following code:
-     * <p><blockquote><pre>
-     * int spreadPos = newType.parameterCount() - 1;
-     * Class&lt;?&gt; spreadType = newType.parameterType(spreadPos);
-     * int spreadCount = target.type().parameterCount() - spreadPos;
-     * MethodHandle adapter = target.asSpreader(spreadType, spreadCount);
-     * adapter = adapter.asType(newType);
-     * return adapter;
-     * </pre></blockquote>
-     * @param target the method handle to invoke after argument spreading
-     * @param newType the expected type of the new method handle
-     * @return a method handle which spreads its final argument,
-     *         before calling the original method handle
-     */
-    /*non-public*/ static
-    MethodHandle spreadArguments(MethodHandle target, MethodType newType) {
-        MethodType oldType = target.type();
-        int inargs  = newType.parameterCount();
-        int outargs = oldType.parameterCount();
-        int spreadPos = inargs - 1;
-        int numSpread = (outargs - spreadPos);
-        MethodHandle res = null;
-        if (spreadPos >= 0 && numSpread >= 0) {
-            res = MethodHandleImpl.spreadArguments(IMPL_TOKEN, target, newType, spreadPos);
-        }
-        if (res == null) {
-            throw newIllegalArgumentException("cannot spread "+newType+" to " +oldType);
-        }
-        return res;
-    }
-
-    /**
-     * Equivalent to the following code:
-     * <p><blockquote><pre>
-     * int collectPos = target.type().parameterCount() - 1;
-     * Class&lt;?&gt; collectType = target.type().parameterType(collectPos);
-     * if (!collectType.isArray())  collectType = Object[].class;
-     * int collectCount = newType.parameterCount() - collectPos;
-     * MethodHandle adapter = target.asCollector(collectType, collectCount);
-     * adapter = adapter.asType(newType);
-     * return adapter;
-     * </pre></blockquote>
-     * @param target the method handle to invoke after argument collection
-     * @param newType the expected type of the new method handle
-     * @return a method handle which collects some trailing argument
-     *         into an array, before calling the original method handle
-     */
-    /*non-public*/ static
-    MethodHandle collectArguments(MethodHandle target, MethodType newType) {
-        MethodType oldType = target.type();
-        int inargs  = newType.parameterCount();
-        int outargs = oldType.parameterCount();
-        int collectPos = outargs - 1;
-        int numCollect = (inargs - collectPos);
-        if (collectPos < 0 || numCollect < 0)
-            throw newIllegalArgumentException("wrong number of arguments");
-        MethodHandle res = MethodHandleImpl.collectArguments(IMPL_TOKEN, target, newType, collectPos, null);
-        if (res == null) {
-            throw newIllegalArgumentException("cannot collect from "+newType+" to " +oldType);
-        }
-        return res;
-    }
-
-    /**
-     * Produces a method handle of the requested return type which returns the given
-     * constant value every time it is invoked.
-     * <p>
-     * Before the method handle is returned, the passed-in value is converted to the requested type.
-     * If the requested type is primitive, widening primitive conversions are attempted,
-     * else reference conversions are attempted.
-     * <p>The returned method handle is equivalent to {@code identity(type).bindTo(value)},
-     * unless the type is {@code void}, in which case it is {@code identity(type)}.
-     * @param type the return type of the desired method handle
-     * @param value the value to return
-     * @return a method handle of the given return type and no arguments, which always returns the given value
-     * @throws NullPointerException if the {@code type} argument is null
-     * @throws ClassCastException if the value cannot be converted to the required return type
-     * @throws IllegalArgumentException if the given type is {@code void.class}
-     */
-    public static
-    MethodHandle constant(Class<?> type, Object value) {
-        if (type.isPrimitive()) {
-            if (type == void.class)
-                throw newIllegalArgumentException("void type");
-            Wrapper w = Wrapper.forPrimitiveType(type);
-            return identity(type).bindTo(w.convert(value, type));
-        } else {
-            return identity(type).bindTo(type.cast(value));
-        }
-    }
-
-    /**
-     * Produces a method handle which returns its sole argument when invoked.
-     * <p>The identity function for {@code void} takes no arguments and returns no values.
-     * @param type the type of the sole parameter and return value of the desired method handle
-     * @return a unary method handle which accepts and returns the given type
-     * @throws NullPointerException if the argument is null
-     * @throws IllegalArgumentException if the given type is {@code void.class}
-     */
-    public static
-    MethodHandle identity(Class<?> type) {
-        if (type == void.class)
-            throw newIllegalArgumentException("void type");
-        return ValueConversions.identity(type);
-    }
-
-    /**
-     * Produces a method handle which calls the original method handle {@code target},
-     * after inserting the given argument(s) at the given position.
-     * The formal parameters to {@code target} which will be supplied by those
-     * arguments are called <em>bound parameters</em>, because the new method
-     * will contain bindings for those parameters take from {@code values}.
-     * The type of the new method handle will drop the types for the bound
-     * parameters from the original target type, since the new method handle
-     * will no longer require those arguments to be supplied by its callers.
-     * <p>
-     * Each given argument object must match the corresponding bound parameter type.
-     * If a bound parameter type is a primitive, the argument object
-     * must be a wrapper, and will be unboxed to produce the primitive value.
-     * <p>
-     * The  <i>pos</i> may range between zero and <i>N</i> (inclusively),
-     * where <i>N</i> is the number of argument types in resulting method handle
-     * (after bound parameter types are dropped).
-     * @param target the method handle to invoke after the argument is inserted
-     * @param pos where to insert the argument (zero for the first)
-     * @param values the series of arguments to insert
-     * @return a method handle which inserts an additional argument,
-     *         before calling the original method handle
-     * @throws NullPointerException if the {@code target} argument or the {@code values} array is null
-     * @see MethodHandle#bindTo
-     */
-    public static
-    MethodHandle insertArguments(MethodHandle target, int pos, Object... values) {
-        int insCount = values.length;
-        MethodType oldType = target.type();
-        ArrayList<Class<?>> ptypes =
-                new ArrayList<Class<?>>(oldType.parameterList());
-        int outargs = oldType.parameterCount();
-        int inargs  = outargs - insCount;
-        if (inargs < 0)
-            throw newIllegalArgumentException("too many values to insert");
-        if (pos < 0 || pos > inargs)
-            throw newIllegalArgumentException("no argument type to append");
-        MethodHandle result = target;
-        for (int i = 0; i < insCount; i++) {
-            Object value = values[i];
-            Class<?> valueType = oldType.parameterType(pos+i);
-            value = checkValue(valueType, value);
-            if (pos == 0 && !valueType.isPrimitive()) {
-                // At least for now, make bound method handles a special case.
-                MethodHandle bmh = MethodHandleImpl.bindReceiver(IMPL_TOKEN, result, value);
-                if (bmh != null) {
-                    result = bmh;
-                    continue;
-                }
-                // else fall through to general adapter machinery
-            }
-            result = MethodHandleImpl.bindArgument(IMPL_TOKEN, result, pos, value);
-        }
-        return result;
-    }
-
-    /**
-     * Produces a method handle which calls the original method handle,
-     * after dropping the given argument(s) at the given position.
-     * The type of the new method handle will insert the given argument
-     * type(s), at that position, into the original handle's type.
-     * <p>
-     * The <i>pos</i> may range between zero and <i>N</i>,
-     * where <i>N</i> is the number of argument types in <i>target</i>,
-     * meaning to drop the first or last argument (respectively),
-     * or an argument somewhere in between.
-     * <p>
-     * <b>Example:</b>
-     * <p><blockquote><pre>
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
-...
-MethodHandle cat = lookup().findVirtual(String.class,
-  "concat", methodType(String.class, String.class));
-assertEquals("xy", (String) cat.invokeExact("x", "y"));
-MethodHandle d0 = dropArguments(cat, 0, String.class);
-assertEquals("yz", (String) d0.invokeExact("x", "y", "z"));
-MethodHandle d1 = dropArguments(cat, 1, String.class);
-assertEquals("xz", (String) d1.invokeExact("x", "y", "z"));
-MethodHandle d2 = dropArguments(cat, 2, String.class);
-assertEquals("xy", (String) d2.invokeExact("x", "y", "z"));
-MethodHandle d12 = dropArguments(cat, 1, int.class, boolean.class);
-assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
-     * </pre></blockquote>
-     * @param target the method handle to invoke after the arguments are dropped
-     * @param valueTypes the type(s) of the argument(s) to drop
-     * @param pos position of first argument to drop (zero for the leftmost)
-     * @return a method handle which drops arguments of the given types,
-     *         before calling the original method handle
-     * @throws NullPointerException if the {@code target} argument is null,
-     *                              or if the {@code valueTypes} list or any of its elements is null
-     * @throws IllegalArgumentException if any of the {@code valueTypes} is {@code void.class}
-     */
-    public static
-    MethodHandle dropArguments(MethodHandle target, int pos, List<Class<?>> valueTypes) {
-        if (valueTypes.size() == 0)  return target;
-        MethodType oldType = target.type();
-        int outargs = oldType.parameterCount();
-        int inargs  = outargs + valueTypes.size();
-        if (pos < 0 || pos >= inargs)
-            throw newIllegalArgumentException("no argument type to remove");
-        ArrayList<Class<?>> ptypes =
-                new ArrayList<Class<?>>(oldType.parameterList());
-        ptypes.addAll(pos, valueTypes);
-        MethodType newType = MethodType.methodType(oldType.returnType(), ptypes);
-        return MethodHandleImpl.dropArguments(IMPL_TOKEN, target, newType, pos);
-    }
-
-    /**
-     * Produces a method handle which calls the original method handle,
-     * after dropping the given argument(s) at the given position.
-     * The type of the new method handle will insert the given argument
-     * type(s), at that position, into the original handle's type.
-     * This method is equivalent to the following code:
-     * <code>
-     * {@link #dropArguments(MethodHandle,int,List) dropArguments}(target, pos, Arrays.asList(valueTypes))
-     * </code>
-     * @param target the method handle to invoke after the arguments are dropped
-     * @param valueTypes the type(s) of the argument(s) to drop
-     * @param pos position of first argument to drop (zero for the leftmost)
-     * @return a method handle which drops arguments of the given types,
-     *         before calling the original method handle
-     * @throws NullPointerException if the {@code target} argument is null,
-     *                              or if the {@code valueTypes} array or any of its elements is null
-     * @throws IllegalArgumentException if any of the {@code valueTypes} is {@code void.class}
-     */
-    public static
-    MethodHandle dropArguments(MethodHandle target, int pos, Class<?>... valueTypes) {
-        return dropArguments(target, pos, Arrays.asList(valueTypes));
-    }
-
-    /**
-     * Adapt a target method handle {@code target} by pre-processing
-     * one or more of its arguments, each with its own unary filter function,
-     * and then calling the target with each pre-processed argument
-     * replaced by the result of its corresponding filter function.
-     * <p>
-     * The pre-processing is performed by one or more method handles,
-     * specified in the elements of the {@code filters} array.
-     * Null arguments in the array are ignored, and the corresponding arguments left unchanged.
-     * (If there are no non-null elements in the array, the original target is returned.)
-     * Each filter is applied to the corresponding argument of the adapter.
-     * <p>
-     * If a filter {@code F} applies to the {@code N}th argument of
-     * the method handle, then {@code F} must be a method handle which
-     * takes exactly one argument.  The type of {@code F}'s sole argument
-     * replaces the corresponding argument type of the target
-     * in the resulting adapted method handle.
-     * The return type of {@code F} must be identical to the corresponding
-     * parameter type of the target.
-     * <p>
-     * It is an error if there are elements of {@code filters}
-     * which do not correspond to argument positions in the target.
-     * <b>Example:</b>
-     * <p><blockquote><pre>
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
-...
-MethodHandle cat = lookup().findVirtual(String.class,
-  "concat", methodType(String.class, String.class));
-MethodHandle upcase = lookup().findVirtual(String.class,
-  "toUpperCase", methodType(String.class));
-assertEquals("xy", (String) cat.invokeExact("x", "y"));
-MethodHandle f0 = filterArguments(cat, 0, upcase);
-assertEquals("Xy", (String) f0.invokeExact("x", "y")); // Xy
-MethodHandle f1 = filterArguments(cat, 1, upcase);
-assertEquals("xY", (String) f1.invokeExact("x", "y")); // xY
-MethodHandle f2 = filterArguments(cat, 0, upcase, upcase);
-assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
-     * </pre></blockquote>
-     *
-     * @param target the method handle to invoke after arguments are filtered
-     * @param pos the position of the first argument to filter
-     * @param filters method handles to call initially on filtered arguments
-     * @return method handle which incorporates the specified argument filtering logic
-     * @throws NullPointerException if the {@code target} argument is null
-     *                              or if the {@code filters} array is null
-     * @throws IllegalArgumentException if a non-null element of {@code filters}
-     *          does not match a corresponding argument type of {@code target} as described above,
-     *          or if the {@code pos+filters.length} is greater than {@code target.type().parameterCount()}
-     */
-    public static
-    MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
-        MethodType targetType = target.type();
-        MethodHandle adapter = target;
-        MethodType adapterType = targetType;
-        int maxPos = targetType.parameterCount();
-        if (pos + filters.length > maxPos)
-            throw newIllegalArgumentException("too many filters");
-        int curPos = pos-1;  // pre-incremented
-        for (MethodHandle filter : filters) {
-            curPos += 1;
-            if (filter == null)  continue;  // ignore null elements of filters
-            MethodType filterType = filter.type();
-            if (filterType.parameterCount() != 1
-                || filterType.returnType() != targetType.parameterType(curPos))
-                throw newIllegalArgumentException("target and filter types do not match");
-            adapterType = adapterType.changeParameterType(curPos, filterType.parameterType(0));
-            adapter = MethodHandleImpl.filterArgument(IMPL_TOKEN, adapter, curPos, filter);
-        }
-        MethodType midType = adapter.type();
-        if (midType != adapterType)
-            adapter = MethodHandleImpl.convertArguments(IMPL_TOKEN, adapter, adapterType, midType, null);
-        return adapter;
-    }
-
-    /**
-     * Adapt a target method handle {@code target} by post-processing
-     * its return value with a unary filter function.
-     * <p>
-     * If a filter {@code F} applies to the return value of
-     * the target method handle, then {@code F} must be a method handle which
-     * takes exactly one argument.  The return type of {@code F}
-     * replaces the return type of the target
-     * in the resulting adapted method handle.
-     * The argument type of {@code F} must be identical to the
-     * return type of the target.
-     * <b>Example:</b>
-     * <p><blockquote><pre>
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
-...
-MethodHandle cat = lookup().findVirtual(String.class,
-  "concat", methodType(String.class, String.class));
-MethodHandle length = lookup().findVirtual(String.class,
-  "length", methodType(int.class));
-System.out.println((String) cat.invokeExact("x", "y")); // xy
-MethodHandle f0 = filterReturnValue(cat, length);
-System.out.println((int) f0.invokeExact("x", "y")); // 2
-     * </pre></blockquote>
-     * @param target the method handle to invoke before filtering the return value
-     * @param filter method handle to call on the return value
-     * @return method handle which incorporates the specified return value filtering logic
-     * @throws NullPointerException if either argument is null
-     * @throws IllegalArgumentException if {@code filter}
-     *          does not match the return type of {@code target} as described above
-     */
-    public static
-    MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
-        MethodType targetType = target.type();
-        MethodType filterType = filter.type();
-        if (filterType.parameterCount() != 1
-            || filterType.parameterType(0) != targetType.returnType())
-            throw newIllegalArgumentException("target and filter types do not match");
-        // result = fold( lambda(retval, arg...) { filter(retval) },
-        //                lambda(        arg...) { target(arg...) } )
-        // FIXME: Too many nodes here.
-        MethodHandle returner = dropArguments(filter, 1, targetType.parameterList());
-        return foldArguments(returner, target);
-    }
-
-    /**
-     * Adapt a target method handle {@code target} by pre-processing
-     * some of its arguments, and then calling the target with
-     * the result of the pre-processing, plus all original arguments.
-     * <p>
-     * The pre-processing is performed by a second method handle, the {@code combiner}.
-     * The first {@code N} arguments passed to the adapter,
-     * are copied to the combiner, which then produces a result.
-     * (Here, {@code N} is defined as the parameter count of the adapter.)
-     * After this, control passes to the {@code target}, with both the result
-     * of the combiner, and all the original incoming arguments.
-     * <p>
-     * The first argument type of the target must be identical with the
-     * return type of the combiner.
-     * The resulting adapter is the same type as the target, except that the
-     * initial argument type of the target is dropped.
-     * <p>
-     * (Note that {@link #dropArguments(MethodHandle,int,List) dropArguments} can be used to remove any arguments
-     * that either the {@code combiner} or {@code target} does not wish to receive.
-     * If some of the incoming arguments are destined only for the combiner,
-     * consider using {@link MethodHandle#asCollector asCollector} instead, since those
-     * arguments will not need to be live on the stack on entry to the
-     * target.)
-     * <p>
-     * The first argument of the target must be identical with the
-     * return value of the combiner.
-     * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
-     * // there are N arguments in the A sequence
-     * T target(V, A[N]..., B...);
-     * V combiner(A...);
-     * T adapter(A... a, B... b) {
-     *   V v = combiner(a...);
-     *   return target(v, a..., b...);
-     * }
-     * </pre></blockquote>
-     * @param target the method handle to invoke after arguments are combined
-     * @param combiner method handle to call initially on the incoming arguments
-     * @return method handle which incorporates the specified argument folding logic
-     * @throws NullPointerException if either argument is null
-     * @throws IllegalArgumentException if the first argument type of
-     *          {@code target} is not the same as {@code combiner}'s return type,
-     *          or if the following argument types of {@code target}
-     *          are not identical with the argument types of {@code combiner}
-     */
-    public static
-    MethodHandle foldArguments(MethodHandle target, MethodHandle combiner) {
-        MethodType targetType = target.type();
-        MethodType combinerType = combiner.type();
-        int foldArgs = combinerType.parameterCount();
-        boolean ok = (targetType.parameterCount() >= 1 + foldArgs);
-        if (ok && !combinerType.parameterList().equals(targetType.parameterList().subList(1, foldArgs+1)))
-            ok = false;
-        if (ok && !combinerType.returnType().equals(targetType.parameterType(0)))
-            ok = false;
-        if (!ok)
-            throw misMatchedTypes("target and combiner types", targetType, combinerType);
-        MethodType newType = targetType.dropParameterTypes(0, 1);
-        return MethodHandleImpl.foldArguments(IMPL_TOKEN, target, newType, combiner);
-    }
-
-    /**
-     * Make a method handle which adapts a target method handle,
-     * by guarding it with a test, a boolean-valued method handle.
-     * If the guard fails, a fallback handle is called instead.
-     * All three method handles must have the same corresponding
-     * argument and return types, except that the return type
-     * of the test must be boolean, and the test is allowed
-     * to have fewer arguments than the other two method handles.
-     * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
-     * boolean test(A...);
-     * T target(A...,B...);
-     * T fallback(A...,B...);
-     * T adapter(A... a,B... b) {
-     *   if (test(a...))
-     *     return target(a..., b...);
-     *   else
-     *     return fallback(a..., b...);
-     * }
-     * </pre></blockquote>
-     * Note that the test arguments ({@code a...} in the pseudocode) cannot
-     * be modified by execution of the test, and so are passed unchanged
-     * from the caller to the target or fallback as appropriate.
-     * @param test method handle used for test, must return boolean
-     * @param target method handle to call if test passes
-     * @param fallback method handle to call if test fails
-     * @return method handle which incorporates the specified if/then/else logic
-     * @throws NullPointerException if any argument is null
-     * @throws IllegalArgumentException if {@code test} does not return boolean,
-     *          or if all three method types do not match (with the return
-     *          type of {@code test} changed to match that of {@code target}).
-     */
-    public static
-    MethodHandle guardWithTest(MethodHandle test,
-                               MethodHandle target,
-                               MethodHandle fallback) {
-        MethodType gtype = test.type();
-        MethodType ttype = target.type();
-        MethodType ftype = fallback.type();
-        if (!ttype.equals(ftype))
-            throw misMatchedTypes("target and fallback types", ttype, ftype);
-        if (gtype.returnType() != boolean.class)
-            throw newIllegalArgumentException("guard type is not a predicate "+gtype);
-        List<Class<?>> targs = ttype.parameterList();
-        List<Class<?>> gargs = gtype.parameterList();
-        if (!targs.equals(gargs)) {
-            int gpc = gargs.size(), tpc = targs.size();
-            if (gpc >= tpc || !targs.subList(0, gpc).equals(gargs))
-                throw misMatchedTypes("target and test types", ttype, gtype);
-            test = dropArguments(test, gpc, targs.subList(gpc, tpc));
-            gtype = test.type();
-        }
-        return MethodHandleImpl.makeGuardWithTest(IMPL_TOKEN, test, target, fallback);
-    }
-
-    static RuntimeException misMatchedTypes(String what, MethodType t1, MethodType t2) {
-        return newIllegalArgumentException(what + " must match: " + t1 + " != " + t2);
-    }
-
-    /**
-     * Make a method handle which adapts a target method handle,
-     * by running it inside an exception handler.
-     * If the target returns normally, the adapter returns that value.
-     * If an exception matching the specified type is thrown, the fallback
-     * handle is called instead on the exception, plus the original arguments.
-     * <p>
-     * The target and handler must have the same corresponding
-     * argument and return types, except that handler may omit trailing arguments
-     * (similarly to the predicate in {@link #guardWithTest guardWithTest}).
-     * Also, the handler must have an extra leading parameter of {@code exType} or a supertype.
-     * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
-     * T target(A..., B...);
-     * T handler(ExType, A...);
-     * T adapter(A... a, B... b) {
-     *   try {
-     *     return target(a..., b...);
-     *   } catch (ExType ex) {
-     *     return handler(ex, a...);
-     *   }
-     * }
-     * </pre></blockquote>
-     * Note that the saved arguments ({@code a...} in the pseudocode) cannot
-     * be modified by execution of the target, and so are passed unchanged
-     * from the caller to the handler, if the handler is invoked.
-     * <p>
-     * The target and handler must return the same type, even if the handler
-     * always throws.  (This might happen, for instance, because the handler
-     * is simulating a {@code finally} clause).
-     * To create such a throwing handler, compose the handler creation logic
-     * with {@link #throwException throwException},
-     * in order to create a method handle of the correct return type.
-     * @param target method handle to call
-     * @param exType the type of exception which the handler will catch
-     * @param handler method handle to call if a matching exception is thrown
-     * @return method handle which incorporates the specified try/catch logic
-     * @throws NullPointerException if any argument is null
-     * @throws IllegalArgumentException if {@code handler} does not accept
-     *          the given exception type, or if the method handle types do
-     *          not match in their return types and their
-     *          corresponding parameters
-     */
-    public static
-    MethodHandle catchException(MethodHandle target,
-                                Class<? extends Throwable> exType,
-                                MethodHandle handler) {
-        MethodType ttype = target.type();
-        MethodType htype = handler.type();
-        if (htype.parameterCount() < 1 ||
-            !htype.parameterType(0).isAssignableFrom(exType))
-            throw newIllegalArgumentException("handler does not accept exception type "+exType);
-        if (htype.returnType() != ttype.returnType())
-            throw misMatchedTypes("target and handler return types", ttype, htype);
-        List<Class<?>> targs = ttype.parameterList();
-        List<Class<?>> hargs = htype.parameterList();
-        hargs = hargs.subList(1, hargs.size());  // omit leading parameter from handler
-        if (!targs.equals(hargs)) {
-            int hpc = hargs.size(), tpc = targs.size();
-            if (hpc >= tpc || !targs.subList(0, hpc).equals(hargs))
-                throw misMatchedTypes("target and handler types", ttype, htype);
-            handler = dropArguments(handler, hpc, hargs.subList(hpc, tpc));
-            htype = handler.type();
-        }
-        return MethodHandleImpl.makeGuardWithCatch(IMPL_TOKEN, target, exType, handler);
-    }
-
-    /**
-     * Produces a method handle which will throw exceptions of the given {@code exType}.
-     * The method handle will accept a single argument of {@code exType},
-     * and immediately throw it as an exception.
-     * The method type will nominally specify a return of {@code returnType}.
-     * The return type may be anything convenient:  It doesn't matter to the
-     * method handle's behavior, since it will never return normally.
-     * @return method handle which can throw the given exceptions
-     * @throws NullPointerException if either argument is null
-     */
-    public static
-    MethodHandle throwException(Class<?> returnType, Class<? extends Throwable> exType) {
-        return MethodHandleImpl.throwException(IMPL_TOKEN, MethodType.methodType(returnType, exType));
-    }
-
-    /**
-     * Produces an instance of the given "SAM" interface which redirects
-     * its calls to the given method handle.
-     * <p>
-     * A SAM interface is an interface which declares a single abstract method.
-     * When determining the unique abstract method of a SAM interface,
-     * the public {@code Object} methods ({@code toString}, {@code equals}, {@code hashCode})
-     * are disregarded.  For example, {@link java.util.Comparator} is a SAM interface,
-     * even though it re-declares the {@code Object.equals} method.
-     * Also, if the SAM interface has a supertype,
-     * the SAM interface may override an inherited method.
-     * Any such overrides are respected, and the method handle will be accessible
-     * by either the inherited method or the SAM method.
-     * In particular, a {@linkplain java.lang.reflect.Method#isBridge bridge method}
-     * may be created if the methods have different return types.
-     * <p>
-     * The type must be public.  No additional access checks are performed.
-     * <p>
-     * The resulting instance of the required SAM type will respond to
-     * invocation of the SAM type's single abstract method by calling
-     * the given {@code target} on the incoming arguments,
-     * and returning or throwing whatever the {@code target}
-     * returns or throws.  The invocation will be as if by
-     * {@code target.invokeGeneric}.
-     * The target's type will be checked before the SAM
-     * instance is created, as if by a call to {@code asType},
-     * which may result in a {@code WrongMethodTypeException}.
-     * <p>
-     * The wrapper instance will implement the requested SAM interface
-     * and its super-types, but no other SAM types.
-     * This means that the SAM instance will not unexpectedly
-     * pass an {@code instanceof} test for any unrequested type.
-     * <p style="font-size:smaller;">
-     * <em>Implementation Note:</em>
-     * Therefore, each SAM instance must implement a unique SAM type.
-     * Implementations may not bundle together
-     * multiple SAM types onto single implementation classes
-     * in the style of {@link java.awt.AWTEventMulticaster}.
-     * <p>
-     * The method handle may throw an <em>undeclared exception</em>,
-     * which means any checked exception (or other checked throwable)
-     * not declared by the SAM type's single abstract method.
-     * If this happens, the throwable will be wrapped in an instance of
-     * {@link java.lang.reflect.UndeclaredThrowableException UndeclaredThrowableException}
-     * and thrown in that wrapped form.
-     * <p>
-     * Like {@link java.lang.Integer#valueOf Integer.valueOf},
-     * {@code asInstance} is a factory method whose results are defined
-     * by their behavior.
-     * It is not guaranteed to return a new instance for every call.
-     * <p>
-     * Future versions of this API may accept additional types,
-     * such as abstract classes with single abstract methods.
-     * Future versions of this API may also equip wrapper instances
-     * with one or more additional public "marker" interfaces.
-     *
-     * @param target the method handle to invoke from the wrapper
-     * @param samType the desired type of the wrapper, a SAM type
-     * @return a correctly-typed wrapper for the given {@code target}
-     * @throws NullPointerException if either argument is null
-     * @throws IllegalArgumentException if the {@code samType} is not a
-     *         valid argument to this method
-     * @throws WrongMethodTypeException if the {@code target} cannot
-     *         be converted to the type required by the SAM type
-     */
-    // Other notes to implementors:
-    // <p>
-    // No stable mapping is promised between the SAM type and
-    // the implementation class C.  Over time, several implementation
-    // classes might be used for the same SAM type.
-    // <p>
-    // If the implementation is able
-    // to prove that a wrapper of the required SAM type
-    // has already been created for a given
-    // method handle, or for another method handle with the
-    // same behavior, the implementation may return that wrapper in place of
-    // a new wrapper.
-    // <p>
-    // This method is designed to apply to common use cases
-    // where a single method handle must interoperate with
-    // an interface that implements a function-like
-    // API.  Additional variations, such as SAM classes with
-    // private constructors, or interfaces with multiple but related
-    // entry points, must be covered by hand-written or automatically
-    // generated adapter classes.
-    //
-    public static
-    <T> T asInstance(final MethodHandle target, final Class<T> samType) {
-        // POC implementation only; violates the above contract several ways
-        final Method sam = getSamMethod(samType);
-        if (sam == null)
-            throw new IllegalArgumentException("not a SAM type: "+samType.getName());
-        MethodType samMT = MethodType.methodType(sam.getReturnType(), sam.getParameterTypes());
-        MethodHandle checkTarget = target.asType(samMT);  // make throw WMT
-        checkTarget = checkTarget.asType(checkTarget.type().changeReturnType(Object.class));
-        final MethodHandle vaTarget = checkTarget.asSpreader(Object[].class, samMT.parameterCount());
-        return samType.cast(Proxy.newProxyInstance(
-                samType.getClassLoader(),
-                new Class[]{ samType, WrapperInstance.class },
-                new InvocationHandler() {
-                    private Object getArg(String name) {
-                        if ((Object)name == "getWrapperInstanceTarget")  return target;
-                        if ((Object)name == "getWrapperInstanceType")    return samType;
-                        throw new AssertionError();
-                    }
-                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-                        if (method.getDeclaringClass() == WrapperInstance.class)
-                            return getArg(method.getName());
-                        if (method.equals(sam))
-                            return vaTarget.invokeExact(args);
-                        if (isObjectMethod(method))
-                            return callObjectMethod(this, method, args);
-                        throw new InternalError();
-                    }
-                }));
-    }
-
-    /**
-     * Determine if the given object was produced by a call to {@link #asInstance asInstance}.
-     * @param x any reference
-     * @return true if the reference is not null and points to an object produced by {@code asInstance}
-     */
-    public static
-    boolean isWrapperInstance(Object x) {
-        return x instanceof WrapperInstance;
-    }
-
-    private static WrapperInstance asWrapperInstance(Object x) {
-        try {
-            if (x != null)
-                return (WrapperInstance) x;
-        } catch (ClassCastException ex) {
-        }
-        throw new IllegalArgumentException("not a wrapper instance");
-    }
-
-    /**
-     * Produces or recovers a target method handle which is behaviorally
-     * equivalent to the SAM method of this wrapper instance.
-     * The object {@code x} must have been produced by a call to {@link #asInstance asInstance}.
-     * This requirement may be tested via {@link #isWrapperInstance isWrapperInstance}.
-     * @param x any reference
-     * @return a method handle implementing the SAM method
-     * @throws IllegalArgumentException if the reference x is not to a wrapper instance
-     */
-    public static
-    MethodHandle wrapperInstanceTarget(Object x) {
-        return asWrapperInstance(x).getWrapperInstanceTarget();
-    }
-
-    /**
-     * Recover the SAM type for which this wrapper instance was created.
-     * The object {@code x} must have been produced by a call to {@link #asInstance asInstance}.
-     * This requirement may be tested via {@link #isWrapperInstance isWrapperInstance}.
-     * @param x any reference
-     * @return the SAM type for which the wrapper was created
-     * @throws IllegalArgumentException if the reference x is not to a wrapper instance
-     */
-    public static
-    Class<?> wrapperInstanceType(Object x) {
-        return asWrapperInstance(x).getWrapperInstanceType();
-    }
-
-    private static
-    boolean isObjectMethod(Method m) {
-        switch (m.getName()) {
-        case "toString":
-            return (m.getReturnType() == String.class
-                    && m.getParameterTypes().length == 0);
-        case "hashCode":
-            return (m.getReturnType() == int.class
-                    && m.getParameterTypes().length == 0);
-        case "equals":
-            return (m.getReturnType() == boolean.class
-                    && m.getParameterTypes().length == 1
-                    && m.getParameterTypes()[0] == Object.class);
-        }
-        return false;
-    }
-
-    private static
-    Object callObjectMethod(Object self, Method m, Object[] args) {
-        assert(isObjectMethod(m)) : m;
-        switch (m.getName()) {
-        case "toString":
-            return self.getClass().getName() + "@" + Integer.toHexString(self.hashCode());
-        case "hashCode":
-            return System.identityHashCode(self);
-        case "equals":
-            return (self == args[0]);
-        }
-        return null;
-    }
-
-    private static
-    Method getSamMethod(Class<?> samType) {
-        Method sam = null;
-        for (Method m : samType.getMethods()) {
-            int mod = m.getModifiers();
-            if (Modifier.isAbstract(mod)) {
-                if (sam != null && !isObjectMethod(sam))
-                    return null;  // too many abstract methods
-                sam = m;
-            }
-        }
-        if (!samType.isInterface() && getSamConstructor(samType) == null)
-            return null;  // wrong kind of constructor
-        return sam;
-    }
-
-    private static
-    Constructor getSamConstructor(Class<?> samType) {
-        for (Constructor c : samType.getDeclaredConstructors()) {
-            if (c.getParameterTypes().length == 0) {
-                int mod = c.getModifiers();
-                if (Modifier.isPublic(mod) || Modifier.isProtected(mod))
-                    return c;
-            }
-        }
-        return null;
-    }
-
-    /*non-public*/
-    static MethodHandle asVarargsCollector(MethodHandle target, Class<?> arrayType) {
-        return MethodHandleImpl.asVarargsCollector(IMPL_TOKEN, target, arrayType);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/MethodType.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,865 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 java.dyn;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import sun.dyn.Access;
-import sun.dyn.Invokers;
-import sun.dyn.MethodHandleImpl;
-import sun.dyn.MethodTypeImpl;
-import sun.dyn.util.BytecodeDescriptor;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * A method type represents the arguments and return type accepted and
- * returned by a method handle, or the arguments and return type passed
- * and expected  by a method handle caller.  Method types must be properly
- * matched between a method handle and all its callers,
- * and the JVM's operations enforce this matching at, specifically
- * during calls to {@link MethodHandle#invokeExact MethodHandle.invokeExact}
- * and {@link MethodHandle#invokeGeneric MethodHandle.invokeGeneric}, and during execution
- * of {@code invokedynamic} instructions.
- * <p>
- * The structure is a return type accompanied by any number of parameter types.
- * The types (primitive, {@code void}, and reference) are represented by {@link Class} objects.
- * (For ease of exposition, we treat {@code void} as if it were a type.
- * In fact, it denotes the absence of a return type.)
- * <p>
- * All instances of {@code MethodType} are immutable.
- * Two instances are completely interchangeable if they compare equal.
- * Equality depends on pairwise correspondence of the return and parameter types and on nothing else.
- * <p>
- * This type can be created only by factory methods.
- * All factory methods may cache values, though caching is not guaranteed.
- * Some factory methods are static, while others are virtual methods which
- * modify precursor method types, e.g., by changing a selected parameter.
- * <p>
- * Factory methods which operate on groups of parameter types
- * are systematically presented in two versions, so that both Java arrays and
- * Java lists can be used to work with groups of parameter types.
- * The query methods {@code parameterArray} and {@code parameterList}
- * also provide a choice between arrays and lists.
- * <p>
- * {@code MethodType} objects are sometimes derived from bytecode instructions
- * such as {@code invokedynamic}, specifically from the type descriptor strings associated
- * with the instructions in a class file's constant pool.
- * <p>
- * Like classes and strings, method types can also be represented directly
- * in a class file's constant pool as constants.
- * A method type may be loaded by an {@code ldc} instruction which refers
- * to a suitable {@code CONSTANT_MethodType} constant pool entry.
- * The entry refers to a {@code CONSTANT_Utf8} spelling for the descriptor string.
- * For more details, see the <a href="package-summary.html#mtcon">package summary</a>.
- * <p>
- * When the JVM materializes a {@code MethodType} from a descriptor string,
- * all classes named in the descriptor must be accessible, and will be loaded.
- * (But the classes need not be initialized, as is the case with a {@code CONSTANT_Class}.)
- * This loading may occur at any time before the {@code MethodType} object is first derived.
- * @author John Rose, JSR 292 EG
- */
-public final
-class MethodType implements java.io.Serializable {
-    private static final long serialVersionUID = 292L;  // {rtype, {ptype...}}
-
-    // The rtype and ptypes fields define the structural identity of the method type:
-    private final Class<?>   rtype;
-    private final Class<?>[] ptypes;
-
-    // The remaining fields are caches of various sorts:
-    private MethodTypeForm form; // erased form, plus cached data about primitives
-    private MethodType wrapAlt;  // alternative wrapped/unwrapped version
-    private Invokers invokers;   // cache of handy higher-order adapters
-
-    private static final Access IMPL_TOKEN = Access.getToken();
-
-    // share a cache with a friend in this package
-    Invokers getInvokers() { return invokers; }
-    void setInvokers(Invokers inv) { invokers = inv; }
-
-    static {
-        // This hack allows the implementation package special access to
-        // the internals of MethodType.  In particular, the MTImpl has all sorts
-        // of cached information useful to the implementation code.
-        MethodTypeImpl.setMethodTypeFriend(IMPL_TOKEN, new MethodTypeImpl.MethodTypeFriend() {
-            public Class<?>[] ptypes(MethodType mt)        { return mt.ptypes; }
-            public MethodTypeImpl form(MethodType mt)      { return mt.form; }
-            public void setForm(MethodType mt, MethodTypeImpl form) {
-                assert(mt.form == null);
-                mt.form = (MethodTypeForm) form;
-            }
-            public MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
-                return MethodType.makeImpl(rtype, ptypes, trusted);
-            }
-            public MethodTypeImpl newMethodTypeForm(MethodType mt) {
-                return new MethodTypeForm(mt);
-            }
-            public Invokers getInvokers(MethodType mt)    { return mt.invokers; }
-            public void setInvokers(MethodType mt, Invokers inv) { mt.invokers = inv; }
-        });
-    }
-
-    /**
-     * Check the given parameters for validity and store them into the final fields.
-     */
-    private MethodType(Class<?> rtype, Class<?>[] ptypes) {
-        checkRtype(rtype);
-        checkPtypes(ptypes);
-        this.rtype = rtype;
-        this.ptypes = ptypes;
-    }
-
-    private static void checkRtype(Class<?> rtype) {
-        rtype.equals(rtype);  // null check
-    }
-    private static int checkPtype(Class<?> ptype) {
-        ptype.getClass();  //NPE
-        if (ptype == void.class)
-            throw newIllegalArgumentException("parameter type cannot be void");
-        if (ptype == double.class || ptype == long.class)  return 1;
-        return 0;
-    }
-    /** Return number of extra slots (count of long/double args). */
-    private static int checkPtypes(Class<?>[] ptypes) {
-        int slots = 0;
-        for (Class<?> ptype : ptypes) {
-            slots += checkPtype(ptype);
-        }
-        checkSlotCount(ptypes.length + slots);
-        return slots;
-    }
-    private static void checkSlotCount(int count) {
-        if ((count & 0xFF) != count)
-            throw newIllegalArgumentException("bad parameter count "+count);
-    }
-    private static IndexOutOfBoundsException newIndexOutOfBoundsException(Object num) {
-        if (num instanceof Integer)  num = "bad index: "+num;
-        return new IndexOutOfBoundsException(num.toString());
-    }
-
-    static final HashMap<MethodType,MethodType> internTable
-            = new HashMap<MethodType, MethodType>();
-
-    static final Class<?>[] NO_PTYPES = {};
-
-    /**
-     * Find or create an instance of the given method type.
-     * @param rtype  the return type
-     * @param ptypes the parameter types
-     * @return a method type with the given components
-     * @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
-     * @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
-     */
-    public static
-    MethodType methodType(Class<?> rtype, Class<?>[] ptypes) {
-        return makeImpl(rtype, ptypes, false);
-    }
-
-    /**
-     * Finds or creates a method type with the given components.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @return a method type with the given components
-     * @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
-     * @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
-     */
-    public static
-    MethodType methodType(Class<?> rtype, List<Class<?>> ptypes) {
-        boolean notrust = false;  // random List impl. could return evil ptypes array
-        return makeImpl(rtype, ptypes.toArray(NO_PTYPES), notrust);
-    }
-
-    /**
-     * Finds or creates a method type with the given components.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * The leading parameter type is prepended to the remaining array.
-     * @return a method type with the given components
-     * @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null
-     * @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class}
-     */
-    public static
-    MethodType methodType(Class<?> rtype, Class<?> ptype0, Class<?>... ptypes) {
-        Class<?>[] ptypes1 = new Class<?>[1+ptypes.length];
-        ptypes1[0] = ptype0;
-        System.arraycopy(ptypes, 0, ptypes1, 1, ptypes.length);
-        return makeImpl(rtype, ptypes1, true);
-    }
-
-    /**
-     * Finds or creates a method type with the given components.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * The resulting method has no parameter types.
-     * @return a method type with the given return value
-     * @throws NullPointerException if {@code rtype} is null
-     */
-    public static
-    MethodType methodType(Class<?> rtype) {
-        return makeImpl(rtype, NO_PTYPES, true);
-    }
-
-    /**
-     * Finds or creates a method type with the given components.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * The resulting method has the single given parameter type.
-     * @return a method type with the given return value and parameter type
-     * @throws NullPointerException if {@code rtype} or {@code ptype0} is null
-     * @throws IllegalArgumentException if {@code ptype0} is {@code void.class}
-     */
-    public static
-    MethodType methodType(Class<?> rtype, Class<?> ptype0) {
-        return makeImpl(rtype, new Class<?>[]{ ptype0 }, true);
-    }
-
-    /**
-     * Finds or creates a method type with the given components.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * The resulting method has the same parameter types as {@code ptypes},
-     * and the specified return type.
-     * @throws NullPointerException if {@code rtype} or {@code ptypes} is null
-     */
-    public static
-    MethodType methodType(Class<?> rtype, MethodType ptypes) {
-        return makeImpl(rtype, ptypes.ptypes, true);
-    }
-
-    /**
-     * Sole factory method to find or create an interned method type.
-     * @param rtype desired return type
-     * @param ptypes desired parameter types
-     * @param trusted whether the ptypes can be used without cloning
-     * @return the unique method type of the desired structure
-     */
-    private static
-    MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
-        if (ptypes == null || ptypes.length == 0) {
-            ptypes = NO_PTYPES; trusted = true;
-        }
-        MethodType mt1 = new MethodType(rtype, ptypes);
-        MethodType mt0;
-        synchronized (internTable) {
-            mt0 = internTable.get(mt1);
-            if (mt0 != null)
-                return mt0;
-        }
-        if (!trusted)
-            // defensively copy the array passed in by the user
-            mt1 = new MethodType(rtype, ptypes.clone());
-        // promote the object to the Real Thing, and reprobe
-        MethodTypeImpl.initForm(IMPL_TOKEN, mt1);
-        synchronized (internTable) {
-            mt0 = internTable.get(mt1);
-            if (mt0 != null)
-                return mt0;
-            internTable.put(mt1, mt1);
-        }
-        return mt1;
-    }
-
-    // Entry point from JVM.  TODO: Change the name & signature.
-    private static MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes,
-            boolean ignore1, boolean ignore2) {
-        return makeImpl(rtype, ptypes, true);
-    }
-
-    private static final MethodType[] objectOnlyTypes = new MethodType[20];
-
-    /**
-     * Finds or creates a method type whose components are {@code Object} with an optional trailing {@code Object[]} array.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * All parameters and the return type will be {@code Object},
-     * except the final varargs parameter if any, which will be {@code Object[]}.
-     * @param objectArgCount number of parameters (excluding the varargs parameter if any)
-     * @param varargs whether there will be a varargs parameter, of type {@code Object[]}
-     * @return a totally generic method type, given only its count of parameters and varargs
-     * @throws IllegalArgumentException if {@code objectArgCount} is negative or greater than 255
-     * @see #genericMethodType(int)
-     */
-    public static
-    MethodType genericMethodType(int objectArgCount, boolean varargs) {
-        MethodType mt;
-        checkSlotCount(objectArgCount);
-        int ivarargs = (!varargs ? 0 : 1);
-        int ootIndex = objectArgCount*2 + ivarargs;
-        if (ootIndex < objectOnlyTypes.length) {
-            mt = objectOnlyTypes[ootIndex];
-            if (mt != null)  return mt;
-        }
-        Class<?>[] ptypes = new Class<?>[objectArgCount + ivarargs];
-        Arrays.fill(ptypes, Object.class);
-        if (ivarargs != 0)  ptypes[objectArgCount] = Object[].class;
-        mt = makeImpl(Object.class, ptypes, true);
-        if (ootIndex < objectOnlyTypes.length) {
-            objectOnlyTypes[ootIndex] = mt;     // cache it here also!
-        }
-        return mt;
-    }
-
-    /**
-     * Finds or creates a method type whose components are all {@code Object}.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * All parameters and the return type will be Object.
-     * @param objectArgCount number of parameters
-     * @return a totally generic method type, given only its count of parameters
-     * @throws IllegalArgumentException if {@code objectArgCount} is negative or greater than 255
-     * @see #genericMethodType(int, boolean)
-     */
-    public static
-    MethodType genericMethodType(int objectArgCount) {
-        return genericMethodType(objectArgCount, false);
-    }
-
-    /**
-     * Finds or creates a method type with a single different parameter type.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param num    the index (zero-based) of the parameter type to change
-     * @param nptype a new parameter type to replace the old one with
-     * @return the same type, except with the selected parameter changed
-     * @throws IndexOutOfBoundsException if {@code num} is not a valid index into {@code parameterArray()}
-     * @throws IllegalArgumentException if {@code nptype} is {@code void.class}
-     * @throws NullPointerException if {@code nptype} is null
-     */
-    public MethodType changeParameterType(int num, Class<?> nptype) {
-        if (parameterType(num) == nptype)  return this;
-        checkPtype(nptype);
-        Class<?>[] nptypes = ptypes.clone();
-        nptypes[num] = nptype;
-        return makeImpl(rtype, nptypes, true);
-    }
-
-    /**
-     * Finds or creates a method type with additional parameter types.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param num    the position (zero-based) of the inserted parameter type(s)
-     * @param ptypesToInsert zero or more new parameter types to insert into the parameter list
-     * @return the same type, except with the selected parameter(s) inserted
-     * @throws IndexOutOfBoundsException if {@code num} is negative or greater than {@code parameterCount()}
-     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
-     *                                  or if the resulting method type would have more than 255 parameter slots
-     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
-     */
-    public MethodType insertParameterTypes(int num, Class<?>... ptypesToInsert) {
-        int len = ptypes.length;
-        if (num < 0 || num > len)
-            throw newIndexOutOfBoundsException(num);
-        int ins = checkPtypes(ptypesToInsert);
-        checkSlotCount(parameterSlotCount() + ptypesToInsert.length + ins);
-        int ilen = ptypesToInsert.length;
-        if (ilen == 0)  return this;
-        Class<?>[] nptypes = Arrays.copyOfRange(ptypes, 0, len+ilen);
-        System.arraycopy(nptypes, num, nptypes, num+ilen, len-num);
-        System.arraycopy(ptypesToInsert, 0, nptypes, num, ilen);
-        return makeImpl(rtype, nptypes, true);
-    }
-
-    /**
-     * Finds or creates a method type with additional parameter types.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param ptypesToInsert zero or more new parameter types to insert after the end of the parameter list
-     * @return the same type, except with the selected parameter(s) appended
-     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
-     *                                  or if the resulting method type would have more than 255 parameter slots
-     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
-     */
-    public MethodType appendParameterTypes(Class<?>... ptypesToInsert) {
-        return insertParameterTypes(parameterCount(), ptypesToInsert);
-    }
-
-    /**
-     * Finds or creates a method type with additional parameter types.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param num    the position (zero-based) of the inserted parameter type(s)
-     * @param ptypesToInsert zero or more new parameter types to insert into the parameter list
-     * @return the same type, except with the selected parameter(s) inserted
-     * @throws IndexOutOfBoundsException if {@code num} is negative or greater than {@code parameterCount()}
-     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
-     *                                  or if the resulting method type would have more than 255 parameter slots
-     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
-     */
-    public MethodType insertParameterTypes(int num, List<Class<?>> ptypesToInsert) {
-        return insertParameterTypes(num, ptypesToInsert.toArray(NO_PTYPES));
-    }
-
-    /**
-     * Finds or creates a method type with additional parameter types.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param ptypesToInsert zero or more new parameter types to insert after the end of the parameter list
-     * @return the same type, except with the selected parameter(s) appended
-     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
-     *                                  or if the resulting method type would have more than 255 parameter slots
-     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
-     */
-    public MethodType appendParameterTypes(List<Class<?>> ptypesToInsert) {
-        return insertParameterTypes(parameterCount(), ptypesToInsert);
-    }
-
-    /**
-     * Finds or creates a method type with some parameter types omitted.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param start  the index (zero-based) of the first parameter type to remove
-     * @param end    the index (greater than {@code start}) of the first parameter type after not to remove
-     * @return the same type, except with the selected parameter(s) removed
-     * @throws IndexOutOfBoundsException if {@code start} is negative or greater than {@code parameterCount()}
-     *                                  or if {@code end} is negative or greater than {@code parameterCount()}
-     *                                  or if {@code start} is greater than {@code end}
-     */
-    public MethodType dropParameterTypes(int start, int end) {
-        int len = ptypes.length;
-        if (!(0 <= start && start <= end && end <= len))
-            throw newIndexOutOfBoundsException("start="+start+" end="+end);
-        if (start == end)  return this;
-        Class<?>[] nptypes;
-        if (start == 0) {
-            if (end == len) {
-                // drop all parameters
-                nptypes = NO_PTYPES;
-            } else {
-                // drop initial parameter(s)
-                nptypes = Arrays.copyOfRange(ptypes, end, len);
-            }
-        } else {
-            if (end == len) {
-                // drop trailing parameter(s)
-                nptypes = Arrays.copyOfRange(ptypes, 0, start);
-            } else {
-                int tail = len - end;
-                nptypes = Arrays.copyOfRange(ptypes, 0, start + tail);
-                System.arraycopy(ptypes, end, nptypes, start, tail);
-            }
-        }
-        return makeImpl(rtype, nptypes, true);
-    }
-
-    /**
-     * Finds or creates a method type with a different return type.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * @param nrtype a return parameter type to replace the old one with
-     * @return the same type, except with the return type change
-     * @throws NullPointerException if {@code nrtype} is null
-     */
-    public MethodType changeReturnType(Class<?> nrtype) {
-        if (returnType() == nrtype)  return this;
-        return makeImpl(nrtype, ptypes, true);
-    }
-
-    /**
-     * Reports if this type contains a primitive argument or return value.
-     * The return type {@code void} counts as a primitive.
-     * @return true if any of the types are primitives
-     */
-    public boolean hasPrimitives() {
-        return form.hasPrimitives();
-    }
-
-    /**
-     * Reports if this type contains a wrapper argument or return value.
-     * Wrappers are types which box primitive values, such as {@link Integer}.
-     * The reference type {@code java.lang.Void} counts as a wrapper.
-     * @return true if any of the types are wrappers
-     */
-    public boolean hasWrappers() {
-        return unwrap() != this;
-    }
-
-    /**
-     * Erases all reference types to {@code Object}.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * All primitive types (including {@code void}) will remain unchanged.
-     * @return a version of the original type with all reference types replaced
-     */
-    public MethodType erase() {
-        return form.erasedType();
-    }
-
-    /**
-     * Converts all types, both reference and primitive, to {@code Object}.
-     * Convenience method for {@link #genericMethodType(int) genericMethodType}.
-     * The expression {@code type.wrap().erase()} produces the same value
-     * as {@code type.generic()}.
-     * @return a version of the original type with all types replaced
-     */
-    public MethodType generic() {
-        return genericMethodType(parameterCount());
-    }
-
-    /**
-     * Converts all primitive types to their corresponding wrapper types.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * All reference types (including wrapper types) will remain unchanged.
-     * A {@code void} return type is changed to the type {@code java.lang.Void}.
-     * The expression {@code type.wrap().erase()} produces the same value
-     * as {@code type.generic()}.
-     * @return a version of the original type with all primitive types replaced
-     */
-    public MethodType wrap() {
-        return hasPrimitives() ? wrapWithPrims(this) : this;
-    }
-
-    /**
-     * Convert all wrapper types to their corresponding primitive types.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * All primitive types (including {@code void}) will remain unchanged.
-     * A return type of {@code java.lang.Void} is changed to {@code void}.
-     * @return a version of the original type with all wrapper types replaced
-     */
-    public MethodType unwrap() {
-        MethodType noprims = !hasPrimitives() ? this : wrapWithPrims(this);
-        return unwrapWithNoPrims(noprims);
-    }
-
-    private static MethodType wrapWithPrims(MethodType pt) {
-        assert(pt.hasPrimitives());
-        MethodType wt = pt.wrapAlt;
-        if (wt == null) {
-            // fill in lazily
-            wt = MethodTypeImpl.canonicalize(pt, MethodTypeImpl.WRAP, MethodTypeImpl.WRAP);
-            assert(wt != null);
-            pt.wrapAlt = wt;
-        }
-        return wt;
-    }
-
-    private static MethodType unwrapWithNoPrims(MethodType wt) {
-        assert(!wt.hasPrimitives());
-        MethodType uwt = wt.wrapAlt;
-        if (uwt == null) {
-            // fill in lazily
-            uwt = MethodTypeImpl.canonicalize(wt, MethodTypeImpl.UNWRAP, MethodTypeImpl.UNWRAP);
-            if (uwt == null)
-                uwt = wt;    // type has no wrappers or prims at all
-            wt.wrapAlt = uwt;
-        }
-        return uwt;
-    }
-
-    /**
-     * Returns the parameter type at the specified index, within this method type.
-     * @param num the index (zero-based) of the desired parameter type
-     * @return the selected parameter type
-     * @throws IndexOutOfBoundsException if {@code num} is not a valid index into {@code parameterArray()}
-     */
-    public Class<?> parameterType(int num) {
-        return ptypes[num];
-    }
-    /**
-     * Returns the number of parameter types in this method type.
-     * @return the number of parameter types
-     */
-    public int parameterCount() {
-        return ptypes.length;
-    }
-    /**
-     * Returns the return type of this method type.
-     * @return the return type
-     */
-    public Class<?> returnType() {
-        return rtype;
-    }
-
-    /**
-     * Presents the parameter types as a list (a convenience method).
-     * The list will be immutable.
-     * @return the parameter types (as an immutable list)
-     */
-    public List<Class<?>> parameterList() {
-        return Collections.unmodifiableList(Arrays.asList(ptypes));
-    }
-
-    /**
-     * Presents the parameter types as an array (a convenience method).
-     * Changes to the array will not result in changes to the type.
-     * @return the parameter types (as a fresh copy if necessary)
-     */
-    public Class<?>[] parameterArray() {
-        return ptypes.clone();
-    }
-
-    /**
-     * Compares the specified object with this type for equality.
-     * That is, it returns <tt>true</tt> if and only if the specified object
-     * is also a method type with exactly the same parameters and return type.
-     * @param x object to compare
-     * @see Object#equals(Object)
-     */
-    @Override
-    public boolean equals(Object x) {
-        return this == x || x instanceof MethodType && equals((MethodType)x);
-    }
-
-    private boolean equals(MethodType that) {
-        return this.rtype == that.rtype
-            && Arrays.equals(this.ptypes, that.ptypes);
-    }
-
-    /**
-     * Returns the hash code value for this method type.
-     * It is defined to be the same as the hashcode of a List
-     * whose elements are the return type followed by the
-     * parameter types.
-     * @return the hash code value for this method type
-     * @see Object#hashCode()
-     * @see #equals(Object)
-     * @see List#hashCode()
-     */
-    @Override
-    public int hashCode() {
-      int hashCode = 31 + rtype.hashCode();
-      for (Class<?> ptype : ptypes)
-          hashCode = 31*hashCode + ptype.hashCode();
-      return hashCode;
-    }
-
-    /**
-     * Returns a string representation of the method type,
-     * of the form {@code "(PT0,PT1...)RT"}.
-     * The string representation of a method type is a
-     * parenthesis enclosed, comma separated list of type names,
-     * followed immediately by the return type.
-     * <p>
-     * Each type is represented by its
-     * {@link java.lang.Class#getSimpleName simple name}.
-     */
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("(");
-        for (int i = 0; i < ptypes.length; i++) {
-            if (i > 0)  sb.append(",");
-            sb.append(ptypes[i].getSimpleName());
-        }
-        sb.append(")");
-        sb.append(rtype.getSimpleName());
-        return sb.toString();
-    }
-
-    /// Queries which have to do with the bytecode architecture
-
-    /** Reports the number of JVM stack slots required to invoke a method
-     * of this type.  Note that (for historic reasons) the JVM requires
-     * a second stack slot to pass long and double arguments.
-     * So this method returns {@link #parameterCount() parameterCount} plus the
-     * number of long and double parameters (if any).
-     * <p>
-     * This method is included for the benfit of applications that must
-     * generate bytecodes that process method handles and invokedynamic.
-     * @return the number of JVM stack slots for this type's parameters
-     * @deprecated Will be removed for PFD.
-     */
-    public int parameterSlotCount() {
-        return form.parameterSlotCount();
-    }
-
-    /** Reports the number of JVM stack slots which carry all parameters including and after
-     * the given position, which must be in the range of 0 to
-     * {@code parameterCount} inclusive.  Successive parameters are
-     * more shallowly stacked, and parameters are indexed in the bytecodes
-     * according to their trailing edge.  Thus, to obtain the depth
-     * in the outgoing call stack of parameter {@code N}, obtain
-     * the {@code parameterSlotDepth} of its trailing edge
-     * at position {@code N+1}.
-     * <p>
-     * Parameters of type {@code long} and {@code double} occupy
-     * two stack slots (for historical reasons) and all others occupy one.
-     * Therefore, the number returned is the number of arguments
-     * <em>including</em> and <em>after</em> the given parameter,
-     * <em>plus</em> the number of long or double arguments
-     * at or after after the argument for the given parameter.
-     * <p>
-     * This method is included for the benfit of applications that must
-     * generate bytecodes that process method handles and invokedynamic.
-     * @param num an index (zero-based, inclusive) within the parameter types
-     * @return the index of the (shallowest) JVM stack slot transmitting the
-     *         given parameter
-     * @throws IllegalArgumentException if {@code num} is negative or greater than {@code parameterCount()}
-     * @deprecated Will be removed for PFD.
-     */
-    public int parameterSlotDepth(int num) {
-        if (num < 0 || num > ptypes.length)
-            parameterType(num);  // force a range check
-        return form.parameterToArgSlot(num-1);
-    }
-
-    /** Reports the number of JVM stack slots required to receive a return value
-     * from a method of this type.
-     * If the {@link #returnType() return type} is void, it will be zero,
-     * else if the return type is long or double, it will be two, else one.
-     * <p>
-     * This method is included for the benfit of applications that must
-     * generate bytecodes that process method handles and invokedynamic.
-     * @return the number of JVM stack slots (0, 1, or 2) for this type's return value
-     * @deprecated Will be removed for PFD.
-     */
-    public int returnSlotCount() {
-        return form.returnSlotCount();
-    }
-
-    /**
-     * Find or create an instance of a method type, given the spelling of its bytecode descriptor.
-     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
-     * Any class or interface name embedded in the descriptor string
-     * will be resolved by calling {@link ClassLoader#loadClass(java.lang.String)}
-     * on the given loader (or if it is null, on the system class loader).
-     * <p>
-     * Note that it is possible to encounter method types which cannot be
-     * constructed by this method, because their component types are
-     * not all reachable from a common class loader.
-     * <p>
-     * This method is included for the benfit of applications that must
-     * generate bytecodes that process method handles and {@code invokedynamic}.
-     * @param descriptor a bytecode-level type descriptor string "(T...)T"
-     * @param loader the class loader in which to look up the types
-     * @return a method type matching the bytecode-level type descriptor
-     * @throws IllegalArgumentException if the string is not well-formed
-     * @throws TypeNotPresentException if a named type cannot be found
-     */
-    public static MethodType fromMethodDescriptorString(String descriptor, ClassLoader loader)
-        throws IllegalArgumentException, TypeNotPresentException
-    {
-        List<Class<?>> types = BytecodeDescriptor.parseMethod(descriptor, loader);
-        Class<?> rtype = types.remove(types.size() - 1);
-        Class<?>[] ptypes = types.toArray(NO_PTYPES);
-        return makeImpl(rtype, ptypes, true);
-    }
-
-    /**
-     * Produces a bytecode descriptor representation of the method type.
-     * <p>
-     * Note that this is not a strict inverse of {@link #fromMethodDescriptorString fromMethodDescriptorString}.
-     * Two distinct classes which share a common name but have different class loaders
-     * will appear identical when viewed within descriptor strings.
-     * <p>
-     * This method is included for the benfit of applications that must
-     * generate bytecodes that process method handles and {@code invokedynamic}.
-     * {@link #fromMethodDescriptorString(java.lang.String, java.lang.ClassLoader) fromMethodDescriptorString},
-     * because the latter requires a suitable class loader argument.
-     * @return the bytecode type descriptor representation
-     */
-    public String toMethodDescriptorString() {
-        return BytecodeDescriptor.unparse(this);
-    }
-
-    /// Serialization.
-
-    /**
-     * There are no serializable fields for {@code MethodType}.
-     */
-    private static final java.io.ObjectStreamField[] serialPersistentFields = { };
-
-    /**
-     * Save the {@code MethodType} instance to a stream.
-     *
-     * @serialData
-     * For portability, the serialized format does not refer to named fields.
-     * Instead, the return type and parameter type arrays are written directly
-     * from the {@code writeObject} method, using two calls to {@code s.writeObject}
-     * as follows:
-     * <blockquote><pre>
-s.writeObject(this.returnType());
-s.writeObject(this.parameterArray());
-     * </pre></blockquote>
-     * <p>
-     * The deserialized field values are checked as if they were
-     * provided to the factory method {@link #methodType(Class,Class[]) methodType}.
-     * For example, null values, or {@code void} parameter types,
-     * will lead to exceptions during deserialization.
-     * @param the stream to write the object to
-     */
-    private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
-        s.defaultWriteObject();  // requires serialPersistentFields to be an empty array
-        s.writeObject(returnType());
-        s.writeObject(parameterArray());
-    }
-
-    /**
-     * Reconstitute the {@code MethodType} instance from a stream (that is,
-     * deserialize it).
-     * This instance is a scratch object with bogus final fields.
-     * It provides the parameters to the factory method called by
-     * {@link #readResolve readResolve}.
-     * After that call it is discarded.
-     * @param the stream to read the object from
-     * @see #MethodType()
-     * @see #readResolve
-     * @see #writeObject
-     */
-    private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();  // requires serialPersistentFields to be an empty array
-
-        Class<?>   returnType     = (Class<?>)   s.readObject();
-        Class<?>[] parameterArray = (Class<?>[]) s.readObject();
-
-        // Probably this object will never escape, but let's check
-        // the field values now, just to be sure.
-        checkRtype(returnType);
-        checkPtypes(parameterArray);
-
-        parameterArray = parameterArray.clone();  // make sure it is unshared
-        MethodType_init(returnType, parameterArray);
-    }
-
-    /**
-     * For serialization only.
-     * Sets the final fields to null, pending {@code Unsafe.putObject}.
-     */
-    private MethodType() {
-        this.rtype = null;
-        this.ptypes = null;
-    }
-    private void MethodType_init(Class<?> rtype, Class<?>[] ptypes) {
-        // In order to communicate these values to readResolve, we must
-        // store them into the implementation-specific final fields.
-        checkRtype(rtype);
-        checkPtypes(ptypes);
-        unsafe.putObject(this, rtypeOffset, rtype);
-        unsafe.putObject(this, ptypesOffset, ptypes);
-    }
-
-    // Support for resetting final fields while deserializing
-    private static final sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
-    private static final long rtypeOffset, ptypesOffset;
-    static {
-        try {
-            rtypeOffset = unsafe.objectFieldOffset
-                (MethodType.class.getDeclaredField("rtype"));
-            ptypesOffset = unsafe.objectFieldOffset
-                (MethodType.class.getDeclaredField("ptypes"));
-        } catch (Exception ex) {
-            throw new Error(ex);
-        }
-    }
-
-    /**
-     * Resolves and initializes a {@code MethodType} object
-     * after serialization.
-     * @return the fully initialized {@code MethodType} object
-     */
-    private Object readResolve() {
-        // Do not use a trusted path for deserialization:
-        //return makeImpl(rtype, ptypes, true);
-        // Verify all operands, and make sure ptypes is unshared:
-        return methodType(rtype, ptypes);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/MethodTypeForm.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 java.dyn;
-
-/**
- * TO DO:  Temporary shim; remove after refactoring effects are complete in JVM.
- * @author John Rose
- */
-import sun.dyn.MethodTypeImpl;
-
-class MethodTypeForm extends MethodTypeImpl {
-
-    MethodTypeForm(MethodType erasedType) {
-        super(erasedType);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/MutableCallSite.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 java.dyn;
-
-import sun.dyn.*;
-import sun.dyn.empty.Empty;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * A {@code MutableCallSite} is a {@link CallSite} whose target variable
- * behaves like an ordinary field.
- * An {@code invokedynamic} instruction linked to a {@code MutableCallSite} delegates
- * all calls to the site's current target.
- * The {@linkplain CallSite#dynamicInvoker dynamic invoker} of a mutable call site
- * also delegates each call to the site's current target.
- * <p>
- * Here is an example of a mutable call site which introduces a
- * state variable into a method handle chain.
- * <blockquote><pre>
-MutableCallSite name = new MutableCallSite(MethodType.methodType(String.class));
-MethodHandle MH_name = name.dynamicInvoker();
-MethodType MT_str2 = MethodType.methodType(String.class, String.class);
-MethodHandle MH_upcase = MethodHandles.lookup()
-    .findVirtual(String.class, "toUpperCase", MT_str2);
-MethodHandle worker1 = MethodHandles.filterReturnValue(MH_name, MH_upcase);
-name.setTarget(MethodHandles.constant(String.class, "Rocky"));
-assertEquals("ROCKY", (String) worker1.invokeExact());
-name.setTarget(MethodHandles.constant(String.class, "Fred"));
-assertEquals("FRED", (String) worker1.invokeExact());
-// (mutation can be continued indefinitely)
- * </pre></blockquote>
- * <p>
- * The same call site may be used in several places at once.
- * <blockquote><pre>
-MethodHandle MH_dear = MethodHandles.lookup()
-    .findVirtual(String.class, "concat", MT_str2).bindTo(", dear?");
-MethodHandle worker2 = MethodHandles.filterReturnValue(MH_name, MH_dear);
-assertEquals("Fred, dear?", (String) worker2.invokeExact());
-name.setTarget(MethodHandles.constant(String.class, "Wilma"));
-assertEquals("WILMA", (String) worker1.invokeExact());
-assertEquals("Wilma, dear?", (String) worker2.invokeExact());
- * </pre></blockquote>
- * <p>
- * <em>Non-synchronization of target values:</em>
- * A write to a mutable call site's target does not force other threads
- * to become aware of the updated value.  Threads which do not perform
- * suitable synchronization actions relative to the updated call site
- * may cache the old target value and delay their use of the new target
- * value indefinitely.
- * (This is a normal consequence of the Java Memory Model as applied
- * to object fields.)
- * <p>
- * The {@link #syncAll syncAll} operation provides a way to force threads
- * to accept a new target value, even if there is no other synchronization.
- * <p>
- * For target values which will be frequently updated, consider using
- * a {@linkplain VolatileCallSite volatile call site} instead.
- * @author John Rose, JSR 292 EG
- */
-public class MutableCallSite extends CallSite {
-    /**
-     * Creates a blank call site object with the given method type.
-     * The initial target is set to a method handle of the given type
-     * which will throw an {@link IllegalStateException} if called.
-     * <p>
-     * The type of the call site is permanently set to the given type.
-     * <p>
-     * Before this {@code CallSite} object is returned from a bootstrap method,
-     * or invoked in some other manner,
-     * it is usually provided with a more useful target method,
-     * via a call to {@link CallSite#setTarget(MethodHandle) setTarget}.
-     * @param type the method type that this call site will have
-     * @throws NullPointerException if the proposed type is null
-     */
-    public MutableCallSite(MethodType type) {
-        super(type);
-    }
-
-    /**
-     * Creates a call site object with an initial target method handle.
-     * The type of the call site is permanently set to the initial target's type.
-     * @param target the method handle that will be the initial target of the call site
-     * @throws NullPointerException if the proposed target is null
-     */
-    public MutableCallSite(MethodHandle target) {
-        super(target);
-    }
-
-    /**
-     * Returns the target method of the call site, which behaves
-     * like a normal field of the {@code MutableCallSite}.
-     * <p>
-     * The interactions of {@code getTarget} with memory are the same
-     * as of a read from an ordinary variable, such as an array element or a
-     * non-volatile, non-final field.
-     * <p>
-     * In particular, the current thread may choose to reuse the result
-     * of a previous read of the target from memory, and may fail to see
-     * a recent update to the target by another thread.
-     *
-     * @return the linkage state of this call site, a method handle which can change over time
-     * @see #setTarget
-     */
-    @Override public final MethodHandle getTarget() {
-        return target;
-    }
-
-    /**
-     * Updates the target method of this call site, as a normal variable.
-     * The type of the new target must agree with the type of the old target.
-     * <p>
-     * The interactions with memory are the same
-     * as of a write to an ordinary variable, such as an array element or a
-     * non-volatile, non-final field.
-     * <p>
-     * In particular, unrelated threads may fail to see the updated target
-     * until they perform a read from memory.
-     * Stronger guarantees can be created by putting appropriate operations
-     * into the bootstrap method and/or the target methods used
-     * at any given call site.
-     *
-     * @param newTarget the new target
-     * @throws NullPointerException if the proposed new target is null
-     * @throws WrongMethodTypeException if the proposed new target
-     *         has a method type that differs from the previous target
-     * @see #getTarget
-     */
-    @Override public void setTarget(MethodHandle newTarget) {
-        checkTargetChange(this.target, newTarget);
-        setTargetNormal(newTarget);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public final MethodHandle dynamicInvoker() {
-        return makeDynamicInvoker();
-    }
-
-    /**
-     * Performs a synchronization operation on each call site in the given array,
-     * forcing all other threads to throw away any cached values previously
-     * loaded from the target of any of the call sites.
-     * <p>
-     * This operation does not reverse any calls that have already started
-     * on an old target value.
-     * (Java supports {@linkplain java.lang.Object#wait() forward time travel} only.)
-     * <p>
-     * The overall effect is to force all future readers of each call site's target
-     * to accept the most recently stored value.
-     * ("Most recently" is reckoned relative to the {@code syncAll} itself.)
-     * Conversely, the {@code syncAll} call may block until all readers have
-     * (somehow) decached all previous versions of each call site's target.
-     * <p>
-     * To avoid race conditions, calls to {@code setTarget} and {@code syncAll}
-     * should generally be performed under some sort of mutual exclusion.
-     * Note that reader threads may observe an updated target as early
-     * as the {@code setTarget} call that install the value
-     * (and before the {@code syncAll} that confirms the value).
-     * On the other hand, reader threads may observe previous versions of
-     * the target until the {@code syncAll} call returns
-     * (and after the {@code setTarget} that attempts to convey the updated version).
-     * <p>
-     * This operation is likely to be expensive and should be used sparingly.
-     * If possible, it should be buffered for batch processing on sets of call sites.
-     * <p>
-     * If {@code sites} contains a null element,
-     * a {@code NullPointerException} will be raised.
-     * In this case, some non-null elements in the array may be
-     * processed before the method returns abnormally.
-     * Which elements these are (if any) is implementation-dependent.
-     *
-     * <h3>Java Memory Model details</h3>
-     * In terms of the Java Memory Model, this operation performs a synchronization
-     * action which is comparable in effect to the writing of a volatile variable
-     * by the current thread, and an eventual volatile read by every other thread
-     * that may access one of the affected call sites.
-     * <p>
-     * The following effects are apparent, for each individual call site {@code S}:
-     * <ul>
-     * <li>A new volatile variable {@code V} is created, and written by the current thread.
-     *     As defined by the JMM, this write is a global synchronization event.
-     * <li>As is normal with thread-local ordering of write events,
-     *     every action already performed by the current thread is
-     *     taken to happen before the volatile write to {@code V}.
-     *     (In some implementations, this means that the current thread
-     *     performs a global release operation.)
-     * <li>Specifically, the write to the current target of {@code S} is
-     *     taken to happen before the volatile write to {@code V}.
-     * <li>The volatile write to {@code V} is placed
-     *     (in an implementation specific manner)
-     *     in the global synchronization order.
-     * <li>Consider an arbitrary thread {@code T} (other than the current thread).
-     *     If {@code T} executes a synchronization action {@code A}
-     *     after the volatile write to {@code V} (in the global synchronization order),
-     *     it is therefore required to see either the current target
-     *     of {@code S}, or a later write to that target,
-     *     if it executes a read on the target of {@code S}.
-     *     (This constraint is called "synchronization-order consistency".)
-     * <li>The JMM specifically allows optimizing compilers to elide
-     *     reads or writes of variables that are known to be useless.
-     *     Such elided reads and writes have no effect on the happens-before
-     *     relation.  Regardless of this fact, the volatile {@code V}
-     *     will not be elided, even though its written value is
-     *     indeterminate and its read value is not used.
-     * </ul>
-     * Because of the last point, the implementation behaves as if a
-     * volatile read of {@code V} were performed by {@code T}
-     * immediately after its action {@code A}.  In the local ordering
-     * of actions in {@code T}, this read happens before any future
-     * read of the target of {@code S}.  It is as if the
-     * implementation arbitrarily picked a read of {@code S}'s target
-     * by {@code T}, and forced a read of {@code V} to precede it,
-     * thereby ensuring communication of the new target value.
-     * <p>
-     * As long as the constraints of the Java Memory Model are obeyed,
-     * implementations may delay the completion of a {@code syncAll}
-     * operation while other threads ({@code T} above) continue to
-     * use previous values of {@code S}'s target.
-     * However, implementations are (as always) encouraged to avoid
-     * livelock, and to eventually require all threads to take account
-     * of the updated target.
-     *
-     * <p style="font-size:smaller;">
-     * <em>Discussion:</em>
-     * For performance reasons, {@code syncAll} is not a virtual method
-     * on a single call site, but rather applies to a set of call sites.
-     * Some implementations may incur a large fixed overhead cost
-     * for processing one or more synchronization operations,
-     * but a small incremental cost for each additional call site.
-     * In any case, this operation is likely to be costly, since
-     * other threads may have to be somehow interrupted
-     * in order to make them notice the updated target value.
-     * However, it may be observed that a single call to synchronize
-     * several sites has the same formal effect as many calls,
-     * each on just one of the sites.
-     *
-     * <p style="font-size:smaller;">
-     * <em>Implementation Note:</em>
-     * Simple implementations of {@code MutableCallSite} may use
-     * a volatile variable for the target of a mutable call site.
-     * In such an implementation, the {@code syncAll} method can be a no-op,
-     * and yet it will conform to the JMM behavior documented above.
-     *
-     * @param sites an array of call sites to be synchronized
-     * @throws NullPointerException if the {@code sites} array reference is null
-     *                              or the array contains a null
-     */
-    public static void syncAll(MutableCallSite[] sites) {
-        if (sites.length == 0)  return;
-        STORE_BARRIER.lazySet(0);
-        for (int i = 0; i < sites.length; i++) {
-            sites[i].getClass();  // trigger NPE on first null
-        }
-        // FIXME: NYI
-    }
-    private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
-}
--- a/jdk/src/share/classes/java/dyn/SwitchPoint.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, 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 java.dyn;
-
-/**
- * <p>
- * A {@code SwitchPoint} is an object which can publish state transitions to other threads.
- * A switch point is initially in the <em>valid</em> state, but may at any time be
- * changed to the <em>invalid</em> state.  Invalidation cannot be reversed.
- * A switch point can combine a <em>guarded pair</em> of method handles into a
- * <em>guarded delegator</em>.
- * The guarded delegator is a method handle which delegates to one of the old method handles.
- * The state of the switch point determines which of the two gets the delegation.
- * <p>
- * A single switch point may be used to control any number of method handles.
- * (Indirectly, therefore, it can control any number of call sites.)
- * This is done by using the single switch point as a factory for combining
- * any number of guarded method handle pairs into guarded delegators.
- * <p>
- * When a guarded delegator is created from a guarded pair, the pair
- * is wrapped in a new method handle {@code M},
- * which is permanently associated with the switch point that created it.
- * Each pair consists of a target {@code T} and a fallback {@code F}.
- * While the switch point is valid, invocations to {@code M} are delegated to {@code T}.
- * After it is invalidated, invocations are delegated to {@code F}.
- * <p>
- * Invalidation is global and immediate, as if the switch point contained a
- * volatile boolean variable consulted on every call to {@code M}.
- * The invalidation is also permanent, which means the switch point
- * can change state only once.
- * The switch point will always delegate to {@code F} after being invalidated.
- * At that point {@code guardWithTest} may ignore {@code T} and return {@code F}.
- * <p>
- * Here is an example of a switch point in action:
- * <blockquote><pre>
-MethodType MT_str2 = MethodType.methodType(String.class, String.class);
-MethodHandle MH_strcat = MethodHandles.lookup()
-    .findVirtual(String.class, "concat", MT_str2);
-SwitchPoint spt = new SwitchPoint();
-// the following steps may be repeated to re-use the same switch point:
-MethodHandle worker1 = strcat;
-MethodHandle worker2 = MethodHandles.permuteArguments(strcat, MT_str2, 1, 0);
-MethodHandle worker = spt.guardWithTest(worker1, worker2);
-assertEquals("method", (String) worker.invokeExact("met", "hod"));
-SwitchPoint.invalidateAll(new SwitchPoint[]{ spt });
-assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
- * </pre></blockquote>
- * <p style="font-size:smaller;">
- * <em>Discussion:</em>
- * Switch points are useful without subclassing.  They may also be subclassed.
- * This may be useful in order to associate application-specific invalidation logic
- * with the switch point.
- * <p style="font-size:smaller;">
- * <em>Implementation Note:</em>
- * A switch point behaves as if implemented on top of {@link MutableCallSite},
- * approximately as follows:
- * <blockquote><pre>
-public class SwitchPoint {
-  private static final MethodHandle
-    K_true  = MethodHandles.constant(boolean.class, true),
-    K_false = MethodHandles.constant(boolean.class, false);
-  private final MutableCallSite mcs;
-  private final MethodHandle mcsInvoker;
-  public SwitchPoint() {
-    this.mcs = new MutableCallSite(K_true);
-    this.mcsInvoker = mcs.dynamicInvoker();
-  }
-  public MethodHandle guardWithTest(
-                MethodHandle target, MethodHandle fallback) {
-    // Note:  mcsInvoker is of type ()boolean.
-    // Target and fallback may take any arguments, but must have the same type.
-    return MethodHandles.guardWithTest(this.mcsInvoker, target, fallback);
-  }
-  public static void invalidateAll(SwitchPoint[] spts) {
-    List&lt;MutableCallSite&gt; mcss = new ArrayList&lt;&gt;();
-    for (SwitchPoint spt : spts)  mcss.add(spt.mcs);
-    for (MutableCallSite mcs : mcss)  mcs.setTarget(K_false);
-    MutableCallSite.syncAll(mcss.toArray(new MutableCallSite[0]));
-  }
-}
- * </pre></blockquote>
- * @author Remi Forax, JSR 292 EG
- */
-public class SwitchPoint {
-    private static final MethodHandle
-        K_true  = MethodHandles.constant(boolean.class, true),
-        K_false = MethodHandles.constant(boolean.class, false);
-
-    private final MutableCallSite mcs;
-    private final MethodHandle mcsInvoker;
-
-    /**
-     * Creates a new switch point.
-     */
-    public SwitchPoint() {
-        this.mcs = new MutableCallSite(K_true);
-        this.mcsInvoker = mcs.dynamicInvoker();
-    }
-
-    /**
-     * Returns a method handle which always delegates either to the target or the fallback.
-     * The method handle will delegate to the target exactly as long as the switch point is valid.
-     * After that, it will permanently delegate to the fallback.
-     * <p>
-     * The target and fallback must be of exactly the same method type,
-     * and the resulting combined method handle will also be of this type.
-     *
-     * @param target the method handle selected by the switch point as long as it is valid
-     * @param fallback the method handle selected by the switch point after it is invalidated
-     * @return a combined method handle which always calls either the target or fallback
-     * @throws NullPointerException if either argument is null
-     * @see MethodHandles#guardWithTest
-     */
-    public MethodHandle guardWithTest(MethodHandle target, MethodHandle fallback) {
-        if (mcs.getTarget() == K_false)
-            return fallback;  // already invalid
-        return MethodHandles.guardWithTest(mcsInvoker, target, fallback);
-    }
-
-    /**
-     * Sets all of the given switch points into the invalid state.
-     * After this call executes, no thread will observe any of the
-     * switch points to be in a valid state.
-     * <p>
-     * This operation is likely to be expensive and should be used sparingly.
-     * If possible, it should be buffered for batch processing on sets of switch points.
-     * <p>
-     * If {@code switchPoints} contains a null element,
-     * a {@code NullPointerException} will be raised.
-     * In this case, some non-null elements in the array may be
-     * processed before the method returns abnormally.
-     * Which elements these are (if any) is implementation-dependent.
-     *
-     * <p style="font-size:smaller;">
-     * <em>Discussion:</em>
-     * For performance reasons, {@code invalidateAll} is not a virtual method
-     * on a single switch point, but rather applies to a set of switch points.
-     * Some implementations may incur a large fixed overhead cost
-     * for processing one or more invalidation operations,
-     * but a small incremental cost for each additional invalidation.
-     * In any case, this operation is likely to be costly, since
-     * other threads may have to be somehow interrupted
-     * in order to make them notice the updated switch point state.
-     * However, it may be observed that a single call to invalidate
-     * several switch points has the same formal effect as many calls,
-     * each on just one of the switch points.
-     *
-     * <p style="font-size:smaller;">
-     * <em>Implementation Note:</em>
-     * Simple implementations of {@code SwitchPoint} may use
-     * a private {@link MutableCallSite} to publish the state of a switch point.
-     * In such an implementation, the {@code invalidateAll} method can
-     * simply change the call site's target, and issue one call to
-     * {@linkplain MutableCallSite#syncAll synchronize} all the
-     * private call sites.
-     *
-     * @param switchPoints an array of call sites to be synchronized
-     * @throws NullPointerException if the {@code switchPoints} array reference is null
-     *                              or the array contains a null
-     */
-    public static void invalidateAll(SwitchPoint[] switchPoints) {
-        if (switchPoints.length == 0)  return;
-        MutableCallSite[] sites = new MutableCallSite[switchPoints.length];
-        for (int i = 0; i < switchPoints.length; i++) {
-            SwitchPoint spt = switchPoints[i];
-            if (spt == null)  break;  // MSC.syncAll will trigger a NPE
-            sites[i] = spt.mcs;
-            spt.mcs.setTarget(K_false);
-        }
-        MutableCallSite.syncAll(sites);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/VolatileCallSite.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, 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 java.dyn;
-
-import java.util.List;
-
-/**
- * A {@code VolatileCallSite} is a {@link CallSite} whose target acts like a volatile variable.
- * An {@code invokedynamic} instruction linked to a {@code VolatileCallSite} sees updates
- * to its call site target immediately, even if the update occurs in another thread.
- * There may be a performance penalty for such tight coupling between threads.
- * <p>
- * Unlike {@code MutableCallSite}, there is no
- * {@linkplain MutableCallSite#syncAll syncAll operation} on volatile
- * call sites, since every write to a volatile variable is implicitly
- * synchronized with reader threads.
- * <p>
- * In other respects, a {@code VolatileCallSite} is interchangeable
- * with {@code MutableCallSite}.
- * @see MutableCallSite
- * @author John Rose, JSR 292 EG
- */
-public class VolatileCallSite extends CallSite {
-    /**
-     * Creates a call site with a volatile binding to its target.
-     * The initial target is set to a method handle
-     * of the given type which will throw an {@code IllegalStateException} if called.
-     * @param type the method type that this call site will have
-     * @throws NullPointerException if the proposed type is null
-     */
-    public VolatileCallSite(MethodType type) {
-        super(type);
-    }
-
-    /**
-     * Creates a call site with a volatile binding to its target.
-     * The target is set to the given value.
-     * @param target the method handle that will be the initial target of the call site
-     * @throws NullPointerException if the proposed target is null
-     */
-    public VolatileCallSite(MethodHandle target) {
-        super(target);
-    }
-
-    /**
-     * Returns the target method of the call site, which behaves
-     * like a {@code volatile} field of the {@code VolatileCallSite}.
-     * <p>
-     * The interactions of {@code getTarget} with memory are the same
-     * as of a read from a {@code volatile} field.
-     * <p>
-     * In particular, the current thread is required to issue a fresh
-     * read of the target from memory, and must not fail to see
-     * a recent update to the target by another thread.
-     *
-     * @return the linkage state of this call site, a method handle which can change over time
-     * @see #setTarget
-     */
-    @Override public final MethodHandle getTarget() {
-        return getTargetVolatile();
-    }
-
-    /**
-     * Updates the target method of this call site, as a volatile variable.
-     * The type of the new target must agree with the type of the old target.
-     * <p>
-     * The interactions with memory are the same as of a write to a volatile field.
-     * In particular, any threads is guaranteed to see the updated target
-     * the next time it calls {@code getTarget}.
-     * @param newTarget the new target
-     * @throws NullPointerException if the proposed new target is null
-     * @throws WrongMethodTypeException if the proposed new target
-     *         has a method type that differs from the previous target
-     * @see #getTarget
-     */
-    @Override public void setTarget(MethodHandle newTarget) {
-        checkTargetChange(getTargetVolatile(), newTarget);
-        setTargetVolatile(newTarget);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public final MethodHandle dynamicInvoker() {
-        return makeDynamicInvoker();
-    }
-}
--- a/jdk/src/share/classes/java/dyn/WrongMethodTypeException.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 java.dyn;
-
-/**
- * Thrown to indicate that code has attempted to call a method handle
- * via the wrong method type.  As with the bytecode representation of
- * normal Java method calls, method handle calls are strongly typed
- * to a specific type descriptor associated with a call site.
- * <p>
- * This exception may also be thrown when two method handles are
- * composed, and the system detects that their types cannot be
- * matched up correctly.  This amounts to an early evaluation
- * of the type mismatch, at method handle construction time,
- * instead of when the mismatched method handle is called.
- *
- * @author John Rose, JSR 292 EG
- * @since 1.7
- */
-public class WrongMethodTypeException extends RuntimeException {
-    private static final long serialVersionUID = 292L;
-
-    /**
-     * Constructs a {@code WrongMethodTypeException} with no detail message.
-     */
-    public WrongMethodTypeException() {
-        super();
-    }
-
-    /**
-     * Constructs a {@code WrongMethodTypeException} with the specified
-     * detail message.
-     *
-     * @param s the detail message.
-     */
-    public WrongMethodTypeException(String s) {
-        super(s);
-    }
-}
--- a/jdk/src/share/classes/java/dyn/package-info.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,478 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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.
- */
-
-/**
- * The {@code java.lang.invoke} package contains dynamic language support provided directly by
- * the Java core class libraries and virtual machine.
- *
- * <p style="font-size:smaller;">
- * <em>Historic Note:</em> In some early versions of Java SE 7,
- * the name of this package is {@code java.dyn}.
- * <p>
- * Certain types in this package have special relations to dynamic
- * language support in the virtual machine:
- * <ul>
- * <li>The class {@link java.dyn.MethodHandle MethodHandle} contains
- * <a href="MethodHandle.html#sigpoly">signature polymorphic methods</a>
- * which can be linked regardless of their type descriptor.
- * Normally, method linkage requires exact matching of type descriptors.
- * </li>
- *
- * <li>The JVM bytecode format supports immediate constants of
- * the classes {@link java.dyn.MethodHandle MethodHandle} and {@link java.dyn.MethodType MethodType}.
- * </li>
- * </ul>
- *
- * <h2><a name="jvm_mods"></a>Corresponding JVM bytecode format changes</h2>
- * <em>The following low-level information is presented here as a preview of
- * changes being made to the Java Virtual Machine specification for JSR 292.
- * This information will be incorporated in a future version of the JVM specification.</em>
- *
- * <h3><a name="indyinsn"></a>{@code invokedynamic} instruction format</h3>
- * In bytecode, an {@code invokedynamic} instruction is formatted as five bytes.
- * The first byte is the opcode 186 (hexadecimal {@code BA}).
- * The next two bytes are a constant pool index (in the same format as for the other {@code invoke} instructions).
- * The final two bytes are reserved for future use and required to be zero.
- * The constant pool reference of an {@code invokedynamic} instruction is to a entry
- * with tag {@code CONSTANT_InvokeDynamic} (decimal 18).  See below for its format.
- * The entry specifies the following information:
- * <ul>
- * <li>a bootstrap method (a {@link java.dyn.MethodHandle MethodHandle} constant)</li>
- * <li>the dynamic invocation name (a UTF8 string)</li>
- * <li>the argument and return types of the call (encoded as a type descriptor in a UTF8 string)</li>
- * <li>optionally, a sequence of additional <em>static arguments</em> to the bootstrap method ({@code ldc}-type constants)</li>
- * </ul>
- * <p>
- * Each instance of an {@code invokedynamic} instruction is called a <em>dynamic call site</em>.
- * Multiple instances of an {@code invokedynamic} instruction can share a single
- * {@code CONSTANT_InvokeDynamic} entry.
- * In any case, distinct call sites always have distinct linkage state.
- * <p>
- * A dynamic call site is originally in an unlinked state.  In this state, there is
- * no target method for the call site to invoke.
- * A dynamic call site is linked by means of a bootstrap method,
- * as <a href="#bsm">described below</a>.
- *
- * <p style="font-size:smaller;">
- * <em>Historic Note:</em> Some older JVMs may allow the index of a {@code CONSTANT_NameAndType}
- * instead of a {@code CONSTANT_InvokeDynamic}.  In earlier, obsolete versions of this API, the
- * bootstrap method was specified dynamically, in a per-class basis, during class initialization.
- *
- * <h3><a name="indycon"></a>constant pool entries for {@code invokedynamic} instructions</h3>
- * If a constant pool entry has the tag {@code CONSTANT_InvokeDynamic} (decimal 18),
- * it must contain exactly four more bytes after the tag.
- * These bytes are interpreted as two 16-bit indexes, in the usual {@code u2} format.
- * The first pair of bytes after the tag must be an index into a side table called the
- * <em>bootstrap method table</em>, which is stored in the {@code BootstrapMethods}
- * attribute as <a href="#bsmattr">described below</a>.
- * The second pair of bytes must be an index to a {@code CONSTANT_NameAndType}.
- * <p>
- * The first index specifies a bootstrap method used by the associated dynamic call sites.
- * The second index specifies the method name, argument types, and return type of the dynamic call site.
- * The structure of such an entry is therefore analogous to a {@code CONSTANT_Methodref},
- * except that the bootstrap method specifier reference replaces
- * the {@code CONSTANT_Class} reference of a {@code CONSTANT_Methodref} entry.
- *
- * <h3><a name="mtcon"></a>constant pool entries for {@linkplain java.dyn.MethodType method types}</h3>
- * If a constant pool entry has the tag {@code CONSTANT_MethodType} (decimal 16),
- * it must contain exactly two more bytes, which must be an index to a {@code CONSTANT_Utf8}
- * entry which represents a method type descriptor.
- * <p>
- * The JVM will ensure that on first
- * execution of an {@code ldc} instruction for this entry, a {@link java.dyn.MethodType MethodType}
- * will be created which represents the type descriptor.
- * Any classes mentioned in the {@code MethodType} will be loaded if necessary,
- * but not initialized.
- * Access checking and error reporting is performed exactly as it is for
- * references by {@code ldc} instructions to {@code CONSTANT_Class} constants.
- *
- * <h3><a name="mhcon"></a>constant pool entries for {@linkplain java.dyn.MethodHandle method handles}</h3>
- * If a constant pool entry has the tag {@code CONSTANT_MethodHandle} (decimal 15),
- * it must contain exactly three more bytes.  The first byte after the tag is a subtag
- * value which must be in the range 1 through 9, and the last two must be an index to a
- * {@code CONSTANT_Fieldref}, {@code CONSTANT_Methodref}, or
- * {@code CONSTANT_InterfaceMethodref} entry which represents a field or method
- * for which a method handle is to be created.
- * Furthermore, the subtag value and the type of the constant index value
- * must agree according to the table below.
- * <p>
- * The JVM will ensure that on first execution of an {@code ldc} instruction
- * for this entry, a {@link java.dyn.MethodHandle MethodHandle} will be created which represents
- * the field or method reference, according to the specific mode implied by the subtag.
- * <p>
- * As with {@code CONSTANT_Class} and {@code CONSTANT_MethodType} constants,
- * the {@code Class} or {@code MethodType} object which reifies the field or method's
- * type is created.  Any classes mentioned in this reification will be loaded if necessary,
- * but not initialized, and access checking and error reporting performed as usual.
- * <p>
- * Unlike the reflective {@code Lookup} API, there are no security manager calls made
- * when these constants are resolved.
- * <p>
- * The method handle itself will have a type and behavior determined by the subtag as follows:
- * <code>
- * <table border=1 cellpadding=5 summary="CONSTANT_MethodHandle subtypes">
- * <tr><th>N</th><th>subtag name</th><th>member</th><th>MH type</th><th>bytecode behavior</th><th>lookup expression</th></tr>
- * <tr><td>1</td><td>REF_getField</td><td>C.f:T</td><td>(C)T</td><td>getfield C.f:T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findGetter findGetter(C.class,"f",T.class)}</td></tr>
- * <tr><td>2</td><td>REF_getStatic</td><td>C.f:T</td><td>(&nbsp;)T</td><td>getstatic C.f:T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findStaticGetter findStaticGetter(C.class,"f",T.class)}</td></tr>
- * <tr><td>3</td><td>REF_putField</td><td>C.f:T</td><td>(C,T)void</td><td>putfield C.f:T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findSetter findSetter(C.class,"f",T.class)}</td></tr>
- * <tr><td>4</td><td>REF_putStatic</td><td>C.f:T</td><td>(T)void</td><td>putstatic C.f:T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findStaticSetter findStaticSetter(C.class,"f",T.class)}</td></tr>
- * <tr><td>5</td><td>REF_invokeVirtual</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokevirtual C.m(A*)T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findVirtual findVirtual(C.class,"m",MT)}</td></tr>
- * <tr><td>6</td><td>REF_invokeStatic</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokestatic C.m(A*)T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findStatic findStatic(C.class,"m",MT)}</td></tr>
- * <tr><td>7</td><td>REF_invokeSpecial</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokespecial C.m(A*)T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findSpecial findSpecial(C.class,"m",MT,this.class)}</td></tr>
- * <tr><td>8</td><td>REF_newInvokeSpecial</td><td>C.&lt;init&gt;(A*)void</td><td>(A*)C</td><td>new C; dup; invokespecial C.&lt;init&gt;(A*)void</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findConstructor findConstructor(C.class,MT)}</td></tr>
- * <tr><td>9</td><td>REF_invokeInterface</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokeinterface C.m(A*)T</td>
- *               <td>{@linkplain java.dyn.MethodHandles.Lookup#findVirtual findVirtual(C.class,"m",MT)}</td></tr>
- * </table>
- * </code>
- * Here, the type {@code C} is taken from the {@code CONSTANT_Class} reference associated
- * with the {@code CONSTANT_NameAndType} descriptor.
- * The field name {@code f} or method name {@code m} is taken from the {@code CONSTANT_NameAndType}
- * as is the result type {@code T} and (in the case of a method or constructor) the argument type sequence
- * {@code A*}.
- * <p>
- * Each method handle constant has an equivalent instruction sequence called its <em>bytecode behavior</em>.
- * In general, creating a method handle constant can be done in exactly the same circumstances that
- * the JVM would successfully resolve the symbolic references in the bytecode behavior.
- * Also, the type of a method handle constant is such that a valid {@code invokeExact} call
- * on the method handle has exactly the same JVM stack effects as the <em>bytecode behavior</em>.
- * Finally, calling a method handle constant on a valid set of arguments has exactly the same effect
- * and returns the same result (if any) as the corresponding <em>bytecode behavior</em>.
- * <p>
- * Each method handle constant also has an equivalent reflective <em>lookup expression</em>,
- * which is a query to a method in {@link java.dyn.MethodHandles.Lookup}.
- * In the example lookup method expression given in the table above, the name {@code MT}
- * stands for a {@code MethodType} built from {@code T} and the sequence of argument types {@code A*}.
- * (Note that the type {@code C} is not prepended to the query type {@code MT} even if the member is non-static.)
- * In the case of {@code findSpecial}, the name {@code this.class} refers to the class containing
- * the bytecodes.
- * <p>
- * The special name {@code <clinit>} is not allowed.
- * The special name {@code <init>} is not allowed except for subtag 8 as shown.
- * <p>
- * The JVM verifier and linker apply the same access checks and restrictions for these references as for the hypothetical
- * bytecode instructions specified in the last column of the table.
- * A method handle constant will successfully resolve to a method handle if the symbolic references
- * of the corresponding bytecode instruction(s) would also resolve successfully.
- * Otherwise, an attempt to resolve the constant will throw equivalent linkage errors.
- * In particular, method handles to
- * private and protected members can be created in exactly those classes for which the corresponding
- * normal accesses are legal.
- * <p>
- * A constant may refer to a method or constructor with the {@code varargs}
- * bit (hexadecimal {@code 0x0080}) set in its modifier bitmask.
- * The method handle constant produced for such a method behaves as if
- * it were created by {@link java.dyn.MethodHandle#asVarargsCollector asVarargsCollector}.
- * In other words, the constant method handle will exhibit variable arity,
- * when invoked via {@code invokeGeneric}.
- * On the other hand, its behavior with respect to {@code invokeExact} will be the same
- * as if the {@code varargs} bit were not set.
- * <p>
- * Although the {@code CONSTANT_MethodHandle} and {@code CONSTANT_MethodType} constant types
- * resolve class names, they do not force class initialization.
- * Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic}
- * may force class initialization on their first invocation, just like the corresponding bytecodes.
- * <p>
- * The rules of section 5.4.3 of the
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73492">JVM Specification</a>
- * apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle},
- * and {@code CONSTANT_InvokeDynamic} constants,
- * by the execution of {@code invokedynamic} and {@code ldc} instructions.
- * (Roughly speaking, this means that every use of a constant pool entry
- * must lead to the same outcome.
- * If the resolution succeeds, the same object reference is produced
- * by every subsequent execution of the same instruction.
- * If the resolution of the constant causes an error to occur,
- * the same error will be re-thrown on every subsequent attempt
- * to use this particular constant.)
- * <p>
- * Constants created by the resolution of these constant pool types are not necessarily
- * interned.  Except for {@code CONSTANT_Class} and {@code CONSTANT_String} entries,
- * two distinct constant pool entries might not resolve to the same reference
- * even if they contain the same symbolic reference.
- *
- * <h2><a name="bsm"></a>Bootstrap Methods</h2>
- * Before the JVM can execute a dynamic call site (an {@code invokedynamic} instruction),
- * the call site must first be <em>linked</em>.
- * Linking is accomplished by calling a <em>bootstrap method</em>
- * which is given the static information content of the call site,
- * and which must produce a {@link java.dyn.MethodHandle method handle}
- * that gives the behavior of the call site.
- * <p>
- * Each {@code invokedynamic} instruction statically specifies its own
- * bootstrap method as a constant pool reference.
- * The constant pool reference also specifies the call site's name and type descriptor,
- * just like {@code invokevirtual} and the other invoke instructions.
- * <p>
- * Linking starts with resolving the constant pool entry for the
- * bootstrap method, and resolving a {@link java.dyn.MethodType MethodType} object for
- * the type descriptor of the dynamic call site.
- * This resolution process may trigger class loading.
- * It may therefore throw an error if a class fails to load.
- * This error becomes the abnormal termination of the dynamic
- * call site execution.
- * Linkage does not trigger class initialization.
- * <p>
- * Next, the bootstrap method call is started, with at least four values being stacked:
- * <ul>
- * <li>a {@code MethodHandle}, the resolved bootstrap method itself </li>
- * <li>a {@code MethodHandles.Lookup}, a lookup object on the <em>caller class</em> in which dynamic call site occurs </li>
- * <li>a {@code String}, the method name mentioned in the call site </li>
- * <li>a {@code MethodType}, the resolved type descriptor of the call </li>
- * <li>optionally, one or more <a href="#args">additional static arguments</a> </li>
- * </ul>
- * The method handle is then applied to the other values as if by
- * {@link java.dyn.MethodHandle#invokeGeneric invokeGeneric}.
- * The returned result must be a {@link java.dyn.CallSite CallSite} (or a subclass).
- * The type of the call site's target must be exactly equal to the type
- * derived from the dynamic call site's type descriptor and passed to
- * the bootstrap method.
- * The call site then becomes permanently linked to the dynamic call site.
- * <p>
- * As long as each bootstrap method can be correctly invoked
- * by <code>invokeGeneric</code>, its detailed type is arbitrary.
- * For example, the first argument could be {@code Object}
- * instead of {@code MethodHandles.Lookup}, and the return type
- * could also be {@code Object} instead of {@code CallSite}.
- * <p>
- * As with any method handle constant, a {@code varargs} modifier bit
- * on the bootstrap method is ignored.
- * <p>
- * Note that the first argument of the bootstrap method cannot be
- * a simple {@code Class} reference.  (This is a change from earlier
- * versions of this specification.  If the caller class is needed,
- * it is easy to {@linkplain java.dyn.MethodHandles.Lookup#lookupClass() extract it}
- * from the {@code Lookup} object.)
- * <p>
- * After resolution, the linkage process may fail in a variety of ways.
- * All failures are reported by an {@link java.dyn.InvokeDynamicBootstrapError InvokeDynamicBootstrapError},
- * which is thrown as the abnormal termination of the dynamic call
- * site execution.
- * The following circumstances will cause this:
- * <ul>
- * <li>the index to the bootstrap method specifier is out of range </li>
- * <li>the bootstrap method cannot be resolved </li>
- * <li>the {@code MethodType} to pass to the bootstrap method cannot be resolved </li>
- * <li>a static argument to the bootstrap method cannot be resolved
- *     (i.e., a {@code CONSTANT_Class}, {@code CONSTANT_MethodType},
- *     or {@code CONSTANT_MethodHandle} argument cannot be linked) </li>
- * <li>the bootstrap method has the wrong arity,
- *     causing {@code invokeGeneric} to throw {@code WrongMethodTypeException} </li>
- * <li>the bootstrap method has a wrong argument or return type </li>
- * <li>the bootstrap method invocation completes abnormally </li>
- * <li>the result from the bootstrap invocation is not a reference to
- *     an object of type {@link java.dyn.CallSite CallSite} </li>
- * <li>the target of the {@code CallSite} does not have a target of
- *     the expected {@code MethodType} </li>
- * </ul>
- *
- * <h3><a name="linktime"></a>timing of linkage</h3>
- * A dynamic call site is linked just before its first execution.
- * The bootstrap method call implementing the linkage occurs within
- * a thread that is attempting a first execution.
- * <p>
- * If there are several such threads, the bootstrap method may be
- * invoked in several threads concurrently.
- * Therefore, bootstrap methods which access global application
- * data must take the usual precautions against race conditions.
- * In any case, every {@code invokedynamic} instruction is either
- * unlinked or linked to a unique {@code CallSite} object.
- * <p>
- * In an application which requires dynamic call sites with individually
- * mutable behaviors, their bootstrap methods should produce distinct
- * {@link java.dyn.CallSite CallSite} objects, one for each linkage request.
- * Alternatively, an application can link a single {@code CallSite} object
- * to several {@code invokedynamic} instructions, in which case
- * a change to the target method will become visible at each of
- * the instructions.
- * <p>
- * If several threads simultaneously execute a bootstrap method for a single dynamic
- * call site, the JVM must choose one {@code CallSite} object and install it visibly to
- * all threads.  Any other bootstrap method calls are allowed to complete, but their
- * results are ignored, and their dynamic call site invocations proceed with the originally
- * chosen target object.
- *
- * <p style="font-size:smaller;">
- * <em>Historic Note:</em> Unlike some previous versions of this specification,
- * these rules do not enable the JVM to duplicate dynamic call sites,
- * or to issue &ldquo;causeless&rdquo; bootstrap method calls.
- * Every dynamic call site transitions at most once from unlinked to linked,
- * just before its first invocation.
- *
- * <h3><a name="bsmattr">the {@code BootstrapMethods} attribute </h3>
- * Each {@code CONSTANT_InvokeDynamic} entry contains an index which references
- * a bootstrap method specifier; all such specifiers are contained in a separate array.
- * This array is defined by a class attribute named {@code BootstrapMethods}.
- * The body of this attribute consists of a sequence of byte pairs, all interpreted as
- * as 16-bit counts or constant pool indexes, in the {@code u2} format.
- * The attribute body starts with a count of bootstrap method specifiers,
- * which is immediately followed by the sequence of specifiers.
- * <p>
- * Each bootstrap method specifier contains an index to a
- * {@code CONSTANT_MethodHandle} constant, which is the bootstrap
- * method itself.
- * This is followed by a count, and then a sequence (perhaps empty) of
- * indexes to <a href="#args">additional static arguments</a>
- * for the bootstrap method.
- * <p>
- * During class loading, the verifier must check the structure of the
- * {@code BootstrapMethods} attribute.  In particular, each constant
- * pool index must be of the correct type.  A bootstrap method index
- * must refer to a {@code CONSTANT_MethodHandle} (tag 15).
- * Every other index must refer to a valid operand of an
- * {@code ldc_w} or {@code ldc2_w} instruction (tag 3..8 or 15..16).
- *
- * <h3><a name="args">static arguments to the bootstrap method</h3>
- * An {@code invokedynamic} instruction specifies at least three arguments
- * to pass to its bootstrap method:
- * The caller class (expressed as a {@link java.dyn.MethodHandles.Lookup Lookup object},
- * the name (extracted from the {@code CONSTANT_NameAndType} entry),
- * and the type (also extracted from the {@code CONSTANT_NameAndType} entry).
- * The {@code invokedynamic} instruction may specify additional metadata values
- * to pass to its bootstrap method.
- * Collectively, these values are called <em>static arguments</em> to the
- * {@code invokedynamic} instruction, because they are used once at link
- * time to determine the instruction's behavior on subsequent sets of
- * <em>dynamic arguments</em>.
- * <p>
- * Static arguments are used to communicate application-specific meta-data
- * to the bootstrap method.
- * Drawn from the constant pool, they may include references to classes, method handles,
- * strings, or numeric data that may be relevant to the task of linking that particular call site.
- * <p>
- * Static arguments are specified constant pool indexes stored in the {@code BootstrapMethods} attribute.
- * Before the bootstrap method is invoked, each index is used to compute an {@code Object}
- * reference to the indexed value in the constant pool.
- * The valid constant pool entries are listed in this table:
- * <code>
- * <table border=1 cellpadding=5 summary="Static argument types">
- * <tr><th>entry type</th><th>argument type</th><th>argument value</th></tr>
- * <tr><td>CONSTANT_String</td><td><code>java.lang.String</code></td><td>the indexed string literal</td></tr>
- * <tr><td>CONSTANT_Class</td><td><code>java.lang.Class</code></td><td>the indexed class, resolved</td></tr>
- * <tr><td>CONSTANT_Integer</td><td><code>java.lang.Integer</code></td><td>the indexed int value</td></tr>
- * <tr><td>CONSTANT_Long</td><td><code>java.lang.Long</code></td><td>the indexed long value</td></tr>
- * <tr><td>CONSTANT_Float</td><td><code>java.lang.Float</code></td><td>the indexed float value</td></tr>
- * <tr><td>CONSTANT_Double</td><td><code>java.lang.Double</code></td><td>the indexed double value</td></tr>
- * <tr><td>CONSTANT_MethodHandle</td><td><code>java.dyn.MethodHandle</code></td><td>the indexed method handle constant</td></tr>
- * <tr><td>CONSTANT_MethodType</td><td><code>java.dyn.MethodType</code></td><td>the indexed method type constant</td></tr>
- * </table>
- * </code>
- * <p>
- * If a given {@code invokedynamic} instruction specifies no static arguments,
- * the instruction's bootstrap method will be invoked on three arguments,
- * conveying the instruction's caller class, name, and method type.
- * If the {@code invokedynamic} instruction specifies one or more static arguments,
- * those values will be passed as additional arguments to the method handle.
- * (Note that because there is a limit of 255 arguments to any method,
- * at most 252 extra arguments can be supplied.)
- * The bootstrap method will be invoked as if by either {@code invokeGeneric}
- * or {@code invokeWithArguments}.  (There is no way to tell the difference.)
- * <p>
- * The normal argument conversion rules for {@code invokeGeneric} apply to all stacked arguments.
- * For example, if a pushed value is a primitive type, it may be converted to a reference by boxing conversion.
- * If the bootstrap method is a variable arity method (its modifier bit {@code 0x0080} is set),
- * then some or all of the arguments specified here may be collected into a trailing array parameter.
- * (This is not a special rule, but rather a useful consequence of the interaction
- * between {@code CONSTANT_MethodHandle} constants, the modifier bit for variable arity methods,
- * and the {@code java.dyn.MethodHandle#asVarargsCollector asVarargsCollector} transformation.)
- * <p>
- * Given these rules, here are examples of legal bootstrap method declarations,
- * given various numbers {@code N} of extra arguments.
- * The first rows (marked {@code *}) will work for any number of extra arguments.
- * <code>
- * <table border=1 cellpadding=5 summary="Static argument types">
- * <tr><th>N</th><th>sample bootstrap method</th></tr>
- * <tr><td>*</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code></td></tr>
- * <tr><td>*</td><td><code>CallSite bootstrap(Object... args)</code></td></tr>
- * <tr><td>*</td><td><code>CallSite bootstrap(Object caller, Object... nameAndTypeWithArgs)</code></td></tr>
- * <tr><td>0</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type)</code></td></tr>
- * <tr><td>0</td><td><code>CallSite bootstrap(Lookup caller, Object... nameAndType)</code></td></tr>
- * <tr><td>1</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object arg)</code></td></tr>
- * <tr><td>2</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code></td></tr>
- * <tr><td>2</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String... args)</code></td></tr>
- * <tr><td>2</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String x, int y)</code></td></tr>
- * </table>
- * </code>
- * The last example assumes that the extra arguments are of type
- * {@code CONSTANT_String} and {@code CONSTANT_Integer}, respectively.
- * The second-to-last example assumes that all extra arguments are of type
- * {@code CONSTANT_String}.
- * The other examples work with all types of extra arguments.
- * <p>
- * As noted above, the actual method type of the bootstrap method can vary.
- * For example, the fourth argument could be {@code MethodHandle},
- * if that is the type of the corresponding constant in
- * the {@code CONSTANT_InvokeDynamic} entry.
- * In that case, the {@code invokeGeneric} call will pass the extra method handle
- * constant as an {@code Object}, but the type matching machinery of {@code invokeGeneric}
- * will cast the reference back to {@code MethodHandle} before invoking the bootstrap method.
- * (If a string constant were passed instead, by badly generated code, that cast would then fail,
- * resulting in an {@code InvokeDynamicBootstrapError}.)
- * <p>
- * Extra bootstrap method arguments are intended to allow language implementors
- * to safely and compactly encode metadata.
- * In principle, the name and extra arguments are redundant,
- * since each call site could be given its own unique bootstrap method.
- * Such a practice is likely to produce large class files and constant pools.
- *
- * <h2><a name="structs"></a>Structure Summary</h2>
- * <blockquote><pre>// summary of constant and attribute structures
-struct CONSTANT_MethodHandle_info {
-  u1 tag = 15;
-  u1 reference_kind;       // 1..8 (one of REF_invokeVirtual, etc.)
-  u2 reference_index;      // index to CONSTANT_Fieldref or *Methodref
-}
-struct CONSTANT_MethodType_info {
-  u1 tag = 16;
-  u2 descriptor_index;    // index to CONSTANT_Utf8, as in NameAndType
-}
-struct CONSTANT_InvokeDynamic_info {
-  u1 tag = 18;
-  u2 bootstrap_method_attr_index;  // index into BootstrapMethods_attr
-  u2 name_and_type_index;          // index to CONSTANT_NameAndType, as in Methodref
-}
-struct BootstrapMethods_attr {
- u2 name;  // CONSTANT_Utf8 = "BootstrapMethods"
- u4 size;
- u2 bootstrap_method_count;
- struct bootstrap_method_specifier {
-   u2 bootstrap_method_ref;  // index to CONSTANT_MethodHandle
-   u2 bootstrap_argument_count;
-   u2 bootstrap_arguments[bootstrap_argument_count];  // constant pool indexes
- } bootstrap_methods[bootstrap_method_count];
-}
- * </pre></blockquote>
- *
- * @author John Rose, JSR 292 EG
- */
-
-package java.dyn;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/BootstrapMethodError.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang;
+
+/**
+ * Thrown to indicate that an {@code invokedynamic} instruction has
+ * failed to find its bootstrap method,
+ * or the bootstrap method has failed to provide a
+ * {@linkplain java.lang.invoke.CallSite call site} with a {@linkplain java.lang.invoke.CallSite#getTarget target}
+ * of the correct {@linkplain java.lang.invoke.MethodHandle#type method type}.
+ *
+ * @author John Rose, JSR 292 EG
+ * @since 1.7
+ */
+public class BootstrapMethodError extends LinkageError {
+    private static final long serialVersionUID = 292L;
+
+    /**
+     * Constructs an {@code BootstrapMethodError} with no detail message.
+     */
+    public BootstrapMethodError() {
+        super();
+    }
+
+    /**
+     * Constructs an {@code BootstrapMethodError} with the specified
+     * detail message.
+     *
+     * @param s the detail message.
+     */
+    public BootstrapMethodError(String s) {
+        super(s);
+    }
+
+    /**
+     * Constructs a {@code BootstrapMethodError} with the specified
+     * detail message and cause.
+     *
+     * @param s the detail message.
+     * @param cause the cause, may be {@code null}.
+     */
+    public BootstrapMethodError(String s, Throwable cause) {
+        super(s, cause);
+    }
+
+    /**
+     * Constructs a {@code BootstrapMethodError} with the specified
+     * cause.
+     *
+     * @param cause the cause, may be {@code null}.
+     */
+    public BootstrapMethodError(Throwable cause) {
+        // cf. Throwable(Throwable cause) constructor.
+        super(cause == null ? null : cause.toString());
+        initCause(cause);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/ClassValue.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2010, 2011, 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 java.lang;
+
+import java.util.WeakHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Lazily associate a computed value with (potentially) every type.
+ * For example, if a dynamic language needs to construct a message dispatch
+ * table for each class encountered at a message send call site,
+ * it can use a {@code ClassValue} to cache information needed to
+ * perform the message send quickly, for each class encountered.
+ * @author John Rose, JSR 292 EG
+ * @since 1.7
+ */
+public abstract class ClassValue<T> {
+    /**
+     * Computes the given class's derived value for this {@code ClassValue}.
+     * <p>
+     * This method will be invoked within the first thread that accesses
+     * the value with the {@link #get get} method.
+     * <p>
+     * Normally, this method is invoked at most once per class,
+     * but it may be invoked again if there has been a call to
+     * {@link #remove remove}.
+     * <p>
+     * If this method throws an exception, the corresponding call to {@code get}
+     * will terminate abnormally with that exception, and no class value will be recorded.
+     *
+     * @param type the type whose class value must be computed
+     * @return the newly computed value associated with this {@code ClassValue}, for the given class or interface
+     * @see #get
+     * @see #remove
+     */
+    protected abstract T computeValue(Class<?> type);
+
+    /**
+     * Returns the value for the given class.
+     * If no value has yet been computed, it is obtained by
+     * an invocation of the {@link #computeValue computeValue} method.
+     * <p>
+     * The actual installation of the value on the class
+     * is performed atomically.
+     * At that point, if several racing threads have
+     * computed values, one is chosen, and returned to
+     * all the racing threads.
+     * <p>
+     * The {@code type} parameter is typically a class, but it may be any type,
+     * such as an interface, a primitive type (like {@code int.class}), or {@code void.class}.
+     * <p>
+     * In the absence of {@code remove} calls, a class value has a simple
+     * state diagram:  uninitialized and initialized.
+     * When {@code remove} calls are made,
+     * the rules for value observation are more complex.
+     * See the documentation for {@link #remove remove} for more information.
+     *
+     * @param type the type whose class value must be computed or retrieved
+     * @return the current value associated with this {@code ClassValue}, for the given class or interface
+     * @throws NullPointerException if the argument is null
+     * @see #remove
+     * @see #computeValue
+     */
+    public T get(Class<?> type) {
+        ClassValueMap map = getMap(type);
+        if (map != null) {
+            Object x = map.get(this);
+            if (x != null) {
+                return (T) map.unmaskNull(x);
+            }
+        }
+        return setComputedValue(type);
+    }
+
+    /**
+     * Removes the associated value for the given class.
+     * If this value is subsequently {@linkplain #get read} for the same class,
+     * its value will be reinitialized by invoking its {@link #computeValue computeValue} method.
+     * This may result in an additional invocation of the
+     * {@code computeValue computeValue} method for the given class.
+     * <p>
+     * In order to explain the interaction between {@code get} and {@code remove} calls,
+     * we must model the state transitions of a class value to take into account
+     * the alternation between uninitialized and initialized states.
+     * To do this, number these states sequentially from zero, and note that
+     * uninitialized (or removed) states are numbered with even numbers,
+     * while initialized (or re-initialized) states have odd numbers.
+     * <p>
+     * When a thread {@code T} removes a class value in state {@code 2N},
+     * nothing happens, since the class value is already uninitialized.
+     * Otherwise, the state is advanced atomically to {@code 2N+1}.
+     * <p>
+     * When a thread {@code T} queries a class value in state {@code 2N},
+     * the thread first attempts to initialize the class value to state {@code 2N+1}
+     * by invoking {@code computeValue} and installing the resulting value.
+     * <p>
+     * When {@code T} attempts to install the newly computed value,
+     * if the state is still at {@code 2N}, the class value will be initialized
+     * with the computed value, advancing it to state {@code 2N+1}.
+     * <p>
+     * Otherwise, whether the new state is even or odd,
+     * {@code T} will discard the newly computed value
+     * and retry the {@code get} operation.
+     * <p>
+     * Discarding and retrying is an important proviso,
+     * since otherwise {@code T} could potentially install
+     * a disastrously stale value.  For example:
+     * <ul>
+     * <li>{@code T} calls {@code CV.get(C)} and sees state {@code 2N}
+     * <li>{@code T} quickly computes a time-dependent value {@code V0} and gets ready to install it
+     * <li>{@code T} is hit by an unlucky paging or scheduling event, and goes to sleep for a long time
+     * <li>...meanwhile, {@code T2} also calls {@code CV.get(C)} and sees state {@code 2N}
+     * <li>{@code T2} quickly computes a similar time-dependent value {@code V1} and installs it on {@code CV.get(C)}
+     * <li>{@code T2} (or a third thread) then calls {@code CV.remove(C)}, undoing {@code T2}'s work
+     * <li> the previous actions of {@code T2} are repeated several times
+     * <li> also, the relevant computed values change over time: {@code V1}, {@code V2}, ...
+     * <li>...meanwhile, {@code T} wakes up and attempts to install {@code V0}; <em>this must fail</em>
+     * </ul>
+     * We can assume in the above scenario that {@code CV.computeValue} uses locks to properly
+     * observe the time-dependent states as it computes {@code V1}, etc.
+     * This does not remove the threat of a stale value, since there is a window of time
+     * between the return of {@code computeValue} in {@code T} and the installation
+     * of the the new value.  No user synchronization is possible during this time.
+     *
+     * @param type the type whose class value must be removed
+     * @throws NullPointerException if the argument is null
+     */
+    public void remove(Class<?> type) {
+        ClassValueMap map = getMap(type);
+        if (map != null) {
+            synchronized (map) {
+                map.remove(this);
+            }
+        }
+    }
+
+    /// Implementation...
+    // FIXME: Use a data structure here similar that of ThreadLocal (7030453).
+
+    private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
+
+    /** Slow path for {@link #get}. */
+    private T setComputedValue(Class<?> type) {
+        ClassValueMap map = getMap(type);
+        if (map == null) {
+            map = initializeMap(type);
+        }
+        T value = computeValue(type);
+        STORE_BARRIER.lazySet(0);
+        // All stores pending from computeValue are completed.
+        synchronized (map) {
+            // Warm up the table with a null entry.
+            map.preInitializeEntry(this);
+        }
+        STORE_BARRIER.lazySet(0);
+        // All stores pending from table expansion are completed.
+        synchronized (map) {
+            value = (T) map.initializeEntry(this, value);
+            // One might fear a possible race condition here
+            // if the code for map.put has flushed the write
+            // to map.table[*] before the writes to the Map.Entry
+            // are done.  This is not possible, since we have
+            // warmed up the table with an empty entry.
+        }
+        return value;
+    }
+
+    // Replace this map by a per-class slot.
+    private static final WeakHashMap<Class<?>, ClassValueMap> ROOT
+        = new WeakHashMap<Class<?>, ClassValueMap>();
+
+    private static ClassValueMap getMap(Class<?> type) {
+        return ROOT.get(type);
+    }
+
+    private static ClassValueMap initializeMap(Class<?> type) {
+        synchronized (ClassValue.class) {
+            ClassValueMap map = ROOT.get(type);
+            if (map == null)
+                ROOT.put(type, map = new ClassValueMap());
+            return map;
+        }
+    }
+
+    static class ClassValueMap extends WeakHashMap<ClassValue, Object> {
+        /** Make sure this table contains an Entry for the given key, even if it is empty. */
+        void preInitializeEntry(ClassValue key) {
+            if (!this.containsKey(key))
+                this.put(key, null);
+        }
+        /** Make sure this table contains a non-empty Entry for the given key. */
+        Object initializeEntry(ClassValue key, Object value) {
+            Object prior = this.get(key);
+            if (prior != null) {
+                return unmaskNull(prior);
+            }
+            this.put(key, maskNull(value));
+            return value;
+        }
+
+        Object maskNull(Object x) {
+            return x == null ? this : x;
+        }
+        Object unmaskNull(Object x) {
+            return x == this ? null : x;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/AdapterMethodHandle.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,943 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.VerifyType;
+import sun.invoke.util.Wrapper;
+import java.util.Arrays;
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * This method handle performs simple conversion or checking of a single argument.
+ * @author jrose
+ */
+class AdapterMethodHandle extends BoundMethodHandle {
+
+    //MethodHandle vmtarget;   // next AMH or BMH in chain or final DMH
+    //Object       argument;   // parameter to the conversion if needed
+    //int          vmargslot;  // which argument slot is affected
+    private final int conversion;  // the type of conversion: RETYPE_ONLY, etc.
+
+    // Constructors in this class *must* be package scoped or private.
+    private AdapterMethodHandle(MethodHandle target, MethodType newType,
+                long conv, Object convArg) {
+        super(newType, convArg, newType.parameterSlotDepth(1+convArgPos(conv)));
+        this.conversion = convCode(conv);
+        // JVM might update VM-specific bits of conversion (ignore)
+        MethodHandleNatives.init(this, target, convArgPos(conv));
+    }
+    private AdapterMethodHandle(MethodHandle target, MethodType newType,
+                long conv) {
+        this(target, newType, conv, null);
+    }
+
+    // TO DO:  When adapting another MH with a null conversion, clone
+    // the target and change its type, instead of adding another layer.
+
+    /** Can a JVM-level adapter directly implement the proposed
+     *  argument conversions, as if by MethodHandles.convertArguments?
+     */
+    static boolean canPairwiseConvert(MethodType newType, MethodType oldType) {
+        // same number of args, of course
+        int len = newType.parameterCount();
+        if (len != oldType.parameterCount())
+            return false;
+
+        // Check return type.  (Not much can be done with it.)
+        Class<?> exp = newType.returnType();
+        Class<?> ret = oldType.returnType();
+        if (!VerifyType.isNullConversion(ret, exp))
+            return false;
+
+        // Check args pairwise.
+        for (int i = 0; i < len; i++) {
+            Class<?> src = newType.parameterType(i); // source type
+            Class<?> dst = oldType.parameterType(i); // destination type
+            if (!canConvertArgument(src, dst))
+                return false;
+        }
+
+        return true;
+    }
+
+    /** Can a JVM-level adapter directly implement the proposed
+     *  argument conversion, as if by MethodHandles.convertArguments?
+     */
+    static boolean canConvertArgument(Class<?> src, Class<?> dst) {
+        // ? Retool this logic to use RETYPE_ONLY, CHECK_CAST, etc., as opcodes,
+        // so we don't need to repeat so much decision making.
+        if (VerifyType.isNullConversion(src, dst)) {
+            return true;
+        } else if (src.isPrimitive()) {
+            if (dst.isPrimitive())
+                return canPrimCast(src, dst);
+            else
+                return canBoxArgument(src, dst);
+        } else {
+            if (dst.isPrimitive())
+                return canUnboxArgument(src, dst);
+            else
+                return true;  // any two refs can be interconverted
+        }
+    }
+
+    /**
+     * Create a JVM-level adapter method handle to conform the given method
+     * handle to the similar newType, using only pairwise argument conversions.
+     * For each argument, convert incoming argument to the exact type needed.
+     * Only null conversions are allowed on the return value (until
+     * the JVM supports ricochet adapters).
+     * The argument conversions allowed are casting, unboxing,
+     * integral widening or narrowing, and floating point widening or narrowing.
+     * @param newType required call type
+     * @param target original method handle
+     * @return an adapter to the original handle with the desired new type,
+     *          or the original target if the types are already identical
+     *          or null if the adaptation cannot be made
+     */
+    static MethodHandle makePairwiseConvert(MethodType newType, MethodHandle target) {
+        MethodType oldType = target.type();
+        if (newType == oldType)  return target;
+
+        if (!canPairwiseConvert(newType, oldType))
+            return null;
+        // (after this point, it is an assertion error to fail to convert)
+
+        // Find last non-trivial conversion (if any).
+        int lastConv = newType.parameterCount()-1;
+        while (lastConv >= 0) {
+            Class<?> src = newType.parameterType(lastConv); // source type
+            Class<?> dst = oldType.parameterType(lastConv); // destination type
+            if (VerifyType.isNullConversion(src, dst)) {
+                --lastConv;
+            } else {
+                break;
+            }
+        }
+        // Now build a chain of one or more adapters.
+        MethodHandle adapter = target;
+        MethodType midType = oldType.changeReturnType(newType.returnType());
+        for (int i = 0; i <= lastConv; i++) {
+            Class<?> src = newType.parameterType(i); // source type
+            Class<?> dst = midType.parameterType(i); // destination type
+            if (VerifyType.isNullConversion(src, dst)) {
+                // do nothing: difference is trivial
+                continue;
+            }
+            // Work the current type backward toward the desired caller type:
+            if (i != lastConv) {
+                midType = midType.changeParameterType(i, src);
+            } else {
+                // When doing the last (or only) real conversion,
+                // force all remaining null conversions to happen also.
+                assert(VerifyType.isNullConversion(newType, midType.changeParameterType(i, src)));
+                midType = newType;
+            }
+
+            // Tricky case analysis follows.
+            // It parallels canConvertArgument() above.
+            if (src.isPrimitive()) {
+                if (dst.isPrimitive()) {
+                    adapter = makePrimCast(midType, adapter, i, dst);
+                } else {
+                    adapter = makeBoxArgument(midType, adapter, i, dst);
+                }
+            } else {
+                if (dst.isPrimitive()) {
+                    // Caller has boxed a primitive.  Unbox it for the target.
+                    // The box type must correspond exactly to the primitive type.
+                    // This is simpler than the powerful set of widening
+                    // conversions supported by reflect.Method.invoke.
+                    // Those conversions require a big nest of if/then/else logic,
+                    // which we prefer to make a user responsibility.
+                    adapter = makeUnboxArgument(midType, adapter, i, dst);
+                } else {
+                    // Simple reference conversion.
+                    // Note:  Do not check for a class hierarchy relation
+                    // between src and dst.  In all cases a 'null' argument
+                    // will pass the cast conversion.
+                    adapter = makeCheckCast(midType, adapter, i, dst);
+                }
+            }
+            assert(adapter != null);
+            assert(adapter.type() == midType);
+        }
+        if (adapter.type() != newType) {
+            // Only trivial conversions remain.
+            adapter = makeRetypeOnly(newType, adapter);
+            assert(adapter != null);
+            // Actually, that's because there were no non-trivial ones:
+            assert(lastConv == -1);
+        }
+        assert(adapter.type() == newType);
+        return adapter;
+    }
+
+    /**
+     * Create a JVM-level adapter method handle to permute the arguments
+     * of the given method.
+     * @param newType required call type
+     * @param target original method handle
+     * @param argumentMap for each target argument, position of its source in newType
+     * @return an adapter to the original handle with the desired new type,
+     *          or the original target if the types are already identical
+     *          and the permutation is null
+     * @throws IllegalArgumentException if the adaptation cannot be made
+     *          directly by a JVM-level adapter, without help from Java code
+     */
+    static MethodHandle makePermutation(MethodType newType, MethodHandle target,
+                int[] argumentMap) {
+        MethodType oldType = target.type();
+        boolean nullPermutation = true;
+        for (int i = 0; i < argumentMap.length; i++) {
+            int pos = argumentMap[i];
+            if (pos != i)
+                nullPermutation = false;
+            if (pos < 0 || pos >= newType.parameterCount()) {
+                argumentMap = new int[0]; break;
+            }
+        }
+        if (argumentMap.length != oldType.parameterCount())
+            throw newIllegalArgumentException("bad permutation: "+Arrays.toString(argumentMap));
+        if (nullPermutation) {
+            MethodHandle res = makePairwiseConvert(newType, target);
+            // well, that was easy
+            if (res == null)
+                throw newIllegalArgumentException("cannot convert pairwise: "+newType);
+            return res;
+        }
+
+        // Check return type.  (Not much can be done with it.)
+        Class<?> exp = newType.returnType();
+        Class<?> ret = oldType.returnType();
+        if (!VerifyType.isNullConversion(ret, exp))
+            throw newIllegalArgumentException("bad return conversion for "+newType);
+
+        // See if the argument types match up.
+        for (int i = 0; i < argumentMap.length; i++) {
+            int j = argumentMap[i];
+            Class<?> src = newType.parameterType(j);
+            Class<?> dst = oldType.parameterType(i);
+            if (!VerifyType.isNullConversion(src, dst))
+                throw newIllegalArgumentException("bad argument #"+j+" conversion for "+newType);
+        }
+
+        // Now figure out a nice mix of SWAP, ROT, DUP, and DROP adapters.
+        // A workable greedy algorithm is as follows:
+        // Drop unused outgoing arguments (right to left: shallowest first).
+        // Duplicate doubly-used outgoing arguments (left to right: deepest first).
+        // Then the remaining problem is a true argument permutation.
+        // Marshal the outgoing arguments as required from left to right.
+        // That is, find the deepest outgoing stack position that does not yet
+        // have the correct argument value, and correct at least that position
+        // by swapping or rotating in the misplaced value (from a shallower place).
+        // If the misplaced value is followed by one or more consecutive values
+        // (also misplaced)  issue a rotation which brings as many as possible
+        // into position.  Otherwise make progress with either a swap or a
+        // rotation.  Prefer the swap as cheaper, but do not use it if it
+        // breaks a slot pair.  Prefer the rotation over the swap if it would
+        // preserve more consecutive values shallower than the target position.
+        // When more than one rotation will work (because the required value
+        // is already adjacent to the target position), then use a rotation
+        // which moves the old value in the target position adjacent to
+        // one of its consecutive values.  Also, prefer shorter rotation
+        // spans, since they use fewer memory cycles for shuffling.
+
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    private static byte basicType(Class<?> type) {
+        if (type == null)  return T_VOID;
+        switch (Wrapper.forBasicType(type)) {
+            case BOOLEAN:  return T_BOOLEAN;
+            case CHAR:     return T_CHAR;
+            case FLOAT:    return T_FLOAT;
+            case DOUBLE:   return T_DOUBLE;
+            case BYTE:     return T_BYTE;
+            case SHORT:    return T_SHORT;
+            case INT:      return T_INT;
+            case LONG:     return T_LONG;
+            case OBJECT:   return T_OBJECT;
+            case VOID:     return T_VOID;
+        }
+        return 99; // T_ILLEGAL or some such
+    }
+
+    /** Number of stack slots for the given type.
+     *  Two for T_DOUBLE and T_FLOAT, one for the rest.
+     */
+    private static int type2size(int type) {
+        assert(type >= T_BOOLEAN && type <= T_OBJECT);
+        return (type == T_LONG || type == T_DOUBLE) ? 2 : 1;
+    }
+    private static int type2size(Class<?> type) {
+        return type2size(basicType(type));
+    }
+
+    /** The given stackMove is the number of slots pushed.
+     * It might be negative.  Scale it (multiply) by the
+     * VM's notion of how an address changes with a push,
+     * to get the raw SP change for stackMove.
+     * Then shift and mask it into the correct field.
+     */
+    private static long insertStackMove(int stackMove) {
+        // following variable must be long to avoid sign extension after '<<'
+        long spChange = stackMove * MethodHandleNatives.JVM_STACK_MOVE_UNIT;
+        return (spChange & CONV_STACK_MOVE_MASK) << CONV_STACK_MOVE_SHIFT;
+    }
+
+    /** Construct an adapter conversion descriptor for a single-argument conversion. */
+    private static long makeConv(int convOp, int argnum, int src, int dest) {
+        assert(src  == (src  & 0xF));
+        assert(dest == (dest & 0xF));
+        assert(convOp >= OP_CHECK_CAST && convOp <= OP_PRIM_TO_REF);
+        int stackMove = type2size(dest) - type2size(src);
+        return ((long) argnum << 32 |
+                (long) convOp << CONV_OP_SHIFT |
+                (int)  src    << CONV_SRC_TYPE_SHIFT |
+                (int)  dest   << CONV_DEST_TYPE_SHIFT |
+                insertStackMove(stackMove)
+                );
+    }
+    private static long makeConv(int convOp, int argnum, int stackMove) {
+        assert(convOp >= OP_DUP_ARGS && convOp <= OP_SPREAD_ARGS);
+        byte src = 0, dest = 0;
+        if (convOp >= OP_COLLECT_ARGS && convOp <= OP_SPREAD_ARGS)
+            src = dest = T_OBJECT;
+        return ((long) argnum << 32 |
+                (long) convOp << CONV_OP_SHIFT |
+                (int)  src    << CONV_SRC_TYPE_SHIFT |
+                (int)  dest   << CONV_DEST_TYPE_SHIFT |
+                insertStackMove(stackMove)
+                );
+    }
+    private static long makeSwapConv(int convOp, int srcArg, byte type, int destSlot) {
+        assert(convOp >= OP_SWAP_ARGS && convOp <= OP_ROT_ARGS);
+        return ((long) srcArg << 32 |
+                (long) convOp << CONV_OP_SHIFT |
+                (int)  type   << CONV_SRC_TYPE_SHIFT |
+                (int)  type   << CONV_DEST_TYPE_SHIFT |
+                (int)  destSlot << CONV_VMINFO_SHIFT
+                );
+    }
+    private static long makeConv(int convOp) {
+        assert(convOp == OP_RETYPE_ONLY || convOp == OP_RETYPE_RAW);
+        return ((long)-1 << 32) | (convOp << CONV_OP_SHIFT);   // stackMove, src, dst all zero
+    }
+    private static int convCode(long conv) {
+        return (int)conv;
+    }
+    private static int convArgPos(long conv) {
+        return (int)(conv >>> 32);
+    }
+    private static boolean convOpSupported(int convOp) {
+        assert(convOp >= 0 && convOp <= CONV_OP_LIMIT);
+        return ((1<<convOp) & MethodHandleNatives.CONV_OP_IMPLEMENTED_MASK) != 0;
+    }
+
+    /** One of OP_RETYPE_ONLY, etc. */
+    int conversionOp() { return (conversion & CONV_OP_MASK) >> CONV_OP_SHIFT; }
+
+    /* Return one plus the position of the first non-trivial difference
+     * between the given types.  This is not a symmetric operation;
+     * we are considering adapting the targetType to adapterType.
+     * Trivial differences are those which could be ignored by the JVM
+     * without subverting the verifier.  Otherwise, adaptable differences
+     * are ones for which we could create an adapter to make the type change.
+     * Return zero if there are no differences (other than trivial ones).
+     * Return 1+N if N is the only adaptable argument difference.
+     * Return the -2-N where N is the first of several adaptable
+     * argument differences.
+     * Return -1 if there there are differences which are not adaptable.
+     */
+    private static int diffTypes(MethodType adapterType,
+                                 MethodType targetType,
+                                 boolean raw) {
+        int diff;
+        diff = diffReturnTypes(adapterType, targetType, raw);
+        if (diff != 0)  return diff;
+        int nargs = adapterType.parameterCount();
+        if (nargs != targetType.parameterCount())
+            return -1;
+        diff = diffParamTypes(adapterType, 0, targetType, 0, nargs, raw);
+        //System.out.println("diff "+adapterType);
+        //System.out.println("  "+diff+" "+targetType);
+        return diff;
+    }
+    private static int diffReturnTypes(MethodType adapterType,
+                                       MethodType targetType,
+                                       boolean raw) {
+        Class<?> src = targetType.returnType();
+        Class<?> dst = adapterType.returnType();
+        if ((!raw
+             ? VerifyType.canPassUnchecked(src, dst)
+             : VerifyType.canPassRaw(src, dst)
+             ) > 0)
+            return 0;  // no significant difference
+        if (raw && !src.isPrimitive() && !dst.isPrimitive())
+            return 0;  // can force a reference return (very carefully!)
+        //if (false)  return 1;  // never adaptable!
+        return -1;  // some significant difference
+    }
+    private static int diffParamTypes(MethodType adapterType, int astart,
+                                      MethodType targetType, int tstart,
+                                      int nargs, boolean raw) {
+        assert(nargs >= 0);
+        int res = 0;
+        for (int i = 0; i < nargs; i++) {
+            Class<?> src  = adapterType.parameterType(astart+i);
+            Class<?> dest = targetType.parameterType(tstart+i);
+            if ((!raw
+                 ? VerifyType.canPassUnchecked(src, dest)
+                 : VerifyType.canPassRaw(src, dest)
+                ) <= 0) {
+                // found a difference; is it the only one so far?
+                if (res != 0)
+                    return -1-res; // return -2-i for prev. i
+                res = 1+i;
+            }
+        }
+        return res;
+    }
+
+    /** Can a retyping adapter (alone) validly convert the target to newType? */
+    static boolean canRetypeOnly(MethodType newType, MethodType targetType) {
+        return canRetype(newType, targetType, false);
+    }
+    /** Can a retyping adapter (alone) convert the target to newType?
+     *  It is allowed to widen subword types and void to int, to make bitwise
+     *  conversions between float/int and double/long, and to perform unchecked
+     *  reference conversions on return.  This last feature requires that the
+     *  caller be trusted, and perform explicit cast conversions on return values.
+     */
+    static boolean canRetypeRaw(MethodType newType, MethodType targetType) {
+        return canRetype(newType, targetType, true);
+    }
+    static boolean canRetype(MethodType newType, MethodType targetType, boolean raw) {
+        if (!convOpSupported(raw ? OP_RETYPE_RAW : OP_RETYPE_ONLY))  return false;
+        int diff = diffTypes(newType, targetType, raw);
+        // %%% This assert is too strong.  Factor diff into VerifyType and reconcile.
+        assert(raw || (diff == 0) == VerifyType.isNullConversion(newType, targetType));
+        return diff == 0;
+    }
+
+    /** Factory method:  Performs no conversions; simply retypes the adapter.
+     *  Allows unchecked argument conversions pairwise, if they are safe.
+     *  Returns null if not possible.
+     */
+    static MethodHandle makeRetypeOnly(MethodType newType, MethodHandle target) {
+        return makeRetype(newType, target, false);
+    }
+    static MethodHandle makeRetypeRaw(MethodType newType, MethodHandle target) {
+        return makeRetype(newType, target, true);
+    }
+    static MethodHandle makeRetype(MethodType newType, MethodHandle target, boolean raw) {
+        MethodType oldType = target.type();
+        if (oldType == newType)  return target;
+        if (!canRetype(newType, oldType, raw))
+            return null;
+        // TO DO:  clone the target guy, whatever he is, with new type.
+        return new AdapterMethodHandle(target, newType, makeConv(raw ? OP_RETYPE_RAW : OP_RETYPE_ONLY));
+    }
+
+    static MethodHandle makeVarargsCollector(MethodHandle target, Class<?> arrayType) {
+        return new AsVarargsCollector(target, arrayType);
+    }
+
+    static class AsVarargsCollector extends AdapterMethodHandle {
+        final MethodHandle target;
+        final Class<?> arrayType;
+        MethodHandle cache;
+
+        AsVarargsCollector(MethodHandle target, Class<?> arrayType) {
+            super(target, target.type(), makeConv(OP_RETYPE_ONLY));
+            this.target = target;
+            this.arrayType = arrayType;
+            this.cache = target.asCollector(arrayType, 0);
+        }
+
+        @Override
+        public boolean isVarargsCollector() {
+            return true;
+        }
+
+        @Override
+        public MethodHandle asType(MethodType newType) {
+            MethodType type = this.type();
+            int collectArg = type.parameterCount() - 1;
+            int newArity = newType.parameterCount();
+            if (newArity == collectArg+1 &&
+                type.parameterType(collectArg).isAssignableFrom(newType.parameterType(collectArg))) {
+                // if arity and trailing parameter are compatible, do normal thing
+                return super.asType(newType);
+            }
+            // check cache
+            if (cache.type().parameterCount() == newArity)
+                return cache.asType(newType);
+            // build and cache a collector
+            int arrayLength = newArity - collectArg;
+            MethodHandle collector;
+            try {
+                collector = target.asCollector(arrayType, arrayLength);
+            } catch (IllegalArgumentException ex) {
+                throw new WrongMethodTypeException("cannot build collector");
+            }
+            cache = collector;
+            return collector.asType(newType);
+        }
+
+        @Override
+        public MethodHandle asVarargsCollector(Class<?> arrayType) {
+            MethodType type = this.type();
+            if (type.parameterType(type.parameterCount()-1) == arrayType)
+                return this;
+            return super.asVarargsCollector(arrayType);
+        }
+    }
+
+    /** Can a checkcast adapter validly convert the target to newType?
+     *  The JVM supports all kind of reference casts, even silly ones.
+     */
+    static boolean canCheckCast(MethodType newType, MethodType targetType,
+                int arg, Class<?> castType) {
+        if (!convOpSupported(OP_CHECK_CAST))  return false;
+        Class<?> src = newType.parameterType(arg);
+        Class<?> dst = targetType.parameterType(arg);
+        if (!canCheckCast(src, castType)
+                || !VerifyType.isNullConversion(castType, dst))
+            return false;
+        int diff = diffTypes(newType, targetType, false);
+        return (diff == arg+1);  // arg is sole non-trivial diff
+    }
+    /** Can an primitive conversion adapter validly convert src to dst? */
+    static boolean canCheckCast(Class<?> src, Class<?> dst) {
+        return (!src.isPrimitive() && !dst.isPrimitive());
+    }
+
+    /** Factory method:  Forces a cast at the given argument.
+     *  The castType is the target of the cast, and can be any type
+     *  with a null conversion to the corresponding target parameter.
+     *  Return null if this cannot be done.
+     */
+    static MethodHandle makeCheckCast(MethodType newType, MethodHandle target,
+                int arg, Class<?> castType) {
+        if (!canCheckCast(newType, target.type(), arg, castType))
+            return null;
+        long conv = makeConv(OP_CHECK_CAST, arg, T_OBJECT, T_OBJECT);
+        return new AdapterMethodHandle(target, newType, conv, castType);
+    }
+
+    /** Can an primitive conversion adapter validly convert the target to newType?
+     *  The JVM currently supports all conversions except those between
+     *  floating and integral types.
+     */
+    static boolean canPrimCast(MethodType newType, MethodType targetType,
+                int arg, Class<?> convType) {
+        if (!convOpSupported(OP_PRIM_TO_PRIM))  return false;
+        Class<?> src = newType.parameterType(arg);
+        Class<?> dst = targetType.parameterType(arg);
+        if (!canPrimCast(src, convType)
+                || !VerifyType.isNullConversion(convType, dst))
+            return false;
+        int diff = diffTypes(newType, targetType, false);
+        return (diff == arg+1);  // arg is sole non-trivial diff
+    }
+    /** Can an primitive conversion adapter validly convert src to dst? */
+    static boolean canPrimCast(Class<?> src, Class<?> dst) {
+        if (src == dst || !src.isPrimitive() || !dst.isPrimitive()) {
+            return false;
+        } else if (Wrapper.forPrimitiveType(dst).isFloating()) {
+            // both must be floating types
+            return Wrapper.forPrimitiveType(src).isFloating();
+        } else {
+            // both are integral, and all combinations work fine
+            assert(Wrapper.forPrimitiveType(src).isIntegral() &&
+                   Wrapper.forPrimitiveType(dst).isIntegral());
+            return true;
+        }
+    }
+
+    /** Factory method:  Truncate the given argument with zero or sign extension,
+     *  and/or convert between single and doubleword versions of integer or float.
+     *  The convType is the target of the conversion, and can be any type
+     *  with a null conversion to the corresponding target parameter.
+     *  Return null if this cannot be done.
+     */
+    static MethodHandle makePrimCast(MethodType newType, MethodHandle target,
+                int arg, Class<?> convType) {
+        MethodType oldType = target.type();
+        if (!canPrimCast(newType, oldType, arg, convType))
+            return null;
+        Class<?> src = newType.parameterType(arg);
+        long conv = makeConv(OP_PRIM_TO_PRIM, arg, basicType(src), basicType(convType));
+        return new AdapterMethodHandle(target, newType, conv);
+    }
+
+    /** Can an unboxing conversion validly convert src to dst?
+     *  The JVM currently supports all kinds of casting and unboxing.
+     *  The convType is the unboxed type; it can be either a primitive or wrapper.
+     */
+    static boolean canUnboxArgument(MethodType newType, MethodType targetType,
+                int arg, Class<?> convType) {
+        if (!convOpSupported(OP_REF_TO_PRIM))  return false;
+        Class<?> src = newType.parameterType(arg);
+        Class<?> dst = targetType.parameterType(arg);
+        Class<?> boxType = Wrapper.asWrapperType(convType);
+        convType = Wrapper.asPrimitiveType(convType);
+        if (!canCheckCast(src, boxType)
+                || boxType == convType
+                || !VerifyType.isNullConversion(convType, dst))
+            return false;
+        int diff = diffTypes(newType, targetType, false);
+        return (diff == arg+1);  // arg is sole non-trivial diff
+    }
+    /** Can an primitive unboxing adapter validly convert src to dst? */
+    static boolean canUnboxArgument(Class<?> src, Class<?> dst) {
+        return (!src.isPrimitive() && Wrapper.asPrimitiveType(dst).isPrimitive());
+    }
+
+    /** Factory method:  Unbox the given argument.
+     *  Return null if this cannot be done.
+     */
+    static MethodHandle makeUnboxArgument(MethodType newType, MethodHandle target,
+                int arg, Class<?> convType) {
+        MethodType oldType = target.type();
+        Class<?> src = newType.parameterType(arg);
+        Class<?> dst = oldType.parameterType(arg);
+        Class<?> boxType = Wrapper.asWrapperType(convType);
+        Class<?> primType = Wrapper.asPrimitiveType(convType);
+        if (!canUnboxArgument(newType, oldType, arg, convType))
+            return null;
+        MethodType castDone = newType;
+        if (!VerifyType.isNullConversion(src, boxType))
+            castDone = newType.changeParameterType(arg, boxType);
+        long conv = makeConv(OP_REF_TO_PRIM, arg, T_OBJECT, basicType(primType));
+        MethodHandle adapter = new AdapterMethodHandle(target, castDone, conv, boxType);
+        if (castDone == newType)
+            return adapter;
+        return makeCheckCast(newType, adapter, arg, boxType);
+    }
+
+    /** Can an primitive boxing adapter validly convert src to dst? */
+    static boolean canBoxArgument(Class<?> src, Class<?> dst) {
+        if (!convOpSupported(OP_PRIM_TO_REF))  return false;
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    /** Factory method:  Unbox the given argument.
+     *  Return null if this cannot be done.
+     */
+    static MethodHandle makeBoxArgument(MethodType newType, MethodHandle target,
+                int arg, Class<?> convType) {
+        // this is difficult to do in the JVM because it must GC
+        return null;
+    }
+
+    /** Can an adapter simply drop arguments to convert the target to newType? */
+    static boolean canDropArguments(MethodType newType, MethodType targetType,
+                int dropArgPos, int dropArgCount) {
+        if (dropArgCount == 0)
+            return canRetypeOnly(newType, targetType);
+        if (!convOpSupported(OP_DROP_ARGS))  return false;
+        if (diffReturnTypes(newType, targetType, false) != 0)
+            return false;
+        int nptypes = newType.parameterCount();
+        // parameter types must be the same up to the drop point
+        if (dropArgPos != 0 && diffParamTypes(newType, 0, targetType, 0, dropArgPos, false) != 0)
+            return false;
+        int afterPos = dropArgPos + dropArgCount;
+        int afterCount = nptypes - afterPos;
+        if (dropArgPos < 0 || dropArgPos >= nptypes ||
+            dropArgCount < 1 || afterPos > nptypes ||
+            targetType.parameterCount() != nptypes - dropArgCount)
+            return false;
+        // parameter types after the drop point must also be the same
+        if (afterCount != 0 && diffParamTypes(newType, afterPos, targetType, dropArgPos, afterCount, false) != 0)
+            return false;
+        return true;
+    }
+
+    /** Factory method:  Drop selected arguments.
+     *  Allow unchecked retyping of remaining arguments, pairwise.
+     *  Return null if this is not possible.
+     */
+    static MethodHandle makeDropArguments(MethodType newType, MethodHandle target,
+                int dropArgPos, int dropArgCount) {
+        if (dropArgCount == 0)
+            return makeRetypeOnly(newType, target);
+        if (!canDropArguments(newType, target.type(), dropArgPos, dropArgCount))
+            return null;
+        // in  arglist: [0: ...keep1 | dpos: drop... | dpos+dcount: keep2... ]
+        // out arglist: [0: ...keep1 |                        dpos: keep2... ]
+        int keep2InPos  = dropArgPos + dropArgCount;
+        int dropSlot    = newType.parameterSlotDepth(keep2InPos);
+        int keep1InSlot = newType.parameterSlotDepth(dropArgPos);
+        int slotCount   = keep1InSlot - dropSlot;
+        assert(slotCount >= dropArgCount);
+        assert(target.type().parameterSlotCount() + slotCount == newType.parameterSlotCount());
+        long conv = makeConv(OP_DROP_ARGS, dropArgPos + dropArgCount - 1, -slotCount);
+        return new AdapterMethodHandle(target, newType, conv);
+    }
+
+    /** Can an adapter duplicate an argument to convert the target to newType? */
+    static boolean canDupArguments(MethodType newType, MethodType targetType,
+                int dupArgPos, int dupArgCount) {
+        if (!convOpSupported(OP_DUP_ARGS))  return false;
+        if (diffReturnTypes(newType, targetType, false) != 0)
+            return false;
+        int nptypes = newType.parameterCount();
+        if (dupArgCount < 0 || dupArgPos + dupArgCount > nptypes)
+            return false;
+        if (targetType.parameterCount() != nptypes + dupArgCount)
+            return false;
+        // parameter types must be the same up to the duplicated arguments
+        if (diffParamTypes(newType, 0, targetType, 0, nptypes, false) != 0)
+            return false;
+        // duplicated types must be, well, duplicates
+        if (diffParamTypes(newType, dupArgPos, targetType, nptypes, dupArgCount, false) != 0)
+            return false;
+        return true;
+    }
+
+    /** Factory method:  Duplicate the selected argument.
+     *  Return null if this is not possible.
+     */
+    static MethodHandle makeDupArguments(MethodType newType, MethodHandle target,
+                int dupArgPos, int dupArgCount) {
+        if (!canDupArguments(newType, target.type(), dupArgPos, dupArgCount))
+            return null;
+        if (dupArgCount == 0)
+            return target;
+        // in  arglist: [0: ...keep1 | dpos: dup... | dpos+dcount: keep2... ]
+        // out arglist: [0: ...keep1 | dpos: dup... | dpos+dcount: keep2... | dup... ]
+        int keep2InPos  = dupArgPos + dupArgCount;
+        int dupSlot     = newType.parameterSlotDepth(keep2InPos);
+        int keep1InSlot = newType.parameterSlotDepth(dupArgPos);
+        int slotCount   = keep1InSlot - dupSlot;
+        assert(target.type().parameterSlotCount() - slotCount == newType.parameterSlotCount());
+        long conv = makeConv(OP_DUP_ARGS, dupArgPos + dupArgCount - 1, slotCount);
+        return new AdapterMethodHandle(target, newType, conv);
+    }
+
+    /** Can an adapter swap two arguments to convert the target to newType? */
+    static boolean canSwapArguments(MethodType newType, MethodType targetType,
+                int swapArg1, int swapArg2) {
+        if (!convOpSupported(OP_SWAP_ARGS))  return false;
+        if (diffReturnTypes(newType, targetType, false) != 0)
+            return false;
+        if (swapArg1 >= swapArg2)  return false;  // caller resp
+        int nptypes = newType.parameterCount();
+        if (targetType.parameterCount() != nptypes)
+            return false;
+        if (swapArg1 < 0 || swapArg2 >= nptypes)
+            return false;
+        if (diffParamTypes(newType, 0, targetType, 0, swapArg1, false) != 0)
+            return false;
+        if (diffParamTypes(newType, swapArg1, targetType, swapArg2, 1, false) != 0)
+            return false;
+        if (diffParamTypes(newType, swapArg1+1, targetType, swapArg1+1, swapArg2-swapArg1-1, false) != 0)
+            return false;
+        if (diffParamTypes(newType, swapArg2, targetType, swapArg1, 1, false) != 0)
+            return false;
+        if (diffParamTypes(newType, swapArg2+1, targetType, swapArg2+1, nptypes-swapArg2-1, false) != 0)
+            return false;
+        return true;
+    }
+
+    /** Factory method:  Swap the selected arguments.
+     *  Return null if this is not possible.
+     */
+    static MethodHandle makeSwapArguments(MethodType newType, MethodHandle target,
+                int swapArg1, int swapArg2) {
+        if (swapArg1 == swapArg2)
+            return target;
+        if (swapArg1 > swapArg2) { int t = swapArg1; swapArg1 = swapArg2; swapArg2 = t; }
+        if (!canSwapArguments(newType, target.type(), swapArg1, swapArg2))
+            return null;
+        Class<?> swapType = newType.parameterType(swapArg1);
+        // in  arglist: [0: ...keep1 | pos1: a1 | pos1+1: keep2... | pos2: a2 | pos2+1: keep3... ]
+        // out arglist: [0: ...keep1 | pos1: a2 | pos1+1: keep2... | pos2: a1 | pos2+1: keep3... ]
+        int swapSlot2  = newType.parameterSlotDepth(swapArg2 + 1);
+        long conv = makeSwapConv(OP_SWAP_ARGS, swapArg1, basicType(swapType), swapSlot2);
+        return new AdapterMethodHandle(target, newType, conv);
+    }
+
+    static int positiveRotation(int argCount, int rotateBy) {
+        assert(argCount > 0);
+        if (rotateBy >= 0) {
+            if (rotateBy < argCount)
+                return rotateBy;
+            return rotateBy % argCount;
+        } else if (rotateBy >= -argCount) {
+            return rotateBy + argCount;
+        } else {
+            return (-1-((-1-rotateBy) % argCount)) + argCount;
+        }
+    }
+
+    final static int MAX_ARG_ROTATION = 1;
+
+    /** Can an adapter rotate arguments to convert the target to newType? */
+    static boolean canRotateArguments(MethodType newType, MethodType targetType,
+                int firstArg, int argCount, int rotateBy) {
+        if (!convOpSupported(OP_ROT_ARGS))  return false;
+        if (argCount <= 2)  return false;  // must be a swap, not a rotate
+        rotateBy = positiveRotation(argCount, rotateBy);
+        if (rotateBy == 0)  return false;  // no rotation
+        if (rotateBy > MAX_ARG_ROTATION && rotateBy < argCount - MAX_ARG_ROTATION)
+            return false;  // too many argument positions
+        // Rotate incoming args right N to the out args, N in 1..(argCouunt-1).
+        if (diffReturnTypes(newType, targetType, false) != 0)
+            return false;
+        int nptypes = newType.parameterCount();
+        if (targetType.parameterCount() != nptypes)
+            return false;
+        if (firstArg < 0 || firstArg >= nptypes)  return false;
+        int argLimit = firstArg + argCount;
+        if (argLimit > nptypes)  return false;
+        if (diffParamTypes(newType, 0, targetType, 0, firstArg, false) != 0)
+            return false;
+        int newChunk1 = argCount - rotateBy, newChunk2 = rotateBy;
+        // swap new chunk1 with target chunk2
+        if (diffParamTypes(newType, firstArg, targetType, argLimit-newChunk1, newChunk1, false) != 0)
+            return false;
+        // swap new chunk2 with target chunk1
+        if (diffParamTypes(newType, firstArg+newChunk1, targetType, firstArg, newChunk2, false) != 0)
+            return false;
+        return true;
+    }
+
+    /** Factory method:  Rotate the selected argument range.
+     *  Return null if this is not possible.
+     */
+    static MethodHandle makeRotateArguments(MethodType newType, MethodHandle target,
+                int firstArg, int argCount, int rotateBy) {
+        rotateBy = positiveRotation(argCount, rotateBy);
+        if (!canRotateArguments(newType, target.type(), firstArg, argCount, rotateBy))
+            return null;
+        // Decide whether it should be done as a right or left rotation,
+        // on the JVM stack.  Return the number of stack slots to rotate by,
+        // positive if right, negative if left.
+        int limit = firstArg + argCount;
+        int depth0 = newType.parameterSlotDepth(firstArg);
+        int depth1 = newType.parameterSlotDepth(limit-rotateBy);
+        int depth2 = newType.parameterSlotDepth(limit);
+        int chunk1Slots = depth0 - depth1; assert(chunk1Slots > 0);
+        int chunk2Slots = depth1 - depth2; assert(chunk2Slots > 0);
+        // From here on out, it assumes a single-argument shift.
+        assert(MAX_ARG_ROTATION == 1);
+        int srcArg, dstArg;
+        byte basicType;
+        if (chunk2Slots <= chunk1Slots) {
+            // Rotate right/down N (rotateBy = +N, N small, c2 small):
+            // in  arglist: [0: ...keep1 | arg1: c1...  | limit-N: c2 | limit: keep2... ]
+            // out arglist: [0: ...keep1 | arg1: c2 | arg1+N: c1...   | limit: keep2... ]
+            srcArg = limit-1;
+            dstArg = firstArg;
+            basicType = basicType(newType.parameterType(srcArg));
+            assert(chunk2Slots == type2size(basicType));
+        } else {
+            // Rotate left/up N (rotateBy = -N, N small, c1 small):
+            // in  arglist: [0: ...keep1 | arg1: c1 | arg1+N: c2...   | limit: keep2... ]
+            // out arglist: [0: ...keep1 | arg1: c2 ... | limit-N: c1 | limit: keep2... ]
+            srcArg = firstArg;
+            dstArg = limit-1;
+            basicType = basicType(newType.parameterType(srcArg));
+            assert(chunk1Slots == type2size(basicType));
+        }
+        int dstSlot = newType.parameterSlotDepth(dstArg + 1);
+        long conv = makeSwapConv(OP_ROT_ARGS, srcArg, basicType, dstSlot);
+        return new AdapterMethodHandle(target, newType, conv);
+    }
+
+    /** Can an adapter spread an argument to convert the target to newType? */
+    static boolean canSpreadArguments(MethodType newType, MethodType targetType,
+                Class<?> spreadArgType, int spreadArgPos, int spreadArgCount) {
+        if (!convOpSupported(OP_SPREAD_ARGS))  return false;
+        if (diffReturnTypes(newType, targetType, false) != 0)
+            return false;
+        int nptypes = newType.parameterCount();
+        // parameter types must be the same up to the spread point
+        if (spreadArgPos != 0 && diffParamTypes(newType, 0, targetType, 0, spreadArgPos, false) != 0)
+            return false;
+        int afterPos = spreadArgPos + spreadArgCount;
+        int afterCount = nptypes - (spreadArgPos + 1);
+        if (spreadArgPos < 0 || spreadArgPos >= nptypes ||
+            spreadArgCount < 0 ||
+            targetType.parameterCount() != afterPos + afterCount)
+            return false;
+        // parameter types after the spread point must also be the same
+        if (afterCount != 0 && diffParamTypes(newType, spreadArgPos+1, targetType, afterPos, afterCount, false) != 0)
+            return false;
+        // match the array element type to the spread arg types
+        Class<?> rawSpreadArgType = newType.parameterType(spreadArgPos);
+        if (rawSpreadArgType != spreadArgType && !canCheckCast(rawSpreadArgType, spreadArgType))
+            return false;
+        for (int i = 0; i < spreadArgCount; i++) {
+            Class<?> src = VerifyType.spreadArgElementType(spreadArgType, i);
+            Class<?> dst = targetType.parameterType(spreadArgPos + i);
+            if (src == null || !VerifyType.isNullConversion(src, dst))
+                return false;
+        }
+        return true;
+    }
+
+
+    /** Factory method:  Spread selected argument. */
+    static MethodHandle makeSpreadArguments(MethodType newType, MethodHandle target,
+                Class<?> spreadArgType, int spreadArgPos, int spreadArgCount) {
+        MethodType targetType = target.type();
+        if (!canSpreadArguments(newType, targetType, spreadArgType, spreadArgPos, spreadArgCount))
+            return null;
+        // in  arglist: [0: ...keep1 | spos: spreadArg | spos+1:      keep2... ]
+        // out arglist: [0: ...keep1 | spos: spread... | spos+scount: keep2... ]
+        int keep2OutPos  = spreadArgPos + spreadArgCount;
+        int spreadSlot   = targetType.parameterSlotDepth(keep2OutPos);
+        int keep1OutSlot = targetType.parameterSlotDepth(spreadArgPos);
+        int slotCount    = keep1OutSlot - spreadSlot;
+        assert(spreadSlot == newType.parameterSlotDepth(spreadArgPos+1));
+        assert(slotCount >= spreadArgCount);
+        long conv = makeConv(OP_SPREAD_ARGS, spreadArgPos, slotCount-1);
+        MethodHandle res = new AdapterMethodHandle(target, newType, conv, spreadArgType);
+        assert(res.type().parameterType(spreadArgPos) == spreadArgType);
+        return res;
+    }
+
+    // TO DO: makeCollectArguments, makeFlyby, makeRicochet
+
+    @Override
+    public String toString() {
+        return getNameString(nonAdapter((MethodHandle)vmtarget), this);
+    }
+
+    private static MethodHandle nonAdapter(MethodHandle mh) {
+        while (mh instanceof AdapterMethodHandle) {
+            mh = (MethodHandle) mh.vmtarget;
+        }
+        return mh;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.VerifyType;
+import sun.invoke.util.Wrapper;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * The flavor of method handle which emulates an invoke instruction
+ * on a predetermined argument.  The JVM dispatches to the correct method
+ * when the handle is created, not when it is invoked.
+ * @author jrose
+ */
+class BoundMethodHandle extends MethodHandle {
+    //MethodHandle vmtarget;           // next BMH or final DMH or methodOop
+    private final Object argument;     // argument to insert
+    private final int    vmargslot;    // position at which it is inserted
+
+    // Constructors in this class *must* be package scoped or private.
+
+    /** Bind a direct MH to its receiver (or first ref. argument).
+     *  The JVM will pre-dispatch the MH if it is not already static.
+     */
+    /*non-public*/ BoundMethodHandle(DirectMethodHandle mh, Object argument) {
+        super(mh.type().dropParameterTypes(0, 1));
+        // check the type now, once for all:
+        this.argument = checkReferenceArgument(argument, mh, 0);
+        this.vmargslot = this.type().parameterSlotCount();
+        initTarget(mh, 0);
+    }
+
+    /** Insert an argument into an arbitrary method handle.
+     *  If argnum is zero, inserts the first argument, etc.
+     *  The argument type must be a reference.
+     */
+    /*non-public*/ BoundMethodHandle(MethodHandle mh, Object argument, int argnum) {
+        this(mh.type().dropParameterTypes(argnum, argnum+1),
+             mh, argument, argnum);
+    }
+
+    /** Insert an argument into an arbitrary method handle.
+     *  If argnum is zero, inserts the first argument, etc.
+     */
+    /*non-public*/ BoundMethodHandle(MethodType type, MethodHandle mh, Object argument, int argnum) {
+        super(type);
+        if (mh.type().parameterType(argnum).isPrimitive())
+            this.argument = bindPrimitiveArgument(argument, mh, argnum);
+        else {
+            this.argument = checkReferenceArgument(argument, mh, argnum);
+        }
+        this.vmargslot = type.parameterSlotDepth(argnum);
+        initTarget(mh, argnum);
+    }
+
+    private void initTarget(MethodHandle mh, int argnum) {
+        //this.vmtarget = mh;  // maybe updated by JVM
+        MethodHandleNatives.init(this, mh, argnum);
+    }
+
+    /** For the AdapterMethodHandle subclass.
+     */
+    /*non-public*/ BoundMethodHandle(MethodType type, Object argument, int vmargslot) {
+        super(type);
+        this.argument = argument;
+        this.vmargslot = vmargslot;
+        assert(this instanceof AdapterMethodHandle);
+    }
+
+    /** Initialize the current object as a self-bound method handle, binding it
+     *  as the first argument of the method handle {@code entryPoint}.
+     *  The invocation type of the resulting method handle will be the
+     *  same as {@code entryPoint},  except that the first argument
+     *  type will be dropped.
+     */
+    /*non-public*/ BoundMethodHandle(MethodHandle entryPoint) {
+        super(entryPoint.type().dropParameterTypes(0, 1));
+        this.argument = this; // kludge; get rid of
+        this.vmargslot = this.type().parameterSlotDepth(0);
+        initTarget(entryPoint, 0);
+    }
+
+    /** Make sure the given {@code argument} can be used as {@code argnum}-th
+     *  parameter of the given method handle {@code mh}, which must be a reference.
+     *  <p>
+     *  If this fails, throw a suitable {@code WrongMethodTypeException},
+     *  which will prevent the creation of an illegally typed bound
+     *  method handle.
+     */
+    final static Object checkReferenceArgument(Object argument, MethodHandle mh, int argnum) {
+        Class<?> ptype = mh.type().parameterType(argnum);
+        if (ptype.isPrimitive()) {
+            // fail
+        } else if (argument == null) {
+            return null;
+        } else if (VerifyType.isNullReferenceConversion(argument.getClass(), ptype)) {
+            return argument;
+        }
+        throw badBoundArgumentException(argument, mh, argnum);
+    }
+
+    /** Make sure the given {@code argument} can be used as {@code argnum}-th
+     *  parameter of the given method handle {@code mh}, which must be a primitive.
+     *  <p>
+     *  If this fails, throw a suitable {@code WrongMethodTypeException},
+     *  which will prevent the creation of an illegally typed bound
+     *  method handle.
+     */
+    final static Object bindPrimitiveArgument(Object argument, MethodHandle mh, int argnum) {
+        Class<?> ptype = mh.type().parameterType(argnum);
+        Wrapper  wrap = Wrapper.forPrimitiveType(ptype);
+        Object   zero  = wrap.zero();
+        if (zero == null) {
+            // fail
+        } else if (argument == null) {
+            if (ptype != int.class && wrap.isSubwordOrInt())
+                return Integer.valueOf(0);
+            else
+                return zero;
+        } else if (VerifyType.isNullReferenceConversion(argument.getClass(), zero.getClass())) {
+            if (ptype != int.class && wrap.isSubwordOrInt())
+                return Wrapper.INT.wrap(argument);
+            else
+                return argument;
+        }
+        throw badBoundArgumentException(argument, mh, argnum);
+    }
+
+    final static RuntimeException badBoundArgumentException(Object argument, MethodHandle mh, int argnum) {
+        String atype = (argument == null) ? "null" : argument.getClass().toString();
+        return new WrongMethodTypeException("cannot bind "+atype+" argument to parameter #"+argnum+" of "+mh.type());
+    }
+
+    @Override
+    public String toString() {
+        return addTypeString(baseName(), this);
+    }
+
+    /** Component of toString() before the type string. */
+    protected String baseName() {
+        MethodHandle mh = this;
+        while (mh instanceof BoundMethodHandle) {
+            Object info = MethodHandleNatives.getTargetInfo(mh);
+            if (info instanceof MethodHandle) {
+                mh = (MethodHandle) info;
+            } else {
+                String name = null;
+                if (info instanceof MemberName)
+                    name = ((MemberName)info).getName();
+                if (name != null)
+                    return name;
+                else
+                    return noParens(super.toString()); // "invoke", probably
+            }
+            assert(mh != this);
+        }
+        return noParens(mh.toString());
+    }
+
+    private static String noParens(String str) {
+        int paren = str.indexOf('(');
+        if (paren >= 0) str = str.substring(0, paren);
+        return str;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/CallSite.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.empty.Empty;
+import sun.misc.Unsafe;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * A {@code CallSite} is a holder for a variable {@link MethodHandle},
+ * which is called its {@code target}.
+ * An {@code invokedynamic} instruction linked to a {@code CallSite} delegates
+ * all calls to the site's current target.
+ * A {@code CallSite} may be associated with several {@code invokedynamic}
+ * instructions, or it may be "free floating", associated with none.
+ * In any case, it may be invoked through an associated method handle
+ * called its {@linkplain #dynamicInvoker dynamic invoker}.
+ * <p>
+ * {@code CallSite} is an abstract class which does not allow
+ * direct subclassing by users.  It has three immediate,
+ * concrete subclasses that may be either instantiated or subclassed.
+ * <ul>
+ * <li>If a mutable target is not required, an {@code invokedynamic} instruction
+ * may be permanently bound by means of a {@linkplain ConstantCallSite constant call site}.
+ * <li>If a mutable target is required which has volatile variable semantics,
+ * because updates to the target must be immediately and reliably witnessed by other threads,
+ * a {@linkplain VolatileCallSite volatile call site} may be used.
+ * <li>Otherwise, if a mutable target is required,
+ * a {@linkplain MutableCallSite mutable call site} may be used.
+ * </ul>
+ * <p>
+ * A non-constant call site may be <em>relinked</em> by changing its target.
+ * The new target must have the same {@linkplain MethodHandle#type() type}
+ * as the previous target.
+ * Thus, though a call site can be relinked to a series of
+ * successive targets, it cannot change its type.
+ * <p>
+ * Here is a sample use of call sites and bootstrap methods which links every
+ * dynamic call site to print its arguments:
+<blockquote><pre><!-- see indy-demo/src/PrintArgsDemo.java -->
+static void test() throws Throwable {
+    // THE FOLLOWING LINE IS PSEUDOCODE FOR A JVM INSTRUCTION
+    InvokeDynamic[#bootstrapDynamic].baz("baz arg", 2, 3.14);
+}
+private static void printArgs(Object... args) {
+  System.out.println(java.util.Arrays.deepToString(args));
+}
+private static final MethodHandle printArgs;
+static {
+  MethodHandles.Lookup lookup = MethodHandles.lookup();
+  Class thisClass = lookup.lookupClass();  // (who am I?)
+  printArgs = lookup.findStatic(thisClass,
+      "printArgs", MethodType.methodType(void.class, Object[].class));
+}
+private static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String name, MethodType type) {
+  // ignore caller and name, but match the type:
+  return new ConstantCallSite(printArgs.asType(type));
+}
+</pre></blockquote>
+ * @author John Rose, JSR 292 EG
+ */
+abstract
+public class CallSite {
+    static { MethodHandleImpl.initStatics(); }
+
+    // Fields used only by the JVM.  Do not use or change.
+    private MemberName vmmethod; // supplied by the JVM (ref. to calling method)
+    private int        vmindex;  // supplied by the JVM (BCI within calling method)
+
+    // The actual payload of this call site:
+    /*package-private*/
+    MethodHandle target;
+
+    /**
+     * Make a blank call site object with the given method type.
+     * An initial target method is supplied which will throw
+     * an {@link IllegalStateException} if called.
+     * <p>
+     * Before this {@code CallSite} object is returned from a bootstrap method,
+     * it is usually provided with a more useful target method,
+     * via a call to {@link CallSite#setTarget(MethodHandle) setTarget}.
+     * @throws NullPointerException if the proposed type is null
+     */
+    /*package-private*/
+    CallSite(MethodType type) {
+        target = type.invokers().uninitializedCallSite();
+    }
+
+    /**
+     * Make a blank call site object, possibly equipped with an initial target method handle.
+     * @param target the method handle which will be the initial target of the call site
+     * @throws NullPointerException if the proposed target is null
+     */
+    /*package-private*/
+    CallSite(MethodHandle target) {
+        target.type();  // null check
+        this.target = target;
+    }
+
+    /**
+     * Returns the type of this call site's target.
+     * Although targets may change, any call site's type is permanent, and can never change to an unequal type.
+     * The {@code setTarget} method enforces this invariant by refusing any new target that does
+     * not have the previous target's type.
+     * @return the type of the current target, which is also the type of any future target
+     */
+    public MethodType type() {
+        return target.type();
+    }
+
+    /** Called from JVM (or low-level Java code) after the BSM returns the newly created CallSite.
+     *  The parameters are JVM-specific.
+     */
+    void initializeFromJVM(String name,
+                           MethodType type,
+                           MemberName callerMethod,
+                           int        callerBCI) {
+        if (this.vmmethod != null) {
+            // FIXME
+            throw new BootstrapMethodError("call site has already been linked to an invokedynamic instruction");
+        }
+        if (!this.type().equals(type)) {
+            throw wrongTargetType(target, type);
+        }
+        this.vmindex  = callerBCI;
+        this.vmmethod = callerMethod;
+    }
+
+    /**
+     * Returns the target method of the call site, according to the
+     * behavior defined by this call site's specific class.
+     * The immediate subclasses of {@code CallSite} document the
+     * class-specific behaviors of this method.
+     *
+     * @return the current linkage state of the call site, its target method handle
+     * @see ConstantCallSite
+     * @see VolatileCallSite
+     * @see #setTarget
+     * @see ConstantCallSite#getTarget
+     * @see MutableCallSite#getTarget
+     * @see VolatileCallSite#getTarget
+     */
+    public abstract MethodHandle getTarget();
+
+    /**
+     * Updates the target method of this call site, according to the
+     * behavior defined by this call site's specific class.
+     * The immediate subclasses of {@code CallSite} document the
+     * class-specific behaviors of this method.
+     * <p>
+     * The type of the new target must be {@linkplain MethodType#equals equal to}
+     * the type of the old target.
+     *
+     * @param newTarget the new target
+     * @throws NullPointerException if the proposed new target is null
+     * @throws WrongMethodTypeException if the proposed new target
+     *         has a method type that differs from the previous target
+     * @see CallSite#getTarget
+     * @see ConstantCallSite#setTarget
+     * @see MutableCallSite#setTarget
+     * @see VolatileCallSite#setTarget
+     */
+    public abstract void setTarget(MethodHandle newTarget);
+
+    void checkTargetChange(MethodHandle oldTarget, MethodHandle newTarget) {
+        MethodType oldType = oldTarget.type();
+        MethodType newType = newTarget.type();  // null check!
+        if (!newType.equals(oldType))
+            throw wrongTargetType(newTarget, oldType);
+    }
+
+    private static WrongMethodTypeException wrongTargetType(MethodHandle target, MethodType type) {
+        return new WrongMethodTypeException(String.valueOf(target)+" should be of type "+type);
+    }
+
+    /**
+     * Produces a method handle equivalent to an invokedynamic instruction
+     * which has been linked to this call site.
+     * <p>
+     * This method is equivalent to the following code:
+     * <blockquote><pre>
+     * MethodHandle getTarget, invoker, result;
+     * getTarget = MethodHandles.publicLookup().bind(this, "getTarget", MethodType.methodType(MethodHandle.class));
+     * invoker = MethodHandles.exactInvoker(this.type());
+     * result = MethodHandles.foldArguments(invoker, getTarget)
+     * </pre></blockquote>
+     *
+     * @return a method handle which always invokes this call site's current target
+     */
+    public abstract MethodHandle dynamicInvoker();
+
+    /*non-public*/ MethodHandle makeDynamicInvoker() {
+        MethodHandle getTarget = MethodHandleImpl.bindReceiver(GET_TARGET, this);
+        MethodHandle invoker = MethodHandles.exactInvoker(this.type());
+        return MethodHandles.foldArguments(invoker, getTarget);
+    }
+
+    private static final MethodHandle GET_TARGET;
+    static {
+        try {
+            GET_TARGET = IMPL_LOOKUP.
+                findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
+        } catch (ReflectiveOperationException ignore) {
+            throw new InternalError();
+        }
+    }
+
+    /** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
+    /*package-private*/
+    static Empty uninitializedCallSite() {
+        throw new IllegalStateException("uninitialized call site");
+    }
+
+    // unsafe stuff:
+    private static final Unsafe unsafe = Unsafe.getUnsafe();
+    private static final long TARGET_OFFSET;
+
+    static {
+        try {
+            TARGET_OFFSET = unsafe.objectFieldOffset(CallSite.class.getDeclaredField("target"));
+        } catch (Exception ex) { throw new Error(ex); }
+    }
+
+    /*package-private*/
+    void setTargetNormal(MethodHandle newTarget) {
+        target = newTarget;
+    }
+    /*package-private*/
+    MethodHandle getTargetVolatile() {
+        return (MethodHandle) unsafe.getObjectVolatile(this, TARGET_OFFSET);
+    }
+    /*package-private*/
+    void setTargetVolatile(MethodHandle newTarget) {
+        unsafe.putObjectVolatile(this, TARGET_OFFSET, newTarget);
+    }
+
+    // this implements the upcall from the JVM, MethodHandleNatives.makeDynamicCallSite:
+    static CallSite makeSite(MethodHandle bootstrapMethod,
+                             // Callee information:
+                             String name, MethodType type,
+                             // Extra arguments for BSM, if any:
+                             Object info,
+                             // Caller information:
+                             MemberName callerMethod, int callerBCI) {
+        Class<?> callerClass = callerMethod.getDeclaringClass();
+        Object caller = IMPL_LOOKUP.in(callerClass);
+        CallSite site;
+        try {
+            Object binding;
+            info = maybeReBox(info);
+            if (info == null) {
+                binding = bootstrapMethod.invokeGeneric(caller, name, type);
+            } else if (!info.getClass().isArray()) {
+                binding = bootstrapMethod.invokeGeneric(caller, name, type, info);
+            } else {
+                Object[] argv = (Object[]) info;
+                maybeReBoxElements(argv);
+                if (3 + argv.length > 255)
+                    throw new BootstrapMethodError("too many bootstrap method arguments");
+                MethodType bsmType = bootstrapMethod.type();
+                if (bsmType.parameterCount() == 4 && bsmType.parameterType(3) == Object[].class)
+                    binding = bootstrapMethod.invokeGeneric(caller, name, type, argv);
+                else
+                    binding = MethodHandles.spreadInvoker(bsmType, 3)
+                        .invokeGeneric(bootstrapMethod, caller, name, type, argv);
+            }
+            //System.out.println("BSM for "+name+type+" => "+binding);
+            if (binding instanceof CallSite) {
+                site = (CallSite) binding;
+            }  else {
+                throw new ClassCastException("bootstrap method failed to produce a CallSite");
+            }
+            assert(site.getTarget() != null);
+            assert(site.getTarget().type().equals(type));
+        } catch (Throwable ex) {
+            BootstrapMethodError bex;
+            if (ex instanceof BootstrapMethodError)
+                bex = (BootstrapMethodError) ex;
+            else
+                bex = new BootstrapMethodError("call site initialization exception", ex);
+            throw bex;
+        }
+        return site;
+    }
+
+    private static Object maybeReBox(Object x) {
+        if (x instanceof Integer) {
+            int xi = (int) x;
+            if (xi == (byte) xi)
+                x = xi;  // must rebox; see JLS 5.1.7
+        }
+        return x;
+    }
+    private static void maybeReBoxElements(Object[] xa) {
+        for (int i = 0; i < xa.length; i++) {
+            xa[i] = maybeReBox(xa[i]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/ConstantCallSite.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2010, 2011, 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 java.lang.invoke;
+
+/**
+ * A {@code ConstantCallSite} is a {@link CallSite} whose target is permanent, and can never be changed.
+ * An {@code invokedynamic} instruction linked to a {@code ConstantCallSite} is permanently
+ * bound to the call site's target.
+ * @author John Rose, JSR 292 EG
+ */
+public class ConstantCallSite extends CallSite {
+    /**
+     * Creates a call site with a permanent target.
+     * @param target the target to be permanently associated with this call site
+     * @throws NullPointerException if the proposed target is null
+     */
+    public ConstantCallSite(MethodHandle target) {
+        super(target);
+    }
+
+    /**
+     * Returns the target method of the call site, which behaves
+     * like a {@code final} field of the {@code ConstantCallSite}.
+     * That is, the the target is always the original value passed
+     * to the constructor call which created this instance.
+     *
+     * @return the immutable linkage state of this call site, a constant method handle
+     * @throws UnsupportedOperationException because this kind of call site cannot change its target
+     */
+    @Override public final MethodHandle getTarget() {
+        return target;
+    }
+
+    /**
+     * Always throws an {@link UnsupportedOperationException}.
+     * This kind of call site cannot change its target.
+     * @param ignore a new target proposed for the call site, which is ignored
+     * @throws UnsupportedOperationException because this kind of call site cannot change its target
+     */
+    @Override public final void setTarget(MethodHandle ignore) {
+        throw new UnsupportedOperationException("ConstantCallSite");
+    }
+
+    /**
+     * Returns this call site's permanent target.
+     * Since that target will never change, this is a correct implementation
+     * of {@link CallSite#dynamicInvoker CallSite.dynamicInvoker}.
+     * @return the immutable linkage state of this call site, a constant method handle
+     */
+    @Override
+    public final MethodHandle dynamicInvoker() {
+        return getTarget();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
+
+/**
+ * The flavor of method handle which emulates invokespecial or invokestatic.
+ * @author jrose
+ */
+class DirectMethodHandle extends MethodHandle {
+    //inherited oop    vmtarget;    // methodOop or virtual class/interface oop
+    private final int  vmindex;     // method index within class or interface
+    { vmindex = VM_INDEX_UNINITIALIZED; }  // JVM may change this
+
+    // Constructors in this class *must* be package scoped or private.
+    DirectMethodHandle(MethodType mtype, MemberName m, boolean doDispatch, Class<?> lookupClass) {
+        super(mtype);
+
+        assert(m.isMethod() || !doDispatch && m.isConstructor());
+        if (!m.isResolved())
+            throw new InternalError();
+
+        MethodHandleNatives.init(this, (Object) m, doDispatch, lookupClass);
+    }
+
+    boolean isValid() {
+        return (vmindex != VM_INDEX_UNINITIALIZED);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/FilterGeneric.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,4496 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import java.lang.reflect.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * These adapters apply arbitrary conversions to arguments
+ * on the way to a ultimate target.
+ * For simplicity, these are all generically typed.
+ * @author jrose
+ */
+class FilterGeneric {
+    // type for the incoming call (will be generic)
+    private final MethodType entryType;
+    // prototype adapters (clone and customize for each new target & conversion!)
+    private final Adapter[] adapters;
+
+    /** Compute and cache information common to all filtering adapters
+     *  with the given generic type
+     */
+    FilterGeneric(MethodType entryType) {
+        this.entryType = entryType;
+        int tableSize = Kind.LIMIT.invokerIndex(1 + entryType.parameterCount());
+        this.adapters = new Adapter[tableSize];
+    }
+
+    Adapter getAdapter(Kind kind, int pos) {
+        int index = kind.invokerIndex(pos);
+        Adapter ad = adapters[index];
+        if (ad != null)  return ad;
+        ad = findAdapter(entryType, kind, pos);
+        if (ad == null)
+            ad = buildAdapterFromBytecodes(entryType, kind, pos);
+        adapters[index] = ad;
+        return ad;
+    }
+
+    Adapter makeInstance(Kind kind, int pos, MethodHandle filter, MethodHandle target) {
+        Adapter ad = getAdapter(kind, pos);
+        return ad.makeInstance(ad.prototypeEntryPoint(), filter, target);
+    }
+
+    /** Build an adapter of the given generic type, which invokes filter
+     *  on the selected incoming argument before passing it to the target.
+     * @param pos the argument to filter
+     * @param filter the function to call on the argument
+     * @param target the target to call with the modified argument list
+     * @return an adapter method handle
+     */
+    public static MethodHandle makeArgumentFilter(int pos, MethodHandle filter, MethodHandle target) {
+        return make(Kind.value, pos, filter, target);
+    }
+
+    /** Build an adapter of the given generic type, which invokes a combiner
+     *  on a selected group of leading arguments.
+     *  The result of the combiner is prepended before all those arguments.
+     * @param combiner the function to call on the selected leading arguments
+     * @param target the target to call with the modified argument list
+     * @return an adapter method handle
+     */
+    public static MethodHandle makeArgumentFolder(MethodHandle combiner, MethodHandle target) {
+        int num = combiner.type().parameterCount();
+        return make(Kind.fold, num, combiner, target);
+    }
+
+    /** Build an adapter of the given generic type, which invokes a filter
+     *  on the incoming arguments, reified as a group.
+     *  The argument may be modified (by side effects in the filter).
+     *  The arguments, possibly modified, are passed on to the target.
+     * @param filter the function to call on the arguments
+     * @param target the target to call with the possibly-modified argument list
+     * @return an adapter method handle
+     */
+    public static MethodHandle makeFlyby(MethodHandle filter, MethodHandle target) {
+        return make(Kind.flyby, 0, filter, target);
+    }
+
+    /** Build an adapter of the given generic type, which invokes a collector
+     *  on the selected incoming argument and all following arguments.
+     *  The result of the collector replaces all those arguments.
+     * @param collector the function to call on the selected trailing arguments
+     * @param target the target to call with the modified argument list
+     * @return an adapter method handle
+     */
+    public static MethodHandle makeArgumentCollector(MethodHandle collector, MethodHandle target) {
+        int pos = target.type().parameterCount() - 1;
+        return make(Kind.collect, pos, collector, target);
+    }
+
+    static MethodHandle make(Kind kind, int pos, MethodHandle filter, MethodHandle target) {
+        FilterGeneric fgen = of(kind, pos, filter.type(), target.type());
+        return fgen.makeInstance(kind, pos, filter, target);
+    }
+
+    /** Return the adapter information for this target and filter type. */
+    static FilterGeneric of(Kind kind, int pos, MethodType filterType, MethodType targetType) {
+        MethodType entryType = entryType(kind, pos, filterType, targetType);
+        if (entryType.generic() != entryType)
+            throw newIllegalArgumentException("must be generic: "+entryType);
+        MethodTypeForm form = entryType.form();
+        FilterGeneric filterGen = form.filterGeneric;
+        if (filterGen == null)
+            form.filterGeneric = filterGen = new FilterGeneric(entryType);
+        return filterGen;
+    }
+
+    public String toString() {
+        return "FilterGeneric/"+entryType;
+    }
+
+    static MethodType targetType(MethodType entryType, Kind kind, int pos, MethodType filterType) {
+        MethodType type = entryType;
+        switch (kind) {
+            case value:
+            case flyby:
+                break;  // no change
+            case fold:
+                type = type.insertParameterTypes(0, filterType.returnType());
+                break;
+            case collect:
+                type = type.dropParameterTypes(pos, type.parameterCount());
+                type = type.insertParameterTypes(pos, filterType.returnType());
+                break;
+            default:
+                throw new InternalError();
+        }
+        return type;
+    }
+
+    static MethodType entryType(Kind kind, int pos, MethodType filterType, MethodType targetType) {
+        MethodType type = targetType;
+        switch (kind) {
+            case value:
+            case flyby:
+                break;  // no change
+            case fold:
+                type = type.dropParameterTypes(0, 1);
+                break;
+            case collect:
+                type = type.dropParameterTypes(pos, pos+1);
+                type = type.insertParameterTypes(pos, filterType.parameterList());
+                break;
+            default:
+                throw new InternalError();
+        }
+        return type;
+    }
+
+    /* Create an adapter that handles spreading calls for the given type. */
+    static Adapter findAdapter(MethodType entryType, Kind kind, int pos) {
+        int argc = entryType.parameterCount();
+        String cname0 = "F"+argc;
+        String cname1 = "F"+argc+kind.key;
+        String[] cnames = { cname0, cname1 };
+        String iname = kind.invokerName(pos);
+        // e.g., F5; invoke_C3
+        for (String cname : cnames) {
+            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
+            if (acls == null)  continue;
+            // see if it has the required invoke method
+            MethodHandle entryPoint = null;
+            try {
+                entryPoint = IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
+            } catch (ReflectiveOperationException ex) {
+            }
+            if (entryPoint == null)  continue;
+            Constructor<? extends Adapter> ctor = null;
+            try {
+                ctor = acls.getDeclaredConstructor(MethodHandle.class);
+            } catch (NoSuchMethodException ex) {
+            } catch (SecurityException ex) {
+            }
+            if (ctor == null)  continue;
+            try {
+                // Produce an instance configured as a prototype.
+                return ctor.newInstance(entryPoint);
+            } catch (IllegalArgumentException ex) {
+            } catch (InvocationTargetException wex) {
+                Throwable ex = wex.getTargetException();
+                if (ex instanceof Error)  throw (Error)ex;
+                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
+            } catch (InstantiationException ex) {
+            } catch (IllegalAccessException ex) {
+            }
+        }
+        return null;
+    }
+
+    static Adapter buildAdapterFromBytecodes(MethodType entryType, Kind kind, int pos) {
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    /**
+     * This adapter takes some untyped arguments, and returns an untyped result.
+     * Internally, it applies the invoker to the target, which causes the
+     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
+     * This result is passed to convert, which is responsible for
+     * converting the raw result into a boxed object.
+     * The invoker is kept separate from the target because it can be
+     * generated once per type erasure family, and reused across adapters.
+     */
+    static abstract class Adapter extends BoundMethodHandle {
+        protected final MethodHandle filter; // transforms one or more arguments
+        protected final MethodHandle target; // ultimate target
+
+        @Override
+        public String toString() {
+            return addTypeString(target, this);
+        }
+
+        protected boolean isPrototype() { return target == null; }
+        protected Adapter(MethodHandle entryPoint) {
+            this(entryPoint, entryPoint, null);
+            assert(isPrototype());
+        }
+        protected MethodHandle prototypeEntryPoint() {
+            if (!isPrototype())  throw new InternalError();
+            return filter;
+        }
+
+        protected Adapter(MethodHandle entryPoint,
+                          MethodHandle filter, MethodHandle target) {
+            super(entryPoint);
+            this.filter = filter;
+            this.target = target;
+        }
+
+        /** Make a copy of self, with new fields. */
+        protected abstract Adapter makeInstance(MethodHandle entryPoint,
+                MethodHandle filter, MethodHandle target);
+        // { return new ThisType(entryPoint, filter, target); }
+
+        static private final String CLASS_PREFIX; // "java.lang.invoke.FilterGeneric$"
+        static {
+            String aname = Adapter.class.getName();
+            String sname = Adapter.class.getSimpleName();
+            if (!aname.endsWith(sname))  throw new InternalError();
+            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
+        }
+        /** Find a sibing class of Adapter. */
+        static Class<? extends Adapter> findSubClass(String name) {
+            String cname = Adapter.CLASS_PREFIX + name;
+            try {
+                return Class.forName(cname).asSubclass(Adapter.class);
+            } catch (ClassNotFoundException ex) {
+                return null;
+            } catch (ClassCastException ex) {
+                return null;
+            }
+        }
+    }
+
+    static enum Kind {
+        value('V'),      // filter and replace Nth argument value
+        fold('F'),       // fold first N arguments, prepend result
+        collect('C'),    // collect last N arguments, replace with result
+        flyby('Y'),      // reify entire argument list, filter, pass to target
+        LIMIT('?');
+        static final int COUNT = LIMIT.ordinal();
+
+        final char key;
+        Kind(char key) { this.key = key; }
+        String invokerName(int pos) { return "invoke_"+key+""+pos; }
+        int invokerIndex(int pos) { return pos * COUNT + ordinal(); }
+    }
+
+    /* generated classes follow this pattern:
+    static class F1X extends Adapter {
+        protected F1X(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F1X(MethodHandle e, MethodHandle f, MethodHandle t)
+                        { super(e, f, t); }
+        protected F1X makeInstance(MethodHandle e, MethodHandle f, MethodHandle t)
+                        { return new F1X(e, f, t); }
+        protected Object invoke_V0(Object a0) { return target.invokeExact(filter.invokeExact(a0)); }
+        protected Object invoke_F0(Object a0) { return target.invokeExact(filter.invokeExact(), a0); }
+        protected Object invoke_F1(Object a0) { return target.invokeExact(filter.invokeExact(a0), a0); }
+        protected Object invoke_C0(Object a0) { return target.invokeExact(filter.invokeExact(a0)); }
+        protected Object invoke_C1(Object a0) { return target.invokeExact(a0, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0) { Object[] av = { a0 };
+                       filter.invokeExact(av); return target.invokeExact(av[0]); }
+    }
+    static class F2X extends Adapter {
+        protected F2X(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F2X(MethodHandle e, MethodHandle f, MethodHandle t)
+                        { super(e, f, t); }
+        protected F2X makeInstance(MethodHandle e, MethodHandle f, MethodHandle t)
+                        { return new F2X(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0), a1); }
+        protected Object invoke_V1(Object a0, Object a1) { return target.invokeExact(a0, filter.invokeExact(a1)); }
+        protected Object invoke_F0(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(), a0, a1); }
+        protected Object invoke_F1(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0), a0, a1); }
+        protected Object invoke_F2(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0, a1), a0, a1); }
+        protected Object invoke_C0(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0, a1)); }
+        protected Object invoke_C1(Object a0, Object a1) { return target.invokeExact(a0, filter.invokeExact(a1)); }
+        protected Object invoke_C2(Object a0, Object a1) { return target.invokeExact(a0, a1, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1) { Object[] av = { a0, a1 };
+                       filter.invokeExact(av); return target.invokeExact(av[0], av[1]); }
+    }
+    // */
+
+    // This one is written by hand:
+    static class F0 extends Adapter {
+        protected F0(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F0(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F0 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F0(e, f, t); }
+        protected Object invoke_F0() throws Throwable {
+            return target.invokeExact(filter.invokeExact()); }
+        protected Object invoke_C0() throws Throwable {
+            return target.invokeExact(filter.invokeExact()); }
+        static final Object[] NO_ARGS = { };
+        protected Object invoke_Y0() throws Throwable {
+            filter.invokeExact(NO_ARGS); // make the flyby
+            return target.invokeExact(); }
+    }
+
+/*
+  : SHELL; n=FilterGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -ea -cp . genclasses | sed 's| *[/]/ *$||') >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
+//{{{
+import java.util.*;
+class genclasses {
+    static String[][] TEMPLATES = { {
+        "@for@ N=1..20",
+        "    //@each-cat@",
+        "    static class @cat@ extends Adapter {",
+        "        protected @cat@(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype",
+        "        protected @cat@(MethodHandle e, MethodHandle f, MethodHandle t) {",
+        "            super(e, f, t); }",
+        "        protected @cat@ makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {",
+        "            return new @cat@(e, f, t); }",
+        "        //@each-P@",
+        "        protected Object invoke_V@P@(@Tvav@) throws Throwable {",
+        "            return target.invokeExact(@a0_@@Psp@filter.invokeExact(a@P@)@_aN@); }",
+        "        //@end-P@",
+        "        //@each-P@",
+        "        protected Object invoke_F@P@(@Tvav@) throws Throwable {",
+        "            return target.invokeExact(filter.invokeExact(@a0@),",
+        "                                 @av@); }",
+        "        //@end-P@",
+        "        protected Object invoke_F@N@(@Tvav@) throws Throwable {",
+        "            return target.invokeExact(filter.invokeExact(@av@),",
+        "                                 @av@); }",
+        "        //@each-P@",
+        "        protected Object invoke_C@P@(@Tvav@) throws Throwable {",
+        "            return target.invokeExact(@a0_@filter.invokeExact(a@P@@_aN@)); }",
+        "        //@end-P@",
+        "        protected Object invoke_C@N@(@Tvav@) throws Throwable {",
+        "            return target.invokeExact(@av@, filter.invokeExact()); }",
+        "        protected Object invoke_Y0(@Tvav@) throws Throwable {",
+        "            Object[] av = { @av@ };",
+        "            filter.invokeExact(av); // make the flyby",
+        "            return target.invokeExact(@av[i]@); }",
+        "    }",
+    } };
+    static final String NEWLINE_INDENT = " //\n                                 ";
+    enum VAR {
+        cat, N, P, Tvav, av, a0, a0_, _aN, Psp, av_i_;
+        public final String pattern = "@"+toString().replace('_','.')+"@";
+        public String binding = toString();
+        static void makeBindings(boolean topLevel, int inargs, int pos) {
+            assert(-1 <= pos && pos < inargs);
+            VAR.cat.binding = "F"+inargs;
+            VAR.N.binding = String.valueOf(inargs); // incoming arg count
+            VAR.P.binding = String.valueOf(pos);  // selected arg position
+            String[] av = new String[inargs];
+            String[] Tvav = new String[inargs];
+            String[] av_i_ = new String[inargs];
+            for (int i = 0; i < inargs; i++) {
+                av[i] = arg(i);
+                av_i_[i] = "av["+i+"]";
+                String spc = "";
+                if (i > 0 && i % 4 == 0) spc = NEWLINE_INDENT+(pos>9?" ":"")+"  ";
+                Tvav[i] = spc+param("Object", av[i]);
+            }
+            VAR.av.binding = comma(av);
+            VAR.av_i_.binding = comma(av_i_);
+            VAR.Tvav.binding = comma(Tvav);
+            if (pos >= 0) {
+                VAR.Psp.binding = (pos > 0 && pos % 10 == 0) ? NEWLINE_INDENT : "";
+                String[] a0 = new String[pos];
+                String[] aN = new String[inargs - (pos+1)];
+                for (int i = 0; i < pos; i++) {
+                    String spc = "";
+                    if (i > 0 && i % 10 == 0) spc = NEWLINE_INDENT;
+                    a0[i] = spc+av[i];
+                }
+                VAR.a0.binding = comma(a0);
+                VAR.a0_.binding = comma(a0, ", ");
+                for (int i = pos+1; i < inargs; i++) {
+                    String spc = "";
+                    if (i > 0 && i % 10 == 0) spc = NEWLINE_INDENT;
+                    aN[i - (pos+1)] = spc+av[i];
+                }
+                VAR._aN.binding = comma(", ", aN);
+            }
+        }
+        static String arg(int i) { return "a"+i; }
+        static String param(String t, String a) { return t+" "+a; }
+        static String comma(String[] v) { return comma(v, ""); }
+        static String comma(String[] v, String sep) { return comma("", v, sep); }
+        static String comma(String sep, String[] v) { return comma(sep, v, ""); }
+        static String comma(String sep1, String[] v, String sep2) {
+            if (v.length == 0)  return "";
+            String res = v[0];
+            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
+            return sep1 + res + sep2;
+        }
+        static String transform(String string) {
+            for (VAR var : values())
+                string = string.replaceAll(var.pattern, var.binding);
+            return string;
+        }
+    }
+    static String[] stringsIn(String[] strings, int beg, int end) {
+        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
+    }
+    static String[] stringsBefore(String[] strings, int pos) {
+        return stringsIn(strings, 0, pos);
+    }
+    static String[] stringsAfter(String[] strings, int pos) {
+        return stringsIn(strings, pos, strings.length);
+    }
+    static int indexAfter(String[] strings, int pos, String tag) {
+        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
+    }
+    static int indexBefore(String[] strings, int pos, String tag) {
+        for (int i = pos, end = strings.length; ; i++) {
+            if (i == end || strings[i].endsWith(tag))  return i;
+        }
+    }
+    static int MIN_ARITY, MAX_ARITY;
+    public static void main(String... av) {
+        for (String[] template : TEMPLATES) {
+            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
+            String[] forLines = stringsBefore(template, forLinesLimit);
+            template = stringsAfter(template, forLinesLimit);
+            for (String forLine : forLines)
+                expandTemplate(forLine, template);
+        }
+    }
+    static void expandTemplate(String forLine, String[] template) {
+        String[] params = forLine.split("[^0-9]+");
+        if (params[0].length() == 0)  params = stringsAfter(params, 1);
+        System.out.println("//params="+Arrays.asList(params));
+        int pcur = 0;
+        MIN_ARITY = Integer.valueOf(params[pcur++]);
+        MAX_ARITY = Integer.valueOf(params[pcur++]);
+        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
+        for (int inargs = MIN_ARITY; inargs <= MAX_ARITY; inargs++) {
+            expandTemplate(template, true, inargs, -1);
+        }
+    }
+    static void expandTemplate(String[] template, boolean topLevel, int inargs, int pos) {
+        VAR.makeBindings(topLevel, inargs, pos);
+        for (int i = 0; i < template.length; i++) {
+            String line = template[i];
+            if (line.endsWith("@each-cat@")) {
+                // ignore
+            } else if (line.endsWith("@each-P@")) {
+                int blockEnd = indexAfter(template, i, "@end-P@");
+                String[] block = stringsIn(template, i+1, blockEnd-1);
+                for (int pos1 = Math.max(0,pos); pos1 < inargs; pos1++)
+                    expandTemplate(block, false, inargs, pos1);
+                VAR.makeBindings(topLevel, inargs, pos);
+                i = blockEnd-1; continue;
+            } else {
+                System.out.println(VAR.transform(line));
+            }
+        }
+    }
+}
+//}}} */
+//params=[1, 20]
+    static class F1 extends Adapter {
+        protected F1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F1(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F1 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F1(e, f, t); }
+        protected Object invoke_V0(Object a0) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0)); }
+        protected Object invoke_F0(Object a0) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0); }
+        protected Object invoke_F1(Object a0) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0); }
+        protected Object invoke_C0(Object a0) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0)); }
+        protected Object invoke_C1(Object a0) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0) throws Throwable {
+            Object[] av = { a0 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0]); }
+    }
+    static class F2 extends Adapter {
+        protected F2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F2(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F2 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F2(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1); }
+        protected Object invoke_V1(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1)); }
+        protected Object invoke_F0(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1); }
+        protected Object invoke_F1(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1); }
+        protected Object invoke_F2(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1); }
+        protected Object invoke_C0(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1)); }
+        protected Object invoke_C1(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1)); }
+        protected Object invoke_C2(Object a0, Object a1) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1) throws Throwable {
+            Object[] av = { a0, a1 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1]); }
+    }
+    static class F3 extends Adapter {
+        protected F3(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F3(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F3 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F3(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2) throws Throwable {
+            Object[] av = { a0, a1, a2 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2]); }
+    }
+    static class F4 extends Adapter {
+        protected F4(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F4(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F4 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F4(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            Object[] av = { a0, a1, a2, a3 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3]); }
+    }
+    static class F5 extends Adapter {
+        protected F5(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F5(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F5 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F5(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4]); }
+    }
+    static class F6 extends Adapter {
+        protected F6(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F6(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F6 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F6(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5]); }
+    }
+    static class F7 extends Adapter {
+        protected F7(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F7(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F7 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F7(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6]); }
+    }
+    static class F8 extends Adapter {
+        protected F8(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F8(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F8 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F8(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7]); }
+    }
+    static class F9 extends Adapter {
+        protected F9(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F9(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F9 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F9(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8]); }
+    }
+    static class F10 extends Adapter {
+        protected F10(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F10(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F10 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F10(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9]); }
+    }
+    static class F11 extends Adapter {
+        protected F11(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F11(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F11 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F11(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10]); }
+    }
+    static class F12 extends Adapter {
+        protected F12(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F12(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F12 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F12(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11]); }
+    }
+    static class F13 extends Adapter {
+        protected F13(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F13(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F13 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F13(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12]); }
+    }
+    static class F14 extends Adapter {
+        protected F14(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F14(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F14 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F14(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13]); }
+    }
+    static class F15 extends Adapter {
+        protected F15(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F15(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F15 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F15(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13, a14); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13, a14); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13, a14); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13, a14); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13), a14); }
+        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13, a14)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13, a14)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13, a14)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13, a14)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14)); }
+        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14]); }
+    }
+    static class F16 extends Adapter {
+        protected F16(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F16(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F16 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F16(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13, a14, a15); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13, a14, a15); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13, a14, a15); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13), a14, a15); }
+        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14), a15); }
+        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13, a14, a15)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13, a14, a15)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13, a14, a15)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14, a15)); }
+        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15)); }
+        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15]); }
+    }
+    static class F17 extends Adapter {
+        protected F17(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F17(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F17 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F17(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16); }
+        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16); }
+        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16); }
+        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16)); }
+        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16)); }
+        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16)); }
+        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16]); }
+    }
+    static class F18 extends Adapter {
+        protected F18(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F18(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F18 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F18(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16, a17); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16, a17); }
+        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16, a17); }
+        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16, a17); }
+        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16), a17); }
+        protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16, a17)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16, a17)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16, a17)); }
+        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16, a17)); }
+        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16, a17)); }
+        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17)); }
+        protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17]); }
+    }
+    static class F19 extends Adapter {
+        protected F19(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F19(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F19 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F19(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16, a17, a18); }
+        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16, a17, a18); }
+        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16, a17, a18); }
+        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16), a17, a18); }
+        protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17), a18); }
+        protected Object invoke_V18(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_F19(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16, a17, a18)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16, a17, a18)); }
+        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16, a17, a18)); }
+        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16, a17, a18)); }
+        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17, a18)); }
+        protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18)); }
+        protected Object invoke_C19(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18]); }
+    }
+    static class F20 extends Adapter {
+        protected F20(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected F20(MethodHandle e, MethodHandle f, MethodHandle t) {
+            super(e, f, t); }
+        protected F20 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
+            return new F20(e, f, t); }
+        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16, a17, a18, a19); }
+        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16, a17, a18, a19); }
+        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16), a17, a18, a19); }
+        protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17), a18, a19); }
+        protected Object invoke_V18(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18), a19); }
+        protected Object invoke_V19(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invokeExact(a19)); }
+        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F19(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_F20(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19),
+                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
+        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16, a17, a18, a19)); }
+        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16, a17, a18, a19)); }
+        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16, a17, a18, a19)); }
+        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17, a18, a19)); }
+        protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18, a19)); }
+        protected Object invoke_C19(Object a0, Object a1, Object a2, Object a3,
+                                    Object a4, Object a5, Object a6, Object a7,
+                                    Object a8, Object a9, Object a10, Object a11,
+                                    Object a12, Object a13, Object a14, Object a15,
+                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invokeExact(a19)); }
+        protected Object invoke_C20(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, filter.invokeExact()); }
+        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
+                                   Object a4, Object a5, Object a6, Object a7,
+                                   Object a8, Object a9, Object a10, Object a11,
+                                   Object a12, Object a13, Object a14, Object a15,
+                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
+            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19 };
+            filter.invokeExact(av); // make the flyby
+            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18], av[19]); }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/FilterOneArgument.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Unary function composition, useful for many small plumbing jobs.
+ * The invoke method takes a single reference argument, and returns a reference
+ * Internally, it first calls the {@code filter} method on the argument,
+ * Making up the difference between the raw method type and the
+ * final method type is the responsibility of a JVM-level adapter.
+ * @author jrose
+ */
+class FilterOneArgument extends BoundMethodHandle {
+    protected final MethodHandle filter;  // Object -> Object
+    protected final MethodHandle target;  // Object -> Object
+
+    @Override
+    public String toString() {
+        return target.toString();
+    }
+
+    protected Object invoke(Object argument) throws Throwable {
+        Object filteredArgument = filter.invokeExact(argument);
+        return target.invokeExact(filteredArgument);
+    }
+
+    private static final MethodHandle INVOKE;
+    static {
+        try {
+            INVOKE =
+                IMPL_LOOKUP.findVirtual(FilterOneArgument.class, "invoke",
+                                        MethodType.genericMethodType(1));
+        } catch (ReflectiveOperationException ex) {
+            throw uncaughtException(ex);
+        }
+    }
+
+    protected FilterOneArgument(MethodHandle filter, MethodHandle target) {
+        super(INVOKE);
+        this.filter = filter;
+        this.target = target;
+    }
+
+    public static MethodHandle make(MethodHandle filter, MethodHandle target) {
+        if (filter == null)  return target;
+        if (target == null)  return filter;
+        return new FilterOneArgument(filter, target);
+    }
+
+//    MethodHandle make(MethodHandle filter1, MethodHandle filter2, MethodHandle target) {
+//        MethodHandle filter = make(filter1, filter2);
+//        return make(filter, target);
+//    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/FromGeneric.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,630 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
+import java.lang.reflect.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Adapters which mediate between incoming calls which are generic
+ * and outgoing calls which are not.  Any call can be represented generically
+ * boxing up its arguments, and (on return) unboxing the return value.
+ * <p>
+ * A call is "generic" (in MethodHandle terms) if its MethodType features
+ * only Object arguments.  A non-generic call therefore features
+ * primitives and/or reference types other than Object.
+ * An adapter has types for its incoming and outgoing calls.
+ * The incoming call type is simply determined by the adapter's type
+ * (the MethodType it presents to callers).  The outgoing call type
+ * is determined by the adapter's target (a MethodHandle that the adapter
+ * either binds internally or else takes as a leading argument).
+ * (To stretch the term, adapter-like method handles may have multiple
+ * targets or be polymorphic across multiple call types.)
+ * @author jrose
+ */
+class FromGeneric {
+    // type for the outgoing call (may have primitives, etc.)
+    private final MethodType targetType;
+    // type of the outgoing call internal to the adapter
+    private final MethodType internalType;
+    // prototype adapter (clone and customize for each new target!)
+    private final Adapter adapter;
+    // entry point for adapter (Adapter mh, a...) => ...
+    private final MethodHandle entryPoint;
+    // unboxing invoker of type (MH, Object**N) => raw return value
+    // it makes up the difference of internalType => targetType
+    private final MethodHandle unboxingInvoker;
+    // conversion which boxes a the target's raw return value
+    private final MethodHandle returnConversion;
+
+    /** Compute and cache information common to all unboxing adapters
+     *  that can call out to targets of the erasure-family of the given erased type.
+     */
+    private FromGeneric(MethodType targetType) {
+        this.targetType = targetType;
+        MethodType internalType0;
+        // the target invoker will generally need casts on reference arguments
+        Adapter ad = findAdapter(internalType0 = targetType.erase());
+        if (ad != null) {
+            // Immediate hit to exactly the adapter we want,
+            // with no monkeying around with primitive types.
+            this.internalType = internalType0;
+            this.adapter = ad;
+            this.entryPoint = ad.prototypeEntryPoint();
+            this.returnConversion = computeReturnConversion(targetType, internalType0);
+            this.unboxingInvoker = computeUnboxingInvoker(targetType, internalType0);
+            return;
+        }
+
+        // outgoing primitive arguments will be wrapped; unwrap them
+        MethodType primsAsObj = targetType.form().primArgsAsBoxes();
+        MethodType objArgsRawRet = primsAsObj.form().primsAsInts();
+        if (objArgsRawRet != targetType)
+            ad = findAdapter(internalType0 = objArgsRawRet);
+        if (ad == null) {
+            ad = buildAdapterFromBytecodes(internalType0 = targetType);
+        }
+        this.internalType = internalType0;
+        this.adapter = ad;
+        MethodType tepType = targetType.insertParameterTypes(0, adapter.getClass());
+        this.entryPoint = ad.prototypeEntryPoint();
+        this.returnConversion = computeReturnConversion(targetType, internalType0);
+        this.unboxingInvoker = computeUnboxingInvoker(targetType, internalType0);
+    }
+
+    /**
+     * The typed target will be called according to targetType.
+     * The adapter code will in fact see the raw result from internalType,
+     * and must box it into an object.  Produce a converter for this.
+     */
+    private static MethodHandle computeReturnConversion(
+            MethodType targetType, MethodType internalType) {
+        Class<?> tret = targetType.returnType();
+        Class<?> iret = internalType.returnType();
+        Wrapper wrap = Wrapper.forBasicType(tret);
+        if (!iret.isPrimitive()) {
+            assert(iret == Object.class);
+            return ValueConversions.identity();
+        } else if (wrap.primitiveType() == iret) {
+            return ValueConversions.box(wrap, false);
+        } else {
+            assert(tret == double.class ? iret == long.class : iret == int.class);
+            return ValueConversions.boxRaw(wrap, false);
+        }
+    }
+
+    /**
+     * The typed target will need an exact invocation point; provide it here.
+     * The adapter will possibly need to make a slightly different call,
+     * so adapt the invoker.  This way, the logic for making up the
+     * difference between what the adapter can call and what the target
+     * needs can be cached once per type.
+     */
+    private static MethodHandle computeUnboxingInvoker(
+            MethodType targetType, MethodType internalType) {
+        // All the adapters we have here have reference-untyped internal calls.
+        assert(internalType == internalType.erase());
+        MethodHandle invoker = targetType.invokers().exactInvoker();
+        // cast all narrow reference types, unbox all primitive arguments:
+        MethodType fixArgsType = internalType.changeReturnType(targetType.returnType());
+        MethodHandle fixArgs = MethodHandleImpl.convertArguments(
+                                 invoker, Invokers.invokerType(fixArgsType),
+                                 invoker.type(), null);
+        if (fixArgs == null)
+            throw new InternalError("bad fixArgs");
+        // reinterpret the calling sequence as raw:
+        MethodHandle retyper = AdapterMethodHandle.makeRetypeRaw(
+                                        Invokers.invokerType(internalType), fixArgs);
+        if (retyper == null)
+            throw new InternalError("bad retyper");
+        return retyper;
+    }
+
+    Adapter makeInstance(MethodHandle typedTarget) {
+        MethodType type = typedTarget.type();
+        if (type == targetType) {
+            return adapter.makeInstance(entryPoint, unboxingInvoker, returnConversion, typedTarget);
+        }
+        // my erased-type is not exactly the same as the desired type
+        assert(type.erase() == targetType);  // else we are busted
+        MethodHandle invoker = computeUnboxingInvoker(type, internalType);
+        return adapter.makeInstance(entryPoint, invoker, returnConversion, typedTarget);
+    }
+
+    /** Build an adapter of the given generic type, which invokes typedTarget
+     *  on the incoming arguments, after unboxing as necessary.
+     *  The return value is boxed if necessary.
+     * @param genericType  the required type of the result
+     * @param typedTarget the target
+     * @return an adapter method handle
+     */
+    public static MethodHandle make(MethodHandle typedTarget) {
+        MethodType type = typedTarget.type();
+        if (type == type.generic())  return typedTarget;
+        return FromGeneric.of(type).makeInstance(typedTarget);
+    }
+
+    /** Return the adapter information for this type's erasure. */
+    static FromGeneric of(MethodType type) {
+        MethodTypeForm form = type.form();
+        FromGeneric fromGen = form.fromGeneric;
+        if (fromGen == null)
+            form.fromGeneric = fromGen = new FromGeneric(form.erasedType());
+        return fromGen;
+    }
+
+    public String toString() {
+        return "FromGeneric"+targetType;
+    }
+
+    /* Create an adapter that handles spreading calls for the given type. */
+    static Adapter findAdapter(MethodType internalType) {
+        MethodType entryType = internalType.generic();
+        MethodTypeForm form = internalType.form();
+        Class<?> rtype = internalType.returnType();
+        int argc = form.parameterCount();
+        int lac = form.longPrimitiveParameterCount();
+        int iac = form.primitiveParameterCount() - lac;
+        String intsAndLongs = (iac > 0 ? "I"+iac : "")+(lac > 0 ? "J"+lac : "");
+        String rawReturn = String.valueOf(Wrapper.forPrimitiveType(rtype).basicTypeChar());
+        String cname0 = rawReturn + argc;
+        String cname1 = "A"       + argc;
+        String[] cnames = { cname0+intsAndLongs, cname0, cname1+intsAndLongs, cname1 };
+        String iname = "invoke_"+cname0+intsAndLongs;
+        // e.g., D5I2, D5, L5I2, L5; invoke_D5
+        for (String cname : cnames) {
+            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
+            if (acls == null)  continue;
+            // see if it has the required invoke method
+            MethodHandle entryPoint = null;
+            try {
+                entryPoint = IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
+            } catch (ReflectiveOperationException ex) {
+            }
+            if (entryPoint == null)  continue;
+            Constructor<? extends Adapter> ctor = null;
+            try {
+                ctor = acls.getDeclaredConstructor(MethodHandle.class);
+            } catch (NoSuchMethodException ex) {
+            } catch (SecurityException ex) {
+            }
+            if (ctor == null)  continue;
+            try {
+                // Produce an instance configured as a prototype.
+                return ctor.newInstance(entryPoint);
+            } catch (IllegalArgumentException ex) {
+            } catch (InvocationTargetException wex) {
+                Throwable ex = wex.getTargetException();
+                if (ex instanceof Error)  throw (Error)ex;
+                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
+            } catch (InstantiationException ex) {
+            } catch (IllegalAccessException ex) {
+            }
+        }
+        return null;
+    }
+
+    static Adapter buildAdapterFromBytecodes(MethodType internalType) {
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    /**
+     * This adapter takes some untyped arguments, and returns an untyped result.
+     * Internally, it applies the invoker to the target, which causes the
+     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
+     * This result is passed to convert, which is responsible for
+     * converting the raw result into a boxed object.
+     * The invoker is kept separate from the target because it can be
+     * generated once per type erasure family, and reused across adapters.
+     */
+    static abstract class Adapter extends BoundMethodHandle {
+        /*
+         * class X<<R,int N>> extends Adapter {
+         *   (MH, Object**N)=>raw(R) invoker;
+         *   (any**N)=>R target;
+         *   raw(R)=>Object convert;
+         *   Object invoke(Object**N a) = convert(invoker(target, a...))
+         * }
+         */
+        protected final MethodHandle invoker;  // (MH, Object**N) => raw(R)
+        protected final MethodHandle convert;  // raw(R) => Object
+        protected final MethodHandle target;   // (any**N) => R
+
+        @Override
+        public String toString() {
+            return addTypeString(target, this);
+        }
+
+        protected boolean isPrototype() { return target == null; }
+        protected Adapter(MethodHandle entryPoint) {
+            this(entryPoint, null, entryPoint, null);
+            assert(isPrototype());
+        }
+        protected MethodHandle prototypeEntryPoint() {
+            if (!isPrototype())  throw new InternalError();
+            return convert;
+        }
+
+        protected Adapter(MethodHandle entryPoint,
+                          MethodHandle invoker, MethodHandle convert, MethodHandle target) {
+            super(entryPoint);
+            this.invoker = invoker;
+            this.convert = convert;
+            this.target  = target;
+        }
+
+        /** Make a copy of self, with new fields. */
+        protected abstract Adapter makeInstance(MethodHandle entryPoint,
+                MethodHandle invoker, MethodHandle convert, MethodHandle target);
+        // { return new ThisType(entryPoint, convert, target); }
+
+        /// Conversions on the value returned from the target.
+        protected Object convert_L(Object result) throws Throwable { return convert.invokeExact(result); }
+        protected Object convert_I(int    result) throws Throwable { return convert.invokeExact(result); }
+        protected Object convert_J(long   result) throws Throwable { return convert.invokeExact(result); }
+        protected Object convert_F(float  result) throws Throwable { return convert.invokeExact(result); }
+        protected Object convert_D(double result) throws Throwable { return convert.invokeExact(result); }
+
+        static private final String CLASS_PREFIX; // "java.lang.invoke.FromGeneric$"
+        static {
+            String aname = Adapter.class.getName();
+            String sname = Adapter.class.getSimpleName();
+            if (!aname.endsWith(sname))  throw new InternalError();
+            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
+        }
+        /** Find a sibing class of Adapter. */
+        static Class<? extends Adapter> findSubClass(String name) {
+            String cname = Adapter.CLASS_PREFIX + name;
+            try {
+                return Class.forName(cname).asSubclass(Adapter.class);
+            } catch (ClassNotFoundException ex) {
+                return null;
+            } catch (ClassCastException ex) {
+                return null;
+            }
+        }
+    }
+
+    /* generated classes follow this pattern:
+    static class xA2 extends Adapter {
+        protected xA2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected xA2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected xA2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new xA2(e, i, c, t); }
+        protected Object invoke_L2(Object a0, Object a1) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_I2(Object a0, Object a1) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_J2(Object a0, Object a1) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_F2(Object a0, Object a1) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_D2(Object a0, Object a1) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1)); }
+    }
+    // */
+
+/*
+: SHELL; n=FromGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
+//{{{
+import java.util.*;
+class genclasses {
+    static String[] TYPES = { "Object",    "int   ",    "long  ",    "float ",    "double" };
+    static String[] WRAPS = { "         ", "(Integer)", "(Long)   ", "(Float)  ", "(Double) " };
+    static String[] TCHARS = { "L",     "I",      "J",      "F",      "D",     "A" };
+    static String[][] TEMPLATES = { {
+        "@for@ arity=0..10  rcat<=4 nrefs<=99 nints=0   nlongs=0",
+        "    //@each-cat@",
+        "    static class @cat@ extends Adapter {",
+        "        protected @cat@(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype",
+        "        protected @cat@(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)",
+        "                        { super(e, i, c, t); }",
+        "        protected @cat@ makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)",
+        "                        { return new @cat@(e, i, c, t); }",
+        "        //@each-R@",
+        "        protected Object invoke_@catN@(@Tvav@) throws Throwable { return convert_@Rc@((@R@)@W@invoker.invokeExact(target@av@)); }",
+        "        //@end-R@",
+        "    }",
+    } };
+    static final String NEWLINE_INDENT = "\n                ";
+    enum VAR {
+        cat, catN, R, Rc, W, av, Tvav, Ovav;
+        public final String pattern = "@"+toString().replace('_','.')+"@";
+        public String binding;
+        static void makeBindings(boolean topLevel, int rcat, int nrefs, int nints, int nlongs) {
+            int nargs = nrefs + nints + nlongs;
+            if (topLevel)
+                VAR.cat.binding = catstr(ALL_RETURN_TYPES ? TYPES.length : rcat, nrefs, nints, nlongs);
+            VAR.catN.binding = catstr(rcat, nrefs, nints, nlongs);
+            VAR.R.binding = TYPES[rcat];
+            VAR.Rc.binding = TCHARS[rcat];
+            VAR.W.binding = WRAPS[rcat];
+            String[] Tv = new String[nargs];
+            String[] av = new String[nargs];
+            String[] Tvav = new String[nargs];
+            String[] Ovav = new String[nargs];
+            for (int i = 0; i < nargs; i++) {
+                int tcat = (i < nrefs) ? 0 : (i < nrefs + nints) ? 1 : 2;
+                Tv[i] = TYPES[tcat];
+                av[i] = arg(i);
+                Tvav[i] = param(Tv[i], av[i]);
+                Ovav[i] = param("Object", av[i]);
+            }
+            VAR.av.binding = comma(", ", av);
+            VAR.Tvav.binding = comma(Tvav);
+            VAR.Ovav.binding = comma(Ovav);
+        }
+        static String arg(int i) { return "a"+i; }
+        static String param(String t, String a) { return t+" "+a; }
+        static String comma(String[] v) { return comma("", v); }
+        static String comma(String sep, String[] v) {
+            if (v.length == 0)  return "";
+            String res = sep+v[0];
+            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
+            return res;
+        }
+        static String transform(String string) {
+            for (VAR var : values())
+                string = string.replaceAll(var.pattern, var.binding);
+            return string;
+        }
+    }
+    static String[] stringsIn(String[] strings, int beg, int end) {
+        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
+    }
+    static String[] stringsBefore(String[] strings, int pos) {
+        return stringsIn(strings, 0, pos);
+    }
+    static String[] stringsAfter(String[] strings, int pos) {
+        return stringsIn(strings, pos, strings.length);
+    }
+    static int indexAfter(String[] strings, int pos, String tag) {
+        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
+    }
+    static int indexBefore(String[] strings, int pos, String tag) {
+        for (int i = pos, end = strings.length; ; i++) {
+            if (i == end || strings[i].endsWith(tag))  return i;
+        }
+    }
+    static int MIN_ARITY, MAX_ARITY, MAX_RCAT, MAX_REFS, MAX_INTS, MAX_LONGS;
+    static boolean ALL_ARG_TYPES, ALL_RETURN_TYPES;
+    static HashSet<String> done = new HashSet<String>();
+    public static void main(String... av) {
+        for (String[] template : TEMPLATES) {
+            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
+            String[] forLines = stringsBefore(template, forLinesLimit);
+            template = stringsAfter(template, forLinesLimit);
+            for (String forLine : forLines)
+                expandTemplate(forLine, template);
+        }
+    }
+    static void expandTemplate(String forLine, String[] template) {
+        String[] params = forLine.split("[^0-9]+");
+        if (params[0].length() == 0)  params = stringsAfter(params, 1);
+        System.out.println("//params="+Arrays.asList(params));
+        int pcur = 0;
+        MIN_ARITY = Integer.valueOf(params[pcur++]);
+        MAX_ARITY = Integer.valueOf(params[pcur++]);
+        MAX_RCAT  = Integer.valueOf(params[pcur++]);
+        MAX_REFS  = Integer.valueOf(params[pcur++]);
+        MAX_INTS  = Integer.valueOf(params[pcur++]);
+        MAX_LONGS = Integer.valueOf(params[pcur++]);
+        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
+        if (MAX_RCAT >= TYPES.length)  MAX_RCAT = TYPES.length - 1;
+        ALL_ARG_TYPES = (indexBefore(template, 0, "@each-Tv@") < template.length);
+        ALL_RETURN_TYPES = (indexBefore(template, 0, "@each-R@") < template.length);
+        for (int nargs = MIN_ARITY; nargs <= MAX_ARITY; nargs++) {
+            for (int rcat = 0; rcat <= MAX_RCAT; rcat++) {
+                expandTemplate(template, true, rcat, nargs, 0, 0);
+                if (ALL_ARG_TYPES)  break;
+                expandTemplateForPrims(template, true, rcat, nargs, 1, 1);
+                if (ALL_RETURN_TYPES)  break;
+            }
+        }
+    }
+    static String catstr(int rcat, int nrefs, int nints, int nlongs) {
+        int nargs = nrefs + nints + nlongs;
+        String cat = TCHARS[rcat] + nargs;
+        if (!ALL_ARG_TYPES)  cat += (nints==0?"":"I"+nints)+(nlongs==0?"":"J"+nlongs);
+        return cat;
+    }
+    static void expandTemplateForPrims(String[] template, boolean topLevel, int rcat, int nargs, int minints, int minlongs) {
+        for (int isLong = 0; isLong <= 1; isLong++) {
+            for (int nprims = 1; nprims <= nargs; nprims++) {
+                int nrefs = nargs - nprims;
+                int nints = ((1-isLong) * nprims);
+                int nlongs = (isLong * nprims);
+                expandTemplate(template, topLevel, rcat, nrefs, nints, nlongs);
+            }
+        }
+    }
+    static void expandTemplate(String[] template, boolean topLevel,
+                               int rcat, int nrefs, int nints, int nlongs) {
+        int nargs = nrefs + nints + nlongs;
+        if (nrefs > MAX_REFS || nints > MAX_INTS || nlongs > MAX_LONGS)  return;
+        VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
+        if (topLevel && !done.add(VAR.cat.binding)) {
+            System.out.println("    //repeat "+VAR.cat.binding);
+            return;
+        }
+        for (int i = 0; i < template.length; i++) {
+            String line = template[i];
+            if (line.endsWith("@each-cat@")) {
+                // ignore
+            } else if (line.endsWith("@each-R@")) {
+                int blockEnd = indexAfter(template, i, "@end-R@");
+                String[] block = stringsIn(template, i+1, blockEnd-1);
+                for (int rcat1 = rcat; rcat1 <= MAX_RCAT; rcat1++)
+                    expandTemplate(block, false, rcat1, nrefs, nints, nlongs);
+                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
+                i = blockEnd-1; continue;
+            } else if (line.endsWith("@each-Tv@")) {
+                int blockEnd = indexAfter(template, i, "@end-Tv@");
+                String[] block = stringsIn(template, i+1, blockEnd-1);
+                expandTemplate(block, false, rcat, nrefs, nints, nlongs);
+                expandTemplateForPrims(block, false, rcat, nargs, nints+1, nlongs+1);
+                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
+                i = blockEnd-1; continue;
+            } else {
+                System.out.println(VAR.transform(line));
+            }
+        }
+    }
+}
+//}}} */
+//params=[0, 10, 4, 99, 0, 0]
+    static class A0 extends Adapter {
+        protected A0(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A0(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A0 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A0(e, i, c, t); }
+        protected Object invoke_L0() throws Throwable { return convert_L((Object)invoker.invokeExact(target)); }
+        protected Object invoke_I0() throws Throwable { return convert_I((int)   invoker.invokeExact(target)); }
+        protected Object invoke_J0() throws Throwable { return convert_J((long)  invoker.invokeExact(target)); }
+        protected Object invoke_F0() throws Throwable { return convert_F((float) invoker.invokeExact(target)); }
+        protected Object invoke_D0() throws Throwable { return convert_D((double)invoker.invokeExact(target)); }
+    }
+    static class A1 extends Adapter {
+        protected A1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A1(e, i, c, t); }
+        protected Object invoke_L1(Object a0) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0)); }
+        protected Object invoke_I1(Object a0) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0)); }
+        protected Object invoke_J1(Object a0) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0)); }
+        protected Object invoke_F1(Object a0) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0)); }
+        protected Object invoke_D1(Object a0) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0)); }
+    }
+    static class A2 extends Adapter {
+        protected A2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A2(e, i, c, t); }
+        protected Object invoke_L2(Object a0, Object a1) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_I2(Object a0, Object a1) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_J2(Object a0, Object a1) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_F2(Object a0, Object a1) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1)); }
+        protected Object invoke_D2(Object a0, Object a1) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1)); }
+    }
+    static class A3 extends Adapter {
+        protected A3(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A3(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A3 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A3(e, i, c, t); }
+        protected Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2)); }
+        protected Object invoke_I3(Object a0, Object a1, Object a2) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2)); }
+        protected Object invoke_J3(Object a0, Object a1, Object a2) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2)); }
+        protected Object invoke_F3(Object a0, Object a1, Object a2) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2)); }
+        protected Object invoke_D3(Object a0, Object a1, Object a2) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2)); }
+    }
+    static class A4 extends Adapter {
+        protected A4(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A4(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A4 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A4(e, i, c, t); }
+        protected Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3)); }
+        protected Object invoke_I4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3)); }
+        protected Object invoke_J4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3)); }
+        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3)); }
+        protected Object invoke_D4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3)); }
+    }
+    static class A5 extends Adapter {
+        protected A5(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A5(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A5 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A5(e, i, c, t); }
+        protected Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
+        protected Object invoke_I5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
+        protected Object invoke_J5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
+        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
+        protected Object invoke_D5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
+    }
+    static class A6 extends Adapter {
+        protected A6(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A6(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A6 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A6(e, i, c, t); }
+        protected Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_I6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_J6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_D6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
+    }
+    static class A7 extends Adapter {
+        protected A7(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A7(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A7 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A7(e, i, c, t); }
+        protected Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_I7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_J7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_D7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
+    }
+    static class A8 extends Adapter {
+        protected A8(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A8(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A8 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A8(e, i, c, t); }
+        protected Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_I8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_J8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_D8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
+    }
+    static class A9 extends Adapter {
+        protected A9(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A9(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A9 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A9(e, i, c, t); }
+        protected Object invoke_L9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_I9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_J9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_D9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+    }
+    static class A10 extends Adapter {
+        protected A10(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A10(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { super(e, i, c, t); }
+        protected A10 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
+                        { return new A10(e, i, c, t); }
+        protected Object invoke_L10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_I10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_J10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_D10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/InvokeDynamic.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+/**
+ * This is a place-holder class.  Some HotSpot implementations need to see it.
+ */
+final class InvokeDynamic {
+    private InvokeDynamic() { throw new InternalError(); }  // do not instantiate
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/InvokeGeneric.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Adapters which manage MethodHandle.invokeGeneric calls.
+ * The JVM calls one of these when the exact type match fails.
+ * @author jrose
+ */
+class InvokeGeneric {
+    // erased type for the call, which originates from an invokeGeneric site
+    private final MethodType erasedCallerType;
+    // an invoker of type (MT, MH; A...) -> R
+    private final MethodHandle initialInvoker;
+
+    /** Compute and cache information for this adapter, so that it can
+     *  call out to targets of the erasure-family of the given erased type.
+     */
+    /*non-public*/ InvokeGeneric(MethodType erasedCallerType) throws ReflectiveOperationException {
+        assert(erasedCallerType.equals(erasedCallerType.erase()));
+        this.erasedCallerType = erasedCallerType;
+        this.initialInvoker = makeInitialInvoker();
+        assert initialInvoker.type().equals(erasedCallerType
+                                            .insertParameterTypes(0, MethodType.class, MethodHandle.class))
+            : initialInvoker.type();
+    }
+
+    private static MethodHandles.Lookup lookup() {
+        return IMPL_LOOKUP;
+    }
+
+    /** Return the adapter information for this type's erasure. */
+    /*non-public*/ static MethodHandle genericInvokerOf(MethodType erasedCallerType) throws ReflectiveOperationException {
+        InvokeGeneric gen = new InvokeGeneric(erasedCallerType);
+        return gen.initialInvoker;
+    }
+
+    private MethodHandle makeInitialInvoker() throws ReflectiveOperationException {
+        // postDispatch = #(MH'; MT, MH; A...){MH'(MT, MH; A)}
+        MethodHandle postDispatch = makePostDispatchInvoker();
+        MethodHandle invoker;
+        if (returnConversionPossible()) {
+            invoker = MethodHandles.foldArguments(postDispatch,
+                                                  dispatcher("dispatchWithConversion"));
+        } else {
+            invoker = MethodHandles.foldArguments(postDispatch, dispatcher("dispatch"));
+        }
+        return invoker;
+    }
+
+    private static final Class<?>[] EXTRA_ARGS = { MethodType.class, MethodHandle.class };
+    private MethodHandle makePostDispatchInvoker() {
+        // Take (MH'; MT, MH; A...) and run MH'(MT, MH; A...).
+        MethodType invokerType = erasedCallerType.insertParameterTypes(0, EXTRA_ARGS);
+        return invokerType.invokers().exactInvoker();
+    }
+    private MethodHandle dropDispatchArguments(MethodHandle targetInvoker) {
+        assert(targetInvoker.type().parameterType(0) == MethodHandle.class);
+        return MethodHandles.dropArguments(targetInvoker, 1, EXTRA_ARGS);
+    }
+
+    private MethodHandle dispatcher(String dispatchName) throws ReflectiveOperationException {
+        return lookup().bind(this, dispatchName,
+                             MethodType.methodType(MethodHandle.class,
+                                                   MethodType.class, MethodHandle.class));
+    }
+
+    static final boolean USE_AS_TYPE_PATH = true;
+
+    /** Return a method handle to invoke on the callerType, target, and remaining arguments.
+     *  The method handle must finish the call.
+     *  This is the first look at the caller type and target.
+     */
+    private MethodHandle dispatch(MethodType callerType, MethodHandle target) {
+        MethodType targetType = target.type();
+        if (USE_AS_TYPE_PATH || target.isVarargsCollector()) {
+            MethodHandle newTarget = target.asType(callerType);
+            targetType = callerType;
+            Invokers invokers = targetType.invokers();
+            MethodHandle invoker = invokers.erasedInvokerWithDrops;
+            if (invoker == null) {
+                invokers.erasedInvokerWithDrops = invoker =
+                    dropDispatchArguments(invokers.erasedInvoker());
+            }
+            return invoker.bindTo(newTarget);
+        }
+        throw new RuntimeException("NYI");
+    }
+
+    private MethodHandle dispatchWithConversion(MethodType callerType, MethodHandle target) {
+        MethodHandle finisher = dispatch(callerType, target);
+        if (returnConversionNeeded(callerType, target))
+            finisher = addReturnConversion(finisher, callerType.returnType());  //FIXME: slow
+        return finisher;
+    }
+
+    private boolean returnConversionPossible() {
+        Class<?> needType = erasedCallerType.returnType();
+        return !needType.isPrimitive();
+    }
+    private boolean returnConversionNeeded(MethodType callerType, MethodHandle target) {
+        Class<?> needType = callerType.returnType();
+        if (needType == erasedCallerType.returnType())
+            return false;  // no conversions possible, since must be primitive or Object
+        Class<?> haveType = target.type().returnType();
+        if (VerifyType.isNullConversion(haveType, needType))
+            return false;
+        return true;
+    }
+    private MethodHandle addReturnConversion(MethodHandle target, Class<?> type) {
+        if (true) throw new RuntimeException("NYI");
+        // FIXME: This is slow because it creates a closure node on every call that requires a return cast.
+        MethodType targetType = target.type();
+        MethodHandle caster = ValueConversions.identity(type);
+        caster = caster.asType(MethodType.methodType(type, targetType.returnType()));
+        // Drop irrelevant arguments, because we only care about the return value:
+        caster = MethodHandles.dropArguments(caster, 1, targetType.parameterList());
+        MethodHandle result = MethodHandles.foldArguments(caster, target);
+        return result.asType(target.type());
+    }
+
+    public String toString() {
+        return "InvokeGeneric"+erasedCallerType;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/Invokers.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.empty.Empty;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Construction and caching of often-used invokers.
+ * @author jrose
+ */
+class Invokers {
+    // exact type (sans leading taget MH) for the outgoing call
+    private final MethodType targetType;
+
+    // exact invoker for the outgoing call
+    private /*lazy*/ MethodHandle exactInvoker;
+
+    // erased (partially untyped but with primitives) invoker for the outgoing call
+    private /*lazy*/ MethodHandle erasedInvoker;
+    /*lazy*/ MethodHandle erasedInvokerWithDrops;  // for InvokeGeneric
+
+    // generic (untyped) invoker for the outgoing call
+    private /*lazy*/ MethodHandle genericInvoker;
+
+    // generic (untyped) invoker for the outgoing call; accepts a single Object[]
+    private final /*lazy*/ MethodHandle[] spreadInvokers;
+
+    // invoker for an unbound callsite
+    private /*lazy*/ MethodHandle uninitializedCallSite;
+
+    /** Compute and cache information common to all collecting adapters
+     *  that implement members of the erasure-family of the given erased type.
+     */
+    /*non-public*/ Invokers(MethodType targetType) {
+        this.targetType = targetType;
+        this.spreadInvokers = new MethodHandle[targetType.parameterCount()+1];
+    }
+
+    /*non-public*/ static MethodType invokerType(MethodType targetType) {
+        return targetType.insertParameterTypes(0, MethodHandle.class);
+    }
+
+    /*non-public*/ MethodHandle exactInvoker() {
+        MethodHandle invoker = exactInvoker;
+        if (invoker != null)  return invoker;
+        try {
+            invoker = IMPL_LOOKUP.findVirtual(MethodHandle.class, "invokeExact", targetType);
+        } catch (ReflectiveOperationException ex) {
+            throw new InternalError("JVM cannot find invoker for "+targetType);
+        }
+        assert(invokerType(targetType) == invoker.type());
+        exactInvoker = invoker;
+        return invoker;
+    }
+
+    /*non-public*/ MethodHandle genericInvoker() {
+        MethodHandle invoker1 = exactInvoker();
+        MethodHandle invoker = genericInvoker;
+        if (invoker != null)  return invoker;
+        MethodType genericType = targetType.generic();
+        invoker = MethodHandles.convertArguments(invoker1, invokerType(genericType));
+        genericInvoker = invoker;
+        return invoker;
+    }
+
+    /*non-public*/ MethodHandle erasedInvoker() {
+        MethodHandle invoker1 = exactInvoker();
+        MethodHandle invoker = erasedInvoker;
+        if (invoker != null)  return invoker;
+        MethodType erasedType = targetType.erase();
+        if (erasedType == targetType.generic())
+            invoker = genericInvoker();
+        else
+            invoker = MethodHandles.convertArguments(invoker1, invokerType(erasedType));
+        erasedInvoker = invoker;
+        return invoker;
+    }
+
+    /*non-public*/ MethodHandle spreadInvoker(int objectArgCount) {
+        MethodHandle vaInvoker = spreadInvokers[objectArgCount];
+        if (vaInvoker != null)  return vaInvoker;
+        MethodHandle gInvoker = genericInvoker();
+        vaInvoker = gInvoker.asSpreader(Object[].class, targetType.parameterCount() - objectArgCount);
+        spreadInvokers[objectArgCount] = vaInvoker;
+        return vaInvoker;
+    }
+
+    private static MethodHandle THROW_UCS = null;
+
+    /*non-public*/ MethodHandle uninitializedCallSite() {
+        MethodHandle invoker = uninitializedCallSite;
+        if (invoker != null)  return invoker;
+        if (targetType.parameterCount() > 0) {
+            MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount());
+            Invokers invokers0 = type0.invokers();
+            invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(),
+                                                  0, targetType.parameterList());
+            assert(invoker.type().equals(targetType));
+            uninitializedCallSite = invoker;
+            return invoker;
+        }
+        if (THROW_UCS == null) {
+            try {
+                THROW_UCS = IMPL_LOOKUP
+                    .findStatic(CallSite.class, "uninitializedCallSite",
+                                MethodType.methodType(Empty.class));
+            } catch (ReflectiveOperationException ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+        invoker = AdapterMethodHandle.makeRetypeRaw(targetType, THROW_UCS);
+        assert(invoker.type().equals(targetType));
+        uninitializedCallSite = invoker;
+        return invoker;
+    }
+
+    public String toString() {
+        return "Invokers"+targetType;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MemberName.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,718 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.BytecodeDescriptor;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * A {@code MemberName} is a compact symbolic datum which fully characterizes
+ * a method or field reference.
+ * A member name refers to a field, method, constructor, or member type.
+ * Every member name has a simple name (a string) and a type (either a Class or MethodType).
+ * A member name may also have a non-null declaring class, or it may be simply
+ * a naked name/type pair.
+ * A member name may also have non-zero modifier flags.
+ * Finally, a member name may be either resolved or unresolved.
+ * If it is resolved, the existence of the named
+ * <p>
+ * Whether resolved or not, a member name provides no access rights or
+ * invocation capability to its possessor.  It is merely a compact
+ * representation of all symbolic information necessary to link to
+ * and properly use the named member.
+ * <p>
+ * When resolved, a member name's internal implementation may include references to JVM metadata.
+ * This representation is stateless and only decriptive.
+ * It provides no private information and no capability to use the member.
+ * <p>
+ * By contrast, a {@linkplain java.lang.reflect.Method} contains fuller information
+ * about the internals of a method (except its bytecodes) and also
+ * allows invocation.  A MemberName is much lighter than a Method,
+ * since it contains about 7 fields to the 16 of Method (plus its sub-arrays),
+ * and those seven fields omit much of the information in Method.
+ * @author jrose
+ */
+/*non-public*/ final class MemberName implements Member, Cloneable {
+    private Class<?>   clazz;       // class in which the method is defined
+    private String     name;        // may be null if not yet materialized
+    private Object     type;        // may be null if not yet materialized
+    private int        flags;       // modifier bits; see reflect.Modifier
+
+    private Object     vmtarget;    // VM-specific target value
+    private int        vmindex;     // method index within class or interface
+
+    { vmindex = VM_INDEX_UNINITIALIZED; }
+
+    /** Return the declaring class of this member.
+     *  In the case of a bare name and type, the declaring class will be null.
+     */
+    public Class<?> getDeclaringClass() {
+        if (clazz == null && isResolved()) {
+            expandFromVM();
+        }
+        return clazz;
+    }
+
+    /** Utility method producing the class loader of the declaring class. */
+    public ClassLoader getClassLoader() {
+        return clazz.getClassLoader();
+    }
+
+    /** Return the simple name of this member.
+     *  For a type, it is the same as {@link Class#getSimpleName}.
+     *  For a method or field, it is the simple name of the member.
+     *  For a constructor, it is always {@code "&lt;init&gt;"}.
+     */
+    public String getName() {
+        if (name == null) {
+            expandFromVM();
+            if (name == null)  return null;
+        }
+        return name;
+    }
+
+    /** Return the declared type of this member, which
+     *  must be a method or constructor.
+     */
+    public MethodType getMethodType() {
+        if (type == null) {
+            expandFromVM();
+            if (type == null)  return null;
+        }
+        if (!isInvocable())
+            throw newIllegalArgumentException("not invocable, no method type");
+        if (type instanceof MethodType) {
+            return (MethodType) type;
+        }
+        if (type instanceof String) {
+            String sig = (String) type;
+            MethodType res = MethodType.fromMethodDescriptorString(sig, getClassLoader());
+            this.type = res;
+            return res;
+        }
+        if (type instanceof Object[]) {
+            Object[] typeInfo = (Object[]) type;
+            Class<?>[] ptypes = (Class<?>[]) typeInfo[1];
+            Class<?> rtype = (Class<?>) typeInfo[0];
+            MethodType res = MethodType.methodType(rtype, ptypes);
+            this.type = res;
+            return res;
+        }
+        throw new InternalError("bad method type "+type);
+    }
+
+    /** Return the actual type under which this method or constructor must be invoked.
+     *  For non-static methods or constructors, this is the type with a leading parameter,
+     *  a reference to declaring class.  For static methods, it is the same as the declared type.
+     */
+    public MethodType getInvocationType() {
+        MethodType itype = getMethodType();
+        if (!isStatic())
+            itype = itype.insertParameterTypes(0, clazz);
+        return itype;
+    }
+
+    /** Utility method producing the parameter types of the method type. */
+    public Class<?>[] getParameterTypes() {
+        return getMethodType().parameterArray();
+    }
+
+    /** Utility method producing the return type of the method type. */
+    public Class<?> getReturnType() {
+        return getMethodType().returnType();
+    }
+
+    /** Return the declared type of this member, which
+     *  must be a field or type.
+     *  If it is a type member, that type itself is returned.
+     */
+    public Class<?> getFieldType() {
+        if (type == null) {
+            expandFromVM();
+            if (type == null)  return null;
+        }
+        if (isInvocable())
+            throw newIllegalArgumentException("not a field or nested class, no simple type");
+        if (type instanceof Class<?>) {
+            return (Class<?>) type;
+        }
+        if (type instanceof String) {
+            String sig = (String) type;
+            MethodType mtype = MethodType.fromMethodDescriptorString("()"+sig, getClassLoader());
+            Class<?> res = mtype.returnType();
+            this.type = res;
+            return res;
+        }
+        throw new InternalError("bad field type "+type);
+    }
+
+    /** Utility method to produce either the method type or field type of this member. */
+    public Object getType() {
+        return (isInvocable() ? getMethodType() : getFieldType());
+    }
+
+    /** Utility method to produce the signature of this member,
+     *  used within the class file format to describe its type.
+     */
+    public String getSignature() {
+        if (type == null) {
+            expandFromVM();
+            if (type == null)  return null;
+        }
+        if (type instanceof String)
+            return (String) type;
+        if (isInvocable())
+            return BytecodeDescriptor.unparse(getMethodType());
+        else
+            return BytecodeDescriptor.unparse(getFieldType());
+    }
+
+    /** Return the modifier flags of this member.
+     *  @see java.lang.reflect.Modifier
+     */
+    public int getModifiers() {
+        return (flags & RECOGNIZED_MODIFIERS);
+    }
+
+    private void setFlags(int flags) {
+        this.flags = flags;
+        assert(testAnyFlags(ALL_KINDS));
+    }
+
+    private boolean testFlags(int mask, int value) {
+        return (flags & mask) == value;
+    }
+    private boolean testAllFlags(int mask) {
+        return testFlags(mask, mask);
+    }
+    private boolean testAnyFlags(int mask) {
+        return !testFlags(mask, 0);
+    }
+
+    /** Utility method to query the modifier flags of this member. */
+    public boolean isStatic() {
+        return Modifier.isStatic(flags);
+    }
+    /** Utility method to query the modifier flags of this member. */
+    public boolean isPublic() {
+        return Modifier.isPublic(flags);
+    }
+    /** Utility method to query the modifier flags of this member. */
+    public boolean isPrivate() {
+        return Modifier.isPrivate(flags);
+    }
+    /** Utility method to query the modifier flags of this member. */
+    public boolean isProtected() {
+        return Modifier.isProtected(flags);
+    }
+    /** Utility method to query the modifier flags of this member. */
+    public boolean isFinal() {
+        return Modifier.isFinal(flags);
+    }
+    /** Utility method to query the modifier flags of this member. */
+    public boolean isAbstract() {
+        return Modifier.isAbstract(flags);
+    }
+    // let the rest (native, volatile, transient, etc.) be tested via Modifier.isFoo
+
+    // unofficial modifier flags, used by HotSpot:
+    static final int BRIDGE    = 0x00000040;
+    static final int VARARGS   = 0x00000080;
+    static final int SYNTHETIC = 0x00001000;
+    static final int ANNOTATION= 0x00002000;
+    static final int ENUM      = 0x00004000;
+    /** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
+    public boolean isBridge() {
+        return testAllFlags(IS_METHOD | BRIDGE);
+    }
+    /** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
+    public boolean isVarargs() {
+        return testAllFlags(VARARGS) && isInvocable();
+    }
+    /** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
+    public boolean isSynthetic() {
+        return testAllFlags(SYNTHETIC);
+    }
+
+    static final String CONSTRUCTOR_NAME = "<init>";  // the ever-popular
+
+    // modifiers exported by the JVM:
+    static final int RECOGNIZED_MODIFIERS = 0xFFFF;
+
+    // private flags, not part of RECOGNIZED_MODIFIERS:
+    static final int
+            IS_METHOD      = MN_IS_METHOD,      // method (not constructor)
+            IS_CONSTRUCTOR = MN_IS_CONSTRUCTOR, // constructor
+            IS_FIELD       = MN_IS_FIELD,       // field
+            IS_TYPE        = MN_IS_TYPE;        // nested type
+    static final int  // for MethodHandleNatives.getMembers
+            SEARCH_SUPERCLASSES = MN_SEARCH_SUPERCLASSES,
+            SEARCH_INTERFACES   = MN_SEARCH_INTERFACES;
+
+    static final int ALL_ACCESS = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED;
+    static final int ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE;
+    static final int IS_INVOCABLE = IS_METHOD | IS_CONSTRUCTOR;
+    static final int IS_FIELD_OR_METHOD = IS_METHOD | IS_FIELD;
+    static final int SEARCH_ALL_SUPERS = SEARCH_SUPERCLASSES | SEARCH_INTERFACES;
+
+    /** Utility method to query whether this member is a method or constructor. */
+    public boolean isInvocable() {
+        return testAnyFlags(IS_INVOCABLE);
+    }
+    /** Utility method to query whether this member is a method, constructor, or field. */
+    public boolean isFieldOrMethod() {
+        return testAnyFlags(IS_FIELD_OR_METHOD);
+    }
+    /** Query whether this member is a method. */
+    public boolean isMethod() {
+        return testAllFlags(IS_METHOD);
+    }
+    /** Query whether this member is a constructor. */
+    public boolean isConstructor() {
+        return testAllFlags(IS_CONSTRUCTOR);
+    }
+    /** Query whether this member is a field. */
+    public boolean isField() {
+        return testAllFlags(IS_FIELD);
+    }
+    /** Query whether this member is a type. */
+    public boolean isType() {
+        return testAllFlags(IS_TYPE);
+    }
+    /** Utility method to query whether this member is neither public, private, nor protected. */
+    public boolean isPackage() {
+        return !testAnyFlags(ALL_ACCESS);
+    }
+
+    /** Initialize a query.   It is not resolved. */
+    private void init(Class<?> defClass, String name, Object type, int flags) {
+        // defining class is allowed to be null (for a naked name/type pair)
+        //name.toString();  // null check
+        //type.equals(type);  // null check
+        // fill in fields:
+        this.clazz = defClass;
+        this.name = name;
+        this.type = type;
+        setFlags(flags);
+        assert(!isResolved());
+    }
+
+    private void expandFromVM() {
+        if (!isResolved())  return;
+        if (type instanceof Object[])
+            type = null;  // don't saddle JVM w/ typeInfo
+        MethodHandleNatives.expand(this);
+    }
+
+    // Capturing information from the Core Reflection API:
+    private static int flagsMods(int flags, int mods) {
+        assert((flags & RECOGNIZED_MODIFIERS) == 0);
+        assert((mods & ~RECOGNIZED_MODIFIERS) == 0);
+        return flags | mods;
+    }
+    /** Create a name for the given reflected method.  The resulting name will be in a resolved state. */
+    public MemberName(Method m) {
+        Object[] typeInfo = { m.getReturnType(), m.getParameterTypes() };
+        init(m.getDeclaringClass(), m.getName(), typeInfo, flagsMods(IS_METHOD, m.getModifiers()));
+        // fill in vmtarget, vmindex while we have m in hand:
+        MethodHandleNatives.init(this, m);
+        assert(isResolved());
+    }
+    /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
+    public MemberName(Constructor ctor) {
+        Object[] typeInfo = { void.class, ctor.getParameterTypes() };
+        init(ctor.getDeclaringClass(), CONSTRUCTOR_NAME, typeInfo, flagsMods(IS_CONSTRUCTOR, ctor.getModifiers()));
+        // fill in vmtarget, vmindex while we have ctor in hand:
+        MethodHandleNatives.init(this, ctor);
+        assert(isResolved());
+    }
+    /** Create a name for the given reflected field.  The resulting name will be in a resolved state. */
+    public MemberName(Field fld) {
+        init(fld.getDeclaringClass(), fld.getName(), fld.getType(), flagsMods(IS_FIELD, fld.getModifiers()));
+        // fill in vmtarget, vmindex while we have fld in hand:
+        MethodHandleNatives.init(this, fld);
+        assert(isResolved());
+    }
+    /** Create a name for the given class.  The resulting name will be in a resolved state. */
+    public MemberName(Class<?> type) {
+        init(type.getDeclaringClass(), type.getSimpleName(), type, flagsMods(IS_TYPE, type.getModifiers()));
+        vmindex = 0;  // isResolved
+        assert(isResolved());
+    }
+
+    // bare-bones constructor; the JVM will fill it in
+    MemberName() { }
+
+    // locally useful cloner
+    @Override protected MemberName clone() {
+        try {
+            return (MemberName) super.clone();
+        } catch (CloneNotSupportedException ex) {
+            throw new InternalError();
+        }
+     }
+
+    // %%% define equals/hashcode?
+
+    // Construction from symbolic parts, for queries:
+    /** Create a field or type name from the given components:  Declaring class, name, type, modifiers.
+     *  The declaring class may be supplied as null if this is to be a bare name and type.
+     *  The resulting name will in an unresolved state.
+     */
+    public MemberName(Class<?> defClass, String name, Class<?> type, int modifiers) {
+        init(defClass, name, type, IS_FIELD | (modifiers & RECOGNIZED_MODIFIERS));
+    }
+    /** Create a field or type name from the given components:  Declaring class, name, type.
+     *  The declaring class may be supplied as null if this is to be a bare name and type.
+     *  The modifier flags default to zero.
+     *  The resulting name will in an unresolved state.
+     */
+    public MemberName(Class<?> defClass, String name, Class<?> type) {
+        this(defClass, name, type, 0);
+    }
+    /** Create a method or constructor name from the given components:  Declaring class, name, type, modifiers.
+     *  It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
+     *  The declaring class may be supplied as null if this is to be a bare name and type.
+     *  The resulting name will in an unresolved state.
+     */
+    public MemberName(Class<?> defClass, String name, MethodType type, int modifiers) {
+        int flagBit = (name.equals(CONSTRUCTOR_NAME) ? IS_CONSTRUCTOR : IS_METHOD);
+        init(defClass, name, type, flagBit | (modifiers & RECOGNIZED_MODIFIERS));
+    }
+    /** Create a method or constructor name from the given components:  Declaring class, name, type, modifiers.
+     *  It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
+     *  The declaring class may be supplied as null if this is to be a bare name and type.
+     *  The modifier flags default to zero.
+     *  The resulting name will in an unresolved state.
+     */
+    public MemberName(Class<?> defClass, String name, MethodType type) {
+        this(defClass, name, type, 0);
+    }
+
+    /** Query whether this member name is resolved.
+     *  A resolved member name is one for which the JVM has found
+     *  a method, constructor, field, or type binding corresponding exactly to the name.
+     *  (Document?)
+     */
+    public boolean isResolved() {
+        return (vmindex != VM_INDEX_UNINITIALIZED);
+    }
+
+    /** Query whether this member name is resolved to a non-static, non-final method.
+     */
+    public boolean hasReceiverTypeDispatch() {
+        return (isMethod() && getVMIndex() >= 0);
+    }
+
+    /** Produce a string form of this member name.
+     *  For types, it is simply the type's own string (as reported by {@code toString}).
+     *  For fields, it is {@code "DeclaringClass.name/type"}.
+     *  For methods and constructors, it is {@code "DeclaringClass.name(ptype...)rtype"}.
+     *  If the declaring class is null, the prefix {@code "DeclaringClass."} is omitted.
+     *  If the member is unresolved, a prefix {@code "*."} is prepended.
+     */
+    @Override
+    public String toString() {
+        if (isType())
+            return type.toString();  // class java.lang.String
+        // else it is a field, method, or constructor
+        StringBuilder buf = new StringBuilder();
+        if (getDeclaringClass() != null) {
+            buf.append(getName(clazz));
+            buf.append('.');
+        }
+        String name = getName();
+        buf.append(name == null ? "*" : name);
+        Object type = getType();
+        if (!isInvocable()) {
+            buf.append('/');
+            buf.append(type == null ? "*" : getName(type));
+        } else {
+            buf.append(type == null ? "(*)*" : getName(type));
+        }
+        /*
+        buf.append('/');
+        // key: Public, private, pRotected, sTatic, Final, sYnchronized,
+        // transient/Varargs, native, (interface), abstract, sTrict, sYnthetic,
+        // (annotation), Enum, (unused)
+        final String FIELD_MOD_CHARS  = "PprTF?vt????Y?E?";
+        final String METHOD_MOD_CHARS = "PprTFybVn?atY???";
+        String modChars = (isInvocable() ? METHOD_MOD_CHARS : FIELD_MOD_CHARS);
+        for (int i = 0; i < modChars.length(); i++) {
+            if ((flags & (1 << i)) != 0) {
+                char mc = modChars.charAt(i);
+                if (mc != '?')
+                    buf.append(mc);
+            }
+        }
+         */
+        return buf.toString();
+    }
+    private static String getName(Object obj) {
+        if (obj instanceof Class<?>)
+            return ((Class<?>)obj).getName();
+        return String.valueOf(obj);
+    }
+
+    // Queries to the JVM:
+    /** Document? */
+    /*non-public*/ int getVMIndex() {
+        if (!isResolved())
+            throw newIllegalStateException("not resolved", this);
+        return vmindex;
+    }
+//    /*non-public*/ Object getVMTarget() {
+//        if (!isResolved())
+//            throw newIllegalStateException("not resolved", this);
+//        return vmtarget;
+//    }
+
+    public IllegalAccessException makeAccessException(String message, Object from) {
+        message = message + ": "+ toString();
+        if (from != null)  message += ", from " + from;
+        return new IllegalAccessException(message);
+    }
+    public ReflectiveOperationException makeAccessException(String message) {
+        message = message + ": "+ toString();
+        if (isResolved())
+            return new IllegalAccessException(message);
+        else if (isConstructor())
+            return new NoSuchMethodException(message);
+        else if (isMethod())
+            return new NoSuchMethodException(message);
+        else
+            return new NoSuchFieldException(message);
+    }
+
+    /** Actually making a query requires an access check. */
+    /*non-public*/ static Factory getFactory() {
+        return Factory.INSTANCE;
+    }
+    /** A factory type for resolving member names with the help of the VM.
+     *  TBD: Define access-safe public constructors for this factory.
+     */
+    public static class Factory {
+        private Factory() { } // singleton pattern
+        static Factory INSTANCE = new Factory();
+
+        private static int ALLOWED_FLAGS = SEARCH_ALL_SUPERS | ALL_KINDS;
+
+        /// Queries
+        List<MemberName> getMembers(Class<?> defc,
+                String matchName, Object matchType,
+                int matchFlags, Class<?> lookupClass) {
+            matchFlags &= ALLOWED_FLAGS;
+            String matchSig = null;
+            if (matchType != null) {
+                matchSig = BytecodeDescriptor.unparse(matchType);
+                if (matchSig.startsWith("("))
+                    matchFlags &= ~(ALL_KINDS & ~IS_INVOCABLE);
+                else
+                    matchFlags &= ~(ALL_KINDS & ~IS_FIELD);
+            }
+            final int BUF_MAX = 0x2000;
+            int len1 = matchName == null ? 10 : matchType == null ? 4 : 1;
+            MemberName[] buf = newMemberBuffer(len1);
+            int totalCount = 0;
+            ArrayList<MemberName[]> bufs = null;
+            int bufCount = 0;
+            for (;;) {
+                bufCount = MethodHandleNatives.getMembers(defc,
+                        matchName, matchSig, matchFlags,
+                        lookupClass,
+                        totalCount, buf);
+                if (bufCount <= buf.length) {
+                    if (bufCount < 0)  bufCount = 0;
+                    totalCount += bufCount;
+                    break;
+                }
+                // JVM returned to us with an intentional overflow!
+                totalCount += buf.length;
+                int excess = bufCount - buf.length;
+                if (bufs == null)  bufs = new ArrayList<MemberName[]>(1);
+                bufs.add(buf);
+                int len2 = buf.length;
+                len2 = Math.max(len2, excess);
+                len2 = Math.max(len2, totalCount / 4);
+                buf = newMemberBuffer(Math.min(BUF_MAX, len2));
+            }
+            ArrayList<MemberName> result = new ArrayList<MemberName>(totalCount);
+            if (bufs != null) {
+                for (MemberName[] buf0 : bufs) {
+                    Collections.addAll(result, buf0);
+                }
+            }
+            result.addAll(Arrays.asList(buf).subList(0, bufCount));
+            // Signature matching is not the same as type matching, since
+            // one signature might correspond to several types.
+            // So if matchType is a Class or MethodType, refilter the results.
+            if (matchType != null && matchType != matchSig) {
+                for (Iterator<MemberName> it = result.iterator(); it.hasNext();) {
+                    MemberName m = it.next();
+                    if (!matchType.equals(m.getType()))
+                        it.remove();
+                }
+            }
+            return result;
+        }
+        boolean resolveInPlace(MemberName m, boolean searchSupers, Class<?> lookupClass) {
+            if (m.name == null || m.type == null) {  // find unique non-overloaded name
+                Class<?> defc = m.getDeclaringClass();
+                List<MemberName> choices = null;
+                if (m.isMethod())
+                    choices = getMethods(defc, searchSupers, m.name, (MethodType) m.type, lookupClass);
+                else if (m.isConstructor())
+                    choices = getConstructors(defc, lookupClass);
+                else if (m.isField())
+                    choices = getFields(defc, searchSupers, m.name, (Class<?>) m.type, lookupClass);
+                //System.out.println("resolving "+m+" to "+choices);
+                if (choices == null || choices.size() != 1)
+                    return false;
+                if (m.name == null)  m.name = choices.get(0).name;
+                if (m.type == null)  m.type = choices.get(0).type;
+            }
+            MethodHandleNatives.resolve(m, lookupClass);
+            if (m.isResolved())  return true;
+            int matchFlags = m.flags | (searchSupers ? SEARCH_ALL_SUPERS : 0);
+            String matchSig = m.getSignature();
+            MemberName[] buf = { m };
+            int n = MethodHandleNatives.getMembers(m.getDeclaringClass(),
+                    m.getName(), matchSig, matchFlags, lookupClass, 0, buf);
+            if (n != 1)  return false;
+            return m.isResolved();
+        }
+        /** Produce a resolved version of the given member.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  If lookup fails or access is not permitted, null is returned.
+         *  Otherwise a fresh copy of the given member is returned, with modifier bits filled in.
+         */
+        public MemberName resolveOrNull(MemberName m, boolean searchSupers, Class<?> lookupClass) {
+            MemberName result = m.clone();
+            if (resolveInPlace(result, searchSupers, lookupClass))
+                return result;
+            return null;
+        }
+        /** Produce a resolved version of the given member.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  If lookup fails or access is not permitted, a {@linkplain ReflectiveOperationException} is thrown.
+         *  Otherwise a fresh copy of the given member is returned, with modifier bits filled in.
+         */
+        public
+        <NoSuchMemberException extends ReflectiveOperationException>
+        MemberName resolveOrFail(MemberName m, boolean searchSupers, Class<?> lookupClass,
+                                 Class<NoSuchMemberException> nsmClass)
+                throws IllegalAccessException, NoSuchMemberException {
+            MemberName result = resolveOrNull(m, searchSupers, lookupClass);
+            if (result != null)
+                return result;
+            ReflectiveOperationException ex = m.makeAccessException("no access");
+            if (ex instanceof IllegalAccessException)  throw (IllegalAccessException) ex;
+            throw nsmClass.cast(ex);
+        }
+        /** Return a list of all methods defined by the given class.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  Inaccessible members are not added to the last.
+         */
+        public List<MemberName> getMethods(Class<?> defc, boolean searchSupers,
+                Class<?> lookupClass) {
+            return getMethods(defc, searchSupers, null, null, lookupClass);
+        }
+        /** Return a list of matching methods defined by the given class.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Returned methods will match the name (if not null) and the type (if not null).
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  Inaccessible members are not added to the last.
+         */
+        public List<MemberName> getMethods(Class<?> defc, boolean searchSupers,
+                String name, MethodType type, Class<?> lookupClass) {
+            int matchFlags = IS_METHOD | (searchSupers ? SEARCH_ALL_SUPERS : 0);
+            return getMembers(defc, name, type, matchFlags, lookupClass);
+        }
+        /** Return a list of all constructors defined by the given class.
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  Inaccessible members are not added to the last.
+         */
+        public List<MemberName> getConstructors(Class<?> defc, Class<?> lookupClass) {
+            return getMembers(defc, null, null, IS_CONSTRUCTOR, lookupClass);
+        }
+        /** Return a list of all fields defined by the given class.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  Inaccessible members are not added to the last.
+         */
+        public List<MemberName> getFields(Class<?> defc, boolean searchSupers,
+                Class<?> lookupClass) {
+            return getFields(defc, searchSupers, null, null, lookupClass);
+        }
+        /** Return a list of all fields defined by the given class.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Returned fields will match the name (if not null) and the type (if not null).
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  Inaccessible members are not added to the last.
+         */
+        public List<MemberName> getFields(Class<?> defc, boolean searchSupers,
+                String name, Class<?> type, Class<?> lookupClass) {
+            int matchFlags = IS_FIELD | (searchSupers ? SEARCH_ALL_SUPERS : 0);
+            return getMembers(defc, name, type, matchFlags, lookupClass);
+        }
+        /** Return a list of all nested types defined by the given class.
+         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
+         *  Access checking is performed on behalf of the given {@code lookupClass}.
+         *  Inaccessible members are not added to the last.
+         */
+        public List<MemberName> getNestedTypes(Class<?> defc, boolean searchSupers,
+                Class<?> lookupClass) {
+            int matchFlags = IS_TYPE | (searchSupers ? SEARCH_ALL_SUPERS : 0);
+            return getMembers(defc, null, null, matchFlags, lookupClass);
+        }
+        private static MemberName[] newMemberBuffer(int length) {
+            MemberName[] buf = new MemberName[length];
+            // fill the buffer with dummy structs for the JVM to fill in
+            for (int i = 0; i < length; i++)
+                buf[i] = new MemberName();
+            return buf;
+        }
+    }
+
+//    static {
+//        System.out.println("Hello world!  My methods are:");
+//        System.out.println(Factory.INSTANCE.getMethods(MemberName.class, true, null));
+//    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,1028 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * A method handle is a typed, directly executable reference to an underlying method,
+ * constructor, field, or similar low-level operation, with optional
+ * transformations of arguments or return values.
+ * These transformations are quite general, and include such patterns as
+ * {@linkplain #asType conversion},
+ * {@linkplain #bindTo insertion},
+ * {@linkplain java.lang.invoke.MethodHandles#dropArguments deletion},
+ * and {@linkplain java.lang.invoke.MethodHandles#filterArguments substitution}.
+ *
+ * <h3>Method handle contents</h3>
+ * Method handles are dynamically and strongly typed according to type descriptor.
+ * They are not distinguished by the name or defining class of their underlying methods.
+ * A method handle must be invoked using type descriptor which matches
+ * the method handle's own {@linkplain #type method type}.
+ * <p>
+ * Every method handle reports its type via the {@link #type type} accessor.
+ * This type descriptor is a {@link java.lang.invoke.MethodType MethodType} object,
+ * whose structure is a series of classes, one of which is
+ * the return type of the method (or {@code void.class} if none).
+ * <p>
+ * A method handle's type controls the types of invocations it accepts,
+ * and the kinds of transformations that apply to it.
+ * <p>
+ * A method handle contains a pair of special invoker methods
+ * called {@link #invokeExact invokeExact} and {@link #invokeGeneric invokeGeneric}.
+ * Both invoker methods provide direct access to the method handle's
+ * underlying method, constructor, field, or other operation,
+ * as modified by transformations of arguments and return values.
+ * Both invokers accept calls which exactly match the method handle's own type.
+ * The {@code invokeGeneric} invoker also accepts a range of other call types.
+ * <p>
+ * Method handles are immutable and have no visible state.
+ * Of course, they can be bound to underlying methods or data which exhibit state.
+ * With respect to the Java Memory Model, any method handle will behave
+ * as if all of its (internal) fields are final variables.  This means that any method
+ * handle made visible to the application will always be fully formed.
+ * This is true even if the method handle is published through a shared
+ * variable in a data race.
+ * <p>
+ * Method handles cannot be subclassed by the user.
+ * Implementations may (or may not) create internal subclasses of {@code MethodHandle}
+ * which may be visible via the {@link java.lang.Object#getClass Object.getClass}
+ * operation.  The programmer should not draw conclusions about a method handle
+ * from its specific class, as the method handle class hierarchy (if any)
+ * may change from time to time or across implementations from different vendors.
+ *
+ * <h3>Method handle compilation</h3>
+ * A Java method call expression naming {@code invokeExact} or {@code invokeGeneric}
+ * can invoke a method handle from Java source code.
+ * From the viewpoint of source code, these methods can take any arguments
+ * and their result can be cast to any return type.
+ * Formally this is accomplished by giving the invoker methods
+ * {@code Object} return types and variable-arity {@code Object} arguments,
+ * but they have an additional quality called <em>signature polymorphism</em>
+ * which connects this freedom of invocation directly to the JVM execution stack.
+ * <p>
+ * As is usual with virtual methods, source-level calls to {@code invokeExact}
+ * and {@code invokeGeneric} compile to an {@code invokevirtual} instruction.
+ * More unusually, the compiler must record the actual argument types,
+ * and may not perform method invocation conversions on the arguments.
+ * Instead, it must push them on the stack according to their own unconverted types.
+ * The method handle object itself is pushed on the stack before the arguments.
+ * The compiler then calls the method handle with a type descriptor which
+ * describes the argument and return types.
+ * <p>
+ * To issue a complete type descriptor, the compiler must also determine
+ * the return type.  This is based on a cast on the method invocation expression,
+ * if there is one, or else {@code Object} if the invocation is an expression
+ * or else {@code void} if the invocation is a statement.
+ * The cast may be to a primitive type (but not {@code void}).
+ * <p>
+ * As a corner case, an uncasted {@code null} argument is given
+ * a type descriptor of {@code java.lang.Void}.
+ * The ambiguity with the type {@code Void} is harmless, since there are no references of type
+ * {@code Void} except the null reference.
+ *
+ * <h3>Method handle invocation</h3>
+ * The first time a {@code invokevirtual} instruction is executed
+ * it is linked, by symbolically resolving the names in the instruction
+ * and verifying that the method call is statically legal.
+ * This is true of calls to {@code invokeExact} and {@code invokeGeneric}.
+ * In this case, the type descriptor emitted by the compiler is checked for
+ * correct syntax and names it contains are resolved.
+ * Thus, an {@code invokevirtual} instruction which invokes
+ * a method handle will always link, as long
+ * as the type descriptor is syntactically well-formed
+ * and the types exist.
+ * <p>
+ * When the {@code invokevirtual} is executed after linking,
+ * the receiving method handle's type is first checked by the JVM
+ * to ensure that it matches the descriptor.
+ * If the type match fails, it means that the method which the
+ * caller is invoking is not present on the individual
+ * method handle being invoked.
+ * <p>
+ * In the case of {@code invokeExact}, the type descriptor of the invocation
+ * (after resolving symbolic type names) must exactly match the method type
+ * of the receiving method handle.
+ * In the case of {@code invokeGeneric}, the resolved type descriptor
+ * must be a valid argument to the receiver's {@link #asType asType} method.
+ * Thus, {@code invokeGeneric} is more permissive than {@code invokeExact}.
+ * <p>
+ * After type matching, a call to {@code invokeExact} directly
+ * and immediately invoke the method handle's underlying method
+ * (or other behavior, as the case may be).
+ * <p>
+ * A call to {@code invokeGeneric} works the same as a call to
+ * {@code invokeExact}, if the type descriptor specified by the caller
+ * exactly matches the method handle's own type.
+ * If there is a type mismatch, {@code invokeGeneric} attempts
+ * to adjust the type of the receiving method handle,
+ * as if by a call to {@link #asType asType},
+ * to obtain an exactly invokable method handle {@code M2}.
+ * This allows a more powerful negotiation of method type
+ * between caller and callee.
+ * <p>
+ * (<em>Note:</em> The adjusted method handle {@code M2} is not directly observable,
+ * and implementations are therefore not required to materialize it.)
+ *
+ * <h3>Invocation checking</h3>
+ * In typical programs, method handle type matching will usually succeed.
+ * But if a match fails, the JVM will throw a {@link WrongMethodTypeException},
+ * either directly (in the case of {@code invokeExact}) or indirectly as if
+ * by a failed call to {@code asType} (in the case of {@code invokeGeneric}).
+ * <p>
+ * Thus, a method type mismatch which might show up as a linkage error
+ * in a statically typed program can show up as
+ * a dynamic {@code WrongMethodTypeException}
+ * in a program which uses method handles.
+ * <p>
+ * Because method types contain "live" {@code Class} objects,
+ * method type matching takes into account both types names and class loaders.
+ * Thus, even if a method handle {@code M} is created in one
+ * class loader {@code L1} and used in another {@code L2},
+ * method handle calls are type-safe, because the caller's type
+ * descriptor, as resolved in {@code L2},
+ * is matched against the original callee method's type descriptor,
+ * as resolved in {@code L1}.
+ * The resolution in {@code L1} happens when {@code M} is created
+ * and its type is assigned, while the resolution in {@code L2} happens
+ * when the {@code invokevirtual} instruction is linked.
+ * <p>
+ * Apart from the checking of type descriptors,
+ * a method handle's capability to call its underlying method is unrestricted.
+ * If a method handle is formed on a non-public method by a class
+ * that has access to that method, the resulting handle can be used
+ * in any place by any caller who receives a reference to it.
+ * <p>
+ * Unlike with the Core Reflection API, where access is checked every time
+ * a reflective method is invoked,
+ * method handle access checking is performed
+ * <a href="MethodHandles.Lookup.html#access">when the method handle is created</a>.
+ * In the case of {@code ldc} (see below), access checking is performed as part of linking
+ * the constant pool entry underlying the constant method handle.
+ * <p>
+ * Thus, handles to non-public methods, or to methods in non-public classes,
+ * should generally be kept secret.
+ * They should not be passed to untrusted code unless their use from
+ * the untrusted code would be harmless.
+ *
+ * <h3>Method handle creation</h3>
+ * Java code can create a method handle that directly accesses
+ * any method, constructor, or field that is accessible to that code.
+ * This is done via a reflective, capability-based API called
+ * {@link java.lang.invoke.MethodHandles.Lookup MethodHandles.Lookup}
+ * For example, a static method handle can be obtained
+ * from {@link java.lang.invoke.MethodHandles.Lookup#findStatic Lookup.findStatic}.
+ * There are also conversion methods from Core Reflection API objects,
+ * such as {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}.
+ * <p>
+ * Like classes and strings, method handles that correspond to accessible
+ * fields, methods, and constructors can also be represented directly
+ * in a class file's constant pool as constants to be loaded by {@code ldc} bytecodes.
+ * A new type of constant pool entry, {@code CONSTANT_MethodHandle},
+ * refers directly to an associated {@code CONSTANT_Methodref},
+ * {@code CONSTANT_InterfaceMethodref}, or {@code CONSTANT_Fieldref}
+ * constant pool entry.
+ * (For more details on method handle constants,
+ * see the <a href="package-summary.html#mhcon">package summary</a>.)
+ * <p>
+ * Method handles produced by lookups or constant loads from methods or
+ * constructors with the variable arity modifier bit ({@code 0x0080})
+ * have a corresponding variable arity, as if they were defined with
+ * the help of {@link #asVarargsCollector asVarargsCollector}.
+ * <p>
+ * A method reference may refer either to a static or non-static method.
+ * In the non-static case, the method handle type includes an explicit
+ * receiver argument, prepended before any other arguments.
+ * In the method handle's type, the initial receiver argument is typed
+ * according to the class under which the method was initially requested.
+ * (E.g., if a non-static method handle is obtained via {@code ldc},
+ * the type of the receiver is the class named in the constant pool entry.)
+ * <p>
+ * When a method handle to a virtual method is invoked, the method is
+ * always looked up in the receiver (that is, the first argument).
+ * <p>
+ * A non-virtual method handle to a specific virtual method implementation
+ * can also be created.  These do not perform virtual lookup based on
+ * receiver type.  Such a method handle simulates the effect of
+ * an {@code invokespecial} instruction to the same method.
+ *
+ * <h3>Usage examples</h3>
+ * Here are some examples of usage:
+ * <p><blockquote><pre>
+Object x, y; String s; int i;
+MethodType mt; MethodHandle mh;
+MethodHandles.Lookup lookup = MethodHandles.lookup();
+// mt is (char,char)String
+mt = MethodType.methodType(String.class, char.class, char.class);
+mh = lookup.findVirtual(String.class, "replace", mt);
+s = (String) mh.invokeExact("daddy",'d','n');
+// invokeExact(Ljava/lang/String;CC)Ljava/lang/String;
+assert(s.equals("nanny"));
+// weakly typed invocation (using MHs.invoke)
+s = (String) mh.invokeWithArguments("sappy", 'p', 'v');
+assert(s.equals("savvy"));
+// mt is (Object[])List
+mt = MethodType.methodType(java.util.List.class, Object[].class);
+mh = lookup.findStatic(java.util.Arrays.class, "asList", mt);
+assert(mh.isVarargsCollector());
+x = mh.invokeGeneric("one", "two");
+// invokeGeneric(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
+assert(x.equals(java.util.Arrays.asList("one","two")));
+// mt is (Object,Object,Object)Object
+mt = MethodType.genericMethodType(3);
+mh = mh.asType(mt);
+x = mh.invokeExact((Object)1, (Object)2, (Object)3);
+// invokeExact(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+assert(x.equals(java.util.Arrays.asList(1,2,3)));
+// mt is int()
+mt = MethodType.methodType(int.class);
+mh = lookup.findVirtual(java.util.List.class, "size", mt);
+i = (int) mh.invokeExact(java.util.Arrays.asList(1,2,3));
+// invokeExact(Ljava/util/List;)I
+assert(i == 3);
+mt = MethodType.methodType(void.class, String.class);
+mh = lookup.findVirtual(java.io.PrintStream.class, "println", mt);
+mh.invokeExact(System.out, "Hello, world.");
+// invokeExact(Ljava/io/PrintStream;Ljava/lang/String;)V
+ * </pre></blockquote>
+ * Each of the above calls to {@code invokeExact} or {@code invokeGeneric}
+ * generates a single invokevirtual instruction with
+ * the type descriptor indicated in the following comment.
+ *
+ * <h3>Exceptions</h3>
+ * The methods {@code invokeExact} and {@code invokeGeneric} are declared
+ * to throw {@link java.lang.Throwable Throwable},
+ * which is to say that there is no static restriction on what a method handle
+ * can throw.  Since the JVM does not distinguish between checked
+ * and unchecked exceptions (other than by their class, of course),
+ * there is no particular effect on bytecode shape from ascribing
+ * checked exceptions to method handle invocations.  But in Java source
+ * code, methods which perform method handle calls must either explicitly
+ * throw {@code java.lang.Throwable Throwable}, or else must catch all
+ * throwables locally, rethrowing only those which are legal in the context,
+ * and wrapping ones which are illegal.
+ *
+ * <h3><a name="sigpoly"></a>Signature polymorphism</h3>
+ * The unusual compilation and linkage behavior of
+ * {@code invokeExact} and {@code invokeGeneric}
+ * is referenced by the term <em>signature polymorphism</em>.
+ * A signature polymorphic method is one which can operate with
+ * any of a wide range of call signatures and return types.
+ * In order to make this work, both the Java compiler and the JVM must
+ * give special treatment to signature polymorphic methods.
+ * <p>
+ * In source code, a call to a signature polymorphic method will
+ * compile, regardless of the requested type descriptor.
+ * As usual, the Java compiler emits an {@code invokevirtual}
+ * instruction with the given type descriptor against the named method.
+ * The unusual part is that the type descriptor is derived from
+ * the actual argument and return types, not from the method declaration.
+ * <p>
+ * When the JVM processes bytecode containing signature polymorphic calls,
+ * it will successfully link any such call, regardless of its type descriptor.
+ * (In order to retain type safety, the JVM will guard such calls with suitable
+ * dynamic type checks, as described elsewhere.)
+ * <p>
+ * Bytecode generators, including the compiler back end, are required to emit
+ * untransformed type descriptors for these methods.
+ * Tools which determine symbolic linkage are required to accept such
+ * untransformed descriptors, without reporting linkage errors.
+ * <p>
+ * For the sake of tools (but not as a programming API), the signature polymorphic
+ * methods are marked with a private yet standard annotation,
+ * {@code @java.lang.invoke.MethodHandle.PolymorphicSignature}.
+ * The annotation's retention is {@code RUNTIME}, so that all tools can see it.
+ *
+ * <h3>Formal rules for processing signature polymorphic methods</h3>
+ * <p>
+ * The following methods (and no others) are signature polymorphic:
+ * <ul>
+ * <li>{@link java.lang.invoke.MethodHandle#invokeExact   MethodHandle.invokeExact}
+ * <li>{@link java.lang.invoke.MethodHandle#invokeGeneric MethodHandle.invokeGeneric}
+ * </ul>
+ * <p>
+ * A signature polymorphic method will be declared with the following properties:
+ * <ul>
+ * <li>It must be native.
+ * <li>It must take a single varargs parameter of the form {@code Object...}.
+ * <li>It must produce a return value of type {@code Object}.
+ * <li>It must be contained within the {@code java.lang.invoke} package.
+ * </ul>
+ * Because of these requirements, a signature polymorphic method is able to accept
+ * any number and type of actual arguments, and can, with a cast, produce a value of any type.
+ * However, the JVM will treat these declaration features as a documentation convention,
+ * rather than a description of the actual structure of the methods as executed.
+ * <p>
+ * When a call to a signature polymorphic method is compiled, the associated linkage information for
+ * its arguments is not array of {@code Object} (as for other similar varargs methods)
+ * but rather the erasure of the static types of all the arguments.
+ * <p>
+ * In an argument position of a method invocation on a signature polymorphic method,
+ * a null literal has type {@code java.lang.Void}, unless cast to a reference type.
+ * (<em>Note:</em> This typing rule allows the null type to have its own encoding in linkage information
+ * distinct from other types.
+ * <p>
+ * The linkage information for the return type is derived from a context-dependent target typing convention.
+ * The return type for a signature polymorphic method invocation is determined as follows:
+ * <ul>
+ * <li>If the method invocation expression is an expression statement, the method is {@code void}.
+ * <li>Otherwise, if the method invocation expression is the immediate operand of a cast,
+ * the return type is the erasure of the cast type.
+ * <li>Otherwise, the return type is the method's nominal return type, {@code Object}.
+ * </ul>
+ * (Programmers are encouraged to use explicit casts unless it is clear that a signature polymorphic
+ * call will be used as a plain {@code Object} expression.)
+ * <p>
+ * The linkage information for argument and return types is stored in the descriptor for the
+ * compiled (bytecode) call site. As for any invocation instruction, the arguments and return value
+ * will be passed directly on the JVM stack, in accordance with the descriptor,
+ * and without implicit boxing or unboxing.
+ *
+ * <h3>Interoperation between method handles and the Core Reflection API</h3>
+ * Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup Lookup} API,
+ * any class member represented by a Core Reflection API object
+ * can be converted to a behaviorally equivalent method handle.
+ * For example, a reflective {@link java.lang.reflect.Method Method} can
+ * be converted to a method handle using
+ * {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}.
+ * The resulting method handles generally provide more direct and efficient
+ * access to the underlying class members.
+ * <p>
+ * As a special case,
+ * when the Core Reflection API is used to view the signature polymorphic
+ * methods {@code invokeExact} or {@code invokeGeneric} in this class,
+ * they appear as single, non-polymorphic native methods.
+ * Calls to these native methods do not result in method handle invocations.
+ * Since {@code invokevirtual} instructions can natively
+ * invoke method handles under any type descriptor, this reflective view conflicts
+ * with the normal presentation via bytecodes.
+ * Thus, these two native methods, as viewed by
+ * {@link java.lang.Class#getDeclaredMethod Class.getDeclaredMethod},
+ * are placeholders only.
+ * If invoked via {@link java.lang.reflect.Method#invoke Method.invoke},
+ * they will throw {@code UnsupportedOperationException}.
+ * <p>
+ * In order to obtain an invoker method for a particular type descriptor,
+ * use {@link java.lang.invoke.MethodHandles#exactInvoker MethodHandles.exactInvoker},
+ * or {@link java.lang.invoke.MethodHandles#genericInvoker MethodHandles.genericInvoker}.
+ * The {@link java.lang.invoke.MethodHandles.Lookup#findVirtual Lookup.findVirtual}
+ * API is also able to return a method handle
+ * to call {@code invokeExact} or {@code invokeGeneric},
+ * for any specified type descriptor .
+ *
+ * <h3>Interoperation between method handles and Java generics</h3>
+ * A method handle can be obtained on a method, constructor, or field
+ * which is declared with Java generic types.
+ * As with the Core Reflection API, the type of the method handle
+ * will constructed from the erasure of the source-level type.
+ * When a method handle is invoked, the types of its arguments
+ * or the return value cast type may be generic types or type instances.
+ * If this occurs, the compiler will replace those
+ * types by their erasures when when it constructs the type descriptor
+ * for the {@code invokevirtual} instruction.
+ * <p>
+ * Method handles do not represent
+ * their function-like types in terms of Java parameterized (generic) types,
+ * because there are three mismatches between function-like types and parameterized
+ * Java types.
+ * <ul>
+ * <li>Method types range over all possible arities,
+ * from no arguments to up to 255 of arguments (a limit imposed by the JVM).
+ * Generics are not variadic, and so cannot represent this.</li>
+ * <li>Method types can specify arguments of primitive types,
+ * which Java generic types cannot range over.</li>
+ * <li>Higher order functions over method handles (combinators) are
+ * often generic across a wide range of function types, including
+ * those of multiple arities.  It is impossible to represent such
+ * genericity with a Java type parameter.</li>
+ * </ul>
+ *
+ * @see MethodType
+ * @see MethodHandles
+ * @author John Rose, JSR 292 EG
+ */
+public abstract class MethodHandle {
+    // { JVM internals:
+
+    private byte       vmentry;    // adapter stub or method entry point
+    //private int      vmslots;    // optionally, hoist type.form.vmslots
+    /*non-public*/ Object vmtarget;   // VM-specific, class-specific target value
+
+    // TO DO:  vmtarget should be invisible to Java, since the JVM puts internal
+    // managed pointers into it.  Making it visible exposes it to debuggers,
+    // which can cause errors when they treat the pointer as an Object.
+
+    // These two dummy fields are present to force 'I' and 'J' signatures
+    // into this class's constant pool, so they can be transferred
+    // to vmentry when this class is loaded.
+    static final int  INT_FIELD = 0;
+    static final long LONG_FIELD = 0;
+
+    // vmentry (a void* field) is used *only* by the JVM.
+    // The JVM adjusts its type to int or long depending on system wordsize.
+    // Since it is statically typed as neither int nor long, it is impossible
+    // to use this field from Java bytecode.  (Please don't try to, either.)
+
+    // The vmentry is an assembly-language stub which is jumped to
+    // immediately after the method type is verified.
+    // For a direct MH, this stub loads the vmtarget's entry point
+    // and jumps to it.
+
+    // } End of JVM internals.
+
+    static { MethodHandleImpl.initStatics(); }
+
+    // interface MethodHandle<R throws X extends Exception,A...>
+    // { MethodType<R throws X,A...> type(); public R invokeExact(A...) throws X; }
+
+    /**
+     * Internal marker interface which distinguishes (to the Java compiler)
+     * those methods which are <a href="MethodHandle.html#sigpoly">signature polymorphic</a>.
+     */
+    @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})
+    @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
+    @interface PolymorphicSignature { }
+
+    private MethodType type;
+
+    /**
+     * Reports the type of this method handle.
+     * Every invocation of this method handle via {@code invokeExact} must exactly match this type.
+     * @return the method handle type
+     */
+    public MethodType type() {
+        return type;
+    }
+
+    /**
+     * Package-private constructor for the method handle implementation hierarchy.
+     * Method handle inheritance will be contained completely within
+     * the {@code java.lang.invoke} package.
+     */
+    // @param type type (permanently assigned) of the new method handle
+    /*non-public*/ MethodHandle(MethodType type) {
+        type.getClass();  // elicit NPE
+        this.type = type;
+    }
+
+    /**
+     * Invokes the method handle, allowing any caller type descriptor, but requiring an exact type match.
+     * The type descriptor at the call site of {@code invokeExact} must
+     * exactly match this method handle's {@link #type type}.
+     * No conversions are allowed on arguments or return values.
+     * <p>
+     * When this method is observed via the Core Reflection API,
+     * it will appear as a single native method, taking an object array and returning an object.
+     * If this native method is invoked directly via
+     * {@link java.lang.reflect.Method#invoke Method.invoke}, via JNI,
+     * or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
+     * it will throw an {@code UnsupportedOperationException}.
+     * @throws WrongMethodTypeException if the target's type is not identical with the caller's type descriptor
+     * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
+     */
+    public final native @PolymorphicSignature Object invokeExact(Object... args) throws Throwable;
+
+    /**
+     * Invokes the method handle, allowing any caller type descriptor,
+     * and optionally performing conversions on arguments and return values.
+     * <p>
+     * If the call site type descriptor exactly matches this method handle's {@link #type type},
+     * the call proceeds as if by {@link #invokeExact invokeExact}.
+     * <p>
+     * Otherwise, the call proceeds as if this method handle were first
+     * adjusted by calling {@link #asType asType} to adjust this method handle
+     * to the required type, and then the call proceeds as if by
+     * {@link #invokeExact invokeExact} on the adjusted method handle.
+     * <p>
+     * There is no guarantee that the {@code asType} call is actually made.
+     * If the JVM can predict the results of making the call, it may perform
+     * adaptations directly on the caller's arguments,
+     * and call the target method handle according to its own exact type.
+     * <p>
+     * The type descriptor at the call site of {@code invokeGeneric} must
+     * be a valid argument to the receivers {@code asType} method.
+     * In particular, the caller must specify the same argument arity
+     * as the callee's type,
+     * if the callee is not a {@linkplain #asVarargsCollector variable arity collector}.
+     * <p>
+     * When this method is observed via the Core Reflection API,
+     * it will appear as a single native method, taking an object array and returning an object.
+     * If this native method is invoked directly via
+     * {@link java.lang.reflect.Method#invoke Method.invoke}, via JNI,
+     * or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
+     * it will throw an {@code UnsupportedOperationException}.
+     * @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's type descriptor
+     * @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails
+     * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
+     */
+    public final native @PolymorphicSignature Object invokeGeneric(Object... args) throws Throwable;
+
+    /**
+     * Performs a varargs invocation, passing the arguments in the given array
+     * to the method handle, as if via {@link #invokeGeneric invokeGeneric} from a call site
+     * which mentions only the type {@code Object}, and whose arity is the length
+     * of the argument array.
+     * <p>
+     * Specifically, execution proceeds as if by the following steps,
+     * although the methods are not guaranteed to be called if the JVM
+     * can predict their effects.
+     * <ul>
+     * <li>Determine the length of the argument array as {@code N}.
+     *     For a null reference, {@code N=0}. </li>
+     * <li>Determine the generic type {@code TN} of {@code N} arguments as
+     *     as {@code TN=MethodType.genericMethodType(N)}.</li>
+     * <li>Force the original target method handle {@code MH0} to the
+     *     required type, as {@code MH1 = MH0.asType(TN)}. </li>
+     * <li>Spread the array into {@code N} separate arguments {@code A0, ...}. </li>
+     * <li>Invoke the type-adjusted method handle on the unpacked arguments:
+     *     MH1.invokeExact(A0, ...). </li>
+     * <li>Take the return value as an {@code Object} reference. </li>
+     * </ul>
+     * <p>
+     * Because of the action of the {@code asType} step, the following argument
+     * conversions are applied as necessary:
+     * <ul>
+     * <li>reference casting
+     * <li>unboxing
+     * <li>widening primitive conversions
+     * </ul>
+     * <p>
+     * The result returned by the call is boxed if it is a primitive,
+     * or forced to null if the return type is void.
+     * <p>
+     * This call is equivalent to the following code:
+     * <p><blockquote><pre>
+     * MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
+     * Object result = invoker.invokeExact(this, arguments);
+     * </pre></blockquote>
+     * <p>
+     * Unlike the signature polymorphic methods {@code invokeExact} and {@code invokeGeneric},
+     * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
+     * It can therefore be used as a bridge between native or reflective code and method handles.
+     *
+     * @param arguments the arguments to pass to the target
+     * @return the result returned by the target
+     * @throws ClassCastException if an argument cannot be converted by reference casting
+     * @throws WrongMethodTypeException if the target's type cannot be adjusted to take the given number of {@code Object} arguments
+     * @throws Throwable anything thrown by the target method invocation
+     * @see MethodHandles#spreadInvoker
+     */
+    public Object invokeWithArguments(Object... arguments) throws Throwable {
+        int argc = arguments == null ? 0 : arguments.length;
+        MethodType type = type();
+        if (type.parameterCount() != argc) {
+            // simulate invokeGeneric
+            return asType(MethodType.genericMethodType(argc)).invokeWithArguments(arguments);
+        }
+        if (argc <= 10) {
+            MethodHandle invoker = type.invokers().genericInvoker();
+            switch (argc) {
+                case 0:  return invoker.invokeExact(this);
+                case 1:  return invoker.invokeExact(this,
+                                    arguments[0]);
+                case 2:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1]);
+                case 3:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2]);
+                case 4:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3]);
+                case 5:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3], arguments[4]);
+                case 6:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3], arguments[4], arguments[5]);
+                case 7:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3], arguments[4], arguments[5],
+                                    arguments[6]);
+                case 8:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3], arguments[4], arguments[5],
+                                    arguments[6], arguments[7]);
+                case 9:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3], arguments[4], arguments[5],
+                                    arguments[6], arguments[7], arguments[8]);
+                case 10:  return invoker.invokeExact(this,
+                                    arguments[0], arguments[1], arguments[2],
+                                    arguments[3], arguments[4], arguments[5],
+                                    arguments[6], arguments[7], arguments[8],
+                                    arguments[9]);
+            }
+        }
+
+        // more than ten arguments get boxed in a varargs list:
+        MethodHandle invoker = type.invokers().spreadInvoker(0);
+        return invoker.invokeExact(this, arguments);
+    }
+
+    /**
+     * Performs a varargs invocation, passing the arguments in the given array
+     * to the method handle, as if via {@link #invokeGeneric invokeGeneric} from a call site
+     * which mentions only the type {@code Object}, and whose arity is the length
+     * of the argument array.
+     * <p>
+     * This method is also equivalent to the following code:
+     * <p><blockquote><pre>
+     * {@link #invokeWithArguments(Object...) invokeWithArguments}(arguments.toArray())
+     * </pre></blockquote>
+     *
+     * @param arguments the arguments to pass to the target
+     * @return the result returned by the target
+     * @throws ClassCastException if an argument cannot be converted by reference casting
+     * @throws WrongMethodTypeException if the target's type cannot be adjusted to take the given number of {@code Object} arguments
+     * @throws Throwable anything thrown by the target method invocation
+     */
+    public Object invokeWithArguments(java.util.List<?> arguments) throws Throwable {
+        return invokeWithArguments(arguments.toArray());
+    }
+
+    /**
+     * Produces an adapter method handle which adapts the type of the
+     * current method handle to a new type.
+     * The resulting method handle is guaranteed to report a type
+     * which is equal to the desired new type.
+     * <p>
+     * If the original type and new type are equal, returns {@code this}.
+     * <p>
+     * This method provides the crucial behavioral difference between
+     * {@link #invokeExact invokeExact} and {@link #invokeGeneric invokeGeneric}.  The two methods
+     * perform the same steps when the caller's type descriptor is identical
+     * with the callee's, but when the types differ, {@link #invokeGeneric invokeGeneric}
+     * also calls {@code asType} (or some internal equivalent) in order
+     * to match up the caller's and callee's types.
+     * <p>
+     * This method is equivalent to {@link MethodHandles#convertArguments convertArguments},
+     * except for variable arity method handles produced by {@link #asVarargsCollector asVarargsCollector}.
+     *
+     * @param newType the expected type of the new method handle
+     * @return a method handle which delegates to {@code this} after performing
+     *           any necessary argument conversions, and arranges for any
+     *           necessary return value conversions
+     * @throws WrongMethodTypeException if the conversion cannot be made
+     * @see MethodHandles#convertArguments
+     */
+    public MethodHandle asType(MethodType newType) {
+        return MethodHandles.convertArguments(this, newType);
+    }
+
+    /**
+     * Makes an adapter which accepts a trailing array argument
+     * and spreads its elements as positional arguments.
+     * The new method handle adapts, as its <i>target</i>,
+     * the current method handle.  The type of the adapter will be
+     * the same as the type of the target, except that the final
+     * {@code arrayLength} parameters of the target's type are replaced
+     * by a single array parameter of type {@code arrayType}.
+     * <p>
+     * If the array element type differs from any of the corresponding
+     * argument types on the original target,
+     * the original target is adapted to take the array elements directly,
+     * as if by a call to {@link #asType asType}.
+     * <p>
+     * When called, the adapter replaces a trailing array argument
+     * by the array's elements, each as its own argument to the target.
+     * (The order of the arguments is preserved.)
+     * They are converted pairwise by casting and/or unboxing
+     * to the types of the trailing parameters of the target.
+     * Finally the target is called.
+     * What the target eventually returns is returned unchanged by the adapter.
+     * <p>
+     * Before calling the target, the adapter verifies that the array
+     * contains exactly enough elements to provide a correct argument count
+     * to the target method handle.
+     * (The array may also be null when zero elements are required.)
+     * @param arrayType usually {@code Object[]}, the type of the array argument from which to extract the spread arguments
+     * @param arrayLength the number of arguments to spread from an incoming array argument
+     * @return a new method handle which spreads its final array argument,
+     *         before calling the original method handle
+     * @throws IllegalArgumentException if {@code arrayType} is not an array type
+     * @throws IllegalArgumentException if target does not have at least
+     *         {@code arrayLength} parameter types
+     * @throws WrongMethodTypeException if the implied {@code asType} call fails
+     * @see #asCollector
+     */
+    public MethodHandle asSpreader(Class<?> arrayType, int arrayLength) {
+        Class<?> arrayElement = arrayType.getComponentType();
+        if (arrayElement == null)  throw newIllegalArgumentException("not an array type");
+        MethodType oldType = type();
+        int nargs = oldType.parameterCount();
+        if (nargs < arrayLength)  throw newIllegalArgumentException("bad spread array length");
+        int keepPosArgs = nargs - arrayLength;
+        MethodType newType = oldType.dropParameterTypes(keepPosArgs, nargs);
+        newType = newType.insertParameterTypes(keepPosArgs, arrayType);
+        return MethodHandles.spreadArguments(this, newType);
+    }
+
+    /**
+     * Makes an adapter which accepts a given number of trailing
+     * positional arguments and collects them into an array argument.
+     * The new method handle adapts, as its <i>target</i>,
+     * the current method handle.  The type of the adapter will be
+     * the same as the type of the target, except that a single trailing
+     * parameter (usually of type {@code arrayType}) is replaced by
+     * {@code arrayLength} parameters whose type is element type of {@code arrayType}.
+     * <p>
+     * If the array type differs from the final argument type on the original target,
+     * the original target is adapted to take the array type directly,
+     * as if by a call to {@link #asType asType}.
+     * <p>
+     * When called, the adapter replaces its trailing {@code arrayLength}
+     * arguments by a single new array of type {@code arrayType}, whose elements
+     * comprise (in order) the replaced arguments.
+     * Finally the target is called.
+     * What the target eventually returns is returned unchanged by the adapter.
+     * <p>
+     * (The array may also be a shared constant when {@code arrayLength} is zero.)
+     * <p>
+     * (<em>Note:</em> The {@code arrayType} is often identical to the last
+     * parameter type of the original target.
+     * It is an explicit argument for symmetry with {@code asSpreader}, and also
+     * to allow the target to use a simple {@code Object} as its last parameter type.)
+     * <p>
+     * In order to create a collecting adapter which is not restricted to a particular
+     * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector} instead.
+     * @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments
+     * @param arrayLength the number of arguments to collect into a new array argument
+     * @return a new method handle which collects some trailing argument
+     *         into an array, before calling the original method handle
+     * @throws IllegalArgumentException if {@code arrayType} is not an array type
+     *         or {@code arrayType} is not assignable to this method handle's trailing parameter type,
+     *         or {@code arrayLength} is not a legal array size
+     * @throws WrongMethodTypeException if the implied {@code asType} call fails
+     * @see #asSpreader
+     * @see #asVarargsCollector
+     */
+    public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
+        Class<?> arrayElement = arrayType.getComponentType();
+        if (arrayElement == null)  throw newIllegalArgumentException("not an array type");
+        MethodType oldType = type();
+        int nargs = oldType.parameterCount();
+        if (nargs == 0)  throw newIllegalArgumentException("no trailing argument");
+        MethodType newType = oldType.dropParameterTypes(nargs-1, nargs);
+        newType = newType.insertParameterTypes(nargs-1,
+                    java.util.Collections.<Class<?>>nCopies(arrayLength, arrayElement));
+        return MethodHandles.collectArguments(this, newType);
+    }
+
+    /**
+     * Makes a <em>variable arity</em> adapter which is able to accept
+     * any number of trailing positional arguments and collect them
+     * into an array argument.
+     * <p>
+     * The type and behavior of the adapter will be the same as
+     * the type and behavior of the target, except that certain
+     * {@code invokeGeneric} and {@code asType} requests can lead to
+     * trailing positional arguments being collected into target's
+     * trailing parameter.
+     * Also, the last parameter type of the adapter will be
+     * {@code arrayType}, even if the target has a different
+     * last parameter type.
+     * <p>
+     * When called with {@link #invokeExact invokeExact}, the adapter invokes
+     * the target with no argument changes.
+     * (<em>Note:</em> This behavior is different from a
+     * {@linkplain #asCollector fixed arity collector},
+     * since it accepts a whole array of indeterminate length,
+     * rather than a fixed number of arguments.)
+     * <p>
+     * When called with {@link #invokeGeneric invokeGeneric}, if the caller
+     * type is the same as the adapter, the adapter invokes the target as with
+     * {@code invokeExact}.
+     * (This is the normal behavior for {@code invokeGeneric} when types match.)
+     * <p>
+     * Otherwise, if the caller and adapter arity are the same, and the
+     * trailing parameter type of the caller is a reference type identical to
+     * or assignable to the trailing parameter type of the adapter,
+     * the arguments and return values are converted pairwise,
+     * as if by {@link MethodHandles#convertArguments convertArguments}.
+     * (This is also normal behavior for {@code invokeGeneric} in such a case.)
+     * <p>
+     * Otherwise, the arities differ, or the adapter's trailing parameter
+     * type is not assignable from the corresponding caller type.
+     * In this case, the adapter replaces all trailing arguments from
+     * the original trailing argument position onward, by
+     * a new array of type {@code arrayType}, whose elements
+     * comprise (in order) the replaced arguments.
+     * <p>
+     * The caller type must provides as least enough arguments,
+     * and of the correct type, to satisfy the target's requirement for
+     * positional arguments before the trailing array argument.
+     * Thus, the caller must supply, at a minimum, {@code N-1} arguments,
+     * where {@code N} is the arity of the target.
+     * Also, there must exist conversions from the incoming arguments
+     * to the target's arguments.
+     * As with other uses of {@code invokeGeneric}, if these basic
+     * requirements are not fulfilled, a {@code WrongMethodTypeException}
+     * may be thrown.
+     * <p>
+     * In all cases, what the target eventually returns is returned unchanged by the adapter.
+     * <p>
+     * In the final case, it is exactly as if the target method handle were
+     * temporarily adapted with a {@linkplain #asCollector fixed arity collector}
+     * to the arity required by the caller type.
+     * (As with {@code asCollector}, if the array length is zero,
+     * a shared constant may be used instead of a new array.
+     * If the implied call to {@code asCollector} would throw
+     * an {@code IllegalArgumentException} or {@code WrongMethodTypeException},
+     * the call to the variable arity adapter must throw
+     * {@code WrongMethodTypeException}.)
+     * <p>
+     * The behavior of {@link #asType asType} is also specialized for
+     * variable arity adapters, to maintain the invariant that
+     * {@code invokeGeneric} is always equivalent to an {@code asType}
+     * call to adjust the target type, followed by {@code invokeExact}.
+     * Therefore, a variable arity adapter responds
+     * to an {@code asType} request by building a fixed arity collector,
+     * if and only if the adapter and requested type differ either
+     * in arity or trailing argument type.
+     * The resulting fixed arity collector has its type further adjusted
+     * (if necessary) to the requested type by pairwise conversion,
+     * as if by another application of {@code asType}.
+     * <p>
+     * When a method handle is obtained by executing an {@code ldc} instruction
+     * of a {@code CONSTANT_MethodHandle} constant, and the target method is marked
+     * as a variable arity method (with the modifier bit {@code 0x0080}),
+     * the method handle will accept multiple arities, as if the method handle
+     * constant were created by means of a call to {@code asVarargsCollector}.
+     * <p>
+     * In order to create a collecting adapter which collects a predetermined
+     * number of arguments, and whose type reflects this predetermined number,
+     * use {@link #asCollector asCollector} instead.
+     * <p>
+     * No method handle transformations produce new method handles with
+     * variable arity, unless they are documented as doing so.
+     * Therefore, besides {@code asVarargsCollector},
+     * all methods in {@code MethodHandle} and {@code MethodHandles}
+     * will return a method handle with fixed arity,
+     * except in the cases where they are specified to return their original
+     * operand (e.g., {@code asType} of the method handle's own type).
+     * <p>
+     * Calling {@code asVarargsCollector} on a method handle which is already
+     * of variable arity will produce a method handle with the same type and behavior.
+     * It may (or may not) return the original variable arity method handle.
+     * <p>
+     * Here is an example, of a list-making variable arity method handle:
+     * <blockquote><pre>
+MethodHandle asList = publicLookup()
+  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
+  .asVarargsCollector(Object[].class);
+assertEquals("[]", asList.invokeGeneric().toString());
+assertEquals("[1]", asList.invokeGeneric(1).toString());
+assertEquals("[two, too]", asList.invokeGeneric("two", "too").toString());
+Object[] argv = { "three", "thee", "tee" };
+assertEquals("[three, thee, tee]", asList.invokeGeneric(argv).toString());
+List ls = (List) asList.invokeGeneric((Object)argv);
+assertEquals(1, ls.size());
+assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
+     * </pre></blockquote>
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * These rules are designed as a dynamically-typed variation
+     * of the Java rules for variable arity methods.
+     * In both cases, callers to a variable arity method or method handle
+     * can either pass zero or more positional arguments, or else pass
+     * pre-collected arrays of any length.  Users should be aware of the
+     * special role of the final argument, and of the effect of a
+     * type match on that final argument, which determines whether
+     * or not a single trailing argument is interpreted as a whole
+     * array or a single element of an array to be collected.
+     * Note that the dynamic type of the trailing argument has no
+     * effect on this decision, only a comparison between the static
+     * type descriptor of the call site and the type of the method handle.)
+     * <p style="font-size:smaller;">
+     * As a result of the previously stated rules, the variable arity behavior
+     * of a method handle may be suppressed, by binding it to the exact invoker
+     * of its own type, as follows:
+     * <blockquote><pre>
+MethodHandle vamh = publicLookup()
+  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
+  .asVarargsCollector(Object[].class);
+MethodHandle mh = MethodHandles.exactInvoker(vamh.type()).bindTo(vamh);
+assert(vamh.type().equals(mh.type()));
+assertEquals("[1, 2, 3]", vamh.invokeGeneric(1,2,3).toString());
+boolean failed = false;
+try { mh.invokeGeneric(1,2,3); }
+catch (WrongMethodTypeException ex) { failed = true; }
+assert(failed);
+     * </pre></blockquote>
+     * This transformation has no behavioral effect if the method handle is
+     * not of variable arity.
+     *
+     * @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments
+     * @return a new method handle which can collect any number of trailing arguments
+     *         into an array, before calling the original method handle
+     * @throws IllegalArgumentException if {@code arrayType} is not an array type
+     *         or {@code arrayType} is not assignable to this method handle's trailing parameter type
+     * @see #asCollector
+     * @see #isVarargsCollector
+     */
+    public MethodHandle asVarargsCollector(Class<?> arrayType) {
+        Class<?> arrayElement = arrayType.getComponentType();
+        if (arrayElement == null)  throw newIllegalArgumentException("not an array type");
+        return MethodHandles.asVarargsCollector(this, arrayType);
+    }
+
+    /**
+     * Determines if this method handle
+     * supports {@linkplain #asVarargsCollector variable arity} calls.
+     * Such method handles arise from the following sources:
+     * <ul>
+     * <li>a call to {@linkplain #asVarargsCollector asVarargsCollector}
+     * <li>a call to a {@linkplain java.lang.invoke.MethodHandles.Lookup lookup method}
+     *     which resolves to a variable arity Java method or constructor
+     * <li>an {@code ldc} instruction of a {@code CONSTANT_MethodHandle}
+     *     which resolves to a variable arity Java method or constructor
+     * </ul>
+     * @return true if this method handle accepts more than one arity of {@code invokeGeneric} calls
+     * @see #asVarargsCollector
+     */
+    public boolean isVarargsCollector() {
+        return false;
+    }
+
+    /**
+     * Binds a value {@code x} to the first argument of a method handle, without invoking it.
+     * The new method handle adapts, as its <i>target</i>,
+     * the current method handle by binding it to the given argument.
+     * The type of the bound handle will be
+     * the same as the type of the target, except that a single leading
+     * reference parameter will be omitted.
+     * <p>
+     * When called, the bound handle inserts the given value {@code x}
+     * as a new leading argument to the target.  The other arguments are
+     * also passed unchanged.
+     * What the target eventually returns is returned unchanged by the bound handle.
+     * <p>
+     * The reference {@code x} must be convertible to the first parameter
+     * type of the target.
+     * <p>
+     * (<em>Note:</em>  Because method handles are immutable, the target method handle
+     * retains its original type and behavior.)
+     * @param x  the value to bind to the first argument of the target
+     * @return a new method handle which prepends the given value to the incoming
+     *         argument list, before calling the original method handle
+     * @throws IllegalArgumentException if the target does not have a
+     *         leading parameter type that is a reference type
+     * @throws ClassCastException if {@code x} cannot be converted
+     *         to the leading parameter type of the target
+     * @see MethodHandles#insertArguments
+     */
+    public MethodHandle bindTo(Object x) {
+        Class<?> ptype;
+        if (type().parameterCount() == 0 ||
+            (ptype = type().parameterType(0)).isPrimitive())
+            throw newIllegalArgumentException("no leading reference parameter", x);
+        x = MethodHandles.checkValue(ptype, x);
+        // Cf. MethodHandles.insertArguments for the following logic:
+        MethodHandle bmh = MethodHandleImpl.bindReceiver(this, x);
+        if (bmh != null)  return bmh;
+        return MethodHandleImpl.bindArgument(this, 0, x);
+    }
+
+    /**
+     * Returns a string representation of the method handle,
+     * starting with the string {@code "MethodHandle"} and
+     * ending with the string representation of the method handle's type.
+     * In other words, this method returns a string equal to the value of:
+     * <blockquote><pre>
+     * "MethodHandle" + type().toString()
+     * </pre></blockquote>
+     * <p>
+     * (<em>Note:</em>  Future releases of this API may add further information
+     * to the string representation.
+     * Therefore, the present syntax should not be parsed by applications.)
+     *
+     * @return a string representation of the method handle
+     */
+    @Override
+    public String toString() {
+        return getNameString(this);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,1106 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.VerifyType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import sun.invoke.empty.Empty;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
+import sun.misc.Unsafe;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Trusted implementation code for MethodHandle.
+ * @author jrose
+ */
+/*non-public*/ abstract class MethodHandleImpl {
+    /// Factory methods to create method handles:
+
+    private static final MemberName.Factory LOOKUP = MemberName.Factory.INSTANCE;
+
+    static void initStatics() {
+        // Trigger preceding sequence.
+    }
+
+    /** Look up a given method.
+     * Callable only from sun.invoke and related packages.
+     * <p>
+     * The resulting method handle type will be of the given type,
+     * with a receiver type {@code rcvc} prepended if the member is not static.
+     * <p>
+     * Access checks are made as of the given lookup class.
+     * In particular, if the method is protected and {@code defc} is in a
+     * different package from the lookup class, then {@code rcvc} must be
+     * the lookup class or a subclass.
+     * @param token Proof that the lookup class has access to this package.
+     * @param member Resolved method or constructor to call.
+     * @param name Name of the desired method.
+     * @param rcvc Receiver type of desired non-static method (else null)
+     * @param doDispatch whether the method handle will test the receiver type
+     * @param lookupClass access-check relative to this class
+     * @return a direct handle to the matching method
+     * @throws IllegalAccessException if the given method cannot be accessed by the lookup class
+     */
+    static
+    MethodHandle findMethod(MemberName method,
+                            boolean doDispatch, Class<?> lookupClass) throws IllegalAccessException {
+        MethodType mtype = method.getMethodType();
+        if (!method.isStatic()) {
+            // adjust the advertised receiver type to be exactly the one requested
+            // (in the case of invokespecial, this will be the calling class)
+            Class<?> recvType = method.getDeclaringClass();
+            mtype = mtype.insertParameterTypes(0, recvType);
+        }
+        DirectMethodHandle mh = new DirectMethodHandle(mtype, method, doDispatch, lookupClass);
+        if (!mh.isValid())
+            throw method.makeAccessException("no access", lookupClass);
+        assert(mh.type() == mtype);
+        if (!method.isVarargs())
+            return mh;
+        else
+            return mh.asVarargsCollector(mtype.parameterType(mtype.parameterCount()-1));
+    }
+
+    static
+    MethodHandle makeAllocator(MethodHandle rawConstructor) {
+        MethodType rawConType = rawConstructor.type();
+        // Wrap the raw (unsafe) constructor with the allocation of a suitable object.
+        MethodHandle allocator
+            = AllocateObject.make(rawConType.parameterType(0), rawConstructor);
+        assert(allocator.type()
+               .equals(rawConType.dropParameterTypes(0, 1).changeReturnType(rawConType.parameterType(0))));
+        return allocator;
+    }
+
+    static final class AllocateObject<C> extends BoundMethodHandle {
+        private static final Unsafe unsafe = Unsafe.getUnsafe();
+
+        private final Class<C> allocateClass;
+        private final MethodHandle rawConstructor;
+
+        private AllocateObject(MethodHandle invoker,
+                               Class<C> allocateClass, MethodHandle rawConstructor) {
+            super(invoker);
+            this.allocateClass = allocateClass;
+            this.rawConstructor = rawConstructor;
+        }
+        static MethodHandle make(Class<?> allocateClass, MethodHandle rawConstructor) {
+            MethodType rawConType = rawConstructor.type();
+            assert(rawConType.parameterType(0) == allocateClass);
+            MethodType newType = rawConType.dropParameterTypes(0, 1).changeReturnType(allocateClass);
+            int nargs = rawConType.parameterCount() - 1;
+            if (nargs < INVOKES.length) {
+                MethodHandle invoke = INVOKES[nargs];
+                MethodType conType = CON_TYPES[nargs];
+                MethodHandle gcon = convertArguments(rawConstructor, conType, rawConType, null);
+                if (gcon == null)  return null;
+                MethodHandle galloc = new AllocateObject(invoke, allocateClass, gcon);
+                assert(galloc.type() == newType.generic());
+                return convertArguments(galloc, newType, galloc.type(), null);
+            } else {
+                MethodHandle invoke = VARARGS_INVOKE;
+                MethodType conType = CON_TYPES[nargs];
+                MethodHandle gcon = spreadArguments(rawConstructor, conType, 1);
+                if (gcon == null)  return null;
+                MethodHandle galloc = new AllocateObject(invoke, allocateClass, gcon);
+                return collectArguments(galloc, newType, 1, null);
+            }
+        }
+        @Override
+        public String toString() {
+            return addTypeString(allocateClass.getSimpleName(), this);
+        }
+        @SuppressWarnings("unchecked")
+        private C allocate() throws InstantiationException {
+            return (C) unsafe.allocateInstance(allocateClass);
+        }
+        private C invoke_V(Object... av) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, av);
+            return obj;
+        }
+        private C invoke_L0() throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj);
+            return obj;
+        }
+        private C invoke_L1(Object a0) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0);
+            return obj;
+        }
+        private C invoke_L2(Object a0, Object a1) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1);
+            return obj;
+        }
+        private C invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1, a2);
+            return obj;
+        }
+        private C invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3);
+            return obj;
+        }
+        private C invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4);
+            return obj;
+        }
+        private C invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4, a5);
+            return obj;
+        }
+        private C invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4, a5, a6);
+            return obj;
+        }
+        private C invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            C obj = allocate();
+            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4, a5, a6, a7);
+            return obj;
+        }
+        static MethodHandle[] makeInvokes() {
+            ArrayList<MethodHandle> invokes = new ArrayList<MethodHandle>();
+            MethodHandles.Lookup lookup = IMPL_LOOKUP;
+            for (;;) {
+                int nargs = invokes.size();
+                String name = "invoke_L"+nargs;
+                MethodHandle invoke = null;
+                try {
+                    invoke = lookup.findVirtual(AllocateObject.class, name, MethodType.genericMethodType(nargs));
+                } catch (ReflectiveOperationException ex) {
+                }
+                if (invoke == null)  break;
+                invokes.add(invoke);
+            }
+            assert(invokes.size() == 9);  // current number of methods
+            return invokes.toArray(new MethodHandle[0]);
+        };
+        static final MethodHandle[] INVOKES = makeInvokes();
+        // For testing use this:
+        //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2);
+        static final MethodHandle VARARGS_INVOKE;
+        static {
+            try {
+                VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(AllocateObject.class, "invoke_V", MethodType.genericMethodType(0, true));
+            } catch (ReflectiveOperationException ex) {
+                throw uncaughtException(ex);
+            }
+        }
+        // Corresponding generic constructor types:
+        static final MethodType[] CON_TYPES = new MethodType[INVOKES.length];
+        static {
+            for (int i = 0; i < INVOKES.length; i++)
+                CON_TYPES[i] = makeConType(INVOKES[i]);
+        }
+        static final MethodType VARARGS_CON_TYPE = makeConType(VARARGS_INVOKE);
+        static MethodType makeConType(MethodHandle invoke) {
+            MethodType invType = invoke.type();
+            return invType.changeParameterType(0, Object.class).changeReturnType(void.class);
+        }
+    }
+
+    static
+    MethodHandle accessField(MemberName member, boolean isSetter,
+                             Class<?> lookupClass) {
+        // Use sun. misc.Unsafe to dig up the dirt on the field.
+        MethodHandle mh = new FieldAccessor(member, isSetter);
+        return mh;
+    }
+
+    static
+    MethodHandle accessArrayElement(Class<?> arrayClass, boolean isSetter) {
+        if (!arrayClass.isArray())
+            throw newIllegalArgumentException("not an array: "+arrayClass);
+        Class<?> elemClass = arrayClass.getComponentType();
+        MethodHandle[] mhs = FieldAccessor.ARRAY_CACHE.get(elemClass);
+        if (mhs == null) {
+            if (!FieldAccessor.doCache(elemClass))
+                return FieldAccessor.ahandle(arrayClass, isSetter);
+            mhs = new MethodHandle[] {
+                FieldAccessor.ahandle(arrayClass, false),
+                FieldAccessor.ahandle(arrayClass, true)
+            };
+            if (mhs[0].type().parameterType(0) == Class.class) {
+                mhs[0] = MethodHandles.insertArguments(mhs[0], 0, elemClass);
+                mhs[1] = MethodHandles.insertArguments(mhs[1], 0, elemClass);
+            }
+            synchronized (FieldAccessor.ARRAY_CACHE) {}  // memory barrier
+            FieldAccessor.ARRAY_CACHE.put(elemClass, mhs);
+        }
+        return mhs[isSetter ? 1 : 0];
+    }
+
+    static final class FieldAccessor<C,V> extends BoundMethodHandle {
+        private static final Unsafe unsafe = Unsafe.getUnsafe();
+        final Object base;  // for static refs only
+        final long offset;
+        final String name;
+
+        FieldAccessor(MemberName field, boolean isSetter) {
+            super(fhandle(field.getDeclaringClass(), field.getFieldType(), isSetter, field.isStatic()));
+            this.offset = (long) field.getVMIndex();
+            this.name = field.getName();
+            this.base = staticBase(field);
+        }
+        @Override
+        public String toString() { return addTypeString(name, this); }
+
+        int getFieldI(C obj) { return unsafe.getInt(obj, offset); }
+        void setFieldI(C obj, int x) { unsafe.putInt(obj, offset, x); }
+        long getFieldJ(C obj) { return unsafe.getLong(obj, offset); }
+        void setFieldJ(C obj, long x) { unsafe.putLong(obj, offset, x); }
+        float getFieldF(C obj) { return unsafe.getFloat(obj, offset); }
+        void setFieldF(C obj, float x) { unsafe.putFloat(obj, offset, x); }
+        double getFieldD(C obj) { return unsafe.getDouble(obj, offset); }
+        void setFieldD(C obj, double x) { unsafe.putDouble(obj, offset, x); }
+        boolean getFieldZ(C obj) { return unsafe.getBoolean(obj, offset); }
+        void setFieldZ(C obj, boolean x) { unsafe.putBoolean(obj, offset, x); }
+        byte getFieldB(C obj) { return unsafe.getByte(obj, offset); }
+        void setFieldB(C obj, byte x) { unsafe.putByte(obj, offset, x); }
+        short getFieldS(C obj) { return unsafe.getShort(obj, offset); }
+        void setFieldS(C obj, short x) { unsafe.putShort(obj, offset, x); }
+        char getFieldC(C obj) { return unsafe.getChar(obj, offset); }
+        void setFieldC(C obj, char x) { unsafe.putChar(obj, offset, x); }
+        @SuppressWarnings("unchecked")
+        V getFieldL(C obj) { return (V) unsafe.getObject(obj, offset); }
+        @SuppressWarnings("unchecked")
+        void setFieldL(C obj, V x) { unsafe.putObject(obj, offset, x); }
+        // cast (V) is OK here, since we wrap convertArguments around the MH.
+
+        static Object staticBase(MemberName field) {
+            if (!field.isStatic())  return null;
+            Class c = field.getDeclaringClass();
+            java.lang.reflect.Field f;
+            try {
+                // FIXME:  Should not have to create 'f' to get this value.
+                f = c.getDeclaredField(field.getName());
+                return unsafe.staticFieldBase(f);
+            } catch (Exception ee) {
+                throw uncaughtException(ee);
+            }
+        }
+
+        int getStaticI() { return unsafe.getInt(base, offset); }
+        void setStaticI(int x) { unsafe.putInt(base, offset, x); }
+        long getStaticJ() { return unsafe.getLong(base, offset); }
+        void setStaticJ(long x) { unsafe.putLong(base, offset, x); }
+        float getStaticF() { return unsafe.getFloat(base, offset); }
+        void setStaticF(float x) { unsafe.putFloat(base, offset, x); }
+        double getStaticD() { return unsafe.getDouble(base, offset); }
+        void setStaticD(double x) { unsafe.putDouble(base, offset, x); }
+        boolean getStaticZ() { return unsafe.getBoolean(base, offset); }
+        void setStaticZ(boolean x) { unsafe.putBoolean(base, offset, x); }
+        byte getStaticB() { return unsafe.getByte(base, offset); }
+        void setStaticB(byte x) { unsafe.putByte(base, offset, x); }
+        short getStaticS() { return unsafe.getShort(base, offset); }
+        void setStaticS(short x) { unsafe.putShort(base, offset, x); }
+        char getStaticC() { return unsafe.getChar(base, offset); }
+        void setStaticC(char x) { unsafe.putChar(base, offset, x); }
+        V getStaticL() { return (V) unsafe.getObject(base, offset); }
+        void setStaticL(V x) { unsafe.putObject(base, offset, x); }
+
+        static String fname(Class<?> vclass, boolean isSetter, boolean isStatic) {
+            String stem;
+            if (!isStatic)
+                stem = (!isSetter ? "getField" : "setField");
+            else
+                stem = (!isSetter ? "getStatic" : "setStatic");
+            return stem + Wrapper.basicTypeChar(vclass);
+        }
+        static MethodType ftype(Class<?> cclass, Class<?> vclass, boolean isSetter, boolean isStatic) {
+            MethodType type;
+            if (!isStatic) {
+                if (!isSetter)
+                    return MethodType.methodType(vclass, cclass);
+                else
+                    return MethodType.methodType(void.class, cclass, vclass);
+            } else {
+                if (!isSetter)
+                    return MethodType.methodType(vclass);
+                else
+                    return MethodType.methodType(void.class, vclass);
+            }
+        }
+        static MethodHandle fhandle(Class<?> cclass, Class<?> vclass, boolean isSetter, boolean isStatic) {
+            String name = FieldAccessor.fname(vclass, isSetter, isStatic);
+            if (cclass.isPrimitive())  throw newIllegalArgumentException("primitive "+cclass);
+            Class<?> ecclass = Object.class;  //erase this type
+            Class<?> evclass = vclass;
+            if (!evclass.isPrimitive())  evclass = Object.class;
+            MethodType type = FieldAccessor.ftype(ecclass, evclass, isSetter, isStatic);
+            MethodHandle mh;
+            try {
+                mh = IMPL_LOOKUP.findVirtual(FieldAccessor.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+                throw uncaughtException(ex);
+            }
+            if (evclass != vclass || (!isStatic && ecclass != cclass)) {
+                MethodType strongType = FieldAccessor.ftype(cclass, vclass, isSetter, isStatic);
+                strongType = strongType.insertParameterTypes(0, FieldAccessor.class);
+                mh = MethodHandles.convertArguments(mh, strongType);
+            }
+            return mh;
+        }
+
+        /// Support for array element access
+        static final HashMap<Class<?>, MethodHandle[]> ARRAY_CACHE =
+                new HashMap<Class<?>, MethodHandle[]>();
+        // FIXME: Cache on the classes themselves, not here.
+        static boolean doCache(Class<?> elemClass) {
+            if (elemClass.isPrimitive())  return true;
+            ClassLoader cl = elemClass.getClassLoader();
+            return cl == null || cl == ClassLoader.getSystemClassLoader();
+        }
+        static int getElementI(int[] a, int i) { return a[i]; }
+        static void setElementI(int[] a, int i, int x) { a[i] = x; }
+        static long getElementJ(long[] a, int i) { return a[i]; }
+        static void setElementJ(long[] a, int i, long x) { a[i] = x; }
+        static float getElementF(float[] a, int i) { return a[i]; }
+        static void setElementF(float[] a, int i, float x) { a[i] = x; }
+        static double getElementD(double[] a, int i) { return a[i]; }
+        static void setElementD(double[] a, int i, double x) { a[i] = x; }
+        static boolean getElementZ(boolean[] a, int i) { return a[i]; }
+        static void setElementZ(boolean[] a, int i, boolean x) { a[i] = x; }
+        static byte getElementB(byte[] a, int i) { return a[i]; }
+        static void setElementB(byte[] a, int i, byte x) { a[i] = x; }
+        static short getElementS(short[] a, int i) { return a[i]; }
+        static void setElementS(short[] a, int i, short x) { a[i] = x; }
+        static char getElementC(char[] a, int i) { return a[i]; }
+        static void setElementC(char[] a, int i, char x) { a[i] = x; }
+        static Object getElementL(Object[] a, int i) { return a[i]; }
+        static void setElementL(Object[] a, int i, Object x) { a[i] = x; }
+        static <V> V getElementL(Class<V[]> aclass, V[] a, int i) { return aclass.cast(a)[i]; }
+        static <V> void setElementL(Class<V[]> aclass, V[] a, int i, V x) { aclass.cast(a)[i] = x; }
+
+        static String aname(Class<?> aclass, boolean isSetter) {
+            Class<?> vclass = aclass.getComponentType();
+            if (vclass == null)  throw new IllegalArgumentException();
+            return (!isSetter ? "getElement" : "setElement") + Wrapper.basicTypeChar(vclass);
+        }
+        static MethodType atype(Class<?> aclass, boolean isSetter) {
+            Class<?> vclass = aclass.getComponentType();
+            if (!isSetter)
+                return MethodType.methodType(vclass, aclass, int.class);
+            else
+                return MethodType.methodType(void.class, aclass, int.class, vclass);
+        }
+        static MethodHandle ahandle(Class<?> aclass, boolean isSetter) {
+            Class<?> vclass = aclass.getComponentType();
+            String name = FieldAccessor.aname(aclass, isSetter);
+            Class<?> caclass = null;
+            if (!vclass.isPrimitive() && vclass != Object.class) {
+                caclass = aclass;
+                aclass = Object[].class;
+                vclass = Object.class;
+            }
+            MethodType type = FieldAccessor.atype(aclass, isSetter);
+            if (caclass != null)
+                type = type.insertParameterTypes(0, Class.class);
+            MethodHandle mh;
+            try {
+                mh = IMPL_LOOKUP.findStatic(FieldAccessor.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+                throw uncaughtException(ex);
+            }
+            if (caclass != null) {
+                MethodType strongType = FieldAccessor.atype(caclass, isSetter);
+                mh = MethodHandles.insertArguments(mh, 0, caclass);
+                mh = MethodHandles.convertArguments(mh, strongType);
+            }
+            return mh;
+        }
+    }
+
+    /** Bind a predetermined first argument to the given direct method handle.
+     * Callable only from MethodHandles.
+     * @param token Proof that the caller has access to this package.
+     * @param target Any direct method handle.
+     * @param receiver Receiver (or first static method argument) to pre-bind.
+     * @return a BoundMethodHandle for the given DirectMethodHandle, or null if it does not exist
+     */
+    static
+    MethodHandle bindReceiver(MethodHandle target, Object receiver) {
+        if (target instanceof AdapterMethodHandle &&
+            ((AdapterMethodHandle)target).conversionOp() == MethodHandleNatives.Constants.OP_RETYPE_ONLY
+            ) {
+            Object info = MethodHandleNatives.getTargetInfo(target);
+            if (info instanceof DirectMethodHandle) {
+                DirectMethodHandle dmh = (DirectMethodHandle) info;
+                if (receiver == null ||
+                    dmh.type().parameterType(0).isAssignableFrom(receiver.getClass())) {
+                    MethodHandle bmh = new BoundMethodHandle(dmh, receiver, 0);
+                    MethodType newType = target.type().dropParameterTypes(0, 1);
+                    return convertArguments(bmh, newType, bmh.type(), null);
+                }
+            }
+        }
+        if (target instanceof DirectMethodHandle)
+            return new BoundMethodHandle((DirectMethodHandle)target, receiver, 0);
+        return null;   // let caller try something else
+    }
+
+    /** Bind a predetermined argument to the given arbitrary method handle.
+     * Callable only from MethodHandles.
+     * @param token Proof that the caller has access to this package.
+     * @param target Any method handle.
+     * @param receiver Argument (which can be a boxed primitive) to pre-bind.
+     * @return a suitable BoundMethodHandle
+     */
+    static
+    MethodHandle bindArgument(MethodHandle target, int argnum, Object receiver) {
+        return new BoundMethodHandle(target, receiver, argnum);
+    }
+
+    static MethodHandle convertArguments(MethodHandle target,
+                                                MethodType newType,
+                                                MethodType oldType,
+                                                int[] permutationOrNull) {
+        assert(oldType.parameterCount() == target.type().parameterCount());
+        if (permutationOrNull != null) {
+            int outargs = oldType.parameterCount(), inargs = newType.parameterCount();
+            if (permutationOrNull.length != outargs)
+                throw newIllegalArgumentException("wrong number of arguments in permutation");
+            // Make the individual outgoing argument types match up first.
+            Class<?>[] callTypeArgs = new Class<?>[outargs];
+            for (int i = 0; i < outargs; i++)
+                callTypeArgs[i] = newType.parameterType(permutationOrNull[i]);
+            MethodType callType = MethodType.methodType(oldType.returnType(), callTypeArgs);
+            target = convertArguments(target, callType, oldType, null);
+            assert(target != null);
+            oldType = target.type();
+            List<Integer> goal = new ArrayList<Integer>();  // i*TOKEN
+            List<Integer> state = new ArrayList<Integer>(); // i*TOKEN
+            List<Integer> drops = new ArrayList<Integer>(); // not tokens
+            List<Integer> dups = new ArrayList<Integer>();  // not tokens
+            final int TOKEN = 10; // to mark items which are symbolic only
+            // state represents the argument values coming into target
+            for (int i = 0; i < outargs; i++) {
+                state.add(permutationOrNull[i] * TOKEN);
+            }
+            // goal represents the desired state
+            for (int i = 0; i < inargs; i++) {
+                if (state.contains(i * TOKEN)) {
+                    goal.add(i * TOKEN);
+                } else {
+                    // adapter must initially drop all unused arguments
+                    drops.add(i);
+                }
+            }
+            // detect duplications
+            while (state.size() > goal.size()) {
+                for (int i2 = 0; i2 < state.size(); i2++) {
+                    int arg1 = state.get(i2);
+                    int i1 = state.indexOf(arg1);
+                    if (i1 != i2) {
+                        // found duplicate occurrence at i2
+                        int arg2 = (inargs++) * TOKEN;
+                        state.set(i2, arg2);
+                        dups.add(goal.indexOf(arg1));
+                        goal.add(arg2);
+                    }
+                }
+            }
+            assert(state.size() == goal.size());
+            int size = goal.size();
+            while (!state.equals(goal)) {
+                // Look for a maximal sequence of adjacent misplaced arguments,
+                // and try to rotate them into place.
+                int bestRotArg = -10 * TOKEN, bestRotLen = 0;
+                int thisRotArg = -10 * TOKEN, thisRotLen = 0;
+                for (int i = 0; i < size; i++) {
+                    int arg = state.get(i);
+                    // Does this argument match the current run?
+                    if (arg == thisRotArg + TOKEN) {
+                        thisRotArg = arg;
+                        thisRotLen += 1;
+                        if (bestRotLen < thisRotLen) {
+                            bestRotLen = thisRotLen;
+                            bestRotArg = thisRotArg;
+                        }
+                    } else {
+                        // The old sequence (if any) stops here.
+                        thisRotLen = 0;
+                        thisRotArg = -10 * TOKEN;
+                        // But maybe a new one starts here also.
+                        int wantArg = goal.get(i);
+                        final int MAX_ARG_ROTATION = AdapterMethodHandle.MAX_ARG_ROTATION;
+                        if (arg != wantArg &&
+                            arg >= wantArg - TOKEN * MAX_ARG_ROTATION &&
+                            arg <= wantArg + TOKEN * MAX_ARG_ROTATION) {
+                            thisRotArg = arg;
+                            thisRotLen = 1;
+                        }
+                    }
+                }
+                if (bestRotLen >= 2) {
+                    // Do a rotation if it can improve argument positioning
+                    // by at least 2 arguments.  This is not always optimal,
+                    // but it seems to catch common cases.
+                    int dstEnd = state.indexOf(bestRotArg);
+                    int srcEnd = goal.indexOf(bestRotArg);
+                    int rotBy = dstEnd - srcEnd;
+                    int dstBeg = dstEnd - (bestRotLen - 1);
+                    int srcBeg = srcEnd - (bestRotLen - 1);
+                    assert((dstEnd | dstBeg | srcEnd | srcBeg) >= 0); // no negs
+                    // Make a span which covers both source and destination.
+                    int rotBeg = Math.min(dstBeg, srcBeg);
+                    int rotEnd = Math.max(dstEnd, srcEnd);
+                    int score = 0;
+                    for (int i = rotBeg; i <= rotEnd; i++) {
+                        if ((int)state.get(i) != (int)goal.get(i))
+                            score += 1;
+                    }
+                    List<Integer> rotSpan = state.subList(rotBeg, rotEnd+1);
+                    Collections.rotate(rotSpan, -rotBy);  // reverse direction
+                    for (int i = rotBeg; i <= rotEnd; i++) {
+                        if ((int)state.get(i) != (int)goal.get(i))
+                            score -= 1;
+                    }
+                    if (score >= 2) {
+                        // Improved at least two argument positions.  Do it.
+                        List<Class<?>> ptypes = Arrays.asList(oldType.parameterArray());
+                        Collections.rotate(ptypes.subList(rotBeg, rotEnd+1), -rotBy);
+                        MethodType rotType = MethodType.methodType(oldType.returnType(), ptypes);
+                        MethodHandle nextTarget
+                                = AdapterMethodHandle.makeRotateArguments(rotType, target,
+                                        rotBeg, rotSpan.size(), rotBy);
+                        if (nextTarget != null) {
+                            //System.out.println("Rot: "+rotSpan+" by "+rotBy);
+                            target = nextTarget;
+                            oldType = rotType;
+                            continue;
+                        }
+                    }
+                    // Else de-rotate, and drop through to the swap-fest.
+                    Collections.rotate(rotSpan, rotBy);
+                }
+
+                // Now swap like the wind!
+                List<Class<?>> ptypes = Arrays.asList(oldType.parameterArray());
+                for (int i = 0; i < size; i++) {
+                    // What argument do I want here?
+                    int arg = goal.get(i);
+                    if (arg != state.get(i)) {
+                        // Where is it now?
+                        int j = state.indexOf(arg);
+                        Collections.swap(ptypes, i, j);
+                        MethodType swapType = MethodType.methodType(oldType.returnType(), ptypes);
+                        target = AdapterMethodHandle.makeSwapArguments(swapType, target, i, j);
+                        if (target == null)  throw newIllegalArgumentException("cannot swap");
+                        assert(target.type() == swapType);
+                        oldType = swapType;
+                        Collections.swap(state, i, j);
+                    }
+                }
+                // One pass of swapping must finish the job.
+                assert(state.equals(goal));
+            }
+            while (!dups.isEmpty()) {
+                // Grab a contiguous trailing sequence of dups.
+                int grab = dups.size() - 1;
+                int dupArgPos = dups.get(grab), dupArgCount = 1;
+                while (grab - 1 >= 0) {
+                    int dup0 = dups.get(grab - 1);
+                    if (dup0 != dupArgPos - 1)  break;
+                    dupArgPos -= 1;
+                    dupArgCount += 1;
+                    grab -= 1;
+                }
+                //if (dupArgCount > 1)  System.out.println("Dup: "+dups.subList(grab, dups.size()));
+                dups.subList(grab, dups.size()).clear();
+                // In the new target type drop that many args from the tail:
+                List<Class<?>> ptypes = oldType.parameterList();
+                ptypes = ptypes.subList(0, ptypes.size() - dupArgCount);
+                MethodType dupType = MethodType.methodType(oldType.returnType(), ptypes);
+                target = AdapterMethodHandle.makeDupArguments(dupType, target, dupArgPos, dupArgCount);
+                if (target == null)
+                    throw newIllegalArgumentException("cannot dup");
+                oldType = target.type();
+            }
+            while (!drops.isEmpty()) {
+                // Grab a contiguous initial sequence of drops.
+                int dropArgPos = drops.get(0), dropArgCount = 1;
+                while (dropArgCount < drops.size()) {
+                    int drop1 = drops.get(dropArgCount);
+                    if (drop1 != dropArgPos + dropArgCount)  break;
+                    dropArgCount += 1;
+                }
+                //if (dropArgCount > 1)  System.out.println("Drop: "+drops.subList(0, dropArgCount));
+                drops.subList(0, dropArgCount).clear();
+                List<Class<?>> dropTypes = newType.parameterList()
+                        .subList(dropArgPos, dropArgPos + dropArgCount);
+                MethodType dropType = oldType.insertParameterTypes(dropArgPos, dropTypes);
+                target = AdapterMethodHandle.makeDropArguments(dropType, target, dropArgPos, dropArgCount);
+                if (target == null)  throw newIllegalArgumentException("cannot drop");
+                oldType = target.type();
+            }
+        }
+        if (newType == oldType)
+            return target;
+        if (oldType.parameterCount() != newType.parameterCount())
+            throw newIllegalArgumentException("mismatched parameter count");
+        MethodHandle res = AdapterMethodHandle.makePairwiseConvert(newType, target);
+        if (res != null)
+            return res;
+        int argc = oldType.parameterCount();
+        // The JVM can't do it directly, so fill in the gap with a Java adapter.
+        // TO DO: figure out what to put here from case-by-case experience
+        // Use a heavier method:  Convert all the arguments to Object,
+        // then back to the desired types.  We might have to use Java-based
+        // method handles to do this.
+        MethodType objType = MethodType.genericMethodType(argc);
+        MethodHandle objTarget = AdapterMethodHandle.makePairwiseConvert(objType, target);
+        if (objTarget == null)
+            objTarget = FromGeneric.make(target);
+        res = AdapterMethodHandle.makePairwiseConvert(newType, objTarget);
+        if (res != null)
+            return res;
+        return ToGeneric.make(newType, objTarget);
+    }
+
+    static MethodHandle spreadArguments(MethodHandle target,
+                                               MethodType newType,
+                                               int spreadArg) {
+        // TO DO: maybe allow the restarg to be Object and implicitly cast to Object[]
+        MethodType oldType = target.type();
+        // spread the last argument of newType to oldType
+        int spreadCount = oldType.parameterCount() - spreadArg;
+        Class<Object[]> spreadArgType = Object[].class;
+        MethodHandle res = AdapterMethodHandle.makeSpreadArguments(newType, target, spreadArgType, spreadArg, spreadCount);
+        if (res != null)
+            return res;
+        // try an intermediate adapter
+        Class<?> spreadType = null;
+        if (spreadArg < 0 || spreadArg >= newType.parameterCount()
+            || !VerifyType.isSpreadArgType(spreadType = newType.parameterType(spreadArg)))
+            throw newIllegalArgumentException("no restarg in "+newType);
+        Class<?>[] ptypes = oldType.parameterArray();
+        for (int i = 0; i < spreadCount; i++)
+            ptypes[spreadArg + i] = VerifyType.spreadArgElementType(spreadType, i);
+        MethodType midType = MethodType.methodType(newType.returnType(), ptypes);
+        // after spreading, some arguments may need further conversion
+        MethodHandle target2 = convertArguments(target, midType, oldType, null);
+        if (target2 == null)
+            throw new UnsupportedOperationException("NYI: convert "+midType+" =calls=> "+oldType);
+        res = AdapterMethodHandle.makeSpreadArguments(newType, target2, spreadArgType, spreadArg, spreadCount);
+        if (res != null)
+            return res;
+        res = SpreadGeneric.make(target2, spreadCount);
+        if (res != null)
+            res = convertArguments(res, newType, res.type(), null);
+        return res;
+    }
+
+    static MethodHandle collectArguments(MethodHandle target,
+                                                MethodType newType,
+                                                int collectArg,
+                                                MethodHandle collector) {
+        MethodType oldType = target.type();     // (a...,c)=>r
+        if (collector == null) {
+            int numCollect = newType.parameterCount() - oldType.parameterCount() + 1;
+            collector = ValueConversions.varargsArray(numCollect);
+        }
+        //         newType                      // (a..., b...)=>r
+        MethodType colType = collector.type();  // (b...)=>c
+        //         oldType                      // (a..., b...)=>r
+        assert(newType.parameterCount() == collectArg + colType.parameterCount());
+        assert(oldType.parameterCount() == collectArg + 1);
+        MethodHandle gtarget = convertArguments(target, oldType.generic(), oldType, null);
+        MethodHandle gcollector = convertArguments(collector, colType.generic(), colType, null);
+        if (gtarget == null || gcollector == null)  return null;
+        MethodHandle gresult = FilterGeneric.makeArgumentCollector(gcollector, gtarget);
+        MethodHandle result = convertArguments(gresult, newType, gresult.type(), null);
+        return result;
+    }
+
+    static MethodHandle filterArgument(MethodHandle target,
+                                              int pos,
+                                              MethodHandle filter) {
+        MethodType ttype = target.type(), gttype = ttype.generic();
+        if (ttype != gttype) {
+            target = convertArguments(target, gttype, ttype, null);
+            ttype = gttype;
+        }
+        MethodType ftype = filter.type(), gftype = ftype.generic();
+        if (ftype.parameterCount() != 1)
+            throw new InternalError();
+        if (ftype != gftype) {
+            filter = convertArguments(filter, gftype, ftype, null);
+            ftype = gftype;
+        }
+        if (ftype == ttype) {
+            // simple unary case
+            return FilterOneArgument.make(filter, target);
+        }
+        return FilterGeneric.makeArgumentFilter(pos, filter, target);
+    }
+
+    static MethodHandle foldArguments(MethodHandle target,
+                                             MethodType newType,
+                                             MethodHandle combiner) {
+        MethodType oldType = target.type();
+        MethodType ctype = combiner.type();
+        MethodHandle gtarget = convertArguments(target, oldType.generic(), oldType, null);
+        MethodHandle gcombiner = convertArguments(combiner, ctype.generic(), ctype, null);
+        if (gtarget == null || gcombiner == null)  return null;
+        MethodHandle gresult = FilterGeneric.makeArgumentFolder(gcombiner, gtarget);
+        MethodHandle result = convertArguments(gresult, newType, gresult.type(), null);
+        return result;
+    }
+
+    static
+    MethodHandle dropArguments(MethodHandle target,
+                               MethodType newType, int argnum) {
+        int drops = newType.parameterCount() - target.type().parameterCount();
+        MethodHandle res = AdapterMethodHandle.makeDropArguments(newType, target, argnum, drops);
+        if (res != null)
+            return res;
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    private static class GuardWithTest extends BoundMethodHandle {
+        private final MethodHandle test, target, fallback;
+        private GuardWithTest(MethodHandle invoker,
+                              MethodHandle test, MethodHandle target, MethodHandle fallback) {
+            super(invoker);
+            this.test = test;
+            this.target = target;
+            this.fallback = fallback;
+        }
+        static MethodHandle make(MethodHandle test, MethodHandle target, MethodHandle fallback) {
+            MethodType type = target.type();
+            int nargs = type.parameterCount();
+            if (nargs < INVOKES.length) {
+                MethodHandle invoke = INVOKES[nargs];
+                MethodType gtype = type.generic();
+                assert(invoke.type().dropParameterTypes(0,1) == gtype);
+                MethodHandle gtest = convertArguments(test, gtype.changeReturnType(boolean.class), test.type(), null);
+                MethodHandle gtarget = convertArguments(target, gtype, type, null);
+                MethodHandle gfallback = convertArguments(fallback, gtype, type, null);
+                if (gtest == null || gtarget == null || gfallback == null)  return null;
+                MethodHandle gguard = new GuardWithTest(invoke, gtest, gtarget, gfallback);
+                return convertArguments(gguard, type, gtype, null);
+            } else {
+                MethodHandle invoke = VARARGS_INVOKE;
+                MethodType gtype = MethodType.genericMethodType(1);
+                assert(invoke.type().dropParameterTypes(0,1) == gtype);
+                MethodHandle gtest = spreadArguments(test, gtype.changeReturnType(boolean.class), 0);
+                MethodHandle gtarget = spreadArguments(target, gtype, 0);
+                MethodHandle gfallback = spreadArguments(fallback, gtype, 0);
+                MethodHandle gguard = new GuardWithTest(invoke, gtest, gtarget, gfallback);
+                if (gtest == null || gtarget == null || gfallback == null)  return null;
+                return collectArguments(gguard, type, 0, null);
+            }
+        }
+        @Override
+        public String toString() {
+            return addTypeString(target, this);
+        }
+        private Object invoke_V(Object... av) throws Throwable {
+            if ((boolean) test.invokeExact(av))
+                return target.invokeExact(av);
+            return fallback.invokeExact(av);
+        }
+        private Object invoke_L0() throws Throwable {
+            if ((boolean) test.invokeExact())
+                return target.invokeExact();
+            return fallback.invokeExact();
+        }
+        private Object invoke_L1(Object a0) throws Throwable {
+            if ((boolean) test.invokeExact(a0))
+                return target.invokeExact(a0);
+            return fallback.invokeExact(a0);
+        }
+        private Object invoke_L2(Object a0, Object a1) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1))
+                return target.invokeExact(a0, a1);
+            return fallback.invokeExact(a0, a1);
+        }
+        private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1, a2))
+                return target.invokeExact(a0, a1, a2);
+            return fallback.invokeExact(a0, a1, a2);
+        }
+        private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1, a2, a3))
+                return target.invokeExact(a0, a1, a2, a3);
+            return fallback.invokeExact(a0, a1, a2, a3);
+        }
+        private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4))
+                return target.invokeExact(a0, a1, a2, a3, a4);
+            return fallback.invokeExact(a0, a1, a2, a3, a4);
+        }
+        private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4, a5))
+                return target.invokeExact(a0, a1, a2, a3, a4, a5);
+            return fallback.invokeExact(a0, a1, a2, a3, a4, a5);
+        }
+        private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4, a5, a6))
+                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6);
+            return fallback.invokeExact(a0, a1, a2, a3, a4, a5, a6);
+        }
+        private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7))
+                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
+            return fallback.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
+        }
+        static MethodHandle[] makeInvokes() {
+            ArrayList<MethodHandle> invokes = new ArrayList<MethodHandle>();
+            MethodHandles.Lookup lookup = IMPL_LOOKUP;
+            for (;;) {
+                int nargs = invokes.size();
+                String name = "invoke_L"+nargs;
+                MethodHandle invoke = null;
+                try {
+                    invoke = lookup.findVirtual(GuardWithTest.class, name, MethodType.genericMethodType(nargs));
+                } catch (ReflectiveOperationException ex) {
+                }
+                if (invoke == null)  break;
+                invokes.add(invoke);
+            }
+            assert(invokes.size() == 9);  // current number of methods
+            return invokes.toArray(new MethodHandle[0]);
+        };
+        static final MethodHandle[] INVOKES = makeInvokes();
+        // For testing use this:
+        //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2);
+        static final MethodHandle VARARGS_INVOKE;
+        static {
+            try {
+                VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(GuardWithTest.class, "invoke_V", MethodType.genericMethodType(0, true));
+            } catch (ReflectiveOperationException ex) {
+                throw uncaughtException(ex);
+            }
+        }
+    }
+
+    static
+    MethodHandle makeGuardWithTest(MethodHandle test,
+                                   MethodHandle target,
+                                   MethodHandle fallback) {
+        return GuardWithTest.make(test, target, fallback);
+    }
+
+    private static class GuardWithCatch extends BoundMethodHandle {
+        private final MethodHandle target;
+        private final Class<? extends Throwable> exType;
+        private final MethodHandle catcher;
+        GuardWithCatch(MethodHandle target, Class<? extends Throwable> exType, MethodHandle catcher) {
+            this(INVOKES[target.type().parameterCount()], target, exType, catcher);
+        }
+       GuardWithCatch(MethodHandle invoker,
+                      MethodHandle target, Class<? extends Throwable> exType, MethodHandle catcher) {
+            super(invoker);
+            this.target = target;
+            this.exType = exType;
+            this.catcher = catcher;
+        }
+        @Override
+        public String toString() {
+            return addTypeString(target, this);
+        }
+        private Object invoke_V(Object... av) throws Throwable {
+            try {
+                return target.invokeExact(av);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, av);
+            }
+        }
+        private Object invoke_L0() throws Throwable {
+            try {
+                return target.invokeExact();
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t);
+            }
+        }
+        private Object invoke_L1(Object a0) throws Throwable {
+            try {
+                return target.invokeExact(a0);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0);
+            }
+        }
+        private Object invoke_L2(Object a0, Object a1) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1);
+            }
+        }
+        private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1, a2);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1, a2);
+            }
+        }
+        private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1, a2, a3);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1, a2, a3);
+            }
+        }
+        private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1, a2, a3, a4);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1, a2, a3, a4);
+            }
+        }
+        private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1, a2, a3, a4, a5);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5);
+            }
+        }
+        private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5, a6);
+            }
+        }
+        private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
+            try {
+                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
+            } catch (Throwable t) {
+                if (!exType.isInstance(t))  throw t;
+                return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5, a6, a7);
+            }
+        }
+        static MethodHandle[] makeInvokes() {
+            ArrayList<MethodHandle> invokes = new ArrayList<MethodHandle>();
+            MethodHandles.Lookup lookup = IMPL_LOOKUP;
+            for (;;) {
+                int nargs = invokes.size();
+                String name = "invoke_L"+nargs;
+                MethodHandle invoke = null;
+                try {
+                    invoke = lookup.findVirtual(GuardWithCatch.class, name, MethodType.genericMethodType(nargs));
+                } catch (ReflectiveOperationException ex) {
+                }
+                if (invoke == null)  break;
+                invokes.add(invoke);
+            }
+            assert(invokes.size() == 9);  // current number of methods
+            return invokes.toArray(new MethodHandle[0]);
+        };
+        static final MethodHandle[] INVOKES = makeInvokes();
+        // For testing use this:
+        //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2);
+        static final MethodHandle VARARGS_INVOKE;
+        static {
+            try {
+                VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(GuardWithCatch.class, "invoke_V", MethodType.genericMethodType(0, true));
+            } catch (ReflectiveOperationException ex) {
+                throw uncaughtException(ex);
+            }
+        }
+    }
+
+
+    static
+    MethodHandle makeGuardWithCatch(MethodHandle target,
+                                    Class<? extends Throwable> exType,
+                                    MethodHandle catcher) {
+        MethodType type = target.type();
+        MethodType ctype = catcher.type();
+        int nargs = type.parameterCount();
+        if (nargs < GuardWithCatch.INVOKES.length) {
+            MethodType gtype = type.generic();
+            MethodType gcatchType = gtype.insertParameterTypes(0, Throwable.class);
+            MethodHandle gtarget = convertArguments(target, gtype, type, null);
+            MethodHandle gcatcher = convertArguments(catcher, gcatchType, ctype, null);
+            MethodHandle gguard = new GuardWithCatch(gtarget, exType, gcatcher);
+            if (gtarget == null || gcatcher == null || gguard == null)  return null;
+            return convertArguments(gguard, type, gtype, null);
+        } else {
+            MethodType gtype = MethodType.genericMethodType(0, true);
+            MethodType gcatchType = gtype.insertParameterTypes(0, Throwable.class);
+            MethodHandle gtarget = spreadArguments(target, gtype, 0);
+            MethodHandle gcatcher = spreadArguments(catcher, gcatchType, 1);
+            MethodHandle gguard = new GuardWithCatch(GuardWithCatch.VARARGS_INVOKE, gtarget, exType, gcatcher);
+            if (gtarget == null || gcatcher == null || gguard == null)  return null;
+            return collectArguments(gguard, type, 0, null);
+        }
+    }
+
+    static
+    MethodHandle throwException(MethodType type) {
+        return AdapterMethodHandle.makeRetypeRaw(type, throwException());
+    }
+
+    static MethodHandle THROW_EXCEPTION;
+    static MethodHandle throwException() {
+        if (THROW_EXCEPTION != null)  return THROW_EXCEPTION;
+        try {
+            THROW_EXCEPTION
+            = IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "throwException",
+                    MethodType.methodType(Empty.class, Throwable.class));
+        } catch (ReflectiveOperationException ex) {
+            throw new RuntimeException(ex);
+        }
+        return THROW_EXCEPTION;
+    }
+    static <T extends Throwable> Empty throwException(T t) throws T { throw t; }
+
+    // Linkage support:
+    static void registerBootstrap(Class<?> callerClass, MethodHandle bootstrapMethod) {
+        MethodHandleNatives.registerBootstrap(callerClass, bootstrapMethod);
+    }
+    static MethodHandle getBootstrap(Class<?> callerClass) {
+        return MethodHandleNatives.getBootstrap(callerClass);
+    }
+
+    static MethodHandle asVarargsCollector(MethodHandle target, Class<?> arrayType) {
+        return AdapterMethodHandle.makeVarargsCollector(target, arrayType);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * The JVM interface for the method handles package is all here.
+ * This is an interface internal and private to an implemetantion of JSR 292.
+ * <em>This class is not part of the JSR 292 standard.</em>
+ * @author jrose
+ */
+class MethodHandleNatives {
+
+    private MethodHandleNatives() { } // static only
+
+    /// MethodName support
+
+    static native void init(MemberName self, Object ref);
+    static native void expand(MemberName self);
+    static native void resolve(MemberName self, Class<?> caller);
+    static native int getMembers(Class<?> defc, String matchName, String matchSig,
+            int matchFlags, Class<?> caller, int skip, MemberName[] results);
+
+    /// MethodHandle support
+
+    /** Initialize the method handle to adapt the call. */
+    static native void init(AdapterMethodHandle self, MethodHandle target, int argnum);
+    /** Initialize the method handle to call the correct method, directly. */
+    static native void init(BoundMethodHandle self, Object target, int argnum);
+    /** Initialize the method handle to call as if by an invoke* instruction. */
+    static native void init(DirectMethodHandle self, Object ref, boolean doDispatch, Class<?> caller);
+
+    /** Initialize a method type, once per form. */
+    static native void init(MethodType self);
+
+    /** Tell the JVM about a class's bootstrap method. */
+    static native void registerBootstrap(Class<?> caller, MethodHandle bootstrapMethod);
+
+    /** Ask the JVM about a class's bootstrap method. */
+    static native MethodHandle getBootstrap(Class<?> caller);
+
+    /** Tell the JVM that we need to change the target of an invokedynamic. */
+    static native void setCallSiteTarget(CallSite site, MethodHandle target);
+
+    /** Fetch the vmtarget field.
+     *  It will be sanitized as necessary to avoid exposing non-Java references.
+     *  This routine is for debugging and reflection.
+     */
+    static native Object getTarget(MethodHandle self, int format);
+
+    /** Fetch the name of the handled method, if available.
+     *  This routine is for debugging and reflection.
+     */
+    static MemberName getMethodName(MethodHandle self) {
+        return (MemberName) getTarget(self, ETF_METHOD_NAME);
+    }
+
+    /** Fetch the reflective version of the handled method, if available.
+     */
+    static AccessibleObject getTargetMethod(MethodHandle self) {
+        return (AccessibleObject) getTarget(self, ETF_REFLECT_METHOD);
+    }
+
+    /** Fetch the target of this method handle.
+     *  If it directly targets a method, return a MemberName for the method.
+     *  If it is chained to another method handle, return that handle.
+     */
+    static Object getTargetInfo(MethodHandle self) {
+        return getTarget(self, ETF_HANDLE_OR_METHOD_NAME);
+    }
+
+    static Object[] makeTarget(Class<?> defc, String name, String sig, int mods, Class<?> refc) {
+        return new Object[] { defc, name, sig, mods, refc };
+    }
+
+    /** Fetch MH-related JVM parameter.
+     *  which=0 retrieves MethodHandlePushLimit
+     *  which=1 retrieves stack slot push size (in address units)
+     */
+    static native int getConstant(int which);
+
+    /** Java copy of MethodHandlePushLimit in range 2..255. */
+    static final int JVM_PUSH_LIMIT;
+    /** JVM stack motion (in words) after one slot is pushed, usually -1.
+     */
+    static final int JVM_STACK_MOVE_UNIT;
+
+    /** Which conv-ops are implemented by the JVM? */
+    static final int CONV_OP_IMPLEMENTED_MASK;
+
+    private static native void registerNatives();
+    static {
+        int     JVM_PUSH_LIMIT_;
+        int     JVM_STACK_MOVE_UNIT_;
+        int     CONV_OP_IMPLEMENTED_MASK_;
+        try {
+            registerNatives();
+            JVM_PUSH_LIMIT_ = getConstant(Constants.GC_JVM_PUSH_LIMIT);
+            JVM_STACK_MOVE_UNIT_ = getConstant(Constants.GC_JVM_STACK_MOVE_UNIT);
+            CONV_OP_IMPLEMENTED_MASK_ = getConstant(Constants.GC_CONV_OP_IMPLEMENTED_MASK);
+            //sun.reflect.Reflection.registerMethodsToFilter(MethodHandleImpl.class, "init");
+        } catch (UnsatisfiedLinkError ee) {
+            // ignore; if we use init() methods later we'll see linkage errors
+            JVM_PUSH_LIMIT_ = 3;  // arbitrary
+            JVM_STACK_MOVE_UNIT_ = -1;  // arbitrary
+            CONV_OP_IMPLEMENTED_MASK_ = 0;
+            JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_;
+            JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_;
+            throw ee;  // just die; hopeless to try to run with an older JVM
+        }
+        JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_;
+        JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_;
+        if (CONV_OP_IMPLEMENTED_MASK_ == 0)
+            CONV_OP_IMPLEMENTED_MASK_ = DEFAULT_CONV_OP_IMPLEMENTED_MASK;
+        CONV_OP_IMPLEMENTED_MASK = CONV_OP_IMPLEMENTED_MASK_;
+    }
+
+    // All compile-time constants go here.
+    // There is an opportunity to check them against the JVM's idea of them.
+    static class Constants {
+        Constants() { } // static only
+        // MethodHandleImpl
+        static final int // for getConstant
+                GC_JVM_PUSH_LIMIT = 0,
+                GC_JVM_STACK_MOVE_UNIT = 1,
+                GC_CONV_OP_IMPLEMENTED_MASK = 2;
+        static final int
+                ETF_HANDLE_OR_METHOD_NAME = 0, // all available data (immediate MH or method)
+                ETF_DIRECT_HANDLE         = 1, // ultimate method handle (will be a DMH, may be self)
+                ETF_METHOD_NAME           = 2, // ultimate method as MemberName
+                ETF_REFLECT_METHOD        = 3; // ultimate method as java.lang.reflect object (sans refClass)
+
+        // MemberName
+        // The JVM uses values of -2 and above for vtable indexes.
+        // Field values are simple positive offsets.
+        // Ref: src/share/vm/oops/methodOop.hpp
+        // This value is negative enough to avoid such numbers,
+        // but not too negative.
+        static final int
+                MN_IS_METHOD           = 0x00010000, // method (not constructor)
+                MN_IS_CONSTRUCTOR      = 0x00020000, // constructor
+                MN_IS_FIELD            = 0x00040000, // field
+                MN_IS_TYPE             = 0x00080000, // nested type
+                MN_SEARCH_SUPERCLASSES = 0x00100000, // for MHN.getMembers
+                MN_SEARCH_INTERFACES   = 0x00200000, // for MHN.getMembers
+                VM_INDEX_UNINITIALIZED = -99;
+
+        // BoundMethodHandle
+        /** Constants for decoding the vmargslot field, which contains 2 values. */
+        static final int
+            ARG_SLOT_PUSH_SHIFT = 16,
+            ARG_SLOT_MASK = (1<<ARG_SLOT_PUSH_SHIFT)-1;
+
+        // AdapterMethodHandle
+        /** Conversions recognized by the JVM.
+         *  They must align with the constants in java.lang.invoke.AdapterMethodHandle,
+         *  in the JVM file hotspot/src/share/vm/classfile/javaClasses.hpp.
+         */
+        static final int
+            OP_RETYPE_ONLY   = 0x0, // no argument changes; straight retype
+            OP_RETYPE_RAW    = 0x1, // no argument changes; straight retype
+            OP_CHECK_CAST    = 0x2, // ref-to-ref conversion; requires a Class argument
+            OP_PRIM_TO_PRIM  = 0x3, // converts from one primitive to another
+            OP_REF_TO_PRIM   = 0x4, // unboxes a wrapper to produce a primitive
+            OP_PRIM_TO_REF   = 0x5, // boxes a primitive into a wrapper (NYI)
+            OP_SWAP_ARGS     = 0x6, // swap arguments (vminfo is 2nd arg)
+            OP_ROT_ARGS      = 0x7, // rotate arguments (vminfo is displaced arg)
+            OP_DUP_ARGS      = 0x8, // duplicates one or more arguments (at TOS)
+            OP_DROP_ARGS     = 0x9, // remove one or more argument slots
+            OP_COLLECT_ARGS  = 0xA, // combine one or more arguments into a varargs (NYI)
+            OP_SPREAD_ARGS   = 0xB, // expand in place a varargs array (of known size)
+            OP_FLYBY         = 0xC, // operate first on reified argument list (NYI)
+            OP_RICOCHET      = 0xD, // run an adapter chain on the return value (NYI)
+            CONV_OP_LIMIT    = 0xE; // limit of CONV_OP enumeration
+        /** Shift and mask values for decoding the AMH.conversion field.
+         *  These numbers are shared with the JVM for creating AMHs.
+         */
+        static final int
+            CONV_OP_MASK     = 0xF00, // this nybble contains the conversion op field
+            CONV_VMINFO_MASK = 0x0FF, // LSB is reserved for JVM use
+            CONV_VMINFO_SHIFT     =  0, // position of bits in CONV_VMINFO_MASK
+            CONV_OP_SHIFT         =  8, // position of bits in CONV_OP_MASK
+            CONV_DEST_TYPE_SHIFT  = 12, // byte 2 has the adapter BasicType (if needed)
+            CONV_SRC_TYPE_SHIFT   = 16, // byte 2 has the source BasicType (if needed)
+            CONV_STACK_MOVE_SHIFT = 20, // high 12 bits give signed SP change
+            CONV_STACK_MOVE_MASK  = (1 << (32 - CONV_STACK_MOVE_SHIFT)) - 1;
+
+        /** Which conv-ops are implemented by the JVM? */
+        static final int DEFAULT_CONV_OP_IMPLEMENTED_MASK =
+                // Value to use if the corresponding JVM query fails.
+                ((1<<OP_RETYPE_ONLY)
+                |(1<<OP_RETYPE_RAW)
+                |(1<<OP_CHECK_CAST)
+                |(1<<OP_PRIM_TO_PRIM)
+                |(1<<OP_REF_TO_PRIM)
+                |(1<<OP_SWAP_ARGS)
+                |(1<<OP_ROT_ARGS)
+                |(1<<OP_DUP_ARGS)
+                |(1<<OP_DROP_ARGS)
+                //|(1<<OP_SPREAD_ARGS)
+                );
+
+        /**
+         * Basic types as encoded in the JVM.  These code values are not
+         * intended for use outside this class.  They are used as part of
+         * a private interface between the JVM and this class.
+         */
+        static final int
+            T_BOOLEAN  =  4,
+            T_CHAR     =  5,
+            T_FLOAT    =  6,
+            T_DOUBLE   =  7,
+            T_BYTE     =  8,
+            T_SHORT    =  9,
+            T_INT      = 10,
+            T_LONG     = 11,
+            T_OBJECT   = 12,
+            //T_ARRAY    = 13
+            T_VOID     = 14;
+            //T_ADDRESS  = 15
+
+        /**
+         * Constant pool reference-kind codes, as used by CONSTANT_MethodHandle CP entries.
+         */
+        static final int
+            REF_getField                = 1,
+            REF_getStatic               = 2,
+            REF_putField                = 3,
+            REF_putStatic               = 4,
+            REF_invokeVirtual           = 5,
+            REF_invokeStatic            = 6,
+            REF_invokeSpecial           = 7,
+            REF_newInvokeSpecial        = 8,
+            REF_invokeInterface         = 9;
+    }
+
+    private static native int getNamedCon(int which, Object[] name);
+    static boolean verifyConstants() {
+        Object[] box = { null };
+        for (int i = 0; ; i++) {
+            box[0] = null;
+            int vmval = getNamedCon(i, box);
+            if (box[0] == null)  break;
+            String name = (String) box[0];
+            try {
+                Field con = Constants.class.getDeclaredField(name);
+                int jval = con.getInt(null);
+                if (jval != vmval)
+                    throw new InternalError(name+": JVM has "+vmval+" while Java has "+jval);
+            } catch (Exception ex) {
+                throw new InternalError(name+": access failed, got "+ex);
+            }
+        }
+        return true;
+    }
+    static {
+        verifyConstants();
+    }
+
+    // Up-calls from the JVM.
+    // These must NOT be public.
+
+    /**
+     * The JVM is linking an invokedynamic instruction.  Create a reified call site for it.
+     */
+    static CallSite makeDynamicCallSite(MethodHandle bootstrapMethod,
+                                        String name, MethodType type,
+                                        Object info,
+                                        MemberName callerMethod, int callerBCI) {
+        return CallSite.makeSite(bootstrapMethod, name, type, info, callerMethod, callerBCI);
+    }
+
+    /**
+     * Called by the JVM to check the length of a spread array.
+     */
+    static void checkSpreadArgument(Object av, int n) {
+        MethodHandleStatics.checkSpreadArgument(av, n);
+    }
+
+    /**
+     * The JVM wants a pointer to a MethodType.  Oblige it by finding or creating one.
+     */
+    static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) {
+        return MethodType.makeImpl(rtype, ptypes, true);
+    }
+
+    /**
+     * The JVM wants to use a MethodType with invokeGeneric.  Give the runtime fair warning.
+     */
+    static void notifyGenericMethodType(MethodType type) {
+        type.form().notifyGenericMethodType();
+    }
+
+    /**
+     * The JVM wants to raise an exception.  Here's the path.
+     */
+    static void raiseException(int code, Object actual, Object required) {
+        String message;
+        // disregard the identity of the actual object, if it is not a class:
+        if (!(actual instanceof Class) && !(actual instanceof MethodType))
+            actual = actual.getClass();
+        if (actual != null)
+            message = "required "+required+" but encountered "+actual;
+        else
+            message = "required "+required;
+        switch (code) {
+        case 192: // checkcast
+            throw new ClassCastException(message);
+        default:
+            throw new InternalError("unexpected code "+code+": "+message);
+        }
+    }
+
+    /**
+     * The JVM is resolving a CONSTANT_MethodHandle CP entry.  And it wants our help.
+     * It will make an up-call to this method.  (Do not change the name or signature.)
+     */
+    static MethodHandle linkMethodHandleConstant(Class<?> callerClass, int refKind,
+                                                 Class<?> defc, String name, Object type) {
+        try {
+            Lookup lookup = IMPL_LOOKUP.in(callerClass);
+            switch (refKind) {
+            case REF_getField:          return lookup.findGetter(       defc, name, (Class<?>)   type );
+            case REF_getStatic:         return lookup.findStaticGetter( defc, name, (Class<?>)   type );
+            case REF_putField:          return lookup.findSetter(       defc, name, (Class<?>)   type );
+            case REF_putStatic:         return lookup.findStaticSetter( defc, name, (Class<?>)   type );
+            case REF_invokeVirtual:     return lookup.findVirtual(      defc, name, (MethodType) type );
+            case REF_invokeStatic:      return lookup.findStatic(       defc, name, (MethodType) type );
+            case REF_invokeSpecial:     return lookup.findSpecial(      defc, name, (MethodType) type, callerClass );
+            case REF_newInvokeSpecial:  return lookup.findConstructor(  defc,       (MethodType) type );
+            case REF_invokeInterface:   return lookup.findVirtual(      defc, name, (MethodType) type );
+            }
+            throw new IllegalArgumentException("bad MethodHandle constant "+name+" : "+type);
+        } catch (ReflectiveOperationException ex) {
+            Error err = new IncompatibleClassChangeError();
+            err.initCause(ex);
+            throw err;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2011, 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 java.lang.invoke;
+
+/**
+ * This class consists exclusively of static names internal to the
+ * method handle implementation.
+ * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
+ * @author John Rose, JSR 292 EG
+ */
+/*non-public*/ class MethodHandleStatics {
+
+    private MethodHandleStatics() { }  // do not instantiate
+
+    /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
+        if (type == null)
+            type = target.type();
+        MemberName name = null;
+        if (target != null)
+            name = MethodHandleNatives.getMethodName(target);
+        if (name == null)
+            return "invoke" + type;
+        return name.getName() + type;
+    }
+
+    /*non-public*/ static String getNameString(MethodHandle target, MethodHandle typeHolder) {
+        return getNameString(target, typeHolder == null ? (MethodType) null : typeHolder.type());
+    }
+
+    /*non-public*/ static String getNameString(MethodHandle target) {
+        return getNameString(target, (MethodType) null);
+    }
+
+    /*non-public*/ static String addTypeString(Object obj, MethodHandle target) {
+        String str = String.valueOf(obj);
+        if (target == null)  return str;
+        int paren = str.indexOf('(');
+        if (paren >= 0) str = str.substring(0, paren);
+        return str + target.type();
+    }
+
+    static void checkSpreadArgument(Object av, int n) {
+        if (av == null ? n != 0 : ((Object[])av).length != n)
+            throw newIllegalArgumentException("Array is not of length "+n);
+    }
+
+    // handy shared exception makers (they simplify the common case code)
+    /*non-public*/ static RuntimeException newIllegalStateException(String message) {
+        return new IllegalStateException(message);
+    }
+    /*non-public*/ static RuntimeException newIllegalStateException(String message, Object obj) {
+        return new IllegalStateException(message(message, obj));
+    }
+    /*non-public*/ static RuntimeException newIllegalArgumentException(String message) {
+        return new IllegalArgumentException(message);
+    }
+    /*non-public*/ static RuntimeException newIllegalArgumentException(String message, Object obj) {
+        return new IllegalArgumentException(message(message, obj));
+    }
+    /*non-public*/ static Error uncaughtException(Exception ex) {
+        Error err = new InternalError("uncaught exception");
+        err.initCause(ex);
+        return err;
+    }
+    private static String message(String message, Object obj) {
+        if (obj != null)  message = message + ": " + obj;
+        return message;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import java.lang.reflect.*;
+import sun.invoke.WrapperInstance;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyAccess;
+import sun.invoke.util.Wrapper;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import sun.reflect.Reflection;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * This class consists exclusively of static methods that operate on or return
+ * method handles. They fall into several categories:
+ * <ul>
+ * <li>Lookup methods which help create method handles for methods and fields.
+ * <li>Combinator methods, which combine or transform pre-existing method handles into new ones.
+ * <li>Other factory methods to create method handles that emulate other common JVM operations or control flow patterns.
+ * <li>Wrapper methods which can convert between method handles and interface types.
+ * </ul>
+ * <p>
+ * @author John Rose, JSR 292 EG
+ */
+public class MethodHandles {
+
+    private MethodHandles() { }  // do not instantiate
+
+    private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory();
+    static { MethodHandleImpl.initStatics(); }
+    // See IMPL_LOOKUP below.
+
+    //// Method handle creation from ordinary methods.
+
+    /**
+     * Returns a {@link Lookup lookup object} on the caller,
+     * which has the capability to access any method handle that the caller has access to,
+     * including direct method handles to private fields and methods.
+     * This lookup object is a <em>capability</em> which may be delegated to trusted agents.
+     * Do not store it in place where untrusted code can access it.
+     */
+    public static Lookup lookup() {
+        return new Lookup();
+    }
+
+    /**
+     * Returns a {@link Lookup lookup object} which is trusted minimally.
+     * It can only be used to create method handles to
+     * publicly accessible fields and methods.
+     * <p>
+     * As a matter of pure convention, the {@linkplain Lookup#lookupClass lookup class}
+     * of this lookup object will be {@link java.lang.Object}.
+     * <p>
+     * The lookup class can be changed to any other class {@code C} using an expression of the form
+     * {@linkplain Lookup#in <code>publicLookup().in(C.class)</code>}.
+     * Since all classes have equal access to public names,
+     * such a change would confer no new access rights.
+     */
+    public static Lookup publicLookup() {
+        return Lookup.PUBLIC_LOOKUP;
+    }
+
+    /**
+     * A <em>lookup object</em> is a factory for creating method handles,
+     * when the creation requires access checking.
+     * Method handles do not perform
+     * access checks when they are called, but rather when they are created.
+     * Therefore, method handle access
+     * restrictions must be enforced when a method handle is created.
+     * The caller class against which those restrictions are enforced
+     * is known as the {@linkplain #lookupClass lookup class}.
+     * <p>
+     * A lookup class which needs to create method handles will call
+     * {@link MethodHandles#lookup MethodHandles.lookup} to create a factory for itself.
+     * When the {@code Lookup} factory object is created, the identity of the lookup class is
+     * determined, and securely stored in the {@code Lookup} object.
+     * The lookup class (or its delegates) may then use factory methods
+     * on the {@code Lookup} object to create method handles for access-checked members.
+     * This includes all methods, constructors, and fields which are allowed to the lookup class,
+     * even private ones.
+     * <p>
+     * The factory methods on a {@code Lookup} object correspond to all major
+     * use cases for methods, constructors, and fields.
+     * Here is a summary of the correspondence between these factory methods and
+     * the behavior the resulting method handles:
+     * <code>
+     * <table border=1 cellpadding=5 summary="lookup method behaviors">
+     * <tr><th>lookup expression</th><th>member</th><th>behavior</th></tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td>
+     *     <td>FT f;</td><td>(T) this.f;</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</td>
+     *     <td>static<br>FT f;</td><td>(T) C.f;</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</td>
+     *     <td>FT f;</td><td>this.f = x;</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}</td>
+     *     <td>static<br>FT f;</td><td>C.f = arg;</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}</td>
+     *     <td>T m(A*);</td><td>(T) this.m(arg*);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}</td>
+     *     <td>static<br>T m(A*);</td><td>(T) C.m(arg*);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}</td>
+     *     <td>T m(A*);</td><td>(T) super.m(arg*);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}</td>
+     *     <td>C(A*);</td><td>(T) new C(arg*);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}</td>
+     *     <td>(static)?<br>FT f;</td><td>(FT) aField.get(thisOrNull);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}</td>
+     *     <td>(static)?<br>FT f;</td><td>aField.set(thisOrNull, arg);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
+     *     <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}</td>
+     *     <td>C(A*);</td><td>(C) aConstructor.newInstance(arg*);</td>
+     * </tr>
+     * <tr>
+     *     <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
+     *     <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td>
+     * </tr>
+     * </table>
+     * </code>
+     * Here, the type {@code C} is the class or interface being searched for a member,
+     * documented as a parameter named {@code refc} in the lookup methods.
+     * The method or constructor type {@code MT} is composed from the return type {@code T}
+     * and the sequence of argument types {@code A*}.
+     * Both {@code MT} and the field type {@code FT} are documented as a parameter named {@code type}.
+     * The formal parameter {@code this} stands for the self-reference of type {@code C};
+     * if it is present, it is always the leading argument to the method handle invocation.
+     * The name {@code arg} stands for all the other method handle arguments.
+     * In the code examples for the Core Reflection API, the name {@code thisOrNull}
+     * stands for a null reference if the accessed method or field is static,
+     * and {@code this} otherwise.
+     * The names {@code aMethod}, {@code aField}, and {@code aConstructor} stand
+     * for reflective objects corresponding to the given members.
+     * <p>
+     * The equivalence between looked-up method handles and underlying
+     * class members can break down in a few ways:
+     * <ul>
+     * <li>If {@code C} is not symbolically accessible from the lookup class's loader,
+     * the lookup can still succeed, even when there is no equivalent
+     * Java expression or bytecoded constant.
+     * <li>Likewise, if {@code T} or {@code MT}
+     * is not symbolically accessible from the lookup class's loader,
+     * the lookup can still succeed.
+     * For example, lookups for {@code MethodHandle.invokeExact} and
+     * {@code MethodHandle.invokeGeneric} will always succeed, regardless of requested type.
+     * <li>If there is a security manager installed, it can forbid the lookup
+     * on various grounds (<a href="#secmgr">see below</a>).
+     * By contrast, the {@code ldc} instruction is not subject to
+     * security manager checks.
+     * </ul>
+     *
+     * <h3><a name="access"></a>Access checking</h3>
+     * Access checks are applied in the factory methods of {@code Lookup},
+     * when a method handle is created.
+     * This is a key difference from the Core Reflection API, since
+     * {@link java.lang.reflect.Method#invoke Method.invoke}
+     * performs access checking against every caller, on every call.
+     * <p>
+     * All access checks start from a {@code Lookup} object, which
+     * compares its recorded lookup class against all requests to
+     * create method handles.
+     * A single {@code Lookup} object can be used to create any number
+     * of access-checked method handles, all checked against a single
+     * lookup class.
+     * <p>
+     * A {@code Lookup} object can be shared with other trusted code,
+     * such as a metaobject protocol.
+     * A shared {@code Lookup} object delegates the capability
+     * to create method handles on private members of the lookup class.
+     * Even if privileged code uses the {@code Lookup} object,
+     * the access checking is confined to the privileges of the
+     * original lookup class.
+     * <p>
+     * A lookup can fail, because
+     * the containing class is not accessible to the lookup class, or
+     * because the desired class member is missing, or because the
+     * desired class member is not accessible to the lookup class.
+     * In any of these cases, a {@code ReflectiveOperationException} will be
+     * thrown from the attempted lookup.  The exact class will be one of
+     * the following:
+     * <ul>
+     * <li>NoSuchMethodException &mdash; if a method is requested but does not exist
+     * <li>NoSuchFieldException &mdash; if a field is requested but does not exist
+     * <li>IllegalAccessException &mdash; if the member exists but an access check fails
+     * </ul>
+     * <p>
+     * In general, the conditions under which a method handle may be
+     * looked up for a method {@code M} are exactly equivalent to the conditions
+     * under which the lookup class could have compiled and resolved a call to {@code M}.
+     * And the effect of invoking the method handle resulting from the lookup
+     * is exactly equivalent to executing the compiled and resolved call to {@code M}.
+     * The same point is true of fields and constructors.
+     * <p>
+     * In some cases, access between nested classes is obtained by the Java compiler by creating
+     * an wrapper method to access a private method of another class
+     * in the same top-level declaration.
+     * For example, a nested class {@code C.D}
+     * can access private members within other related classes such as
+     * {@code C}, {@code C.D.E}, or {@code C.B},
+     * but the Java compiler may need to generate wrapper methods in
+     * those related classes.  In such cases, a {@code Lookup} object on
+     * {@code C.E} would be unable to those private members.
+     * A workaround for this limitation is the {@link Lookup#in Lookup.in} method,
+     * which can transform a lookup on {@code C.E} into one on any of those other
+     * classes, without special elevation of privilege.
+     * <p>
+     * Although bytecode instructions can only refer to classes in
+     * a related class loader, this API can search for methods in any
+     * class, as long as a reference to its {@code Class} object is
+     * available.  Such cross-loader references are also possible with the
+     * Core Reflection API, and are impossible to bytecode instructions
+     * such as {@code invokestatic} or {@code getfield}.
+     * There is a {@linkplain java.lang.SecurityManager security manager API}
+     * to allow applications to check such cross-loader references.
+     * These checks apply to both the {@code MethodHandles.Lookup} API
+     * and the Core Reflection API
+     * (as found on {@link java.lang.Class Class}).
+     * <p>
+     * Access checks only apply to named and reflected methods,
+     * constructors, and fields.
+     * Other method handle creation methods, such as
+     * {@link #convertArguments MethodHandles.convertArguments},
+     * do not require any access checks, and are done
+     * with static methods of {@link MethodHandles},
+     * independently of any {@code Lookup} object.
+     *
+     * <h3>Security manager interactions</h3>
+     * <a name="secmgr"></a>
+     * If a security manager is present, member lookups are subject to
+     * additional checks.
+     * From one to four calls are made to the security manager.
+     * Any of these calls can refuse access by throwing a
+     * {@link java.lang.SecurityException SecurityException}.
+     * Define {@code smgr} as the security manager,
+     * {@code refc} as the containing class in which the member
+     * is being sought, and {@code defc} as the class in which the
+     * member is actually defined.
+     * The calls are made according to the following rules:
+     * <ul>
+     * <li>In all cases, {@link SecurityManager#checkMemberAccess
+     *     smgr.checkMemberAccess(refc, Member.PUBLIC)} is called.
+     * <li>If the class loader of the lookup class is not
+     *     the same as or an ancestor of the class loader of {@code refc},
+     *     then {@link SecurityManager#checkPackageAccess
+     *     smgr.checkPackageAccess(refcPkg)} is called,
+     *     where {@code refcPkg} is the package of {@code refc}.
+     * <li>If the retrieved member is not public,
+     *     {@link SecurityManager#checkMemberAccess
+     *     smgr.checkMemberAccess(defc, Member.DECLARED)} is called.
+     *     (Note that {@code defc} might be the same as {@code refc}.)
+     * <li>If the retrieved member is not public,
+     *     and if {@code defc} and {@code refc} are in different class loaders,
+     *     and if the class loader of the lookup class is not
+     *     the same as or an ancestor of the class loader of {@code defc},
+     *     then {@link SecurityManager#checkPackageAccess
+     *     smgr.checkPackageAccess(defcPkg)} is called,
+     *     where {@code defcPkg} is the package of {@code defc}.
+     * </ul>
+     * In all cases, the requesting class presented to the security
+     * manager will be the lookup class from the current {@code Lookup} object.
+     */
+    public static final
+    class Lookup {
+        /** The class on behalf of whom the lookup is being performed. */
+        private final Class<?> lookupClass;
+
+        /** The allowed sorts of members which may be looked up (PUBLIC, etc.). */
+        private final int allowedModes;
+
+        /** A single-bit mask representing {@code public} access,
+         *  which may contribute to the result of {@link #lookupModes lookupModes}.
+         *  The value, {@code 0x01}, happens to be the same as the value of the
+         *  {@code public} {@linkplain java.lang.reflect.Modifier#PUBLIC modifier bit}.
+         */
+        public static final int PUBLIC = Modifier.PUBLIC;
+
+        /** A single-bit mask representing {@code private} access,
+         *  which may contribute to the result of {@link #lookupModes lookupModes}.
+         *  The value, {@code 0x02}, happens to be the same as the value of the
+         *  {@code private} {@linkplain java.lang.reflect.Modifier#PRIVATE modifier bit}.
+         */
+        public static final int PRIVATE = Modifier.PRIVATE;
+
+        /** A single-bit mask representing {@code protected} access,
+         *  which may contribute to the result of {@link #lookupModes lookupModes}.
+         *  The value, {@code 0x04}, happens to be the same as the value of the
+         *  {@code protected} {@linkplain java.lang.reflect.Modifier#PROTECTED modifier bit}.
+         */
+        public static final int PROTECTED = Modifier.PROTECTED;
+
+        /** A single-bit mask representing {@code package} access (default access),
+         *  which may contribute to the result of {@link #lookupModes lookupModes}.
+         *  The value is {@code 0x08}, which does not correspond meaningfully to
+         *  any particular {@linkplain java.lang.reflect.Modifier modifier bit}.
+         */
+        public static final int PACKAGE = Modifier.STATIC;
+
+        private static final int ALL_MODES = (PUBLIC | PRIVATE | PROTECTED | PACKAGE);
+        private static final int TRUSTED   = -1;
+
+        private static int fixmods(int mods) {
+            mods &= (ALL_MODES - PACKAGE);
+            return (mods != 0) ? mods : PACKAGE;
+        }
+
+        /** Tells which class is performing the lookup.  It is this class against
+         *  which checks are performed for visibility and access permissions.
+         *  <p>
+         *  The class implies a maximum level of access permission,
+         *  but the permissions may be additionally limited by the bitmask
+         *  {@link #lookupModes lookupModes}, which controls whether non-public members
+         *  can be accessed.
+         */
+        public Class<?> lookupClass() {
+            return lookupClass;
+        }
+
+        // This is just for calling out to MethodHandleImpl.
+        private Class<?> lookupClassOrNull() {
+            return (allowedModes == TRUSTED) ? null : lookupClass;
+        }
+
+        /** Tells which access-protection classes of members this lookup object can produce.
+         *  The result is a bit-mask of the bits
+         *  {@linkplain #PUBLIC PUBLIC (0x01)},
+         *  {@linkplain #PRIVATE PRIVATE (0x02)},
+         *  {@linkplain #PROTECTED PROTECTED (0x04)},
+         *  and {@linkplain #PACKAGE PACKAGE (0x08)}.
+         *  <p>
+         *  A freshly-created lookup object
+         *  on the {@linkplain java.lang.invoke.MethodHandles#lookup() caller's class}
+         *  has all possible bits set, since the caller class can access all its own members.
+         *  A lookup object on a new lookup class
+         *  {@linkplain java.lang.invoke.MethodHandles.Lookup#in created from a previous lookup object}
+         *  may have some mode bits set to zero.
+         *  The purpose of this is to restrict access via the new lookup object,
+         *  so that it can access only names which can be reached by the original
+         *  lookup object, and also by the new lookup class.
+         */
+        public int lookupModes() {
+            return allowedModes & ALL_MODES;
+        }
+
+        /** Embody the current class (the lookupClass) as a lookup class
+         * for method handle creation.
+         * Must be called by from a method in this package,
+         * which in turn is called by a method not in this package.
+         * <p>
+         * Also, don't make it private, lest javac interpose
+         * an access$N method.
+         */
+        Lookup() {
+            this(getCallerClassAtEntryPoint(), ALL_MODES);
+            // make sure we haven't accidentally picked up a privileged class:
+            checkUnprivilegedlookupClass(lookupClass);
+        }
+
+        Lookup(Class<?> lookupClass) {
+            this(lookupClass, ALL_MODES);
+        }
+
+        private Lookup(Class<?> lookupClass, int allowedModes) {
+            this.lookupClass = lookupClass;
+            this.allowedModes = allowedModes;
+        }
+
+        /**
+         * Creates a lookup on the specified new lookup class.
+         * The resulting object will report the specified
+         * class as its own {@link #lookupClass lookupClass}.
+         * <p>
+         * However, the resulting {@code Lookup} object is guaranteed
+         * to have no more access capabilities than the original.
+         * In particular, access capabilities can be lost as follows:<ul>
+         * <li>If the new lookup class differs from the old one,
+         * protected members will not be accessible by virtue of inheritance.
+         * (Protected members may continue to be accessible because of package sharing.)
+         * <li>If the new lookup class is in a different package
+         * than the old one, protected and default (package) members will not be accessible.
+         * <li>If the new lookup class is not within the same package member
+         * as the old one, private members will not be accessible.
+         * <li>If the new lookup class is not accessible to the old lookup class,
+         * then no members, not even public members, will be accessible.
+         * (In all other cases, public members will continue to be accessible.)
+         * </ul>
+         *
+         * @param requestedLookupClass the desired lookup class for the new lookup object
+         * @return a lookup object which reports the desired lookup class
+         * @throws NullPointerException if the argument is null
+         */
+        public Lookup in(Class<?> requestedLookupClass) {
+            requestedLookupClass.getClass();  // null check
+            if (allowedModes == TRUSTED)  // IMPL_LOOKUP can make any lookup at all
+                return new Lookup(requestedLookupClass, ALL_MODES);
+            if (requestedLookupClass == this.lookupClass)
+                return this;  // keep same capabilities
+            int newModes = (allowedModes & (ALL_MODES & ~PROTECTED));
+            if ((newModes & PACKAGE) != 0
+                && !VerifyAccess.isSamePackage(this.lookupClass, requestedLookupClass)) {
+                newModes &= ~(PACKAGE|PRIVATE);
+            }
+            // Allow nestmate lookups to be created without special privilege:
+            if ((newModes & PRIVATE) != 0
+                && !VerifyAccess.isSamePackageMember(this.lookupClass, requestedLookupClass)) {
+                newModes &= ~PRIVATE;
+            }
+            if (newModes == PUBLIC
+                && !VerifyAccess.isClassAccessible(requestedLookupClass, this.lookupClass)) {
+                // The requested class it not accessible from the lookup class.
+                // No permissions.
+                newModes = 0;
+            }
+            checkUnprivilegedlookupClass(requestedLookupClass);
+            return new Lookup(requestedLookupClass, newModes);
+        }
+
+        // Make sure outer class is initialized first.
+        static { IMPL_NAMES.getClass(); }
+
+        /** Version of lookup which is trusted minimally.
+         *  It can only be used to create method handles to
+         *  publicly accessible members.
+         */
+        static final Lookup PUBLIC_LOOKUP = new Lookup(Object.class, PUBLIC);
+
+        /** Package-private version of lookup which is trusted. */
+        static final Lookup IMPL_LOOKUP = new Lookup(Object.class, TRUSTED);
+
+        private static void checkUnprivilegedlookupClass(Class<?> lookupClass) {
+            String name = lookupClass.getName();
+            if (name.startsWith("java.lang.invoke."))
+                throw newIllegalArgumentException("illegal lookupClass: "+lookupClass);
+        }
+
+        /**
+         * Displays the name of the class from which lookups are to be made.
+         * (The name is the one reported by {@link java.lang.Class#getName() Class.getName}.)
+         * If there are restrictions on the access permitted to this lookup,
+         * this is indicated by adding a suffix to the class name, consisting
+         * of a slash and a keyword.  The keyword represents the strongest
+         * allowed access, and is chosen as follows:
+         * <ul>
+         * <li>If no access is allowed, the suffix is "/noaccess".
+         * <li>If only public access is allowed, the suffix is "/public".
+         * <li>If only public and package access are allowed, the suffix is "/package".
+         * <li>If only public, package, and private access are allowed, the suffix is "/private".
+         * </ul>
+         * If none of the above cases apply, it is the case that full
+         * access (public, package, private, and protected) is allowed.
+         * In this case, no suffix is added.
+         * This is true only of an object obtained originally from
+         * {@link java.lang.invoke.MethodHandles#lookup MethodHandles.lookup}.
+         * Objects created by {@link java.lang.invoke.MethodHandles.Lookup#in Lookup.in}
+         * always have restricted access, and will display a suffix.
+         * <p>
+         * (It may seem strange that protected access should be
+         * stronger than private access.  Viewed independently from
+         * package access, protected access is the first to be lost,
+         * because it requires a direct subclass relationship between
+         * caller and callee.)
+         * @see #in
+         */
+        @Override
+        public String toString() {
+            String cname = lookupClass.getName();
+            switch (allowedModes) {
+            case 0:  // no privileges
+                return cname + "/noaccess";
+            case PUBLIC:
+                return cname + "/public";
+            case PUBLIC|PACKAGE:
+                return cname + "/package";
+            case ALL_MODES & ~PROTECTED:
+                return cname + "/private";
+            case ALL_MODES:
+                return cname;
+            case TRUSTED:
+                return "/trusted";  // internal only; not exported
+            default:  // Should not happen, but it's a bitfield...
+                cname = cname + "/" + Integer.toHexString(allowedModes);
+                assert(false) : cname;
+                return cname;
+            }
+        }
+
+        // call this from an entry point method in Lookup with extraFrames=0.
+        private static Class<?> getCallerClassAtEntryPoint() {
+            final int CALLER_DEPTH = 4;
+            // 0: Reflection.getCC, 1: getCallerClassAtEntryPoint,
+            // 2: Lookup.<init>, 3: MethodHandles.*, 4: caller
+            // Note:  This should be the only use of getCallerClass in this file.
+            assert(Reflection.getCallerClass(CALLER_DEPTH-1) == MethodHandles.class);
+            return Reflection.getCallerClass(CALLER_DEPTH);
+        }
+
+        /**
+         * Produces a method handle for a static method.
+         * The type of the method handle will be that of the method.
+         * (Since static methods do not take receivers, there is no
+         * additional receiver argument inserted into the method handle type,
+         * as there would be with {@link #findVirtual findVirtual} or {@link #findSpecial findSpecial}.)
+         * The method and all its argument types must be accessible to the lookup class.
+         * If the method's class has not yet been initialized, that is done
+         * immediately, before the method handle is returned.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * @param refc the class from which the method is accessed
+         * @param name the name of the method
+         * @param type the type of the method
+         * @return the desired method handle
+         * @throws NoSuchMethodException if the method does not exist
+         * @throws IllegalAccessException if access checking fails, or if the method is not {@code static}
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public
+        MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
+            MemberName method = resolveOrFail(refc, name, type, true);
+            checkMethod(refc, method, true);
+            return MethodHandleImpl.findMethod(method, false, lookupClassOrNull());
+        }
+
+        /**
+         * Produces a method handle for a virtual method.
+         * The type of the method handle will be that of the method,
+         * with the receiver type (usually {@code refc}) prepended.
+         * The method and all its argument types must be accessible to the lookup class.
+         * <p>
+         * When called, the handle will treat the first argument as a receiver
+         * and dispatch on the receiver's type to determine which method
+         * implementation to enter.
+         * (The dispatching action is identical with that performed by an
+         * {@code invokevirtual} or {@code invokeinterface} instruction.)
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * <p>
+         * Because of the general equivalence between {@code invokevirtual}
+         * instructions and method handles produced by {@code findVirtual},
+         * if the class is {@code MethodHandle} and the name string is
+         * {@code invokeExact} or {@code invokeGeneric}, the resulting
+         * method handle is equivalent to one produced by
+         * {@link java.lang.invoke.MethodHandles#exactInvoker MethodHandles.exactInvoker} or
+         * {@link java.lang.invoke.MethodHandles#genericInvoker MethodHandles.genericInvoker}
+         * with the same {@code type} argument.
+         *
+         * @param refc the class or interface from which the method is accessed
+         * @param name the name of the method
+         * @param type the type of the method, with the receiver argument omitted
+         * @return the desired method handle
+         * @throws NoSuchMethodException if the method does not exist
+         * @throws IllegalAccessException if access checking fails, or if the method is {@code static}
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findVirtual(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
+            MemberName method = resolveOrFail(refc, name, type, false);
+            checkMethod(refc, method, false);
+            MethodHandle mh = MethodHandleImpl.findMethod(method, true, lookupClassOrNull());
+            return restrictProtectedReceiver(method, mh);
+        }
+
+        /**
+         * Produces a method handle which creates an object and initializes it, using
+         * the constructor of the specified type.
+         * The parameter types of the method handle will be those of the constructor,
+         * while the return type will be a reference to the constructor's class.
+         * The constructor and all its argument types must be accessible to the lookup class.
+         * If the constructor's class has not yet been initialized, that is done
+         * immediately, before the method handle is returned.
+         * <p>
+         * Note:  The requested type must have a return type of {@code void}.
+         * This is consistent with the JVM's treatment of constructor type descriptors.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the constructor's variable arity modifier bit ({@code 0x0080}) is set.
+         * @param refc the class or interface from which the method is accessed
+         * @param type the type of the method, with the receiver argument omitted, and a void return type
+         * @return the desired method handle
+         * @throws NoSuchMethodException if the constructor does not exist
+         * @throws IllegalAccessException if access checking fails
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuchMethodException, IllegalAccessException {
+            String name = "<init>";
+            MemberName ctor = resolveOrFail(refc, name, type, false, false, lookupClassOrNull());
+            assert(ctor.isConstructor());
+            checkAccess(refc, ctor);
+            MethodHandle rawMH = MethodHandleImpl.findMethod(ctor, false, lookupClassOrNull());
+            MethodHandle allocMH = MethodHandleImpl.makeAllocator(rawMH);
+            return fixVarargs(allocMH, rawMH);
+        }
+
+        /** Return a version of MH which matches matchMH w.r.t. isVarargsCollector. */
+        private static MethodHandle fixVarargs(MethodHandle mh, MethodHandle matchMH) {
+            boolean va1 = mh.isVarargsCollector();
+            boolean va2 = matchMH.isVarargsCollector();
+            if (va1 == va2) {
+                return mh;
+            } else if (va2) {
+                MethodType type = mh.type();
+                int arity = type.parameterCount();
+                return mh.asVarargsCollector(type.parameterType(arity-1));
+            } else {
+                throw new InternalError("already varargs, but template is not: "+mh);
+            }
+        }
+
+        /**
+         * Produces an early-bound method handle for a virtual method,
+         * as if called from an {@code invokespecial}
+         * instruction from {@code caller}.
+         * The type of the method handle will be that of the method,
+         * with a suitably restricted receiver type (such as {@code caller}) prepended.
+         * The method and all its argument types must be accessible
+         * to the caller.
+         * <p>
+         * When called, the handle will treat the first argument as a receiver,
+         * but will not dispatch on the receiver's type.
+         * (This direct invocation action is identical with that performed by an
+         * {@code invokespecial} instruction.)
+         * <p>
+         * If the explicitly specified caller class is not identical with the
+         * lookup class, or if this lookup object does not have private access
+         * privileges, the access fails.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * @param refc the class or interface from which the method is accessed
+         * @param name the name of the method (which must not be "&lt;init&gt;")
+         * @param type the type of the method, with the receiver argument omitted
+         * @param specialCaller the proposed calling class to perform the {@code invokespecial}
+         * @return the desired method handle
+         * @throws NoSuchMethodException if the method does not exist
+         * @throws IllegalAccessException if access checking fails
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findSpecial(Class<?> refc, String name, MethodType type,
+                                        Class<?> specialCaller) throws NoSuchMethodException, IllegalAccessException {
+            checkSpecialCaller(specialCaller);
+            MemberName method = resolveOrFail(refc, name, type, false, false, specialCaller);
+            checkMethod(refc, method, false);
+            MethodHandle mh = MethodHandleImpl.findMethod(method, false, specialCaller);
+            return restrictReceiver(method, mh, specialCaller);
+        }
+
+        /**
+         * Produces a method handle giving read access to a non-static field.
+         * The type of the method handle will have a return type of the field's
+         * value type.
+         * The method handle's single argument will be the instance containing
+         * the field.
+         * Access checking is performed immediately on behalf of the lookup class.
+         * @param refc the class or interface from which the method is accessed
+         * @param name the field's name
+         * @param type the field's type
+         * @return a method handle which can load values from the field
+         * @throws NoSuchFieldException if the field does not exist
+         * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
+            return makeAccessor(refc, name, type, false, false);
+        }
+
+        /**
+         * Produces a method handle giving write access to a non-static field.
+         * The type of the method handle will have a void return type.
+         * The method handle will take two arguments, the instance containing
+         * the field, and the value to be stored.
+         * The second argument will be of the field's value type.
+         * Access checking is performed immediately on behalf of the lookup class.
+         * @param refc the class or interface from which the method is accessed
+         * @param name the field's name
+         * @param type the field's type
+         * @return a method handle which can store values into the field
+         * @throws NoSuchFieldException if the field does not exist
+         * @throws IllegalAccessException if access checking fails, or if the field is {@code static}
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
+            return makeAccessor(refc, name, type, false, true);
+        }
+
+        /**
+         * Produces a method handle giving read access to a static field.
+         * The type of the method handle will have a return type of the field's
+         * value type.
+         * The method handle will take no arguments.
+         * Access checking is performed immediately on behalf of the lookup class.
+         * @param refc the class or interface from which the method is accessed
+         * @param name the field's name
+         * @param type the field's type
+         * @return a method handle which can load values from the field
+         * @throws NoSuchFieldException if the field does not exist
+         * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findStaticGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
+            return makeAccessor(refc, name, type, true, false);
+        }
+
+        /**
+         * Produces a method handle giving write access to a static field.
+         * The type of the method handle will have a void return type.
+         * The method handle will take a single
+         * argument, of the field's value type, the value to be stored.
+         * Access checking is performed immediately on behalf of the lookup class.
+         * @param refc the class or interface from which the method is accessed
+         * @param name the field's name
+         * @param type the field's type
+         * @return a method handle which can store values into the field
+         * @throws NoSuchFieldException if the field does not exist
+         * @throws IllegalAccessException if access checking fails, or if the field is not {@code static}
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle findStaticSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
+            return makeAccessor(refc, name, type, true, true);
+        }
+
+        /**
+         * Produces an early-bound method handle for a non-static method.
+         * The receiver must have a supertype {@code defc} in which a method
+         * of the given name and type is accessible to the lookup class.
+         * The method and all its argument types must be accessible to the lookup class.
+         * The type of the method handle will be that of the method,
+         * without any insertion of an additional receiver parameter.
+         * The given receiver will be bound into the method handle,
+         * so that every call to the method handle will invoke the
+         * requested method on the given receiver.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the method's variable arity modifier bit ({@code 0x0080}) is set
+         * <em>and</em> the trailing array argument is not the only argument.
+         * (If the trailing array argument is the only argument,
+         * the given receiver value will be bound to it.)
+         * <p>
+         * This is equivalent to the following code:
+         * <blockquote><pre>
+MethodHandle mh0 = {@link #findVirtual findVirtual}(defc, name, type);
+MethodHandle mh1 = mh0.{@link MethodHandle#bindTo bindTo}(receiver);
+MethodType mt1 = mh1.type();
+if (mh0.isVarargsCollector() && mt1.parameterCount() > 0) {
+  mh1 = mh1.asVarargsCollector(mt1.parameterType(mt1.parameterCount()-1));
+return mh1;
+         * </pre></blockquote>
+         * where {@code defc} is either {@code receiver.getClass()} or a super
+         * type of that class, in which the requested method is accessible
+         * to the lookup class.
+         * (Note that {@code bindTo} does not preserve variable arity.)
+         * @param receiver the object from which the method is accessed
+         * @param name the name of the method
+         * @param type the type of the method, with the receiver argument omitted
+         * @return the desired method handle
+         * @throws NoSuchMethodException if the method does not exist
+         * @throws IllegalAccessException if access checking fails
+         * @exception SecurityException if a security manager is present and it
+         *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle bind(Object receiver, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
+            Class<? extends Object> refc = receiver.getClass(); // may get NPE
+            MemberName method = resolveOrFail(refc, name, type, false);
+            checkMethod(refc, method, false);
+            MethodHandle dmh = MethodHandleImpl.findMethod(method, true, lookupClassOrNull());
+            MethodHandle bmh = MethodHandleImpl.bindReceiver(dmh, receiver);
+            if (bmh == null)
+                throw method.makeAccessException("no access", this);
+            if (dmh.type().parameterCount() == 0)
+                return dmh;  // bound the trailing parameter; no varargs possible
+            return fixVarargs(bmh, dmh);
+        }
+
+        /**
+         * Makes a direct method handle to <i>m</i>, if the lookup class has permission.
+         * If <i>m</i> is non-static, the receiver argument is treated as an initial argument.
+         * If <i>m</i> is virtual, overriding is respected on every call.
+         * Unlike the Core Reflection API, exceptions are <em>not</em> wrapped.
+         * The type of the method handle will be that of the method,
+         * with the receiver type prepended (but only if it is non-static).
+         * If the method's {@code accessible} flag is not set,
+         * access checking is performed immediately on behalf of the lookup class.
+         * If <i>m</i> is not public, do not share the resulting handle with untrusted parties.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * @param m the reflected method
+         * @return a method handle which can invoke the reflected method
+         * @throws IllegalAccessException if access checking fails
+         * @throws NullPointerException if the argument is null
+         */
+        public MethodHandle unreflect(Method m) throws IllegalAccessException {
+            MemberName method = new MemberName(m);
+            assert(method.isMethod());
+            if (!m.isAccessible())  checkMethod(method.getDeclaringClass(), method, method.isStatic());
+            MethodHandle mh = MethodHandleImpl.findMethod(method, true, lookupClassOrNull());
+            if (!m.isAccessible())  mh = restrictProtectedReceiver(method, mh);
+            return mh;
+        }
+
+        /**
+         * Produces a method handle for a reflected method.
+         * It will bypass checks for overriding methods on the receiver,
+         * as if by a {@code invokespecial} instruction from within the {@code specialCaller}.
+         * The type of the method handle will be that of the method,
+         * with the special caller type prepended (and <em>not</em> the receiver of the method).
+         * If the method's {@code accessible} flag is not set,
+         * access checking is performed immediately on behalf of the lookup class,
+         * as if {@code invokespecial} instruction were being linked.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * @param m the reflected method
+         * @param specialCaller the class nominally calling the method
+         * @return a method handle which can invoke the reflected method
+         * @throws IllegalAccessException if access checking fails
+         * @throws NullPointerException if any argument is null
+         */
+        public MethodHandle unreflectSpecial(Method m, Class<?> specialCaller) throws IllegalAccessException {
+            checkSpecialCaller(specialCaller);
+            MemberName method = new MemberName(m);
+            assert(method.isMethod());
+            // ignore m.isAccessible:  this is a new kind of access
+            checkMethod(m.getDeclaringClass(), method, false);
+            MethodHandle mh = MethodHandleImpl.findMethod(method, false, lookupClassOrNull());
+            return restrictReceiver(method, mh, specialCaller);
+        }
+
+        /**
+         * Produces a method handle for a reflected constructor.
+         * The type of the method handle will be that of the constructor,
+         * with the return type changed to the declaring class.
+         * The method handle will perform a {@code newInstance} operation,
+         * creating a new instance of the constructor's class on the
+         * arguments passed to the method handle.
+         * <p>
+         * If the constructor's {@code accessible} flag is not set,
+         * access checking is performed immediately on behalf of the lookup class.
+         * <p>
+         * The returned method handle will have
+         * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
+         * the constructor's variable arity modifier bit ({@code 0x0080}) is set.
+         * @param c the reflected constructor
+         * @return a method handle which can invoke the reflected constructor
+         * @throws IllegalAccessException if access checking fails
+         * @throws NullPointerException if the argument is null
+         */
+        public MethodHandle unreflectConstructor(Constructor c) throws IllegalAccessException {
+            MemberName ctor = new MemberName(c);
+            assert(ctor.isConstructor());
+            if (!c.isAccessible())  checkAccess(c.getDeclaringClass(), ctor);
+            MethodHandle rawCtor = MethodHandleImpl.findMethod(ctor, false, lookupClassOrNull());
+            MethodHandle allocator = MethodHandleImpl.makeAllocator(rawCtor);
+            return fixVarargs(allocator, rawCtor);
+        }
+
+        /**
+         * Produces a method handle giving read access to a reflected field.
+         * The type of the method handle will have a return type of the field's
+         * value type.
+         * If the field is static, the method handle will take no arguments.
+         * Otherwise, its single argument will be the instance containing
+         * the field.
+         * If the field's {@code accessible} flag is not set,
+         * access checking is performed immediately on behalf of the lookup class.
+         * @param f the reflected field
+         * @return a method handle which can load values from the reflected field
+         * @throws IllegalAccessException if access checking fails
+         * @throws NullPointerException if the argument is null
+         */
+        public MethodHandle unreflectGetter(Field f) throws IllegalAccessException {
+            return makeAccessor(f.getDeclaringClass(), new MemberName(f), f.isAccessible(), false);
+        }
+
+        /**
+         * Produces a method handle giving write access to a reflected field.
+         * The type of the method handle will have a void return type.
+         * If the field is static, the method handle will take a single
+         * argument, of the field's value type, the value to be stored.
+         * Otherwise, the two arguments will be the instance containing
+         * the field, and the value to be stored.
+         * If the field's {@code accessible} flag is not set,
+         * access checking is performed immediately on behalf of the lookup class.
+         * @param f the reflected field
+         * @return a method handle which can store values into the reflected field
+         * @throws IllegalAccessException if access checking fails
+         * @throws NullPointerException if the argument is null
+         */
+        public MethodHandle unreflectSetter(Field f) throws IllegalAccessException {
+            return makeAccessor(f.getDeclaringClass(), new MemberName(f), f.isAccessible(), true);
+        }
+
+        /// Helper methods, all package-private.
+
+        MemberName resolveOrFail(Class<?> refc, String name, Class<?> type, boolean isStatic) throws NoSuchFieldException, IllegalAccessException {
+            checkSymbolicClass(refc);  // do this before attempting to resolve
+            name.getClass(); type.getClass();  // NPE
+            int mods = (isStatic ? Modifier.STATIC : 0);
+            return IMPL_NAMES.resolveOrFail(new MemberName(refc, name, type, mods), true, lookupClassOrNull(),
+                                            NoSuchFieldException.class);
+        }
+
+        MemberName resolveOrFail(Class<?> refc, String name, MethodType type, boolean isStatic) throws NoSuchMethodException, IllegalAccessException {
+            checkSymbolicClass(refc);  // do this before attempting to resolve
+            name.getClass(); type.getClass();  // NPE
+            int mods = (isStatic ? Modifier.STATIC : 0);
+            return IMPL_NAMES.resolveOrFail(new MemberName(refc, name, type, mods), true, lookupClassOrNull(),
+                                            NoSuchMethodException.class);
+        }
+
+        MemberName resolveOrFail(Class<?> refc, String name, MethodType type, boolean isStatic,
+                                 boolean searchSupers, Class<?> specialCaller) throws NoSuchMethodException, IllegalAccessException {
+            checkSymbolicClass(refc);  // do this before attempting to resolve
+            name.getClass(); type.getClass();  // NPE
+            int mods = (isStatic ? Modifier.STATIC : 0);
+            return IMPL_NAMES.resolveOrFail(new MemberName(refc, name, type, mods), searchSupers, specialCaller,
+                                            NoSuchMethodException.class);
+        }
+
+        void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
+            Class<?> caller = lookupClassOrNull();
+            if (caller != null && !VerifyAccess.isClassAccessible(refc, caller))
+                throw new MemberName(refc).makeAccessException("symbolic reference class is not public", this);
+        }
+
+        void checkMethod(Class<?> refc, MemberName m, boolean wantStatic) throws IllegalAccessException {
+            String message;
+            if (m.isConstructor())
+                message = "expected a method, not a constructor";
+            else if (!m.isMethod())
+                message = "expected a method";
+            else if (wantStatic != m.isStatic())
+                message = wantStatic ? "expected a static method" : "expected a non-static method";
+            else
+                { checkAccess(refc, m); return; }
+            throw m.makeAccessException(message, this);
+        }
+
+        void checkAccess(Class<?> refc, MemberName m) throws IllegalAccessException {
+            int allowedModes = this.allowedModes;
+            if (allowedModes == TRUSTED)  return;
+            int mods = m.getModifiers();
+            if (Modifier.isPublic(mods) && Modifier.isPublic(refc.getModifiers()) && allowedModes != 0)
+                return;  // common case
+            int requestedModes = fixmods(mods);  // adjust 0 => PACKAGE
+            if ((requestedModes & allowedModes) != 0
+                && VerifyAccess.isMemberAccessible(refc, m.getDeclaringClass(),
+                                                   mods, lookupClass()))
+                return;
+            if (((requestedModes & ~allowedModes) & PROTECTED) != 0
+                && VerifyAccess.isSamePackage(m.getDeclaringClass(), lookupClass()))
+                // Protected members can also be checked as if they were package-private.
+                return;
+            throw m.makeAccessException(accessFailedMessage(refc, m), this);
+        }
+
+        String accessFailedMessage(Class<?> refc, MemberName m) {
+            Class<?> defc = m.getDeclaringClass();
+            int mods = m.getModifiers();
+            // check the class first:
+            boolean classOK = (Modifier.isPublic(defc.getModifiers()) &&
+                               (defc == refc ||
+                                Modifier.isPublic(refc.getModifiers())));
+            if (!classOK && (allowedModes & PACKAGE) != 0) {
+                classOK = (VerifyAccess.isClassAccessible(defc, lookupClass()) &&
+                           (defc == refc ||
+                            VerifyAccess.isClassAccessible(refc, lookupClass())));
+            }
+            if (!classOK)
+                return "class is not public";
+            if (Modifier.isPublic(mods))
+                return "access to public member failed";  // (how?)
+            if (Modifier.isPrivate(mods))
+                return "member is private";
+            if (Modifier.isProtected(mods))
+                return "member is protected";
+            return "member is private to package";
+        }
+
+        private static final boolean ALLOW_NESTMATE_ACCESS = false;
+
+        void checkSpecialCaller(Class<?> specialCaller) throws IllegalAccessException {
+            if (allowedModes == TRUSTED)  return;
+            if ((allowedModes & PRIVATE) == 0
+                || (specialCaller != lookupClass()
+                    && !(ALLOW_NESTMATE_ACCESS &&
+                         VerifyAccess.isSamePackageMember(specialCaller, lookupClass()))))
+                throw new MemberName(specialCaller).
+                    makeAccessException("no private access for invokespecial", this);
+        }
+
+        MethodHandle restrictProtectedReceiver(MemberName method, MethodHandle mh) throws IllegalAccessException {
+            // The accessing class only has the right to use a protected member
+            // on itself or a subclass.  Enforce that restriction, from JVMS 5.4.4, etc.
+            if (!method.isProtected() || method.isStatic()
+                || allowedModes == TRUSTED
+                || method.getDeclaringClass() == lookupClass()
+                || (ALLOW_NESTMATE_ACCESS &&
+                    VerifyAccess.isSamePackageMember(method.getDeclaringClass(), lookupClass())))
+                return mh;
+            else
+                return restrictReceiver(method, mh, lookupClass());
+        }
+        MethodHandle restrictReceiver(MemberName method, MethodHandle mh, Class<?> caller) throws IllegalAccessException {
+            assert(!method.isStatic());
+            Class<?> defc = method.getDeclaringClass();  // receiver type of mh is too wide
+            if (defc.isInterface() || !defc.isAssignableFrom(caller)) {
+                throw method.makeAccessException("caller class must be a subclass below the method", caller);
+            }
+            MethodType rawType = mh.type();
+            if (rawType.parameterType(0) == caller)  return mh;
+            MethodType narrowType = rawType.changeParameterType(0, caller);
+            MethodHandle narrowMH = MethodHandleImpl.convertArguments(mh, narrowType, rawType, null);
+            return fixVarargs(narrowMH, mh);
+        }
+
+        MethodHandle makeAccessor(Class<?> refc, String name, Class<?> type,
+                                  boolean isStatic, boolean isSetter) throws NoSuchFieldException, IllegalAccessException {
+            MemberName field = resolveOrFail(refc, name, type, isStatic);
+            if (isStatic != field.isStatic())
+                throw field.makeAccessException(isStatic
+                                                ? "expected a static field"
+                                                : "expected a non-static field", this);
+            return makeAccessor(refc, field, false, isSetter);
+        }
+
+        MethodHandle makeAccessor(Class<?> refc, MemberName field,
+                                  boolean trusted, boolean isSetter) throws IllegalAccessException {
+            assert(field.isField());
+            if (trusted)
+                return MethodHandleImpl.accessField(field, isSetter, lookupClassOrNull());
+            checkAccess(refc, field);
+            MethodHandle mh = MethodHandleImpl.accessField(field, isSetter, lookupClassOrNull());
+            return restrictProtectedReceiver(field, mh);
+        }
+    }
+
+    /**
+     * Produces a method handle giving read access to elements of an array.
+     * The type of the method handle will have a return type of the array's
+     * element type.  Its first argument will be the array type,
+     * and the second will be {@code int}.
+     * @param arrayClass an array type
+     * @return a method handle which can load values from the given array type
+     * @throws NullPointerException if the argument is null
+     * @throws  IllegalArgumentException if arrayClass is not an array type
+     */
+    public static
+    MethodHandle arrayElementGetter(Class<?> arrayClass) throws IllegalArgumentException {
+        return MethodHandleImpl.accessArrayElement(arrayClass, false);
+    }
+
+    /**
+     * Produces a method handle giving write access to elements of an array.
+     * The type of the method handle will have a void return type.
+     * Its last argument will be the array's element type.
+     * The first and second arguments will be the array type and int.
+     * @return a method handle which can store values into the array type
+     * @throws NullPointerException if the argument is null
+     * @throws IllegalArgumentException if arrayClass is not an array type
+     */
+    public static
+    MethodHandle arrayElementSetter(Class<?> arrayClass) throws IllegalArgumentException {
+        return MethodHandleImpl.accessArrayElement(arrayClass, true);
+    }
+
+    /// method handle invocation (reflective style)
+
+    /**
+     * Produces a method handle which will invoke any method handle of the
+     * given {@code type} on a standard set of {@code Object} type arguments
+     * and a single trailing {@code Object[]} array.
+     * The resulting invoker will be a method handle with the following
+     * arguments:
+     * <ul>
+     * <li>a single {@code MethodHandle} target
+     * <li>zero or more {@code Object} values (counted by {@code objectArgCount})
+     * <li>an {@code Object[]} array containing more arguments
+     * </ul>
+     * <p>
+     * The invoker will behave like a call to {@link MethodHandle#invokeGeneric invokeGeneric} with
+     * the indicated {@code type}.
+     * That is, if the target is exactly of the given {@code type}, it will behave
+     * like {@code invokeExact}; otherwise it behave as if {@link MethodHandle#asType asType}
+     * is used to convert the target to the required {@code type}.
+     * <p>
+     * The type of the returned invoker will not be the given {@code type}, but rather
+     * will have all parameter and return types replaced by {@code Object}, except for
+     * the last parameter type, which will be the array type {@code Object[]}.
+     * <p>
+     * Before invoking its target, the invoker will spread the varargs array, apply
+     * reference casts as necessary, and unbox and widen primitive arguments.
+     * The return value of the invoker will be an {@code Object} reference,
+     * boxing a primitive value if the original type returns a primitive,
+     * and always null if the original type returns void.
+     * <p>
+     * This method is equivalent to the following code (though it may be more efficient):
+     * <p><blockquote><pre>
+MethodHandle invoker = MethodHandles.genericInvoker(type);
+int spreadArgCount = type.parameterCount - objectArgCount;
+invoker = invoker.asSpreader(Object[].class, spreadArgCount);
+return invoker;
+     * </pre></blockquote>
+     * <p>
+     * This method throws no reflective or security exceptions.
+     * @param type the desired target type
+     * @param objectArgCount number of fixed (non-varargs) {@code Object} arguments
+     * @return a method handle suitable for invoking any method handle of the given type
+     */
+    static public
+    MethodHandle spreadInvoker(MethodType type, int objectArgCount) {
+        if (objectArgCount < 0 || objectArgCount > type.parameterCount())
+            throw new IllegalArgumentException("bad argument count "+objectArgCount);
+        return type.invokers().spreadInvoker(objectArgCount);
+    }
+
+    /**
+     * Produces a special <em>invoker method handle</em> which can be used to
+     * invoke any method handle of the given type, as if by {@code invokeExact}.
+     * The resulting invoker will have a type which is
+     * exactly equal to the desired type, except that it will accept
+     * an additional leading argument of type {@code MethodHandle}.
+     * <p>
+     * This method is equivalent to the following code (though it may be more efficient):
+     * <p><blockquote><pre>
+publicLookup().findVirtual(MethodHandle.class, "invokeExact", type)
+     * </pre></blockquote>
+     *
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * Invoker method handles can be useful when working with variable method handles
+     * of unknown types.
+     * For example, to emulate an {@code invokeExact} call to a variable method
+     * handle {@code M}, extract its type {@code T},
+     * look up the invoker method {@code X} for {@code T},
+     * and call the invoker method, as {@code X.invokeGeneric(T, A...)}.
+     * (It would not work to call {@code X.invokeExact}, since the type {@code T}
+     * is unknown.)
+     * If spreading, collecting, or other argument transformations are required,
+     * they can be applied once to the invoker {@code X} and reused on many {@code M}
+     * method handle values, as long as they are compatible with the type of {@code X}.
+     * <p>
+     * <em>(Note:  The invoker method is not available via the Core Reflection API.
+     * An attempt to call {@linkplain java.lang.reflect.Method#invoke Method.invoke}
+     * on the declared {@code invokeExact} or {@code invokeGeneric} method will raise an
+     * {@link java.lang.UnsupportedOperationException UnsupportedOperationException}.)</em>
+     * <p>
+     * This method throws no reflective or security exceptions.
+     * @param type the desired target type
+     * @return a method handle suitable for invoking any method handle of the given type
+     */
+    static public
+    MethodHandle exactInvoker(MethodType type) {
+        return type.invokers().exactInvoker();
+    }
+
+    /**
+     * Produces a special <em>invoker method handle</em> which can be used to
+     * invoke any method handle of the given type, as if by {@code invokeGeneric}.
+     * The resulting invoker will have a type which is
+     * exactly equal to the desired type, except that it will accept
+     * an additional leading argument of type {@code MethodHandle}.
+     * <p>
+     * Before invoking its target, the invoker will apply reference casts as
+     * necessary and unbox and widen primitive arguments, as if by {@link #convertArguments convertArguments}.
+     * The return value of the invoker will be an {@code Object} reference,
+     * boxing a primitive value if the original type returns a primitive,
+     * and always null if the original type returns void.
+     * <p>
+     * This method is equivalent to the following code (though it may be more efficient):
+     * <p><blockquote><pre>
+publicLookup().findVirtual(MethodHandle.class, "invokeGeneric", type)
+     * </pre></blockquote>
+     * <p>
+     * This method throws no reflective or security exceptions.
+     * @param type the desired target type
+     * @return a method handle suitable for invoking any method handle convertible to the given type
+     */
+    static public
+    MethodHandle genericInvoker(MethodType type) {
+        return type.invokers().genericInvoker();
+    }
+
+    /**
+     * Perform value checking, exactly as if for an adapted method handle.
+     * It is assumed that the given value is either null, of type T0,
+     * or (if T0 is primitive) of the wrapper type corresponding to T0.
+     * The following checks and conversions are made:
+     * <ul>
+     * <li>If T0 and T1 are references, then a cast to T1 is applied.
+     *     (The types do not need to be related in any particular way.)
+     * <li>If T0 and T1 are primitives, then a widening or narrowing
+     *     conversion is applied, if one exists.
+     * <li>If T0 is a primitive and T1 a reference, and
+     *     T0 has a wrapper type TW, a boxing conversion to TW is applied,
+     *     possibly followed by a reference conversion.
+     *     T1 must be TW or a supertype.
+     * <li>If T0 is a reference and T1 a primitive, and
+     *     T1 has a wrapper type TW, an unboxing conversion is applied,
+     *     possibly preceded by a reference conversion.
+     *     T0 must be TW or a supertype.
+     * <li>If T1 is void, the return value is discarded
+     * <li>If T0 is void and T1 a reference, a null value is introduced.
+     * <li>If T0 is void and T1 a primitive, a zero value is introduced.
+     * </ul>
+     * If the value is discarded, null will be returned.
+     * @param valueType
+     * @param value
+     * @return the value, converted if necessary
+     * @throws java.lang.ClassCastException if a cast fails
+     */
+    static
+    <T0, T1> T1 checkValue(Class<T0> t0, Class<T1> t1, Object value)
+       throws ClassCastException
+    {
+        if (t0 == t1) {
+            // no conversion needed; just reassert the same type
+            if (t0.isPrimitive())
+                return Wrapper.asPrimitiveType(t1).cast(value);
+            else
+                return Wrapper.OBJECT.convert(value, t1);
+        }
+        boolean prim0 = t0.isPrimitive(), prim1 = t1.isPrimitive();
+        if (!prim0) {
+            // check contract with caller
+            Wrapper.OBJECT.convert(value, t0);
+            if (!prim1) {
+                return Wrapper.OBJECT.convert(value, t1);
+            }
+            // convert reference to primitive by unboxing
+            Wrapper w1 = Wrapper.forPrimitiveType(t1);
+            return w1.convert(value, t1);
+        }
+        // check contract with caller:
+        Wrapper.asWrapperType(t0).cast(value);
+        Wrapper w1 = Wrapper.forPrimitiveType(t1);
+        return w1.convert(value, t1);
+    }
+
+    static
+    Object checkValue(Class<?> T1, Object value)
+       throws ClassCastException
+    {
+        Class<?> T0;
+        if (value == null)
+            T0 = Object.class;
+        else
+            T0 = value.getClass();
+        return checkValue(T0, T1, value);
+    }
+
+    /// method handle modification (creation from other method handles)
+
+    /**
+     * Produces a method handle which adapts the type of the
+     * given method handle to a new type by pairwise argument conversion.
+     * The original type and new type must have the same number of arguments.
+     * The resulting method handle is guaranteed to report a type
+     * which is equal to the desired new type.
+     * <p>
+     * If the original type and new type are equal, returns target.
+     * <p>
+     * The following conversions are applied as needed both to
+     * arguments and return types.  Let T0 and T1 be the differing
+     * new and old parameter types (or old and new return types)
+     * for corresponding values passed by the new and old method types.
+     * Given those types T0, T1, one of the following conversions is applied
+     * if possible:
+     * <ul>
+     * <li>If T0 and T1 are references, then a cast to T1 is applied.
+     *     (The types do not need to be related in any particular way.)
+     * <li>If T0 and T1 are primitives, then a Java method invocation
+     *     conversion (JLS 5.3) is applied, if one exists.
+     * <li>If T0 is a primitive and T1 a reference, a boxing
+     *     conversion is applied if one exists, possibly followed by
+     *     a reference conversion to a superclass.
+     *     T1 must be a wrapper class or a supertype of one.
+     * <li>If T0 is a reference and T1 a primitive, an unboxing
+     *     conversion will be applied at runtime, possibly followed
+     *     by a Java method invocation conversion (JLS 5.3)
+     *     on the primitive value.  (These are the widening conversions.)
+     *     T0 must be a wrapper class or a supertype of one.
+     *     (In the case where T0 is Object, these are the conversions
+     *     allowed by java.lang.reflect.Method.invoke.)
+     * <li>If the return type T1 is void, any returned value is discarded
+     * <li>If the return type T0 is void and T1 a reference, a null value is introduced.
+     * <li>If the return type T0 is void and T1 a primitive, a zero value is introduced.
+     * </ul>
+     * @param target the method handle to invoke after arguments are retyped
+     * @param newType the expected type of the new method handle
+     * @return a method handle which delegates to {@code target} after performing
+     *           any necessary argument conversions, and arranges for any
+     *           necessary return value conversions
+     * @throws NullPointerException if either argument is null
+     * @throws WrongMethodTypeException if the conversion cannot be made
+     * @see MethodHandle#asType
+     * @see MethodHandles#explicitCastArguments
+     */
+    public static
+    MethodHandle convertArguments(MethodHandle target, MethodType newType) {
+        MethodType oldType = target.type();
+        if (oldType.equals(newType))
+            return target;
+        MethodHandle res = null;
+        try {
+            res = MethodHandleImpl.convertArguments(target,
+                                                    newType, oldType, null);
+        } catch (IllegalArgumentException ex) {
+        }
+        if (res == null)
+            throw new WrongMethodTypeException("cannot convert to "+newType+": "+target);
+        return res;
+    }
+
+    /**
+     * Produces a method handle which adapts the type of the
+     * given method handle to a new type by pairwise argument conversion.
+     * The original type and new type must have the same number of arguments.
+     * The resulting method handle is guaranteed to report a type
+     * which is equal to the desired new type.
+     * <p>
+     * If the original type and new type are equal, returns target.
+     * <p>
+     * The same conversions are allowed as for {@link #convertArguments convertArguments},
+     * and some additional conversions are also applied if those conversions fail.
+     * Given types T0, T1, one of the following conversions is applied
+     * in addition, if the conversions specified for {@code convertArguments}
+     * would be insufficient:
+     * <ul>
+     * <li>If T0 and T1 are references, and T1 is an interface type,
+     *     then the value of type T0 is passed as a T1 without a cast.
+     *     (This treatment of interfaces follows the usage of the bytecode verifier.)
+     * <li>If T0 and T1 are primitives and one is boolean,
+     *     the boolean is treated as a one-bit unsigned integer.
+     *     (This treatment follows the usage of the bytecode verifier.)
+     *     A conversion from another primitive type behaves as if
+     *     it first converts to byte, and then masks all but the low bit.
+     * <li>If a primitive value would be converted by {@code convertArguments}
+     *     using Java method invocation conversion (JLS 5.3),
+     *     Java casting conversion (JLS 5.5) may be used also.
+     *     This allows primitives to be narrowed as well as widened.
+     * </ul>
+     * @param target the method handle to invoke after arguments are retyped
+     * @param newType the expected type of the new method handle
+     * @return a method handle which delegates to {@code target} after performing
+     *           any necessary argument conversions, and arranges for any
+     *           necessary return value conversions
+     * @throws NullPointerException if either argument is null
+     * @throws WrongMethodTypeException if the conversion cannot be made
+     * @see MethodHandle#asType
+     * @see MethodHandles#convertArguments
+     */
+    public static
+    MethodHandle explicitCastArguments(MethodHandle target, MethodType newType) {
+        return convertArguments(target, newType);  // FIXME!
+    }
+
+    /*
+      FIXME: Reconcile javadoc with 10/22/2010 EG notes on conversion:
+
+      Both converters arrange for their method handles to convert arguments
+      and return values.  The conversion rules are the same for arguments
+      and return values, and depend only on source and target types, S and
+      T.  The conversions allowed by castConvertArguments are a strict
+      superset of those performed by convertArguments.
+
+      In all cases, if S and T are references, a simple checkcast is done.
+      If neither S nor T is a primitive, no attempt is made to unbox and
+      box.  A failed conversion throws ClassCastException.
+
+      If T is void, the value is dropped.
+
+      For compatibility with reflection, if S is void and T is a reference,
+      a null value is produced.
+
+      For compatibility with reflection, if S is a reference and T is a
+      primitive, S is first unboxed and then undergoes primitive conversion.
+      In the case of 'convertArguments', only assignment conversion is
+      performed (no narrowing primitive conversion).
+
+      If S is a primitive, S is boxed, and then the above rules are applied.
+      If S and T are both primitives, the boxing will be undetectable; only
+      the primitive conversions will be apparent to the user.  The key point
+      is that if S is a primitive type, the implementation may box it and
+      treat is as Object, without loss of information, or it may use a "fast
+      path" which does not use boxing.
+
+      Notwithstanding the rules above, for compatibility with the verifier,
+      if T is an interface, it is treated as if it were Object.  [KEEP THIS?]
+
+      Also, for compatibility with the verifier, a boolean may be undergo
+      widening or narrowing conversion to any other primitive type.  [KEEP THIS?]
+    */
+
+    /**
+     * Produces a method handle which adapts the calling sequence of the
+     * given method handle to a new type, by reordering the arguments.
+     * The resulting method handle is guaranteed to report a type
+     * which is equal to the desired new type.
+     * <p>
+     * The given array controls the reordering.
+     * Call {@code #I} the number of incoming parameters (the value
+     * {@code newType.parameterCount()}, and call {@code #O} the number
+     * of outgoing parameters (the value {@code target.type().parameterCount()}).
+     * Then the length of the reordering array must be {@code #O},
+     * and each element must be a non-negative number less than {@code #I}.
+     * For every {@code N} less than {@code #O}, the {@code N}-th
+     * outgoing argument will be taken from the {@code I}-th incoming
+     * argument, where {@code I} is {@code reorder[N]}.
+     * <p>
+     * No argument or return value conversions are applied.
+     * The type of each incoming argument, as determined by {@code newType},
+     * must be identical to the type of the corresponding outgoing argument
+     * or arguments in the target method handle.
+     * The return type of {@code newType} must be identical to the return
+     * type of the original target.
+     * <p>
+     * The reordering array need not specify an actual permutation.
+     * An incoming argument will be duplicated if its index appears
+     * more than once in the array, and an incoming argument will be dropped
+     * if its index does not appear in the array.
+     * As in the case of {@link #dropArguments(MethodHandle,int,List) dropArguments},
+     * incoming arguments which are not mentioned in the reordering array
+     * are may be any type, as determined only by {@code newType}.
+     * <blockquote><pre>
+MethodType intfn1 = MethodType.methodType(int.class, int.class);
+MethodType intfn2 = MethodType.methodType(int.class, int.class, int.class);
+MethodHandle sub = ... {int x, int y => x-y} ...;
+assert(sub.type().equals(intfn2));
+MethodHandle sub1 = MethodHandles.permuteArguments(sub, intfn2, 0, 1);
+MethodHandle rsub = MethodHandles.permuteArguments(sub, intfn2, 1, 0);
+assert((int)rsub.invokeExact(1, 100) == 99);
+MethodHandle add = ... {int x, int y => x+y} ...;
+assert(add.type().equals(intfn2));
+MethodHandle twice = MethodHandles.permuteArguments(add, intfn1, 0, 0);
+assert(twice.type().equals(intfn1));
+assert((int)twice.invokeExact(21) == 42);
+     * </pre></blockquote>
+     * @param target the method handle to invoke after arguments are reordered
+     * @param newType the expected type of the new method handle
+     * @param reorder a string which controls the reordering
+     * @return a method handle which delegates to {@code target} after it
+     *           drops unused arguments and moves and/or duplicates the other arguments
+     * @throws NullPointerException if any argument is null
+     */
+    public static
+    MethodHandle permuteArguments(MethodHandle target, MethodType newType, int... reorder) {
+        MethodType oldType = target.type();
+        checkReorder(reorder, newType, oldType);
+        return MethodHandleImpl.convertArguments(target,
+                                                 newType, oldType,
+                                                 reorder);
+    }
+
+    private static void checkReorder(int[] reorder, MethodType newType, MethodType oldType) {
+        if (reorder.length == oldType.parameterCount()) {
+            int limit = newType.parameterCount();
+            boolean bad = false;
+            for (int i : reorder) {
+                if (i < 0 || i >= limit) {
+                    bad = true; break;
+                }
+            }
+            if (!bad)  return;
+        }
+        throw newIllegalArgumentException("bad reorder array");
+    }
+
+    /**
+     * Equivalent to the following code:
+     * <p><blockquote><pre>
+     * int spreadPos = newType.parameterCount() - 1;
+     * Class&lt;?&gt; spreadType = newType.parameterType(spreadPos);
+     * int spreadCount = target.type().parameterCount() - spreadPos;
+     * MethodHandle adapter = target.asSpreader(spreadType, spreadCount);
+     * adapter = adapter.asType(newType);
+     * return adapter;
+     * </pre></blockquote>
+     * @param target the method handle to invoke after argument spreading
+     * @param newType the expected type of the new method handle
+     * @return a method handle which spreads its final argument,
+     *         before calling the original method handle
+     */
+    /*non-public*/ static
+    MethodHandle spreadArguments(MethodHandle target, MethodType newType) {
+        MethodType oldType = target.type();
+        int inargs  = newType.parameterCount();
+        int outargs = oldType.parameterCount();
+        int spreadPos = inargs - 1;
+        int numSpread = (outargs - spreadPos);
+        MethodHandle res = null;
+        if (spreadPos >= 0 && numSpread >= 0) {
+            res = MethodHandleImpl.spreadArguments(target, newType, spreadPos);
+        }
+        if (res == null) {
+            throw newIllegalArgumentException("cannot spread "+newType+" to " +oldType);
+        }
+        return res;
+    }
+
+    /**
+     * Equivalent to the following code:
+     * <p><blockquote><pre>
+     * int collectPos = target.type().parameterCount() - 1;
+     * Class&lt;?&gt; collectType = target.type().parameterType(collectPos);
+     * if (!collectType.isArray())  collectType = Object[].class;
+     * int collectCount = newType.parameterCount() - collectPos;
+     * MethodHandle adapter = target.asCollector(collectType, collectCount);
+     * adapter = adapter.asType(newType);
+     * return adapter;
+     * </pre></blockquote>
+     * @param target the method handle to invoke after argument collection
+     * @param newType the expected type of the new method handle
+     * @return a method handle which collects some trailing argument
+     *         into an array, before calling the original method handle
+     */
+    /*non-public*/ static
+    MethodHandle collectArguments(MethodHandle target, MethodType newType) {
+        MethodType oldType = target.type();
+        int inargs  = newType.parameterCount();
+        int outargs = oldType.parameterCount();
+        int collectPos = outargs - 1;
+        int numCollect = (inargs - collectPos);
+        if (collectPos < 0 || numCollect < 0)
+            throw newIllegalArgumentException("wrong number of arguments");
+        MethodHandle res = MethodHandleImpl.collectArguments(target, newType, collectPos, null);
+        if (res == null) {
+            throw newIllegalArgumentException("cannot collect from "+newType+" to " +oldType);
+        }
+        return res;
+    }
+
+    /**
+     * Produces a method handle of the requested return type which returns the given
+     * constant value every time it is invoked.
+     * <p>
+     * Before the method handle is returned, the passed-in value is converted to the requested type.
+     * If the requested type is primitive, widening primitive conversions are attempted,
+     * else reference conversions are attempted.
+     * <p>The returned method handle is equivalent to {@code identity(type).bindTo(value)},
+     * unless the type is {@code void}, in which case it is {@code identity(type)}.
+     * @param type the return type of the desired method handle
+     * @param value the value to return
+     * @return a method handle of the given return type and no arguments, which always returns the given value
+     * @throws NullPointerException if the {@code type} argument is null
+     * @throws ClassCastException if the value cannot be converted to the required return type
+     * @throws IllegalArgumentException if the given type is {@code void.class}
+     */
+    public static
+    MethodHandle constant(Class<?> type, Object value) {
+        if (type.isPrimitive()) {
+            if (type == void.class)
+                throw newIllegalArgumentException("void type");
+            Wrapper w = Wrapper.forPrimitiveType(type);
+            return identity(type).bindTo(w.convert(value, type));
+        } else {
+            return identity(type).bindTo(type.cast(value));
+        }
+    }
+
+    /**
+     * Produces a method handle which returns its sole argument when invoked.
+     * <p>The identity function for {@code void} takes no arguments and returns no values.
+     * @param type the type of the sole parameter and return value of the desired method handle
+     * @return a unary method handle which accepts and returns the given type
+     * @throws NullPointerException if the argument is null
+     * @throws IllegalArgumentException if the given type is {@code void.class}
+     */
+    public static
+    MethodHandle identity(Class<?> type) {
+        if (type == void.class)
+            throw newIllegalArgumentException("void type");
+        else if (type == Object.class)
+            return ValueConversions.identity();
+        else if (type.isPrimitive())
+            return ValueConversions.identity(Wrapper.forPrimitiveType(type));
+        else
+            return AdapterMethodHandle.makeRetypeRaw(
+                    MethodType.methodType(type, type), ValueConversions.identity());
+    }
+
+    /**
+     * Produces a method handle which calls the original method handle {@code target},
+     * after inserting the given argument(s) at the given position.
+     * The formal parameters to {@code target} which will be supplied by those
+     * arguments are called <em>bound parameters</em>, because the new method
+     * will contain bindings for those parameters take from {@code values}.
+     * The type of the new method handle will drop the types for the bound
+     * parameters from the original target type, since the new method handle
+     * will no longer require those arguments to be supplied by its callers.
+     * <p>
+     * Each given argument object must match the corresponding bound parameter type.
+     * If a bound parameter type is a primitive, the argument object
+     * must be a wrapper, and will be unboxed to produce the primitive value.
+     * <p>
+     * The  <i>pos</i> may range between zero and <i>N</i> (inclusively),
+     * where <i>N</i> is the number of argument types in resulting method handle
+     * (after bound parameter types are dropped).
+     * @param target the method handle to invoke after the argument is inserted
+     * @param pos where to insert the argument (zero for the first)
+     * @param values the series of arguments to insert
+     * @return a method handle which inserts an additional argument,
+     *         before calling the original method handle
+     * @throws NullPointerException if the {@code target} argument or the {@code values} array is null
+     * @see MethodHandle#bindTo
+     */
+    public static
+    MethodHandle insertArguments(MethodHandle target, int pos, Object... values) {
+        int insCount = values.length;
+        MethodType oldType = target.type();
+        int outargs = oldType.parameterCount();
+        int inargs  = outargs - insCount;
+        if (inargs < 0)
+            throw newIllegalArgumentException("too many values to insert");
+        if (pos < 0 || pos > inargs)
+            throw newIllegalArgumentException("no argument type to append");
+        MethodHandle result = target;
+        for (int i = 0; i < insCount; i++) {
+            Object value = values[i];
+            Class<?> valueType = oldType.parameterType(pos+i);
+            value = checkValue(valueType, value);
+            if (pos == 0 && !valueType.isPrimitive()) {
+                // At least for now, make bound method handles a special case.
+                MethodHandle bmh = MethodHandleImpl.bindReceiver(result, value);
+                if (bmh != null) {
+                    result = bmh;
+                    continue;
+                }
+                // else fall through to general adapter machinery
+            }
+            result = MethodHandleImpl.bindArgument(result, pos, value);
+        }
+        return result;
+    }
+
+    /**
+     * Produces a method handle which calls the original method handle,
+     * after dropping the given argument(s) at the given position.
+     * The type of the new method handle will insert the given argument
+     * type(s), at that position, into the original handle's type.
+     * <p>
+     * The <i>pos</i> may range between zero and <i>N</i>,
+     * where <i>N</i> is the number of argument types in <i>target</i>,
+     * meaning to drop the first or last argument (respectively),
+     * or an argument somewhere in between.
+     * <p>
+     * <b>Example:</b>
+     * <p><blockquote><pre>
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodType bigType = cat.type().insertParameterTypes(0, int.class, String.class);
+MethodHandle d0 = dropArguments(cat, 0, bigType.parameterList().subList(0,2));
+assertEquals(bigType, d0.type());
+assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
+     * </pre></blockquote>
+     * <p>
+     * This method is also equivalent to the following code:
+     * <p><blockquote><pre>
+     * {@link #dropArguments(MethodHandle,int,Class...) dropArguments}(target, pos, valueTypes.toArray(new Class[0]))
+     * </pre></blockquote>
+     * @param target the method handle to invoke after the arguments are dropped
+     * @param valueTypes the type(s) of the argument(s) to drop
+     * @param pos position of first argument to drop (zero for the leftmost)
+     * @return a method handle which drops arguments of the given types,
+     *         before calling the original method handle
+     * @throws NullPointerException if the {@code target} argument is null,
+     *                              or if the {@code valueTypes} list or any of its elements is null
+     * @throws IllegalArgumentException if any of the {@code valueTypes} is {@code void.class}
+     */
+    public static
+    MethodHandle dropArguments(MethodHandle target, int pos, List<Class<?>> valueTypes) {
+        if (valueTypes.size() == 0)  return target;
+        MethodType oldType = target.type();
+        int outargs = oldType.parameterCount();
+        int inargs  = outargs + valueTypes.size();
+        if (pos < 0 || pos >= inargs)
+            throw newIllegalArgumentException("no argument type to remove");
+        ArrayList<Class<?>> ptypes =
+                new ArrayList<Class<?>>(oldType.parameterList());
+        ptypes.addAll(pos, valueTypes);
+        MethodType newType = MethodType.methodType(oldType.returnType(), ptypes);
+        return MethodHandleImpl.dropArguments(target, newType, pos);
+    }
+
+    /**
+     * Produces a method handle which calls the original method handle,
+     * after dropping the given argument(s) at the given position.
+     * The type of the new method handle will insert the given argument
+     * type(s), at that position, into the original handle's type.
+     * <p>
+     * The <i>pos</i> may range between zero and <i>N</i>,
+     * where <i>N</i> is the number of argument types in <i>target</i>,
+     * meaning to drop the first or last argument (respectively),
+     * or an argument somewhere in between.
+     * <p>
+     * <b>Example:</b>
+     * <p><blockquote><pre>
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodHandle d0 = dropArguments(cat, 0, String.class);
+assertEquals("yz", (String) d0.invokeExact("x", "y", "z"));
+MethodHandle d1 = dropArguments(cat, 1, String.class);
+assertEquals("xz", (String) d1.invokeExact("x", "y", "z"));
+MethodHandle d2 = dropArguments(cat, 2, String.class);
+assertEquals("xy", (String) d2.invokeExact("x", "y", "z"));
+MethodHandle d12 = dropArguments(cat, 1, int.class, boolean.class);
+assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
+     * </pre></blockquote>
+     * <p>
+     * This method is also equivalent to the following code:
+     * <p><blockquote><pre>
+     * {@link #dropArguments(MethodHandle,int,List) dropArguments}(target, pos, Arrays.asList(valueTypes))
+     * </pre></blockquote>
+     * @param target the method handle to invoke after the arguments are dropped
+     * @param valueTypes the type(s) of the argument(s) to drop
+     * @param pos position of first argument to drop (zero for the leftmost)
+     * @return a method handle which drops arguments of the given types,
+     *         before calling the original method handle
+     * @throws NullPointerException if the {@code target} argument is null,
+     *                              or if the {@code valueTypes} array or any of its elements is null
+     * @throws IllegalArgumentException if any of the {@code valueTypes} is {@code void.class}
+     */
+    public static
+    MethodHandle dropArguments(MethodHandle target, int pos, Class<?>... valueTypes) {
+        return dropArguments(target, pos, Arrays.asList(valueTypes));
+    }
+
+    /**
+     * Adapts a target method handle {@code target} by pre-processing
+     * one or more of its arguments, each with its own unary filter function,
+     * and then calling the target with each pre-processed argument
+     * replaced by the result of its corresponding filter function.
+     * <p>
+     * The pre-processing is performed by one or more method handles,
+     * specified in the elements of the {@code filters} array.
+     * Null arguments in the array are ignored, and the corresponding arguments left unchanged.
+     * (If there are no non-null elements in the array, the original target is returned.)
+     * Each filter is applied to the corresponding argument of the adapter.
+     * <p>
+     * If a filter {@code F} applies to the {@code N}th argument of
+     * the method handle, then {@code F} must be a method handle which
+     * takes exactly one argument.  The type of {@code F}'s sole argument
+     * replaces the corresponding argument type of the target
+     * in the resulting adapted method handle.
+     * The return type of {@code F} must be identical to the corresponding
+     * parameter type of the target.
+     * <p>
+     * It is an error if there are elements of {@code filters}
+     * which do not correspond to argument positions in the target.
+     * <b>Example:</b>
+     * <p><blockquote><pre>
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+MethodHandle upcase = lookup().findVirtual(String.class,
+  "toUpperCase", methodType(String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodHandle f0 = filterArguments(cat, 0, upcase);
+assertEquals("Xy", (String) f0.invokeExact("x", "y")); // Xy
+MethodHandle f1 = filterArguments(cat, 1, upcase);
+assertEquals("xY", (String) f1.invokeExact("x", "y")); // xY
+MethodHandle f2 = filterArguments(cat, 0, upcase, upcase);
+assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
+     * </pre></blockquote>
+     *
+     * @param target the method handle to invoke after arguments are filtered
+     * @param pos the position of the first argument to filter
+     * @param filters method handles to call initially on filtered arguments
+     * @return method handle which incorporates the specified argument filtering logic
+     * @throws NullPointerException if the {@code target} argument is null
+     *                              or if the {@code filters} array is null
+     * @throws IllegalArgumentException if a non-null element of {@code filters}
+     *          does not match a corresponding argument type of {@code target} as described above,
+     *          or if the {@code pos+filters.length} is greater than {@code target.type().parameterCount()}
+     */
+    public static
+    MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
+        MethodType targetType = target.type();
+        MethodHandle adapter = target;
+        MethodType adapterType = targetType;
+        int maxPos = targetType.parameterCount();
+        if (pos + filters.length > maxPos)
+            throw newIllegalArgumentException("too many filters");
+        int curPos = pos-1;  // pre-incremented
+        for (MethodHandle filter : filters) {
+            curPos += 1;
+            if (filter == null)  continue;  // ignore null elements of filters
+            MethodType filterType = filter.type();
+            if (filterType.parameterCount() != 1
+                || filterType.returnType() != targetType.parameterType(curPos))
+                throw newIllegalArgumentException("target and filter types do not match");
+            adapterType = adapterType.changeParameterType(curPos, filterType.parameterType(0));
+            adapter = MethodHandleImpl.filterArgument(adapter, curPos, filter);
+        }
+        MethodType midType = adapter.type();
+        if (midType != adapterType)
+            adapter = MethodHandleImpl.convertArguments(adapter, adapterType, midType, null);
+        return adapter;
+    }
+
+    /**
+     * Adapts a target method handle {@code target} by post-processing
+     * its return value with a unary filter function.
+     * <p>
+     * If a filter {@code F} applies to the return value of
+     * the target method handle, then {@code F} must be a method handle which
+     * takes exactly one argument.  The return type of {@code F}
+     * replaces the return type of the target
+     * in the resulting adapted method handle.
+     * The argument type of {@code F} must be identical to the
+     * return type of the target.
+     * <b>Example:</b>
+     * <p><blockquote><pre>
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+MethodHandle length = lookup().findVirtual(String.class,
+  "length", methodType(int.class));
+System.out.println((String) cat.invokeExact("x", "y")); // xy
+MethodHandle f0 = filterReturnValue(cat, length);
+System.out.println((int) f0.invokeExact("x", "y")); // 2
+     * </pre></blockquote>
+     * @param target the method handle to invoke before filtering the return value
+     * @param filter method handle to call on the return value
+     * @return method handle which incorporates the specified return value filtering logic
+     * @throws NullPointerException if either argument is null
+     * @throws IllegalArgumentException if {@code filter}
+     *          does not match the return type of {@code target} as described above
+     */
+    public static
+    MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
+        MethodType targetType = target.type();
+        MethodType filterType = filter.type();
+        if (filterType.parameterCount() != 1
+            || filterType.parameterType(0) != targetType.returnType())
+            throw newIllegalArgumentException("target and filter types do not match");
+        // result = fold( lambda(retval, arg...) { filter(retval) },
+        //                lambda(        arg...) { target(arg...) } )
+        // FIXME: Too many nodes here.
+        MethodHandle returner = dropArguments(filter, 1, targetType.parameterList());
+        return foldArguments(returner, target);
+    }
+
+    /**
+     * Adapts a target method handle {@code target} by pre-processing
+     * some of its arguments, and then calling the target with
+     * the result of the pre-processing, plus all original arguments.
+     * <p>
+     * The pre-processing is performed by a second method handle, the {@code combiner}.
+     * The first {@code N} arguments passed to the adapter,
+     * are copied to the combiner, which then produces a result.
+     * (Here, {@code N} is defined as the parameter count of the adapter.)
+     * After this, control passes to the {@code target}, with both the result
+     * of the combiner, and all the original incoming arguments.
+     * <p>
+     * The first argument type of the target must be identical with the
+     * return type of the combiner.
+     * The resulting adapter is the same type as the target, except that the
+     * initial argument type of the target is dropped.
+     * <p>
+     * (Note that {@link #dropArguments(MethodHandle,int,List) dropArguments} can be used to remove any arguments
+     * that either the {@code combiner} or {@code target} does not wish to receive.
+     * If some of the incoming arguments are destined only for the combiner,
+     * consider using {@link MethodHandle#asCollector asCollector} instead, since those
+     * arguments will not need to be live on the stack on entry to the
+     * target.)
+     * <p>
+     * The first argument of the target must be identical with the
+     * return value of the combiner.
+     * <p> Here is pseudocode for the resulting adapter:
+     * <blockquote><pre>
+     * // there are N arguments in the A sequence
+     * T target(V, A[N]..., B...);
+     * V combiner(A...);
+     * T adapter(A... a, B... b) {
+     *   V v = combiner(a...);
+     *   return target(v, a..., b...);
+     * }
+     * </pre></blockquote>
+     * @param target the method handle to invoke after arguments are combined
+     * @param combiner method handle to call initially on the incoming arguments
+     * @return method handle which incorporates the specified argument folding logic
+     * @throws NullPointerException if either argument is null
+     * @throws IllegalArgumentException if the first argument type of
+     *          {@code target} is not the same as {@code combiner}'s return type,
+     *          or if the following argument types of {@code target}
+     *          are not identical with the argument types of {@code combiner}
+     */
+    public static
+    MethodHandle foldArguments(MethodHandle target, MethodHandle combiner) {
+        MethodType targetType = target.type();
+        MethodType combinerType = combiner.type();
+        int foldArgs = combinerType.parameterCount();
+        boolean ok = (targetType.parameterCount() >= 1 + foldArgs);
+        if (ok && !combinerType.parameterList().equals(targetType.parameterList().subList(1, foldArgs+1)))
+            ok = false;
+        if (ok && !combinerType.returnType().equals(targetType.parameterType(0)))
+            ok = false;
+        if (!ok)
+            throw misMatchedTypes("target and combiner types", targetType, combinerType);
+        MethodType newType = targetType.dropParameterTypes(0, 1);
+        return MethodHandleImpl.foldArguments(target, newType, combiner);
+    }
+
+    /**
+     * Makes a method handle which adapts a target method handle,
+     * by guarding it with a test, a boolean-valued method handle.
+     * If the guard fails, a fallback handle is called instead.
+     * All three method handles must have the same corresponding
+     * argument and return types, except that the return type
+     * of the test must be boolean, and the test is allowed
+     * to have fewer arguments than the other two method handles.
+     * <p> Here is pseudocode for the resulting adapter:
+     * <blockquote><pre>
+     * boolean test(A...);
+     * T target(A...,B...);
+     * T fallback(A...,B...);
+     * T adapter(A... a,B... b) {
+     *   if (test(a...))
+     *     return target(a..., b...);
+     *   else
+     *     return fallback(a..., b...);
+     * }
+     * </pre></blockquote>
+     * Note that the test arguments ({@code a...} in the pseudocode) cannot
+     * be modified by execution of the test, and so are passed unchanged
+     * from the caller to the target or fallback as appropriate.
+     * @param test method handle used for test, must return boolean
+     * @param target method handle to call if test passes
+     * @param fallback method handle to call if test fails
+     * @return method handle which incorporates the specified if/then/else logic
+     * @throws NullPointerException if any argument is null
+     * @throws IllegalArgumentException if {@code test} does not return boolean,
+     *          or if all three method types do not match (with the return
+     *          type of {@code test} changed to match that of {@code target}).
+     */
+    public static
+    MethodHandle guardWithTest(MethodHandle test,
+                               MethodHandle target,
+                               MethodHandle fallback) {
+        MethodType gtype = test.type();
+        MethodType ttype = target.type();
+        MethodType ftype = fallback.type();
+        if (!ttype.equals(ftype))
+            throw misMatchedTypes("target and fallback types", ttype, ftype);
+        if (gtype.returnType() != boolean.class)
+            throw newIllegalArgumentException("guard type is not a predicate "+gtype);
+        List<Class<?>> targs = ttype.parameterList();
+        List<Class<?>> gargs = gtype.parameterList();
+        if (!targs.equals(gargs)) {
+            int gpc = gargs.size(), tpc = targs.size();
+            if (gpc >= tpc || !targs.subList(0, gpc).equals(gargs))
+                throw misMatchedTypes("target and test types", ttype, gtype);
+            test = dropArguments(test, gpc, targs.subList(gpc, tpc));
+            gtype = test.type();
+        }
+        return MethodHandleImpl.makeGuardWithTest(test, target, fallback);
+    }
+
+    static RuntimeException misMatchedTypes(String what, MethodType t1, MethodType t2) {
+        return newIllegalArgumentException(what + " must match: " + t1 + " != " + t2);
+    }
+
+    /**
+     * Makes a method handle which adapts a target method handle,
+     * by running it inside an exception handler.
+     * If the target returns normally, the adapter returns that value.
+     * If an exception matching the specified type is thrown, the fallback
+     * handle is called instead on the exception, plus the original arguments.
+     * <p>
+     * The target and handler must have the same corresponding
+     * argument and return types, except that handler may omit trailing arguments
+     * (similarly to the predicate in {@link #guardWithTest guardWithTest}).
+     * Also, the handler must have an extra leading parameter of {@code exType} or a supertype.
+     * <p> Here is pseudocode for the resulting adapter:
+     * <blockquote><pre>
+     * T target(A..., B...);
+     * T handler(ExType, A...);
+     * T adapter(A... a, B... b) {
+     *   try {
+     *     return target(a..., b...);
+     *   } catch (ExType ex) {
+     *     return handler(ex, a...);
+     *   }
+     * }
+     * </pre></blockquote>
+     * Note that the saved arguments ({@code a...} in the pseudocode) cannot
+     * be modified by execution of the target, and so are passed unchanged
+     * from the caller to the handler, if the handler is invoked.
+     * <p>
+     * The target and handler must return the same type, even if the handler
+     * always throws.  (This might happen, for instance, because the handler
+     * is simulating a {@code finally} clause).
+     * To create such a throwing handler, compose the handler creation logic
+     * with {@link #throwException throwException},
+     * in order to create a method handle of the correct return type.
+     * @param target method handle to call
+     * @param exType the type of exception which the handler will catch
+     * @param handler method handle to call if a matching exception is thrown
+     * @return method handle which incorporates the specified try/catch logic
+     * @throws NullPointerException if any argument is null
+     * @throws IllegalArgumentException if {@code handler} does not accept
+     *          the given exception type, or if the method handle types do
+     *          not match in their return types and their
+     *          corresponding parameters
+     */
+    public static
+    MethodHandle catchException(MethodHandle target,
+                                Class<? extends Throwable> exType,
+                                MethodHandle handler) {
+        MethodType ttype = target.type();
+        MethodType htype = handler.type();
+        if (htype.parameterCount() < 1 ||
+            !htype.parameterType(0).isAssignableFrom(exType))
+            throw newIllegalArgumentException("handler does not accept exception type "+exType);
+        if (htype.returnType() != ttype.returnType())
+            throw misMatchedTypes("target and handler return types", ttype, htype);
+        List<Class<?>> targs = ttype.parameterList();
+        List<Class<?>> hargs = htype.parameterList();
+        hargs = hargs.subList(1, hargs.size());  // omit leading parameter from handler
+        if (!targs.equals(hargs)) {
+            int hpc = hargs.size(), tpc = targs.size();
+            if (hpc >= tpc || !targs.subList(0, hpc).equals(hargs))
+                throw misMatchedTypes("target and handler types", ttype, htype);
+            handler = dropArguments(handler, hpc, hargs.subList(hpc, tpc));
+            htype = handler.type();
+        }
+        return MethodHandleImpl.makeGuardWithCatch(target, exType, handler);
+    }
+
+    /**
+     * Produces a method handle which will throw exceptions of the given {@code exType}.
+     * The method handle will accept a single argument of {@code exType},
+     * and immediately throw it as an exception.
+     * The method type will nominally specify a return of {@code returnType}.
+     * The return type may be anything convenient:  It doesn't matter to the
+     * method handle's behavior, since it will never return normally.
+     * @return method handle which can throw the given exceptions
+     * @throws NullPointerException if either argument is null
+     */
+    public static
+    MethodHandle throwException(Class<?> returnType, Class<? extends Throwable> exType) {
+        return MethodHandleImpl.throwException(MethodType.methodType(returnType, exType));
+    }
+
+    /**
+     * Produces an instance of the given single-method interface which redirects
+     * its calls to the given method handle.
+     * <p>
+     * A single-method interface is an interface which declares a unique method.
+     * When determining the unique method of a single-method interface,
+     * the public {@code Object} methods ({@code toString}, {@code equals}, {@code hashCode})
+     * are disregarded.  For example, {@link java.util.Comparator} is a single-method interface,
+     * even though it re-declares the {@code Object.equals} method.
+     * <p>
+     * The type must be public.  No additional access checks are performed.
+     * <p>
+     * The resulting instance of the required type will respond to
+     * invocation of the type's single abstract method by calling
+     * the given {@code target} on the incoming arguments,
+     * and returning or throwing whatever the {@code target}
+     * returns or throws.  The invocation will be as if by
+     * {@code target.invokeGeneric}.
+     * The target's type will be checked before the
+     * instance is created, as if by a call to {@code asType},
+     * which may result in a {@code WrongMethodTypeException}.
+     * <p>
+     * The wrapper instance will implement the requested interface
+     * and its super-types, but no other single-method interfaces.
+     * This means that the instance will not unexpectedly
+     * pass an {@code instanceof} test for any unrequested type.
+     * <p style="font-size:smaller;">
+     * <em>Implementation Note:</em>
+     * Therefore, each instance must implement a unique single-method interface.
+     * Implementations may not bundle together
+     * multiple single-method interfaces onto single implementation classes
+     * in the style of {@link java.awt.AWTEventMulticaster}.
+     * <p>
+     * The method handle may throw an <em>undeclared exception</em>,
+     * which means any checked exception (or other checked throwable)
+     * not declared by the requested type's single abstract method.
+     * If this happens, the throwable will be wrapped in an instance of
+     * {@link java.lang.reflect.UndeclaredThrowableException UndeclaredThrowableException}
+     * and thrown in that wrapped form.
+     * <p>
+     * Like {@link java.lang.Integer#valueOf Integer.valueOf},
+     * {@code asInstance} is a factory method whose results are defined
+     * by their behavior.
+     * It is not guaranteed to return a new instance for every call.
+     * <p>
+     * Because of the possibility of {@linkplain java.lang.reflect.Method#isBridge bridge methods}
+     * and other corner cases, the interface may also have several abstract methods
+     * with the same name but having distinct descriptors (types of returns and parameters).
+     * In this case, all the methods are bound in common to the one given {@code target}.
+     * The type check and effective {@code asType} conversion is applied to each
+     * method type descriptor, and all abstract methods are bound to the {@code target} in common.
+     * Beyond this type check, no further checks are made to determine that the
+     * abstract methods are related in any way.
+     * <p>
+     * Future versions of this API may accept additional types,
+     * such as abstract classes with single abstract methods.
+     * Future versions of this API may also equip wrapper instances
+     * with one or more additional public "marker" interfaces.
+     *
+     * @param target the method handle to invoke from the wrapper
+     * @param smType the desired type of the wrapper, a single-method interface
+     * @return a correctly-typed wrapper for the given {@code target}
+     * @throws NullPointerException if either argument is null
+     * @throws IllegalArgumentException if the {@code smType} is not a
+     *         valid argument to this method
+     * @throws WrongMethodTypeException if the {@code target} cannot
+     *         be converted to the type required by the requested interface
+     */
+    // Other notes to implementors:
+    // <p>
+    // No stable mapping is promised between the single-method interface and
+    // the implementation class C.  Over time, several implementation
+    // classes might be used for the same type.
+    // <p>
+    // If the implementation is able
+    // to prove that a wrapper of the required type
+    // has already been created for a given
+    // method handle, or for another method handle with the
+    // same behavior, the implementation may return that wrapper in place of
+    // a new wrapper.
+    // <p>
+    // This method is designed to apply to common use cases
+    // where a single method handle must interoperate with
+    // an interface that implements a function-like
+    // API.  Additional variations, such as single-abstract-method classes with
+    // private constructors, or interfaces with multiple but related
+    // entry points, must be covered by hand-written or automatically
+    // generated adapter classes.
+    //
+    public static
+    <T> T asInstance(final MethodHandle target, final Class<T> smType) {
+        // POC implementation only; violates the above contract several ways
+        final Method sm = getSingleMethod(smType);
+        if (sm == null)
+            throw new IllegalArgumentException("not a single-method interface: "+smType.getName());
+        MethodType smMT = MethodType.methodType(sm.getReturnType(), sm.getParameterTypes());
+        MethodHandle checkTarget = target.asType(smMT);  // make throw WMT
+        checkTarget = checkTarget.asType(checkTarget.type().changeReturnType(Object.class));
+        final MethodHandle vaTarget = checkTarget.asSpreader(Object[].class, smMT.parameterCount());
+        return smType.cast(Proxy.newProxyInstance(
+                smType.getClassLoader(),
+                new Class[]{ smType, WrapperInstance.class },
+                new InvocationHandler() {
+                    private Object getArg(String name) {
+                        if ((Object)name == "getWrapperInstanceTarget")  return target;
+                        if ((Object)name == "getWrapperInstanceType")    return smType;
+                        throw new AssertionError();
+                    }
+                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+                        if (method.getDeclaringClass() == WrapperInstance.class)
+                            return getArg(method.getName());
+                        if (method.equals(sm))
+                            return vaTarget.invokeExact(args);
+                        if (isObjectMethod(method))
+                            return callObjectMethod(this, method, args);
+                        throw new InternalError();
+                    }
+                }));
+    }
+
+    /**
+     * Determines if the given object was produced by a call to {@link #asInstance asInstance}.
+     * @param x any reference
+     * @return true if the reference is not null and points to an object produced by {@code asInstance}
+     */
+    public static
+    boolean isWrapperInstance(Object x) {
+        return x instanceof WrapperInstance;
+    }
+
+    private static WrapperInstance asWrapperInstance(Object x) {
+        try {
+            if (x != null)
+                return (WrapperInstance) x;
+        } catch (ClassCastException ex) {
+        }
+        throw new IllegalArgumentException("not a wrapper instance");
+    }
+
+    /**
+     * Produces or recovers a target method handle which is behaviorally
+     * equivalent to the unique method of this wrapper instance.
+     * The object {@code x} must have been produced by a call to {@link #asInstance asInstance}.
+     * This requirement may be tested via {@link #isWrapperInstance isWrapperInstance}.
+     * @param x any reference
+     * @return a method handle implementing the unique method
+     * @throws IllegalArgumentException if the reference x is not to a wrapper instance
+     */
+    public static
+    MethodHandle wrapperInstanceTarget(Object x) {
+        return asWrapperInstance(x).getWrapperInstanceTarget();
+    }
+
+    /**
+     * Recovers the unique single-method interface type for which this wrapper instance was created.
+     * The object {@code x} must have been produced by a call to {@link #asInstance asInstance}.
+     * This requirement may be tested via {@link #isWrapperInstance isWrapperInstance}.
+     * @param x any reference
+     * @return the single-method interface type for which the wrapper was created
+     * @throws IllegalArgumentException if the reference x is not to a wrapper instance
+     */
+    public static
+    Class<?> wrapperInstanceType(Object x) {
+        return asWrapperInstance(x).getWrapperInstanceType();
+    }
+
+    private static
+    boolean isObjectMethod(Method m) {
+        switch (m.getName()) {
+        case "toString":
+            return (m.getReturnType() == String.class
+                    && m.getParameterTypes().length == 0);
+        case "hashCode":
+            return (m.getReturnType() == int.class
+                    && m.getParameterTypes().length == 0);
+        case "equals":
+            return (m.getReturnType() == boolean.class
+                    && m.getParameterTypes().length == 1
+                    && m.getParameterTypes()[0] == Object.class);
+        }
+        return false;
+    }
+
+    private static
+    Object callObjectMethod(Object self, Method m, Object[] args) {
+        assert(isObjectMethod(m)) : m;
+        switch (m.getName()) {
+        case "toString":
+            return self.getClass().getName() + "@" + Integer.toHexString(self.hashCode());
+        case "hashCode":
+            return System.identityHashCode(self);
+        case "equals":
+            return (self == args[0]);
+        }
+        return null;
+    }
+
+    private static
+    Method getSingleMethod(Class<?> smType) {
+        Method sm = null;
+        for (Method m : smType.getMethods()) {
+            int mod = m.getModifiers();
+            if (Modifier.isAbstract(mod)) {
+                if (sm != null && !isObjectMethod(sm))
+                    return null;  // too many abstract methods
+                sm = m;
+            }
+        }
+        if (!smType.isInterface() && getSingleConstructor(smType) == null)
+            return null;  // wrong kind of constructor
+        return sm;
+    }
+
+    private static
+    Constructor getSingleConstructor(Class<?> smType) {
+        for (Constructor c : smType.getDeclaredConstructors()) {
+            if (c.getParameterTypes().length == 0) {
+                int mod = c.getModifiers();
+                if (Modifier.isPublic(mod) || Modifier.isProtected(mod))
+                    return c;
+            }
+        }
+        return null;
+    }
+
+    /*non-public*/
+    static MethodHandle asVarargsCollector(MethodHandle target, Class<?> arrayType) {
+        return MethodHandleImpl.asVarargsCollector(target, arrayType);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,841 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import sun.invoke.util.BytecodeDescriptor;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * A method type represents the arguments and return type accepted and
+ * returned by a method handle, or the arguments and return type passed
+ * and expected  by a method handle caller.  Method types must be properly
+ * matched between a method handle and all its callers,
+ * and the JVM's operations enforce this matching at, specifically
+ * during calls to {@link MethodHandle#invokeExact MethodHandle.invokeExact}
+ * and {@link MethodHandle#invokeGeneric MethodHandle.invokeGeneric}, and during execution
+ * of {@code invokedynamic} instructions.
+ * <p>
+ * The structure is a return type accompanied by any number of parameter types.
+ * The types (primitive, {@code void}, and reference) are represented by {@link Class} objects.
+ * (For ease of exposition, we treat {@code void} as if it were a type.
+ * In fact, it denotes the absence of a return type.)
+ * <p>
+ * All instances of {@code MethodType} are immutable.
+ * Two instances are completely interchangeable if they compare equal.
+ * Equality depends on pairwise correspondence of the return and parameter types and on nothing else.
+ * <p>
+ * This type can be created only by factory methods.
+ * All factory methods may cache values, though caching is not guaranteed.
+ * Some factory methods are static, while others are virtual methods which
+ * modify precursor method types, e.g., by changing a selected parameter.
+ * <p>
+ * Factory methods which operate on groups of parameter types
+ * are systematically presented in two versions, so that both Java arrays and
+ * Java lists can be used to work with groups of parameter types.
+ * The query methods {@code parameterArray} and {@code parameterList}
+ * also provide a choice between arrays and lists.
+ * <p>
+ * {@code MethodType} objects are sometimes derived from bytecode instructions
+ * such as {@code invokedynamic}, specifically from the type descriptor strings associated
+ * with the instructions in a class file's constant pool.
+ * <p>
+ * Like classes and strings, method types can also be represented directly
+ * in a class file's constant pool as constants.
+ * A method type may be loaded by an {@code ldc} instruction which refers
+ * to a suitable {@code CONSTANT_MethodType} constant pool entry.
+ * The entry refers to a {@code CONSTANT_Utf8} spelling for the descriptor string.
+ * For more details, see the <a href="package-summary.html#mtcon">package summary</a>.
+ * <p>
+ * When the JVM materializes a {@code MethodType} from a descriptor string,
+ * all classes named in the descriptor must be accessible, and will be loaded.
+ * (But the classes need not be initialized, as is the case with a {@code CONSTANT_Class}.)
+ * This loading may occur at any time before the {@code MethodType} object is first derived.
+ * @author John Rose, JSR 292 EG
+ */
+public final
+class MethodType implements java.io.Serializable {
+    private static final long serialVersionUID = 292L;  // {rtype, {ptype...}}
+
+    // The rtype and ptypes fields define the structural identity of the method type:
+    private final Class<?>   rtype;
+    private final Class<?>[] ptypes;
+
+    // The remaining fields are caches of various sorts:
+    private MethodTypeForm form; // erased form, plus cached data about primitives
+    private MethodType wrapAlt;  // alternative wrapped/unwrapped version
+    private Invokers invokers;   // cache of handy higher-order adapters
+
+    /**
+     * Check the given parameters for validity and store them into the final fields.
+     */
+    private MethodType(Class<?> rtype, Class<?>[] ptypes) {
+        checkRtype(rtype);
+        checkPtypes(ptypes);
+        this.rtype = rtype;
+        this.ptypes = ptypes;
+    }
+
+    /*trusted*/ MethodTypeForm form() { return form; }
+    /*trusted*/ Class<?> rtype() { return rtype; }
+    /*trusted*/ Class<?>[] ptypes() { return ptypes; }
+
+    private static void checkRtype(Class<?> rtype) {
+        rtype.equals(rtype);  // null check
+    }
+    private static int checkPtype(Class<?> ptype) {
+        ptype.getClass();  //NPE
+        if (ptype == void.class)
+            throw newIllegalArgumentException("parameter type cannot be void");
+        if (ptype == double.class || ptype == long.class)  return 1;
+        return 0;
+    }
+    /** Return number of extra slots (count of long/double args). */
+    private static int checkPtypes(Class<?>[] ptypes) {
+        int slots = 0;
+        for (Class<?> ptype : ptypes) {
+            slots += checkPtype(ptype);
+        }
+        checkSlotCount(ptypes.length + slots);
+        return slots;
+    }
+    private static void checkSlotCount(int count) {
+        if ((count & 0xFF) != count)
+            throw newIllegalArgumentException("bad parameter count "+count);
+    }
+    private static IndexOutOfBoundsException newIndexOutOfBoundsException(Object num) {
+        if (num instanceof Integer)  num = "bad index: "+num;
+        return new IndexOutOfBoundsException(num.toString());
+    }
+
+    static final HashMap<MethodType,MethodType> internTable
+            = new HashMap<MethodType, MethodType>();
+
+    static final Class<?>[] NO_PTYPES = {};
+
+    /**
+     * Finds or creates an instance of the given method type.
+     * @param rtype  the return type
+     * @param ptypes the parameter types
+     * @return a method type with the given components
+     * @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
+     * @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
+     */
+    public static
+    MethodType methodType(Class<?> rtype, Class<?>[] ptypes) {
+        return makeImpl(rtype, ptypes, false);
+    }
+
+    /**
+     * Finds or creates a method type with the given components.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @return a method type with the given components
+     * @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
+     * @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
+     */
+    public static
+    MethodType methodType(Class<?> rtype, List<Class<?>> ptypes) {
+        boolean notrust = false;  // random List impl. could return evil ptypes array
+        return makeImpl(rtype, ptypes.toArray(NO_PTYPES), notrust);
+    }
+
+    /**
+     * Finds or creates a method type with the given components.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * The leading parameter type is prepended to the remaining array.
+     * @return a method type with the given components
+     * @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null
+     * @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class}
+     */
+    public static
+    MethodType methodType(Class<?> rtype, Class<?> ptype0, Class<?>... ptypes) {
+        Class<?>[] ptypes1 = new Class<?>[1+ptypes.length];
+        ptypes1[0] = ptype0;
+        System.arraycopy(ptypes, 0, ptypes1, 1, ptypes.length);
+        return makeImpl(rtype, ptypes1, true);
+    }
+
+    /**
+     * Finds or creates a method type with the given components.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * The resulting method has no parameter types.
+     * @return a method type with the given return value
+     * @throws NullPointerException if {@code rtype} is null
+     */
+    public static
+    MethodType methodType(Class<?> rtype) {
+        return makeImpl(rtype, NO_PTYPES, true);
+    }
+
+    /**
+     * Finds or creates a method type with the given components.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * The resulting method has the single given parameter type.
+     * @return a method type with the given return value and parameter type
+     * @throws NullPointerException if {@code rtype} or {@code ptype0} is null
+     * @throws IllegalArgumentException if {@code ptype0} is {@code void.class}
+     */
+    public static
+    MethodType methodType(Class<?> rtype, Class<?> ptype0) {
+        return makeImpl(rtype, new Class<?>[]{ ptype0 }, true);
+    }
+
+    /**
+     * Finds or creates a method type with the given components.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * The resulting method has the same parameter types as {@code ptypes},
+     * and the specified return type.
+     * @throws NullPointerException if {@code rtype} or {@code ptypes} is null
+     */
+    public static
+    MethodType methodType(Class<?> rtype, MethodType ptypes) {
+        return makeImpl(rtype, ptypes.ptypes, true);
+    }
+
+    /**
+     * Sole factory method to find or create an interned method type.
+     * @param rtype desired return type
+     * @param ptypes desired parameter types
+     * @param trusted whether the ptypes can be used without cloning
+     * @return the unique method type of the desired structure
+     */
+    /*trusted*/ static
+    MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
+        if (ptypes == null || ptypes.length == 0) {
+            ptypes = NO_PTYPES; trusted = true;
+        }
+        MethodType mt1 = new MethodType(rtype, ptypes);
+        MethodType mt0;
+        synchronized (internTable) {
+            mt0 = internTable.get(mt1);
+            if (mt0 != null)
+                return mt0;
+        }
+        if (!trusted)
+            // defensively copy the array passed in by the user
+            mt1 = new MethodType(rtype, ptypes.clone());
+        // promote the object to the Real Thing, and reprobe
+        MethodTypeForm form = MethodTypeForm.findForm(mt1);
+        mt1.form = form;
+        if (form.erasedType == mt1) {
+            // This is a principal (erased) type; show it to the JVM.
+            MethodHandleNatives.init(mt1);
+        }
+        synchronized (internTable) {
+            mt0 = internTable.get(mt1);
+            if (mt0 != null)
+                return mt0;
+            internTable.put(mt1, mt1);
+        }
+        return mt1;
+    }
+
+    private static final MethodType[] objectOnlyTypes = new MethodType[20];
+
+    /**
+     * Finds or creates a method type whose components are {@code Object} with an optional trailing {@code Object[]} array.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * All parameters and the return type will be {@code Object},
+     * except the final varargs parameter if any, which will be {@code Object[]}.
+     * @param objectArgCount number of parameters (excluding the varargs parameter if any)
+     * @param varargs whether there will be a varargs parameter, of type {@code Object[]}
+     * @return a totally generic method type, given only its count of parameters and varargs
+     * @throws IllegalArgumentException if {@code objectArgCount} is negative or greater than 255
+     * @see #genericMethodType(int)
+     */
+    public static
+    MethodType genericMethodType(int objectArgCount, boolean varargs) {
+        MethodType mt;
+        checkSlotCount(objectArgCount);
+        int ivarargs = (!varargs ? 0 : 1);
+        int ootIndex = objectArgCount*2 + ivarargs;
+        if (ootIndex < objectOnlyTypes.length) {
+            mt = objectOnlyTypes[ootIndex];
+            if (mt != null)  return mt;
+        }
+        Class<?>[] ptypes = new Class<?>[objectArgCount + ivarargs];
+        Arrays.fill(ptypes, Object.class);
+        if (ivarargs != 0)  ptypes[objectArgCount] = Object[].class;
+        mt = makeImpl(Object.class, ptypes, true);
+        if (ootIndex < objectOnlyTypes.length) {
+            objectOnlyTypes[ootIndex] = mt;     // cache it here also!
+        }
+        return mt;
+    }
+
+    /**
+     * Finds or creates a method type whose components are all {@code Object}.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * All parameters and the return type will be Object.
+     * @param objectArgCount number of parameters
+     * @return a totally generic method type, given only its count of parameters
+     * @throws IllegalArgumentException if {@code objectArgCount} is negative or greater than 255
+     * @see #genericMethodType(int, boolean)
+     */
+    public static
+    MethodType genericMethodType(int objectArgCount) {
+        return genericMethodType(objectArgCount, false);
+    }
+
+    /**
+     * Finds or creates a method type with a single different parameter type.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param num    the index (zero-based) of the parameter type to change
+     * @param nptype a new parameter type to replace the old one with
+     * @return the same type, except with the selected parameter changed
+     * @throws IndexOutOfBoundsException if {@code num} is not a valid index into {@code parameterArray()}
+     * @throws IllegalArgumentException if {@code nptype} is {@code void.class}
+     * @throws NullPointerException if {@code nptype} is null
+     */
+    public MethodType changeParameterType(int num, Class<?> nptype) {
+        if (parameterType(num) == nptype)  return this;
+        checkPtype(nptype);
+        Class<?>[] nptypes = ptypes.clone();
+        nptypes[num] = nptype;
+        return makeImpl(rtype, nptypes, true);
+    }
+
+    /**
+     * Finds or creates a method type with additional parameter types.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param num    the position (zero-based) of the inserted parameter type(s)
+     * @param ptypesToInsert zero or more new parameter types to insert into the parameter list
+     * @return the same type, except with the selected parameter(s) inserted
+     * @throws IndexOutOfBoundsException if {@code num} is negative or greater than {@code parameterCount()}
+     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
+     *                                  or if the resulting method type would have more than 255 parameter slots
+     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
+     */
+    public MethodType insertParameterTypes(int num, Class<?>... ptypesToInsert) {
+        int len = ptypes.length;
+        if (num < 0 || num > len)
+            throw newIndexOutOfBoundsException(num);
+        int ins = checkPtypes(ptypesToInsert);
+        checkSlotCount(parameterSlotCount() + ptypesToInsert.length + ins);
+        int ilen = ptypesToInsert.length;
+        if (ilen == 0)  return this;
+        Class<?>[] nptypes = Arrays.copyOfRange(ptypes, 0, len+ilen);
+        System.arraycopy(nptypes, num, nptypes, num+ilen, len-num);
+        System.arraycopy(ptypesToInsert, 0, nptypes, num, ilen);
+        return makeImpl(rtype, nptypes, true);
+    }
+
+    /**
+     * Finds or creates a method type with additional parameter types.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param ptypesToInsert zero or more new parameter types to insert after the end of the parameter list
+     * @return the same type, except with the selected parameter(s) appended
+     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
+     *                                  or if the resulting method type would have more than 255 parameter slots
+     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
+     */
+    public MethodType appendParameterTypes(Class<?>... ptypesToInsert) {
+        return insertParameterTypes(parameterCount(), ptypesToInsert);
+    }
+
+    /**
+     * Finds or creates a method type with additional parameter types.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param num    the position (zero-based) of the inserted parameter type(s)
+     * @param ptypesToInsert zero or more new parameter types to insert into the parameter list
+     * @return the same type, except with the selected parameter(s) inserted
+     * @throws IndexOutOfBoundsException if {@code num} is negative or greater than {@code parameterCount()}
+     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
+     *                                  or if the resulting method type would have more than 255 parameter slots
+     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
+     */
+    public MethodType insertParameterTypes(int num, List<Class<?>> ptypesToInsert) {
+        return insertParameterTypes(num, ptypesToInsert.toArray(NO_PTYPES));
+    }
+
+    /**
+     * Finds or creates a method type with additional parameter types.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param ptypesToInsert zero or more new parameter types to insert after the end of the parameter list
+     * @return the same type, except with the selected parameter(s) appended
+     * @throws IllegalArgumentException if any element of {@code ptypesToInsert} is {@code void.class}
+     *                                  or if the resulting method type would have more than 255 parameter slots
+     * @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
+     */
+    public MethodType appendParameterTypes(List<Class<?>> ptypesToInsert) {
+        return insertParameterTypes(parameterCount(), ptypesToInsert);
+    }
+
+    /**
+     * Finds or creates a method type with some parameter types omitted.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param start  the index (zero-based) of the first parameter type to remove
+     * @param end    the index (greater than {@code start}) of the first parameter type after not to remove
+     * @return the same type, except with the selected parameter(s) removed
+     * @throws IndexOutOfBoundsException if {@code start} is negative or greater than {@code parameterCount()}
+     *                                  or if {@code end} is negative or greater than {@code parameterCount()}
+     *                                  or if {@code start} is greater than {@code end}
+     */
+    public MethodType dropParameterTypes(int start, int end) {
+        int len = ptypes.length;
+        if (!(0 <= start && start <= end && end <= len))
+            throw newIndexOutOfBoundsException("start="+start+" end="+end);
+        if (start == end)  return this;
+        Class<?>[] nptypes;
+        if (start == 0) {
+            if (end == len) {
+                // drop all parameters
+                nptypes = NO_PTYPES;
+            } else {
+                // drop initial parameter(s)
+                nptypes = Arrays.copyOfRange(ptypes, end, len);
+            }
+        } else {
+            if (end == len) {
+                // drop trailing parameter(s)
+                nptypes = Arrays.copyOfRange(ptypes, 0, start);
+            } else {
+                int tail = len - end;
+                nptypes = Arrays.copyOfRange(ptypes, 0, start + tail);
+                System.arraycopy(ptypes, end, nptypes, start, tail);
+            }
+        }
+        return makeImpl(rtype, nptypes, true);
+    }
+
+    /**
+     * Finds or creates a method type with a different return type.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * @param nrtype a return parameter type to replace the old one with
+     * @return the same type, except with the return type change
+     * @throws NullPointerException if {@code nrtype} is null
+     */
+    public MethodType changeReturnType(Class<?> nrtype) {
+        if (returnType() == nrtype)  return this;
+        return makeImpl(nrtype, ptypes, true);
+    }
+
+    /**
+     * Reports if this type contains a primitive argument or return value.
+     * The return type {@code void} counts as a primitive.
+     * @return true if any of the types are primitives
+     */
+    public boolean hasPrimitives() {
+        return form.hasPrimitives();
+    }
+
+    /**
+     * Reports if this type contains a wrapper argument or return value.
+     * Wrappers are types which box primitive values, such as {@link Integer}.
+     * The reference type {@code java.lang.Void} counts as a wrapper.
+     * @return true if any of the types are wrappers
+     */
+    public boolean hasWrappers() {
+        return unwrap() != this;
+    }
+
+    /**
+     * Erases all reference types to {@code Object}.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * All primitive types (including {@code void}) will remain unchanged.
+     * @return a version of the original type with all reference types replaced
+     */
+    public MethodType erase() {
+        return form.erasedType();
+    }
+
+    /**
+     * Converts all types, both reference and primitive, to {@code Object}.
+     * Convenience method for {@link #genericMethodType(int) genericMethodType}.
+     * The expression {@code type.wrap().erase()} produces the same value
+     * as {@code type.generic()}.
+     * @return a version of the original type with all types replaced
+     */
+    public MethodType generic() {
+        return genericMethodType(parameterCount());
+    }
+
+    /**
+     * Converts all primitive types to their corresponding wrapper types.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * All reference types (including wrapper types) will remain unchanged.
+     * A {@code void} return type is changed to the type {@code java.lang.Void}.
+     * The expression {@code type.wrap().erase()} produces the same value
+     * as {@code type.generic()}.
+     * @return a version of the original type with all primitive types replaced
+     */
+    public MethodType wrap() {
+        return hasPrimitives() ? wrapWithPrims(this) : this;
+    }
+
+    /**
+     * Converts all wrapper types to their corresponding primitive types.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * All primitive types (including {@code void}) will remain unchanged.
+     * A return type of {@code java.lang.Void} is changed to {@code void}.
+     * @return a version of the original type with all wrapper types replaced
+     */
+    public MethodType unwrap() {
+        MethodType noprims = !hasPrimitives() ? this : wrapWithPrims(this);
+        return unwrapWithNoPrims(noprims);
+    }
+
+    private static MethodType wrapWithPrims(MethodType pt) {
+        assert(pt.hasPrimitives());
+        MethodType wt = pt.wrapAlt;
+        if (wt == null) {
+            // fill in lazily
+            wt = MethodTypeForm.canonicalize(pt, MethodTypeForm.WRAP, MethodTypeForm.WRAP);
+            assert(wt != null);
+            pt.wrapAlt = wt;
+        }
+        return wt;
+    }
+
+    private static MethodType unwrapWithNoPrims(MethodType wt) {
+        assert(!wt.hasPrimitives());
+        MethodType uwt = wt.wrapAlt;
+        if (uwt == null) {
+            // fill in lazily
+            uwt = MethodTypeForm.canonicalize(wt, MethodTypeForm.UNWRAP, MethodTypeForm.UNWRAP);
+            if (uwt == null)
+                uwt = wt;    // type has no wrappers or prims at all
+            wt.wrapAlt = uwt;
+        }
+        return uwt;
+    }
+
+    /**
+     * Returns the parameter type at the specified index, within this method type.
+     * @param num the index (zero-based) of the desired parameter type
+     * @return the selected parameter type
+     * @throws IndexOutOfBoundsException if {@code num} is not a valid index into {@code parameterArray()}
+     */
+    public Class<?> parameterType(int num) {
+        return ptypes[num];
+    }
+    /**
+     * Returns the number of parameter types in this method type.
+     * @return the number of parameter types
+     */
+    public int parameterCount() {
+        return ptypes.length;
+    }
+    /**
+     * Returns the return type of this method type.
+     * @return the return type
+     */
+    public Class<?> returnType() {
+        return rtype;
+    }
+
+    /**
+     * Presents the parameter types as a list (a convenience method).
+     * The list will be immutable.
+     * @return the parameter types (as an immutable list)
+     */
+    public List<Class<?>> parameterList() {
+        return Collections.unmodifiableList(Arrays.asList(ptypes));
+    }
+
+    /**
+     * Presents the parameter types as an array (a convenience method).
+     * Changes to the array will not result in changes to the type.
+     * @return the parameter types (as a fresh copy if necessary)
+     */
+    public Class<?>[] parameterArray() {
+        return ptypes.clone();
+    }
+
+    /**
+     * Compares the specified object with this type for equality.
+     * That is, it returns <tt>true</tt> if and only if the specified object
+     * is also a method type with exactly the same parameters and return type.
+     * @param x object to compare
+     * @see Object#equals(Object)
+     */
+    @Override
+    public boolean equals(Object x) {
+        return this == x || x instanceof MethodType && equals((MethodType)x);
+    }
+
+    private boolean equals(MethodType that) {
+        return this.rtype == that.rtype
+            && Arrays.equals(this.ptypes, that.ptypes);
+    }
+
+    /**
+     * Returns the hash code value for this method type.
+     * It is defined to be the same as the hashcode of a List
+     * whose elements are the return type followed by the
+     * parameter types.
+     * @return the hash code value for this method type
+     * @see Object#hashCode()
+     * @see #equals(Object)
+     * @see List#hashCode()
+     */
+    @Override
+    public int hashCode() {
+      int hashCode = 31 + rtype.hashCode();
+      for (Class<?> ptype : ptypes)
+          hashCode = 31*hashCode + ptype.hashCode();
+      return hashCode;
+    }
+
+    /**
+     * Returns a string representation of the method type,
+     * of the form {@code "(PT0,PT1...)RT"}.
+     * The string representation of a method type is a
+     * parenthesis enclosed, comma separated list of type names,
+     * followed immediately by the return type.
+     * <p>
+     * Each type is represented by its
+     * {@link java.lang.Class#getSimpleName simple name}.
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("(");
+        for (int i = 0; i < ptypes.length; i++) {
+            if (i > 0)  sb.append(",");
+            sb.append(ptypes[i].getSimpleName());
+        }
+        sb.append(")");
+        sb.append(rtype.getSimpleName());
+        return sb.toString();
+    }
+
+    /// Queries which have to do with the bytecode architecture
+
+    /** Reports the number of JVM stack slots required to invoke a method
+     * of this type.  Note that (for historical reasons) the JVM requires
+     * a second stack slot to pass long and double arguments.
+     * So this method returns {@link #parameterCount() parameterCount} plus the
+     * number of long and double parameters (if any).
+     * <p>
+     * This method is included for the benfit of applications that must
+     * generate bytecodes that process method handles and invokedynamic.
+     * @return the number of JVM stack slots for this type's parameters
+     */
+    /*non-public*/ int parameterSlotCount() {
+        return form.parameterSlotCount();
+    }
+
+    /*non-public*/ Invokers invokers() {
+        Invokers inv = invokers;
+        if (inv != null)  return inv;
+        invokers = inv = new Invokers(this);
+        return inv;
+    }
+
+    /** Reports the number of JVM stack slots which carry all parameters including and after
+     * the given position, which must be in the range of 0 to
+     * {@code parameterCount} inclusive.  Successive parameters are
+     * more shallowly stacked, and parameters are indexed in the bytecodes
+     * according to their trailing edge.  Thus, to obtain the depth
+     * in the outgoing call stack of parameter {@code N}, obtain
+     * the {@code parameterSlotDepth} of its trailing edge
+     * at position {@code N+1}.
+     * <p>
+     * Parameters of type {@code long} and {@code double} occupy
+     * two stack slots (for historical reasons) and all others occupy one.
+     * Therefore, the number returned is the number of arguments
+     * <em>including</em> and <em>after</em> the given parameter,
+     * <em>plus</em> the number of long or double arguments
+     * at or after after the argument for the given parameter.
+     * <p>
+     * This method is included for the benfit of applications that must
+     * generate bytecodes that process method handles and invokedynamic.
+     * @param num an index (zero-based, inclusive) within the parameter types
+     * @return the index of the (shallowest) JVM stack slot transmitting the
+     *         given parameter
+     * @throws IllegalArgumentException if {@code num} is negative or greater than {@code parameterCount()}
+     */
+    /*non-public*/ int parameterSlotDepth(int num) {
+        if (num < 0 || num > ptypes.length)
+            parameterType(num);  // force a range check
+        return form.parameterToArgSlot(num-1);
+    }
+
+    /** Reports the number of JVM stack slots required to receive a return value
+     * from a method of this type.
+     * If the {@link #returnType() return type} is void, it will be zero,
+     * else if the return type is long or double, it will be two, else one.
+     * <p>
+     * This method is included for the benfit of applications that must
+     * generate bytecodes that process method handles and invokedynamic.
+     * @return the number of JVM stack slots (0, 1, or 2) for this type's return value
+     * Will be removed for PFD.
+     */
+    /*non-public*/ int returnSlotCount() {
+        return form.returnSlotCount();
+    }
+
+    /**
+     * Finds or creates an instance of a method type, given the spelling of its bytecode descriptor.
+     * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+     * Any class or interface name embedded in the descriptor string
+     * will be resolved by calling {@link ClassLoader#loadClass(java.lang.String)}
+     * on the given loader (or if it is null, on the system class loader).
+     * <p>
+     * Note that it is possible to encounter method types which cannot be
+     * constructed by this method, because their component types are
+     * not all reachable from a common class loader.
+     * <p>
+     * This method is included for the benfit of applications that must
+     * generate bytecodes that process method handles and {@code invokedynamic}.
+     * @param descriptor a bytecode-level type descriptor string "(T...)T"
+     * @param loader the class loader in which to look up the types
+     * @return a method type matching the bytecode-level type descriptor
+     * @throws IllegalArgumentException if the string is not well-formed
+     * @throws TypeNotPresentException if a named type cannot be found
+     */
+    public static MethodType fromMethodDescriptorString(String descriptor, ClassLoader loader)
+        throws IllegalArgumentException, TypeNotPresentException
+    {
+        List<Class<?>> types = BytecodeDescriptor.parseMethod(descriptor, loader);
+        Class<?> rtype = types.remove(types.size() - 1);
+        Class<?>[] ptypes = types.toArray(NO_PTYPES);
+        return makeImpl(rtype, ptypes, true);
+    }
+
+    /**
+     * Produces a bytecode descriptor representation of the method type.
+     * <p>
+     * Note that this is not a strict inverse of {@link #fromMethodDescriptorString fromMethodDescriptorString}.
+     * Two distinct classes which share a common name but have different class loaders
+     * will appear identical when viewed within descriptor strings.
+     * <p>
+     * This method is included for the benfit of applications that must
+     * generate bytecodes that process method handles and {@code invokedynamic}.
+     * {@link #fromMethodDescriptorString(java.lang.String, java.lang.ClassLoader) fromMethodDescriptorString},
+     * because the latter requires a suitable class loader argument.
+     * @return the bytecode type descriptor representation
+     */
+    public String toMethodDescriptorString() {
+        return BytecodeDescriptor.unparse(this);
+    }
+
+    /// Serialization.
+
+    /**
+     * There are no serializable fields for {@code MethodType}.
+     */
+    private static final java.io.ObjectStreamField[] serialPersistentFields = { };
+
+    /**
+     * Save the {@code MethodType} instance to a stream.
+     *
+     * @serialData
+     * For portability, the serialized format does not refer to named fields.
+     * Instead, the return type and parameter type arrays are written directly
+     * from the {@code writeObject} method, using two calls to {@code s.writeObject}
+     * as follows:
+     * <blockquote><pre>
+s.writeObject(this.returnType());
+s.writeObject(this.parameterArray());
+     * </pre></blockquote>
+     * <p>
+     * The deserialized field values are checked as if they were
+     * provided to the factory method {@link #methodType(Class,Class[]) methodType}.
+     * For example, null values, or {@code void} parameter types,
+     * will lead to exceptions during deserialization.
+     * @param the stream to write the object to
+     */
+    private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
+        s.defaultWriteObject();  // requires serialPersistentFields to be an empty array
+        s.writeObject(returnType());
+        s.writeObject(parameterArray());
+    }
+
+    /**
+     * Reconstitute the {@code MethodType} instance from a stream (that is,
+     * deserialize it).
+     * This instance is a scratch object with bogus final fields.
+     * It provides the parameters to the factory method called by
+     * {@link #readResolve readResolve}.
+     * After that call it is discarded.
+     * @param the stream to read the object from
+     * @see #MethodType()
+     * @see #readResolve
+     * @see #writeObject
+     */
+    private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
+        s.defaultReadObject();  // requires serialPersistentFields to be an empty array
+
+        Class<?>   returnType     = (Class<?>)   s.readObject();
+        Class<?>[] parameterArray = (Class<?>[]) s.readObject();
+
+        // Probably this object will never escape, but let's check
+        // the field values now, just to be sure.
+        checkRtype(returnType);
+        checkPtypes(parameterArray);
+
+        parameterArray = parameterArray.clone();  // make sure it is unshared
+        MethodType_init(returnType, parameterArray);
+    }
+
+    /**
+     * For serialization only.
+     * Sets the final fields to null, pending {@code Unsafe.putObject}.
+     */
+    private MethodType() {
+        this.rtype = null;
+        this.ptypes = null;
+    }
+    private void MethodType_init(Class<?> rtype, Class<?>[] ptypes) {
+        // In order to communicate these values to readResolve, we must
+        // store them into the implementation-specific final fields.
+        checkRtype(rtype);
+        checkPtypes(ptypes);
+        unsafe.putObject(this, rtypeOffset, rtype);
+        unsafe.putObject(this, ptypesOffset, ptypes);
+    }
+
+    // Support for resetting final fields while deserializing
+    private static final sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
+    private static final long rtypeOffset, ptypesOffset;
+    static {
+        try {
+            rtypeOffset = unsafe.objectFieldOffset
+                (MethodType.class.getDeclaredField("rtype"));
+            ptypesOffset = unsafe.objectFieldOffset
+                (MethodType.class.getDeclaredField("ptypes"));
+        } catch (Exception ex) {
+            throw new Error(ex);
+        }
+    }
+
+    /**
+     * Resolves and initializes a {@code MethodType} object
+     * after serialization.
+     * @return the fully initialized {@code MethodType} object
+     */
+    private Object readResolve() {
+        // Do not use a trusted path for deserialization:
+        //return makeImpl(rtype, ptypes, true);
+        // Verify all operands, and make sure ptypes is unshared:
+        return methodType(rtype, ptypes);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,476 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.Wrapper;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * Shared information for a group of method types, which differ
+ * only by reference types, and therefore share a common erasure
+ * and wrapping.
+ * <p>
+ * For an empirical discussion of the structure of method types,
+ * see <a href="http://groups.google.com/group/jvm-languages/browse_thread/thread/ac9308ae74da9b7e/">
+ * the thread "Avoiding Boxing" on jvm-languages</a>.
+ * There are approximately 2000 distinct erased method types in the JDK.
+ * There are a little over 10 times that number of unerased types.
+ * No more than half of these are likely to be loaded at once.
+ * @author John Rose
+ */
+class MethodTypeForm {
+    final int[] argToSlotTable, slotToArgTable;
+    final long argCounts;               // packed slot & value counts
+    final long primCounts;              // packed prim & double counts
+    final int vmslots;                  // total number of parameter slots
+    final MethodType erasedType;        // the canonical erasure
+
+    /*lazy*/ MethodType primsAsBoxes;   // replace prims by wrappers
+    /*lazy*/ MethodType primArgsAsBoxes; // wrap args only; make raw return
+    /*lazy*/ MethodType primsAsInts;    // replace prims by int/long
+    /*lazy*/ MethodType primsAsLongs;   // replace prims by long
+    /*lazy*/ MethodType primsAtEnd;     // reorder primitives to the end
+
+    // Cached adapter information:
+    /*lazy*/ ToGeneric   toGeneric;     // convert cs. with prims to w/o
+    /*lazy*/ FromGeneric fromGeneric;   // convert cs. w/o prims to with
+    /*lazy*/ SpreadGeneric[] spreadGeneric; // expand one argument to many
+    /*lazy*/ FilterGeneric filterGeneric; // convert argument(s) on the fly
+    /*lazy*/ MethodHandle genericInvoker; // hook for invokeGeneric
+
+    public MethodType erasedType() {
+        return erasedType;
+    }
+
+    protected MethodTypeForm(MethodType erasedType) {
+        this.erasedType = erasedType;
+
+        Class<?>[] ptypes = erasedType.ptypes();
+        int ptypeCount = ptypes.length;
+        int pslotCount = ptypeCount;            // temp. estimate
+        int rtypeCount = 1;                     // temp. estimate
+        int rslotCount = 1;                     // temp. estimate
+
+        int[] argToSlotTab = null, slotToArgTab = null;
+
+        // Walk the argument types, looking for primitives.
+        int pac = 0, lac = 0, prc = 0, lrc = 0;
+        Class<?> epts[] = ptypes;
+        for (int i = 0; i < epts.length; i++) {
+            Class<?> pt = epts[i];
+            if (pt != Object.class) {
+                assert(pt.isPrimitive());
+                ++pac;
+                if (hasTwoArgSlots(pt))  ++lac;
+            }
+        }
+        pslotCount += lac;                  // #slots = #args + #longs
+        Class<?> rt = erasedType.returnType();
+        if (rt != Object.class) {
+            ++prc;          // even void.class counts as a prim here
+            if (hasTwoArgSlots(rt))  ++lrc;
+            // adjust #slots, #args
+            if (rt == void.class)
+                rtypeCount = rslotCount = 0;
+            else
+                rslotCount += lrc;
+        }
+        if (lac != 0) {
+            int slot = ptypeCount + lac;
+            slotToArgTab = new int[slot+1];
+            argToSlotTab = new int[1+ptypeCount];
+            argToSlotTab[0] = slot;  // argument "-1" is past end of slots
+            for (int i = 0; i < epts.length; i++) {
+                Class<?> pt = epts[i];
+                if (hasTwoArgSlots(pt))  --slot;
+                --slot;
+                slotToArgTab[slot] = i+1; // "+1" see argSlotToParameter note
+                argToSlotTab[1+i]  = slot;
+            }
+            assert(slot == 0);  // filled the table
+        }
+        this.primCounts = pack(lrc, prc, lac, pac);
+        this.argCounts = pack(rslotCount, rtypeCount, pslotCount, ptypeCount);
+        if (slotToArgTab == null) {
+            int slot = ptypeCount; // first arg is deepest in stack
+            slotToArgTab = new int[slot+1];
+            argToSlotTab = new int[1+ptypeCount];
+            argToSlotTab[0] = slot;  // argument "-1" is past end of slots
+            for (int i = 0; i < ptypeCount; i++) {
+                --slot;
+                slotToArgTab[slot] = i+1; // "+1" see argSlotToParameter note
+                argToSlotTab[1+i]  = slot;
+            }
+        }
+        this.argToSlotTable = argToSlotTab;
+        this.slotToArgTable = slotToArgTab;
+
+        if (pslotCount >= 256)  throw newIllegalArgumentException("too many arguments");
+
+        // send a few bits down to the JVM:
+        this.vmslots = parameterSlotCount();
+
+        // short circuit some no-op canonicalizations:
+        if (!hasPrimitives()) {
+            primsAsBoxes = erasedType;
+            primArgsAsBoxes = erasedType;
+            primsAsInts  = erasedType;
+            primsAsLongs = erasedType;
+            primsAtEnd   = erasedType;
+        }
+    }
+
+    /** Turn all primitive types to corresponding wrapper types.
+     */
+    public MethodType primsAsBoxes() {
+        MethodType ct = primsAsBoxes;
+        if (ct != null)  return ct;
+        MethodType t = erasedType;
+        ct = canonicalize(erasedType, WRAP, WRAP);
+        if (ct == null)  ct = t;  // no prims to box
+        return primsAsBoxes = ct;
+    }
+
+    /** Turn all primitive argument types to corresponding wrapper types.
+     *  Subword and void return types are promoted to int.
+     */
+    public MethodType primArgsAsBoxes() {
+        MethodType ct = primArgsAsBoxes;
+        if (ct != null)  return ct;
+        MethodType t = erasedType;
+        ct = canonicalize(erasedType, RAW_RETURN, WRAP);
+        if (ct == null)  ct = t;  // no prims to box
+        return primArgsAsBoxes = ct;
+    }
+
+    /** Turn all primitive types to either int or long.
+     *  Floating point return types are not changed, because
+     *  they may require special calling sequences.
+     *  A void return value is turned to int.
+     */
+    public MethodType primsAsInts() {
+        MethodType ct = primsAsInts;
+        if (ct != null)  return ct;
+        MethodType t = erasedType;
+        ct = canonicalize(t, RAW_RETURN, INTS);
+        if (ct == null)  ct = t;  // no prims to int-ify
+        return primsAsInts = ct;
+    }
+
+    /** Turn all primitive types to either int or long.
+     *  Floating point return types are not changed, because
+     *  they may require special calling sequences.
+     *  A void return value is turned to int.
+     */
+    public MethodType primsAsLongs() {
+        MethodType ct = primsAsLongs;
+        if (ct != null)  return ct;
+        MethodType t = erasedType;
+        ct = canonicalize(t, RAW_RETURN, LONGS);
+        if (ct == null)  ct = t;  // no prims to int-ify
+        return primsAsLongs = ct;
+    }
+
+    /** Stably sort parameters into 3 buckets: ref, int, long. */
+    public MethodType primsAtEnd() {
+        MethodType ct = primsAtEnd;
+        if (ct != null)  return ct;
+        MethodType t = erasedType;
+
+        int pac = primitiveParameterCount();
+        if (pac == 0)
+            return primsAtEnd = t;
+
+        int argc = parameterCount();
+        int lac = longPrimitiveParameterCount();
+        if (pac == argc && (lac == 0 || lac == argc))
+            return primsAtEnd = t;
+
+        // known to have a mix of 2 or 3 of ref, int, long
+        int[] reorder = primsAtEndOrder(t);
+        ct = reorderParameters(t, reorder, null);
+        //System.out.println("t="+t+" / reorder="+java.util.Arrays.toString(reorder)+" => "+ct);
+        return primsAtEnd = ct;
+    }
+
+    /** Compute a new ordering of parameters so that all references
+     *  are before all ints or longs, and all ints are before all longs.
+     *  For this ordering, doubles count as longs, and all other primitive
+     *  values count as ints.
+     *  As a special case, if the parameters are already in the specified
+     *  order, this method returns a null reference, rather than an array
+     *  specifying a null permutation.
+     *  <p>
+     *  For example, the type {@code (int,boolean,int,Object,String)void}
+     *  produces the order {@code {3,4,0,1,2}}, the type
+     *  {@code (long,int,String)void} produces {@code {2,1,2}}, and
+     *  the type {@code (Object,int)Object} produces {@code null}.
+     */
+    public static int[] primsAtEndOrder(MethodType mt) {
+        MethodTypeForm form = mt.form();
+        if (form.primsAtEnd == form.erasedType)
+            // quick check shows no reordering is necessary
+            return null;
+
+        int argc = form.parameterCount();
+        int[] paramOrder = new int[argc];
+
+        // 3-way bucket sort:
+        int pac = form.primitiveParameterCount();
+        int lac = form.longPrimitiveParameterCount();
+        int rfill = 0, ifill = argc - pac, lfill = argc - lac;
+
+        Class<?>[] ptypes = mt.ptypes();
+        boolean changed = false;
+        for (int i = 0; i < ptypes.length; i++) {
+            Class<?> pt = ptypes[i];
+            int ord;
+            if (!pt.isPrimitive())             ord = rfill++;
+            else if (!hasTwoArgSlots(pt))      ord = ifill++;
+            else                               ord = lfill++;
+            if (ord != i)  changed = true;
+            assert(paramOrder[ord] == 0);
+            paramOrder[ord] = i;
+        }
+        assert(rfill == argc - pac && ifill == argc - lac && lfill == argc);
+        if (!changed) {
+            form.primsAtEnd = form.erasedType;
+            return null;
+        }
+        return paramOrder;
+    }
+
+    /** Put the existing parameters of mt into a new order, given by newParamOrder.
+     *  The third argument is logically appended to mt.parameterArray,
+     *  so that elements of newParamOrder can index either pre-existing or
+     *  new parameter types.
+     */
+    public static MethodType reorderParameters(MethodType mt, int[] newParamOrder, Class<?>[] moreParams) {
+        if (newParamOrder == null)  return mt;  // no-op reordering
+        Class<?>[] ptypes = mt.ptypes();
+        Class<?>[] ntypes = new Class<?>[newParamOrder.length];
+        int maxParam = ptypes.length + (moreParams == null ? 0 : moreParams.length);
+        boolean changed = (ntypes.length != ptypes.length);
+        for (int i = 0; i < newParamOrder.length; i++) {
+            int param = newParamOrder[i];
+            if (param != i)  changed = true;
+            Class<?> nt;
+            if (param < ptypes.length)   nt = ptypes[param];
+            else if (param == maxParam)  nt = mt.returnType();
+            else                         nt = moreParams[param - ptypes.length];
+            ntypes[i] = nt;
+        }
+        if (!changed)  return mt;
+        return MethodType.makeImpl(mt.returnType(), ntypes, true);
+    }
+
+    private static boolean hasTwoArgSlots(Class<?> type) {
+        return type == long.class || type == double.class;
+    }
+
+    private static long pack(int a, int b, int c, int d) {
+        assert(((a|b|c|d) & ~0xFFFF) == 0);
+        long hw = ((a << 16) | b), lw = ((c << 16) | d);
+        return (hw << 32) | lw;
+    }
+    private static char unpack(long packed, int word) { // word==0 => return a, ==3 => return d
+        assert(word <= 3);
+        return (char)(packed >> ((3-word) * 16));
+    }
+
+    public int parameterCount() {                      // # outgoing values
+        return unpack(argCounts, 3);
+    }
+    public int parameterSlotCount() {                  // # outgoing interpreter slots
+        return unpack(argCounts, 2);
+    }
+    public int returnCount() {                         // = 0 (V), or 1
+        return unpack(argCounts, 1);
+    }
+    public int returnSlotCount() {                     // = 0 (V), 2 (J/D), or 1
+        return unpack(argCounts, 0);
+    }
+    public int primitiveParameterCount() {
+        return unpack(primCounts, 3);
+    }
+    public int longPrimitiveParameterCount() {
+        return unpack(primCounts, 2);
+    }
+    public int primitiveReturnCount() {                // = 0 (obj), or 1
+        return unpack(primCounts, 1);
+    }
+    public int longPrimitiveReturnCount() {            // = 1 (J/D), or 0
+        return unpack(primCounts, 0);
+    }
+    public boolean hasPrimitives() {
+        return primCounts != 0;
+    }
+//    public boolean hasNonVoidPrimitives() {
+//        if (primCounts == 0)  return false;
+//        if (primitiveParameterCount() != 0)  return true;
+//        return (primitiveReturnCount() != 0 && returnCount() != 0);
+//    }
+    public boolean hasLongPrimitives() {
+        return (longPrimitiveParameterCount() | longPrimitiveReturnCount()) != 0;
+    }
+    public int parameterToArgSlot(int i) {
+        return argToSlotTable[1+i];
+    }
+    public int argSlotToParameter(int argSlot) {
+        // Note:  Empty slots are represented by zero in this table.
+        // Valid arguments slots contain incremented entries, so as to be non-zero.
+        // We return -1 the caller to mean an empty slot.
+        return slotToArgTable[argSlot] - 1;
+    }
+
+    static MethodTypeForm findForm(MethodType mt) {
+        MethodType erased = canonicalize(mt, ERASE, ERASE);
+        if (erased == null) {
+            // It is already erased.  Make a new MethodTypeForm.
+            return new MethodTypeForm(mt);
+        } else {
+            // Share the MethodTypeForm with the erased version.
+            return erased.form();
+        }
+    }
+
+    /** Codes for {@link #canonicalize(java.lang.Class, int)}.
+     * ERASE means change every reference to {@code Object}.
+     * WRAP means convert primitives (including {@code void} to their
+     * corresponding wrapper types.  UNWRAP means the reverse of WRAP.
+     * INTS means convert all non-void primitive types to int or long,
+     * according to size.  LONGS means convert all non-void primitives
+     * to long, regardless of size.  RAW_RETURN means convert a type
+     * (assumed to be a return type) to int if it is smaller than an int,
+     * or if it is void.
+     */
+    public static final int NO_CHANGE = 0, ERASE = 1, WRAP = 2, UNWRAP = 3, INTS = 4, LONGS = 5, RAW_RETURN = 6;
+
+    /** Canonicalize the types in the given method type.
+     * If any types change, intern the new type, and return it.
+     * Otherwise return null.
+     */
+    public static MethodType canonicalize(MethodType mt, int howRet, int howArgs) {
+        Class<?>[] ptypes = mt.ptypes();
+        Class<?>[] ptc = MethodTypeForm.canonicalizes(ptypes, howArgs);
+        Class<?> rtype = mt.returnType();
+        Class<?> rtc = MethodTypeForm.canonicalize(rtype, howRet);
+        if (ptc == null && rtc == null) {
+            // It is already canonical.
+            return null;
+        }
+        // Find the erased version of the method type:
+        if (rtc == null)  rtc = rtype;
+        if (ptc == null)  ptc = ptypes;
+        return MethodType.makeImpl(rtc, ptc, true);
+    }
+
+    /** Canonicalize the given return or param type.
+     *  Return null if the type is already canonicalized.
+     */
+    static Class<?> canonicalize(Class<?> t, int how) {
+        Class<?> ct;
+        if (t == Object.class) {
+            // no change, ever
+        } else if (!t.isPrimitive()) {
+            switch (how) {
+                case UNWRAP:
+                    ct = Wrapper.asPrimitiveType(t);
+                    if (ct != t)  return ct;
+                    break;
+                case RAW_RETURN:
+                case ERASE:
+                    return Object.class;
+            }
+        } else if (t == void.class) {
+            // no change, usually
+            switch (how) {
+                case RAW_RETURN:
+                    return int.class;
+                case WRAP:
+                    return Void.class;
+            }
+        } else {
+            // non-void primitive
+            switch (how) {
+                case WRAP:
+                    return Wrapper.asWrapperType(t);
+                case INTS:
+                    if (t == int.class || t == long.class)
+                        return null;  // no change
+                    if (t == double.class)
+                        return long.class;
+                    return int.class;
+                case LONGS:
+                    if (t == long.class)
+                        return null;  // no change
+                    return long.class;
+                case RAW_RETURN:
+                    if (t == int.class || t == long.class ||
+                        t == float.class || t == double.class)
+                        return null;  // no change
+                    // everything else returns as an int
+                    return int.class;
+            }
+        }
+        // no change; return null to signify
+        return null;
+    }
+
+    /** Canonicalize each param type in the given array.
+     *  Return null if all types are already canonicalized.
+     */
+    static Class<?>[] canonicalizes(Class<?>[] ts, int how) {
+        Class<?>[] cs = null;
+        for (int imax = ts.length, i = 0; i < imax; i++) {
+            Class<?> c = canonicalize(ts[i], how);
+            if (c != null) {
+                if (cs == null)
+                    cs = ts.clone();
+                cs[i] = c;
+            }
+        }
+        return cs;
+    }
+
+    /*non-public*/ void notifyGenericMethodType() {
+        if (genericInvoker != null)  return;
+        try {
+            // Trigger adapter creation.
+            genericInvoker = InvokeGeneric.genericInvokerOf(erasedType);
+        } catch (Exception ex) {
+            Error err = new InternalError("Exception while resolving invokeGeneric");
+            err.initCause(ex);
+            throw err;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "Form"+erasedType;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * A {@code MutableCallSite} is a {@link CallSite} whose target variable
+ * behaves like an ordinary field.
+ * An {@code invokedynamic} instruction linked to a {@code MutableCallSite} delegates
+ * all calls to the site's current target.
+ * The {@linkplain CallSite#dynamicInvoker dynamic invoker} of a mutable call site
+ * also delegates each call to the site's current target.
+ * <p>
+ * Here is an example of a mutable call site which introduces a
+ * state variable into a method handle chain.
+ * <blockquote><pre>
+MutableCallSite name = new MutableCallSite(MethodType.methodType(String.class));
+MethodHandle MH_name = name.dynamicInvoker();
+MethodType MT_str2 = MethodType.methodType(String.class, String.class);
+MethodHandle MH_upcase = MethodHandles.lookup()
+    .findVirtual(String.class, "toUpperCase", MT_str2);
+MethodHandle worker1 = MethodHandles.filterReturnValue(MH_name, MH_upcase);
+name.setTarget(MethodHandles.constant(String.class, "Rocky"));
+assertEquals("ROCKY", (String) worker1.invokeExact());
+name.setTarget(MethodHandles.constant(String.class, "Fred"));
+assertEquals("FRED", (String) worker1.invokeExact());
+// (mutation can be continued indefinitely)
+ * </pre></blockquote>
+ * <p>
+ * The same call site may be used in several places at once.
+ * <blockquote><pre>
+MethodHandle MH_dear = MethodHandles.lookup()
+    .findVirtual(String.class, "concat", MT_str2).bindTo(", dear?");
+MethodHandle worker2 = MethodHandles.filterReturnValue(MH_name, MH_dear);
+assertEquals("Fred, dear?", (String) worker2.invokeExact());
+name.setTarget(MethodHandles.constant(String.class, "Wilma"));
+assertEquals("WILMA", (String) worker1.invokeExact());
+assertEquals("Wilma, dear?", (String) worker2.invokeExact());
+ * </pre></blockquote>
+ * <p>
+ * <em>Non-synchronization of target values:</em>
+ * A write to a mutable call site's target does not force other threads
+ * to become aware of the updated value.  Threads which do not perform
+ * suitable synchronization actions relative to the updated call site
+ * may cache the old target value and delay their use of the new target
+ * value indefinitely.
+ * (This is a normal consequence of the Java Memory Model as applied
+ * to object fields.)
+ * <p>
+ * The {@link #syncAll syncAll} operation provides a way to force threads
+ * to accept a new target value, even if there is no other synchronization.
+ * <p>
+ * For target values which will be frequently updated, consider using
+ * a {@linkplain VolatileCallSite volatile call site} instead.
+ * @author John Rose, JSR 292 EG
+ */
+public class MutableCallSite extends CallSite {
+    /**
+     * Creates a blank call site object with the given method type.
+     * The initial target is set to a method handle of the given type
+     * which will throw an {@link IllegalStateException} if called.
+     * <p>
+     * The type of the call site is permanently set to the given type.
+     * <p>
+     * Before this {@code CallSite} object is returned from a bootstrap method,
+     * or invoked in some other manner,
+     * it is usually provided with a more useful target method,
+     * via a call to {@link CallSite#setTarget(MethodHandle) setTarget}.
+     * @param type the method type that this call site will have
+     * @throws NullPointerException if the proposed type is null
+     */
+    public MutableCallSite(MethodType type) {
+        super(type);
+    }
+
+    /**
+     * Creates a call site object with an initial target method handle.
+     * The type of the call site is permanently set to the initial target's type.
+     * @param target the method handle that will be the initial target of the call site
+     * @throws NullPointerException if the proposed target is null
+     */
+    public MutableCallSite(MethodHandle target) {
+        super(target);
+    }
+
+    /**
+     * Returns the target method of the call site, which behaves
+     * like a normal field of the {@code MutableCallSite}.
+     * <p>
+     * The interactions of {@code getTarget} with memory are the same
+     * as of a read from an ordinary variable, such as an array element or a
+     * non-volatile, non-final field.
+     * <p>
+     * In particular, the current thread may choose to reuse the result
+     * of a previous read of the target from memory, and may fail to see
+     * a recent update to the target by another thread.
+     *
+     * @return the linkage state of this call site, a method handle which can change over time
+     * @see #setTarget
+     */
+    @Override public final MethodHandle getTarget() {
+        return target;
+    }
+
+    /**
+     * Updates the target method of this call site, as a normal variable.
+     * The type of the new target must agree with the type of the old target.
+     * <p>
+     * The interactions with memory are the same
+     * as of a write to an ordinary variable, such as an array element or a
+     * non-volatile, non-final field.
+     * <p>
+     * In particular, unrelated threads may fail to see the updated target
+     * until they perform a read from memory.
+     * Stronger guarantees can be created by putting appropriate operations
+     * into the bootstrap method and/or the target methods used
+     * at any given call site.
+     *
+     * @param newTarget the new target
+     * @throws NullPointerException if the proposed new target is null
+     * @throws WrongMethodTypeException if the proposed new target
+     *         has a method type that differs from the previous target
+     * @see #getTarget
+     */
+    @Override public void setTarget(MethodHandle newTarget) {
+        checkTargetChange(this.target, newTarget);
+        setTargetNormal(newTarget);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final MethodHandle dynamicInvoker() {
+        return makeDynamicInvoker();
+    }
+
+    /**
+     * Performs a synchronization operation on each call site in the given array,
+     * forcing all other threads to throw away any cached values previously
+     * loaded from the target of any of the call sites.
+     * <p>
+     * This operation does not reverse any calls that have already started
+     * on an old target value.
+     * (Java supports {@linkplain java.lang.Object#wait() forward time travel} only.)
+     * <p>
+     * The overall effect is to force all future readers of each call site's target
+     * to accept the most recently stored value.
+     * ("Most recently" is reckoned relative to the {@code syncAll} itself.)
+     * Conversely, the {@code syncAll} call may block until all readers have
+     * (somehow) decached all previous versions of each call site's target.
+     * <p>
+     * To avoid race conditions, calls to {@code setTarget} and {@code syncAll}
+     * should generally be performed under some sort of mutual exclusion.
+     * Note that reader threads may observe an updated target as early
+     * as the {@code setTarget} call that install the value
+     * (and before the {@code syncAll} that confirms the value).
+     * On the other hand, reader threads may observe previous versions of
+     * the target until the {@code syncAll} call returns
+     * (and after the {@code setTarget} that attempts to convey the updated version).
+     * <p>
+     * This operation is likely to be expensive and should be used sparingly.
+     * If possible, it should be buffered for batch processing on sets of call sites.
+     * <p>
+     * If {@code sites} contains a null element,
+     * a {@code NullPointerException} will be raised.
+     * In this case, some non-null elements in the array may be
+     * processed before the method returns abnormally.
+     * Which elements these are (if any) is implementation-dependent.
+     *
+     * <h3>Java Memory Model details</h3>
+     * In terms of the Java Memory Model, this operation performs a synchronization
+     * action which is comparable in effect to the writing of a volatile variable
+     * by the current thread, and an eventual volatile read by every other thread
+     * that may access one of the affected call sites.
+     * <p>
+     * The following effects are apparent, for each individual call site {@code S}:
+     * <ul>
+     * <li>A new volatile variable {@code V} is created, and written by the current thread.
+     *     As defined by the JMM, this write is a global synchronization event.
+     * <li>As is normal with thread-local ordering of write events,
+     *     every action already performed by the current thread is
+     *     taken to happen before the volatile write to {@code V}.
+     *     (In some implementations, this means that the current thread
+     *     performs a global release operation.)
+     * <li>Specifically, the write to the current target of {@code S} is
+     *     taken to happen before the volatile write to {@code V}.
+     * <li>The volatile write to {@code V} is placed
+     *     (in an implementation specific manner)
+     *     in the global synchronization order.
+     * <li>Consider an arbitrary thread {@code T} (other than the current thread).
+     *     If {@code T} executes a synchronization action {@code A}
+     *     after the volatile write to {@code V} (in the global synchronization order),
+     *     it is therefore required to see either the current target
+     *     of {@code S}, or a later write to that target,
+     *     if it executes a read on the target of {@code S}.
+     *     (This constraint is called "synchronization-order consistency".)
+     * <li>The JMM specifically allows optimizing compilers to elide
+     *     reads or writes of variables that are known to be useless.
+     *     Such elided reads and writes have no effect on the happens-before
+     *     relation.  Regardless of this fact, the volatile {@code V}
+     *     will not be elided, even though its written value is
+     *     indeterminate and its read value is not used.
+     * </ul>
+     * Because of the last point, the implementation behaves as if a
+     * volatile read of {@code V} were performed by {@code T}
+     * immediately after its action {@code A}.  In the local ordering
+     * of actions in {@code T}, this read happens before any future
+     * read of the target of {@code S}.  It is as if the
+     * implementation arbitrarily picked a read of {@code S}'s target
+     * by {@code T}, and forced a read of {@code V} to precede it,
+     * thereby ensuring communication of the new target value.
+     * <p>
+     * As long as the constraints of the Java Memory Model are obeyed,
+     * implementations may delay the completion of a {@code syncAll}
+     * operation while other threads ({@code T} above) continue to
+     * use previous values of {@code S}'s target.
+     * However, implementations are (as always) encouraged to avoid
+     * livelock, and to eventually require all threads to take account
+     * of the updated target.
+     *
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * For performance reasons, {@code syncAll} is not a virtual method
+     * on a single call site, but rather applies to a set of call sites.
+     * Some implementations may incur a large fixed overhead cost
+     * for processing one or more synchronization operations,
+     * but a small incremental cost for each additional call site.
+     * In any case, this operation is likely to be costly, since
+     * other threads may have to be somehow interrupted
+     * in order to make them notice the updated target value.
+     * However, it may be observed that a single call to synchronize
+     * several sites has the same formal effect as many calls,
+     * each on just one of the sites.
+     *
+     * <p style="font-size:smaller;">
+     * <em>Implementation Note:</em>
+     * Simple implementations of {@code MutableCallSite} may use
+     * a volatile variable for the target of a mutable call site.
+     * In such an implementation, the {@code syncAll} method can be a no-op,
+     * and yet it will conform to the JMM behavior documented above.
+     *
+     * @param sites an array of call sites to be synchronized
+     * @throws NullPointerException if the {@code sites} array reference is null
+     *                              or the array contains a null
+     */
+    public static void syncAll(MutableCallSite[] sites) {
+        if (sites.length == 0)  return;
+        STORE_BARRIER.lazySet(0);
+        for (int i = 0; i < sites.length; i++) {
+            sites[i].getClass();  // trigger NPE on first null
+        }
+        // FIXME: NYI
+    }
+    private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/SpreadGeneric.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,678 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import sun.invoke.util.ValueConversions;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Generic spread adapter.
+ * Expands a final argument into multiple (zero or more) arguments, keeping the others the same.
+ * @author jrose
+ */
+class SpreadGeneric {
+    // type for the outgoing call
+    private final MethodType targetType;
+    // number of arguments to spread
+    private final int spreadCount;
+    // prototype adapter (clone and customize for each new target!)
+    private final Adapter adapter;
+    // entry point for adapter (Adapter mh, a...) => ...
+    private final MethodHandle entryPoint;
+
+    /** Compute and cache information common to all spreading adapters
+     *  that accept calls of the given (generic) type.
+     */
+    private SpreadGeneric(MethodType targetType, int spreadCount) {
+        assert(targetType == targetType.generic());
+        this.targetType = targetType;
+        this.spreadCount = spreadCount;
+        // the target invoker will generally need casts on reference arguments
+        MethodHandle[] ep = { null };
+        Adapter ad = findAdapter(this, ep);
+        if (ad != null) {
+            this.adapter = ad;
+            this.entryPoint = ep[0];
+            return;
+        }
+        this.adapter = buildAdapterFromBytecodes(targetType, spreadCount, ep);
+        this.entryPoint = ep[0];
+    }
+
+    /** From targetType remove the last spreadCount arguments, and instead
+     *  append a simple Object argument.
+     */
+    static MethodType preSpreadType(MethodType targetType, int spreadCount) {
+        @SuppressWarnings("unchecked")
+        ArrayList<Class<?>> params = new ArrayList(targetType.parameterList());
+        int outargs = params.size();
+        params.subList(outargs - spreadCount, outargs).clear();
+        params.add(Object.class);
+        return MethodType.methodType(targetType.returnType(), params);
+    }
+
+    MethodHandle makeInstance(MethodHandle target) {
+        MethodType type = target.type();
+        if (type != targetType) {
+            throw new UnsupportedOperationException("NYI type="+type);
+        }
+        return adapter.makeInstance(this, target);
+    }
+
+    /** Build an adapter of the given generic type, which invokes typedTarget
+     *  on the incoming arguments, after unboxing as necessary.
+     *  The return value is boxed if necessary.
+     * @param genericType  the required type of the result
+     * @param typedTarget the target
+     * @return an adapter method handle
+     */
+    public static MethodHandle make(MethodHandle target, int spreadCount) {
+        MethodType type = target.type();
+        MethodType gtype = type.generic();
+        if (type == gtype) {
+            return SpreadGeneric.of(type, spreadCount).makeInstance(target);
+        } else {
+            MethodHandle gtarget = FromGeneric.make(target);
+            assert(gtarget.type() == gtype);
+            MethodHandle gspread = SpreadGeneric.of(gtype, spreadCount).makeInstance(gtarget);
+            return ToGeneric.make(preSpreadType(type, spreadCount), gspread);
+        }
+    }
+
+    /** Return the adapter information for this type's erasure. */
+    static SpreadGeneric of(MethodType targetType, int spreadCount) {
+        if (targetType != targetType.generic())
+            throw new UnsupportedOperationException("NYI type="+targetType);
+        MethodTypeForm form = targetType.form();
+        int outcount = form.parameterCount();
+        assert(spreadCount <= outcount);
+        SpreadGeneric[] spreadGens = form.spreadGeneric;
+        if (spreadGens == null)
+            form.spreadGeneric = spreadGens = new SpreadGeneric[outcount+1];
+        SpreadGeneric spreadGen = spreadGens[spreadCount];
+        if (spreadGen == null)
+            spreadGens[spreadCount] = spreadGen = new SpreadGeneric(form.erasedType(), spreadCount);
+        return spreadGen;
+    }
+
+    public String toString() {
+        return getClass().getSimpleName()+targetType+"["+spreadCount+"]";
+    }
+
+    // This mini-api is called from an Adapter to manage the spread.
+    /** A check/coercion that happens once before any selections. */
+    protected Object check(Object av, int n) {
+        checkSpreadArgument(av, n);
+        return av;
+    }
+
+    /** The selection operator for spreading; note that it takes Object not Object[]. */
+    protected Object select(Object av, int n) {
+        return ((Object[])av)[n];
+    }
+    /*
+    protected int select_I(Object av, int n) {
+        // maybe return ((int[])select)[n]
+        throw new UnsupportedOperationException("subclass resp.");
+    }
+    protected int select_J(Object av, int n) {
+        // maybe return ((long[])select)[n]
+        throw new UnsupportedOperationException("subclass resp.");
+    }
+    // */
+
+    /* Create an adapter that handles spreading calls for the given type. */
+    static Adapter findAdapter(SpreadGeneric outer, MethodHandle[] ep) {
+        MethodType targetType = outer.targetType;
+        int spreadCount = outer.spreadCount;
+        int outargs = targetType.parameterCount();
+        int inargs = outargs - spreadCount;
+        if (inargs < 0)  return null;
+        MethodType entryType = MethodType.genericMethodType(inargs + 1); // 1 for av
+        String cname1 = "S" + outargs;
+        String[] cnames = { cname1 };
+        String iname = "invoke_S"+spreadCount;
+        // e.g., D5I2, D5, L5I2, L5; invoke_D5
+        for (String cname : cnames) {
+            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
+            if (acls == null)  continue;
+            // see if it has the required invoke method
+            MethodHandle entryPoint = null;
+            try {
+                entryPoint = IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
+            } catch (ReflectiveOperationException ex) {
+            }
+            if (entryPoint == null)  continue;
+            Constructor<? extends Adapter> ctor = null;
+            try {
+                ctor = acls.getDeclaredConstructor(SpreadGeneric.class);
+            } catch (NoSuchMethodException ex) {
+            } catch (SecurityException ex) {
+            }
+            if (ctor == null)  continue;
+            try {
+                // Produce an instance configured as a prototype.
+                Adapter ad = ctor.newInstance(outer);
+                ep[0] = entryPoint;
+                return ad;
+            } catch (IllegalArgumentException ex) {
+            } catch (InvocationTargetException wex) {
+                Throwable ex = wex.getTargetException();
+                if (ex instanceof Error)  throw (Error)ex;
+                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
+            } catch (InstantiationException ex) {
+            } catch (IllegalAccessException ex) {
+            }
+        }
+        return null;
+    }
+
+    static Adapter buildAdapterFromBytecodes(MethodType targetType,
+            int spreadCount, MethodHandle[] ep) {
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    /**
+     * This adapter takes some untyped arguments, and returns an untyped result.
+     * Internally, it applies the invoker to the target, which causes the
+     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
+     * This result is passed to convert, which is responsible for
+     * converting the raw result into a boxed object.
+     * The invoker is kept separate from the target because it can be
+     * generated once per type erasure family, and reused across adapters.
+     */
+    static abstract class Adapter extends BoundMethodHandle {
+        /*
+         * class X<<R,int M,int N>> extends Adapter {
+         *   (Object**N)=>R target;
+         *   static int S = N-M;
+         *   Object invoke(Object**M a, Object v) = target(a..., v[0]...v[S-1]);
+         * }
+         */
+        protected final SpreadGeneric outer;
+        protected final MethodHandle target;   // (any**N) => R
+
+        @Override
+        public String toString() {
+            return addTypeString(target, this);
+        }
+
+        static final MethodHandle NO_ENTRY = ValueConversions.identity();
+
+        protected boolean isPrototype() { return target == null; }
+        protected Adapter(SpreadGeneric outer) {
+            super(NO_ENTRY);
+            this.outer = outer;
+            this.target = null;
+            assert(isPrototype());
+        }
+
+        protected Adapter(SpreadGeneric outer, MethodHandle target) {
+            super(outer.entryPoint);
+            this.outer = outer;
+            this.target = target;
+        }
+
+        /** Make a copy of self, with new fields. */
+        protected abstract Adapter makeInstance(SpreadGeneric outer, MethodHandle target);
+        // { return new ThisType(outer, target); }
+
+        protected Object check(Object av, int n) {
+            return outer.check(av, n);
+        }
+        protected Object select(Object av, int n) {
+            return outer.select(av, n);
+        }
+
+        static private final String CLASS_PREFIX; // "java.lang.invoke.SpreadGeneric$"
+        static {
+            String aname = Adapter.class.getName();
+            String sname = Adapter.class.getSimpleName();
+            if (!aname.endsWith(sname))  throw new InternalError();
+            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
+        }
+        /** Find a sibing class of Adapter. */
+        static Class<? extends Adapter> findSubClass(String name) {
+            String cname = Adapter.CLASS_PREFIX + name;
+            try {
+                return Class.forName(cname).asSubclass(Adapter.class);
+            } catch (ClassNotFoundException ex) {
+                return null;
+            } catch (ClassCastException ex) {
+                return null;
+            }
+        }
+    }
+
+    /* generated classes follow this pattern:
+    static class xS2 extends Adapter {
+        protected xS2(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected xS2(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected xS2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new xS2(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av,0);
+             return target.invokeExact(a0, a1)); }
+        protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av,1);
+             return target.invokeExact(a0,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av,1);
+             return target.invokeExact(
+                super.select(av,0), super.select(av,1)); }
+    }
+    // */
+
+/*
+: SHELL; n=SpreadGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
+//{{{
+import java.util.*;
+class genclasses {
+    static String[][] TEMPLATES = { {
+        "@for@ N=0..10",
+        "    //@each-cat@",
+        "    static class @cat@ extends Adapter {",
+        "        protected @cat@(SpreadGeneric outer) { super(outer); }  // to build prototype",
+        "        protected @cat@(SpreadGeneric outer, MethodHandle t) { super(outer, t); }",
+        "        protected @cat@ makeInstance(SpreadGeneric outer, MethodHandle t) { return new @cat@(outer, t); }",
+        "        protected Object invoke_S0(@Tvav,@Object av) throws Throwable { av = super.check(av, 0);",
+        "            return target.invokeExact(@av@); }",
+        "        //@each-S@",
+        "        protected Object invoke_S@S@(@Tvav,@Object av) throws Throwable { av = super.check(av, @S@);",
+        "            return target.invokeExact(@av,@@sv@); }",
+        "        //@end-S@",
+        "    }",
+    } };
+    static final String NEWLINE_INDENT = "\n                ";
+    enum VAR {
+        cat, N, S, av, av_, Tvav_, sv;
+        public final String pattern = "@"+toString().replace('_','.')+"@";
+        public String binding = toString();
+        static void makeBindings(boolean topLevel, int outargs, int spread) {
+            int inargs = outargs - spread;
+            VAR.cat.binding = "S"+outargs;
+            VAR.N.binding = String.valueOf(outargs); // outgoing arg count
+            VAR.S.binding = String.valueOf(spread);  // spread count
+            String[] av = new String[inargs];
+            String[] Tvav = new String[inargs];
+            for (int i = 0; i < inargs; i++) {
+                av[i] = arg(i);
+                Tvav[i] = param("Object", av[i]);
+            }
+            VAR.av.binding = comma(av);
+            VAR.av_.binding = comma(av, ", ");
+            VAR.Tvav_.binding = comma(Tvav, ", ");
+            String[] sv = new String[spread];
+            for (int i = 0; i < spread; i++) {
+                String spc = "";
+                if (i % 4 == 0) spc = NEWLINE_INDENT;
+                sv[i] = spc+"super.select(av,"+i+")";
+            }
+            VAR.sv.binding = comma(sv);
+        }
+        static String arg(int i) { return "a"+i; }
+        static String param(String t, String a) { return t+" "+a; }
+        static String comma(String[] v) { return comma(v, ""); }
+        static String comma(String[] v, String sep) {
+            if (v.length == 0)  return "";
+            String res = v[0];
+            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
+            return res + sep;
+        }
+        static String transform(String string) {
+            for (VAR var : values())
+                string = string.replaceAll(var.pattern, var.binding);
+            return string;
+        }
+    }
+    static String[] stringsIn(String[] strings, int beg, int end) {
+        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
+    }
+    static String[] stringsBefore(String[] strings, int pos) {
+        return stringsIn(strings, 0, pos);
+    }
+    static String[] stringsAfter(String[] strings, int pos) {
+        return stringsIn(strings, pos, strings.length);
+    }
+    static int indexAfter(String[] strings, int pos, String tag) {
+        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
+    }
+    static int indexBefore(String[] strings, int pos, String tag) {
+        for (int i = pos, end = strings.length; ; i++) {
+            if (i == end || strings[i].endsWith(tag))  return i;
+        }
+    }
+    static int MIN_ARITY, MAX_ARITY;
+    public static void main(String... av) {
+        for (String[] template : TEMPLATES) {
+            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
+            String[] forLines = stringsBefore(template, forLinesLimit);
+            template = stringsAfter(template, forLinesLimit);
+            for (String forLine : forLines)
+                expandTemplate(forLine, template);
+        }
+    }
+    static void expandTemplate(String forLine, String[] template) {
+        String[] params = forLine.split("[^0-9]+");
+        if (params[0].length() == 0)  params = stringsAfter(params, 1);
+        System.out.println("//params="+Arrays.asList(params));
+        int pcur = 0;
+        MIN_ARITY = Integer.valueOf(params[pcur++]);
+        MAX_ARITY = Integer.valueOf(params[pcur++]);
+        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
+        for (int outargs = MIN_ARITY; outargs <= MAX_ARITY; outargs++) {
+            expandTemplate(template, true, outargs, 0);
+        }
+    }
+    static void expandTemplate(String[] template, boolean topLevel, int outargs, int spread) {
+        VAR.makeBindings(topLevel, outargs, spread);
+        for (int i = 0; i < template.length; i++) {
+            String line = template[i];
+            if (line.endsWith("@each-cat@")) {
+                // ignore
+            } else if (line.endsWith("@each-S@")) {
+                int blockEnd = indexAfter(template, i, "@end-S@");
+                String[] block = stringsIn(template, i+1, blockEnd-1);
+                for (int spread1 = spread+1; spread1 <= outargs; spread1++)
+                    expandTemplate(block, false, outargs, spread1);
+                VAR.makeBindings(topLevel, outargs, spread);
+                i = blockEnd-1; continue;
+            } else {
+                System.out.println(VAR.transform(line));
+            }
+        }
+    }
+}
+//}}} */
+//params=[0, 10]
+    static class S0 extends Adapter {
+        protected S0(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S0(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S0 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S0(outer, t); }
+        protected Object invoke_S0(Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(); }
+    }
+    static class S1 extends Adapter {
+        protected S1(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S1(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S1 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S1(outer, t); }
+        protected Object invoke_S0(Object a0, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0); }
+        protected Object invoke_S1(Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(
+                super.select(av,0)); }
+    }
+    static class S2 extends Adapter {
+        protected S2(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S2(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S2(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1); }
+        protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1)); }
+    }
+    static class S3 extends Adapter {
+        protected S3(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S3(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S3 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S3(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2); }
+        protected Object invoke_S1(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+    }
+    static class S4 extends Adapter {
+        protected S4(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S4(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S4 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S4(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+    }
+    static class S5 extends Adapter {
+        protected S5(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S5(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S5 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S5(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3, a4); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2, a3,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object a0, Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+        protected Object invoke_S5(Object av) throws Throwable { av = super.check(av, 5);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4)); }
+    }
+    static class S6 extends Adapter {
+        protected S6(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S6(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S6 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S6(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2, a3, a4,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1, a2, a3,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+        protected Object invoke_S5(Object a0, Object av) throws Throwable { av = super.check(av, 5);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4)); }
+        protected Object invoke_S6(Object av) throws Throwable { av = super.check(av, 6);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5)); }
+    }
+    static class S7 extends Adapter {
+        protected S7(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S7(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S7 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S7(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1, a2, a3, a4,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0, a1, a2, a3,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+        protected Object invoke_S5(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 5);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4)); }
+        protected Object invoke_S6(Object a0, Object av) throws Throwable { av = super.check(av, 6);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5)); }
+        protected Object invoke_S7(Object av) throws Throwable { av = super.check(av, 7);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6)); }
+    }
+    static class S8 extends Adapter {
+        protected S8(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S8(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S8 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S8(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0, a1, a2, a3, a4,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(a0, a1, a2, a3,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+        protected Object invoke_S5(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 5);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4)); }
+        protected Object invoke_S6(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 6);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5)); }
+        protected Object invoke_S7(Object a0, Object av) throws Throwable { av = super.check(av, 7);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6)); }
+        protected Object invoke_S8(Object av) throws Throwable { av = super.check(av, 8);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
+    }
+    static class S9 extends Adapter {
+        protected S9(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S9(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S9 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S9(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(a0, a1, a2, a3, a4,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+        protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 5);
+            return target.invokeExact(a0, a1, a2, a3,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4)); }
+        protected Object invoke_S6(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 6);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5)); }
+        protected Object invoke_S7(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 7);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6)); }
+        protected Object invoke_S8(Object a0, Object av) throws Throwable { av = super.check(av, 8);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
+        protected Object invoke_S9(Object av) throws Throwable { av = super.check(av, 9);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
+                super.select(av,8)); }
+    }
+    static class S10 extends Adapter {
+        protected S10(SpreadGeneric outer) { super(outer); }  // to build prototype
+        protected S10(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
+        protected S10 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S10(outer, t); }
+        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9, Object av) throws Throwable { av = super.check(av, 0);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 1);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8,
+                super.select(av,0)); }
+        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 2);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7,
+                super.select(av,0), super.select(av,1)); }
+        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 3);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
+                super.select(av,0), super.select(av,1), super.select(av,2)); }
+        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 4);
+            return target.invokeExact(a0, a1, a2, a3, a4, a5,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
+        protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 5);
+            return target.invokeExact(a0, a1, a2, a3, a4,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4)); }
+        protected Object invoke_S6(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 6);
+            return target.invokeExact(a0, a1, a2, a3,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5)); }
+        protected Object invoke_S7(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 7);
+            return target.invokeExact(a0, a1, a2,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6)); }
+        protected Object invoke_S8(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 8);
+            return target.invokeExact(a0, a1,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
+        protected Object invoke_S9(Object a0, Object av) throws Throwable { av = super.check(av, 9);
+            return target.invokeExact(a0,
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
+                super.select(av,8)); }
+        protected Object invoke_S10(Object av) throws Throwable { av = super.check(av, 10);
+            return target.invokeExact(
+                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
+                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
+                super.select(av,8), super.select(av,9)); }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/SwitchPoint.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2010, 2011, 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 java.lang.invoke;
+
+/**
+ * <p>
+ * A {@code SwitchPoint} is an object which can publish state transitions to other threads.
+ * A switch point is initially in the <em>valid</em> state, but may at any time be
+ * changed to the <em>invalid</em> state.  Invalidation cannot be reversed.
+ * A switch point can combine a <em>guarded pair</em> of method handles into a
+ * <em>guarded delegator</em>.
+ * The guarded delegator is a method handle which delegates to one of the old method handles.
+ * The state of the switch point determines which of the two gets the delegation.
+ * <p>
+ * A single switch point may be used to control any number of method handles.
+ * (Indirectly, therefore, it can control any number of call sites.)
+ * This is done by using the single switch point as a factory for combining
+ * any number of guarded method handle pairs into guarded delegators.
+ * <p>
+ * When a guarded delegator is created from a guarded pair, the pair
+ * is wrapped in a new method handle {@code M},
+ * which is permanently associated with the switch point that created it.
+ * Each pair consists of a target {@code T} and a fallback {@code F}.
+ * While the switch point is valid, invocations to {@code M} are delegated to {@code T}.
+ * After it is invalidated, invocations are delegated to {@code F}.
+ * <p>
+ * Invalidation is global and immediate, as if the switch point contained a
+ * volatile boolean variable consulted on every call to {@code M}.
+ * The invalidation is also permanent, which means the switch point
+ * can change state only once.
+ * The switch point will always delegate to {@code F} after being invalidated.
+ * At that point {@code guardWithTest} may ignore {@code T} and return {@code F}.
+ * <p>
+ * Here is an example of a switch point in action:
+ * <blockquote><pre>
+MethodType MT_str2 = MethodType.methodType(String.class, String.class);
+MethodHandle MH_strcat = MethodHandles.lookup()
+    .findVirtual(String.class, "concat", MT_str2);
+SwitchPoint spt = new SwitchPoint();
+// the following steps may be repeated to re-use the same switch point:
+MethodHandle worker1 = strcat;
+MethodHandle worker2 = MethodHandles.permuteArguments(strcat, MT_str2, 1, 0);
+MethodHandle worker = spt.guardWithTest(worker1, worker2);
+assertEquals("method", (String) worker.invokeExact("met", "hod"));
+SwitchPoint.invalidateAll(new SwitchPoint[]{ spt });
+assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
+ * </pre></blockquote>
+ * <p style="font-size:smaller;">
+ * <em>Discussion:</em>
+ * Switch points are useful without subclassing.  They may also be subclassed.
+ * This may be useful in order to associate application-specific invalidation logic
+ * with the switch point.
+ * Notice that there is no permanent association between a switch point and
+ * the method handles it produces and consumes.
+ * The garbage collector may collect method handles produced or consumed
+ * by a switch point independently of the lifetime of the switch point itself.
+ * <p style="font-size:smaller;">
+ * <em>Implementation Note:</em>
+ * A switch point behaves as if implemented on top of {@link MutableCallSite},
+ * approximately as follows:
+ * <blockquote><pre>
+public class SwitchPoint {
+  private static final MethodHandle
+    K_true  = MethodHandles.constant(boolean.class, true),
+    K_false = MethodHandles.constant(boolean.class, false);
+  private final MutableCallSite mcs;
+  private final MethodHandle mcsInvoker;
+  public SwitchPoint() {
+    this.mcs = new MutableCallSite(K_true);
+    this.mcsInvoker = mcs.dynamicInvoker();
+  }
+  public MethodHandle guardWithTest(
+                MethodHandle target, MethodHandle fallback) {
+    // Note:  mcsInvoker is of type ()boolean.
+    // Target and fallback may take any arguments, but must have the same type.
+    return MethodHandles.guardWithTest(this.mcsInvoker, target, fallback);
+  }
+  public static void invalidateAll(SwitchPoint[] spts) {
+    List&lt;MutableCallSite&gt; mcss = new ArrayList&lt;&gt;();
+    for (SwitchPoint spt : spts)  mcss.add(spt.mcs);
+    for (MutableCallSite mcs : mcss)  mcs.setTarget(K_false);
+    MutableCallSite.syncAll(mcss.toArray(new MutableCallSite[0]));
+  }
+}
+ * </pre></blockquote>
+ * @author Remi Forax, JSR 292 EG
+ */
+public class SwitchPoint {
+    private static final MethodHandle
+        K_true  = MethodHandles.constant(boolean.class, true),
+        K_false = MethodHandles.constant(boolean.class, false);
+
+    private final MutableCallSite mcs;
+    private final MethodHandle mcsInvoker;
+
+    /**
+     * Creates a new switch point.
+     */
+    public SwitchPoint() {
+        this.mcs = new MutableCallSite(K_true);
+        this.mcsInvoker = mcs.dynamicInvoker();
+    }
+
+    /**
+     * Returns a method handle which always delegates either to the target or the fallback.
+     * The method handle will delegate to the target exactly as long as the switch point is valid.
+     * After that, it will permanently delegate to the fallback.
+     * <p>
+     * The target and fallback must be of exactly the same method type,
+     * and the resulting combined method handle will also be of this type.
+     *
+     * @param target the method handle selected by the switch point as long as it is valid
+     * @param fallback the method handle selected by the switch point after it is invalidated
+     * @return a combined method handle which always calls either the target or fallback
+     * @throws NullPointerException if either argument is null
+     * @see MethodHandles#guardWithTest
+     */
+    public MethodHandle guardWithTest(MethodHandle target, MethodHandle fallback) {
+        if (mcs.getTarget() == K_false)
+            return fallback;  // already invalid
+        return MethodHandles.guardWithTest(mcsInvoker, target, fallback);
+    }
+
+    /**
+     * Sets all of the given switch points into the invalid state.
+     * After this call executes, no thread will observe any of the
+     * switch points to be in a valid state.
+     * <p>
+     * This operation is likely to be expensive and should be used sparingly.
+     * If possible, it should be buffered for batch processing on sets of switch points.
+     * <p>
+     * If {@code switchPoints} contains a null element,
+     * a {@code NullPointerException} will be raised.
+     * In this case, some non-null elements in the array may be
+     * processed before the method returns abnormally.
+     * Which elements these are (if any) is implementation-dependent.
+     *
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * For performance reasons, {@code invalidateAll} is not a virtual method
+     * on a single switch point, but rather applies to a set of switch points.
+     * Some implementations may incur a large fixed overhead cost
+     * for processing one or more invalidation operations,
+     * but a small incremental cost for each additional invalidation.
+     * In any case, this operation is likely to be costly, since
+     * other threads may have to be somehow interrupted
+     * in order to make them notice the updated switch point state.
+     * However, it may be observed that a single call to invalidate
+     * several switch points has the same formal effect as many calls,
+     * each on just one of the switch points.
+     *
+     * <p style="font-size:smaller;">
+     * <em>Implementation Note:</em>
+     * Simple implementations of {@code SwitchPoint} may use
+     * a private {@link MutableCallSite} to publish the state of a switch point.
+     * In such an implementation, the {@code invalidateAll} method can
+     * simply change the call site's target, and issue one call to
+     * {@linkplain MutableCallSite#syncAll synchronize} all the
+     * private call sites.
+     *
+     * @param switchPoints an array of call sites to be synchronized
+     * @throws NullPointerException if the {@code switchPoints} array reference is null
+     *                              or the array contains a null
+     */
+    public static void invalidateAll(SwitchPoint[] switchPoints) {
+        if (switchPoints.length == 0)  return;
+        MutableCallSite[] sites = new MutableCallSite[switchPoints.length];
+        for (int i = 0; i < switchPoints.length; i++) {
+            SwitchPoint spt = switchPoints[i];
+            if (spt == null)  break;  // MSC.syncAll will trigger a NPE
+            sites[i] = spt.mcs;
+            spt.mcs.setTarget(K_false);
+        }
+        MutableCallSite.syncAll(sites);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/ToGeneric.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,1062 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+
+/**
+ * Adapters which mediate between incoming calls which are not generic
+ * and outgoing calls which are.  Any call can be represented generically
+ * boxing up its arguments, and (on return) unboxing the return value.
+ * <p>
+ * A call is "generic" (in MethodHandle terms) if its MethodType features
+ * only Object arguments.  A non-generic call therefore features
+ * primitives and/or reference types other than Object.
+ * An adapter has types for its incoming and outgoing calls.
+ * The incoming call type is simply determined by the adapter's type
+ * (the MethodType it presents to callers).  The outgoing call type
+ * is determined by the adapter's target (a MethodHandle that the adapter
+ * either binds internally or else takes as a leading argument).
+ * (To stretch the term, adapter-like method handles may have multiple
+ * targets or be polymorphic across multiple call types.)
+ * @author jrose
+ */
+class ToGeneric {
+    // type for the incoming call (may be erased)
+    private final MethodType entryType;
+    // incoming type with primitives moved to the end and turned to int/long
+    private final MethodType rawEntryType;
+    // adapter for the erased type
+    private final Adapter adapter;
+    // entry point for adapter (Adapter mh, a...) => ...
+    private final MethodHandle entryPoint;
+    // permutation of arguments for primsAtEndType
+    private final int[] primsAtEndOrder;
+    // optional final argument list conversions (at least, invokes the target)
+    private final MethodHandle invoker;
+    // conversion which unboxes a primitive return value
+    private final MethodHandle returnConversion;
+
+    /** Compute and cache information common to all generifying (boxing) adapters
+     *  that implement members of the erasure-family of the given erased type.
+     */
+    private ToGeneric(MethodType entryType) {
+        assert(entryType.erase() == entryType); // for now
+        // incoming call will first "forget" all reference types except Object
+        this.entryType = entryType;
+        MethodHandle invoker0 = entryType.generic().invokers().exactInvoker();
+        MethodType rawEntryTypeInit;
+        Adapter ad = findAdapter(rawEntryTypeInit = entryType);
+        if (ad != null) {
+            // Immediate hit to exactly the adapter we want,
+            // with no monkeying around with primitive types.
+            this.returnConversion = computeReturnConversion(entryType, rawEntryTypeInit, false);
+            this.rawEntryType = rawEntryTypeInit;
+            this.adapter = ad;
+            this.entryPoint = ad.prototypeEntryPoint();
+            this.primsAtEndOrder = null;
+            this.invoker = invoker0;
+            return;
+        }
+
+        // next, it will reorder primitives after references
+        MethodType primsAtEnd = entryType.form().primsAtEnd();
+        // at the same time, it will "forget" all primitive types except int/long
+        this.primsAtEndOrder = MethodTypeForm.primsAtEndOrder(entryType);
+        if (primsAtEndOrder != null) {
+            // reordering is required; build on top of a simpler ToGeneric
+            ToGeneric va2 = ToGeneric.of(primsAtEnd);
+            this.adapter = va2.adapter;
+            if (true) throw new UnsupportedOperationException("NYI: primitive parameters must follow references; entryType = "+entryType);
+            this.entryPoint = MethodHandleImpl.convertArguments(
+                    va2.entryPoint, primsAtEnd, entryType, primsAtEndOrder);
+            // example: for entryType of (int,Object,Object), the reordered
+            // type is (Object,Object,int) and the order is {1,2,0},
+            // and putPAE is (mh,int0,obj1,obj2) => mh.invokeExact(obj1,obj2,int0)
+            return;
+        }
+
+        // after any needed argument reordering, it will reinterpret
+        // primitive arguments according to their "raw" types int/long
+        MethodType intsAtEnd = primsAtEnd.form().primsAsInts();
+        ad = findAdapter(rawEntryTypeInit = intsAtEnd);
+        MethodHandle rawEntryPoint;
+        if (ad != null) {
+            rawEntryPoint = ad.prototypeEntryPoint();
+        } else {
+            // Perhaps the adapter is available only for longs.
+            // If so, we can use it, but there will have to be a little
+            // more stack motion on each call.
+            MethodType longsAtEnd = primsAtEnd.form().primsAsLongs();
+            ad = findAdapter(rawEntryTypeInit = longsAtEnd);
+            if (ad != null) {
+                MethodType eptWithLongs = longsAtEnd.insertParameterTypes(0, ad.getClass());
+                MethodType eptWithInts  =  intsAtEnd.insertParameterTypes(0, ad.getClass());
+                rawEntryPoint = ad.prototypeEntryPoint();
+                MethodType midType = eptWithLongs;  // will change longs to ints
+                for (int i = 0, nargs = midType.parameterCount(); i < nargs; i++) {
+                    if (midType.parameterType(i) != eptWithInts.parameterType(i)) {
+                        assert(midType.parameterType(i) == long.class);
+                        assert(eptWithInts.parameterType(i) == int.class);
+                        MethodType nextType = midType.changeParameterType(i, int.class);
+                        rawEntryPoint = MethodHandleImpl.convertArguments(
+                                rawEntryPoint, nextType, midType, null);
+                        midType = nextType;
+                    }
+                }
+                assert(midType == eptWithInts);
+            } else {
+                // If there is no statically compiled adapter,
+                // build one by means of dynamic bytecode generation.
+                ad = buildAdapterFromBytecodes(rawEntryTypeInit = intsAtEnd);
+                rawEntryPoint = ad.prototypeEntryPoint();
+            }
+        }
+        MethodType tepType = entryType.insertParameterTypes(0, ad.getClass());
+        this.entryPoint =
+            AdapterMethodHandle.makeRetypeRaw(tepType, rawEntryPoint);
+        if (this.entryPoint == null)
+            throw new UnsupportedOperationException("cannot retype to "+entryType
+                    +" from "+rawEntryPoint.type().dropParameterTypes(0, 1));
+        this.returnConversion = computeReturnConversion(entryType, rawEntryTypeInit, false);
+        this.rawEntryType = rawEntryTypeInit;
+        this.adapter = ad;
+        this.invoker = makeRawArgumentFilter(invoker0, rawEntryTypeInit, entryType);
+    }
+
+    /** A generic argument list will be created by a call of type 'raw'.
+     *  The values need to be reboxed for to match 'cooked'.
+     *  Do this on the fly.
+     */
+    // TO DO: Use a generic argument converter in a different file
+    static MethodHandle makeRawArgumentFilter(MethodHandle invoker,
+            MethodType raw, MethodType cooked) {
+        MethodHandle filteredInvoker = null;
+        for (int i = 0, nargs = raw.parameterCount(); i < nargs; i++) {
+            Class<?> src = raw.parameterType(i);
+            Class<?> dst = cooked.parameterType(i);
+            if (src == dst)  continue;
+            assert(src.isPrimitive() && dst.isPrimitive());
+            if (filteredInvoker == null) {
+                filteredInvoker =
+                        AdapterMethodHandle.makeCheckCast(
+                            invoker.type().generic(), invoker, 0, MethodHandle.class);
+                if (filteredInvoker == null)  throw new UnsupportedOperationException("NYI");
+            }
+            MethodHandle reboxer = ValueConversions.rebox(dst, false);
+            filteredInvoker = FilterGeneric.makeArgumentFilter(1+i, reboxer, filteredInvoker);
+            if (filteredInvoker == null)  throw new InternalError();
+        }
+        if (filteredInvoker == null)  return invoker;
+        return AdapterMethodHandle.makeRetypeOnly(invoker.type(), filteredInvoker);
+    }
+
+    /**
+     * Caller will be expecting a result from a call to {@code type},
+     * while the internal adapter entry point is rawEntryType.
+     * Also, the internal target method will be returning a boxed value,
+     * as an untyped object.
+     * <p>
+     * Produce a value converter which will be typed to convert from
+     * {@code Object} to the return value of {@code rawEntryType}, and will
+     * in fact ensure that the value is compatible with the return type of
+     * {@code type}.
+     */
+    private static MethodHandle computeReturnConversion(
+            MethodType type, MethodType rawEntryType, boolean mustCast) {
+        Class<?> tret = type.returnType();
+        Class<?> rret = rawEntryType.returnType();
+        if (mustCast || !tret.isPrimitive()) {
+            assert(!tret.isPrimitive());
+            assert(!rret.isPrimitive());
+            if (rret == Object.class && !mustCast)
+                return null;
+            return ValueConversions.cast(tret, false);
+        } else if (tret == rret) {
+            return ValueConversions.unbox(tret, false);
+        } else {
+            assert(rret.isPrimitive());
+            assert(tret == double.class ? rret == long.class : rret == int.class);
+            return ValueConversions.unboxRaw(tret, false);
+        }
+    }
+
+    Adapter makeInstance(MethodType type, MethodHandle genericTarget) {
+        genericTarget.getClass();  // check for NPE
+        MethodHandle convert = returnConversion;
+        if (primsAtEndOrder != null)
+            // reorder arguments passed to genericTarget, if primsAtEndOrder
+            throw new UnsupportedOperationException("NYI");
+        if (type == entryType) {
+            if (convert == null)  convert = ValueConversions.identity();
+            return adapter.makeInstance(entryPoint, invoker, convert, genericTarget);
+        }
+        // my erased-type is not exactly the same as the desired type
+        assert(type.erase() == entryType);  // else we are busted
+        if (convert == null)
+            convert = computeReturnConversion(type, rawEntryType, true);
+        // retype erased reference arguments (the cast makes it safe to do this)
+        MethodType tepType = type.insertParameterTypes(0, adapter.getClass());
+        MethodHandle typedEntryPoint =
+            AdapterMethodHandle.makeRetypeRaw(tepType, entryPoint);
+        return adapter.makeInstance(typedEntryPoint, invoker, convert, genericTarget);
+    }
+
+    /** Build an adapter of the given type, which invokes genericTarget
+     *  on the incoming arguments, after boxing as necessary.
+     *  The return value is unboxed if necessary.
+     * @param type  the required type of the
+     * @param genericTarget the target, which must accept and return only Object values
+     * @return an adapter method handle
+     */
+    public static MethodHandle make(MethodType type, MethodHandle genericTarget) {
+        MethodType gtype = genericTarget.type();
+        if (type.generic() != gtype)
+            throw newIllegalArgumentException("type must be generic");
+        if (type == gtype)  return genericTarget;
+        return ToGeneric.of(type).makeInstance(type, genericTarget);
+    }
+
+    /** Return the adapter information for this type's erasure. */
+    static ToGeneric of(MethodType type) {
+        MethodTypeForm form = type.form();
+        ToGeneric toGen = form.toGeneric;
+        if (toGen == null)
+            form.toGeneric = toGen = new ToGeneric(form.erasedType());
+        return toGen;
+    }
+
+    public String toString() {
+        return "ToGeneric"+entryType
+                +(primsAtEndOrder!=null?"[reorder]":"");
+    }
+
+    /* Create an adapter for the given incoming call type. */
+    static Adapter findAdapter(MethodType entryPointType) {
+        MethodTypeForm form = entryPointType.form();
+        Class<?> rtype = entryPointType.returnType();
+        int argc = form.parameterCount();
+        int lac = form.longPrimitiveParameterCount();
+        int iac = form.primitiveParameterCount() - lac;
+        String intsAndLongs = (iac > 0 ? "I"+iac : "")+(lac > 0 ? "J"+lac : "");
+        String rawReturn = String.valueOf(Wrapper.forPrimitiveType(rtype).basicTypeChar());
+        String iname0 = "invoke_"+rawReturn;
+        String iname1 = "invoke";
+        String[] inames = { iname0, iname1 };
+        String cname0 = rawReturn + argc;
+        String cname1 = "A"       + argc;
+        String[] cnames = { cname1, cname1+intsAndLongs, cname0, cname0+intsAndLongs };
+        // e.g., D5I2, D5, L5I2, L5
+        for (String cname : cnames) {
+            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
+            if (acls == null)  continue;
+            // see if it has the required invoke method
+            for (String iname : inames) {
+                MethodHandle entryPoint = null;
+                try {
+                    entryPoint = IMPL_LOOKUP.
+                                    findSpecial(acls, iname, entryPointType, acls);
+                } catch (ReflectiveOperationException ex) {
+                }
+                if (entryPoint == null)  continue;
+                Constructor<? extends Adapter> ctor = null;
+                try {
+                    // Prototype builder:
+                    ctor = acls.getDeclaredConstructor(MethodHandle.class);
+                } catch (NoSuchMethodException ex) {
+                } catch (SecurityException ex) {
+                }
+                if (ctor == null)  continue;
+                try {
+                    return ctor.newInstance(entryPoint);
+                } catch (IllegalArgumentException ex) {
+                } catch (InvocationTargetException wex) {
+                    Throwable ex = wex.getTargetException();
+                    if (ex instanceof Error)  throw (Error)ex;
+                    if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
+                } catch (InstantiationException ex) {
+                } catch (IllegalAccessException ex) {
+                }
+            }
+        }
+        return null;
+    }
+
+    static Adapter buildAdapterFromBytecodes(MethodType entryPointType) {
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    /**
+     * The invoke method takes some particular but unconstrained spread
+     * of raw argument types, and returns a raw return type (in L/I/J/F/D).
+     * Internally, it converts the incoming arguments uniformly into objects.
+     * This series of objects is then passed to the {@code target} method,
+     * which returns a result object.  This result is finally converted,
+     * via another method handle {@code convert}, which is responsible for
+     * converting the object result into the raw return value.
+     */
+    static abstract class Adapter extends BoundMethodHandle {
+        /*
+         * class X<<R,A...>> extends Adapter {
+         *   Object...=>Object target;
+         *   Object=>R convert;
+         *   R invoke(A... a...) = convert(invoker(target, a...)))
+         * }
+         */
+        protected final MethodHandle invoker;  // (MH, Object...) -> Object
+        protected final MethodHandle target;   // Object... -> Object
+        protected final MethodHandle convert;  // Object -> R
+
+        @Override
+        public String toString() {
+            return target == null ? "prototype:"+convert : addTypeString(target, this);
+        }
+
+        protected boolean isPrototype() { return target == null; }
+        /* Prototype constructor. */
+        protected Adapter(MethodHandle entryPoint) {
+            super(entryPoint);
+            this.invoker = null;
+            this.convert = entryPoint;
+            this.target = null;
+            assert(isPrototype());
+        }
+        protected MethodHandle prototypeEntryPoint() {
+            if (!isPrototype())  throw new InternalError();
+            return convert;
+        }
+
+        protected Adapter(MethodHandle entryPoint, MethodHandle invoker, MethodHandle convert, MethodHandle target) {
+            super(entryPoint);
+            this.invoker = invoker;
+            this.convert = convert;
+            this.target = target;
+        }
+
+        /** Make a copy of self, with new fields. */
+        protected abstract Adapter makeInstance(MethodHandle entryPoint,
+                MethodHandle invoker, MethodHandle convert, MethodHandle target);
+        // { return new ThisType(entryPoint, convert, target); }
+
+        // Code to run when the arguments (<= 4) have all been boxed.
+        protected Object target()               throws Throwable { return invoker.invokeExact(target); }
+        protected Object target(Object a0)      throws Throwable { return invoker.invokeExact(target, a0); }
+        protected Object target(Object a0, Object a1)
+                                                throws Throwable { return invoker.invokeExact(target, a0, a1); }
+        protected Object target(Object a0, Object a1, Object a2)
+                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3)
+                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3); }
+        /*
+        protected Object target_0(Object... av) throws Throwable { return invoker.invokeExact(target, av); }
+        protected Object target_1(Object a0, Object... av)
+                                                throws Throwable { return invoker.invokeExact(target, a0, (Object)av); }
+        protected Object target_2(Object a0, Object a1, Object... av)
+                                                throws Throwable { return invoker.invokeExact(target, a0, a1, (Object)av); }
+        protected Object target_3(Object a0, Object a1, Object a2, Object... av)
+                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2, (Object)av); }
+        protected Object target_4(Object a0, Object a1, Object a2, Object a3, Object... av)
+                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, (Object)av); }
+        // */
+        // (For more than 4 arguments, generate the code in the adapter itself.)
+
+        // Code to run when the generic target has finished and produced a value.
+        protected Object return_L(Object res) throws Throwable { return (Object)convert.invokeExact(res); }
+        protected int    return_I(Object res) throws Throwable { return (int)   convert.invokeExact(res); }
+        protected long   return_J(Object res) throws Throwable { return (long)  convert.invokeExact(res); }
+        protected float  return_F(Object res) throws Throwable { return (float) convert.invokeExact(res); }
+        protected double return_D(Object res) throws Throwable { return (double)convert.invokeExact(res); }
+
+        static private final String CLASS_PREFIX; // "java.lang.invoke.ToGeneric$"
+        static {
+            String aname = Adapter.class.getName();
+            String sname = Adapter.class.getSimpleName();
+            if (!aname.endsWith(sname))  throw new InternalError();
+            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
+        }
+        /** Find a sibing class of Adapter. */
+        static Class<? extends Adapter> findSubClass(String name) {
+            String cname = Adapter.CLASS_PREFIX + name;
+            try {
+                return Class.forName(cname).asSubclass(Adapter.class);
+            } catch (ClassNotFoundException ex) {
+                return null;
+            } catch (ClassCastException ex) {
+                return null;
+            }
+        }
+    }
+
+    /* generated classes follow this pattern:
+    static class A1 extends Adapter {
+        protected A1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); }
+        protected Object target(Object a0)   throws Throwable { return invoker.invokeExact(target, a0); }
+        protected Object targetA1(Object a0) throws Throwable { return target(a0); }
+        protected Object targetA1(int    a0) throws Throwable { return target(a0); }
+        protected Object targetA1(long   a0) throws Throwable { return target(a0); }
+        protected Object invoke_L(Object a0) throws Throwable { return return_L(targetA1(a0)); }
+        protected int    invoke_I(Object a0) throws Throwable { return return_I(targetA1(a0)); }
+        protected long   invoke_J(Object a0) throws Throwable { return return_J(targetA1(a0)); }
+        protected float  invoke_F(Object a0) throws Throwable { return return_F(targetA1(a0)); }
+        protected double invoke_D(Object a0) throws Throwable { return return_D(targetA1(a0)); }
+        protected Object invoke_L(int    a0) throws Throwable { return return_L(targetA1(a0)); }
+        protected int    invoke_I(int    a0) throws Throwable { return return_I(targetA1(a0)); }
+        protected long   invoke_J(int    a0) throws Throwable { return return_J(targetA1(a0)); }
+        protected float  invoke_F(int    a0) throws Throwable { return return_F(targetA1(a0)); }
+        protected double invoke_D(int    a0) throws Throwable { return return_D(targetA1(a0)); }
+        protected Object invoke_L(long   a0) throws Throwable { return return_L(targetA1(a0)); }
+        protected int    invoke_I(long   a0) throws Throwable { return return_I(targetA1(a0)); }
+        protected long   invoke_J(long   a0) throws Throwable { return return_J(targetA1(a0)); }
+        protected float  invoke_F(long   a0) throws Throwable { return return_F(targetA1(a0)); }
+        protected double invoke_D(long   a0) throws Throwable { return return_D(targetA1(a0)); }
+    }
+    // */
+
+/*
+: SHELL; n=ToGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
+//{{{
+import java.util.*;
+class genclasses {
+    static String[] TYPES = { "Object", "int   ", "long  ", "float ", "double" };
+    static String[] TCHARS = { "L",     "I",      "J",      "F",      "D",     "A" };
+    static String[][] TEMPLATES = { {
+        "@for@ arity=0..3   rcat<=4 nrefs<=99 nints<=99 nlongs<=99",
+        "@for@ arity=4..4   rcat<=4 nrefs<=99 nints<=99 nlongs<=99",
+        "@for@ arity=5..5   rcat<=2 nrefs<=99 nints<=99 nlongs<=99",
+        "@for@ arity=6..10  rcat<=2 nrefs<=99 nints=0   nlongs<=99",
+        "    //@each-cat@",
+        "    static class @cat@ extends Adapter {",
+        "        protected @cat@(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype",
+        "        protected @cat@(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }",
+        "        protected @cat@ makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new @cat@(e, i, c, t); }",
+        "        protected Object target(@Ovav@)   throws Throwable { return invoker.invokeExact(target@comma@@av@); }",
+        "        //@each-Tv@",
+        "        protected Object target@cat@(@Tvav@) throws Throwable { return target(@av@); }",
+        "        //@end-Tv@",
+        "        //@each-Tv@",
+        "        //@each-R@",
+        "        protected @R@ invoke_@Rc@(@Tvav@) throws Throwable { return return_@Rc@(target@cat@(@av@)); }",
+        "        //@end-R@",
+        "        //@end-Tv@",
+        "    }",
+    } };
+    enum VAR {
+        cat, R, Rc, Tv, av, comma, Tvav, Ovav;
+        public final String pattern = "@"+toString().replace('_','.')+"@";
+        public String binding;
+        static void makeBindings(boolean topLevel, int rcat, int nrefs, int nints, int nlongs) {
+            int nargs = nrefs + nints + nlongs;
+            if (topLevel)
+                VAR.cat.binding = catstr(ALL_RETURN_TYPES ? TYPES.length : rcat, nrefs, nints, nlongs);
+            VAR.R.binding = TYPES[rcat];
+            VAR.Rc.binding = TCHARS[rcat];
+            String[] Tv = new String[nargs];
+            String[] av = new String[nargs];
+            String[] Tvav = new String[nargs];
+            String[] Ovav = new String[nargs];
+            for (int i = 0; i < nargs; i++) {
+                int tcat = (i < nrefs) ? 0 : (i < nrefs + nints) ? 1 : 2;
+                Tv[i] = TYPES[tcat];
+                av[i] = arg(i);
+                Tvav[i] = param(Tv[i], av[i]);
+                Ovav[i] = param("Object", av[i]);
+            }
+            VAR.Tv.binding = comma(Tv);
+            VAR.av.binding = comma(av);
+            VAR.comma.binding = (av.length == 0 ? "" : ", ");
+            VAR.Tvav.binding = comma(Tvav);
+            VAR.Ovav.binding = comma(Ovav);
+        }
+        static String arg(int i) { return "a"+i; }
+        static String param(String t, String a) { return t+" "+a; }
+        static String comma(String[] v) { return comma("", v); }
+        static String comma(String sep, String[] v) {
+            if (v.length == 0)  return "";
+            String res = sep+v[0];
+            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
+            return res;
+        }
+        static String transform(String string) {
+            for (VAR var : values())
+                string = string.replaceAll(var.pattern, var.binding);
+            return string;
+        }
+    }
+    static String[] stringsIn(String[] strings, int beg, int end) {
+        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
+    }
+    static String[] stringsBefore(String[] strings, int pos) {
+        return stringsIn(strings, 0, pos);
+    }
+    static String[] stringsAfter(String[] strings, int pos) {
+        return stringsIn(strings, pos, strings.length);
+    }
+    static int indexAfter(String[] strings, int pos, String tag) {
+        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
+    }
+    static int indexBefore(String[] strings, int pos, String tag) {
+        for (int i = pos, end = strings.length; ; i++) {
+            if (i == end || strings[i].endsWith(tag))  return i;
+        }
+    }
+    static int MIN_ARITY, MAX_ARITY, MAX_RCAT, MAX_REFS, MAX_INTS, MAX_LONGS;
+    static boolean ALL_ARG_TYPES, ALL_RETURN_TYPES;
+    static HashSet<String> done = new HashSet<String>();
+    public static void main(String... av) {
+        for (String[] template : TEMPLATES) {
+            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
+            String[] forLines = stringsBefore(template, forLinesLimit);
+            template = stringsAfter(template, forLinesLimit);
+            for (String forLine : forLines)
+                expandTemplate(forLine, template);
+        }
+    }
+    static void expandTemplate(String forLine, String[] template) {
+        String[] params = forLine.split("[^0-9]+");
+        if (params[0].length() == 0)  params = stringsAfter(params, 1);
+        System.out.println("//params="+Arrays.asList(params));
+        int pcur = 0;
+        MIN_ARITY = Integer.valueOf(params[pcur++]);
+        MAX_ARITY = Integer.valueOf(params[pcur++]);
+        MAX_RCAT  = Integer.valueOf(params[pcur++]);
+        MAX_REFS  = Integer.valueOf(params[pcur++]);
+        MAX_INTS  = Integer.valueOf(params[pcur++]);
+        MAX_LONGS = Integer.valueOf(params[pcur++]);
+        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
+        if (MAX_RCAT >= TYPES.length)  MAX_RCAT = TYPES.length - 1;
+        ALL_ARG_TYPES = (indexBefore(template, 0, "@each-Tv@") < template.length);
+        ALL_RETURN_TYPES = (indexBefore(template, 0, "@each-R@") < template.length);
+        for (int nargs = MIN_ARITY; nargs <= MAX_ARITY; nargs++) {
+            for (int rcat = 0; rcat <= MAX_RCAT; rcat++) {
+                expandTemplate(template, true, rcat, nargs, 0, 0);
+                if (ALL_ARG_TYPES)  break;
+                expandTemplateForPrims(template, true, rcat, nargs, 1, 1);
+                if (ALL_RETURN_TYPES)  break;
+            }
+        }
+    }
+    static String catstr(int rcat, int nrefs, int nints, int nlongs) {
+        int nargs = nrefs + nints + nlongs;
+        String cat = TCHARS[rcat] + nargs;
+        if (!ALL_ARG_TYPES)  cat += (nints==0?"":"I"+nints)+(nlongs==0?"":"J"+nlongs);
+        return cat;
+    }
+    static void expandTemplateForPrims(String[] template, boolean topLevel, int rcat, int nargs, int minints, int minlongs) {
+        for (int isLong = 0; isLong <= 1; isLong++) {
+            for (int nprims = 1; nprims <= nargs; nprims++) {
+                int nrefs = nargs - nprims;
+                int nints = ((1-isLong) * nprims);
+                int nlongs = (isLong * nprims);
+                expandTemplate(template, topLevel, rcat, nrefs, nints, nlongs);
+            }
+        }
+    }
+    static void expandTemplate(String[] template, boolean topLevel,
+                               int rcat, int nrefs, int nints, int nlongs) {
+        int nargs = nrefs + nints + nlongs;
+        if (nrefs > MAX_REFS || nints > MAX_INTS || nlongs > MAX_LONGS)  return;
+        VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
+        if (topLevel && !done.add(VAR.cat.binding)) {
+            System.out.println("    //repeat "+VAR.cat.binding);
+            return;
+        }
+        for (int i = 0; i < template.length; i++) {
+            String line = template[i];
+            if (line.endsWith("@each-cat@")) {
+                // ignore
+            } else if (line.endsWith("@each-R@")) {
+                int blockEnd = indexAfter(template, i, "@end-R@");
+                String[] block = stringsIn(template, i+1, blockEnd-1);
+                for (int rcat1 = rcat; rcat1 <= MAX_RCAT; rcat1++)
+                    expandTemplate(block, false, rcat1, nrefs, nints, nlongs);
+                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
+                i = blockEnd-1; continue;
+            } else if (line.endsWith("@each-Tv@")) {
+                int blockEnd = indexAfter(template, i, "@end-Tv@");
+                String[] block = stringsIn(template, i+1, blockEnd-1);
+                expandTemplate(block, false, rcat, nrefs, nints, nlongs);
+                expandTemplateForPrims(block, false, rcat, nargs, nints+1, nlongs+1);
+                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
+                i = blockEnd-1; continue;
+            } else {
+                System.out.println(VAR.transform(line));
+            }
+        }
+    }
+}
+//}}} */
+//params=[0, 3, 4, 99, 99, 99]
+    static class A0 extends Adapter {
+        protected A0(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A0(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A0 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A0(e, i, c, t); }
+        protected Object target()   throws Throwable { return invoker.invokeExact(target); }
+        protected Object targetA0() throws Throwable { return target(); }
+        protected Object invoke_L() throws Throwable { return return_L(targetA0()); }
+        protected int    invoke_I() throws Throwable { return return_I(targetA0()); }
+        protected long   invoke_J() throws Throwable { return return_J(targetA0()); }
+        protected float  invoke_F() throws Throwable { return return_F(targetA0()); }
+        protected double invoke_D() throws Throwable { return return_D(targetA0()); }
+    }
+    static class A1 extends Adapter {
+        protected A1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); }
+        protected Object target(Object a0)   throws Throwable { return invoker.invokeExact(target, a0); }
+        protected Object targetA1(Object a0) throws Throwable { return target(a0); }
+        protected Object targetA1(int    a0) throws Throwable { return target(a0); }
+        protected Object targetA1(long   a0) throws Throwable { return target(a0); }
+        protected Object invoke_L(Object a0) throws Throwable { return return_L(targetA1(a0)); }
+        protected int    invoke_I(Object a0) throws Throwable { return return_I(targetA1(a0)); }
+        protected long   invoke_J(Object a0) throws Throwable { return return_J(targetA1(a0)); }
+        protected float  invoke_F(Object a0) throws Throwable { return return_F(targetA1(a0)); }
+        protected double invoke_D(Object a0) throws Throwable { return return_D(targetA1(a0)); }
+        protected Object invoke_L(int    a0) throws Throwable { return return_L(targetA1(a0)); }
+        protected int    invoke_I(int    a0) throws Throwable { return return_I(targetA1(a0)); }
+        protected long   invoke_J(int    a0) throws Throwable { return return_J(targetA1(a0)); }
+        protected float  invoke_F(int    a0) throws Throwable { return return_F(targetA1(a0)); }
+        protected double invoke_D(int    a0) throws Throwable { return return_D(targetA1(a0)); }
+        protected Object invoke_L(long   a0) throws Throwable { return return_L(targetA1(a0)); }
+        protected int    invoke_I(long   a0) throws Throwable { return return_I(targetA1(a0)); }
+        protected long   invoke_J(long   a0) throws Throwable { return return_J(targetA1(a0)); }
+        protected float  invoke_F(long   a0) throws Throwable { return return_F(targetA1(a0)); }
+        protected double invoke_D(long   a0) throws Throwable { return return_D(targetA1(a0)); }
+    }
+    static class A2 extends Adapter {
+        protected A2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A2(e, i, c, t); }
+        protected Object target(Object a0, Object a1)   throws Throwable { return invoker.invokeExact(target, a0, a1); }
+        protected Object targetA2(Object a0, Object a1) throws Throwable { return target(a0, a1); }
+        protected Object targetA2(Object a0, int    a1) throws Throwable { return target(a0, a1); }
+        protected Object targetA2(int    a0, int    a1) throws Throwable { return target(a0, a1); }
+        protected Object targetA2(Object a0, long   a1) throws Throwable { return target(a0, a1); }
+        protected Object targetA2(long   a0, long   a1) throws Throwable { return target(a0, a1); }
+        protected Object invoke_L(Object a0, Object a1) throws Throwable { return return_L(targetA2(a0, a1)); }
+        protected int    invoke_I(Object a0, Object a1) throws Throwable { return return_I(targetA2(a0, a1)); }
+        protected long   invoke_J(Object a0, Object a1) throws Throwable { return return_J(targetA2(a0, a1)); }
+        protected float  invoke_F(Object a0, Object a1) throws Throwable { return return_F(targetA2(a0, a1)); }
+        protected double invoke_D(Object a0, Object a1) throws Throwable { return return_D(targetA2(a0, a1)); }
+        protected Object invoke_L(Object a0, int    a1) throws Throwable { return return_L(targetA2(a0, a1)); }
+        protected int    invoke_I(Object a0, int    a1) throws Throwable { return return_I(targetA2(a0, a1)); }
+        protected long   invoke_J(Object a0, int    a1) throws Throwable { return return_J(targetA2(a0, a1)); }
+        protected float  invoke_F(Object a0, int    a1) throws Throwable { return return_F(targetA2(a0, a1)); }
+        protected double invoke_D(Object a0, int    a1) throws Throwable { return return_D(targetA2(a0, a1)); }
+        protected Object invoke_L(int    a0, int    a1) throws Throwable { return return_L(targetA2(a0, a1)); }
+        protected int    invoke_I(int    a0, int    a1) throws Throwable { return return_I(targetA2(a0, a1)); }
+        protected long   invoke_J(int    a0, int    a1) throws Throwable { return return_J(targetA2(a0, a1)); }
+        protected float  invoke_F(int    a0, int    a1) throws Throwable { return return_F(targetA2(a0, a1)); }
+        protected double invoke_D(int    a0, int    a1) throws Throwable { return return_D(targetA2(a0, a1)); }
+        protected Object invoke_L(Object a0, long   a1) throws Throwable { return return_L(targetA2(a0, a1)); }
+        protected int    invoke_I(Object a0, long   a1) throws Throwable { return return_I(targetA2(a0, a1)); }
+        protected long   invoke_J(Object a0, long   a1) throws Throwable { return return_J(targetA2(a0, a1)); }
+        protected float  invoke_F(Object a0, long   a1) throws Throwable { return return_F(targetA2(a0, a1)); }
+        protected double invoke_D(Object a0, long   a1) throws Throwable { return return_D(targetA2(a0, a1)); }
+        protected Object invoke_L(long   a0, long   a1) throws Throwable { return return_L(targetA2(a0, a1)); }
+        protected int    invoke_I(long   a0, long   a1) throws Throwable { return return_I(targetA2(a0, a1)); }
+        protected long   invoke_J(long   a0, long   a1) throws Throwable { return return_J(targetA2(a0, a1)); }
+        protected float  invoke_F(long   a0, long   a1) throws Throwable { return return_F(targetA2(a0, a1)); }
+        protected double invoke_D(long   a0, long   a1) throws Throwable { return return_D(targetA2(a0, a1)); }
+    }
+    static class A3 extends Adapter {
+        protected A3(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A3(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A3 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A3(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2); }
+        protected Object targetA3(Object a0, Object a1, Object a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object targetA3(Object a0, Object a1, int    a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object targetA3(Object a0, int    a1, int    a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object targetA3(int    a0, int    a1, int    a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object targetA3(Object a0, Object a1, long   a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object targetA3(Object a0, long   a1, long   a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object targetA3(long   a0, long   a1, long   a2) throws Throwable { return target(a0, a1, a2); }
+        protected Object invoke_L(Object a0, Object a1, Object a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(Object a0, Object a1, Object a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(Object a0, Object a1, Object a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+        protected Object invoke_L(Object a0, Object a1, int    a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(Object a0, Object a1, int    a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(Object a0, Object a1, int    a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(Object a0, Object a1, int    a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(Object a0, Object a1, int    a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+        protected Object invoke_L(Object a0, int    a1, int    a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(Object a0, int    a1, int    a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(Object a0, int    a1, int    a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(Object a0, int    a1, int    a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(Object a0, int    a1, int    a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+        protected Object invoke_L(int    a0, int    a1, int    a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(int    a0, int    a1, int    a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(int    a0, int    a1, int    a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(int    a0, int    a1, int    a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(int    a0, int    a1, int    a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(Object a0, Object a1, long   a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(Object a0, Object a1, long   a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(Object a0, long   a1, long   a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(Object a0, long   a1, long   a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
+        protected float  invoke_F(long   a0, long   a1, long   a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
+        protected double invoke_D(long   a0, long   a1, long   a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
+    }
+//params=[4, 4, 4, 99, 99, 99]
+    static class A4 extends Adapter {
+        protected A4(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A4(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A4 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A4(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, Object a1, Object a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, Object a1, int    a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, int    a1, int    a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(int    a0, int    a1, int    a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, Object a1, Object a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, Object a1, long   a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(Object a0, long   a1, long   a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object targetA4(long   a0, long   a1, long   a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
+        protected float  invoke_F(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_F(targetA4(a0, a1, a2, a3)); }
+        protected double invoke_D(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_D(targetA4(a0, a1, a2, a3)); }
+    }
+//params=[5, 5, 2, 99, 99, 99]
+    static class A5 extends Adapter {
+        protected A5(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A5(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A5 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A5(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object targetA5(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
+    }
+//params=[6, 10, 2, 99, 0, 99]
+    static class A6 extends Adapter {
+        protected A6(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A6(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A6 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A6(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object targetA6(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
+    }
+    static class A7 extends Adapter {
+        protected A7(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A7(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A7 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A7(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object targetA7(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
+    }
+    static class A8 extends Adapter {
+        protected A8(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A8(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A8 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A8(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object targetA8(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
+    }
+    static class A9 extends Adapter {
+        protected A9(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A9(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A9 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A9(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object targetA9(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
+    }
+    static class A10 extends Adapter {
+        protected A10(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
+        protected A10(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
+        protected A10 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A10(e, i, c, t); }
+        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object targetA10(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/VolatileCallSite.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010, 2011, 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 java.lang.invoke;
+
+/**
+ * A {@code VolatileCallSite} is a {@link CallSite} whose target acts like a volatile variable.
+ * An {@code invokedynamic} instruction linked to a {@code VolatileCallSite} sees updates
+ * to its call site target immediately, even if the update occurs in another thread.
+ * There may be a performance penalty for such tight coupling between threads.
+ * <p>
+ * Unlike {@code MutableCallSite}, there is no
+ * {@linkplain MutableCallSite#syncAll syncAll operation} on volatile
+ * call sites, since every write to a volatile variable is implicitly
+ * synchronized with reader threads.
+ * <p>
+ * In other respects, a {@code VolatileCallSite} is interchangeable
+ * with {@code MutableCallSite}.
+ * @see MutableCallSite
+ * @author John Rose, JSR 292 EG
+ */
+public class VolatileCallSite extends CallSite {
+    /**
+     * Creates a call site with a volatile binding to its target.
+     * The initial target is set to a method handle
+     * of the given type which will throw an {@code IllegalStateException} if called.
+     * @param type the method type that this call site will have
+     * @throws NullPointerException if the proposed type is null
+     */
+    public VolatileCallSite(MethodType type) {
+        super(type);
+    }
+
+    /**
+     * Creates a call site with a volatile binding to its target.
+     * The target is set to the given value.
+     * @param target the method handle that will be the initial target of the call site
+     * @throws NullPointerException if the proposed target is null
+     */
+    public VolatileCallSite(MethodHandle target) {
+        super(target);
+    }
+
+    /**
+     * Returns the target method of the call site, which behaves
+     * like a {@code volatile} field of the {@code VolatileCallSite}.
+     * <p>
+     * The interactions of {@code getTarget} with memory are the same
+     * as of a read from a {@code volatile} field.
+     * <p>
+     * In particular, the current thread is required to issue a fresh
+     * read of the target from memory, and must not fail to see
+     * a recent update to the target by another thread.
+     *
+     * @return the linkage state of this call site, a method handle which can change over time
+     * @see #setTarget
+     */
+    @Override public final MethodHandle getTarget() {
+        return getTargetVolatile();
+    }
+
+    /**
+     * Updates the target method of this call site, as a volatile variable.
+     * The type of the new target must agree with the type of the old target.
+     * <p>
+     * The interactions with memory are the same as of a write to a volatile field.
+     * In particular, any threads is guaranteed to see the updated target
+     * the next time it calls {@code getTarget}.
+     * @param newTarget the new target
+     * @throws NullPointerException if the proposed new target is null
+     * @throws WrongMethodTypeException if the proposed new target
+     *         has a method type that differs from the previous target
+     * @see #getTarget
+     */
+    @Override public void setTarget(MethodHandle newTarget) {
+        checkTargetChange(getTargetVolatile(), newTarget);
+        setTargetVolatile(newTarget);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final MethodHandle dynamicInvoker() {
+        return makeDynamicInvoker();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/WrongMethodTypeException.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2008, 2011, 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 java.lang.invoke;
+
+/**
+ * Thrown to indicate that code has attempted to call a method handle
+ * via the wrong method type.  As with the bytecode representation of
+ * normal Java method calls, method handle calls are strongly typed
+ * to a specific type descriptor associated with a call site.
+ * <p>
+ * This exception may also be thrown when two method handles are
+ * composed, and the system detects that their types cannot be
+ * matched up correctly.  This amounts to an early evaluation
+ * of the type mismatch, at method handle construction time,
+ * instead of when the mismatched method handle is called.
+ *
+ * @author John Rose, JSR 292 EG
+ * @since 1.7
+ */
+public class WrongMethodTypeException extends RuntimeException {
+    private static final long serialVersionUID = 292L;
+
+    /**
+     * Constructs a {@code WrongMethodTypeException} with no detail message.
+     */
+    public WrongMethodTypeException() {
+        super();
+    }
+
+    /**
+     * Constructs a {@code WrongMethodTypeException} with the specified
+     * detail message.
+     *
+     * @param s the detail message.
+     */
+    public WrongMethodTypeException(String s) {
+        super(s);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/package-info.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2008, 2011, 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.
+ */
+
+/**
+ * The {@code java.lang.invoke} package contains dynamic language support provided directly by
+ * the Java core class libraries and virtual machine.
+ *
+ * <p>
+ * Certain types in this package have special relations to dynamic
+ * language support in the virtual machine:
+ * <ul>
+ * <li>The class {@link java.lang.invoke.MethodHandle MethodHandle} contains
+ * <a href="MethodHandle.html#sigpoly">signature polymorphic methods</a>
+ * which can be linked regardless of their type descriptor.
+ * Normally, method linkage requires exact matching of type descriptors.
+ * </li>
+ *
+ * <li>The JVM bytecode format supports immediate constants of
+ * the classes {@link java.lang.invoke.MethodHandle MethodHandle} and {@link java.lang.invoke.MethodType MethodType}.
+ * </li>
+ * </ul>
+ *
+ * <h2><a name="jvm_mods"></a>Corresponding JVM bytecode format changes</h2>
+ * <em>The following low-level information is presented here as a preview of
+ * changes being made to the Java Virtual Machine specification for JSR 292.
+ * This information will be incorporated in a future version of the JVM specification.</em>
+ *
+ * <h3><a name="indyinsn"></a>{@code invokedynamic} instruction format</h3>
+ * In bytecode, an {@code invokedynamic} instruction is formatted as five bytes.
+ * The first byte is the opcode 186 (hexadecimal {@code BA}).
+ * The next two bytes are a constant pool index (in the same format as for the other {@code invoke} instructions).
+ * The final two bytes are reserved for future use and required to be zero.
+ * The constant pool reference of an {@code invokedynamic} instruction is to a entry
+ * with tag {@code CONSTANT_InvokeDynamic} (decimal 18).  See below for its format.
+ * The entry specifies the following information:
+ * <ul>
+ * <li>a bootstrap method (a {@link java.lang.invoke.MethodHandle MethodHandle} constant)</li>
+ * <li>the dynamic invocation name (a UTF8 string)</li>
+ * <li>the argument and return types of the call (encoded as a type descriptor in a UTF8 string)</li>
+ * <li>optionally, a sequence of additional <em>static arguments</em> to the bootstrap method ({@code ldc}-type constants)</li>
+ * </ul>
+ * <p>
+ * Each instance of an {@code invokedynamic} instruction is called a <em>dynamic call site</em>.
+ * Multiple instances of an {@code invokedynamic} instruction can share a single
+ * {@code CONSTANT_InvokeDynamic} entry.
+ * In any case, distinct call sites always have distinct linkage state.
+ * <p>
+ * A dynamic call site is originally in an unlinked state.  In this state, there is
+ * no target method for the call site to invoke.
+ * A dynamic call site is linked by means of a bootstrap method,
+ * as <a href="#bsm">described below</a>.
+ *
+ * <h3><a name="indycon"></a>constant pool entries for {@code invokedynamic} instructions</h3>
+ * If a constant pool entry has the tag {@code CONSTANT_InvokeDynamic} (decimal 18),
+ * it must contain exactly four more bytes after the tag.
+ * These bytes are interpreted as two 16-bit indexes, in the usual {@code u2} format.
+ * The first pair of bytes after the tag must be an index into a side table called the
+ * <em>bootstrap method table</em>, which is stored in the {@code BootstrapMethods}
+ * attribute as <a href="#bsmattr">described below</a>.
+ * The second pair of bytes must be an index to a {@code CONSTANT_NameAndType}.
+ * <p>
+ * The first index specifies a bootstrap method used by the associated dynamic call sites.
+ * The second index specifies the method name, argument types, and return type of the dynamic call site.
+ * The structure of such an entry is therefore analogous to a {@code CONSTANT_Methodref},
+ * except that the bootstrap method specifier reference replaces
+ * the {@code CONSTANT_Class} reference of a {@code CONSTANT_Methodref} entry.
+ *
+ * <h3><a name="mtcon"></a>constant pool entries for {@linkplain java.lang.invoke.MethodType method types}</h3>
+ * If a constant pool entry has the tag {@code CONSTANT_MethodType} (decimal 16),
+ * it must contain exactly two more bytes, which must be an index to a {@code CONSTANT_Utf8}
+ * entry which represents a method type descriptor.
+ * <p>
+ * The JVM will ensure that on first
+ * execution of an {@code ldc} instruction for this entry, a {@link java.lang.invoke.MethodType MethodType}
+ * will be created which represents the type descriptor.
+ * Any classes mentioned in the {@code MethodType} will be loaded if necessary,
+ * but not initialized.
+ * Access checking and error reporting is performed exactly as it is for
+ * references by {@code ldc} instructions to {@code CONSTANT_Class} constants.
+ *
+ * <h3><a name="mhcon"></a>constant pool entries for {@linkplain java.lang.invoke.MethodHandle method handles}</h3>
+ * If a constant pool entry has the tag {@code CONSTANT_MethodHandle} (decimal 15),
+ * it must contain exactly three more bytes.  The first byte after the tag is a subtag
+ * value which must be in the range 1 through 9, and the last two must be an index to a
+ * {@code CONSTANT_Fieldref}, {@code CONSTANT_Methodref}, or
+ * {@code CONSTANT_InterfaceMethodref} entry which represents a field or method
+ * for which a method handle is to be created.
+ * Furthermore, the subtag value and the type of the constant index value
+ * must agree according to the table below.
+ * <p>
+ * The JVM will ensure that on first execution of an {@code ldc} instruction
+ * for this entry, a {@link java.lang.invoke.MethodHandle MethodHandle} will be created which represents
+ * the field or method reference, according to the specific mode implied by the subtag.
+ * <p>
+ * As with {@code CONSTANT_Class} and {@code CONSTANT_MethodType} constants,
+ * the {@code Class} or {@code MethodType} object which reifies the field or method's
+ * type is created.  Any classes mentioned in this reification will be loaded if necessary,
+ * but not initialized, and access checking and error reporting performed as usual.
+ * <p>
+ * Unlike the reflective {@code Lookup} API, there are no security manager calls made
+ * when these constants are resolved.
+ * <p>
+ * The method handle itself will have a type and behavior determined by the subtag as follows:
+ * <code>
+ * <table border=1 cellpadding=5 summary="CONSTANT_MethodHandle subtypes">
+ * <tr><th>N</th><th>subtag name</th><th>member</th><th>MH type</th><th>bytecode behavior</th><th>lookup expression</th></tr>
+ * <tr><td>1</td><td>REF_getField</td><td>C.f:T</td><td>(C)T</td><td>getfield C.f:T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findGetter findGetter(C.class,"f",T.class)}</td></tr>
+ * <tr><td>2</td><td>REF_getStatic</td><td>C.f:T</td><td>(&nbsp;)T</td><td>getstatic C.f:T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticGetter findStaticGetter(C.class,"f",T.class)}</td></tr>
+ * <tr><td>3</td><td>REF_putField</td><td>C.f:T</td><td>(C,T)void</td><td>putfield C.f:T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSetter findSetter(C.class,"f",T.class)}</td></tr>
+ * <tr><td>4</td><td>REF_putStatic</td><td>C.f:T</td><td>(T)void</td><td>putstatic C.f:T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticSetter findStaticSetter(C.class,"f",T.class)}</td></tr>
+ * <tr><td>5</td><td>REF_invokeVirtual</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokevirtual C.m(A*)T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findVirtual findVirtual(C.class,"m",MT)}</td></tr>
+ * <tr><td>6</td><td>REF_invokeStatic</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokestatic C.m(A*)T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStatic findStatic(C.class,"m",MT)}</td></tr>
+ * <tr><td>7</td><td>REF_invokeSpecial</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokespecial C.m(A*)T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSpecial findSpecial(C.class,"m",MT,this.class)}</td></tr>
+ * <tr><td>8</td><td>REF_newInvokeSpecial</td><td>C.&lt;init&gt;(A*)void</td><td>(A*)C</td><td>new C; dup; invokespecial C.&lt;init&gt;(A*)void</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findConstructor findConstructor(C.class,MT)}</td></tr>
+ * <tr><td>9</td><td>REF_invokeInterface</td><td>C.m(A*)T</td><td>(C,A*)T</td><td>invokeinterface C.m(A*)T</td>
+ *               <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findVirtual findVirtual(C.class,"m",MT)}</td></tr>
+ * </table>
+ * </code>
+ * Here, the type {@code C} is taken from the {@code CONSTANT_Class} reference associated
+ * with the {@code CONSTANT_NameAndType} descriptor.
+ * The field name {@code f} or method name {@code m} is taken from the {@code CONSTANT_NameAndType}
+ * as is the result type {@code T} and (in the case of a method or constructor) the argument type sequence
+ * {@code A*}.
+ * <p>
+ * Each method handle constant has an equivalent instruction sequence called its <em>bytecode behavior</em>.
+ * In general, creating a method handle constant can be done in exactly the same circumstances that
+ * the JVM would successfully resolve the symbolic references in the bytecode behavior.
+ * Also, the type of a method handle constant is such that a valid {@code invokeExact} call
+ * on the method handle has exactly the same JVM stack effects as the <em>bytecode behavior</em>.
+ * Finally, calling a method handle constant on a valid set of arguments has exactly the same effect
+ * and returns the same result (if any) as the corresponding <em>bytecode behavior</em>.
+ * <p>
+ * Each method handle constant also has an equivalent reflective <em>lookup expression</em>,
+ * which is a query to a method in {@link java.lang.invoke.MethodHandles.Lookup}.
+ * In the example lookup method expression given in the table above, the name {@code MT}
+ * stands for a {@code MethodType} built from {@code T} and the sequence of argument types {@code A*}.
+ * (Note that the type {@code C} is not prepended to the query type {@code MT} even if the member is non-static.)
+ * In the case of {@code findSpecial}, the name {@code this.class} refers to the class containing
+ * the bytecodes.
+ * <p>
+ * The special name {@code <clinit>} is not allowed.
+ * The special name {@code <init>} is not allowed except for subtag 8 as shown.
+ * <p>
+ * The JVM verifier and linker apply the same access checks and restrictions for these references as for the hypothetical
+ * bytecode instructions specified in the last column of the table.
+ * A method handle constant will successfully resolve to a method handle if the symbolic references
+ * of the corresponding bytecode instruction(s) would also resolve successfully.
+ * Otherwise, an attempt to resolve the constant will throw equivalent linkage errors.
+ * In particular, method handles to
+ * private and protected members can be created in exactly those classes for which the corresponding
+ * normal accesses are legal.
+ * <p>
+ * A constant may refer to a method or constructor with the {@code varargs}
+ * bit (hexadecimal {@code 0x0080}) set in its modifier bitmask.
+ * The method handle constant produced for such a method behaves as if
+ * it were created by {@link java.lang.invoke.MethodHandle#asVarargsCollector asVarargsCollector}.
+ * In other words, the constant method handle will exhibit variable arity,
+ * when invoked via {@code invokeGeneric}.
+ * On the other hand, its behavior with respect to {@code invokeExact} will be the same
+ * as if the {@code varargs} bit were not set.
+ * <p>
+ * Although the {@code CONSTANT_MethodHandle} and {@code CONSTANT_MethodType} constant types
+ * resolve class names, they do not force class initialization.
+ * Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic}
+ * may force class initialization on their first invocation, just like the corresponding bytecodes.
+ * <p>
+ * The rules of section 5.4.3 of the
+ * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73492">JVM Specification</a>
+ * apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle},
+ * and {@code CONSTANT_InvokeDynamic} constants,
+ * by the execution of {@code invokedynamic} and {@code ldc} instructions.
+ * (Roughly speaking, this means that every use of a constant pool entry
+ * must lead to the same outcome.
+ * If the resolution succeeds, the same object reference is produced
+ * by every subsequent execution of the same instruction.
+ * If the resolution of the constant causes an error to occur,
+ * the same error will be re-thrown on every subsequent attempt
+ * to use this particular constant.)
+ * <p>
+ * Constants created by the resolution of these constant pool types are not necessarily
+ * interned.  Except for {@code CONSTANT_Class} and {@code CONSTANT_String} entries,
+ * two distinct constant pool entries might not resolve to the same reference
+ * even if they contain the same symbolic reference.
+ *
+ * <h2><a name="bsm"></a>Bootstrap Methods</h2>
+ * Before the JVM can execute a dynamic call site (an {@code invokedynamic} instruction),
+ * the call site must first be <em>linked</em>.
+ * Linking is accomplished by calling a <em>bootstrap method</em>
+ * which is given the static information content of the call site,
+ * and which must produce a {@link java.lang.invoke.MethodHandle method handle}
+ * that gives the behavior of the call site.
+ * <p>
+ * Each {@code invokedynamic} instruction statically specifies its own
+ * bootstrap method as a constant pool reference.
+ * The constant pool reference also specifies the call site's name and type descriptor,
+ * just like {@code invokevirtual} and the other invoke instructions.
+ * <p>
+ * Linking starts with resolving the constant pool entry for the
+ * bootstrap method, and resolving a {@link java.lang.invoke.MethodType MethodType} object for
+ * the type descriptor of the dynamic call site.
+ * This resolution process may trigger class loading.
+ * It may therefore throw an error if a class fails to load.
+ * This error becomes the abnormal termination of the dynamic
+ * call site execution.
+ * Linkage does not trigger class initialization.
+ * <p>
+ * Next, the bootstrap method call is started, with at least four values being stacked:
+ * <ul>
+ * <li>a {@code MethodHandle}, the resolved bootstrap method itself </li>
+ * <li>a {@code MethodHandles.Lookup}, a lookup object on the <em>caller class</em> in which dynamic call site occurs </li>
+ * <li>a {@code String}, the method name mentioned in the call site </li>
+ * <li>a {@code MethodType}, the resolved type descriptor of the call </li>
+ * <li>optionally, one or more <a href="#args">additional static arguments</a> </li>
+ * </ul>
+ * The method handle is then applied to the other values as if by
+ * {@link java.lang.invoke.MethodHandle#invokeGeneric invokeGeneric}.
+ * The returned result must be a {@link java.lang.invoke.CallSite CallSite} (or a subclass).
+ * The type of the call site's target must be exactly equal to the type
+ * derived from the dynamic call site's type descriptor and passed to
+ * the bootstrap method.
+ * The call site then becomes permanently linked to the dynamic call site.
+ * <p>
+ * As long as each bootstrap method can be correctly invoked
+ * by <code>invokeGeneric</code>, its detailed type is arbitrary.
+ * For example, the first argument could be {@code Object}
+ * instead of {@code MethodHandles.Lookup}, and the return type
+ * could also be {@code Object} instead of {@code CallSite}.
+ * (Note that the types and number of the stacked arguments limit
+ * the legal kinds of bootstrap methods to appropriately typed
+ * static methods and constructors of {@code CallSite} subclasses.)
+ * <p>
+ * After resolution, the linkage process may fail in a variety of ways.
+ * All failures are reported by a {@link java.lang.BootstrapMethodError BootstrapMethodError},
+ * which is thrown as the abnormal termination of the dynamic call
+ * site execution.
+ * The following circumstances will cause this:
+ * <ul>
+ * <li>the index to the bootstrap method specifier is out of range </li>
+ * <li>the bootstrap method cannot be resolved </li>
+ * <li>the {@code MethodType} to pass to the bootstrap method cannot be resolved </li>
+ * <li>a static argument to the bootstrap method cannot be resolved
+ *     (i.e., a {@code CONSTANT_Class}, {@code CONSTANT_MethodType},
+ *     or {@code CONSTANT_MethodHandle} argument cannot be linked) </li>
+ * <li>the bootstrap method has the wrong arity,
+ *     causing {@code invokeGeneric} to throw {@code WrongMethodTypeException} </li>
+ * <li>the bootstrap method has a wrong argument or return type </li>
+ * <li>the bootstrap method invocation completes abnormally </li>
+ * <li>the result from the bootstrap invocation is not a reference to
+ *     an object of type {@link java.lang.invoke.CallSite CallSite} </li>
+ * <li>the target of the {@code CallSite} does not have a target of
+ *     the expected {@code MethodType} </li>
+ * </ul>
+ *
+ * <h3><a name="linktime"></a>timing of linkage</h3>
+ * A dynamic call site is linked just before its first execution.
+ * The bootstrap method call implementing the linkage occurs within
+ * a thread that is attempting a first execution.
+ * <p>
+ * If there are several such threads, the bootstrap method may be
+ * invoked in several threads concurrently.
+ * Therefore, bootstrap methods which access global application
+ * data must take the usual precautions against race conditions.
+ * In any case, every {@code invokedynamic} instruction is either
+ * unlinked or linked to a unique {@code CallSite} object.
+ * <p>
+ * In an application which requires dynamic call sites with individually
+ * mutable behaviors, their bootstrap methods should produce distinct
+ * {@link java.lang.invoke.CallSite CallSite} objects, one for each linkage request.
+ * Alternatively, an application can link a single {@code CallSite} object
+ * to several {@code invokedynamic} instructions, in which case
+ * a change to the target method will become visible at each of
+ * the instructions.
+ * <p>
+ * If several threads simultaneously execute a bootstrap method for a single dynamic
+ * call site, the JVM must choose one {@code CallSite} object and install it visibly to
+ * all threads.  Any other bootstrap method calls are allowed to complete, but their
+ * results are ignored, and their dynamic call site invocations proceed with the originally
+ * chosen target object.
+ *
+ * <p style="font-size:smaller;">
+ * <em>Discussion:</em>
+ * These rules do not enable the JVM to duplicate dynamic call sites,
+ * or to issue &ldquo;causeless&rdquo; bootstrap method calls.
+ * Every dynamic call site transitions at most once from unlinked to linked,
+ * just before its first invocation.
+ * There is no way to undo the effect of a completed bootstrap method call.
+ *
+ * <h3><a name="bsmattr">the {@code BootstrapMethods} attribute </h3>
+ * Each {@code CONSTANT_InvokeDynamic} entry contains an index which references
+ * a bootstrap method specifier; all such specifiers are contained in a separate array.
+ * This array is defined by a class attribute named {@code BootstrapMethods}.
+ * The body of this attribute consists of a sequence of byte pairs, all interpreted as
+ * as 16-bit counts or constant pool indexes, in the {@code u2} format.
+ * The attribute body starts with a count of bootstrap method specifiers,
+ * which is immediately followed by the sequence of specifiers.
+ * <p>
+ * Each bootstrap method specifier contains an index to a
+ * {@code CONSTANT_MethodHandle} constant, which is the bootstrap
+ * method itself.
+ * This is followed by a count, and then a sequence (perhaps empty) of
+ * indexes to <a href="#args">additional static arguments</a>
+ * for the bootstrap method.
+ * <p>
+ * During class loading, the verifier must check the structure of the
+ * {@code BootstrapMethods} attribute.  In particular, each constant
+ * pool index must be of the correct type.  A bootstrap method index
+ * must refer to a {@code CONSTANT_MethodHandle} (tag 15).
+ * Every other index must refer to a valid operand of an
+ * {@code ldc_w} or {@code ldc2_w} instruction (tag 3..8 or 15..16).
+ *
+ * <h3><a name="args">static arguments to the bootstrap method</h3>
+ * An {@code invokedynamic} instruction specifies at least three arguments
+ * to pass to its bootstrap method:
+ * The caller class (expressed as a {@link java.lang.invoke.MethodHandles.Lookup Lookup object},
+ * the name (extracted from the {@code CONSTANT_NameAndType} entry),
+ * and the type (also extracted from the {@code CONSTANT_NameAndType} entry).
+ * The {@code invokedynamic} instruction may specify additional metadata values
+ * to pass to its bootstrap method.
+ * Collectively, these values are called <em>static arguments</em> to the
+ * {@code invokedynamic} instruction, because they are used once at link
+ * time to determine the instruction's behavior on subsequent sets of
+ * <em>dynamic arguments</em>.
+ * <p>
+ * Static arguments are used to communicate application-specific meta-data
+ * to the bootstrap method.
+ * Drawn from the constant pool, they may include references to classes, method handles,
+ * strings, or numeric data that may be relevant to the task of linking that particular call site.
+ * <p>
+ * Static arguments are specified constant pool indexes stored in the {@code BootstrapMethods} attribute.
+ * Before the bootstrap method is invoked, each index is used to compute an {@code Object}
+ * reference to the indexed value in the constant pool.
+ * The valid constant pool entries are listed in this table:
+ * <code>
+ * <table border=1 cellpadding=5 summary="Static argument types">
+ * <tr><th>entry type</th><th>argument type</th><th>argument value</th></tr>
+ * <tr><td>CONSTANT_String</td><td><code>java.lang.String</code></td><td>the indexed string literal</td></tr>
+ * <tr><td>CONSTANT_Class</td><td><code>java.lang.Class</code></td><td>the indexed class, resolved</td></tr>
+ * <tr><td>CONSTANT_Integer</td><td><code>java.lang.Integer</code></td><td>the indexed int value</td></tr>
+ * <tr><td>CONSTANT_Long</td><td><code>java.lang.Long</code></td><td>the indexed long value</td></tr>
+ * <tr><td>CONSTANT_Float</td><td><code>java.lang.Float</code></td><td>the indexed float value</td></tr>
+ * <tr><td>CONSTANT_Double</td><td><code>java.lang.Double</code></td><td>the indexed double value</td></tr>
+ * <tr><td>CONSTANT_MethodHandle</td><td><code>java.lang.invoke.MethodHandle</code></td><td>the indexed method handle constant</td></tr>
+ * <tr><td>CONSTANT_MethodType</td><td><code>java.lang.invoke.MethodType</code></td><td>the indexed method type constant</td></tr>
+ * </table>
+ * </code>
+ * <p>
+ * If a given {@code invokedynamic} instruction specifies no static arguments,
+ * the instruction's bootstrap method will be invoked on three arguments,
+ * conveying the instruction's caller class, name, and method type.
+ * If the {@code invokedynamic} instruction specifies one or more static arguments,
+ * those values will be passed as additional arguments to the method handle.
+ * (Note that because there is a limit of 255 arguments to any method,
+ * at most 252 extra arguments can be supplied.)
+ * The bootstrap method will be invoked as if by either {@code invokeGeneric}
+ * or {@code invokeWithArguments}.  (There is no way to tell the difference.)
+ * <p>
+ * The normal argument conversion rules for {@code invokeGeneric} apply to all stacked arguments.
+ * For example, if a pushed value is a primitive type, it may be converted to a reference by boxing conversion.
+ * If the bootstrap method is a variable arity method (its modifier bit {@code 0x0080} is set),
+ * then some or all of the arguments specified here may be collected into a trailing array parameter.
+ * (This is not a special rule, but rather a useful consequence of the interaction
+ * between {@code CONSTANT_MethodHandle} constants, the modifier bit for variable arity methods,
+ * and the {@code java.lang.invoke.MethodHandle#asVarargsCollector asVarargsCollector} transformation.)
+ * <p>
+ * Given these rules, here are examples of legal bootstrap method declarations,
+ * given various numbers {@code N} of extra arguments.
+ * The first rows (marked {@code *}) will work for any number of extra arguments.
+ * <code>
+ * <table border=1 cellpadding=5 summary="Static argument types">
+ * <tr><th>N</th><th>sample bootstrap method</th></tr>
+ * <tr><td>*</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code></td></tr>
+ * <tr><td>*</td><td><code>CallSite bootstrap(Object... args)</code></td></tr>
+ * <tr><td>*</td><td><code>CallSite bootstrap(Object caller, Object... nameAndTypeWithArgs)</code></td></tr>
+ * <tr><td>0</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type)</code></td></tr>
+ * <tr><td>0</td><td><code>CallSite bootstrap(Lookup caller, Object... nameAndType)</code></td></tr>
+ * <tr><td>1</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object arg)</code></td></tr>
+ * <tr><td>2</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code></td></tr>
+ * <tr><td>2</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String... args)</code></td></tr>
+ * <tr><td>2</td><td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String x, int y)</code></td></tr>
+ * </table>
+ * </code>
+ * The last example assumes that the extra arguments are of type
+ * {@code CONSTANT_String} and {@code CONSTANT_Integer}, respectively.
+ * The second-to-last example assumes that all extra arguments are of type
+ * {@code CONSTANT_String}.
+ * The other examples work with all types of extra arguments.
+ * <p>
+ * As noted above, the actual method type of the bootstrap method can vary.
+ * For example, the fourth argument could be {@code MethodHandle},
+ * if that is the type of the corresponding constant in
+ * the {@code CONSTANT_InvokeDynamic} entry.
+ * In that case, the {@code invokeGeneric} call will pass the extra method handle
+ * constant as an {@code Object}, but the type matching machinery of {@code invokeGeneric}
+ * will cast the reference back to {@code MethodHandle} before invoking the bootstrap method.
+ * (If a string constant were passed instead, by badly generated code, that cast would then fail,
+ * resulting in a {@code BootstrapMethodError}.)
+ * <p>
+ * Extra bootstrap method arguments are intended to allow language implementors
+ * to safely and compactly encode metadata.
+ * In principle, the name and extra arguments are redundant,
+ * since each call site could be given its own unique bootstrap method.
+ * Such a practice is likely to produce large class files and constant pools.
+ *
+ * <h2><a name="structs"></a>Structure Summary</h2>
+ * <blockquote><pre>// summary of constant and attribute structures
+struct CONSTANT_MethodHandle_info {
+  u1 tag = 15;
+  u1 reference_kind;       // 1..8 (one of REF_invokeVirtual, etc.)
+  u2 reference_index;      // index to CONSTANT_Fieldref or *Methodref
+}
+struct CONSTANT_MethodType_info {
+  u1 tag = 16;
+  u2 descriptor_index;    // index to CONSTANT_Utf8, as in NameAndType
+}
+struct CONSTANT_InvokeDynamic_info {
+  u1 tag = 18;
+  u2 bootstrap_method_attr_index;  // index into BootstrapMethods_attr
+  u2 name_and_type_index;          // index to CONSTANT_NameAndType, as in Methodref
+}
+struct BootstrapMethods_attr {
+ u2 name;  // CONSTANT_Utf8 = "BootstrapMethods"
+ u4 size;
+ u2 bootstrap_method_count;
+ struct bootstrap_method_specifier {
+   u2 bootstrap_method_ref;  // index to CONSTANT_MethodHandle
+   u2 bootstrap_argument_count;
+   u2 bootstrap_arguments[bootstrap_argument_count];  // constant pool indexes
+ } bootstrap_methods[bootstrap_method_count];
+}
+ * </pre></blockquote>
+ *
+ * @author John Rose, JSR 292 EG
+ * @since 1.7
+ */
+
+package java.lang.invoke;
--- a/jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.util.Enumeration;
+import sun.net.ResourceManager;
 
 /**
  * Abstract datagram and multicast socket implementation base class.
@@ -66,7 +67,14 @@
      */
     protected synchronized void create() throws SocketException {
         fd = new FileDescriptor();
-        datagramSocketCreate();
+        ResourceManager.beforeUdpCreate();
+        try {
+            datagramSocketCreate();
+        } catch (SocketException ioe) {
+            ResourceManager.afterUdpClose();
+            fd = null;
+            throw ioe;
+        }
     }
 
     /**
@@ -211,6 +219,7 @@
     protected void close() {
         if (fd != null) {
             datagramSocketClose();
+            ResourceManager.afterUdpClose();
             fd = null;
         }
     }
--- a/jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -32,6 +32,7 @@
 
 import sun.net.ConnectionResetException;
 import sun.net.NetHooks;
+import sun.net.ResourceManager;
 
 /**
  * Default Socket Implementation. This implementation does
@@ -68,6 +69,10 @@
     private int resetState;
     private final Object resetLock = new Object();
 
+   /* whether this Socket is a stream (TCP) socket or not (UDP)
+    */
+    private boolean stream;
+
     /**
      * Load net library into runtime.
      */
@@ -82,7 +87,19 @@
      */
     protected synchronized void create(boolean stream) throws IOException {
         fd = new FileDescriptor();
-        socketCreate(stream);
+        this.stream = stream;
+        if (!stream) {
+            ResourceManager.beforeUdpCreate();
+            try {
+                socketCreate(false);
+            } catch (IOException ioe) {
+                ResourceManager.afterUdpClose();
+                fd = null;
+                throw ioe;
+            }
+        } else {
+            socketCreate(true);
+        }
         if (socket != null)
             socket.setCreated();
         if (serverSocket != null)
@@ -479,6 +496,9 @@
     protected void close() throws IOException {
         synchronized(fdLock) {
             if (fd != null) {
+                if (!stream) {
+                    ResourceManager.afterUdpClose();
+                }
                 if (fdUseCount == 0) {
                     if (closePending) {
                         return;
--- a/jdk/src/share/classes/java/security/AccessControlContext.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/security/AccessControlContext.java	Thu Mar 31 22:07:32 2011 -0700
@@ -29,6 +29,9 @@
 import java.util.List;
 import sun.security.util.Debug;
 import sun.security.util.SecurityConstants;
+import sun.misc.JavaSecurityAccess;
+import sun.misc.SharedSecrets;
+
 
 /**
  * An AccessControlContext is used to make system resource access decisions
@@ -197,6 +200,24 @@
     }
 
     /**
+     * Constructor for JavaSecurityAccess.doIntersectionPrivilege()
+     */
+    AccessControlContext(ProtectionDomain[] context,
+                         AccessControlContext privilegedContext)
+    {
+        this.context = context;
+        this.privilegedContext = privilegedContext;
+        this.isPrivileged = true;
+    }
+
+    /**
+     * Returns this context's context.
+     */
+    ProtectionDomain[] getContext() {
+        return context;
+    }
+
+    /**
      * Returns true if this context is privileged.
      */
     boolean isPrivileged()
--- a/jdk/src/share/classes/java/security/ProtectionDomain.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/security/ProtectionDomain.java	Thu Mar 31 22:07:32 2011 -0700
@@ -36,6 +36,8 @@
 import sun.misc.SharedSecrets;
 import sun.security.util.Debug;
 import sun.security.util.SecurityConstants;
+import sun.misc.JavaSecurityAccess;
+import sun.misc.SharedSecrets;
 
 /**
  *
@@ -59,6 +61,36 @@
 
 public class ProtectionDomain {
 
+    static {
+        // Set up JavaSecurityAccess in SharedSecrets
+        SharedSecrets.setJavaSecurityAccess(
+            new JavaSecurityAccess() {
+                public <T> T doIntersectionPrivilege(
+                    PrivilegedAction<T> action,
+                    final AccessControlContext stack,
+                    final AccessControlContext context)
+                {
+                    if (action == null) {
+                        throw new NullPointerException();
+                    }
+                    return AccessController.doPrivileged(
+                        action,
+                        new AccessControlContext(
+                            stack.getContext(), context).optimize()
+                    );
+                }
+
+                public <T> T doIntersectionPrivilege(
+                    PrivilegedAction<T> action,
+                    AccessControlContext context)
+                {
+                    return doIntersectionPrivilege(action,
+                        AccessController.getContext(), context);
+                }
+            }
+       );
+    }
+
     /* CodeSource */
     private CodeSource codesource ;
 
--- a/jdk/src/share/classes/java/text/SimpleDateFormat.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java	Thu Mar 31 22:07:32 2011 -0700
@@ -504,8 +504,8 @@
     /**
      * Cache to hold the DateTimePatterns of a Locale.
      */
-    private static final ConcurrentMap<String, String[]> cachedLocaleData
-        = new ConcurrentHashMap<String, String[]>(3);
+    private static final ConcurrentMap<Locale, String[]> cachedLocaleData
+        = new ConcurrentHashMap<Locale, String[]>(3);
 
     /**
      * Cache NumberFormat instances with Locale key.
@@ -619,8 +619,7 @@
         initializeCalendar(loc);
 
         /* try the cache first */
-        String key = getKey();
-        String[] dateTimePatterns = cachedLocaleData.get(key);
+        String[] dateTimePatterns = cachedLocaleData.get(loc);
         if (dateTimePatterns == null) { /* cache miss */
             ResourceBundle r = LocaleData.getDateFormatData(loc);
             if (!isGregorianCalendar()) {
@@ -633,7 +632,7 @@
                 dateTimePatterns = r.getStringArray("DateTimePatterns");
             }
             /* update cache */
-            cachedLocaleData.putIfAbsent(key, dateTimePatterns);
+            cachedLocaleData.putIfAbsent(loc, dateTimePatterns);
         }
         formatData = DateFormatSymbols.getInstanceRef(loc);
         if ((timeStyle >= 0) && (dateStyle >= 0)) {
@@ -684,13 +683,6 @@
         }
     }
 
-    private String getKey() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getCalendarName()).append('.');
-        sb.append(locale.getLanguage()).append('_').append(locale.getCountry()).append('_').append(locale.getVariant());
-        return sb.toString();
-    }
-
     /**
      * Returns the compiled form of the given pattern. The syntax of
      * the compiled pattern is:
--- a/jdk/src/share/classes/javax/swing/JOptionPane.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/JOptionPane.java	Thu Mar 31 22:07:32 2011 -0700
@@ -987,11 +987,33 @@
         }
         dialog.pack();
         dialog.setLocationRelativeTo(parentComponent);
+
+        final PropertyChangeListener listener = new PropertyChangeListener() {
+            public void propertyChange(PropertyChangeEvent event) {
+                // Let the defaultCloseOperation handle the closing
+                // if the user closed the window without selecting a button
+                // (newValue = null in that case).  Otherwise, close the dialog.
+                if (dialog.isVisible() && event.getSource() == JOptionPane.this &&
+                        (event.getPropertyName().equals(VALUE_PROPERTY) ||
+                                event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
+                        event.getNewValue() != null &&
+                        event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
+                    dialog.setVisible(false);
+                }
+            }
+        };
+
         WindowAdapter adapter = new WindowAdapter() {
             private boolean gotFocus = false;
             public void windowClosing(WindowEvent we) {
                 setValue(null);
             }
+
+            public void windowClosed(WindowEvent e) {
+                removePropertyChangeListener(listener);
+                dialog.getContentPane().removeAll();
+            }
+
             public void windowGainedFocus(WindowEvent we) {
                 // Once window gets focus, set initial focus
                 if (!gotFocus) {
@@ -1008,20 +1030,8 @@
                 setValue(JOptionPane.UNINITIALIZED_VALUE);
             }
         });
-        addPropertyChangeListener(new PropertyChangeListener() {
-            public void propertyChange(PropertyChangeEvent event) {
-                // Let the defaultCloseOperation handle the closing
-                // if the user closed the window without selecting a button
-                // (newValue = null in that case).  Otherwise, close the dialog.
-                if (dialog.isVisible() && event.getSource() == JOptionPane.this &&
-                  (event.getPropertyName().equals(VALUE_PROPERTY) ||
-                   event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
-                  event.getNewValue() != null &&
-                  event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
-                    dialog.setVisible(false);
-                }
-            }
-        });
+
+        addPropertyChangeListener(listener);
     }
 
 
--- a/jdk/src/share/classes/javax/swing/Timer.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/Timer.java	Thu Mar 31 22:07:32 2011 -0700
@@ -35,6 +35,10 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.io.Serializable;
+import java.io.*;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import javax.swing.event.EventListenerList;
 
 
@@ -208,6 +212,22 @@
         }
     }
 
+    /*
+     * The timer's AccessControlContext.
+     */
+     private transient volatile AccessControlContext acc =
+            AccessController.getContext();
+
+    /**
+      * Returns the acc this timer was constructed with.
+      */
+     final AccessControlContext getAccessControlContext() {
+       if (acc == null) {
+           throw new SecurityException(
+                   "Timer is missing AccessControlContext");
+       }
+       return acc;
+     }
 
     /**
      * DoPostEvent is a runnable class that fires actionEvents to
@@ -587,8 +607,13 @@
 
 
     void post() {
-        if (notify.compareAndSet(false, true) || !coalesce) {
-            SwingUtilities.invokeLater(doPostEvent);
+         if (notify.compareAndSet(false, true) || !coalesce) {
+             AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                 public Void run() {
+                     SwingUtilities.invokeLater(doPostEvent);
+                     return null;
+                }
+            }, getAccessControlContext());
         }
     }
 
@@ -596,6 +621,13 @@
         return lock;
     }
 
+    private void readObject(ObjectInputStream in)
+        throws ClassNotFoundException, IOException
+    {
+        this.acc = AccessController.getContext();
+        in.defaultReadObject();
+    }
+
     /*
      * We have to use readResolve because we can not initialize final
      * fields for deserialized object otherwise
--- a/jdk/src/share/classes/javax/swing/TransferHandler.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/TransferHandler.java	Thu Mar 31 22:07:32 2011 -0700
@@ -42,6 +42,16 @@
 import sun.swing.*;
 import sun.awt.SunToolkit;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.security.AccessControlContext;
+import java.security.ProtectionDomain;
+import sun.misc.SharedSecrets;
+import sun.misc.JavaSecurityAccess;
+
+import sun.awt.AWTAccessor;
+
 /**
  * This class is used to handle the transfer of a <code>Transferable</code>
  * to and from Swing components.  The <code>Transferable</code> is used to
@@ -1686,7 +1696,37 @@
             return true;
         }
 
-        public void actionPerformed(ActionEvent e) {
+        private static final JavaSecurityAccess javaSecurityAccess =
+            SharedSecrets.getJavaSecurityAccess();
+
+        public void actionPerformed(final ActionEvent e) {
+            final Object src = e.getSource();
+
+            final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
+                public Void run() {
+                    actionPerformedImpl(e);
+                    return null;
+                }
+            };
+
+            final AccessControlContext stack = AccessController.getContext();
+            final AccessControlContext srcAcc = AWTAccessor.getComponentAccessor().getAccessControlContext((Component)src);
+            final AccessControlContext eventAcc = AWTAccessor.getAWTEventAccessor().getAccessControlContext(e);
+
+                if (srcAcc == null) {
+                    javaSecurityAccess.doIntersectionPrivilege(action, stack, eventAcc);
+                } else {
+                    javaSecurityAccess.doIntersectionPrivilege(
+                        new PrivilegedAction<Void>() {
+                            public Void run() {
+                                javaSecurityAccess.doIntersectionPrivilege(action, eventAcc);
+                                return null;
+                             }
+                    }, stack, srcAcc);
+                }
+        }
+
+        private void actionPerformedImpl(ActionEvent e) {
             Object src = e.getSource();
             if (src instanceof JComponent) {
                 JComponent c = (JComponent) src;
--- a/jdk/src/share/classes/overview-core.html	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/overview-core.html	Thu Mar 31 22:07:32 2011 -0700
@@ -33,7 +33,7 @@
 
 <body>
 
-This document is the API specification for version&nbsp;6 of the Java&#x2122;
+This document is the API specification for the Java&#x2122;
 Platform, Standard Edition.
 
 </body>
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -103,7 +103,6 @@
             {"appletclassloader.fileexception", "{0} exception when loading: {1}"},
             {"appletclassloader.filedeath", "{0} killed when loading: {1}"},
             {"appletclassloader.fileerror", "{0} error when loading: {1}"},
-            {"appletclassloader.findclass.verbose.findclass", "{0} find class {1}"},
             {"appletclassloader.findclass.verbose.openstream", "Opening stream to: {0} to get {1}"},
             {"appletclassloader.getresource.verbose.forname", "AppletClassLoader.getResource for name: {0}"},
             {"appletclassloader.getresource.verbose.found", "Found resource: {0} as a system resource"},
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Thu Mar 31 22:07:32 2011 -0700
@@ -33,6 +33,9 @@
 import sun.misc.Unsafe;
 import java.awt.peer.ComponentPeer;
 
+import java.security.AccessController;
+import java.security.AccessControlContext;
+
 /**
  * The AWTAccessor utility class.
  * The main purpose of this class is to enable accessing
@@ -221,6 +224,13 @@
          * Processes events occurring on this component.
          */
         void processEvent(Component comp, AWTEvent e);
+
+
+        /*
+         * Returns the acc this component was constructed with.
+         */
+        AccessControlContext getAccessControlContext(Component comp);
+
     }
 
     /*
@@ -323,6 +333,13 @@
          * Indicates whether this AWTEvent was generated by the system.
          */
         boolean isSystemGenerated(AWTEvent ev);
+
+
+        /*
+         * Returns the acc this event was constructed with.
+         */
+        AccessControlContext getAccessControlContext(AWTEvent ev);
+
     }
 
     public interface InputEventAccessor {
--- a/jdk/src/share/classes/sun/dyn/Access.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn;
-
-import sun.reflect.Reflection;
-
-/**
- * Access control to this package.
- * Classes in other packages can attempt to acquire the access token,
- * but will fail if they are not recognized as friends.
- * Certain methods in this package, although public, require a non-null
- * access token in order to proceed; they act like package-private methods.
- * @author jrose
- */
-
-public class Access {
-
-    private Access() { }
-
-    /**
-     * The heart of this pattern:  The list of classes which are
-     * permitted to acquire the access token, and become honorary
-     * members of this package.
-     */
-    private static final String[] FRIENDS = {
-        "java.dyn.", "sun.dyn."
-    };
-
-    /**
-     * The following object is NOT public.  That's the point of the pattern.
-     * It is package-private, so that any member of this package
-     * can acquire the access token, and give it away to trusted friends.
-     */
-    static final Access TOKEN = new Access();
-
-    /**
-     * @return Access.TOKEN, if the caller is a friend of this package
-     */
-    public static Access getToken() {
-        Class<?> callc = Reflection.getCallerClass(2);
-        if (isFriend(callc))
-            return TOKEN;
-        else
-            throw new IllegalAccessError("bad caller: " + callc);
-    }
-
-    /** Is the given name the name of a class which could be our friend? */
-    public static boolean isFriendName(String name) {
-        for (String friend : FRIENDS) {
-            if (name.startsWith(friend))
-                return true;
-        }
-        return false;
-    }
-
-    /** Is the given class a friend?  True if {@link #isFriendName},
-     *  and the given class also shares a class loader with us.
-     */
-    public static boolean isFriend(Class<?> c) {
-        return isFriendName(c.getName()) && c.getClassLoader() == CLASS_LOADER;
-    }
-
-    private static final ClassLoader CLASS_LOADER = Access.class.getClassLoader();
-
-    /**
-     * Throw an IllegalAccessError if the caller does not possess
-     * the Access.TOKEN.
-     * @param must be Access.TOKEN
-     */
-    public static void check(Access token) {
-        if (token == null)
-            fail();
-        // else it must be the unique Access.TOKEN
-        assert(token == Access.TOKEN);
-    }
-    private static void fail() {
-        final int CALLER_DEPTH = 3;
-        // 0: Reflection.getCC, 1: this.fail, 2: Access.*, 3: caller
-        Class<?> callc = Reflection.getCallerClass(CALLER_DEPTH);
-        throw new IllegalAccessError("bad caller: " + callc);
-    }
-
-    static {
-        //sun.reflect.Reflection.registerMethodsToFilter(MH.class, "getToken");
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/AdapterMethodHandle.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,974 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import sun.dyn.util.VerifyType;
-import sun.dyn.util.Wrapper;
-import java.dyn.*;
-import java.util.Arrays;
-import static sun.dyn.MethodHandleNatives.Constants.*;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * This method handle performs simple conversion or checking of a single argument.
- * @author jrose
- */
-public class AdapterMethodHandle extends BoundMethodHandle {
-
-    //MethodHandle vmtarget;   // next AMH or BMH in chain or final DMH
-    //Object       argument;   // parameter to the conversion if needed
-    //int          vmargslot;  // which argument slot is affected
-    private final int conversion;  // the type of conversion: RETYPE_ONLY, etc.
-
-    // Constructors in this class *must* be package scoped or private.
-    private AdapterMethodHandle(MethodHandle target, MethodType newType,
-                long conv, Object convArg) {
-        super(newType, convArg, newType.parameterSlotDepth(1+convArgPos(conv)));
-        this.conversion = convCode(conv);
-        if (MethodHandleNatives.JVM_SUPPORT) {
-            // JVM might update VM-specific bits of conversion (ignore)
-            MethodHandleNatives.init(this, target, convArgPos(conv));
-        }
-    }
-    private AdapterMethodHandle(MethodHandle target, MethodType newType,
-                long conv) {
-        this(target, newType, conv, null);
-    }
-
-    private static final Access IMPL_TOKEN = Access.getToken();
-
-    // TO DO:  When adapting another MH with a null conversion, clone
-    // the target and change its type, instead of adding another layer.
-
-    /** Can a JVM-level adapter directly implement the proposed
-     *  argument conversions, as if by MethodHandles.convertArguments?
-     */
-    public static boolean canPairwiseConvert(MethodType newType, MethodType oldType) {
-        // same number of args, of course
-        int len = newType.parameterCount();
-        if (len != oldType.parameterCount())
-            return false;
-
-        // Check return type.  (Not much can be done with it.)
-        Class<?> exp = newType.returnType();
-        Class<?> ret = oldType.returnType();
-        if (!VerifyType.isNullConversion(ret, exp))
-            return false;
-
-        // Check args pairwise.
-        for (int i = 0; i < len; i++) {
-            Class<?> src = newType.parameterType(i); // source type
-            Class<?> dst = oldType.parameterType(i); // destination type
-            if (!canConvertArgument(src, dst))
-                return false;
-        }
-
-        return true;
-    }
-
-    /** Can a JVM-level adapter directly implement the proposed
-     *  argument conversion, as if by MethodHandles.convertArguments?
-     */
-    public static boolean canConvertArgument(Class<?> src, Class<?> dst) {
-        // ? Retool this logic to use RETYPE_ONLY, CHECK_CAST, etc., as opcodes,
-        // so we don't need to repeat so much decision making.
-        if (VerifyType.isNullConversion(src, dst)) {
-            return true;
-        } else if (src.isPrimitive()) {
-            if (dst.isPrimitive())
-                return canPrimCast(src, dst);
-            else
-                return canBoxArgument(src, dst);
-        } else {
-            if (dst.isPrimitive())
-                return canUnboxArgument(src, dst);
-            else
-                return true;  // any two refs can be interconverted
-        }
-    }
-
-    /**
-     * Create a JVM-level adapter method handle to conform the given method
-     * handle to the similar newType, using only pairwise argument conversions.
-     * For each argument, convert incoming argument to the exact type needed.
-     * Only null conversions are allowed on the return value (until
-     * the JVM supports ricochet adapters).
-     * The argument conversions allowed are casting, unboxing,
-     * integral widening or narrowing, and floating point widening or narrowing.
-     * @param token access check
-     * @param newType required call type
-     * @param target original method handle
-     * @return an adapter to the original handle with the desired new type,
-     *          or the original target if the types are already identical
-     *          or null if the adaptation cannot be made
-     */
-    public static MethodHandle makePairwiseConvert(Access token,
-                MethodType newType, MethodHandle target) {
-        Access.check(token);
-        MethodType oldType = target.type();
-        if (newType == oldType)  return target;
-
-        if (!canPairwiseConvert(newType, oldType))
-            return null;
-        // (after this point, it is an assertion error to fail to convert)
-
-        // Find last non-trivial conversion (if any).
-        int lastConv = newType.parameterCount()-1;
-        while (lastConv >= 0) {
-            Class<?> src = newType.parameterType(lastConv); // source type
-            Class<?> dst = oldType.parameterType(lastConv); // destination type
-            if (VerifyType.isNullConversion(src, dst)) {
-                --lastConv;
-            } else {
-                break;
-            }
-        }
-        // Now build a chain of one or more adapters.
-        MethodHandle adapter = target;
-        MethodType midType = oldType.changeReturnType(newType.returnType());
-        for (int i = 0; i <= lastConv; i++) {
-            Class<?> src = newType.parameterType(i); // source type
-            Class<?> dst = midType.parameterType(i); // destination type
-            if (VerifyType.isNullConversion(src, dst)) {
-                // do nothing: difference is trivial
-                continue;
-            }
-            // Work the current type backward toward the desired caller type:
-            if (i != lastConv) {
-                midType = midType.changeParameterType(i, src);
-            } else {
-                // When doing the last (or only) real conversion,
-                // force all remaining null conversions to happen also.
-                assert(VerifyType.isNullConversion(newType, midType.changeParameterType(i, src)));
-                midType = newType;
-            }
-
-            // Tricky case analysis follows.
-            // It parallels canConvertArgument() above.
-            if (src.isPrimitive()) {
-                if (dst.isPrimitive()) {
-                    adapter = makePrimCast(token, midType, adapter, i, dst);
-                } else {
-                    adapter = makeBoxArgument(token, midType, adapter, i, dst);
-                }
-            } else {
-                if (dst.isPrimitive()) {
-                    // Caller has boxed a primitive.  Unbox it for the target.
-                    // The box type must correspond exactly to the primitive type.
-                    // This is simpler than the powerful set of widening
-                    // conversions supported by reflect.Method.invoke.
-                    // Those conversions require a big nest of if/then/else logic,
-                    // which we prefer to make a user responsibility.
-                    adapter = makeUnboxArgument(token, midType, adapter, i, dst);
-                } else {
-                    // Simple reference conversion.
-                    // Note:  Do not check for a class hierarchy relation
-                    // between src and dst.  In all cases a 'null' argument
-                    // will pass the cast conversion.
-                    adapter = makeCheckCast(token, midType, adapter, i, dst);
-                }
-            }
-            assert(adapter != null);
-            assert(adapter.type() == midType);
-        }
-        if (adapter.type() != newType) {
-            // Only trivial conversions remain.
-            adapter = makeRetypeOnly(IMPL_TOKEN, newType, adapter);
-            assert(adapter != null);
-            // Actually, that's because there were no non-trivial ones:
-            assert(lastConv == -1);
-        }
-        assert(adapter.type() == newType);
-        return adapter;
-    }
-
-    /**
-     * Create a JVM-level adapter method handle to permute the arguments
-     * of the given method.
-     * @param token access check
-     * @param newType required call type
-     * @param target original method handle
-     * @param argumentMap for each target argument, position of its source in newType
-     * @return an adapter to the original handle with the desired new type,
-     *          or the original target if the types are already identical
-     *          and the permutation is null
-     * @throws IllegalArgumentException if the adaptation cannot be made
-     *          directly by a JVM-level adapter, without help from Java code
-     */
-    public static MethodHandle makePermutation(Access token,
-                MethodType newType, MethodHandle target,
-                int[] argumentMap) {
-        MethodType oldType = target.type();
-        boolean nullPermutation = true;
-        for (int i = 0; i < argumentMap.length; i++) {
-            int pos = argumentMap[i];
-            if (pos != i)
-                nullPermutation = false;
-            if (pos < 0 || pos >= newType.parameterCount()) {
-                argumentMap = new int[0]; break;
-            }
-        }
-        if (argumentMap.length != oldType.parameterCount())
-            throw newIllegalArgumentException("bad permutation: "+Arrays.toString(argumentMap));
-        if (nullPermutation) {
-            MethodHandle res = makePairwiseConvert(token, newType, target);
-            // well, that was easy
-            if (res == null)
-                throw newIllegalArgumentException("cannot convert pairwise: "+newType);
-            return res;
-        }
-
-        // Check return type.  (Not much can be done with it.)
-        Class<?> exp = newType.returnType();
-        Class<?> ret = oldType.returnType();
-        if (!VerifyType.isNullConversion(ret, exp))
-            throw newIllegalArgumentException("bad return conversion for "+newType);
-
-        // See if the argument types match up.
-        for (int i = 0; i < argumentMap.length; i++) {
-            int j = argumentMap[i];
-            Class<?> src = newType.parameterType(j);
-            Class<?> dst = oldType.parameterType(i);
-            if (!VerifyType.isNullConversion(src, dst))
-                throw newIllegalArgumentException("bad argument #"+j+" conversion for "+newType);
-        }
-
-        // Now figure out a nice mix of SWAP, ROT, DUP, and DROP adapters.
-        // A workable greedy algorithm is as follows:
-        // Drop unused outgoing arguments (right to left: shallowest first).
-        // Duplicate doubly-used outgoing arguments (left to right: deepest first).
-        // Then the remaining problem is a true argument permutation.
-        // Marshal the outgoing arguments as required from left to right.
-        // That is, find the deepest outgoing stack position that does not yet
-        // have the correct argument value, and correct at least that position
-        // by swapping or rotating in the misplaced value (from a shallower place).
-        // If the misplaced value is followed by one or more consecutive values
-        // (also misplaced)  issue a rotation which brings as many as possible
-        // into position.  Otherwise make progress with either a swap or a
-        // rotation.  Prefer the swap as cheaper, but do not use it if it
-        // breaks a slot pair.  Prefer the rotation over the swap if it would
-        // preserve more consecutive values shallower than the target position.
-        // When more than one rotation will work (because the required value
-        // is already adjacent to the target position), then use a rotation
-        // which moves the old value in the target position adjacent to
-        // one of its consecutive values.  Also, prefer shorter rotation
-        // spans, since they use fewer memory cycles for shuffling.
-
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    private static byte basicType(Class<?> type) {
-        if (type == null)  return T_VOID;
-        switch (Wrapper.forBasicType(type)) {
-            case BOOLEAN:  return T_BOOLEAN;
-            case CHAR:     return T_CHAR;
-            case FLOAT:    return T_FLOAT;
-            case DOUBLE:   return T_DOUBLE;
-            case BYTE:     return T_BYTE;
-            case SHORT:    return T_SHORT;
-            case INT:      return T_INT;
-            case LONG:     return T_LONG;
-            case OBJECT:   return T_OBJECT;
-            case VOID:     return T_VOID;
-        }
-        return 99; // T_ILLEGAL or some such
-    }
-
-    /** Number of stack slots for the given type.
-     *  Two for T_DOUBLE and T_FLOAT, one for the rest.
-     */
-    private static int type2size(int type) {
-        assert(type >= T_BOOLEAN && type <= T_OBJECT);
-        return (type == T_LONG || type == T_DOUBLE) ? 2 : 1;
-    }
-    private static int type2size(Class<?> type) {
-        return type2size(basicType(type));
-    }
-
-    /** The given stackMove is the number of slots pushed.
-     * It might be negative.  Scale it (multiply) by the
-     * VM's notion of how an address changes with a push,
-     * to get the raw SP change for stackMove.
-     * Then shift and mask it into the correct field.
-     */
-    private static long insertStackMove(int stackMove) {
-        // following variable must be long to avoid sign extension after '<<'
-        long spChange = stackMove * MethodHandleNatives.JVM_STACK_MOVE_UNIT;
-        return (spChange & CONV_STACK_MOVE_MASK) << CONV_STACK_MOVE_SHIFT;
-    }
-
-    /** Construct an adapter conversion descriptor for a single-argument conversion. */
-    private static long makeConv(int convOp, int argnum, int src, int dest) {
-        assert(src  == (src  & 0xF));
-        assert(dest == (dest & 0xF));
-        assert(convOp >= OP_CHECK_CAST && convOp <= OP_PRIM_TO_REF);
-        int stackMove = type2size(dest) - type2size(src);
-        return ((long) argnum << 32 |
-                (long) convOp << CONV_OP_SHIFT |
-                (int)  src    << CONV_SRC_TYPE_SHIFT |
-                (int)  dest   << CONV_DEST_TYPE_SHIFT |
-                insertStackMove(stackMove)
-                );
-    }
-    private static long makeConv(int convOp, int argnum, int stackMove) {
-        assert(convOp >= OP_DUP_ARGS && convOp <= OP_SPREAD_ARGS);
-        byte src = 0, dest = 0;
-        if (convOp >= OP_COLLECT_ARGS && convOp <= OP_SPREAD_ARGS)
-            src = dest = T_OBJECT;
-        return ((long) argnum << 32 |
-                (long) convOp << CONV_OP_SHIFT |
-                (int)  src    << CONV_SRC_TYPE_SHIFT |
-                (int)  dest   << CONV_DEST_TYPE_SHIFT |
-                insertStackMove(stackMove)
-                );
-    }
-    private static long makeSwapConv(int convOp, int srcArg, byte type, int destSlot) {
-        assert(convOp >= OP_SWAP_ARGS && convOp <= OP_ROT_ARGS);
-        return ((long) srcArg << 32 |
-                (long) convOp << CONV_OP_SHIFT |
-                (int)  type   << CONV_SRC_TYPE_SHIFT |
-                (int)  type   << CONV_DEST_TYPE_SHIFT |
-                (int)  destSlot << CONV_VMINFO_SHIFT
-                );
-    }
-    private static long makeConv(int convOp) {
-        assert(convOp == OP_RETYPE_ONLY || convOp == OP_RETYPE_RAW);
-        return ((long)-1 << 32) | (convOp << CONV_OP_SHIFT);   // stackMove, src, dst all zero
-    }
-    private static int convCode(long conv) {
-        return (int)conv;
-    }
-    private static int convArgPos(long conv) {
-        return (int)(conv >>> 32);
-    }
-    private static boolean convOpSupported(int convOp) {
-        assert(convOp >= 0 && convOp <= CONV_OP_LIMIT);
-        return ((1<<convOp) & MethodHandleNatives.CONV_OP_IMPLEMENTED_MASK) != 0;
-    }
-
-    /** One of OP_RETYPE_ONLY, etc. */
-    int conversionOp() { return (conversion & CONV_OP_MASK) >> CONV_OP_SHIFT; }
-
-    /* Return one plus the position of the first non-trivial difference
-     * between the given types.  This is not a symmetric operation;
-     * we are considering adapting the targetType to adapterType.
-     * Trivial differences are those which could be ignored by the JVM
-     * without subverting the verifier.  Otherwise, adaptable differences
-     * are ones for which we could create an adapter to make the type change.
-     * Return zero if there are no differences (other than trivial ones).
-     * Return 1+N if N is the only adaptable argument difference.
-     * Return the -2-N where N is the first of several adaptable
-     * argument differences.
-     * Return -1 if there there are differences which are not adaptable.
-     */
-    private static int diffTypes(MethodType adapterType,
-                                 MethodType targetType,
-                                 boolean raw) {
-        int diff;
-        diff = diffReturnTypes(adapterType, targetType, raw);
-        if (diff != 0)  return diff;
-        int nargs = adapterType.parameterCount();
-        if (nargs != targetType.parameterCount())
-            return -1;
-        diff = diffParamTypes(adapterType, 0, targetType, 0, nargs, raw);
-        //System.out.println("diff "+adapterType);
-        //System.out.println("  "+diff+" "+targetType);
-        return diff;
-    }
-    private static int diffReturnTypes(MethodType adapterType,
-                                       MethodType targetType,
-                                       boolean raw) {
-        Class<?> src = targetType.returnType();
-        Class<?> dst = adapterType.returnType();
-        if ((!raw
-             ? VerifyType.canPassUnchecked(src, dst)
-             : VerifyType.canPassRaw(src, dst)
-             ) > 0)
-            return 0;  // no significant difference
-        if (raw && !src.isPrimitive() && !dst.isPrimitive())
-            return 0;  // can force a reference return (very carefully!)
-        //if (false)  return 1;  // never adaptable!
-        return -1;  // some significant difference
-    }
-    private static int diffParamTypes(MethodType adapterType, int astart,
-                                      MethodType targetType, int tstart,
-                                      int nargs, boolean raw) {
-        assert(nargs >= 0);
-        int res = 0;
-        for (int i = 0; i < nargs; i++) {
-            Class<?> src  = adapterType.parameterType(astart+i);
-            Class<?> dest = targetType.parameterType(tstart+i);
-            if ((!raw
-                 ? VerifyType.canPassUnchecked(src, dest)
-                 : VerifyType.canPassRaw(src, dest)
-                ) <= 0) {
-                // found a difference; is it the only one so far?
-                if (res != 0)
-                    return -1-res; // return -2-i for prev. i
-                res = 1+i;
-            }
-        }
-        return res;
-    }
-
-    /** Can a retyping adapter (alone) validly convert the target to newType? */
-    public static boolean canRetypeOnly(MethodType newType, MethodType targetType) {
-        return canRetype(newType, targetType, false);
-    }
-    /** Can a retyping adapter (alone) convert the target to newType?
-     *  It is allowed to widen subword types and void to int, to make bitwise
-     *  conversions between float/int and double/long, and to perform unchecked
-     *  reference conversions on return.  This last feature requires that the
-     *  caller be trusted, and perform explicit cast conversions on return values.
-     */
-    public static boolean canRetypeRaw(MethodType newType, MethodType targetType) {
-        return canRetype(newType, targetType, true);
-    }
-    static boolean canRetype(MethodType newType, MethodType targetType, boolean raw) {
-        if (!convOpSupported(raw ? OP_RETYPE_RAW : OP_RETYPE_ONLY))  return false;
-        int diff = diffTypes(newType, targetType, raw);
-        // %%% This assert is too strong.  Factor diff into VerifyType and reconcile.
-        assert(raw || (diff == 0) == VerifyType.isNullConversion(newType, targetType));
-        return diff == 0;
-    }
-
-    /** Factory method:  Performs no conversions; simply retypes the adapter.
-     *  Allows unchecked argument conversions pairwise, if they are safe.
-     *  Returns null if not possible.
-     */
-    public static MethodHandle makeRetypeOnly(Access token,
-                MethodType newType, MethodHandle target) {
-        return makeRetype(token, newType, target, false);
-    }
-    public static MethodHandle makeRetypeRaw(Access token,
-                MethodType newType, MethodHandle target) {
-        return makeRetype(token, newType, target, true);
-    }
-    static MethodHandle makeRetype(Access token,
-                MethodType newType, MethodHandle target, boolean raw) {
-        Access.check(token);
-        MethodType oldType = target.type();
-        if (oldType == newType)  return target;
-        if (!canRetype(newType, oldType, raw))
-            return null;
-        // TO DO:  clone the target guy, whatever he is, with new type.
-        return new AdapterMethodHandle(target, newType, makeConv(raw ? OP_RETYPE_RAW : OP_RETYPE_ONLY));
-    }
-
-    static MethodHandle makeVarargsCollector(Access token,
-                MethodHandle target, Class<?> arrayType) {
-        Access.check(token);
-        return new AsVarargsCollector(target, arrayType);
-    }
-
-    static class AsVarargsCollector extends AdapterMethodHandle {
-        final MethodHandle target;
-        final Class<?> arrayType;
-        MethodHandle cache;
-
-        AsVarargsCollector(MethodHandle target, Class<?> arrayType) {
-            super(target, target.type(), makeConv(OP_RETYPE_ONLY));
-            this.target = target;
-            this.arrayType = arrayType;
-            this.cache = target.asCollector(arrayType, 0);
-        }
-
-        @Override
-        public boolean isVarargsCollector() {
-            return true;
-        }
-
-        @Override
-        public MethodHandle asType(MethodType newType) {
-            MethodType type = this.type();
-            int collectArg = type.parameterCount() - 1;
-            int newArity = newType.parameterCount();
-            if (newArity == collectArg+1 &&
-                type.parameterType(collectArg).isAssignableFrom(newType.parameterType(collectArg))) {
-                // if arity and trailing parameter are compatible, do normal thing
-                return super.asType(newType);
-            }
-            // check cache
-            if (cache.type().parameterCount() == newArity)
-                return cache.asType(newType);
-            // build and cache a collector
-            int arrayLength = newArity - collectArg;
-            MethodHandle collector;
-            try {
-                collector = target.asCollector(arrayType, arrayLength);
-            } catch (IllegalArgumentException ex) {
-                throw new WrongMethodTypeException("cannot build collector");
-            }
-            cache = collector;
-            return collector.asType(newType);
-        }
-
-        public MethodHandle asVarargsCollector(Class<?> arrayType) {
-            MethodType type = this.type();
-            if (type.parameterType(type.parameterCount()-1) == arrayType)
-                return this;
-            return super.asVarargsCollector(arrayType);
-        }
-    }
-
-    /** Can a checkcast adapter validly convert the target to newType?
-     *  The JVM supports all kind of reference casts, even silly ones.
-     */
-    public static boolean canCheckCast(MethodType newType, MethodType targetType,
-                int arg, Class<?> castType) {
-        if (!convOpSupported(OP_CHECK_CAST))  return false;
-        Class<?> src = newType.parameterType(arg);
-        Class<?> dst = targetType.parameterType(arg);
-        if (!canCheckCast(src, castType)
-                || !VerifyType.isNullConversion(castType, dst))
-            return false;
-        int diff = diffTypes(newType, targetType, false);
-        return (diff == arg+1);  // arg is sole non-trivial diff
-    }
-    /** Can an primitive conversion adapter validly convert src to dst? */
-    public static boolean canCheckCast(Class<?> src, Class<?> dst) {
-        return (!src.isPrimitive() && !dst.isPrimitive());
-    }
-
-    /** Factory method:  Forces a cast at the given argument.
-     *  The castType is the target of the cast, and can be any type
-     *  with a null conversion to the corresponding target parameter.
-     *  Return null if this cannot be done.
-     */
-    public static MethodHandle makeCheckCast(Access token,
-                MethodType newType, MethodHandle target,
-                int arg, Class<?> castType) {
-        Access.check(token);
-        if (!canCheckCast(newType, target.type(), arg, castType))
-            return null;
-        long conv = makeConv(OP_CHECK_CAST, arg, T_OBJECT, T_OBJECT);
-        return new AdapterMethodHandle(target, newType, conv, castType);
-    }
-
-    /** Can an primitive conversion adapter validly convert the target to newType?
-     *  The JVM currently supports all conversions except those between
-     *  floating and integral types.
-     */
-    public static boolean canPrimCast(MethodType newType, MethodType targetType,
-                int arg, Class<?> convType) {
-        if (!convOpSupported(OP_PRIM_TO_PRIM))  return false;
-        Class<?> src = newType.parameterType(arg);
-        Class<?> dst = targetType.parameterType(arg);
-        if (!canPrimCast(src, convType)
-                || !VerifyType.isNullConversion(convType, dst))
-            return false;
-        int diff = diffTypes(newType, targetType, false);
-        return (diff == arg+1);  // arg is sole non-trivial diff
-    }
-    /** Can an primitive conversion adapter validly convert src to dst? */
-    public static boolean canPrimCast(Class<?> src, Class<?> dst) {
-        if (src == dst || !src.isPrimitive() || !dst.isPrimitive()) {
-            return false;
-        } else if (Wrapper.forPrimitiveType(dst).isFloating()) {
-            // both must be floating types
-            return Wrapper.forPrimitiveType(src).isFloating();
-        } else {
-            // both are integral, and all combinations work fine
-            assert(Wrapper.forPrimitiveType(src).isIntegral() &&
-                   Wrapper.forPrimitiveType(dst).isIntegral());
-            return true;
-        }
-    }
-
-    /** Factory method:  Truncate the given argument with zero or sign extension,
-     *  and/or convert between single and doubleword versions of integer or float.
-     *  The convType is the target of the conversion, and can be any type
-     *  with a null conversion to the corresponding target parameter.
-     *  Return null if this cannot be done.
-     */
-    public static MethodHandle makePrimCast(Access token,
-                MethodType newType, MethodHandle target,
-                int arg, Class<?> convType) {
-        Access.check(token);
-        MethodType oldType = target.type();
-        if (!canPrimCast(newType, oldType, arg, convType))
-            return null;
-        Class<?> src = newType.parameterType(arg);
-        long conv = makeConv(OP_PRIM_TO_PRIM, arg, basicType(src), basicType(convType));
-        return new AdapterMethodHandle(target, newType, conv);
-    }
-
-    /** Can an unboxing conversion validly convert src to dst?
-     *  The JVM currently supports all kinds of casting and unboxing.
-     *  The convType is the unboxed type; it can be either a primitive or wrapper.
-     */
-    public static boolean canUnboxArgument(MethodType newType, MethodType targetType,
-                int arg, Class<?> convType) {
-        if (!convOpSupported(OP_REF_TO_PRIM))  return false;
-        Class<?> src = newType.parameterType(arg);
-        Class<?> dst = targetType.parameterType(arg);
-        Class<?> boxType = Wrapper.asWrapperType(convType);
-        convType = Wrapper.asPrimitiveType(convType);
-        if (!canCheckCast(src, boxType)
-                || boxType == convType
-                || !VerifyType.isNullConversion(convType, dst))
-            return false;
-        int diff = diffTypes(newType, targetType, false);
-        return (diff == arg+1);  // arg is sole non-trivial diff
-    }
-    /** Can an primitive unboxing adapter validly convert src to dst? */
-    public static boolean canUnboxArgument(Class<?> src, Class<?> dst) {
-        return (!src.isPrimitive() && Wrapper.asPrimitiveType(dst).isPrimitive());
-    }
-
-    /** Factory method:  Unbox the given argument.
-     *  Return null if this cannot be done.
-     */
-    public static MethodHandle makeUnboxArgument(Access token,
-                MethodType newType, MethodHandle target,
-                int arg, Class<?> convType) {
-        MethodType oldType = target.type();
-        Class<?> src = newType.parameterType(arg);
-        Class<?> dst = oldType.parameterType(arg);
-        Class<?> boxType = Wrapper.asWrapperType(convType);
-        Class<?> primType = Wrapper.asPrimitiveType(convType);
-        if (!canUnboxArgument(newType, oldType, arg, convType))
-            return null;
-        MethodType castDone = newType;
-        if (!VerifyType.isNullConversion(src, boxType))
-            castDone = newType.changeParameterType(arg, boxType);
-        long conv = makeConv(OP_REF_TO_PRIM, arg, T_OBJECT, basicType(primType));
-        MethodHandle adapter = new AdapterMethodHandle(target, castDone, conv, boxType);
-        if (castDone == newType)
-            return adapter;
-        return makeCheckCast(token, newType, adapter, arg, boxType);
-    }
-
-    /** Can an primitive boxing adapter validly convert src to dst? */
-    public static boolean canBoxArgument(Class<?> src, Class<?> dst) {
-        if (!convOpSupported(OP_PRIM_TO_REF))  return false;
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    /** Factory method:  Unbox the given argument.
-     *  Return null if this cannot be done.
-     */
-    public static MethodHandle makeBoxArgument(Access token,
-                MethodType newType, MethodHandle target,
-                int arg, Class<?> convType) {
-        // this is difficult to do in the JVM because it must GC
-        return null;
-    }
-
-    /** Can an adapter simply drop arguments to convert the target to newType? */
-    public static boolean canDropArguments(MethodType newType, MethodType targetType,
-                int dropArgPos, int dropArgCount) {
-        if (dropArgCount == 0)
-            return canRetypeOnly(newType, targetType);
-        if (!convOpSupported(OP_DROP_ARGS))  return false;
-        if (diffReturnTypes(newType, targetType, false) != 0)
-            return false;
-        int nptypes = newType.parameterCount();
-        // parameter types must be the same up to the drop point
-        if (dropArgPos != 0 && diffParamTypes(newType, 0, targetType, 0, dropArgPos, false) != 0)
-            return false;
-        int afterPos = dropArgPos + dropArgCount;
-        int afterCount = nptypes - afterPos;
-        if (dropArgPos < 0 || dropArgPos >= nptypes ||
-            dropArgCount < 1 || afterPos > nptypes ||
-            targetType.parameterCount() != nptypes - dropArgCount)
-            return false;
-        // parameter types after the drop point must also be the same
-        if (afterCount != 0 && diffParamTypes(newType, afterPos, targetType, dropArgPos, afterCount, false) != 0)
-            return false;
-        return true;
-    }
-
-    /** Factory method:  Drop selected arguments.
-     *  Allow unchecked retyping of remaining arguments, pairwise.
-     *  Return null if this is not possible.
-     */
-    public static MethodHandle makeDropArguments(Access token,
-                MethodType newType, MethodHandle target,
-                int dropArgPos, int dropArgCount) {
-        Access.check(token);
-        if (dropArgCount == 0)
-            return makeRetypeOnly(IMPL_TOKEN, newType, target);
-        if (!canDropArguments(newType, target.type(), dropArgPos, dropArgCount))
-            return null;
-        // in  arglist: [0: ...keep1 | dpos: drop... | dpos+dcount: keep2... ]
-        // out arglist: [0: ...keep1 |                        dpos: keep2... ]
-        int keep2InPos  = dropArgPos + dropArgCount;
-        int dropSlot    = newType.parameterSlotDepth(keep2InPos);
-        int keep1InSlot = newType.parameterSlotDepth(dropArgPos);
-        int slotCount   = keep1InSlot - dropSlot;
-        assert(slotCount >= dropArgCount);
-        assert(target.type().parameterSlotCount() + slotCount == newType.parameterSlotCount());
-        long conv = makeConv(OP_DROP_ARGS, dropArgPos + dropArgCount - 1, -slotCount);
-        return new AdapterMethodHandle(target, newType, conv);
-    }
-
-    /** Can an adapter duplicate an argument to convert the target to newType? */
-    public static boolean canDupArguments(MethodType newType, MethodType targetType,
-                int dupArgPos, int dupArgCount) {
-        if (!convOpSupported(OP_DUP_ARGS))  return false;
-        if (diffReturnTypes(newType, targetType, false) != 0)
-            return false;
-        int nptypes = newType.parameterCount();
-        if (dupArgCount < 0 || dupArgPos + dupArgCount > nptypes)
-            return false;
-        if (targetType.parameterCount() != nptypes + dupArgCount)
-            return false;
-        // parameter types must be the same up to the duplicated arguments
-        if (diffParamTypes(newType, 0, targetType, 0, nptypes, false) != 0)
-            return false;
-        // duplicated types must be, well, duplicates
-        if (diffParamTypes(newType, dupArgPos, targetType, nptypes, dupArgCount, false) != 0)
-            return false;
-        return true;
-    }
-
-    /** Factory method:  Duplicate the selected argument.
-     *  Return null if this is not possible.
-     */
-    public static MethodHandle makeDupArguments(Access token,
-                MethodType newType, MethodHandle target,
-                int dupArgPos, int dupArgCount) {
-        Access.check(token);
-        if (!canDupArguments(newType, target.type(), dupArgPos, dupArgCount))
-            return null;
-        if (dupArgCount == 0)
-            return target;
-        // in  arglist: [0: ...keep1 | dpos: dup... | dpos+dcount: keep2... ]
-        // out arglist: [0: ...keep1 | dpos: dup... | dpos+dcount: keep2... | dup... ]
-        int keep2InPos  = dupArgPos + dupArgCount;
-        int dupSlot     = newType.parameterSlotDepth(keep2InPos);
-        int keep1InSlot = newType.parameterSlotDepth(dupArgPos);
-        int slotCount   = keep1InSlot - dupSlot;
-        assert(target.type().parameterSlotCount() - slotCount == newType.parameterSlotCount());
-        long conv = makeConv(OP_DUP_ARGS, dupArgPos + dupArgCount - 1, slotCount);
-        return new AdapterMethodHandle(target, newType, conv);
-    }
-
-    /** Can an adapter swap two arguments to convert the target to newType? */
-    public static boolean canSwapArguments(MethodType newType, MethodType targetType,
-                int swapArg1, int swapArg2) {
-        if (!convOpSupported(OP_SWAP_ARGS))  return false;
-        if (diffReturnTypes(newType, targetType, false) != 0)
-            return false;
-        if (swapArg1 >= swapArg2)  return false;  // caller resp
-        int nptypes = newType.parameterCount();
-        if (targetType.parameterCount() != nptypes)
-            return false;
-        if (swapArg1 < 0 || swapArg2 >= nptypes)
-            return false;
-        if (diffParamTypes(newType, 0, targetType, 0, swapArg1, false) != 0)
-            return false;
-        if (diffParamTypes(newType, swapArg1, targetType, swapArg2, 1, false) != 0)
-            return false;
-        if (diffParamTypes(newType, swapArg1+1, targetType, swapArg1+1, swapArg2-swapArg1-1, false) != 0)
-            return false;
-        if (diffParamTypes(newType, swapArg2, targetType, swapArg1, 1, false) != 0)
-            return false;
-        if (diffParamTypes(newType, swapArg2+1, targetType, swapArg2+1, nptypes-swapArg2-1, false) != 0)
-            return false;
-        return true;
-    }
-
-    /** Factory method:  Swap the selected arguments.
-     *  Return null if this is not possible.
-     */
-    public static MethodHandle makeSwapArguments(Access token,
-                MethodType newType, MethodHandle target,
-                int swapArg1, int swapArg2) {
-        Access.check(token);
-        if (swapArg1 == swapArg2)
-            return target;
-        if (swapArg1 > swapArg2) { int t = swapArg1; swapArg1 = swapArg2; swapArg2 = t; }
-        if (!canSwapArguments(newType, target.type(), swapArg1, swapArg2))
-            return null;
-        Class<?> swapType = newType.parameterType(swapArg1);
-        // in  arglist: [0: ...keep1 | pos1: a1 | pos1+1: keep2... | pos2: a2 | pos2+1: keep3... ]
-        // out arglist: [0: ...keep1 | pos1: a2 | pos1+1: keep2... | pos2: a1 | pos2+1: keep3... ]
-        int swapSlot2  = newType.parameterSlotDepth(swapArg2 + 1);
-        long conv = makeSwapConv(OP_SWAP_ARGS, swapArg1, basicType(swapType), swapSlot2);
-        return new AdapterMethodHandle(target, newType, conv);
-    }
-
-    static int positiveRotation(int argCount, int rotateBy) {
-        assert(argCount > 0);
-        if (rotateBy >= 0) {
-            if (rotateBy < argCount)
-                return rotateBy;
-            return rotateBy % argCount;
-        } else if (rotateBy >= -argCount) {
-            return rotateBy + argCount;
-        } else {
-            return (-1-((-1-rotateBy) % argCount)) + argCount;
-        }
-    }
-
-    final static int MAX_ARG_ROTATION = 1;
-
-    /** Can an adapter rotate arguments to convert the target to newType? */
-    public static boolean canRotateArguments(MethodType newType, MethodType targetType,
-                int firstArg, int argCount, int rotateBy) {
-        if (!convOpSupported(OP_ROT_ARGS))  return false;
-        if (argCount <= 2)  return false;  // must be a swap, not a rotate
-        rotateBy = positiveRotation(argCount, rotateBy);
-        if (rotateBy == 0)  return false;  // no rotation
-        if (rotateBy > MAX_ARG_ROTATION && rotateBy < argCount - MAX_ARG_ROTATION)
-            return false;  // too many argument positions
-        // Rotate incoming args right N to the out args, N in 1..(argCouunt-1).
-        if (diffReturnTypes(newType, targetType, false) != 0)
-            return false;
-        int nptypes = newType.parameterCount();
-        if (targetType.parameterCount() != nptypes)
-            return false;
-        if (firstArg < 0 || firstArg >= nptypes)  return false;
-        int argLimit = firstArg + argCount;
-        if (argLimit > nptypes)  return false;
-        if (diffParamTypes(newType, 0, targetType, 0, firstArg, false) != 0)
-            return false;
-        int newChunk1 = argCount - rotateBy, newChunk2 = rotateBy;
-        // swap new chunk1 with target chunk2
-        if (diffParamTypes(newType, firstArg, targetType, argLimit-newChunk1, newChunk1, false) != 0)
-            return false;
-        // swap new chunk2 with target chunk1
-        if (diffParamTypes(newType, firstArg+newChunk1, targetType, firstArg, newChunk2, false) != 0)
-            return false;
-        return true;
-    }
-
-    /** Factory method:  Rotate the selected argument range.
-     *  Return null if this is not possible.
-     */
-    public static MethodHandle makeRotateArguments(Access token,
-                MethodType newType, MethodHandle target,
-                int firstArg, int argCount, int rotateBy) {
-        Access.check(token);
-        rotateBy = positiveRotation(argCount, rotateBy);
-        if (!canRotateArguments(newType, target.type(), firstArg, argCount, rotateBy))
-            return null;
-        // Decide whether it should be done as a right or left rotation,
-        // on the JVM stack.  Return the number of stack slots to rotate by,
-        // positive if right, negative if left.
-        int limit = firstArg + argCount;
-        int depth0 = newType.parameterSlotDepth(firstArg);
-        int depth1 = newType.parameterSlotDepth(limit-rotateBy);
-        int depth2 = newType.parameterSlotDepth(limit);
-        int chunk1Slots = depth0 - depth1; assert(chunk1Slots > 0);
-        int chunk2Slots = depth1 - depth2; assert(chunk2Slots > 0);
-        // From here on out, it assumes a single-argument shift.
-        assert(MAX_ARG_ROTATION == 1);
-        int srcArg, dstArg;
-        byte basicType;
-        if (chunk2Slots <= chunk1Slots) {
-            // Rotate right/down N (rotateBy = +N, N small, c2 small):
-            // in  arglist: [0: ...keep1 | arg1: c1...  | limit-N: c2 | limit: keep2... ]
-            // out arglist: [0: ...keep1 | arg1: c2 | arg1+N: c1...   | limit: keep2... ]
-            srcArg = limit-1;
-            dstArg = firstArg;
-            basicType = basicType(newType.parameterType(srcArg));
-            assert(chunk2Slots == type2size(basicType));
-        } else {
-            // Rotate left/up N (rotateBy = -N, N small, c1 small):
-            // in  arglist: [0: ...keep1 | arg1: c1 | arg1+N: c2...   | limit: keep2... ]
-            // out arglist: [0: ...keep1 | arg1: c2 ... | limit-N: c1 | limit: keep2... ]
-            srcArg = firstArg;
-            dstArg = limit-1;
-            basicType = basicType(newType.parameterType(srcArg));
-            assert(chunk1Slots == type2size(basicType));
-        }
-        int dstSlot = newType.parameterSlotDepth(dstArg + 1);
-        long conv = makeSwapConv(OP_ROT_ARGS, srcArg, basicType, dstSlot);
-        return new AdapterMethodHandle(target, newType, conv);
-    }
-
-    /** Can an adapter spread an argument to convert the target to newType? */
-    public static boolean canSpreadArguments(MethodType newType, MethodType targetType,
-                Class<?> spreadArgType, int spreadArgPos, int spreadArgCount) {
-        if (!convOpSupported(OP_SPREAD_ARGS))  return false;
-        if (diffReturnTypes(newType, targetType, false) != 0)
-            return false;
-        int nptypes = newType.parameterCount();
-        // parameter types must be the same up to the spread point
-        if (spreadArgPos != 0 && diffParamTypes(newType, 0, targetType, 0, spreadArgPos, false) != 0)
-            return false;
-        int afterPos = spreadArgPos + spreadArgCount;
-        int afterCount = nptypes - (spreadArgPos + 1);
-        if (spreadArgPos < 0 || spreadArgPos >= nptypes ||
-            spreadArgCount < 0 ||
-            targetType.parameterCount() != afterPos + afterCount)
-            return false;
-        // parameter types after the spread point must also be the same
-        if (afterCount != 0 && diffParamTypes(newType, spreadArgPos+1, targetType, afterPos, afterCount, false) != 0)
-            return false;
-        // match the array element type to the spread arg types
-        Class<?> rawSpreadArgType = newType.parameterType(spreadArgPos);
-        if (rawSpreadArgType != spreadArgType && !canCheckCast(rawSpreadArgType, spreadArgType))
-            return false;
-        for (int i = 0; i < spreadArgCount; i++) {
-            Class<?> src = VerifyType.spreadArgElementType(spreadArgType, i);
-            Class<?> dst = targetType.parameterType(spreadArgPos + i);
-            if (src == null || !VerifyType.isNullConversion(src, dst))
-                return false;
-        }
-        return true;
-    }
-
-
-    /** Factory method:  Spread selected argument. */
-    public static MethodHandle makeSpreadArguments(Access token,
-                MethodType newType, MethodHandle target,
-                Class<?> spreadArgType, int spreadArgPos, int spreadArgCount) {
-        Access.check(token);
-        MethodType targetType = target.type();
-        if (!canSpreadArguments(newType, targetType, spreadArgType, spreadArgPos, spreadArgCount))
-            return null;
-        // in  arglist: [0: ...keep1 | spos: spreadArg | spos+1:      keep2... ]
-        // out arglist: [0: ...keep1 | spos: spread... | spos+scount: keep2... ]
-        int keep2OutPos  = spreadArgPos + spreadArgCount;
-        int spreadSlot   = targetType.parameterSlotDepth(keep2OutPos);
-        int keep1OutSlot = targetType.parameterSlotDepth(spreadArgPos);
-        int slotCount    = keep1OutSlot - spreadSlot;
-        assert(spreadSlot == newType.parameterSlotDepth(spreadArgPos+1));
-        assert(slotCount >= spreadArgCount);
-        long conv = makeConv(OP_SPREAD_ARGS, spreadArgPos, slotCount-1);
-        MethodHandle res = new AdapterMethodHandle(target, newType, conv, spreadArgType);
-        assert(res.type().parameterType(spreadArgPos) == spreadArgType);
-        return res;
-    }
-
-    // TO DO: makeCollectArguments, makeFlyby, makeRicochet
-
-    @Override
-    public String toString() {
-        return MethodHandleImpl.getNameString(IMPL_TOKEN, nonAdapter((MethodHandle)vmtarget), this);
-    }
-
-    private static MethodHandle nonAdapter(MethodHandle mh) {
-        while (mh instanceof AdapterMethodHandle) {
-            mh = (MethodHandle) mh.vmtarget;
-        }
-        return mh;
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/BoundMethodHandle.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn;
-
-import sun.dyn.util.VerifyType;
-import sun.dyn.util.Wrapper;
-import java.dyn.*;
-import java.util.List;
-import sun.dyn.MethodHandleNatives.Constants;
-import static sun.dyn.MethodHandleImpl.IMPL_LOOKUP;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * The flavor of method handle which emulates an invoke instruction
- * on a predetermined argument.  The JVM dispatches to the correct method
- * when the handle is created, not when it is invoked.
- * @author jrose
- */
-public class BoundMethodHandle extends MethodHandle {
-    //MethodHandle vmtarget;           // next BMH or final DMH or methodOop
-    private final Object argument;     // argument to insert
-    private final int    vmargslot;    // position at which it is inserted
-
-    private static final Access IMPL_TOKEN = Access.getToken();
-    private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory(IMPL_TOKEN);
-
-    // Constructors in this class *must* be package scoped or private.
-
-    /** Bind a direct MH to its receiver (or first ref. argument).
-     *  The JVM will pre-dispatch the MH if it is not already static.
-     */
-    BoundMethodHandle(DirectMethodHandle mh, Object argument) {
-        super(Access.TOKEN, mh.type().dropParameterTypes(0, 1));
-        // check the type now, once for all:
-        this.argument = checkReferenceArgument(argument, mh, 0);
-        this.vmargslot = this.type().parameterSlotCount();
-        if (MethodHandleNatives.JVM_SUPPORT) {
-            this.vmtarget = null;  // maybe updated by JVM
-            MethodHandleNatives.init(this, mh, 0);
-        } else {
-            this.vmtarget = mh;
-        }
-    }
-
-    /** Insert an argument into an arbitrary method handle.
-     *  If argnum is zero, inserts the first argument, etc.
-     *  The argument type must be a reference.
-     */
-    BoundMethodHandle(MethodHandle mh, Object argument, int argnum) {
-        this(mh.type().dropParameterTypes(argnum, argnum+1),
-             mh, argument, argnum);
-    }
-
-    /** Insert an argument into an arbitrary method handle.
-     *  If argnum is zero, inserts the first argument, etc.
-     */
-    BoundMethodHandle(MethodType type, MethodHandle mh, Object argument, int argnum) {
-        super(Access.TOKEN, type);
-        if (mh.type().parameterType(argnum).isPrimitive())
-            this.argument = bindPrimitiveArgument(argument, mh, argnum);
-        else {
-            this.argument = checkReferenceArgument(argument, mh, argnum);
-        }
-        this.vmargslot = type.parameterSlotDepth(argnum);
-        initTarget(mh, argnum);
-    }
-
-    private void initTarget(MethodHandle mh, int argnum) {
-        if (MethodHandleNatives.JVM_SUPPORT) {
-            this.vmtarget = null; // maybe updated by JVM
-            MethodHandleNatives.init(this, mh, argnum);
-        } else {
-            this.vmtarget = mh;
-        }
-    }
-
-    /** For the AdapterMethodHandle subclass.
-     */
-    BoundMethodHandle(MethodType type, Object argument, int vmargslot) {
-        super(Access.TOKEN, type);
-        this.argument = argument;
-        this.vmargslot = vmargslot;
-        assert(this instanceof AdapterMethodHandle);
-    }
-
-    /** Initialize the current object as a self-bound method handle, binding it
-     *  as the first argument of the method handle {@code entryPoint}.
-     *  The invocation type of the resulting method handle will be the
-     *  same as {@code entryPoint},  except that the first argument
-     *  type will be dropped.
-     */
-    protected BoundMethodHandle(Access token, MethodHandle entryPoint) {
-        super(token, entryPoint.type().dropParameterTypes(0, 1));
-        this.argument = this; // kludge; get rid of
-        this.vmargslot = this.type().parameterSlotDepth(0);
-        initTarget(entryPoint, 0);
-    }
-
-    /** Make sure the given {@code argument} can be used as {@code argnum}-th
-     *  parameter of the given method handle {@code mh}, which must be a reference.
-     *  <p>
-     *  If this fails, throw a suitable {@code WrongMethodTypeException},
-     *  which will prevent the creation of an illegally typed bound
-     *  method handle.
-     */
-    final static Object checkReferenceArgument(Object argument, MethodHandle mh, int argnum) {
-        Class<?> ptype = mh.type().parameterType(argnum);
-        if (ptype.isPrimitive()) {
-            // fail
-        } else if (argument == null) {
-            return null;
-        } else if (VerifyType.isNullReferenceConversion(argument.getClass(), ptype)) {
-            return argument;
-        }
-        throw badBoundArgumentException(argument, mh, argnum);
-    }
-
-    /** Make sure the given {@code argument} can be used as {@code argnum}-th
-     *  parameter of the given method handle {@code mh}, which must be a primitive.
-     *  <p>
-     *  If this fails, throw a suitable {@code WrongMethodTypeException},
-     *  which will prevent the creation of an illegally typed bound
-     *  method handle.
-     */
-    final static Object bindPrimitiveArgument(Object argument, MethodHandle mh, int argnum) {
-        Class<?> ptype = mh.type().parameterType(argnum);
-        Wrapper  wrap = Wrapper.forPrimitiveType(ptype);
-        Object   zero  = wrap.zero();
-        if (zero == null) {
-            // fail
-        } else if (argument == null) {
-            if (ptype != int.class && wrap.isSubwordOrInt())
-                return Integer.valueOf(0);
-            else
-                return zero;
-        } else if (VerifyType.isNullReferenceConversion(argument.getClass(), zero.getClass())) {
-            if (ptype != int.class && wrap.isSubwordOrInt())
-                return Wrapper.INT.wrap(argument);
-            else
-                return argument;
-        }
-        throw badBoundArgumentException(argument, mh, argnum);
-    }
-
-    final static RuntimeException badBoundArgumentException(Object argument, MethodHandle mh, int argnum) {
-        String atype = (argument == null) ? "null" : argument.getClass().toString();
-        return new WrongMethodTypeException("cannot bind "+atype+" argument to parameter #"+argnum+" of "+mh.type());
-    }
-
-    @Override
-    public String toString() {
-        return MethodHandleImpl.addTypeString(baseName(), this);
-    }
-
-    /** Component of toString() before the type string. */
-    protected String baseName() {
-        MethodHandle mh = this;
-        while (mh instanceof BoundMethodHandle) {
-            Object info = MethodHandleNatives.getTargetInfo(mh);
-            if (info instanceof MethodHandle) {
-                mh = (MethodHandle) info;
-            } else {
-                String name = null;
-                if (info instanceof MemberName)
-                    name = ((MemberName)info).getName();
-                if (name != null)
-                    return name;
-                else
-                    return noParens(super.toString()); // "invoke", probably
-            }
-            assert(mh != this);
-        }
-        return noParens(mh.toString());
-    }
-
-    private static String noParens(String str) {
-        int paren = str.indexOf('(');
-        if (paren >= 0) str = str.substring(0, paren);
-        return str;
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/CallSiteImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn;
-
-import java.dyn.*;
-import static sun.dyn.MemberName.uncaughtException;
-
-/**
- * Parts of CallSite known to the JVM.
- * @author jrose
- */
-public class CallSiteImpl {
-    // this implements the upcall from the JVM, MethodHandleNatives.makeDynamicCallSite:
-    static CallSite makeSite(MethodHandle bootstrapMethod,
-                             // Callee information:
-                             String name, MethodType type,
-                             // Extra arguments for BSM, if any:
-                             Object info,
-                             // Caller information:
-                             MemberName callerMethod, int callerBCI) {
-        Class<?> callerClass = callerMethod.getDeclaringClass();
-        Object caller;
-        if (bootstrapMethod.type().parameterType(0) == Class.class && TRANSITIONAL_BEFORE_PFD)
-            caller = callerClass;  // remove for PFD
-        else
-            caller = MethodHandleImpl.IMPL_LOOKUP.in(callerClass);
-        if (bootstrapMethod == null && TRANSITIONAL_BEFORE_PFD) {
-            // If there is no bootstrap method, throw IncompatibleClassChangeError.
-            // This is a valid generic error type for resolution (JLS 12.3.3).
-            throw new IncompatibleClassChangeError
-                ("Class "+callerClass.getName()+" has not declared a bootstrap method for invokedynamic");
-        }
-        CallSite site;
-        try {
-            Object binding;
-            info = maybeReBox(info);
-            if (info == null) {
-                binding = bootstrapMethod.invokeGeneric(caller, name, type);
-            } else if (!info.getClass().isArray()) {
-                binding = bootstrapMethod.invokeGeneric(caller, name, type, info);
-            } else {
-                Object[] argv = (Object[]) info;
-                if (3 + argv.length > 255)
-                    new InvokeDynamicBootstrapError("too many bootstrap method arguments");
-                MethodType bsmType = bootstrapMethod.type();
-                if (bsmType.parameterCount() == 4 && bsmType.parameterType(3) == Object[].class)
-                    binding = bootstrapMethod.invokeGeneric(caller, name, type, argv);
-                else
-                    binding = MethodHandles.spreadInvoker(bsmType, 3)
-                        .invokeGeneric(bootstrapMethod, caller, name, type, argv);
-            }
-            //System.out.println("BSM for "+name+type+" => "+binding);
-            if (binding instanceof CallSite) {
-                site = (CallSite) binding;
-            } else if (binding instanceof MethodHandle && TRANSITIONAL_BEFORE_PFD) {
-                // Transitional!
-                MethodHandle target = (MethodHandle) binding;
-                site = new ConstantCallSite(target);
-            } else {
-                throw new ClassCastException("bootstrap method failed to produce a CallSite");
-            }
-            if (TRANSITIONAL_BEFORE_PFD)
-                PRIVATE_INITIALIZE_CALL_SITE.invokeExact(site, name, type,
-                                                         callerMethod, callerBCI);
-            assert(site.getTarget() != null);
-            assert(site.getTarget().type().equals(type));
-        } catch (Throwable ex) {
-            InvokeDynamicBootstrapError bex;
-            if (ex instanceof InvokeDynamicBootstrapError)
-                bex = (InvokeDynamicBootstrapError) ex;
-            else
-                bex = new InvokeDynamicBootstrapError("call site initialization exception", ex);
-            throw bex;
-        }
-        return site;
-    }
-
-    private static boolean TRANSITIONAL_BEFORE_PFD = true;  // FIXME: remove for PFD
-
-    private static Object maybeReBox(Object x) {
-        if (x instanceof Integer) {
-            int xi = (int) x;
-            if (xi == (byte) xi)
-                x = xi;  // must rebox; see JLS 5.1.7
-            return x;
-        } else if (x instanceof Object[]) {
-            Object[] xa = (Object[]) x;
-            for (int i = 0; i < xa.length; i++) {
-                if (xa[i] instanceof Integer)
-                    xa[i] = maybeReBox(xa[i]);
-            }
-            return xa;
-        } else {
-            return x;
-        }
-    }
-
-    // This method is private in CallSite because it touches private fields in CallSite.
-    // These private fields (vmmethod, vmindex) are specific to the JVM.
-    private static final MethodHandle PRIVATE_INITIALIZE_CALL_SITE;
-    static {
-        try {
-            PRIVATE_INITIALIZE_CALL_SITE =
-            !TRANSITIONAL_BEFORE_PFD ? null :
-            MethodHandleImpl.IMPL_LOOKUP.findVirtual(CallSite.class, "initializeFromJVM",
-                MethodType.methodType(void.class,
-                                      String.class, MethodType.class,
-                                      MemberName.class, int.class));
-        } catch (ReflectiveOperationException ex) {
-            throw uncaughtException(ex);
-        }
-    }
-
-    public static void setCallSiteTarget(Access token, CallSite site, MethodHandle target) {
-        Access.check(token);
-        MethodHandleNatives.setCallSiteTarget(site, target);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/DirectMethodHandle.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn;
-
-import java.dyn.*;
-import static sun.dyn.MethodHandleNatives.Constants.*;
-
-/**
- * The flavor of method handle which emulates invokespecial or invokestatic.
- * @author jrose
- */
-class DirectMethodHandle extends MethodHandle {
-    //inherited oop    vmtarget;    // methodOop or virtual class/interface oop
-    private final int  vmindex;     // method index within class or interface
-    { vmindex = VM_INDEX_UNINITIALIZED; }  // JVM may change this
-
-    // Constructors in this class *must* be package scoped or private.
-    DirectMethodHandle(MethodType mtype, MemberName m, boolean doDispatch, Class<?> lookupClass) {
-        super(Access.TOKEN, mtype);
-
-        assert(m.isMethod() || !doDispatch && m.isConstructor());
-        if (!m.isResolved())
-            throw new InternalError();
-
-        MethodHandleNatives.init(this, (Object) m, doDispatch, lookupClass);
-    }
-
-    boolean isValid() {
-        return (vmindex != VM_INDEX_UNINITIALIZED);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/FilterGeneric.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4496 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn;
-
-import java.dyn.*;
-import java.lang.reflect.*;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * These adapters apply arbitrary conversions to arguments
- * on the way to a ultimate target.
- * For simplicity, these are all generically typed.
- * @author jrose
- */
-class FilterGeneric {
-    // type for the incoming call (will be generic)
-    private final MethodType entryType;
-    // prototype adapters (clone and customize for each new target & conversion!)
-    private final Adapter[] adapters;
-
-    /** Compute and cache information common to all filtering adapters
-     *  with the given generic type
-     */
-    FilterGeneric(MethodType entryType) {
-        this.entryType = entryType;
-        int tableSize = Kind.LIMIT.invokerIndex(1 + entryType.parameterCount());
-        this.adapters = new Adapter[tableSize];
-    }
-
-    Adapter getAdapter(Kind kind, int pos) {
-        int index = kind.invokerIndex(pos);
-        Adapter ad = adapters[index];
-        if (ad != null)  return ad;
-        ad = findAdapter(entryType, kind, pos);
-        if (ad == null)
-            ad = buildAdapterFromBytecodes(entryType, kind, pos);
-        adapters[index] = ad;
-        return ad;
-    }
-
-    Adapter makeInstance(Kind kind, int pos, MethodHandle filter, MethodHandle target) {
-        Adapter ad = getAdapter(kind, pos);
-        return ad.makeInstance(ad.prototypeEntryPoint(), filter, target);
-    }
-
-    /** Build an adapter of the given generic type, which invokes filter
-     *  on the selected incoming argument before passing it to the target.
-     * @param pos the argument to filter
-     * @param filter the function to call on the argument
-     * @param target the target to call with the modified argument list
-     * @return an adapter method handle
-     */
-    public static MethodHandle makeArgumentFilter(int pos, MethodHandle filter, MethodHandle target) {
-        return make(Kind.value, pos, filter, target);
-    }
-
-    /** Build an adapter of the given generic type, which invokes a combiner
-     *  on a selected group of leading arguments.
-     *  The result of the combiner is prepended before all those arguments.
-     * @param combiner the function to call on the selected leading arguments
-     * @param target the target to call with the modified argument list
-     * @return an adapter method handle
-     */
-    public static MethodHandle makeArgumentFolder(MethodHandle combiner, MethodHandle target) {
-        int num = combiner.type().parameterCount();
-        return make(Kind.fold, num, combiner, target);
-    }
-
-    /** Build an adapter of the given generic type, which invokes a filter
-     *  on the incoming arguments, reified as a group.
-     *  The argument may be modified (by side effects in the filter).
-     *  The arguments, possibly modified, are passed on to the target.
-     * @param filter the function to call on the arguments
-     * @param target the target to call with the possibly-modified argument list
-     * @return an adapter method handle
-     */
-    public static MethodHandle makeFlyby(MethodHandle filter, MethodHandle target) {
-        return make(Kind.flyby, 0, filter, target);
-    }
-
-    /** Build an adapter of the given generic type, which invokes a collector
-     *  on the selected incoming argument and all following arguments.
-     *  The result of the collector replaces all those arguments.
-     * @param collector the function to call on the selected trailing arguments
-     * @param target the target to call with the modified argument list
-     * @return an adapter method handle
-     */
-    public static MethodHandle makeArgumentCollector(MethodHandle collector, MethodHandle target) {
-        int pos = target.type().parameterCount() - 1;
-        return make(Kind.collect, pos, collector, target);
-    }
-
-    static MethodHandle make(Kind kind, int pos, MethodHandle filter, MethodHandle target) {
-        FilterGeneric fgen = of(kind, pos, filter.type(), target.type());
-        return fgen.makeInstance(kind, pos, filter, target);
-    }
-
-    /** Return the adapter information for this target and filter type. */
-    static FilterGeneric of(Kind kind, int pos, MethodType filterType, MethodType targetType) {
-        MethodType entryType = entryType(kind, pos, filterType, targetType);
-        if (entryType.generic() != entryType)
-            throw newIllegalArgumentException("must be generic: "+entryType);
-        MethodTypeImpl form = MethodTypeImpl.of(entryType);
-        FilterGeneric filterGen = form.filterGeneric;
-        if (filterGen == null)
-            form.filterGeneric = filterGen = new FilterGeneric(entryType);
-        return filterGen;
-    }
-
-    public String toString() {
-        return "FilterGeneric/"+entryType;
-    }
-
-    static MethodType targetType(MethodType entryType, Kind kind, int pos, MethodType filterType) {
-        MethodType type = entryType;
-        switch (kind) {
-            case value:
-            case flyby:
-                break;  // no change
-            case fold:
-                type = type.insertParameterTypes(0, filterType.returnType());
-                break;
-            case collect:
-                type = type.dropParameterTypes(pos, type.parameterCount());
-                type = type.insertParameterTypes(pos, filterType.returnType());
-                break;
-            default:
-                throw new InternalError();
-        }
-        return type;
-    }
-
-    static MethodType entryType(Kind kind, int pos, MethodType filterType, MethodType targetType) {
-        MethodType type = targetType;
-        switch (kind) {
-            case value:
-            case flyby:
-                break;  // no change
-            case fold:
-                type = type.dropParameterTypes(0, 1);
-                break;
-            case collect:
-                type = type.dropParameterTypes(pos, pos+1);
-                type = type.insertParameterTypes(pos, filterType.parameterList());
-                break;
-            default:
-                throw new InternalError();
-        }
-        return type;
-    }
-
-    /* Create an adapter that handles spreading calls for the given type. */
-    static Adapter findAdapter(MethodType entryType, Kind kind, int pos) {
-        int argc = entryType.parameterCount();
-        String cname0 = "F"+argc;
-        String cname1 = "F"+argc+kind.key;
-        String[] cnames = { cname0, cname1 };
-        String iname = kind.invokerName(pos);
-        // e.g., F5; invoke_C3
-        for (String cname : cnames) {
-            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
-            if (acls == null)  continue;
-            // see if it has the required invoke method
-            MethodHandle entryPoint = null;
-            try {
-                entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
-            } catch (ReflectiveOperationException ex) {
-            }
-            if (entryPoint == null)  continue;
-            Constructor<? extends Adapter> ctor = null;
-            try {
-                ctor = acls.getDeclaredConstructor(MethodHandle.class);
-            } catch (NoSuchMethodException ex) {
-            } catch (SecurityException ex) {
-            }
-            if (ctor == null)  continue;
-            try {
-                // Produce an instance configured as a prototype.
-                return ctor.newInstance(entryPoint);
-            } catch (IllegalArgumentException ex) {
-            } catch (InvocationTargetException wex) {
-                Throwable ex = wex.getTargetException();
-                if (ex instanceof Error)  throw (Error)ex;
-                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
-            }
-        }
-        return null;
-    }
-
-    static Adapter buildAdapterFromBytecodes(MethodType entryType, Kind kind, int pos) {
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    /**
-     * This adapter takes some untyped arguments, and returns an untyped result.
-     * Internally, it applies the invoker to the target, which causes the
-     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
-     * This result is passed to convert, which is responsible for
-     * converting the raw result into a boxed object.
-     * The invoker is kept separate from the target because it can be
-     * generated once per type erasure family, and reused across adapters.
-     */
-    static abstract class Adapter extends BoundMethodHandle {
-        protected final MethodHandle filter; // transforms one or more arguments
-        protected final MethodHandle target; // ultimate target
-
-        @Override
-        public String toString() {
-            return MethodHandleImpl.addTypeString(target, this);
-        }
-
-        protected boolean isPrototype() { return target == null; }
-        protected Adapter(MethodHandle entryPoint) {
-            this(entryPoint, entryPoint, null);
-            assert(isPrototype());
-        }
-        protected MethodHandle prototypeEntryPoint() {
-            if (!isPrototype())  throw new InternalError();
-            return filter;
-        }
-
-        protected Adapter(MethodHandle entryPoint,
-                          MethodHandle filter, MethodHandle target) {
-            super(Access.TOKEN, entryPoint);
-            this.filter = filter;
-            this.target = target;
-        }
-
-        /** Make a copy of self, with new fields. */
-        protected abstract Adapter makeInstance(MethodHandle entryPoint,
-                MethodHandle filter, MethodHandle target);
-        // { return new ThisType(entryPoint, filter, target); }
-
-        static private final String CLASS_PREFIX; // "sun.dyn.FilterGeneric$"
-        static {
-            String aname = Adapter.class.getName();
-            String sname = Adapter.class.getSimpleName();
-            if (!aname.endsWith(sname))  throw new InternalError();
-            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
-        }
-        /** Find a sibing class of Adapter. */
-        static Class<? extends Adapter> findSubClass(String name) {
-            String cname = Adapter.CLASS_PREFIX + name;
-            try {
-                return Class.forName(cname).asSubclass(Adapter.class);
-            } catch (ClassNotFoundException ex) {
-                return null;
-            } catch (ClassCastException ex) {
-                return null;
-            }
-        }
-    }
-
-    static enum Kind {
-        value('V'),      // filter and replace Nth argument value
-        fold('F'),       // fold first N arguments, prepend result
-        collect('C'),    // collect last N arguments, replace with result
-        flyby('Y'),      // reify entire argument list, filter, pass to target
-        LIMIT('?');
-        static final int COUNT = LIMIT.ordinal();
-
-        final char key;
-        Kind(char key) { this.key = key; }
-        String invokerName(int pos) { return "invoke_"+key+""+pos; }
-        int invokerIndex(int pos) { return pos * COUNT + ordinal(); }
-    }
-
-    /* generated classes follow this pattern:
-    static class F1X extends Adapter {
-        protected F1X(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F1X(MethodHandle e, MethodHandle f, MethodHandle t)
-                        { super(e, f, t); }
-        protected F1X makeInstance(MethodHandle e, MethodHandle f, MethodHandle t)
-                        { return new F1X(e, f, t); }
-        protected Object invoke_V0(Object a0) { return target.invokeExact(filter.invokeExact(a0)); }
-        protected Object invoke_F0(Object a0) { return target.invokeExact(filter.invokeExact(), a0); }
-        protected Object invoke_F1(Object a0) { return target.invokeExact(filter.invokeExact(a0), a0); }
-        protected Object invoke_C0(Object a0) { return target.invokeExact(filter.invokeExact(a0)); }
-        protected Object invoke_C1(Object a0) { return target.invokeExact(a0, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0) { Object[] av = { a0 };
-                       filter.invokeExact(av); return target.invokeExact(av[0]); }
-    }
-    static class F2X extends Adapter {
-        protected F2X(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F2X(MethodHandle e, MethodHandle f, MethodHandle t)
-                        { super(e, f, t); }
-        protected F2X makeInstance(MethodHandle e, MethodHandle f, MethodHandle t)
-                        { return new F2X(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0), a1); }
-        protected Object invoke_V1(Object a0, Object a1) { return target.invokeExact(a0, filter.invokeExact(a1)); }
-        protected Object invoke_F0(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(), a0, a1); }
-        protected Object invoke_F1(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0), a0, a1); }
-        protected Object invoke_F2(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0, a1), a0, a1); }
-        protected Object invoke_C0(Object a0, Object a1) { return target.invokeExact(filter.invokeExact(a0, a1)); }
-        protected Object invoke_C1(Object a0, Object a1) { return target.invokeExact(a0, filter.invokeExact(a1)); }
-        protected Object invoke_C2(Object a0, Object a1) { return target.invokeExact(a0, a1, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1) { Object[] av = { a0, a1 };
-                       filter.invokeExact(av); return target.invokeExact(av[0], av[1]); }
-    }
-    // */
-
-    // This one is written by hand:
-    static class F0 extends Adapter {
-        protected F0(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F0(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F0 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F0(e, f, t); }
-        protected Object invoke_F0() throws Throwable {
-            return target.invokeExact(filter.invokeExact()); }
-        protected Object invoke_C0() throws Throwable {
-            return target.invokeExact(filter.invokeExact()); }
-        static final Object[] NO_ARGS = { };
-        protected Object invoke_Y0() throws Throwable {
-            filter.invokeExact(NO_ARGS); // make the flyby
-            return target.invokeExact(); }
-    }
-
-/*
-  : SHELL; n=FilterGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -ea -cp . genclasses | sed 's| *[/]/ *$||') >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
-//{{{
-import java.util.*;
-class genclasses {
-    static String[][] TEMPLATES = { {
-        "@for@ N=1..20",
-        "    //@each-cat@",
-        "    static class @cat@ extends Adapter {",
-        "        protected @cat@(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype",
-        "        protected @cat@(MethodHandle e, MethodHandle f, MethodHandle t) {",
-        "            super(e, f, t); }",
-        "        protected @cat@ makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {",
-        "            return new @cat@(e, f, t); }",
-        "        //@each-P@",
-        "        protected Object invoke_V@P@(@Tvav@) throws Throwable {",
-        "            return target.invokeExact(@a0_@@Psp@filter.invokeExact(a@P@)@_aN@); }",
-        "        //@end-P@",
-        "        //@each-P@",
-        "        protected Object invoke_F@P@(@Tvav@) throws Throwable {",
-        "            return target.invokeExact(filter.invokeExact(@a0@),",
-        "                                 @av@); }",
-        "        //@end-P@",
-        "        protected Object invoke_F@N@(@Tvav@) throws Throwable {",
-        "            return target.invokeExact(filter.invokeExact(@av@),",
-        "                                 @av@); }",
-        "        //@each-P@",
-        "        protected Object invoke_C@P@(@Tvav@) throws Throwable {",
-        "            return target.invokeExact(@a0_@filter.invokeExact(a@P@@_aN@)); }",
-        "        //@end-P@",
-        "        protected Object invoke_C@N@(@Tvav@) throws Throwable {",
-        "            return target.invokeExact(@av@, filter.invokeExact()); }",
-        "        protected Object invoke_Y0(@Tvav@) throws Throwable {",
-        "            Object[] av = { @av@ };",
-        "            filter.invokeExact(av); // make the flyby",
-        "            return target.invokeExact(@av[i]@); }",
-        "    }",
-    } };
-    static final String NEWLINE_INDENT = " //\n                                 ";
-    enum VAR {
-        cat, N, P, Tvav, av, a0, a0_, _aN, Psp, av_i_;
-        public final String pattern = "@"+toString().replace('_','.')+"@";
-        public String binding = toString();
-        static void makeBindings(boolean topLevel, int inargs, int pos) {
-            assert(-1 <= pos && pos < inargs);
-            VAR.cat.binding = "F"+inargs;
-            VAR.N.binding = String.valueOf(inargs); // incoming arg count
-            VAR.P.binding = String.valueOf(pos);  // selected arg position
-            String[] av = new String[inargs];
-            String[] Tvav = new String[inargs];
-            String[] av_i_ = new String[inargs];
-            for (int i = 0; i < inargs; i++) {
-                av[i] = arg(i);
-                av_i_[i] = "av["+i+"]";
-                String spc = "";
-                if (i > 0 && i % 4 == 0) spc = NEWLINE_INDENT+(pos>9?" ":"")+"  ";
-                Tvav[i] = spc+param("Object", av[i]);
-            }
-            VAR.av.binding = comma(av);
-            VAR.av_i_.binding = comma(av_i_);
-            VAR.Tvav.binding = comma(Tvav);
-            if (pos >= 0) {
-                VAR.Psp.binding = (pos > 0 && pos % 10 == 0) ? NEWLINE_INDENT : "";
-                String[] a0 = new String[pos];
-                String[] aN = new String[inargs - (pos+1)];
-                for (int i = 0; i < pos; i++) {
-                    String spc = "";
-                    if (i > 0 && i % 10 == 0) spc = NEWLINE_INDENT;
-                    a0[i] = spc+av[i];
-                }
-                VAR.a0.binding = comma(a0);
-                VAR.a0_.binding = comma(a0, ", ");
-                for (int i = pos+1; i < inargs; i++) {
-                    String spc = "";
-                    if (i > 0 && i % 10 == 0) spc = NEWLINE_INDENT;
-                    aN[i - (pos+1)] = spc+av[i];
-                }
-                VAR._aN.binding = comma(", ", aN);
-            }
-        }
-        static String arg(int i) { return "a"+i; }
-        static String param(String t, String a) { return t+" "+a; }
-        static String comma(String[] v) { return comma(v, ""); }
-        static String comma(String[] v, String sep) { return comma("", v, sep); }
-        static String comma(String sep, String[] v) { return comma(sep, v, ""); }
-        static String comma(String sep1, String[] v, String sep2) {
-            if (v.length == 0)  return "";
-            String res = v[0];
-            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
-            return sep1 + res + sep2;
-        }
-        static String transform(String string) {
-            for (VAR var : values())
-                string = string.replaceAll(var.pattern, var.binding);
-            return string;
-        }
-    }
-    static String[] stringsIn(String[] strings, int beg, int end) {
-        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
-    }
-    static String[] stringsBefore(String[] strings, int pos) {
-        return stringsIn(strings, 0, pos);
-    }
-    static String[] stringsAfter(String[] strings, int pos) {
-        return stringsIn(strings, pos, strings.length);
-    }
-    static int indexAfter(String[] strings, int pos, String tag) {
-        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
-    }
-    static int indexBefore(String[] strings, int pos, String tag) {
-        for (int i = pos, end = strings.length; ; i++) {
-            if (i == end || strings[i].endsWith(tag))  return i;
-        }
-    }
-    static int MIN_ARITY, MAX_ARITY;
-    public static void main(String... av) {
-        for (String[] template : TEMPLATES) {
-            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
-            String[] forLines = stringsBefore(template, forLinesLimit);
-            template = stringsAfter(template, forLinesLimit);
-            for (String forLine : forLines)
-                expandTemplate(forLine, template);
-        }
-    }
-    static void expandTemplate(String forLine, String[] template) {
-        String[] params = forLine.split("[^0-9]+");
-        if (params[0].length() == 0)  params = stringsAfter(params, 1);
-        System.out.println("//params="+Arrays.asList(params));
-        int pcur = 0;
-        MIN_ARITY = Integer.valueOf(params[pcur++]);
-        MAX_ARITY = Integer.valueOf(params[pcur++]);
-        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
-        for (int inargs = MIN_ARITY; inargs <= MAX_ARITY; inargs++) {
-            expandTemplate(template, true, inargs, -1);
-        }
-    }
-    static void expandTemplate(String[] template, boolean topLevel, int inargs, int pos) {
-        VAR.makeBindings(topLevel, inargs, pos);
-        for (int i = 0; i < template.length; i++) {
-            String line = template[i];
-            if (line.endsWith("@each-cat@")) {
-                // ignore
-            } else if (line.endsWith("@each-P@")) {
-                int blockEnd = indexAfter(template, i, "@end-P@");
-                String[] block = stringsIn(template, i+1, blockEnd-1);
-                for (int pos1 = Math.max(0,pos); pos1 < inargs; pos1++)
-                    expandTemplate(block, false, inargs, pos1);
-                VAR.makeBindings(topLevel, inargs, pos);
-                i = blockEnd-1; continue;
-            } else {
-                System.out.println(VAR.transform(line));
-            }
-        }
-    }
-}
-//}}} */
-//params=[1, 20]
-    static class F1 extends Adapter {
-        protected F1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F1(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F1 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F1(e, f, t); }
-        protected Object invoke_V0(Object a0) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0)); }
-        protected Object invoke_F0(Object a0) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0); }
-        protected Object invoke_F1(Object a0) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0); }
-        protected Object invoke_C0(Object a0) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0)); }
-        protected Object invoke_C1(Object a0) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0) throws Throwable {
-            Object[] av = { a0 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0]); }
-    }
-    static class F2 extends Adapter {
-        protected F2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F2(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F2 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F2(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1); }
-        protected Object invoke_V1(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1)); }
-        protected Object invoke_F0(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1); }
-        protected Object invoke_F1(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1); }
-        protected Object invoke_F2(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1); }
-        protected Object invoke_C0(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1)); }
-        protected Object invoke_C1(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1)); }
-        protected Object invoke_C2(Object a0, Object a1) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1) throws Throwable {
-            Object[] av = { a0, a1 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1]); }
-    }
-    static class F3 extends Adapter {
-        protected F3(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F3(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F3 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F3(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2) throws Throwable {
-            Object[] av = { a0, a1, a2 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2]); }
-    }
-    static class F4 extends Adapter {
-        protected F4(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F4(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F4 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F4(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            Object[] av = { a0, a1, a2, a3 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3]); }
-    }
-    static class F5 extends Adapter {
-        protected F5(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F5(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F5 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F5(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4]); }
-    }
-    static class F6 extends Adapter {
-        protected F6(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F6(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F6 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F6(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5]); }
-    }
-    static class F7 extends Adapter {
-        protected F7(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F7(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F7 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F7(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6]); }
-    }
-    static class F8 extends Adapter {
-        protected F8(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F8(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F8 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F8(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7]); }
-    }
-    static class F9 extends Adapter {
-        protected F9(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F9(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F9 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F9(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8]); }
-    }
-    static class F10 extends Adapter {
-        protected F10(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F10(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F10 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F10(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9]); }
-    }
-    static class F11 extends Adapter {
-        protected F11(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F11(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F11 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F11(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10]); }
-    }
-    static class F12 extends Adapter {
-        protected F12(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F12(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F12 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F12(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11]); }
-    }
-    static class F13 extends Adapter {
-        protected F13(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F13(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F13 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F13(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12]); }
-    }
-    static class F14 extends Adapter {
-        protected F14(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F14(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F14 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F14(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13]); }
-    }
-    static class F15 extends Adapter {
-        protected F15(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F15(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F15 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F15(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13, a14); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13, a14); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13, a14); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13, a14); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13), a14); }
-        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13, a14)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13, a14)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13, a14)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13, a14)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14)); }
-        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14]); }
-    }
-    static class F16 extends Adapter {
-        protected F16(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F16(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F16 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F16(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13, a14, a15); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13, a14, a15); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13, a14, a15); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13), a14, a15); }
-        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14), a15); }
-        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13, a14, a15)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13, a14, a15)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13, a14, a15)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14, a15)); }
-        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15)); }
-        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15]); }
-    }
-    static class F17 extends Adapter {
-        protected F17(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F17(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F17 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F17(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16); }
-        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16); }
-        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16); }
-        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16)); }
-        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16)); }
-        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16)); }
-        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16]); }
-    }
-    static class F18 extends Adapter {
-        protected F18(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F18(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F18 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F18(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16, a17); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16, a17); }
-        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16, a17); }
-        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16, a17); }
-        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16), a17); }
-        protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16, a17)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16, a17)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16, a17)); }
-        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16, a17)); }
-        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16, a17)); }
-        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17)); }
-        protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17]); }
-    }
-    static class F19 extends Adapter {
-        protected F19(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F19(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F19 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F19(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16, a17, a18); }
-        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16, a17, a18); }
-        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16, a17, a18); }
-        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16), a17, a18); }
-        protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17), a18); }
-        protected Object invoke_V18(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_F19(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16, a17, a18)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16, a17, a18)); }
-        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16, a17, a18)); }
-        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16, a17, a18)); }
-        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17, a18)); }
-        protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18)); }
-        protected Object invoke_C19(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18]); }
-    }
-    static class F20 extends Adapter {
-        protected F20(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected F20(MethodHandle e, MethodHandle f, MethodHandle t) {
-            super(e, f, t); }
-        protected F20 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {
-            return new F20(e, f, t); }
-        protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1), a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2), a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3), a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4), a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5), a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6), a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7), a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8), a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9),
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 filter.invokeExact(a10), a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11), a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12), a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13), a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14), a15, a16, a17, a18, a19); }
-        protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15), a16, a17, a18, a19); }
-        protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16), a17, a18, a19); }
-        protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17), a18, a19); }
-        protected Object invoke_V18(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18), a19); }
-        protected Object invoke_V19(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invokeExact(a19)); }
-        protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F19(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_F20(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19),
-                                 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); }
-        protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(filter.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, filter.invokeExact(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, filter.invokeExact(a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, filter.invokeExact(a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, filter.invokeExact(a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, filter.invokeExact(a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, filter.invokeExact(a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, filter.invokeExact(a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, filter.invokeExact(a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invokeExact(a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invokeExact(a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, filter.invokeExact(a11, a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, filter.invokeExact(a12, a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, filter.invokeExact(a13, a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, filter.invokeExact(a14, a15, a16, a17, a18, a19)); }
-        protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, filter.invokeExact(a15, a16, a17, a18, a19)); }
-        protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, filter.invokeExact(a16, a17, a18, a19)); }
-        protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, filter.invokeExact(a17, a18, a19)); }
-        protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, filter.invokeExact(a18, a19)); }
-        protected Object invoke_C19(Object a0, Object a1, Object a2, Object a3,
-                                    Object a4, Object a5, Object a6, Object a7,
-                                    Object a8, Object a9, Object a10, Object a11,
-                                    Object a12, Object a13, Object a14, Object a15,
-                                    Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
-                                 a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invokeExact(a19)); }
-        protected Object invoke_C20(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, filter.invokeExact()); }
-        protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3,
-                                   Object a4, Object a5, Object a6, Object a7,
-                                   Object a8, Object a9, Object a10, Object a11,
-                                   Object a12, Object a13, Object a14, Object a15,
-                                   Object a16, Object a17, Object a18, Object a19) throws Throwable {
-            Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19 };
-            filter.invokeExact(av); // make the flyby
-            return target.invokeExact(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18], av[19]); }
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/FilterOneArgument.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn;
-
-import java.dyn.*;
-import static sun.dyn.MemberName.uncaughtException;
-
-/**
- * Unary function composition, useful for many small plumbing jobs.
- * The invoke method takes a single reference argument, and returns a reference
- * Internally, it first calls the {@code filter} method on the argument,
- * Making up the difference between the raw method type and the
- * final method type is the responsibility of a JVM-level adapter.
- * @author jrose
- */
-public class FilterOneArgument extends BoundMethodHandle {
-    protected final MethodHandle filter;  // Object -> Object
-    protected final MethodHandle target;  // Object -> Object
-
-    @Override
-    public String toString() {
-        return target.toString();
-    }
-
-    protected Object invoke(Object argument) throws Throwable {
-        Object filteredArgument = filter.invokeExact(argument);
-        return target.invokeExact(filteredArgument);
-    }
-
-    private static final MethodHandle INVOKE;
-    static {
-        try {
-            INVOKE =
-                MethodHandleImpl.IMPL_LOOKUP.findVirtual(FilterOneArgument.class, "invoke",
-                                                         MethodType.genericMethodType(1));
-        } catch (ReflectiveOperationException ex) {
-            throw uncaughtException(ex);
-        }
-    }
-
-    protected FilterOneArgument(MethodHandle filter, MethodHandle target) {
-        super(Access.TOKEN, INVOKE);
-        this.filter = filter;
-        this.target = target;
-    }
-
-    public static MethodHandle make(MethodHandle filter, MethodHandle target) {
-        if (filter == null)  return target;
-        if (target == null)  return filter;
-        return new FilterOneArgument(filter, target);
-    }
-
-//    MethodHandle make(MethodHandle filter1, MethodHandle filter2, MethodHandle target) {
-//        MethodHandle filter = make(filter1, filter2);
-//        return make(filter, target);
-//    }
-}
--- a/jdk/src/share/classes/sun/dyn/FromGeneric.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,629 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import java.dyn.*;
-import java.lang.reflect.*;
-import sun.dyn.util.*;
-import static sun.dyn.MethodTypeImpl.invokers;
-
-/**
- * Adapters which mediate between incoming calls which are generic
- * and outgoing calls which are not.  Any call can be represented generically
- * boxing up its arguments, and (on return) unboxing the return value.
- * <p>
- * A call is "generic" (in MethodHandle terms) if its MethodType features
- * only Object arguments.  A non-generic call therefore features
- * primitives and/or reference types other than Object.
- * An adapter has types for its incoming and outgoing calls.
- * The incoming call type is simply determined by the adapter's type
- * (the MethodType it presents to callers).  The outgoing call type
- * is determined by the adapter's target (a MethodHandle that the adapter
- * either binds internally or else takes as a leading argument).
- * (To stretch the term, adapter-like method handles may have multiple
- * targets or be polymorphic across multiple call types.)
- * @author jrose
- */
-class FromGeneric {
-    // type for the outgoing call (may have primitives, etc.)
-    private final MethodType targetType;
-    // type of the outgoing call internal to the adapter
-    private final MethodType internalType;
-    // prototype adapter (clone and customize for each new target!)
-    private final Adapter adapter;
-    // entry point for adapter (Adapter mh, a...) => ...
-    private final MethodHandle entryPoint;
-    // unboxing invoker of type (MH, Object**N) => raw return value
-    // it makes up the difference of internalType => targetType
-    private final MethodHandle unboxingInvoker;
-    // conversion which boxes a the target's raw return value
-    private final MethodHandle returnConversion;
-
-    /** Compute and cache information common to all unboxing adapters
-     *  that can call out to targets of the erasure-family of the given erased type.
-     */
-    private FromGeneric(MethodType targetType) {
-        this.targetType = targetType;
-        MethodType internalType0;
-        // the target invoker will generally need casts on reference arguments
-        Adapter ad = findAdapter(internalType0 = targetType.erase());
-        if (ad != null) {
-            // Immediate hit to exactly the adapter we want,
-            // with no monkeying around with primitive types.
-            this.internalType = internalType0;
-            this.adapter = ad;
-            this.entryPoint = ad.prototypeEntryPoint();
-            this.returnConversion = computeReturnConversion(targetType, internalType0);
-            this.unboxingInvoker = computeUnboxingInvoker(targetType, internalType0);
-            return;
-        }
-
-        // outgoing primitive arguments will be wrapped; unwrap them
-        MethodType primsAsObj = MethodTypeImpl.of(targetType).primArgsAsBoxes();
-        MethodType objArgsRawRet = MethodTypeImpl.of(primsAsObj).primsAsInts();
-        if (objArgsRawRet != targetType)
-            ad = findAdapter(internalType0 = objArgsRawRet);
-        if (ad == null) {
-            ad = buildAdapterFromBytecodes(internalType0 = targetType);
-        }
-        this.internalType = internalType0;
-        this.adapter = ad;
-        MethodType tepType = targetType.insertParameterTypes(0, adapter.getClass());
-        this.entryPoint = ad.prototypeEntryPoint();
-        this.returnConversion = computeReturnConversion(targetType, internalType0);
-        this.unboxingInvoker = computeUnboxingInvoker(targetType, internalType0);
-    }
-
-    /**
-     * The typed target will be called according to targetType.
-     * The adapter code will in fact see the raw result from internalType,
-     * and must box it into an object.  Produce a converter for this.
-     */
-    private static MethodHandle computeReturnConversion(
-            MethodType targetType, MethodType internalType) {
-        Class<?> tret = targetType.returnType();
-        Class<?> iret = internalType.returnType();
-        Wrapper wrap = Wrapper.forBasicType(tret);
-        if (!iret.isPrimitive()) {
-            assert(iret == Object.class);
-            return ValueConversions.identity();
-        } else if (wrap.primitiveType() == iret) {
-            return ValueConversions.box(wrap, false);
-        } else {
-            assert(tret == double.class ? iret == long.class : iret == int.class);
-            return ValueConversions.boxRaw(wrap, false);
-        }
-    }
-
-    /**
-     * The typed target will need an exact invocation point; provide it here.
-     * The adapter will possibly need to make a slightly different call,
-     * so adapt the invoker.  This way, the logic for making up the
-     * difference between what the adapter can call and what the target
-     * needs can be cached once per type.
-     */
-    private static MethodHandle computeUnboxingInvoker(
-            MethodType targetType, MethodType internalType) {
-        // All the adapters we have here have reference-untyped internal calls.
-        assert(internalType == internalType.erase());
-        MethodHandle invoker = invokers(targetType).exactInvoker();
-        // cast all narrow reference types, unbox all primitive arguments:
-        MethodType fixArgsType = internalType.changeReturnType(targetType.returnType());
-        MethodHandle fixArgs = AdapterMethodHandle.convertArguments(Access.TOKEN,
-                                 invoker, Invokers.invokerType(fixArgsType),
-                                 invoker.type(), null);
-        if (fixArgs == null)
-            throw new InternalError("bad fixArgs");
-        // reinterpret the calling sequence as raw:
-        MethodHandle retyper = AdapterMethodHandle.makeRetypeRaw(Access.TOKEN,
-                                        Invokers.invokerType(internalType), fixArgs);
-        if (retyper == null)
-            throw new InternalError("bad retyper");
-        return retyper;
-    }
-
-    Adapter makeInstance(MethodHandle typedTarget) {
-        MethodType type = typedTarget.type();
-        if (type == targetType) {
-            return adapter.makeInstance(entryPoint, unboxingInvoker, returnConversion, typedTarget);
-        }
-        // my erased-type is not exactly the same as the desired type
-        assert(type.erase() == targetType);  // else we are busted
-        MethodHandle invoker = computeUnboxingInvoker(type, internalType);
-        return adapter.makeInstance(entryPoint, invoker, returnConversion, typedTarget);
-    }
-
-    /** Build an adapter of the given generic type, which invokes typedTarget
-     *  on the incoming arguments, after unboxing as necessary.
-     *  The return value is boxed if necessary.
-     * @param genericType  the required type of the result
-     * @param typedTarget the target
-     * @return an adapter method handle
-     */
-    public static MethodHandle make(MethodHandle typedTarget) {
-        MethodType type = typedTarget.type();
-        if (type == type.generic())  return typedTarget;
-        return FromGeneric.of(type).makeInstance(typedTarget);
-    }
-
-    /** Return the adapter information for this type's erasure. */
-    static FromGeneric of(MethodType type) {
-        MethodTypeImpl form = MethodTypeImpl.of(type);
-        FromGeneric fromGen = form.fromGeneric;
-        if (fromGen == null)
-            form.fromGeneric = fromGen = new FromGeneric(form.erasedType());
-        return fromGen;
-    }
-
-    public String toString() {
-        return "FromGeneric"+targetType;
-    }
-
-    /* Create an adapter that handles spreading calls for the given type. */
-    static Adapter findAdapter(MethodType internalType) {
-        MethodType entryType = internalType.generic();
-        MethodTypeImpl form = MethodTypeImpl.of(internalType);
-        Class<?> rtype = internalType.returnType();
-        int argc = form.parameterCount();
-        int lac = form.longPrimitiveParameterCount();
-        int iac = form.primitiveParameterCount() - lac;
-        String intsAndLongs = (iac > 0 ? "I"+iac : "")+(lac > 0 ? "J"+lac : "");
-        String rawReturn = String.valueOf(Wrapper.forPrimitiveType(rtype).basicTypeChar());
-        String cname0 = rawReturn + argc;
-        String cname1 = "A"       + argc;
-        String[] cnames = { cname0+intsAndLongs, cname0, cname1+intsAndLongs, cname1 };
-        String iname = "invoke_"+cname0+intsAndLongs;
-        // e.g., D5I2, D5, L5I2, L5; invoke_D5
-        for (String cname : cnames) {
-            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
-            if (acls == null)  continue;
-            // see if it has the required invoke method
-            MethodHandle entryPoint = null;
-            try {
-                entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
-            } catch (ReflectiveOperationException ex) {
-            }
-            if (entryPoint == null)  continue;
-            Constructor<? extends Adapter> ctor = null;
-            try {
-                ctor = acls.getDeclaredConstructor(MethodHandle.class);
-            } catch (NoSuchMethodException ex) {
-            } catch (SecurityException ex) {
-            }
-            if (ctor == null)  continue;
-            try {
-                // Produce an instance configured as a prototype.
-                return ctor.newInstance(entryPoint);
-            } catch (IllegalArgumentException ex) {
-            } catch (InvocationTargetException wex) {
-                Throwable ex = wex.getTargetException();
-                if (ex instanceof Error)  throw (Error)ex;
-                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
-            }
-        }
-        return null;
-    }
-
-    static Adapter buildAdapterFromBytecodes(MethodType internalType) {
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    /**
-     * This adapter takes some untyped arguments, and returns an untyped result.
-     * Internally, it applies the invoker to the target, which causes the
-     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
-     * This result is passed to convert, which is responsible for
-     * converting the raw result into a boxed object.
-     * The invoker is kept separate from the target because it can be
-     * generated once per type erasure family, and reused across adapters.
-     */
-    static abstract class Adapter extends BoundMethodHandle {
-        /*
-         * class X<<R,int N>> extends Adapter {
-         *   (MH, Object**N)=>raw(R) invoker;
-         *   (any**N)=>R target;
-         *   raw(R)=>Object convert;
-         *   Object invoke(Object**N a) = convert(invoker(target, a...))
-         * }
-         */
-        protected final MethodHandle invoker;  // (MH, Object**N) => raw(R)
-        protected final MethodHandle convert;  // raw(R) => Object
-        protected final MethodHandle target;   // (any**N) => R
-
-        @Override
-        public String toString() {
-            return MethodHandleImpl.addTypeString(target, this);
-        }
-
-        protected boolean isPrototype() { return target == null; }
-        protected Adapter(MethodHandle entryPoint) {
-            this(entryPoint, null, entryPoint, null);
-            assert(isPrototype());
-        }
-        protected MethodHandle prototypeEntryPoint() {
-            if (!isPrototype())  throw new InternalError();
-            return convert;
-        }
-
-        protected Adapter(MethodHandle entryPoint,
-                          MethodHandle invoker, MethodHandle convert, MethodHandle target) {
-            super(Access.TOKEN, entryPoint);
-            this.invoker = invoker;
-            this.convert = convert;
-            this.target  = target;
-        }
-
-        /** Make a copy of self, with new fields. */
-        protected abstract Adapter makeInstance(MethodHandle entryPoint,
-                MethodHandle invoker, MethodHandle convert, MethodHandle target);
-        // { return new ThisType(entryPoint, convert, target); }
-
-        /// Conversions on the value returned from the target.
-        protected Object convert_L(Object result) throws Throwable { return convert.invokeExact(result); }
-        protected Object convert_I(int    result) throws Throwable { return convert.invokeExact(result); }
-        protected Object convert_J(long   result) throws Throwable { return convert.invokeExact(result); }
-        protected Object convert_F(float  result) throws Throwable { return convert.invokeExact(result); }
-        protected Object convert_D(double result) throws Throwable { return convert.invokeExact(result); }
-
-        static private final String CLASS_PREFIX; // "sun.dyn.FromGeneric$"
-        static {
-            String aname = Adapter.class.getName();
-            String sname = Adapter.class.getSimpleName();
-            if (!aname.endsWith(sname))  throw new InternalError();
-            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
-        }
-        /** Find a sibing class of Adapter. */
-        static Class<? extends Adapter> findSubClass(String name) {
-            String cname = Adapter.CLASS_PREFIX + name;
-            try {
-                return Class.forName(cname).asSubclass(Adapter.class);
-            } catch (ClassNotFoundException ex) {
-                return null;
-            } catch (ClassCastException ex) {
-                return null;
-            }
-        }
-    }
-
-    /* generated classes follow this pattern:
-    static class xA2 extends Adapter {
-        protected xA2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected xA2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected xA2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new xA2(e, i, c, t); }
-        protected Object invoke_L2(Object a0, Object a1) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_I2(Object a0, Object a1) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_J2(Object a0, Object a1) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_F2(Object a0, Object a1) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_D2(Object a0, Object a1) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1)); }
-    }
-    // */
-
-/*
-: SHELL; n=FromGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
-//{{{
-import java.util.*;
-class genclasses {
-    static String[] TYPES = { "Object",    "int   ",    "long  ",    "float ",    "double" };
-    static String[] WRAPS = { "         ", "(Integer)", "(Long)   ", "(Float)  ", "(Double) " };
-    static String[] TCHARS = { "L",     "I",      "J",      "F",      "D",     "A" };
-    static String[][] TEMPLATES = { {
-        "@for@ arity=0..10  rcat<=4 nrefs<=99 nints=0   nlongs=0",
-        "    //@each-cat@",
-        "    static class @cat@ extends Adapter {",
-        "        protected @cat@(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype",
-        "        protected @cat@(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)",
-        "                        { super(e, i, c, t); }",
-        "        protected @cat@ makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)",
-        "                        { return new @cat@(e, i, c, t); }",
-        "        //@each-R@",
-        "        protected Object invoke_@catN@(@Tvav@) throws Throwable { return convert_@Rc@((@R@)@W@invoker.invokeExact(target@av@)); }",
-        "        //@end-R@",
-        "    }",
-    } };
-    static final String NEWLINE_INDENT = "\n                ";
-    enum VAR {
-        cat, catN, R, Rc, W, av, Tvav, Ovav;
-        public final String pattern = "@"+toString().replace('_','.')+"@";
-        public String binding;
-        static void makeBindings(boolean topLevel, int rcat, int nrefs, int nints, int nlongs) {
-            int nargs = nrefs + nints + nlongs;
-            if (topLevel)
-                VAR.cat.binding = catstr(ALL_RETURN_TYPES ? TYPES.length : rcat, nrefs, nints, nlongs);
-            VAR.catN.binding = catstr(rcat, nrefs, nints, nlongs);
-            VAR.R.binding = TYPES[rcat];
-            VAR.Rc.binding = TCHARS[rcat];
-            VAR.W.binding = WRAPS[rcat];
-            String[] Tv = new String[nargs];
-            String[] av = new String[nargs];
-            String[] Tvav = new String[nargs];
-            String[] Ovav = new String[nargs];
-            for (int i = 0; i < nargs; i++) {
-                int tcat = (i < nrefs) ? 0 : (i < nrefs + nints) ? 1 : 2;
-                Tv[i] = TYPES[tcat];
-                av[i] = arg(i);
-                Tvav[i] = param(Tv[i], av[i]);
-                Ovav[i] = param("Object", av[i]);
-            }
-            VAR.av.binding = comma(", ", av);
-            VAR.Tvav.binding = comma(Tvav);
-            VAR.Ovav.binding = comma(Ovav);
-        }
-        static String arg(int i) { return "a"+i; }
-        static String param(String t, String a) { return t+" "+a; }
-        static String comma(String[] v) { return comma("", v); }
-        static String comma(String sep, String[] v) {
-            if (v.length == 0)  return "";
-            String res = sep+v[0];
-            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
-            return res;
-        }
-        static String transform(String string) {
-            for (VAR var : values())
-                string = string.replaceAll(var.pattern, var.binding);
-            return string;
-        }
-    }
-    static String[] stringsIn(String[] strings, int beg, int end) {
-        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
-    }
-    static String[] stringsBefore(String[] strings, int pos) {
-        return stringsIn(strings, 0, pos);
-    }
-    static String[] stringsAfter(String[] strings, int pos) {
-        return stringsIn(strings, pos, strings.length);
-    }
-    static int indexAfter(String[] strings, int pos, String tag) {
-        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
-    }
-    static int indexBefore(String[] strings, int pos, String tag) {
-        for (int i = pos, end = strings.length; ; i++) {
-            if (i == end || strings[i].endsWith(tag))  return i;
-        }
-    }
-    static int MIN_ARITY, MAX_ARITY, MAX_RCAT, MAX_REFS, MAX_INTS, MAX_LONGS;
-    static boolean ALL_ARG_TYPES, ALL_RETURN_TYPES;
-    static HashSet<String> done = new HashSet<String>();
-    public static void main(String... av) {
-        for (String[] template : TEMPLATES) {
-            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
-            String[] forLines = stringsBefore(template, forLinesLimit);
-            template = stringsAfter(template, forLinesLimit);
-            for (String forLine : forLines)
-                expandTemplate(forLine, template);
-        }
-    }
-    static void expandTemplate(String forLine, String[] template) {
-        String[] params = forLine.split("[^0-9]+");
-        if (params[0].length() == 0)  params = stringsAfter(params, 1);
-        System.out.println("//params="+Arrays.asList(params));
-        int pcur = 0;
-        MIN_ARITY = Integer.valueOf(params[pcur++]);
-        MAX_ARITY = Integer.valueOf(params[pcur++]);
-        MAX_RCAT  = Integer.valueOf(params[pcur++]);
-        MAX_REFS  = Integer.valueOf(params[pcur++]);
-        MAX_INTS  = Integer.valueOf(params[pcur++]);
-        MAX_LONGS = Integer.valueOf(params[pcur++]);
-        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
-        if (MAX_RCAT >= TYPES.length)  MAX_RCAT = TYPES.length - 1;
-        ALL_ARG_TYPES = (indexBefore(template, 0, "@each-Tv@") < template.length);
-        ALL_RETURN_TYPES = (indexBefore(template, 0, "@each-R@") < template.length);
-        for (int nargs = MIN_ARITY; nargs <= MAX_ARITY; nargs++) {
-            for (int rcat = 0; rcat <= MAX_RCAT; rcat++) {
-                expandTemplate(template, true, rcat, nargs, 0, 0);
-                if (ALL_ARG_TYPES)  break;
-                expandTemplateForPrims(template, true, rcat, nargs, 1, 1);
-                if (ALL_RETURN_TYPES)  break;
-            }
-        }
-    }
-    static String catstr(int rcat, int nrefs, int nints, int nlongs) {
-        int nargs = nrefs + nints + nlongs;
-        String cat = TCHARS[rcat] + nargs;
-        if (!ALL_ARG_TYPES)  cat += (nints==0?"":"I"+nints)+(nlongs==0?"":"J"+nlongs);
-        return cat;
-    }
-    static void expandTemplateForPrims(String[] template, boolean topLevel, int rcat, int nargs, int minints, int minlongs) {
-        for (int isLong = 0; isLong <= 1; isLong++) {
-            for (int nprims = 1; nprims <= nargs; nprims++) {
-                int nrefs = nargs - nprims;
-                int nints = ((1-isLong) * nprims);
-                int nlongs = (isLong * nprims);
-                expandTemplate(template, topLevel, rcat, nrefs, nints, nlongs);
-            }
-        }
-    }
-    static void expandTemplate(String[] template, boolean topLevel,
-                               int rcat, int nrefs, int nints, int nlongs) {
-        int nargs = nrefs + nints + nlongs;
-        if (nrefs > MAX_REFS || nints > MAX_INTS || nlongs > MAX_LONGS)  return;
-        VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
-        if (topLevel && !done.add(VAR.cat.binding)) {
-            System.out.println("    //repeat "+VAR.cat.binding);
-            return;
-        }
-        for (int i = 0; i < template.length; i++) {
-            String line = template[i];
-            if (line.endsWith("@each-cat@")) {
-                // ignore
-            } else if (line.endsWith("@each-R@")) {
-                int blockEnd = indexAfter(template, i, "@end-R@");
-                String[] block = stringsIn(template, i+1, blockEnd-1);
-                for (int rcat1 = rcat; rcat1 <= MAX_RCAT; rcat1++)
-                    expandTemplate(block, false, rcat1, nrefs, nints, nlongs);
-                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
-                i = blockEnd-1; continue;
-            } else if (line.endsWith("@each-Tv@")) {
-                int blockEnd = indexAfter(template, i, "@end-Tv@");
-                String[] block = stringsIn(template, i+1, blockEnd-1);
-                expandTemplate(block, false, rcat, nrefs, nints, nlongs);
-                expandTemplateForPrims(block, false, rcat, nargs, nints+1, nlongs+1);
-                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
-                i = blockEnd-1; continue;
-            } else {
-                System.out.println(VAR.transform(line));
-            }
-        }
-    }
-}
-//}}} */
-//params=[0, 10, 4, 99, 0, 0]
-    static class A0 extends Adapter {
-        protected A0(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A0(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A0 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A0(e, i, c, t); }
-        protected Object invoke_L0() throws Throwable { return convert_L((Object)invoker.invokeExact(target)); }
-        protected Object invoke_I0() throws Throwable { return convert_I((int)   invoker.invokeExact(target)); }
-        protected Object invoke_J0() throws Throwable { return convert_J((long)  invoker.invokeExact(target)); }
-        protected Object invoke_F0() throws Throwable { return convert_F((float) invoker.invokeExact(target)); }
-        protected Object invoke_D0() throws Throwable { return convert_D((double)invoker.invokeExact(target)); }
-    }
-    static class A1 extends Adapter {
-        protected A1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A1(e, i, c, t); }
-        protected Object invoke_L1(Object a0) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0)); }
-        protected Object invoke_I1(Object a0) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0)); }
-        protected Object invoke_J1(Object a0) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0)); }
-        protected Object invoke_F1(Object a0) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0)); }
-        protected Object invoke_D1(Object a0) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0)); }
-    }
-    static class A2 extends Adapter {
-        protected A2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A2(e, i, c, t); }
-        protected Object invoke_L2(Object a0, Object a1) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_I2(Object a0, Object a1) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_J2(Object a0, Object a1) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_F2(Object a0, Object a1) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1)); }
-        protected Object invoke_D2(Object a0, Object a1) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1)); }
-    }
-    static class A3 extends Adapter {
-        protected A3(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A3(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A3 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A3(e, i, c, t); }
-        protected Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2)); }
-        protected Object invoke_I3(Object a0, Object a1, Object a2) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2)); }
-        protected Object invoke_J3(Object a0, Object a1, Object a2) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2)); }
-        protected Object invoke_F3(Object a0, Object a1, Object a2) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2)); }
-        protected Object invoke_D3(Object a0, Object a1, Object a2) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2)); }
-    }
-    static class A4 extends Adapter {
-        protected A4(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A4(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A4 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A4(e, i, c, t); }
-        protected Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3)); }
-        protected Object invoke_I4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3)); }
-        protected Object invoke_J4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3)); }
-        protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3)); }
-        protected Object invoke_D4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3)); }
-    }
-    static class A5 extends Adapter {
-        protected A5(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A5(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A5 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A5(e, i, c, t); }
-        protected Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
-        protected Object invoke_I5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
-        protected Object invoke_J5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
-        protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
-        protected Object invoke_D5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4)); }
-    }
-    static class A6 extends Adapter {
-        protected A6(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A6(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A6 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A6(e, i, c, t); }
-        protected Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_I6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_J6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_D6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5)); }
-    }
-    static class A7 extends Adapter {
-        protected A7(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A7(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A7 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A7(e, i, c, t); }
-        protected Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_I7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_J7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_D7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6)); }
-    }
-    static class A8 extends Adapter {
-        protected A8(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A8(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A8 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A8(e, i, c, t); }
-        protected Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_I8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_J8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_D8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7)); }
-    }
-    static class A9 extends Adapter {
-        protected A9(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A9(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A9 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A9(e, i, c, t); }
-        protected Object invoke_L9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_I9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_J9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_D9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-    }
-    static class A10 extends Adapter {
-        protected A10(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A10(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { super(e, i, c, t); }
-        protected A10 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)
-                        { return new A10(e, i, c, t); }
-        protected Object invoke_L10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_L((Object)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_I10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_I((int)   invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_J10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_J((long)  invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_F((float) invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_D10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_D((double)invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/InvokeGeneric.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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 sun.dyn;
-
-import java.dyn.*;
-import java.lang.reflect.*;
-import sun.dyn.util.*;
-import static sun.dyn.MethodTypeImpl.invokers;
-
-/**
- * Adapters which manage MethodHanndle.invokeGeneric calls.
- * The JVM calls one of these when the exact type match fails.
- * @author jrose
- */
-class InvokeGeneric {
-    // erased type for the call, which originates from an invokeGeneric site
-    private final MethodType erasedCallerType;
-    // an invoker of type (MT, MH; A...) -> R
-    private final MethodHandle initialInvoker;
-
-    /** Compute and cache information for this adapter, so that it can
-     *  call out to targets of the erasure-family of the given erased type.
-     */
-    private InvokeGeneric(MethodType erasedCallerType) throws ReflectiveOperationException {
-        this.erasedCallerType = erasedCallerType;
-        this.initialInvoker = makeInitialInvoker();
-        assert initialInvoker.type().equals(erasedCallerType
-                                            .insertParameterTypes(0, MethodType.class, MethodHandle.class))
-            : initialInvoker.type();
-    }
-
-    private static MethodHandles.Lookup lookup() {
-        return MethodHandleImpl.IMPL_LOOKUP;
-    }
-
-    /** Return the adapter information for this type's erasure. */
-    static MethodHandle genericInvokerOf(MethodType type) {
-        MethodTypeImpl form = MethodTypeImpl.of(type);
-        MethodHandle genericInvoker = form.genericInvoker;
-        if (genericInvoker == null) {
-            try {
-                InvokeGeneric gen = new InvokeGeneric(form.erasedType());
-                form.genericInvoker = genericInvoker = gen.initialInvoker;
-            } catch (ReflectiveOperationException ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-        return genericInvoker;
-    }
-
-    private MethodHandle makeInitialInvoker() throws ReflectiveOperationException {
-        // postDispatch = #(MH'; MT, MH; A...){MH'(MT, MH; A)}
-        MethodHandle postDispatch = makePostDispatchInvoker();
-        MethodHandle invoker;
-        if (returnConversionPossible()) {
-            invoker = MethodHandles.foldArguments(postDispatch,
-                                                  dispatcher("dispatchWithConversion"));
-        } else {
-            invoker = MethodHandles.foldArguments(postDispatch, dispatcher("dispatch"));
-        }
-        return invoker;
-    }
-
-    private static final Class<?>[] EXTRA_ARGS = { MethodType.class, MethodHandle.class };
-    private MethodHandle makePostDispatchInvoker() {
-        // Take (MH'; MT, MH; A...) and run MH'(MT, MH; A...).
-        MethodType invokerType = erasedCallerType.insertParameterTypes(0, EXTRA_ARGS);
-        return invokers(invokerType).exactInvoker();
-    }
-    private MethodHandle dropDispatchArguments(MethodHandle targetInvoker) {
-        assert(targetInvoker.type().parameterType(0) == MethodHandle.class);
-        return MethodHandles.dropArguments(targetInvoker, 1, EXTRA_ARGS);
-    }
-
-    private MethodHandle dispatcher(String dispatchName) throws ReflectiveOperationException {
-        return lookup().bind(this, dispatchName,
-                             MethodType.methodType(MethodHandle.class,
-                                                   MethodType.class, MethodHandle.class));
-    }
-
-    static final boolean USE_AS_TYPE_PATH = true;
-
-    /** Return a method handle to invoke on the callerType, target, and remaining arguments.
-     *  The method handle must finish the call.
-     *  This is the first look at the caller type and target.
-     */
-    private MethodHandle dispatch(MethodType callerType, MethodHandle target) {
-        MethodType targetType = target.type();
-        if (USE_AS_TYPE_PATH || target.isVarargsCollector()) {
-            MethodHandle newTarget = target.asType(callerType);
-            targetType = callerType;
-            Invokers invokers = MethodTypeImpl.invokers(Access.TOKEN, targetType);
-            MethodHandle invoker = invokers.erasedInvokerWithDrops;
-            if (invoker == null) {
-                invokers.erasedInvokerWithDrops = invoker =
-                    dropDispatchArguments(invokers.erasedInvoker());
-            }
-            return invoker.bindTo(newTarget);
-        }
-        throw new RuntimeException("NYI");
-    }
-
-    private MethodHandle dispatchWithConversion(MethodType callerType, MethodHandle target) {
-        MethodHandle finisher = dispatch(callerType, target);
-        if (returnConversionNeeded(callerType, target))
-            finisher = addReturnConversion(finisher, callerType.returnType());  //FIXME: slow
-        return finisher;
-    }
-
-    private boolean returnConversionPossible() {
-        Class<?> needType = erasedCallerType.returnType();
-        return !needType.isPrimitive();
-    }
-    private boolean returnConversionNeeded(MethodType callerType, MethodHandle target) {
-        Class<?> needType = callerType.returnType();
-        if (needType == erasedCallerType.returnType())
-            return false;  // no conversions possible, since must be primitive or Object
-        Class<?> haveType = target.type().returnType();
-        if (VerifyType.isNullConversion(haveType, needType))
-            return false;
-        return true;
-    }
-    private MethodHandle addReturnConversion(MethodHandle target, Class<?> type) {
-        if (true) throw new RuntimeException("NYI");
-        // FIXME: This is slow because it creates a closure node on every call that requires a return cast.
-        MethodType targetType = target.type();
-        MethodHandle caster = ValueConversions.identity(type);
-        caster = caster.asType(MethodType.methodType(type, targetType.returnType()));
-        // Drop irrelevant arguments, because we only care about the return value:
-        caster = MethodHandles.dropArguments(caster, 1, targetType.parameterList());
-        MethodHandle result = MethodHandles.foldArguments(caster, target);
-        return result.asType(target.type());
-    }
-
-    public String toString() {
-        return "InvokeGeneric"+erasedCallerType;
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/Invokers.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import java.dyn.*;
-import sun.dyn.empty.Empty;
-
-/**
- * Construction and caching of often-used invokers.
- * @author jrose
- */
-public class Invokers {
-    // exact type (sans leading taget MH) for the outgoing call
-    private final MethodType targetType;
-
-    // exact invoker for the outgoing call
-    private /*lazy*/ MethodHandle exactInvoker;
-
-    // erased (partially untyped but with primitives) invoker for the outgoing call
-    private /*lazy*/ MethodHandle erasedInvoker;
-    /*lazy*/ MethodHandle erasedInvokerWithDrops;  // for InvokeGeneric
-
-    // generic (untyped) invoker for the outgoing call
-    private /*lazy*/ MethodHandle genericInvoker;
-
-    // generic (untyped) invoker for the outgoing call; accepts a single Object[]
-    private final /*lazy*/ MethodHandle[] spreadInvokers;
-
-    // invoker for an unbound callsite
-    private /*lazy*/ MethodHandle uninitializedCallSite;
-
-    /** Compute and cache information common to all collecting adapters
-     *  that implement members of the erasure-family of the given erased type.
-     */
-    /*non-public*/ Invokers(MethodType targetType) {
-        this.targetType = targetType;
-        this.spreadInvokers = new MethodHandle[targetType.parameterCount()+1];
-    }
-
-    public static MethodType invokerType(MethodType targetType) {
-        return targetType.insertParameterTypes(0, MethodHandle.class);
-    }
-
-    public MethodHandle exactInvoker() {
-        MethodHandle invoker = exactInvoker;
-        if (invoker != null)  return invoker;
-        try {
-            invoker = MethodHandleImpl.IMPL_LOOKUP.findVirtual(MethodHandle.class, "invokeExact", targetType);
-        } catch (ReflectiveOperationException ex) {
-            throw new InternalError("JVM cannot find invoker for "+targetType);
-        }
-        assert(invokerType(targetType) == invoker.type());
-        exactInvoker = invoker;
-        return invoker;
-    }
-
-    public MethodHandle genericInvoker() {
-        MethodHandle invoker1 = exactInvoker();
-        MethodHandle invoker = genericInvoker;
-        if (invoker != null)  return invoker;
-        MethodType genericType = targetType.generic();
-        invoker = MethodHandles.convertArguments(invoker1, invokerType(genericType));
-        genericInvoker = invoker;
-        return invoker;
-    }
-
-    public MethodHandle erasedInvoker() {
-        MethodHandle invoker1 = exactInvoker();
-        MethodHandle invoker = erasedInvoker;
-        if (invoker != null)  return invoker;
-        MethodType erasedType = targetType.erase();
-        if (erasedType == targetType.generic())
-            invoker = genericInvoker();
-        else
-            invoker = MethodHandles.convertArguments(invoker1, invokerType(erasedType));
-        erasedInvoker = invoker;
-        return invoker;
-    }
-
-    public MethodHandle spreadInvoker(int objectArgCount) {
-        MethodHandle vaInvoker = spreadInvokers[objectArgCount];
-        if (vaInvoker != null)  return vaInvoker;
-        MethodHandle gInvoker = genericInvoker();
-        vaInvoker = gInvoker.asSpreader(Object[].class, targetType.parameterCount() - objectArgCount);
-        spreadInvokers[objectArgCount] = vaInvoker;
-        return vaInvoker;
-    }
-
-    private static MethodHandle THROW_UCS = null;
-
-    public MethodHandle uninitializedCallSite() {
-        MethodHandle invoker = uninitializedCallSite;
-        if (invoker != null)  return invoker;
-        if (targetType.parameterCount() > 0) {
-            MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount());
-            Invokers invokers0 = MethodTypeImpl.invokers(type0);
-            invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(),
-                                                  0, targetType.parameterList());
-            assert(invoker.type().equals(targetType));
-            uninitializedCallSite = invoker;
-            return invoker;
-        }
-        if (THROW_UCS == null) {
-            try {
-                THROW_UCS = MethodHandleImpl.IMPL_LOOKUP
-                    .findStatic(CallSite.class, "uninitializedCallSite",
-                                MethodType.methodType(Empty.class));
-            } catch (ReflectiveOperationException ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-        invoker = AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, targetType, THROW_UCS);
-        assert(invoker.type().equals(targetType));
-        uninitializedCallSite = invoker;
-        return invoker;
-    }
-
-    public String toString() {
-        return "Invokers"+targetType;
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/MemberName.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,739 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import sun.dyn.util.BytecodeDescriptor;
-import java.dyn.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Member;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import static sun.dyn.MethodHandleNatives.Constants.*;
-
-/**
- * A {@code MemberName} is a compact symbolic datum which fully characterizes
- * a method or field reference.
- * A member name refers to a field, method, constructor, or member type.
- * Every member name has a simple name (a string) and a type (either a Class or MethodType).
- * A member name may also have a non-null declaring class, or it may be simply
- * a naked name/type pair.
- * A member name may also have non-zero modifier flags.
- * Finally, a member name may be either resolved or unresolved.
- * If it is resolved, the existence of the named
- * <p>
- * Whether resolved or not, a member name provides no access rights or
- * invocation capability to its possessor.  It is merely a compact
- * representation of all symbolic information necessary to link to
- * and properly use the named member.
- * <p>
- * When resolved, a member name's internal implementation may include references to JVM metadata.
- * This representation is stateless and only decriptive.
- * It provides no private information and no capability to use the member.
- * <p>
- * By contrast, a {@linkplain java.lang.reflect.Method} contains fuller information
- * about the internals of a method (except its bytecodes) and also
- * allows invocation.  A MemberName is much lighter than a Method,
- * since it contains about 7 fields to the 16 of Method (plus its sub-arrays),
- * and those seven fields omit much of the information in Method.
- * @author jrose
- */
-public final class MemberName implements Member, Cloneable {
-    private Class<?>   clazz;       // class in which the method is defined
-    private String     name;        // may be null if not yet materialized
-    private Object     type;        // may be null if not yet materialized
-    private int        flags;       // modifier bits; see reflect.Modifier
-
-    private Object     vmtarget;    // VM-specific target value
-    private int        vmindex;     // method index within class or interface
-
-    { vmindex = VM_INDEX_UNINITIALIZED; }
-
-    /** Return the declaring class of this member.
-     *  In the case of a bare name and type, the declaring class will be null.
-     */
-    public Class<?> getDeclaringClass() {
-        if (clazz == null && isResolved()) {
-            expandFromVM();
-        }
-        return clazz;
-    }
-
-    /** Utility method producing the class loader of the declaring class. */
-    public ClassLoader getClassLoader() {
-        return clazz.getClassLoader();
-    }
-
-    /** Return the simple name of this member.
-     *  For a type, it is the same as {@link Class#getSimpleName}.
-     *  For a method or field, it is the simple name of the member.
-     *  For a constructor, it is always {@code "&lt;init&gt;"}.
-     */
-    public String getName() {
-        if (name == null) {
-            expandFromVM();
-            if (name == null)  return null;
-        }
-        return name;
-    }
-
-    /** Return the declared type of this member, which
-     *  must be a method or constructor.
-     */
-    public MethodType getMethodType() {
-        if (type == null) {
-            expandFromVM();
-            if (type == null)  return null;
-        }
-        if (!isInvocable())
-            throw newIllegalArgumentException("not invocable, no method type");
-        if (type instanceof MethodType) {
-            return (MethodType) type;
-        }
-        if (type instanceof String) {
-            String sig = (String) type;
-            MethodType res = MethodType.fromMethodDescriptorString(sig, getClassLoader());
-            this.type = res;
-            return res;
-        }
-        if (type instanceof Object[]) {
-            Object[] typeInfo = (Object[]) type;
-            Class<?>[] ptypes = (Class<?>[]) typeInfo[1];
-            Class<?> rtype = (Class<?>) typeInfo[0];
-            MethodType res = MethodType.methodType(rtype, ptypes);
-            this.type = res;
-            return res;
-        }
-        throw new InternalError("bad method type "+type);
-    }
-
-    /** Return the actual type under which this method or constructor must be invoked.
-     *  For non-static methods or constructors, this is the type with a leading parameter,
-     *  a reference to declaring class.  For static methods, it is the same as the declared type.
-     */
-    public MethodType getInvocationType() {
-        MethodType itype = getMethodType();
-        if (!isStatic())
-            itype = itype.insertParameterTypes(0, clazz);
-        return itype;
-    }
-
-    /** Utility method producing the parameter types of the method type. */
-    public Class<?>[] getParameterTypes() {
-        return getMethodType().parameterArray();
-    }
-
-    /** Utility method producing the return type of the method type. */
-    public Class<?> getReturnType() {
-        return getMethodType().returnType();
-    }
-
-    /** Return the declared type of this member, which
-     *  must be a field or type.
-     *  If it is a type member, that type itself is returned.
-     */
-    public Class<?> getFieldType() {
-        if (type == null) {
-            expandFromVM();
-            if (type == null)  return null;
-        }
-        if (isInvocable())
-            throw newIllegalArgumentException("not a field or nested class, no simple type");
-        if (type instanceof Class<?>) {
-            return (Class<?>) type;
-        }
-        if (type instanceof String) {
-            String sig = (String) type;
-            MethodType mtype = MethodType.fromMethodDescriptorString("()"+sig, getClassLoader());
-            Class<?> res = mtype.returnType();
-            this.type = res;
-            return res;
-        }
-        throw new InternalError("bad field type "+type);
-    }
-
-    /** Utility method to produce either the method type or field type of this member. */
-    public Object getType() {
-        return (isInvocable() ? getMethodType() : getFieldType());
-    }
-
-    /** Utility method to produce the signature of this member,
-     *  used within the class file format to describe its type.
-     */
-    public String getSignature() {
-        if (type == null) {
-            expandFromVM();
-            if (type == null)  return null;
-        }
-        if (type instanceof String)
-            return (String) type;
-        if (isInvocable())
-            return BytecodeDescriptor.unparse(getMethodType());
-        else
-            return BytecodeDescriptor.unparse(getFieldType());
-    }
-
-    /** Return the modifier flags of this member.
-     *  @see java.lang.reflect.Modifier
-     */
-    public int getModifiers() {
-        return (flags & RECOGNIZED_MODIFIERS);
-    }
-
-    private void setFlags(int flags) {
-        this.flags = flags;
-        assert(testAnyFlags(ALL_KINDS));
-    }
-
-    private boolean testFlags(int mask, int value) {
-        return (flags & mask) == value;
-    }
-    private boolean testAllFlags(int mask) {
-        return testFlags(mask, mask);
-    }
-    private boolean testAnyFlags(int mask) {
-        return !testFlags(mask, 0);
-    }
-
-    /** Utility method to query the modifier flags of this member. */
-    public boolean isStatic() {
-        return Modifier.isStatic(flags);
-    }
-    /** Utility method to query the modifier flags of this member. */
-    public boolean isPublic() {
-        return Modifier.isPublic(flags);
-    }
-    /** Utility method to query the modifier flags of this member. */
-    public boolean isPrivate() {
-        return Modifier.isPrivate(flags);
-    }
-    /** Utility method to query the modifier flags of this member. */
-    public boolean isProtected() {
-        return Modifier.isProtected(flags);
-    }
-    /** Utility method to query the modifier flags of this member. */
-    public boolean isFinal() {
-        return Modifier.isFinal(flags);
-    }
-    /** Utility method to query the modifier flags of this member. */
-    public boolean isAbstract() {
-        return Modifier.isAbstract(flags);
-    }
-    // let the rest (native, volatile, transient, etc.) be tested via Modifier.isFoo
-
-    // unofficial modifier flags, used by HotSpot:
-    static final int BRIDGE    = 0x00000040;
-    static final int VARARGS   = 0x00000080;
-    static final int SYNTHETIC = 0x00001000;
-    static final int ANNOTATION= 0x00002000;
-    static final int ENUM      = 0x00004000;
-    /** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
-    public boolean isBridge() {
-        return testAllFlags(IS_METHOD | BRIDGE);
-    }
-    /** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
-    public boolean isVarargs() {
-        return testAllFlags(VARARGS) && isInvocable();
-    }
-    /** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
-    public boolean isSynthetic() {
-        return testAllFlags(SYNTHETIC);
-    }
-
-    static final String CONSTRUCTOR_NAME = "<init>";  // the ever-popular
-
-    // modifiers exported by the JVM:
-    static final int RECOGNIZED_MODIFIERS = 0xFFFF;
-
-    // private flags, not part of RECOGNIZED_MODIFIERS:
-    static final int
-            IS_METHOD      = MN_IS_METHOD,      // method (not constructor)
-            IS_CONSTRUCTOR = MN_IS_CONSTRUCTOR, // constructor
-            IS_FIELD       = MN_IS_FIELD,       // field
-            IS_TYPE        = MN_IS_TYPE;        // nested type
-    static final int  // for MethodHandleNatives.getMembers
-            SEARCH_SUPERCLASSES = MN_SEARCH_SUPERCLASSES,
-            SEARCH_INTERFACES   = MN_SEARCH_INTERFACES;
-
-    static final int ALL_ACCESS = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED;
-    static final int ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE;
-    static final int IS_INVOCABLE = IS_METHOD | IS_CONSTRUCTOR;
-    static final int IS_FIELD_OR_METHOD = IS_METHOD | IS_FIELD;
-    static final int SEARCH_ALL_SUPERS = SEARCH_SUPERCLASSES | SEARCH_INTERFACES;
-
-    /** Utility method to query whether this member is a method or constructor. */
-    public boolean isInvocable() {
-        return testAnyFlags(IS_INVOCABLE);
-    }
-    /** Utility method to query whether this member is a method, constructor, or field. */
-    public boolean isFieldOrMethod() {
-        return testAnyFlags(IS_FIELD_OR_METHOD);
-    }
-    /** Query whether this member is a method. */
-    public boolean isMethod() {
-        return testAllFlags(IS_METHOD);
-    }
-    /** Query whether this member is a constructor. */
-    public boolean isConstructor() {
-        return testAllFlags(IS_CONSTRUCTOR);
-    }
-    /** Query whether this member is a field. */
-    public boolean isField() {
-        return testAllFlags(IS_FIELD);
-    }
-    /** Query whether this member is a type. */
-    public boolean isType() {
-        return testAllFlags(IS_TYPE);
-    }
-    /** Utility method to query whether this member is neither public, private, nor protected. */
-    public boolean isPackage() {
-        return !testAnyFlags(ALL_ACCESS);
-    }
-
-    /** Initialize a query.   It is not resolved. */
-    private void init(Class<?> defClass, String name, Object type, int flags) {
-        // defining class is allowed to be null (for a naked name/type pair)
-        //name.toString();  // null check
-        //type.equals(type);  // null check
-        // fill in fields:
-        this.clazz = defClass;
-        this.name = name;
-        this.type = type;
-        setFlags(flags);
-        assert(!isResolved());
-    }
-
-    private void expandFromVM() {
-        if (!isResolved())  return;
-        if (type instanceof Object[])
-            type = null;  // don't saddle JVM w/ typeInfo
-        MethodHandleNatives.expand(this);
-    }
-
-    // Capturing information from the Core Reflection API:
-    private static int flagsMods(int flags, int mods) {
-        assert((flags & RECOGNIZED_MODIFIERS) == 0);
-        assert((mods & ~RECOGNIZED_MODIFIERS) == 0);
-        return flags | mods;
-    }
-    /** Create a name for the given reflected method.  The resulting name will be in a resolved state. */
-    public MemberName(Method m) {
-        Object[] typeInfo = { m.getReturnType(), m.getParameterTypes() };
-        init(m.getDeclaringClass(), m.getName(), typeInfo, flagsMods(IS_METHOD, m.getModifiers()));
-        // fill in vmtarget, vmindex while we have m in hand:
-        MethodHandleNatives.init(this, m);
-        assert(isResolved());
-    }
-    /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
-    public MemberName(Constructor ctor) {
-        Object[] typeInfo = { void.class, ctor.getParameterTypes() };
-        init(ctor.getDeclaringClass(), CONSTRUCTOR_NAME, typeInfo, flagsMods(IS_CONSTRUCTOR, ctor.getModifiers()));
-        // fill in vmtarget, vmindex while we have ctor in hand:
-        MethodHandleNatives.init(this, ctor);
-        assert(isResolved());
-    }
-    /** Create a name for the given reflected field.  The resulting name will be in a resolved state. */
-    public MemberName(Field fld) {
-        init(fld.getDeclaringClass(), fld.getName(), fld.getType(), flagsMods(IS_FIELD, fld.getModifiers()));
-        // fill in vmtarget, vmindex while we have fld in hand:
-        MethodHandleNatives.init(this, fld);
-        assert(isResolved());
-    }
-    /** Create a name for the given class.  The resulting name will be in a resolved state. */
-    public MemberName(Class<?> type) {
-        init(type.getDeclaringClass(), type.getSimpleName(), type, flagsMods(IS_TYPE, type.getModifiers()));
-        vmindex = 0;  // isResolved
-        assert(isResolved());
-    }
-
-    // bare-bones constructor; the JVM will fill it in
-    MemberName() { }
-
-    // locally useful cloner
-    @Override protected MemberName clone() {
-        try {
-            return (MemberName) super.clone();
-        } catch (CloneNotSupportedException ex) {
-            throw new InternalError();
-        }
-     }
-
-    // %%% define equals/hashcode?
-
-    // Construction from symbolic parts, for queries:
-    /** Create a field or type name from the given components:  Declaring class, name, type, modifiers.
-     *  The declaring class may be supplied as null if this is to be a bare name and type.
-     *  The resulting name will in an unresolved state.
-     */
-    public MemberName(Class<?> defClass, String name, Class<?> type, int modifiers) {
-        init(defClass, name, type, IS_FIELD | (modifiers & RECOGNIZED_MODIFIERS));
-    }
-    /** Create a field or type name from the given components:  Declaring class, name, type.
-     *  The declaring class may be supplied as null if this is to be a bare name and type.
-     *  The modifier flags default to zero.
-     *  The resulting name will in an unresolved state.
-     */
-    public MemberName(Class<?> defClass, String name, Class<?> type) {
-        this(defClass, name, type, 0);
-    }
-    /** Create a method or constructor name from the given components:  Declaring class, name, type, modifiers.
-     *  It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
-     *  The declaring class may be supplied as null if this is to be a bare name and type.
-     *  The resulting name will in an unresolved state.
-     */
-    public MemberName(Class<?> defClass, String name, MethodType type, int modifiers) {
-        int flagBit = (name.equals(CONSTRUCTOR_NAME) ? IS_CONSTRUCTOR : IS_METHOD);
-        init(defClass, name, type, flagBit | (modifiers & RECOGNIZED_MODIFIERS));
-    }
-    /** Create a method or constructor name from the given components:  Declaring class, name, type, modifiers.
-     *  It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
-     *  The declaring class may be supplied as null if this is to be a bare name and type.
-     *  The modifier flags default to zero.
-     *  The resulting name will in an unresolved state.
-     */
-    public MemberName(Class<?> defClass, String name, MethodType type) {
-        this(defClass, name, type, 0);
-    }
-
-    /** Query whether this member name is resolved.
-     *  A resolved member name is one for which the JVM has found
-     *  a method, constructor, field, or type binding corresponding exactly to the name.
-     *  (Document?)
-     */
-    public boolean isResolved() {
-        return (vmindex != VM_INDEX_UNINITIALIZED);
-    }
-
-    /** Query whether this member name is resolved to a non-static, non-final method.
-     */
-    public boolean hasReceiverTypeDispatch() {
-        return (isMethod() && getVMIndex(Access.TOKEN) >= 0);
-    }
-
-    /** Produce a string form of this member name.
-     *  For types, it is simply the type's own string (as reported by {@code toString}).
-     *  For fields, it is {@code "DeclaringClass.name/type"}.
-     *  For methods and constructors, it is {@code "DeclaringClass.name(ptype...)rtype"}.
-     *  If the declaring class is null, the prefix {@code "DeclaringClass."} is omitted.
-     *  If the member is unresolved, a prefix {@code "*."} is prepended.
-     */
-    @Override
-    public String toString() {
-        if (isType())
-            return type.toString();  // class java.lang.String
-        // else it is a field, method, or constructor
-        StringBuilder buf = new StringBuilder();
-        if (getDeclaringClass() != null) {
-            buf.append(getName(clazz));
-            buf.append('.');
-        }
-        String name = getName();
-        buf.append(name == null ? "*" : name);
-        Object type = getType();
-        if (!isInvocable()) {
-            buf.append('/');
-            buf.append(type == null ? "*" : getName(type));
-        } else {
-            buf.append(type == null ? "(*)*" : getName(type));
-        }
-        /*
-        buf.append('/');
-        // key: Public, private, pRotected, sTatic, Final, sYnchronized,
-        // transient/Varargs, native, (interface), abstract, sTrict, sYnthetic,
-        // (annotation), Enum, (unused)
-        final String FIELD_MOD_CHARS  = "PprTF?vt????Y?E?";
-        final String METHOD_MOD_CHARS = "PprTFybVn?atY???";
-        String modChars = (isInvocable() ? METHOD_MOD_CHARS : FIELD_MOD_CHARS);
-        for (int i = 0; i < modChars.length(); i++) {
-            if ((flags & (1 << i)) != 0) {
-                char mc = modChars.charAt(i);
-                if (mc != '?')
-                    buf.append(mc);
-            }
-        }
-         */
-        return buf.toString();
-    }
-    private static String getName(Object obj) {
-        if (obj instanceof Class<?>)
-            return ((Class<?>)obj).getName();
-        return String.valueOf(obj);
-    }
-
-    // Queries to the JVM:
-    /** Document? */
-    public int getVMIndex(Access token) {
-        Access.check(token);
-        if (!isResolved())
-            throw newIllegalStateException("not resolved");
-        return vmindex;
-    }
-//    public Object getVMTarget(Access token) {
-//        Access.check(token);
-//        if (!isResolved())
-//            throw newIllegalStateException("not resolved");
-//        return vmtarget;
-//    }
-    private RuntimeException newIllegalStateException(String message) {
-        return new IllegalStateException(message+": "+this);
-    }
-
-    // handy shared exception makers (they simplify the common case code)
-    public static RuntimeException newIllegalArgumentException(String message) {
-        return new IllegalArgumentException(message);
-    }
-    public static IllegalAccessException newNoAccessException(MemberName name, Object from) {
-        return newNoAccessException("cannot access", name, from);
-    }
-    public static IllegalAccessException newNoAccessException(String message,
-            MemberName name, Object from) {
-        message += ": " + name;
-        if (from != null)  message += ", from " + from;
-        return new IllegalAccessException(message);
-    }
-    public static ReflectiveOperationException newNoAccessException(MemberName name) {
-        if (name.isResolved())
-            return new IllegalAccessException(name.toString());
-        else if (name.isConstructor())
-            return new NoSuchMethodException(name.toString());
-        else if (name.isMethod())
-            return new NoSuchMethodException(name.toString());
-        else
-            return new NoSuchFieldException(name.toString());
-    }
-    public static Error uncaughtException(Exception ex) {
-        Error err = new InternalError("uncaught exception");
-        err.initCause(ex);
-        return err;
-    }
-
-    /** Actually making a query requires an access check. */
-    public static Factory getFactory(Access token) {
-        Access.check(token);
-        return Factory.INSTANCE;
-    }
-    public static Factory getFactory() {
-        return getFactory(Access.getToken());
-    }
-    /** A factory type for resolving member names with the help of the VM.
-     *  TBD: Define access-safe public constructors for this factory.
-     */
-    public static class Factory {
-        private Factory() { } // singleton pattern
-        static Factory INSTANCE = new Factory();
-
-        private static int ALLOWED_FLAGS = SEARCH_ALL_SUPERS | ALL_KINDS;
-
-        /// Queries
-        List<MemberName> getMembers(Class<?> defc,
-                String matchName, Object matchType,
-                int matchFlags, Class<?> lookupClass) {
-            matchFlags &= ALLOWED_FLAGS;
-            String matchSig = null;
-            if (matchType != null) {
-                matchSig = BytecodeDescriptor.unparse(matchType);
-                if (matchSig.startsWith("("))
-                    matchFlags &= ~(ALL_KINDS & ~IS_INVOCABLE);
-                else
-                    matchFlags &= ~(ALL_KINDS & ~IS_FIELD);
-            }
-            final int BUF_MAX = 0x2000;
-            int len1 = matchName == null ? 10 : matchType == null ? 4 : 1;
-            MemberName[] buf = newMemberBuffer(len1);
-            int totalCount = 0;
-            ArrayList<MemberName[]> bufs = null;
-            int bufCount = 0;
-            for (;;) {
-                bufCount = MethodHandleNatives.getMembers(defc,
-                        matchName, matchSig, matchFlags,
-                        lookupClass,
-                        totalCount, buf);
-                if (bufCount <= buf.length) {
-                    if (bufCount < 0)  bufCount = 0;
-                    totalCount += bufCount;
-                    break;
-                }
-                // JVM returned to us with an intentional overflow!
-                totalCount += buf.length;
-                int excess = bufCount - buf.length;
-                if (bufs == null)  bufs = new ArrayList<MemberName[]>(1);
-                bufs.add(buf);
-                int len2 = buf.length;
-                len2 = Math.max(len2, excess);
-                len2 = Math.max(len2, totalCount / 4);
-                buf = newMemberBuffer(Math.min(BUF_MAX, len2));
-            }
-            ArrayList<MemberName> result = new ArrayList<MemberName>(totalCount);
-            if (bufs != null) {
-                for (MemberName[] buf0 : bufs) {
-                    Collections.addAll(result, buf0);
-                }
-            }
-            result.addAll(Arrays.asList(buf).subList(0, bufCount));
-            // Signature matching is not the same as type matching, since
-            // one signature might correspond to several types.
-            // So if matchType is a Class or MethodType, refilter the results.
-            if (matchType != null && matchType != matchSig) {
-                for (Iterator<MemberName> it = result.iterator(); it.hasNext();) {
-                    MemberName m = it.next();
-                    if (!matchType.equals(m.getType()))
-                        it.remove();
-                }
-            }
-            return result;
-        }
-        boolean resolveInPlace(MemberName m, boolean searchSupers, Class<?> lookupClass) {
-            if (m.name == null || m.type == null) {  // find unique non-overloaded name
-                Class<?> defc = m.getDeclaringClass();
-                List<MemberName> choices = null;
-                if (m.isMethod())
-                    choices = getMethods(defc, searchSupers, m.name, (MethodType) m.type, lookupClass);
-                else if (m.isConstructor())
-                    choices = getConstructors(defc, lookupClass);
-                else if (m.isField())
-                    choices = getFields(defc, searchSupers, m.name, (Class<?>) m.type, lookupClass);
-                //System.out.println("resolving "+m+" to "+choices);
-                if (choices == null || choices.size() != 1)
-                    return false;
-                if (m.name == null)  m.name = choices.get(0).name;
-                if (m.type == null)  m.type = choices.get(0).type;
-            }
-            MethodHandleNatives.resolve(m, lookupClass);
-            if (m.isResolved())  return true;
-            int matchFlags = m.flags | (searchSupers ? SEARCH_ALL_SUPERS : 0);
-            String matchSig = m.getSignature();
-            MemberName[] buf = { m };
-            int n = MethodHandleNatives.getMembers(m.getDeclaringClass(),
-                    m.getName(), matchSig, matchFlags, lookupClass, 0, buf);
-            if (n != 1)  return false;
-            return m.isResolved();
-        }
-        /** Produce a resolved version of the given member.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  If lookup fails or access is not permitted, null is returned.
-         *  Otherwise a fresh copy of the given member is returned, with modifier bits filled in.
-         */
-        public MemberName resolveOrNull(MemberName m, boolean searchSupers, Class<?> lookupClass) {
-            MemberName result = m.clone();
-            if (resolveInPlace(result, searchSupers, lookupClass))
-                return result;
-            return null;
-        }
-        /** Produce a resolved version of the given member.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  If lookup fails or access is not permitted, a {@linkplain ReflectiveOperationException} is thrown.
-         *  Otherwise a fresh copy of the given member is returned, with modifier bits filled in.
-         */
-        public
-        <NoSuchMemberException extends ReflectiveOperationException>
-        MemberName resolveOrFail(MemberName m, boolean searchSupers, Class<?> lookupClass,
-                                 Class<NoSuchMemberException> nsmClass)
-                throws IllegalAccessException, NoSuchMemberException {
-            MemberName result = resolveOrNull(m, searchSupers, lookupClass);
-            if (result != null)
-                return result;
-            ReflectiveOperationException ex = newNoAccessException(m);
-            if (ex instanceof IllegalAccessException)  throw (IllegalAccessException) ex;
-            throw nsmClass.cast(ex);
-        }
-        /** Return a list of all methods defined by the given class.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  Inaccessible members are not added to the last.
-         */
-        public List<MemberName> getMethods(Class<?> defc, boolean searchSupers,
-                Class<?> lookupClass) {
-            return getMethods(defc, searchSupers, null, null, lookupClass);
-        }
-        /** Return a list of matching methods defined by the given class.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Returned methods will match the name (if not null) and the type (if not null).
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  Inaccessible members are not added to the last.
-         */
-        public List<MemberName> getMethods(Class<?> defc, boolean searchSupers,
-                String name, MethodType type, Class<?> lookupClass) {
-            int matchFlags = IS_METHOD | (searchSupers ? SEARCH_ALL_SUPERS : 0);
-            return getMembers(defc, name, type, matchFlags, lookupClass);
-        }
-        /** Return a list of all constructors defined by the given class.
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  Inaccessible members are not added to the last.
-         */
-        public List<MemberName> getConstructors(Class<?> defc, Class<?> lookupClass) {
-            return getMembers(defc, null, null, IS_CONSTRUCTOR, lookupClass);
-        }
-        /** Return a list of all fields defined by the given class.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  Inaccessible members are not added to the last.
-         */
-        public List<MemberName> getFields(Class<?> defc, boolean searchSupers,
-                Class<?> lookupClass) {
-            return getFields(defc, searchSupers, null, null, lookupClass);
-        }
-        /** Return a list of all fields defined by the given class.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Returned fields will match the name (if not null) and the type (if not null).
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  Inaccessible members are not added to the last.
-         */
-        public List<MemberName> getFields(Class<?> defc, boolean searchSupers,
-                String name, Class<?> type, Class<?> lookupClass) {
-            int matchFlags = IS_FIELD | (searchSupers ? SEARCH_ALL_SUPERS : 0);
-            return getMembers(defc, name, type, matchFlags, lookupClass);
-        }
-        /** Return a list of all nested types defined by the given class.
-         *  Super types are searched (for inherited members) if {@code searchSupers} is true.
-         *  Access checking is performed on behalf of the given {@code lookupClass}.
-         *  Inaccessible members are not added to the last.
-         */
-        public List<MemberName> getNestedTypes(Class<?> defc, boolean searchSupers,
-                Class<?> lookupClass) {
-            int matchFlags = IS_TYPE | (searchSupers ? SEARCH_ALL_SUPERS : 0);
-            return getMembers(defc, null, null, matchFlags, lookupClass);
-        }
-        private static MemberName[] newMemberBuffer(int length) {
-            MemberName[] buf = new MemberName[length];
-            // fill the buffer with dummy structs for the JVM to fill in
-            for (int i = 0; i < length; i++)
-                buf[i] = new MemberName();
-            return buf;
-        }
-    }
-
-//    static {
-//        System.out.println("Hello world!  My methods are:");
-//        System.out.println(Factory.INSTANCE.getMethods(MemberName.class, true, null));
-//    }
-}
--- a/jdk/src/share/classes/sun/dyn/MethodHandleImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1284 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import java.dyn.*;
-import java.dyn.MethodHandles.Lookup;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import sun.dyn.util.VerifyType;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import sun.dyn.empty.Empty;
-import sun.dyn.util.ValueConversions;
-import sun.dyn.util.Wrapper;
-import sun.misc.Unsafe;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-import static sun.dyn.MemberName.newNoAccessException;
-import static sun.dyn.MemberName.uncaughtException;
-
-/**
- * Base class for method handles, containing JVM-specific fields and logic.
- * TO DO:  It should not be a base class.
- * @author jrose
- */
-public abstract class MethodHandleImpl {
-
-    // Fields which really belong in MethodHandle:
-    private byte       vmentry;    // adapter stub or method entry point
-    //private int      vmslots;    // optionally, hoist type.form.vmslots
-    protected Object   vmtarget;   // VM-specific, class-specific target value
-    //MethodType       type;       // defined in MethodHandle
-
-    // TO DO:  vmtarget should be invisible to Java, since the JVM puts internal
-    // managed pointers into it.  Making it visible exposes it to debuggers,
-    // which can cause errors when they treat the pointer as an Object.
-
-    // These two dummy fields are present to force 'I' and 'J' signatures
-    // into this class's constant pool, so they can be transferred
-    // to vmentry when this class is loaded.
-    static final int  INT_FIELD = 0;
-    static final long LONG_FIELD = 0;
-
-    /** Access methods for the internals of MethodHandle, supplied to
-     *  MethodHandleImpl as a trusted agent.
-     */
-    static public interface MethodHandleFriend {
-        void initType(MethodHandle mh, MethodType type);
-    }
-    public static void setMethodHandleFriend(Access token, MethodHandleFriend am) {
-        Access.check(token);
-        if (METHOD_HANDLE_FRIEND != null)
-            throw new InternalError();  // just once
-        METHOD_HANDLE_FRIEND = am;
-    }
-    static private MethodHandleFriend METHOD_HANDLE_FRIEND;
-
-    // NOT public
-    static void initType(MethodHandle mh, MethodType type) {
-        METHOD_HANDLE_FRIEND.initType(mh, type);
-    }
-
-    // type is defined in java.dyn.MethodHandle, which is platform-independent
-
-    // vmentry (a void* field) is used *only* by by the JVM.
-    // The JVM adjusts its type to int or long depending on system wordsize.
-    // Since it is statically typed as neither int nor long, it is impossible
-    // to use this field from Java bytecode.  (Please don't try to, either.)
-
-    // The vmentry is an assembly-language stub which is jumped to
-    // immediately after the method type is verified.
-    // For a direct MH, this stub loads the vmtarget's entry point
-    // and jumps to it.
-
-    /**
-     * VM-based method handles must have a security token.
-     * This security token can only be obtained by trusted code.
-     * Do not create method handles directly; use factory methods.
-     */
-    public MethodHandleImpl(Access token) {
-        Access.check(token);
-    }
-
-    /** Initialize the method type form to participate in JVM calls.
-     *  This is done once for each erased type.
-     */
-    public static void init(Access token, MethodType self) {
-        Access.check(token);
-        if (MethodHandleNatives.JVM_SUPPORT)
-            MethodHandleNatives.init(self);
-    }
-
-    /// Factory methods to create method handles:
-
-    private static final MemberName.Factory LOOKUP = MemberName.Factory.INSTANCE;
-
-    static private Lookup IMPL_LOOKUP_INIT;
-
-    public static void initLookup(Access token, Lookup lookup) {
-        Access.check(token);
-        if (IMPL_LOOKUP_INIT != null)
-            throw new InternalError();
-        IMPL_LOOKUP_INIT = lookup;
-    }
-
-    public static Lookup getLookup(Access token) {
-        Access.check(token);
-        return IMPL_LOOKUP;
-    }
-
-    static {
-        if (!MethodHandleNatives.JVM_SUPPORT)  // force init of native API
-            throw new InternalError("No JVM support for JSR 292");
-        // Force initialization of Lookup, so it calls us back as initLookup:
-        MethodHandles.publicLookup();
-        if (IMPL_LOOKUP_INIT == null)
-            throw new InternalError();
-    }
-
-    public static void initStatics() {
-        // Trigger preceding sequence.
-    }
-
-    /** Shared secret with MethodHandles.Lookup, a copy of Lookup.IMPL_LOOKUP. */
-    static final Lookup IMPL_LOOKUP = IMPL_LOOKUP_INIT;
-
-
-    /** Look up a given method.
-     * Callable only from java.dyn and related packages.
-     * <p>
-     * The resulting method handle type will be of the given type,
-     * with a receiver type {@code rcvc} prepended if the member is not static.
-     * <p>
-     * Access checks are made as of the given lookup class.
-     * In particular, if the method is protected and {@code defc} is in a
-     * different package from the lookup class, then {@code rcvc} must be
-     * the lookup class or a subclass.
-     * @param token Proof that the lookup class has access to this package.
-     * @param member Resolved method or constructor to call.
-     * @param name Name of the desired method.
-     * @param rcvc Receiver type of desired non-static method (else null)
-     * @param doDispatch whether the method handle will test the receiver type
-     * @param lookupClass access-check relative to this class
-     * @return a direct handle to the matching method
-     * @throws IllegalAccessException if the given method cannot be accessed by the lookup class
-     */
-    public static
-    MethodHandle findMethod(Access token, MemberName method,
-                            boolean doDispatch, Class<?> lookupClass) throws IllegalAccessException {
-        Access.check(token);  // only trusted calls
-        MethodType mtype = method.getMethodType();
-        if (!method.isStatic()) {
-            // adjust the advertised receiver type to be exactly the one requested
-            // (in the case of invokespecial, this will be the calling class)
-            Class<?> recvType = method.getDeclaringClass();
-            mtype = mtype.insertParameterTypes(0, recvType);
-        }
-        DirectMethodHandle mh = new DirectMethodHandle(mtype, method, doDispatch, lookupClass);
-        if (!mh.isValid())
-            throw newNoAccessException(method, lookupClass);
-        assert(mh.type() == mtype);
-        if (!method.isVarargs())
-            return mh;
-        else
-            return mh.asVarargsCollector(mtype.parameterType(mtype.parameterCount()-1));
-    }
-
-    public static
-    MethodHandle makeAllocator(Access token, MethodHandle rawConstructor) {
-        Access.check(token);
-        MethodType rawConType = rawConstructor.type();
-        // Wrap the raw (unsafe) constructor with the allocation of a suitable object.
-        MethodHandle allocator
-            = AllocateObject.make(token, rawConType.parameterType(0), rawConstructor);
-        assert(allocator.type()
-               .equals(rawConType.dropParameterTypes(0, 1).changeReturnType(rawConType.parameterType(0))));
-        return allocator;
-    }
-
-    static final class AllocateObject<C> extends BoundMethodHandle {
-        private static final Unsafe unsafe = Unsafe.getUnsafe();
-
-        private final Class<C> allocateClass;
-        private final MethodHandle rawConstructor;
-
-        private AllocateObject(MethodHandle invoker,
-                               Class<C> allocateClass, MethodHandle rawConstructor) {
-            super(Access.TOKEN, invoker);
-            this.allocateClass = allocateClass;
-            this.rawConstructor = rawConstructor;
-        }
-        static MethodHandle make(Access token,
-                                 Class<?> allocateClass, MethodHandle rawConstructor) {
-            Access.check(token);
-            MethodType rawConType = rawConstructor.type();
-            assert(rawConType.parameterType(0) == allocateClass);
-            MethodType newType = rawConType.dropParameterTypes(0, 1).changeReturnType(allocateClass);
-            int nargs = rawConType.parameterCount() - 1;
-            if (nargs < INVOKES.length) {
-                MethodHandle invoke = INVOKES[nargs];
-                MethodType conType = CON_TYPES[nargs];
-                MethodHandle gcon = convertArguments(token, rawConstructor, conType, rawConType, null);
-                if (gcon == null)  return null;
-                MethodHandle galloc = new AllocateObject(invoke, allocateClass, gcon);
-                assert(galloc.type() == newType.generic());
-                return convertArguments(token, galloc, newType, galloc.type(), null);
-            } else {
-                MethodHandle invoke = VARARGS_INVOKE;
-                MethodType conType = CON_TYPES[nargs];
-                MethodHandle gcon = spreadArguments(token, rawConstructor, conType, 1);
-                if (gcon == null)  return null;
-                MethodHandle galloc = new AllocateObject(invoke, allocateClass, gcon);
-                return collectArguments(token, galloc, newType, 1, null);
-            }
-        }
-        @Override
-        public String toString() {
-            return addTypeString(allocateClass.getSimpleName(), this);
-        }
-        @SuppressWarnings("unchecked")
-        private C allocate() throws InstantiationException {
-            return (C) unsafe.allocateInstance(allocateClass);
-        }
-        private C invoke_V(Object... av) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, av);
-            return obj;
-        }
-        private C invoke_L0() throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj);
-            return obj;
-        }
-        private C invoke_L1(Object a0) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0);
-            return obj;
-        }
-        private C invoke_L2(Object a0, Object a1) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1);
-            return obj;
-        }
-        private C invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1, a2);
-            return obj;
-        }
-        private C invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3);
-            return obj;
-        }
-        private C invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4);
-            return obj;
-        }
-        private C invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4, a5);
-            return obj;
-        }
-        private C invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4, a5, a6);
-            return obj;
-        }
-        private C invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            C obj = allocate();
-            rawConstructor.invokeExact((Object)obj, a0, a1, a2, a3, a4, a5, a6, a7);
-            return obj;
-        }
-        static MethodHandle[] makeInvokes() {
-            ArrayList<MethodHandle> invokes = new ArrayList<MethodHandle>();
-            MethodHandles.Lookup lookup = IMPL_LOOKUP;
-            for (;;) {
-                int nargs = invokes.size();
-                String name = "invoke_L"+nargs;
-                MethodHandle invoke = null;
-                try {
-                    invoke = lookup.findVirtual(AllocateObject.class, name, MethodType.genericMethodType(nargs));
-                } catch (ReflectiveOperationException ex) {
-                }
-                if (invoke == null)  break;
-                invokes.add(invoke);
-            }
-            assert(invokes.size() == 9);  // current number of methods
-            return invokes.toArray(new MethodHandle[0]);
-        };
-        static final MethodHandle[] INVOKES = makeInvokes();
-        // For testing use this:
-        //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2);
-        static final MethodHandle VARARGS_INVOKE;
-        static {
-            try {
-                VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(AllocateObject.class, "invoke_V", MethodType.genericMethodType(0, true));
-            } catch (ReflectiveOperationException ex) {
-                throw uncaughtException(ex);
-            }
-        }
-        // Corresponding generic constructor types:
-        static final MethodType[] CON_TYPES = new MethodType[INVOKES.length];
-        static {
-            for (int i = 0; i < INVOKES.length; i++)
-                CON_TYPES[i] = makeConType(INVOKES[i]);
-        }
-        static final MethodType VARARGS_CON_TYPE = makeConType(VARARGS_INVOKE);
-        static MethodType makeConType(MethodHandle invoke) {
-            MethodType invType = invoke.type();
-            return invType.changeParameterType(0, Object.class).changeReturnType(void.class);
-        }
-    }
-
-    public static
-    MethodHandle accessField(Access token,
-                             MemberName member, boolean isSetter,
-                             Class<?> lookupClass) {
-        Access.check(token);
-        // Use sun. misc.Unsafe to dig up the dirt on the field.
-        MethodHandle mh = new FieldAccessor(token, member, isSetter);
-        return mh;
-    }
-
-    public static
-    MethodHandle accessArrayElement(Access token,
-                                    Class<?> arrayClass, boolean isSetter) {
-        Access.check(token);
-        if (!arrayClass.isArray())
-            throw newIllegalArgumentException("not an array: "+arrayClass);
-        Class<?> elemClass = arrayClass.getComponentType();
-        MethodHandle[] mhs = FieldAccessor.ARRAY_CACHE.get(elemClass);
-        if (mhs == null) {
-            if (!FieldAccessor.doCache(elemClass))
-                return FieldAccessor.ahandle(arrayClass, isSetter);
-            mhs = new MethodHandle[] {
-                FieldAccessor.ahandle(arrayClass, false),
-                FieldAccessor.ahandle(arrayClass, true)
-            };
-            if (mhs[0].type().parameterType(0) == Class.class) {
-                mhs[0] = MethodHandles.insertArguments(mhs[0], 0, elemClass);
-                mhs[1] = MethodHandles.insertArguments(mhs[1], 0, elemClass);
-            }
-            synchronized (FieldAccessor.ARRAY_CACHE) {}  // memory barrier
-            FieldAccessor.ARRAY_CACHE.put(elemClass, mhs);
-        }
-        return mhs[isSetter ? 1 : 0];
-    }
-
-    static final class FieldAccessor<C,V> extends BoundMethodHandle {
-        private static final Unsafe unsafe = Unsafe.getUnsafe();
-        final Object base;  // for static refs only
-        final long offset;
-        final String name;
-
-        public FieldAccessor(Access token, MemberName field, boolean isSetter) {
-            super(Access.TOKEN, fhandle(field.getDeclaringClass(), field.getFieldType(), isSetter, field.isStatic()));
-            this.offset = (long) field.getVMIndex(token);
-            this.name = field.getName();
-            this.base = staticBase(field);
-        }
-        public String toString() { return addTypeString(name, this); }
-
-        int getFieldI(C obj) { return unsafe.getInt(obj, offset); }
-        void setFieldI(C obj, int x) { unsafe.putInt(obj, offset, x); }
-        long getFieldJ(C obj) { return unsafe.getLong(obj, offset); }
-        void setFieldJ(C obj, long x) { unsafe.putLong(obj, offset, x); }
-        float getFieldF(C obj) { return unsafe.getFloat(obj, offset); }
-        void setFieldF(C obj, float x) { unsafe.putFloat(obj, offset, x); }
-        double getFieldD(C obj) { return unsafe.getDouble(obj, offset); }
-        void setFieldD(C obj, double x) { unsafe.putDouble(obj, offset, x); }
-        boolean getFieldZ(C obj) { return unsafe.getBoolean(obj, offset); }
-        void setFieldZ(C obj, boolean x) { unsafe.putBoolean(obj, offset, x); }
-        byte getFieldB(C obj) { return unsafe.getByte(obj, offset); }
-        void setFieldB(C obj, byte x) { unsafe.putByte(obj, offset, x); }
-        short getFieldS(C obj) { return unsafe.getShort(obj, offset); }
-        void setFieldS(C obj, short x) { unsafe.putShort(obj, offset, x); }
-        char getFieldC(C obj) { return unsafe.getChar(obj, offset); }
-        void setFieldC(C obj, char x) { unsafe.putChar(obj, offset, x); }
-        @SuppressWarnings("unchecked")
-        V getFieldL(C obj) { return (V) unsafe.getObject(obj, offset); }
-        @SuppressWarnings("unchecked")
-        void setFieldL(C obj, V x) { unsafe.putObject(obj, offset, x); }
-        // cast (V) is OK here, since we wrap convertArguments around the MH.
-
-        static Object staticBase(MemberName field) {
-            if (!field.isStatic())  return null;
-            Class c = field.getDeclaringClass();
-            java.lang.reflect.Field f;
-            try {
-                // FIXME:  Should not have to create 'f' to get this value.
-                f = c.getDeclaredField(field.getName());
-                return unsafe.staticFieldBase(f);
-            } catch (Exception ee) {
-                throw uncaughtException(ee);
-            }
-        }
-
-        int getStaticI() { return unsafe.getInt(base, offset); }
-        void setStaticI(int x) { unsafe.putInt(base, offset, x); }
-        long getStaticJ() { return unsafe.getLong(base, offset); }
-        void setStaticJ(long x) { unsafe.putLong(base, offset, x); }
-        float getStaticF() { return unsafe.getFloat(base, offset); }
-        void setStaticF(float x) { unsafe.putFloat(base, offset, x); }
-        double getStaticD() { return unsafe.getDouble(base, offset); }
-        void setStaticD(double x) { unsafe.putDouble(base, offset, x); }
-        boolean getStaticZ() { return unsafe.getBoolean(base, offset); }
-        void setStaticZ(boolean x) { unsafe.putBoolean(base, offset, x); }
-        byte getStaticB() { return unsafe.getByte(base, offset); }
-        void setStaticB(byte x) { unsafe.putByte(base, offset, x); }
-        short getStaticS() { return unsafe.getShort(base, offset); }
-        void setStaticS(short x) { unsafe.putShort(base, offset, x); }
-        char getStaticC() { return unsafe.getChar(base, offset); }
-        void setStaticC(char x) { unsafe.putChar(base, offset, x); }
-        V getStaticL() { return (V) unsafe.getObject(base, offset); }
-        void setStaticL(V x) { unsafe.putObject(base, offset, x); }
-
-        static String fname(Class<?> vclass, boolean isSetter, boolean isStatic) {
-            String stem;
-            if (!isStatic)
-                stem = (!isSetter ? "getField" : "setField");
-            else
-                stem = (!isSetter ? "getStatic" : "setStatic");
-            return stem + Wrapper.basicTypeChar(vclass);
-        }
-        static MethodType ftype(Class<?> cclass, Class<?> vclass, boolean isSetter, boolean isStatic) {
-            MethodType type;
-            if (!isStatic) {
-                if (!isSetter)
-                    return MethodType.methodType(vclass, cclass);
-                else
-                    return MethodType.methodType(void.class, cclass, vclass);
-            } else {
-                if (!isSetter)
-                    return MethodType.methodType(vclass);
-                else
-                    return MethodType.methodType(void.class, vclass);
-            }
-        }
-        static MethodHandle fhandle(Class<?> cclass, Class<?> vclass, boolean isSetter, boolean isStatic) {
-            String name = FieldAccessor.fname(vclass, isSetter, isStatic);
-            if (cclass.isPrimitive())  throw newIllegalArgumentException("primitive "+cclass);
-            Class<?> ecclass = Object.class;  //erase this type
-            Class<?> evclass = vclass;
-            if (!evclass.isPrimitive())  evclass = Object.class;
-            MethodType type = FieldAccessor.ftype(ecclass, evclass, isSetter, isStatic);
-            MethodHandle mh;
-            try {
-                mh = IMPL_LOOKUP.findVirtual(FieldAccessor.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-                throw uncaughtException(ex);
-            }
-            if (evclass != vclass || (!isStatic && ecclass != cclass)) {
-                MethodType strongType = FieldAccessor.ftype(cclass, vclass, isSetter, isStatic);
-                strongType = strongType.insertParameterTypes(0, FieldAccessor.class);
-                mh = MethodHandles.convertArguments(mh, strongType);
-            }
-            return mh;
-        }
-
-        /// Support for array element access
-        static final HashMap<Class<?>, MethodHandle[]> ARRAY_CACHE =
-                new HashMap<Class<?>, MethodHandle[]>();
-        // FIXME: Cache on the classes themselves, not here.
-        static boolean doCache(Class<?> elemClass) {
-            if (elemClass.isPrimitive())  return true;
-            ClassLoader cl = elemClass.getClassLoader();
-            return cl == null || cl == ClassLoader.getSystemClassLoader();
-        }
-        static int getElementI(int[] a, int i) { return a[i]; }
-        static void setElementI(int[] a, int i, int x) { a[i] = x; }
-        static long getElementJ(long[] a, int i) { return a[i]; }
-        static void setElementJ(long[] a, int i, long x) { a[i] = x; }
-        static float getElementF(float[] a, int i) { return a[i]; }
-        static void setElementF(float[] a, int i, float x) { a[i] = x; }
-        static double getElementD(double[] a, int i) { return a[i]; }
-        static void setElementD(double[] a, int i, double x) { a[i] = x; }
-        static boolean getElementZ(boolean[] a, int i) { return a[i]; }
-        static void setElementZ(boolean[] a, int i, boolean x) { a[i] = x; }
-        static byte getElementB(byte[] a, int i) { return a[i]; }
-        static void setElementB(byte[] a, int i, byte x) { a[i] = x; }
-        static short getElementS(short[] a, int i) { return a[i]; }
-        static void setElementS(short[] a, int i, short x) { a[i] = x; }
-        static char getElementC(char[] a, int i) { return a[i]; }
-        static void setElementC(char[] a, int i, char x) { a[i] = x; }
-        static Object getElementL(Object[] a, int i) { return a[i]; }
-        static void setElementL(Object[] a, int i, Object x) { a[i] = x; }
-        static <V> V getElementL(Class<V[]> aclass, V[] a, int i) { return aclass.cast(a)[i]; }
-        static <V> void setElementL(Class<V[]> aclass, V[] a, int i, V x) { aclass.cast(a)[i] = x; }
-
-        static String aname(Class<?> aclass, boolean isSetter) {
-            Class<?> vclass = aclass.getComponentType();
-            if (vclass == null)  throw new IllegalArgumentException();
-            return (!isSetter ? "getElement" : "setElement") + Wrapper.basicTypeChar(vclass);
-        }
-        static MethodType atype(Class<?> aclass, boolean isSetter) {
-            Class<?> vclass = aclass.getComponentType();
-            if (!isSetter)
-                return MethodType.methodType(vclass, aclass, int.class);
-            else
-                return MethodType.methodType(void.class, aclass, int.class, vclass);
-        }
-        static MethodHandle ahandle(Class<?> aclass, boolean isSetter) {
-            Class<?> vclass = aclass.getComponentType();
-            String name = FieldAccessor.aname(aclass, isSetter);
-            Class<?> caclass = null;
-            if (!vclass.isPrimitive() && vclass != Object.class) {
-                caclass = aclass;
-                aclass = Object[].class;
-                vclass = Object.class;
-            }
-            MethodType type = FieldAccessor.atype(aclass, isSetter);
-            if (caclass != null)
-                type = type.insertParameterTypes(0, Class.class);
-            MethodHandle mh;
-            try {
-                mh = IMPL_LOOKUP.findStatic(FieldAccessor.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-                throw uncaughtException(ex);
-            }
-            if (caclass != null) {
-                MethodType strongType = FieldAccessor.atype(caclass, isSetter);
-                mh = MethodHandles.insertArguments(mh, 0, caclass);
-                mh = MethodHandles.convertArguments(mh, strongType);
-            }
-            return mh;
-        }
-    }
-
-    /** Bind a predetermined first argument to the given direct method handle.
-     * Callable only from MethodHandles.
-     * @param token Proof that the caller has access to this package.
-     * @param target Any direct method handle.
-     * @param receiver Receiver (or first static method argument) to pre-bind.
-     * @return a BoundMethodHandle for the given DirectMethodHandle, or null if it does not exist
-     */
-    public static
-    MethodHandle bindReceiver(Access token,
-                              MethodHandle target, Object receiver) {
-        Access.check(token);
-        if (target instanceof AdapterMethodHandle &&
-            ((AdapterMethodHandle)target).conversionOp() == MethodHandleNatives.Constants.OP_RETYPE_ONLY
-            ) {
-            Object info = MethodHandleNatives.getTargetInfo(target);
-            if (info instanceof DirectMethodHandle) {
-                DirectMethodHandle dmh = (DirectMethodHandle) info;
-                if (receiver == null ||
-                    dmh.type().parameterType(0).isAssignableFrom(receiver.getClass())) {
-                    MethodHandle bmh = new BoundMethodHandle(dmh, receiver, 0);
-                    MethodType newType = target.type().dropParameterTypes(0, 1);
-                    return convertArguments(token, bmh, newType, bmh.type(), null);
-                }
-            }
-        }
-        if (target instanceof DirectMethodHandle)
-            return new BoundMethodHandle((DirectMethodHandle)target, receiver, 0);
-        return null;   // let caller try something else
-    }
-
-    /** Bind a predetermined argument to the given arbitrary method handle.
-     * Callable only from MethodHandles.
-     * @param token Proof that the caller has access to this package.
-     * @param target Any method handle.
-     * @param receiver Argument (which can be a boxed primitive) to pre-bind.
-     * @return a suitable BoundMethodHandle
-     */
-    public static
-    MethodHandle bindArgument(Access token,
-                              MethodHandle target, int argnum, Object receiver) {
-        Access.check(token);
-        return new BoundMethodHandle(target, receiver, argnum);
-    }
-
-    public static MethodHandle convertArguments(Access token,
-                                                MethodHandle target,
-                                                MethodType newType,
-                                                MethodType oldType,
-                                                int[] permutationOrNull) {
-        Access.check(token);
-        assert(oldType.parameterCount() == target.type().parameterCount());
-        if (permutationOrNull != null) {
-            int outargs = oldType.parameterCount(), inargs = newType.parameterCount();
-            if (permutationOrNull.length != outargs)
-                throw newIllegalArgumentException("wrong number of arguments in permutation");
-            // Make the individual outgoing argument types match up first.
-            Class<?>[] callTypeArgs = new Class<?>[outargs];
-            for (int i = 0; i < outargs; i++)
-                callTypeArgs[i] = newType.parameterType(permutationOrNull[i]);
-            MethodType callType = MethodType.methodType(oldType.returnType(), callTypeArgs);
-            target = convertArguments(token, target, callType, oldType, null);
-            assert(target != null);
-            oldType = target.type();
-            List<Integer> goal = new ArrayList<Integer>();  // i*TOKEN
-            List<Integer> state = new ArrayList<Integer>(); // i*TOKEN
-            List<Integer> drops = new ArrayList<Integer>(); // not tokens
-            List<Integer> dups = new ArrayList<Integer>();  // not tokens
-            final int TOKEN = 10; // to mark items which are symbolic only
-            // state represents the argument values coming into target
-            for (int i = 0; i < outargs; i++) {
-                state.add(permutationOrNull[i] * TOKEN);
-            }
-            // goal represents the desired state
-            for (int i = 0; i < inargs; i++) {
-                if (state.contains(i * TOKEN)) {
-                    goal.add(i * TOKEN);
-                } else {
-                    // adapter must initially drop all unused arguments
-                    drops.add(i);
-                }
-            }
-            // detect duplications
-            while (state.size() > goal.size()) {
-                for (int i2 = 0; i2 < state.size(); i2++) {
-                    int arg1 = state.get(i2);
-                    int i1 = state.indexOf(arg1);
-                    if (i1 != i2) {
-                        // found duplicate occurrence at i2
-                        int arg2 = (inargs++) * TOKEN;
-                        state.set(i2, arg2);
-                        dups.add(goal.indexOf(arg1));
-                        goal.add(arg2);
-                    }
-                }
-            }
-            assert(state.size() == goal.size());
-            int size = goal.size();
-            while (!state.equals(goal)) {
-                // Look for a maximal sequence of adjacent misplaced arguments,
-                // and try to rotate them into place.
-                int bestRotArg = -10 * TOKEN, bestRotLen = 0;
-                int thisRotArg = -10 * TOKEN, thisRotLen = 0;
-                for (int i = 0; i < size; i++) {
-                    int arg = state.get(i);
-                    // Does this argument match the current run?
-                    if (arg == thisRotArg + TOKEN) {
-                        thisRotArg = arg;
-                        thisRotLen += 1;
-                        if (bestRotLen < thisRotLen) {
-                            bestRotLen = thisRotLen;
-                            bestRotArg = thisRotArg;
-                        }
-                    } else {
-                        // The old sequence (if any) stops here.
-                        thisRotLen = 0;
-                        thisRotArg = -10 * TOKEN;
-                        // But maybe a new one starts here also.
-                        int wantArg = goal.get(i);
-                        final int MAX_ARG_ROTATION = AdapterMethodHandle.MAX_ARG_ROTATION;
-                        if (arg != wantArg &&
-                            arg >= wantArg - TOKEN * MAX_ARG_ROTATION &&
-                            arg <= wantArg + TOKEN * MAX_ARG_ROTATION) {
-                            thisRotArg = arg;
-                            thisRotLen = 1;
-                        }
-                    }
-                }
-                if (bestRotLen >= 2) {
-                    // Do a rotation if it can improve argument positioning
-                    // by at least 2 arguments.  This is not always optimal,
-                    // but it seems to catch common cases.
-                    int dstEnd = state.indexOf(bestRotArg);
-                    int srcEnd = goal.indexOf(bestRotArg);
-                    int rotBy = dstEnd - srcEnd;
-                    int dstBeg = dstEnd - (bestRotLen - 1);
-                    int srcBeg = srcEnd - (bestRotLen - 1);
-                    assert((dstEnd | dstBeg | srcEnd | srcBeg) >= 0); // no negs
-                    // Make a span which covers both source and destination.
-                    int rotBeg = Math.min(dstBeg, srcBeg);
-                    int rotEnd = Math.max(dstEnd, srcEnd);
-                    int score = 0;
-                    for (int i = rotBeg; i <= rotEnd; i++) {
-                        if ((int)state.get(i) != (int)goal.get(i))
-                            score += 1;
-                    }
-                    List<Integer> rotSpan = state.subList(rotBeg, rotEnd+1);
-                    Collections.rotate(rotSpan, -rotBy);  // reverse direction
-                    for (int i = rotBeg; i <= rotEnd; i++) {
-                        if ((int)state.get(i) != (int)goal.get(i))
-                            score -= 1;
-                    }
-                    if (score >= 2) {
-                        // Improved at least two argument positions.  Do it.
-                        List<Class<?>> ptypes = Arrays.asList(oldType.parameterArray());
-                        Collections.rotate(ptypes.subList(rotBeg, rotEnd+1), -rotBy);
-                        MethodType rotType = MethodType.methodType(oldType.returnType(), ptypes);
-                        MethodHandle nextTarget
-                                = AdapterMethodHandle.makeRotateArguments(token, rotType, target,
-                                        rotBeg, rotSpan.size(), rotBy);
-                        if (nextTarget != null) {
-                            //System.out.println("Rot: "+rotSpan+" by "+rotBy);
-                            target = nextTarget;
-                            oldType = rotType;
-                            continue;
-                        }
-                    }
-                    // Else de-rotate, and drop through to the swap-fest.
-                    Collections.rotate(rotSpan, rotBy);
-                }
-
-                // Now swap like the wind!
-                List<Class<?>> ptypes = Arrays.asList(oldType.parameterArray());
-                for (int i = 0; i < size; i++) {
-                    // What argument do I want here?
-                    int arg = goal.get(i);
-                    if (arg != state.get(i)) {
-                        // Where is it now?
-                        int j = state.indexOf(arg);
-                        Collections.swap(ptypes, i, j);
-                        MethodType swapType = MethodType.methodType(oldType.returnType(), ptypes);
-                        target = AdapterMethodHandle.makeSwapArguments(token, swapType, target, i, j);
-                        if (target == null)  throw newIllegalArgumentException("cannot swap");
-                        assert(target.type() == swapType);
-                        oldType = swapType;
-                        Collections.swap(state, i, j);
-                    }
-                }
-                // One pass of swapping must finish the job.
-                assert(state.equals(goal));
-            }
-            while (!dups.isEmpty()) {
-                // Grab a contiguous trailing sequence of dups.
-                int grab = dups.size() - 1;
-                int dupArgPos = dups.get(grab), dupArgCount = 1;
-                while (grab - 1 >= 0) {
-                    int dup0 = dups.get(grab - 1);
-                    if (dup0 != dupArgPos - 1)  break;
-                    dupArgPos -= 1;
-                    dupArgCount += 1;
-                    grab -= 1;
-                }
-                //if (dupArgCount > 1)  System.out.println("Dup: "+dups.subList(grab, dups.size()));
-                dups.subList(grab, dups.size()).clear();
-                // In the new target type drop that many args from the tail:
-                List<Class<?>> ptypes = oldType.parameterList();
-                ptypes = ptypes.subList(0, ptypes.size() - dupArgCount);
-                MethodType dupType = MethodType.methodType(oldType.returnType(), ptypes);
-                target = AdapterMethodHandle.makeDupArguments(token, dupType, target, dupArgPos, dupArgCount);
-                if (target == null)
-                    throw newIllegalArgumentException("cannot dup");
-                oldType = target.type();
-            }
-            while (!drops.isEmpty()) {
-                // Grab a contiguous initial sequence of drops.
-                int dropArgPos = drops.get(0), dropArgCount = 1;
-                while (dropArgCount < drops.size()) {
-                    int drop1 = drops.get(dropArgCount);
-                    if (drop1 != dropArgPos + dropArgCount)  break;
-                    dropArgCount += 1;
-                }
-                //if (dropArgCount > 1)  System.out.println("Drop: "+drops.subList(0, dropArgCount));
-                drops.subList(0, dropArgCount).clear();
-                List<Class<?>> dropTypes = newType.parameterList()
-                        .subList(dropArgPos, dropArgPos + dropArgCount);
-                MethodType dropType = oldType.insertParameterTypes(dropArgPos, dropTypes);
-                target = AdapterMethodHandle.makeDropArguments(token, dropType, target, dropArgPos, dropArgCount);
-                if (target == null)  throw newIllegalArgumentException("cannot drop");
-                oldType = target.type();
-            }
-        }
-        if (newType == oldType)
-            return target;
-        if (oldType.parameterCount() != newType.parameterCount())
-            throw newIllegalArgumentException("mismatched parameter count");
-        MethodHandle res = AdapterMethodHandle.makePairwiseConvert(token, newType, target);
-        if (res != null)
-            return res;
-        int argc = oldType.parameterCount();
-        // The JVM can't do it directly, so fill in the gap with a Java adapter.
-        // TO DO: figure out what to put here from case-by-case experience
-        // Use a heavier method:  Convert all the arguments to Object,
-        // then back to the desired types.  We might have to use Java-based
-        // method handles to do this.
-        MethodType objType = MethodType.genericMethodType(argc);
-        MethodHandle objTarget = AdapterMethodHandle.makePairwiseConvert(token, objType, target);
-        if (objTarget == null)
-            objTarget = FromGeneric.make(target);
-        res = AdapterMethodHandle.makePairwiseConvert(token, newType, objTarget);
-        if (res != null)
-            return res;
-        return ToGeneric.make(newType, objTarget);
-    }
-
-    public static MethodHandle spreadArguments(Access token,
-                                               MethodHandle target,
-                                               MethodType newType,
-                                               int spreadArg) {
-        Access.check(token);
-        // TO DO: maybe allow the restarg to be Object and implicitly cast to Object[]
-        MethodType oldType = target.type();
-        // spread the last argument of newType to oldType
-        int spreadCount = oldType.parameterCount() - spreadArg;
-        Class<Object[]> spreadArgType = Object[].class;
-        MethodHandle res = AdapterMethodHandle.makeSpreadArguments(token, newType, target, spreadArgType, spreadArg, spreadCount);
-        if (res != null)
-            return res;
-        // try an intermediate adapter
-        Class<?> spreadType = null;
-        if (spreadArg < 0 || spreadArg >= newType.parameterCount()
-            || !VerifyType.isSpreadArgType(spreadType = newType.parameterType(spreadArg)))
-            throw newIllegalArgumentException("no restarg in "+newType);
-        Class<?>[] ptypes = oldType.parameterArray();
-        for (int i = 0; i < spreadCount; i++)
-            ptypes[spreadArg + i] = VerifyType.spreadArgElementType(spreadType, i);
-        MethodType midType = MethodType.methodType(newType.returnType(), ptypes);
-        // after spreading, some arguments may need further conversion
-        MethodHandle target2 = convertArguments(token, target, midType, oldType, null);
-        if (target2 == null)
-            throw new UnsupportedOperationException("NYI: convert "+midType+" =calls=> "+oldType);
-        res = AdapterMethodHandle.makeSpreadArguments(token, newType, target2, spreadArgType, spreadArg, spreadCount);
-        if (res != null)
-            return res;
-        res = SpreadGeneric.make(target2, spreadCount);
-        if (res != null)
-            res = convertArguments(token, res, newType, res.type(), null);
-        return res;
-    }
-
-    public static MethodHandle collectArguments(Access token,
-                                                MethodHandle target,
-                                                MethodType newType,
-                                                int collectArg,
-                                                MethodHandle collector) {
-        MethodType oldType = target.type();     // (a...,c)=>r
-        if (collector == null) {
-            int numCollect = newType.parameterCount() - oldType.parameterCount() + 1;
-            collector = ValueConversions.varargsArray(numCollect);
-        }
-        //         newType                      // (a..., b...)=>r
-        MethodType colType = collector.type();  // (b...)=>c
-        //         oldType                      // (a..., b...)=>r
-        assert(newType.parameterCount() == collectArg + colType.parameterCount());
-        assert(oldType.parameterCount() == collectArg + 1);
-        MethodHandle gtarget = convertArguments(token, target, oldType.generic(), oldType, null);
-        MethodHandle gcollector = convertArguments(token, collector, colType.generic(), colType, null);
-        if (gtarget == null || gcollector == null)  return null;
-        MethodHandle gresult = FilterGeneric.makeArgumentCollector(gcollector, gtarget);
-        MethodHandle result = convertArguments(token, gresult, newType, gresult.type(), null);
-        return result;
-    }
-
-    public static MethodHandle filterArgument(Access token,
-                                              MethodHandle target,
-                                              int pos,
-                                              MethodHandle filter) {
-        Access.check(token);
-        MethodType ttype = target.type(), gttype = ttype.generic();
-        if (ttype != gttype) {
-            target = convertArguments(token, target, gttype, ttype, null);
-            ttype = gttype;
-        }
-        MethodType ftype = filter.type(), gftype = ftype.generic();
-        if (ftype.parameterCount() != 1)
-            throw new InternalError();
-        if (ftype != gftype) {
-            filter = convertArguments(token, filter, gftype, ftype, null);
-            ftype = gftype;
-        }
-        if (ftype == ttype) {
-            // simple unary case
-            return FilterOneArgument.make(filter, target);
-        }
-        return FilterGeneric.makeArgumentFilter(pos, filter, target);
-    }
-
-    public static MethodHandle foldArguments(Access token,
-                                             MethodHandle target,
-                                             MethodType newType,
-                                             MethodHandle combiner) {
-        Access.check(token);
-        MethodType oldType = target.type();
-        MethodType ctype = combiner.type();
-        MethodHandle gtarget = convertArguments(token, target, oldType.generic(), oldType, null);
-        MethodHandle gcombiner = convertArguments(token, combiner, ctype.generic(), ctype, null);
-        if (gtarget == null || gcombiner == null)  return null;
-        MethodHandle gresult = FilterGeneric.makeArgumentFolder(gcombiner, gtarget);
-        MethodHandle result = convertArguments(token, gresult, newType, gresult.type(), null);
-        return result;
-    }
-
-    public static
-    MethodHandle dropArguments(Access token, MethodHandle target,
-                               MethodType newType, int argnum) {
-        Access.check(token);
-        int drops = newType.parameterCount() - target.type().parameterCount();
-        MethodHandle res = AdapterMethodHandle.makeDropArguments(token, newType, target, argnum, drops);
-        if (res != null)
-            return res;
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    private static class GuardWithTest extends BoundMethodHandle {
-        private final MethodHandle test, target, fallback;
-        private GuardWithTest(MethodHandle invoker,
-                              MethodHandle test, MethodHandle target, MethodHandle fallback) {
-            super(Access.TOKEN, invoker);
-            this.test = test;
-            this.target = target;
-            this.fallback = fallback;
-        }
-        static MethodHandle make(Access token,
-                                 MethodHandle test, MethodHandle target, MethodHandle fallback) {
-            Access.check(token);
-            MethodType type = target.type();
-            int nargs = type.parameterCount();
-            if (nargs < INVOKES.length) {
-                MethodHandle invoke = INVOKES[nargs];
-                MethodType gtype = type.generic();
-                assert(invoke.type().dropParameterTypes(0,1) == gtype);
-                MethodHandle gtest = convertArguments(token, test, gtype.changeReturnType(boolean.class), test.type(), null);
-                MethodHandle gtarget = convertArguments(token, target, gtype, type, null);
-                MethodHandle gfallback = convertArguments(token, fallback, gtype, type, null);
-                if (gtest == null || gtarget == null || gfallback == null)  return null;
-                MethodHandle gguard = new GuardWithTest(invoke, gtest, gtarget, gfallback);
-                return convertArguments(token, gguard, type, gtype, null);
-            } else {
-                MethodHandle invoke = VARARGS_INVOKE;
-                MethodType gtype = MethodType.genericMethodType(1);
-                assert(invoke.type().dropParameterTypes(0,1) == gtype);
-                MethodHandle gtest = spreadArguments(token, test, gtype.changeReturnType(boolean.class), 0);
-                MethodHandle gtarget = spreadArguments(token, target, gtype, 0);
-                MethodHandle gfallback = spreadArguments(token, fallback, gtype, 0);
-                MethodHandle gguard = new GuardWithTest(invoke, gtest, gtarget, gfallback);
-                if (gtest == null || gtarget == null || gfallback == null)  return null;
-                return collectArguments(token, gguard, type, 0, null);
-            }
-        }
-        @Override
-        public String toString() {
-            return addTypeString(target, this);
-        }
-        private Object invoke_V(Object... av) throws Throwable {
-            if ((boolean) test.invokeExact(av))
-                return target.invokeExact(av);
-            return fallback.invokeExact(av);
-        }
-        private Object invoke_L0() throws Throwable {
-            if ((boolean) test.invokeExact())
-                return target.invokeExact();
-            return fallback.invokeExact();
-        }
-        private Object invoke_L1(Object a0) throws Throwable {
-            if ((boolean) test.invokeExact(a0))
-                return target.invokeExact(a0);
-            return fallback.invokeExact(a0);
-        }
-        private Object invoke_L2(Object a0, Object a1) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1))
-                return target.invokeExact(a0, a1);
-            return fallback.invokeExact(a0, a1);
-        }
-        private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1, a2))
-                return target.invokeExact(a0, a1, a2);
-            return fallback.invokeExact(a0, a1, a2);
-        }
-        private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1, a2, a3))
-                return target.invokeExact(a0, a1, a2, a3);
-            return fallback.invokeExact(a0, a1, a2, a3);
-        }
-        private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4))
-                return target.invokeExact(a0, a1, a2, a3, a4);
-            return fallback.invokeExact(a0, a1, a2, a3, a4);
-        }
-        private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4, a5))
-                return target.invokeExact(a0, a1, a2, a3, a4, a5);
-            return fallback.invokeExact(a0, a1, a2, a3, a4, a5);
-        }
-        private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4, a5, a6))
-                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6);
-            return fallback.invokeExact(a0, a1, a2, a3, a4, a5, a6);
-        }
-        private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            if ((boolean) test.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7))
-                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
-            return fallback.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
-        }
-        static MethodHandle[] makeInvokes() {
-            ArrayList<MethodHandle> invokes = new ArrayList<MethodHandle>();
-            MethodHandles.Lookup lookup = IMPL_LOOKUP;
-            for (;;) {
-                int nargs = invokes.size();
-                String name = "invoke_L"+nargs;
-                MethodHandle invoke = null;
-                try {
-                    invoke = lookup.findVirtual(GuardWithTest.class, name, MethodType.genericMethodType(nargs));
-                } catch (ReflectiveOperationException ex) {
-                }
-                if (invoke == null)  break;
-                invokes.add(invoke);
-            }
-            assert(invokes.size() == 9);  // current number of methods
-            return invokes.toArray(new MethodHandle[0]);
-        };
-        static final MethodHandle[] INVOKES = makeInvokes();
-        // For testing use this:
-        //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2);
-        static final MethodHandle VARARGS_INVOKE;
-        static {
-            try {
-                VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(GuardWithTest.class, "invoke_V", MethodType.genericMethodType(0, true));
-            } catch (ReflectiveOperationException ex) {
-                throw uncaughtException(ex);
-            }
-        }
-    }
-
-    public static
-    MethodHandle makeGuardWithTest(Access token,
-                                   MethodHandle test,
-                                   MethodHandle target,
-                                   MethodHandle fallback) {
-        return GuardWithTest.make(token, test, target, fallback);
-    }
-
-    private static class GuardWithCatch extends BoundMethodHandle {
-        private final MethodHandle target;
-        private final Class<? extends Throwable> exType;
-        private final MethodHandle catcher;
-        public GuardWithCatch(MethodHandle target, Class<? extends Throwable> exType, MethodHandle catcher) {
-            this(INVOKES[target.type().parameterCount()], target, exType, catcher);
-        }
-        public GuardWithCatch(MethodHandle invoker,
-                              MethodHandle target, Class<? extends Throwable> exType, MethodHandle catcher) {
-            super(Access.TOKEN, invoker);
-            this.target = target;
-            this.exType = exType;
-            this.catcher = catcher;
-        }
-        @Override
-        public String toString() {
-            return addTypeString(target, this);
-        }
-        private Object invoke_V(Object... av) throws Throwable {
-            try {
-                return target.invokeExact(av);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, av);
-            }
-        }
-        private Object invoke_L0() throws Throwable {
-            try {
-                return target.invokeExact();
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t);
-            }
-        }
-        private Object invoke_L1(Object a0) throws Throwable {
-            try {
-                return target.invokeExact(a0);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0);
-            }
-        }
-        private Object invoke_L2(Object a0, Object a1) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1);
-            }
-        }
-        private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1, a2);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1, a2);
-            }
-        }
-        private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1, a2, a3);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1, a2, a3);
-            }
-        }
-        private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1, a2, a3, a4);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1, a2, a3, a4);
-            }
-        }
-        private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1, a2, a3, a4, a5);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5);
-            }
-        }
-        private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5, a6);
-            }
-        }
-        private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
-            try {
-                return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
-            } catch (Throwable t) {
-                if (!exType.isInstance(t))  throw t;
-                return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5, a6, a7);
-            }
-        }
-        static MethodHandle[] makeInvokes() {
-            ArrayList<MethodHandle> invokes = new ArrayList<MethodHandle>();
-            MethodHandles.Lookup lookup = IMPL_LOOKUP;
-            for (;;) {
-                int nargs = invokes.size();
-                String name = "invoke_L"+nargs;
-                MethodHandle invoke = null;
-                try {
-                    invoke = lookup.findVirtual(GuardWithCatch.class, name, MethodType.genericMethodType(nargs));
-                } catch (ReflectiveOperationException ex) {
-                }
-                if (invoke == null)  break;
-                invokes.add(invoke);
-            }
-            assert(invokes.size() == 9);  // current number of methods
-            return invokes.toArray(new MethodHandle[0]);
-        };
-        static final MethodHandle[] INVOKES = makeInvokes();
-        // For testing use this:
-        //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2);
-        static final MethodHandle VARARGS_INVOKE;
-        static {
-            try {
-                VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(GuardWithCatch.class, "invoke_V", MethodType.genericMethodType(0, true));
-            } catch (ReflectiveOperationException ex) {
-                throw uncaughtException(ex);
-            }
-        }
-    }
-
-
-    public static
-    MethodHandle makeGuardWithCatch(Access token,
-                                    MethodHandle target,
-                                    Class<? extends Throwable> exType,
-                                    MethodHandle catcher) {
-        Access.check(token);
-        MethodType type = target.type();
-        MethodType ctype = catcher.type();
-        int nargs = type.parameterCount();
-        if (nargs < GuardWithCatch.INVOKES.length) {
-            MethodType gtype = type.generic();
-            MethodType gcatchType = gtype.insertParameterTypes(0, Throwable.class);
-            MethodHandle gtarget = convertArguments(token, target, gtype, type, null);
-            MethodHandle gcatcher = convertArguments(token, catcher, gcatchType, ctype, null);
-            MethodHandle gguard = new GuardWithCatch(gtarget, exType, gcatcher);
-            if (gtarget == null || gcatcher == null || gguard == null)  return null;
-            return convertArguments(token, gguard, type, gtype, null);
-        } else {
-            MethodType gtype = MethodType.genericMethodType(0, true);
-            MethodType gcatchType = gtype.insertParameterTypes(0, Throwable.class);
-            MethodHandle gtarget = spreadArguments(token, target, gtype, 0);
-            MethodHandle gcatcher = spreadArguments(token, catcher, gcatchType, 1);
-            MethodHandle gguard = new GuardWithCatch(GuardWithCatch.VARARGS_INVOKE, gtarget, exType, gcatcher);
-            if (gtarget == null || gcatcher == null || gguard == null)  return null;
-            return collectArguments(token, gguard, type, 0, null);
-        }
-    }
-
-    public static
-    MethodHandle throwException(Access token, MethodType type) {
-        Access.check(token);
-        return AdapterMethodHandle.makeRetypeRaw(token, type, THROW_EXCEPTION);
-    }
-
-    static final MethodHandle THROW_EXCEPTION;
-    static {
-        try {
-            THROW_EXCEPTION
-            = IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "throwException",
-                    MethodType.methodType(Empty.class, Throwable.class));
-        } catch (ReflectiveOperationException ex) {
-            throw new RuntimeException(ex);
-        }
-    }
-    static <T extends Throwable> Empty throwException(T t) throws T { throw t; }
-
-    public static String getNameString(Access token, MethodHandle target, Object type) {
-        Access.check(token);
-        if (!(type instanceof MethodType)) {
-            if (type == null)
-                type = target.type();
-            else if (type instanceof MethodHandle)
-                type = ((MethodHandle)type).type();
-        }
-        MemberName name = null;
-        if (target != null)
-            name = MethodHandleNatives.getMethodName(target);
-        if (name == null)
-            return "invoke" + type;
-        return name.getName() + type;
-    }
-
-    public static String getNameString(Access token, MethodHandle target) {
-        return getNameString(token, target, null);
-    }
-
-    static String addTypeString(Object obj, MethodHandle target) {
-        String str = String.valueOf(obj);
-        if (target == null)  return str;
-        int paren = str.indexOf('(');
-        if (paren >= 0) str = str.substring(0, paren);
-        return str + target.type();
-    }
-
-    static void checkSpreadArgument(Object av, int n) {
-        if (av == null ? n != 0 : ((Object[])av).length != n)
-            throw newIllegalArgumentException("Array is not of length "+n);
-    }
-
-    static void raiseException(int code, Object actual, Object required) {
-        String message;
-        // disregard the identity of the actual object, if it is not a class:
-        if (!(actual instanceof Class) && !(actual instanceof MethodType))
-            actual = actual.getClass();
-        if (actual != null)
-            message = "required "+required+" but encountered "+actual;
-        else
-            message = "required "+required;
-        switch (code) {
-        case 192: // checkcast
-            throw new ClassCastException(message);
-        default:
-            throw new InternalError("unexpected code "+code+": "+message);
-        }
-    }
-
-    // Linkage support:
-    public static void registerBootstrap(Access token, Class<?> callerClass, MethodHandle bootstrapMethod) {
-        Access.check(token);
-        MethodHandleNatives.registerBootstrap(callerClass, bootstrapMethod);
-    }
-    public static MethodHandle getBootstrap(Access token, Class<?> callerClass) {
-        Access.check(token);
-        return MethodHandleNatives.getBootstrap(callerClass);
-    }
-
-    public static MethodHandle asVarargsCollector(Access token, MethodHandle target, Class<?> arrayType) {
-        Access.check(token);
-        return AdapterMethodHandle.makeVarargsCollector(token, target, arrayType);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/MethodHandleNatives.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,359 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn;
-
-import java.dyn.*;
-import java.dyn.MethodHandles.Lookup;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import static sun.dyn.MethodHandleNatives.Constants.*;
-import static sun.dyn.MethodHandleImpl.IMPL_LOOKUP;
-
-/**
- * The JVM interface for the method handles package is all here.
- * This is an interface internal and private to an implemetantion of JSR 292.
- * <em>This class is not part of the JSR 292 standard.</em>
- * @author jrose
- */
-class MethodHandleNatives {
-
-    private MethodHandleNatives() { } // static only
-
-    /// MethodName support
-
-    static native void init(MemberName self, Object ref);
-    static native void expand(MemberName self);
-    static native void resolve(MemberName self, Class<?> caller);
-    static native int getMembers(Class<?> defc, String matchName, String matchSig,
-            int matchFlags, Class<?> caller, int skip, MemberName[] results);
-
-    /// MethodHandle support
-
-    /** Initialize the method handle to adapt the call. */
-    static native void init(AdapterMethodHandle self, MethodHandle target, int argnum);
-    /** Initialize the method handle to call the correct method, directly. */
-    static native void init(BoundMethodHandle self, Object target, int argnum);
-    /** Initialize the method handle to call as if by an invoke* instruction. */
-    static native void init(DirectMethodHandle self, Object ref, boolean doDispatch, Class<?> caller);
-
-    /** Initialize a method type, once per form. */
-    static native void init(MethodType self);
-
-    /** Tell the JVM about a class's bootstrap method. */
-    static native void registerBootstrap(Class<?> caller, MethodHandle bootstrapMethod);
-
-    /** Ask the JVM about a class's bootstrap method. */
-    static native MethodHandle getBootstrap(Class<?> caller);
-
-    /** Tell the JVM that we need to change the target of an invokedynamic. */
-    static native void setCallSiteTarget(CallSite site, MethodHandle target);
-
-    /** Fetch the vmtarget field.
-     *  It will be sanitized as necessary to avoid exposing non-Java references.
-     *  This routine is for debugging and reflection.
-     */
-    static native Object getTarget(MethodHandle self, int format);
-
-    /** Fetch the name of the handled method, if available.
-     *  This routine is for debugging and reflection.
-     */
-    static MemberName getMethodName(MethodHandle self) {
-        if (!JVM_SUPPORT)  return null;
-        return (MemberName) getTarget(self, ETF_METHOD_NAME);
-    }
-
-    /** Fetch the reflective version of the handled method, if available.
-     */
-    static AccessibleObject getTargetMethod(MethodHandle self) {
-        if (!JVM_SUPPORT)  return null;
-        return (AccessibleObject) getTarget(self, ETF_REFLECT_METHOD);
-    }
-
-    /** Fetch the target of this method handle.
-     *  If it directly targets a method, return a MemberName for the method.
-     *  If it is chained to another method handle, return that handle.
-     */
-    static Object getTargetInfo(MethodHandle self) {
-        if (!JVM_SUPPORT)  return null;
-        return getTarget(self, ETF_HANDLE_OR_METHOD_NAME);
-    }
-
-    static Object[] makeTarget(Class<?> defc, String name, String sig, int mods, Class<?> refc) {
-        return new Object[] { defc, name, sig, mods, refc };
-    }
-
-    /** Fetch MH-related JVM parameter.
-     *  which=0 retrieves MethodHandlePushLimit
-     *  which=1 retrieves stack slot push size (in address units)
-     */
-    static native int getConstant(int which);
-
-    /** True iff this HotSpot JVM has built-in support for method handles.
-     * If false, some test cases might run, but functionality will be missing.
-     */
-    public static final boolean JVM_SUPPORT;
-
-    /** Java copy of MethodHandlePushLimit in range 2..255. */
-    static final int JVM_PUSH_LIMIT;
-    /** JVM stack motion (in words) after one slot is pushed, usually -1.
-     */
-    static final int JVM_STACK_MOVE_UNIT;
-
-    /** Which conv-ops are implemented by the JVM? */
-    static final int CONV_OP_IMPLEMENTED_MASK;
-
-    private static native void registerNatives();
-    static {
-        boolean JVM_SUPPORT_;
-        int     JVM_PUSH_LIMIT_;
-        int     JVM_STACK_MOVE_UNIT_;
-        int     CONV_OP_IMPLEMENTED_MASK_;
-        try {
-            registerNatives();
-            JVM_SUPPORT_ = true;
-            JVM_PUSH_LIMIT_ = getConstant(Constants.GC_JVM_PUSH_LIMIT);
-            JVM_STACK_MOVE_UNIT_ = getConstant(Constants.GC_JVM_STACK_MOVE_UNIT);
-            CONV_OP_IMPLEMENTED_MASK_ = getConstant(Constants.GC_CONV_OP_IMPLEMENTED_MASK);
-            //sun.reflect.Reflection.registerMethodsToFilter(MethodHandleImpl.class, "init");
-        } catch (UnsatisfiedLinkError ee) {
-            // ignore; if we use init() methods later we'll see linkage errors
-            JVM_SUPPORT_ = false;
-            JVM_PUSH_LIMIT_ = 3;  // arbitrary
-            JVM_STACK_MOVE_UNIT_ = -1;  // arbitrary
-            CONV_OP_IMPLEMENTED_MASK_ = 0;
-            //System.out.println("Warning: Running with JVM_SUPPORT=false");
-            //System.out.println(ee);
-            JVM_SUPPORT = JVM_SUPPORT_;
-            JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_;
-            JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_;
-            throw ee;  // just die; hopeless to try to run with an older JVM
-        }
-        JVM_SUPPORT = JVM_SUPPORT_;
-        JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_;
-        JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_;
-        if (CONV_OP_IMPLEMENTED_MASK_ == 0)
-            CONV_OP_IMPLEMENTED_MASK_ = DEFAULT_CONV_OP_IMPLEMENTED_MASK;
-        CONV_OP_IMPLEMENTED_MASK = CONV_OP_IMPLEMENTED_MASK_;
-    }
-
-    // All compile-time constants go here.
-    // There is an opportunity to check them against the JVM's idea of them.
-    static class Constants {
-        Constants() { } // static only
-        // MethodHandleImpl
-        static final int // for getConstant
-                GC_JVM_PUSH_LIMIT = 0,
-                GC_JVM_STACK_MOVE_UNIT = 1,
-                GC_CONV_OP_IMPLEMENTED_MASK = 2;
-        static final int
-                ETF_HANDLE_OR_METHOD_NAME = 0, // all available data (immediate MH or method)
-                ETF_DIRECT_HANDLE         = 1, // ultimate method handle (will be a DMH, may be self)
-                ETF_METHOD_NAME           = 2, // ultimate method as MemberName
-                ETF_REFLECT_METHOD        = 3; // ultimate method as java.lang.reflect object (sans refClass)
-
-        // MemberName
-        // The JVM uses values of -2 and above for vtable indexes.
-        // Field values are simple positive offsets.
-        // Ref: src/share/vm/oops/methodOop.hpp
-        // This value is negative enough to avoid such numbers,
-        // but not too negative.
-        static final int
-                MN_IS_METHOD           = 0x00010000, // method (not constructor)
-                MN_IS_CONSTRUCTOR      = 0x00020000, // constructor
-                MN_IS_FIELD            = 0x00040000, // field
-                MN_IS_TYPE             = 0x00080000, // nested type
-                MN_SEARCH_SUPERCLASSES = 0x00100000, // for MHN.getMembers
-                MN_SEARCH_INTERFACES   = 0x00200000, // for MHN.getMembers
-                VM_INDEX_UNINITIALIZED = -99;
-
-        // AdapterMethodHandle
-        /** Conversions recognized by the JVM.
-         *  They must align with the constants in sun.dyn_AdapterMethodHandle,
-         *  in the JVM file hotspot/src/share/vm/classfile/javaClasses.hpp.
-         */
-        static final int
-            OP_RETYPE_ONLY   = 0x0, // no argument changes; straight retype
-            OP_RETYPE_RAW    = 0x1, // no argument changes; straight retype
-            OP_CHECK_CAST    = 0x2, // ref-to-ref conversion; requires a Class argument
-            OP_PRIM_TO_PRIM  = 0x3, // converts from one primitive to another
-            OP_REF_TO_PRIM   = 0x4, // unboxes a wrapper to produce a primitive
-            OP_PRIM_TO_REF   = 0x5, // boxes a primitive into a wrapper (NYI)
-            OP_SWAP_ARGS     = 0x6, // swap arguments (vminfo is 2nd arg)
-            OP_ROT_ARGS      = 0x7, // rotate arguments (vminfo is displaced arg)
-            OP_DUP_ARGS      = 0x8, // duplicates one or more arguments (at TOS)
-            OP_DROP_ARGS     = 0x9, // remove one or more argument slots
-            OP_COLLECT_ARGS  = 0xA, // combine one or more arguments into a varargs (NYI)
-            OP_SPREAD_ARGS   = 0xB, // expand in place a varargs array (of known size)
-            OP_FLYBY         = 0xC, // operate first on reified argument list (NYI)
-            OP_RICOCHET      = 0xD, // run an adapter chain on the return value (NYI)
-            CONV_OP_LIMIT    = 0xE; // limit of CONV_OP enumeration
-        /** Shift and mask values for decoding the AMH.conversion field.
-         *  These numbers are shared with the JVM for creating AMHs.
-         */
-        static final int
-            CONV_OP_MASK     = 0xF00, // this nybble contains the conversion op field
-            CONV_VMINFO_MASK = 0x0FF, // LSB is reserved for JVM use
-            CONV_VMINFO_SHIFT     =  0, // position of bits in CONV_VMINFO_MASK
-            CONV_OP_SHIFT         =  8, // position of bits in CONV_OP_MASK
-            CONV_DEST_TYPE_SHIFT  = 12, // byte 2 has the adapter BasicType (if needed)
-            CONV_SRC_TYPE_SHIFT   = 16, // byte 2 has the source BasicType (if needed)
-            CONV_STACK_MOVE_SHIFT = 20, // high 12 bits give signed SP change
-            CONV_STACK_MOVE_MASK  = (1 << (32 - CONV_STACK_MOVE_SHIFT)) - 1;
-
-        /** Which conv-ops are implemented by the JVM? */
-        static final int DEFAULT_CONV_OP_IMPLEMENTED_MASK =
-                // Value to use if the corresponding JVM query fails.
-                ((1<<OP_RETYPE_ONLY)
-                |(1<<OP_RETYPE_RAW)
-                |(1<<OP_CHECK_CAST)
-                |(1<<OP_PRIM_TO_PRIM)
-                |(1<<OP_REF_TO_PRIM)
-                |(1<<OP_SWAP_ARGS)
-                |(1<<OP_ROT_ARGS)
-                |(1<<OP_DUP_ARGS)
-                |(1<<OP_DROP_ARGS)
-                //|(1<<OP_SPREAD_ARGS)
-                );
-
-        /**
-         * Basic types as encoded in the JVM.  These code values are not
-         * intended for use outside this class.  They are used as part of
-         * a private interface between the JVM and this class.
-         */
-        static final int
-            T_BOOLEAN  =  4,
-            T_CHAR     =  5,
-            T_FLOAT    =  6,
-            T_DOUBLE   =  7,
-            T_BYTE     =  8,
-            T_SHORT    =  9,
-            T_INT      = 10,
-            T_LONG     = 11,
-            T_OBJECT   = 12,
-            //T_ARRAY    = 13
-            T_VOID     = 14;
-            //T_ADDRESS  = 15
-
-        /**
-         * Constant pool reference-kind codes, as used by CONSTANT_MethodHandle CP entries.
-         */
-        static final int
-            REF_getField                = 1,
-            REF_getStatic               = 2,
-            REF_putField                = 3,
-            REF_putStatic               = 4,
-            REF_invokeVirtual           = 5,
-            REF_invokeStatic            = 6,
-            REF_invokeSpecial           = 7,
-            REF_newInvokeSpecial        = 8,
-            REF_invokeInterface         = 9;
-    }
-
-    private static native int getNamedCon(int which, Object[] name);
-    static boolean verifyConstants() {
-        Object[] box = { null };
-        for (int i = 0; ; i++) {
-            box[0] = null;
-            int vmval = getNamedCon(i, box);
-            if (box[0] == null)  break;
-            String name = (String) box[0];
-            try {
-                Field con = Constants.class.getDeclaredField(name);
-                int jval = con.getInt(null);
-                if (jval != vmval)
-                    throw new InternalError(name+": JVM has "+vmval+" while Java has "+jval);
-            } catch (Exception ex) {
-                throw new InternalError(name+": access failed, got "+ex);
-            }
-        }
-        return true;
-    }
-    static {
-        if (JVM_SUPPORT)  verifyConstants();
-    }
-
-    // Up-calls from the JVM.
-    // These must NOT be public.
-
-    /**
-     * The JVM is linking an invokedynamic instruction.  Create a reified call site for it.
-     */
-    static CallSite makeDynamicCallSite(MethodHandle bootstrapMethod,
-                                        String name, MethodType type,
-                                        Object info,
-                                        MemberName callerMethod, int callerBCI) {
-        return CallSiteImpl.makeSite(bootstrapMethod, name, type, info, callerMethod, callerBCI);
-    }
-
-    /**
-     * The JVM wants a pointer to a MethodType.  Oblige it by finding or creating one.
-     */
-    static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) {
-        MethodType.genericMethodType(0);  // trigger initialization
-        return MethodTypeImpl.makeImpl(Access.TOKEN, rtype, ptypes, true);
-    }
-
-    /**
-     * The JVM wants to use a MethodType with invokeGeneric.  Give the runtime fair warning.
-     */
-    static void notifyGenericMethodType(MethodType type) {
-        try {
-            // Trigger adapter creation.
-            InvokeGeneric.genericInvokerOf(type);
-        } catch (Exception ex) {
-            Error err = new InternalError("Exception while resolving invokeGeneric");
-            err.initCause(ex);
-            throw err;
-        }
-    }
-
-    /**
-     * The JVM is resolving a CONSTANT_MethodHandle CP entry.  And it wants our help.
-     * It will make an up-call to this method.  (Do not change the name or signature.)
-     */
-    static MethodHandle linkMethodHandleConstant(Class<?> callerClass, int refKind,
-                                                 Class<?> defc, String name, Object type) {
-        try {
-            Lookup lookup = IMPL_LOOKUP.in(callerClass);
-            switch (refKind) {
-            case REF_getField:          return lookup.findGetter(       defc, name, (Class<?>)   type );
-            case REF_getStatic:         return lookup.findStaticGetter( defc, name, (Class<?>)   type );
-            case REF_putField:          return lookup.findSetter(       defc, name, (Class<?>)   type );
-            case REF_putStatic:         return lookup.findStaticSetter( defc, name, (Class<?>)   type );
-            case REF_invokeVirtual:     return lookup.findVirtual(      defc, name, (MethodType) type );
-            case REF_invokeStatic:      return lookup.findStatic(       defc, name, (MethodType) type );
-            case REF_invokeSpecial:     return lookup.findSpecial(      defc, name, (MethodType) type, callerClass );
-            case REF_newInvokeSpecial:  return lookup.findConstructor(  defc,       (MethodType) type );
-            case REF_invokeInterface:   return lookup.findVirtual(      defc, name, (MethodType) type );
-            }
-            throw new IllegalArgumentException("bad MethodHandle constant "+name+" : "+type);
-        } catch (ReflectiveOperationException ex) {
-            Error err = new IncompatibleClassChangeError();
-            err.initCause(ex);
-            throw err;
-        }
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/MethodTypeImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,516 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import java.dyn.*;
-import sun.dyn.util.Wrapper;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * Shared information for a group of method types, which differ
- * only by reference types, and therefore share a common erasure
- * and wrapping.
- * <p>
- * For an empirical discussion of the structure of method types,
- * see <a href="http://groups.google.com/group/jvm-languages/browse_thread/thread/ac9308ae74da9b7e/">
- * the thread "Avoiding Boxing" on jvm-languages</a>.
- * There are approximately 2000 distinct erased method types in the JDK.
- * There are a little over 10 times that number of unerased types.
- * No more than half of these are likely to be loaded at once.
- * @author John Rose
- */
-public class MethodTypeImpl {
-    final int[] argToSlotTable, slotToArgTable;
-    final long argCounts;               // packed slot & value counts
-    final long primCounts;              // packed prim & double counts
-    final int vmslots;                  // total number of parameter slots
-    final MethodType erasedType;        // the canonical erasure
-
-    /*lazy*/ MethodType primsAsBoxes;   // replace prims by wrappers
-    /*lazy*/ MethodType primArgsAsBoxes; // wrap args only; make raw return
-    /*lazy*/ MethodType primsAsInts;    // replace prims by int/long
-    /*lazy*/ MethodType primsAsLongs;   // replace prims by long
-    /*lazy*/ MethodType primsAtEnd;     // reorder primitives to the end
-
-    // Cached adapter information:
-    /*lazy*/ ToGeneric   toGeneric;     // convert cs. with prims to w/o
-    /*lazy*/ FromGeneric fromGeneric;   // convert cs. w/o prims to with
-    /*lazy*/ SpreadGeneric[] spreadGeneric; // expand one argument to many
-    /*lazy*/ FilterGeneric filterGeneric; // convert argument(s) on the fly
-    /*lazy*/ MethodHandle genericInvoker; // hook for invokeGeneric
-
-    public MethodType erasedType() {
-        return erasedType;
-    }
-
-    public static MethodTypeImpl of(MethodType type) {
-        return METHOD_TYPE_FRIEND.form(type);
-    }
-
-    /** Access methods for the internals of MethodType, supplied to
-     *  MethodTypeImpl as a trusted agent.
-     */
-    static public interface MethodTypeFriend {
-        Class<?>[]     ptypes(MethodType mt);
-        MethodTypeImpl form(MethodType mt);
-        void           setForm(MethodType mt, MethodTypeImpl form);
-        MethodType     makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted);
-        MethodTypeImpl newMethodTypeForm(MethodType mt);
-        Invokers       getInvokers(MethodType mt);
-        void           setInvokers(MethodType mt, Invokers inv);
-    }
-    public static void setMethodTypeFriend(Access token, MethodTypeFriend am) {
-        Access.check(token);
-        if (METHOD_TYPE_FRIEND != null)
-            throw new InternalError();  // just once
-        METHOD_TYPE_FRIEND = am;
-    }
-    static private MethodTypeFriend METHOD_TYPE_FRIEND;
-
-    static MethodType makeImpl(Access token, Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
-        Access.check(token);
-        return METHOD_TYPE_FRIEND.makeImpl(rtype, ptypes, trusted);
-    }
-
-    protected MethodTypeImpl(MethodType erasedType) {
-        this.erasedType = erasedType;
-
-        Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(erasedType);
-        int ptypeCount = ptypes.length;
-        int pslotCount = ptypeCount;            // temp. estimate
-        int rtypeCount = 1;                     // temp. estimate
-        int rslotCount = 1;                     // temp. estimate
-
-        int[] argToSlotTab = null, slotToArgTab = null;
-
-        // Walk the argument types, looking for primitives.
-        int pac = 0, lac = 0, prc = 0, lrc = 0;
-        Class<?> epts[] = ptypes;
-        for (int i = 0; i < epts.length; i++) {
-            Class<?> pt = epts[i];
-            if (pt != Object.class) {
-                assert(pt.isPrimitive());
-                ++pac;
-                if (hasTwoArgSlots(pt))  ++lac;
-            }
-        }
-        pslotCount += lac;                  // #slots = #args + #longs
-        Class<?> rt = erasedType.returnType();
-        if (rt != Object.class) {
-            ++prc;          // even void.class counts as a prim here
-            if (hasTwoArgSlots(rt))  ++lrc;
-            // adjust #slots, #args
-            if (rt == void.class)
-                rtypeCount = rslotCount = 0;
-            else
-                rslotCount += lrc;
-        }
-        if (lac != 0) {
-            int slot = ptypeCount + lac;
-            slotToArgTab = new int[slot+1];
-            argToSlotTab = new int[1+ptypeCount];
-            argToSlotTab[0] = slot;  // argument "-1" is past end of slots
-            for (int i = 0; i < epts.length; i++) {
-                Class<?> pt = epts[i];
-                if (hasTwoArgSlots(pt))  --slot;
-                --slot;
-                slotToArgTab[slot] = i+1; // "+1" see argSlotToParameter note
-                argToSlotTab[1+i]  = slot;
-            }
-            assert(slot == 0);  // filled the table
-        }
-        this.primCounts = pack(lrc, prc, lac, pac);
-        this.argCounts = pack(rslotCount, rtypeCount, pslotCount, ptypeCount);
-        if (slotToArgTab == null) {
-            int slot = ptypeCount; // first arg is deepest in stack
-            slotToArgTab = new int[slot+1];
-            argToSlotTab = new int[1+ptypeCount];
-            argToSlotTab[0] = slot;  // argument "-1" is past end of slots
-            for (int i = 0; i < ptypeCount; i++) {
-                --slot;
-                slotToArgTab[slot] = i+1; // "+1" see argSlotToParameter note
-                argToSlotTab[1+i]  = slot;
-            }
-        }
-        this.argToSlotTable = argToSlotTab;
-        this.slotToArgTable = slotToArgTab;
-
-        if (pslotCount >= 256)  throw newIllegalArgumentException("too many arguments");
-
-        // send a few bits down to the JVM:
-        this.vmslots = parameterSlotCount();
-
-        // short circuit some no-op canonicalizations:
-        if (!hasPrimitives()) {
-            primsAsBoxes = erasedType;
-            primArgsAsBoxes = erasedType;
-            primsAsInts  = erasedType;
-            primsAsLongs = erasedType;
-            primsAtEnd   = erasedType;
-        }
-    }
-
-    /** Turn all primitive types to corresponding wrapper types.
-     */
-    public MethodType primsAsBoxes() {
-        MethodType ct = primsAsBoxes;
-        if (ct != null)  return ct;
-        MethodType t = erasedType;
-        ct = canonicalize(erasedType, WRAP, WRAP);
-        if (ct == null)  ct = t;  // no prims to box
-        return primsAsBoxes = ct;
-    }
-
-    /** Turn all primitive argument types to corresponding wrapper types.
-     *  Subword and void return types are promoted to int.
-     */
-    public MethodType primArgsAsBoxes() {
-        MethodType ct = primArgsAsBoxes;
-        if (ct != null)  return ct;
-        MethodType t = erasedType;
-        ct = canonicalize(erasedType, RAW_RETURN, WRAP);
-        if (ct == null)  ct = t;  // no prims to box
-        return primArgsAsBoxes = ct;
-    }
-
-    /** Turn all primitive types to either int or long.
-     *  Floating point return types are not changed, because
-     *  they may require special calling sequences.
-     *  A void return value is turned to int.
-     */
-    public MethodType primsAsInts() {
-        MethodType ct = primsAsInts;
-        if (ct != null)  return ct;
-        MethodType t = erasedType;
-        ct = canonicalize(t, RAW_RETURN, INTS);
-        if (ct == null)  ct = t;  // no prims to int-ify
-        return primsAsInts = ct;
-    }
-
-    /** Turn all primitive types to either int or long.
-     *  Floating point return types are not changed, because
-     *  they may require special calling sequences.
-     *  A void return value is turned to int.
-     */
-    public MethodType primsAsLongs() {
-        MethodType ct = primsAsLongs;
-        if (ct != null)  return ct;
-        MethodType t = erasedType;
-        ct = canonicalize(t, RAW_RETURN, LONGS);
-        if (ct == null)  ct = t;  // no prims to int-ify
-        return primsAsLongs = ct;
-    }
-
-    /** Stably sort parameters into 3 buckets: ref, int, long. */
-    public MethodType primsAtEnd() {
-        MethodType ct = primsAtEnd;
-        if (ct != null)  return ct;
-        MethodType t = erasedType;
-
-        int pac = primitiveParameterCount();
-        if (pac == 0)
-            return primsAtEnd = t;
-
-        int argc = parameterCount();
-        int lac = longPrimitiveParameterCount();
-        if (pac == argc && (lac == 0 || lac == argc))
-            return primsAtEnd = t;
-
-        // known to have a mix of 2 or 3 of ref, int, long
-        int[] reorder = primsAtEndOrder(t);
-        ct = reorderParameters(t, reorder, null);
-        //System.out.println("t="+t+" / reorder="+java.util.Arrays.toString(reorder)+" => "+ct);
-        return primsAtEnd = ct;
-    }
-
-    /** Compute a new ordering of parameters so that all references
-     *  are before all ints or longs, and all ints are before all longs.
-     *  For this ordering, doubles count as longs, and all other primitive
-     *  values count as ints.
-     *  As a special case, if the parameters are already in the specified
-     *  order, this method returns a null reference, rather than an array
-     *  specifying a null permutation.
-     *  <p>
-     *  For example, the type {@code (int,boolean,int,Object,String)void}
-     *  produces the order {@code {3,4,0,1,2}}, the type
-     *  {@code (long,int,String)void} produces {@code {2,1,2}}, and
-     *  the type {@code (Object,int)Object} produces {@code null}.
-     */
-    public static int[] primsAtEndOrder(MethodType mt) {
-        MethodTypeImpl form = METHOD_TYPE_FRIEND.form(mt);
-        if (form.primsAtEnd == form.erasedType)
-            // quick check shows no reordering is necessary
-            return null;
-
-        int argc = form.parameterCount();
-        int[] paramOrder = new int[argc];
-
-        // 3-way bucket sort:
-        int pac = form.primitiveParameterCount();
-        int lac = form.longPrimitiveParameterCount();
-        int rfill = 0, ifill = argc - pac, lfill = argc - lac;
-
-        Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(mt);
-        boolean changed = false;
-        for (int i = 0; i < ptypes.length; i++) {
-            Class<?> pt = ptypes[i];
-            int ord;
-            if (!pt.isPrimitive())             ord = rfill++;
-            else if (!hasTwoArgSlots(pt))      ord = ifill++;
-            else                               ord = lfill++;
-            if (ord != i)  changed = true;
-            assert(paramOrder[ord] == 0);
-            paramOrder[ord] = i;
-        }
-        assert(rfill == argc - pac && ifill == argc - lac && lfill == argc);
-        if (!changed) {
-            form.primsAtEnd = form.erasedType;
-            return null;
-        }
-        return paramOrder;
-    }
-
-    /** Put the existing parameters of mt into a new order, given by newParamOrder.
-     *  The third argument is logically appended to mt.parameterArray,
-     *  so that elements of newParamOrder can index either pre-existing or
-     *  new parameter types.
-     */
-    public static MethodType reorderParameters(MethodType mt, int[] newParamOrder, Class<?>[] moreParams) {
-        if (newParamOrder == null)  return mt;  // no-op reordering
-        Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(mt);
-        Class<?>[] ntypes = new Class<?>[newParamOrder.length];
-        int maxParam = ptypes.length + (moreParams == null ? 0 : moreParams.length);
-        boolean changed = (ntypes.length != ptypes.length);
-        for (int i = 0; i < newParamOrder.length; i++) {
-            int param = newParamOrder[i];
-            if (param != i)  changed = true;
-            Class<?> nt;
-            if (param < ptypes.length)   nt = ptypes[param];
-            else if (param == maxParam)  nt = mt.returnType();
-            else                         nt = moreParams[param - ptypes.length];
-            ntypes[i] = nt;
-        }
-        if (!changed)  return mt;
-        return METHOD_TYPE_FRIEND.makeImpl(mt.returnType(), ntypes, true);
-    }
-
-    private static boolean hasTwoArgSlots(Class<?> type) {
-        return type == long.class || type == double.class;
-    }
-
-    private static long pack(int a, int b, int c, int d) {
-        assert(((a|b|c|d) & ~0xFFFF) == 0);
-        long hw = ((a << 16) | b), lw = ((c << 16) | d);
-        return (hw << 32) | lw;
-    }
-    private static char unpack(long packed, int word) { // word==0 => return a, ==3 => return d
-        assert(word <= 3);
-        return (char)(packed >> ((3-word) * 16));
-    }
-
-    public int parameterCount() {                      // # outgoing values
-        return unpack(argCounts, 3);
-    }
-    public int parameterSlotCount() {                  // # outgoing interpreter slots
-        return unpack(argCounts, 2);
-    }
-    public int returnCount() {                         // = 0 (V), or 1
-        return unpack(argCounts, 1);
-    }
-    public int returnSlotCount() {                     // = 0 (V), 2 (J/D), or 1
-        return unpack(argCounts, 0);
-    }
-    public int primitiveParameterCount() {
-        return unpack(primCounts, 3);
-    }
-    public int longPrimitiveParameterCount() {
-        return unpack(primCounts, 2);
-    }
-    public int primitiveReturnCount() {                // = 0 (obj), or 1
-        return unpack(primCounts, 1);
-    }
-    public int longPrimitiveReturnCount() {            // = 1 (J/D), or 0
-        return unpack(primCounts, 0);
-    }
-    public boolean hasPrimitives() {
-        return primCounts != 0;
-    }
-//    public boolean hasNonVoidPrimitives() {
-//        if (primCounts == 0)  return false;
-//        if (primitiveParameterCount() != 0)  return true;
-//        return (primitiveReturnCount() != 0 && returnCount() != 0);
-//    }
-    public boolean hasLongPrimitives() {
-        return (longPrimitiveParameterCount() | longPrimitiveReturnCount()) != 0;
-    }
-    public int parameterToArgSlot(int i) {
-        return argToSlotTable[1+i];
-    }
-    public int argSlotToParameter(int argSlot) {
-        // Note:  Empty slots are represented by zero in this table.
-        // Valid arguments slots contain incremented entries, so as to be non-zero.
-        // We return -1 the caller to mean an empty slot.
-        return slotToArgTable[argSlot] - 1;
-    }
-
-    public static void initForm(Access token, MethodType mt) {
-        Access.check(token);
-        MethodTypeImpl form = findForm(mt);
-        METHOD_TYPE_FRIEND.setForm(mt, form);
-        if (form.erasedType == mt) {
-            // This is a principal (erased) type; show it to the JVM.
-            MethodHandleImpl.init(token, mt);
-        }
-    }
-
-    static MethodTypeImpl findForm(MethodType mt) {
-        MethodType erased = canonicalize(mt, ERASE, ERASE);
-        if (erased == null) {
-            // It is already erased.  Make a new MethodTypeImpl.
-            return METHOD_TYPE_FRIEND.newMethodTypeForm(mt);
-        } else {
-            // Share the MethodTypeImpl with the erased version.
-            return METHOD_TYPE_FRIEND.form(erased);
-        }
-    }
-
-    /** Codes for {@link #canonicalize(java.lang.Class, int).
-     * ERASE means change every reference to {@code Object}.
-     * WRAP means convert primitives (including {@code void} to their
-     * corresponding wrapper types.  UNWRAP means the reverse of WRAP.
-     * INTS means convert all non-void primitive types to int or long,
-     * according to size.  LONGS means convert all non-void primitives
-     * to long, regardless of size.  RAW_RETURN means convert a type
-     * (assumed to be a return type) to int if it is smaller than an int,
-     * or if it is void.
-     */
-    public static final int NO_CHANGE = 0, ERASE = 1, WRAP = 2, UNWRAP = 3, INTS = 4, LONGS = 5, RAW_RETURN = 6;
-
-    /** Canonicalize the types in the given method type.
-     * If any types change, intern the new type, and return it.
-     * Otherwise return null.
-     */
-    public static MethodType canonicalize(MethodType mt, int howRet, int howArgs) {
-        Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(mt);
-        Class<?>[] ptc = MethodTypeImpl.canonicalizes(ptypes, howArgs);
-        Class<?> rtype = mt.returnType();
-        Class<?> rtc = MethodTypeImpl.canonicalize(rtype, howRet);
-        if (ptc == null && rtc == null) {
-            // It is already canonical.
-            return null;
-        }
-        // Find the erased version of the method type:
-        if (rtc == null)  rtc = rtype;
-        if (ptc == null)  ptc = ptypes;
-        return METHOD_TYPE_FRIEND.makeImpl(rtc, ptc, true);
-    }
-
-    /** Canonicalize the given return or param type.
-     *  Return null if the type is already canonicalized.
-     */
-    static Class<?> canonicalize(Class<?> t, int how) {
-        Class<?> ct;
-        if (t == Object.class) {
-            // no change, ever
-        } else if (!t.isPrimitive()) {
-            switch (how) {
-                case UNWRAP:
-                    ct = Wrapper.asPrimitiveType(t);
-                    if (ct != t)  return ct;
-                    break;
-                case RAW_RETURN:
-                case ERASE:
-                    return Object.class;
-            }
-        } else if (t == void.class) {
-            // no change, usually
-            switch (how) {
-                case RAW_RETURN:
-                    return int.class;
-                case WRAP:
-                    return Void.class;
-            }
-        } else {
-            // non-void primitive
-            switch (how) {
-                case WRAP:
-                    return Wrapper.asWrapperType(t);
-                case INTS:
-                    if (t == int.class || t == long.class)
-                        return null;  // no change
-                    if (t == double.class)
-                        return long.class;
-                    return int.class;
-                case LONGS:
-                    if (t == long.class)
-                        return null;  // no change
-                    return long.class;
-                case RAW_RETURN:
-                    if (t == int.class || t == long.class ||
-                        t == float.class || t == double.class)
-                        return null;  // no change
-                    // everything else returns as an int
-                    return int.class;
-            }
-        }
-        // no change; return null to signify
-        return null;
-    }
-
-    /** Canonicalize each param type in the given array.
-     *  Return null if all types are already canonicalized.
-     */
-    static Class<?>[] canonicalizes(Class<?>[] ts, int how) {
-        Class<?>[] cs = null;
-        for (int imax = ts.length, i = 0; i < imax; i++) {
-            Class<?> c = canonicalize(ts[i], how);
-            if (c != null) {
-                if (cs == null)
-                    cs = ts.clone();
-                cs[i] = c;
-            }
-        }
-        return cs;
-    }
-
-    public static Invokers invokers(Access token, MethodType type) {
-        Access.check(token);
-        return invokers(type);
-    }
-    /*non-public*/ static Invokers invokers(MethodType type) {
-        Invokers inv = METHOD_TYPE_FRIEND.getInvokers(type);
-        if (inv != null)  return inv;
-        inv = new Invokers(type);
-        METHOD_TYPE_FRIEND.setInvokers(type, inv);
-        return inv;
-    }
-
-    @Override
-    public String toString() {
-        return "Form"+erasedType;
-    }
-
-}
--- a/jdk/src/share/classes/sun/dyn/SpreadGeneric.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,678 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn;
-
-import java.dyn.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import sun.dyn.util.ValueConversions;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-
-/**
- * Generic spread adapter.
- * Expands a final argument into multiple (zero or more) arguments, keeping the others the same.
- * @author jrose
- */
-class SpreadGeneric {
-    // type for the outgoing call
-    private final MethodType targetType;
-    // number of arguments to spread
-    private final int spreadCount;
-    // prototype adapter (clone and customize for each new target!)
-    private final Adapter adapter;
-    // entry point for adapter (Adapter mh, a...) => ...
-    private final MethodHandle entryPoint;
-
-    /** Compute and cache information common to all spreading adapters
-     *  that accept calls of the given (generic) type.
-     */
-    private SpreadGeneric(MethodType targetType, int spreadCount) {
-        assert(targetType == targetType.generic());
-        this.targetType = targetType;
-        this.spreadCount = spreadCount;
-        // the target invoker will generally need casts on reference arguments
-        MethodHandle[] ep = { null };
-        Adapter ad = findAdapter(this, ep);
-        if (ad != null) {
-            this.adapter = ad;
-            this.entryPoint = ep[0];
-            return;
-        }
-        this.adapter = buildAdapterFromBytecodes(targetType, spreadCount, ep);
-        this.entryPoint = ep[0];
-    }
-
-    /** From targetType remove the last spreadCount arguments, and instead
-     *  append a simple Object argument.
-     */
-    static MethodType preSpreadType(MethodType targetType, int spreadCount) {
-        @SuppressWarnings("unchecked")
-        ArrayList<Class<?>> params = new ArrayList(targetType.parameterList());
-        int outargs = params.size();
-        params.subList(outargs - spreadCount, outargs).clear();
-        params.add(Object.class);
-        return MethodType.methodType(targetType.returnType(), params);
-    }
-
-    MethodHandle makeInstance(MethodHandle target) {
-        MethodType type = target.type();
-        if (type != targetType) {
-            throw new UnsupportedOperationException("NYI type="+type);
-        }
-        return adapter.makeInstance(this, target);
-    }
-
-    /** Build an adapter of the given generic type, which invokes typedTarget
-     *  on the incoming arguments, after unboxing as necessary.
-     *  The return value is boxed if necessary.
-     * @param genericType  the required type of the result
-     * @param typedTarget the target
-     * @return an adapter method handle
-     */
-    public static MethodHandle make(MethodHandle target, int spreadCount) {
-        MethodType type = target.type();
-        MethodType gtype = type.generic();
-        if (type == gtype) {
-            return SpreadGeneric.of(type, spreadCount).makeInstance(target);
-        } else {
-            MethodHandle gtarget = FromGeneric.make(target);
-            assert(gtarget.type() == gtype);
-            MethodHandle gspread = SpreadGeneric.of(gtype, spreadCount).makeInstance(gtarget);
-            return ToGeneric.make(preSpreadType(type, spreadCount), gspread);
-        }
-    }
-
-    /** Return the adapter information for this type's erasure. */
-    static SpreadGeneric of(MethodType targetType, int spreadCount) {
-        if (targetType != targetType.generic())
-            throw new UnsupportedOperationException("NYI type="+targetType);
-        MethodTypeImpl form = MethodTypeImpl.of(targetType);
-        int outcount = form.parameterCount();
-        assert(spreadCount <= outcount);
-        SpreadGeneric[] spreadGens = form.spreadGeneric;
-        if (spreadGens == null)
-            form.spreadGeneric = spreadGens = new SpreadGeneric[outcount+1];
-        SpreadGeneric spreadGen = spreadGens[spreadCount];
-        if (spreadGen == null)
-            spreadGens[spreadCount] = spreadGen = new SpreadGeneric(form.erasedType(), spreadCount);
-        return spreadGen;
-    }
-
-    public String toString() {
-        return getClass().getSimpleName()+targetType+"["+spreadCount+"]";
-    }
-
-    // This mini-api is called from an Adapter to manage the spread.
-    /** A check/coercion that happens once before any selections. */
-    protected Object check(Object av, int n) {
-        MethodHandleImpl.checkSpreadArgument(av, n);
-        return av;
-    }
-
-    /** The selection operator for spreading; note that it takes Object not Object[]. */
-    protected Object select(Object av, int n) {
-        return ((Object[])av)[n];
-    }
-    /*
-    protected int select_I(Object av, int n) {
-        // maybe return ((int[])select)[n]
-        throw new UnsupportedOperationException("subclass resp.");
-    }
-    protected int select_J(Object av, int n) {
-        // maybe return ((long[])select)[n]
-        throw new UnsupportedOperationException("subclass resp.");
-    }
-    // */
-
-    /* Create an adapter that handles spreading calls for the given type. */
-    static Adapter findAdapter(SpreadGeneric outer, MethodHandle[] ep) {
-        MethodType targetType = outer.targetType;
-        int spreadCount = outer.spreadCount;
-        int outargs = targetType.parameterCount();
-        int inargs = outargs - spreadCount;
-        if (inargs < 0)  return null;
-        MethodType entryType = MethodType.genericMethodType(inargs + 1); // 1 for av
-        String cname1 = "S" + outargs;
-        String[] cnames = { cname1 };
-        String iname = "invoke_S"+spreadCount;
-        // e.g., D5I2, D5, L5I2, L5; invoke_D5
-        for (String cname : cnames) {
-            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
-            if (acls == null)  continue;
-            // see if it has the required invoke method
-            MethodHandle entryPoint = null;
-            try {
-                entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
-            } catch (ReflectiveOperationException ex) {
-            }
-            if (entryPoint == null)  continue;
-            Constructor<? extends Adapter> ctor = null;
-            try {
-                ctor = acls.getDeclaredConstructor(SpreadGeneric.class);
-            } catch (NoSuchMethodException ex) {
-            } catch (SecurityException ex) {
-            }
-            if (ctor == null)  continue;
-            try {
-                // Produce an instance configured as a prototype.
-                Adapter ad = ctor.newInstance(outer);
-                ep[0] = entryPoint;
-                return ad;
-            } catch (IllegalArgumentException ex) {
-            } catch (InvocationTargetException wex) {
-                Throwable ex = wex.getTargetException();
-                if (ex instanceof Error)  throw (Error)ex;
-                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
-            }
-        }
-        return null;
-    }
-
-    static Adapter buildAdapterFromBytecodes(MethodType targetType,
-            int spreadCount, MethodHandle[] ep) {
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    /**
-     * This adapter takes some untyped arguments, and returns an untyped result.
-     * Internally, it applies the invoker to the target, which causes the
-     * objects to be unboxed; the result is a raw type in L/I/J/F/D.
-     * This result is passed to convert, which is responsible for
-     * converting the raw result into a boxed object.
-     * The invoker is kept separate from the target because it can be
-     * generated once per type erasure family, and reused across adapters.
-     */
-    static abstract class Adapter extends BoundMethodHandle {
-        /*
-         * class X<<R,int M,int N>> extends Adapter {
-         *   (Object**N)=>R target;
-         *   static int S = N-M;
-         *   Object invoke(Object**M a, Object v) = target(a..., v[0]...v[S-1]);
-         * }
-         */
-        protected final SpreadGeneric outer;
-        protected final MethodHandle target;   // (any**N) => R
-
-        @Override
-        public String toString() {
-            return MethodHandleImpl.addTypeString(target, this);
-        }
-
-        static final MethodHandle NO_ENTRY = ValueConversions.identity();
-
-        protected boolean isPrototype() { return target == null; }
-        protected Adapter(SpreadGeneric outer) {
-            super(Access.TOKEN, NO_ENTRY);
-            this.outer = outer;
-            this.target = null;
-            assert(isPrototype());
-        }
-
-        protected Adapter(SpreadGeneric outer, MethodHandle target) {
-            super(Access.TOKEN, outer.entryPoint);
-            this.outer = outer;
-            this.target = target;
-        }
-
-        /** Make a copy of self, with new fields. */
-        protected abstract Adapter makeInstance(SpreadGeneric outer, MethodHandle target);
-        // { return new ThisType(outer, target); }
-
-        protected Object check(Object av, int n) {
-            return outer.check(av, n);
-        }
-        protected Object select(Object av, int n) {
-            return outer.select(av, n);
-        }
-
-        static private final String CLASS_PREFIX; // "sun.dyn.SpreadGeneric$"
-        static {
-            String aname = Adapter.class.getName();
-            String sname = Adapter.class.getSimpleName();
-            if (!aname.endsWith(sname))  throw new InternalError();
-            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
-        }
-        /** Find a sibing class of Adapter. */
-        static Class<? extends Adapter> findSubClass(String name) {
-            String cname = Adapter.CLASS_PREFIX + name;
-            try {
-                return Class.forName(cname).asSubclass(Adapter.class);
-            } catch (ClassNotFoundException ex) {
-                return null;
-            } catch (ClassCastException ex) {
-                return null;
-            }
-        }
-    }
-
-    /* generated classes follow this pattern:
-    static class xS2 extends Adapter {
-        protected xS2(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected xS2(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected xS2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new xS2(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av,0);
-             return target.invokeExact(a0, a1)); }
-        protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av,1);
-             return target.invokeExact(a0,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av,1);
-             return target.invokeExact(
-                super.select(av,0), super.select(av,1)); }
-    }
-    // */
-
-/*
-: SHELL; n=SpreadGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
-//{{{
-import java.util.*;
-class genclasses {
-    static String[][] TEMPLATES = { {
-        "@for@ N=0..10",
-        "    //@each-cat@",
-        "    static class @cat@ extends Adapter {",
-        "        protected @cat@(SpreadGeneric outer) { super(outer); }  // to build prototype",
-        "        protected @cat@(SpreadGeneric outer, MethodHandle t) { super(outer, t); }",
-        "        protected @cat@ makeInstance(SpreadGeneric outer, MethodHandle t) { return new @cat@(outer, t); }",
-        "        protected Object invoke_S0(@Tvav,@Object av) throws Throwable { av = super.check(av, 0);",
-        "            return target.invokeExact(@av@); }",
-        "        //@each-S@",
-        "        protected Object invoke_S@S@(@Tvav,@Object av) throws Throwable { av = super.check(av, @S@);",
-        "            return target.invokeExact(@av,@@sv@); }",
-        "        //@end-S@",
-        "    }",
-    } };
-    static final String NEWLINE_INDENT = "\n                ";
-    enum VAR {
-        cat, N, S, av, av_, Tvav_, sv;
-        public final String pattern = "@"+toString().replace('_','.')+"@";
-        public String binding = toString();
-        static void makeBindings(boolean topLevel, int outargs, int spread) {
-            int inargs = outargs - spread;
-            VAR.cat.binding = "S"+outargs;
-            VAR.N.binding = String.valueOf(outargs); // outgoing arg count
-            VAR.S.binding = String.valueOf(spread);  // spread count
-            String[] av = new String[inargs];
-            String[] Tvav = new String[inargs];
-            for (int i = 0; i < inargs; i++) {
-                av[i] = arg(i);
-                Tvav[i] = param("Object", av[i]);
-            }
-            VAR.av.binding = comma(av);
-            VAR.av_.binding = comma(av, ", ");
-            VAR.Tvav_.binding = comma(Tvav, ", ");
-            String[] sv = new String[spread];
-            for (int i = 0; i < spread; i++) {
-                String spc = "";
-                if (i % 4 == 0) spc = NEWLINE_INDENT;
-                sv[i] = spc+"super.select(av,"+i+")";
-            }
-            VAR.sv.binding = comma(sv);
-        }
-        static String arg(int i) { return "a"+i; }
-        static String param(String t, String a) { return t+" "+a; }
-        static String comma(String[] v) { return comma(v, ""); }
-        static String comma(String[] v, String sep) {
-            if (v.length == 0)  return "";
-            String res = v[0];
-            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
-            return res + sep;
-        }
-        static String transform(String string) {
-            for (VAR var : values())
-                string = string.replaceAll(var.pattern, var.binding);
-            return string;
-        }
-    }
-    static String[] stringsIn(String[] strings, int beg, int end) {
-        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
-    }
-    static String[] stringsBefore(String[] strings, int pos) {
-        return stringsIn(strings, 0, pos);
-    }
-    static String[] stringsAfter(String[] strings, int pos) {
-        return stringsIn(strings, pos, strings.length);
-    }
-    static int indexAfter(String[] strings, int pos, String tag) {
-        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
-    }
-    static int indexBefore(String[] strings, int pos, String tag) {
-        for (int i = pos, end = strings.length; ; i++) {
-            if (i == end || strings[i].endsWith(tag))  return i;
-        }
-    }
-    static int MIN_ARITY, MAX_ARITY;
-    public static void main(String... av) {
-        for (String[] template : TEMPLATES) {
-            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
-            String[] forLines = stringsBefore(template, forLinesLimit);
-            template = stringsAfter(template, forLinesLimit);
-            for (String forLine : forLines)
-                expandTemplate(forLine, template);
-        }
-    }
-    static void expandTemplate(String forLine, String[] template) {
-        String[] params = forLine.split("[^0-9]+");
-        if (params[0].length() == 0)  params = stringsAfter(params, 1);
-        System.out.println("//params="+Arrays.asList(params));
-        int pcur = 0;
-        MIN_ARITY = Integer.valueOf(params[pcur++]);
-        MAX_ARITY = Integer.valueOf(params[pcur++]);
-        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
-        for (int outargs = MIN_ARITY; outargs <= MAX_ARITY; outargs++) {
-            expandTemplate(template, true, outargs, 0);
-        }
-    }
-    static void expandTemplate(String[] template, boolean topLevel, int outargs, int spread) {
-        VAR.makeBindings(topLevel, outargs, spread);
-        for (int i = 0; i < template.length; i++) {
-            String line = template[i];
-            if (line.endsWith("@each-cat@")) {
-                // ignore
-            } else if (line.endsWith("@each-S@")) {
-                int blockEnd = indexAfter(template, i, "@end-S@");
-                String[] block = stringsIn(template, i+1, blockEnd-1);
-                for (int spread1 = spread+1; spread1 <= outargs; spread1++)
-                    expandTemplate(block, false, outargs, spread1);
-                VAR.makeBindings(topLevel, outargs, spread);
-                i = blockEnd-1; continue;
-            } else {
-                System.out.println(VAR.transform(line));
-            }
-        }
-    }
-}
-//}}} */
-//params=[0, 10]
-    static class S0 extends Adapter {
-        protected S0(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S0(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S0 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S0(outer, t); }
-        protected Object invoke_S0(Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(); }
-    }
-    static class S1 extends Adapter {
-        protected S1(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S1(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S1 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S1(outer, t); }
-        protected Object invoke_S0(Object a0, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0); }
-        protected Object invoke_S1(Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(
-                super.select(av,0)); }
-    }
-    static class S2 extends Adapter {
-        protected S2(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S2(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S2(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1); }
-        protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1)); }
-    }
-    static class S3 extends Adapter {
-        protected S3(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S3(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S3 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S3(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2); }
-        protected Object invoke_S1(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-    }
-    static class S4 extends Adapter {
-        protected S4(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S4(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S4 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S4(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-    }
-    static class S5 extends Adapter {
-        protected S5(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S5(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S5 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S5(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3, a4); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2, a3,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object a0, Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-        protected Object invoke_S5(Object av) throws Throwable { av = super.check(av, 5);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4)); }
-    }
-    static class S6 extends Adapter {
-        protected S6(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S6(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S6 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S6(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2, a3, a4,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1, a2, a3,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-        protected Object invoke_S5(Object a0, Object av) throws Throwable { av = super.check(av, 5);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4)); }
-        protected Object invoke_S6(Object av) throws Throwable { av = super.check(av, 6);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5)); }
-    }
-    static class S7 extends Adapter {
-        protected S7(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S7(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S7 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S7(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1, a2, a3, a4,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0, a1, a2, a3,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-        protected Object invoke_S5(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 5);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4)); }
-        protected Object invoke_S6(Object a0, Object av) throws Throwable { av = super.check(av, 6);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5)); }
-        protected Object invoke_S7(Object av) throws Throwable { av = super.check(av, 7);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6)); }
-    }
-    static class S8 extends Adapter {
-        protected S8(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S8(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S8 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S8(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0, a1, a2, a3, a4,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(a0, a1, a2, a3,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-        protected Object invoke_S5(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 5);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4)); }
-        protected Object invoke_S6(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 6);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5)); }
-        protected Object invoke_S7(Object a0, Object av) throws Throwable { av = super.check(av, 7);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6)); }
-        protected Object invoke_S8(Object av) throws Throwable { av = super.check(av, 8);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
-    }
-    static class S9 extends Adapter {
-        protected S9(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S9(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S9 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S9(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(a0, a1, a2, a3, a4,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-        protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 5);
-            return target.invokeExact(a0, a1, a2, a3,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4)); }
-        protected Object invoke_S6(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 6);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5)); }
-        protected Object invoke_S7(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 7);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6)); }
-        protected Object invoke_S8(Object a0, Object av) throws Throwable { av = super.check(av, 8);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
-        protected Object invoke_S9(Object av) throws Throwable { av = super.check(av, 9);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
-                super.select(av,8)); }
-    }
-    static class S10 extends Adapter {
-        protected S10(SpreadGeneric outer) { super(outer); }  // to build prototype
-        protected S10(SpreadGeneric outer, MethodHandle t) { super(outer, t); }
-        protected S10 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S10(outer, t); }
-        protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9, Object av) throws Throwable { av = super.check(av, 0);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 1);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7, a8,
-                super.select(av,0)); }
-        protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 2);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7,
-                super.select(av,0), super.select(av,1)); }
-        protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 3);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5, a6,
-                super.select(av,0), super.select(av,1), super.select(av,2)); }
-        protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 4);
-            return target.invokeExact(a0, a1, a2, a3, a4, a5,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); }
-        protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 5);
-            return target.invokeExact(a0, a1, a2, a3, a4,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4)); }
-        protected Object invoke_S6(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 6);
-            return target.invokeExact(a0, a1, a2, a3,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5)); }
-        protected Object invoke_S7(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 7);
-            return target.invokeExact(a0, a1, a2,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6)); }
-        protected Object invoke_S8(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 8);
-            return target.invokeExact(a0, a1,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); }
-        protected Object invoke_S9(Object a0, Object av) throws Throwable { av = super.check(av, 9);
-            return target.invokeExact(a0,
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
-                super.select(av,8)); }
-        protected Object invoke_S10(Object av) throws Throwable { av = super.check(av, 10);
-            return target.invokeExact(
-                super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3),
-                super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7),
-                super.select(av,8), super.select(av,9)); }
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/ToGeneric.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1042 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.dyn;
-
-import java.dyn.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import sun.dyn.util.ValueConversions;
-import sun.dyn.util.Wrapper;
-import static sun.dyn.MemberName.newIllegalArgumentException;
-import static sun.dyn.MethodTypeImpl.invokers;
-
-/**
- * Adapters which mediate between incoming calls which are not generic
- * and outgoing calls which are.  Any call can be represented generically
- * boxing up its arguments, and (on return) unboxing the return value.
- * <p>
- * A call is "generic" (in MethodHandle terms) if its MethodType features
- * only Object arguments.  A non-generic call therefore features
- * primitives and/or reference types other than Object.
- * An adapter has types for its incoming and outgoing calls.
- * The incoming call type is simply determined by the adapter's type
- * (the MethodType it presents to callers).  The outgoing call type
- * is determined by the adapter's target (a MethodHandle that the adapter
- * either binds internally or else takes as a leading argument).
- * (To stretch the term, adapter-like method handles may have multiple
- * targets or be polymorphic across multiple call types.)
- * @author jrose
- */
-class ToGeneric {
-    // type for the incoming call (may be erased)
-    private final MethodType entryType;
-    // incoming type with primitives moved to the end and turned to int/long
-    private final MethodType rawEntryType;
-    // adapter for the erased type
-    private final Adapter adapter;
-    // entry point for adapter (Adapter mh, a...) => ...
-    private final MethodHandle entryPoint;
-    // permutation of arguments for primsAtEndType
-    private final int[] primsAtEndOrder;
-    // optional final argument list conversions (at least, invokes the target)
-    private final MethodHandle invoker;
-    // conversion which unboxes a primitive return value
-    private final MethodHandle returnConversion;
-
-    /** Compute and cache information common to all generifying (boxing) adapters
-     *  that implement members of the erasure-family of the given erased type.
-     */
-    private ToGeneric(MethodType entryType) {
-        assert(entryType.erase() == entryType); // for now
-        // incoming call will first "forget" all reference types except Object
-        this.entryType = entryType;
-        MethodHandle invoker0 = invokers(entryType.generic()).exactInvoker();
-        MethodType rawEntryTypeInit;
-        Adapter ad = findAdapter(rawEntryTypeInit = entryType);
-        if (ad != null) {
-            // Immediate hit to exactly the adapter we want,
-            // with no monkeying around with primitive types.
-            this.returnConversion = computeReturnConversion(entryType, rawEntryTypeInit, false);
-            this.rawEntryType = rawEntryTypeInit;
-            this.adapter = ad;
-            this.entryPoint = ad.prototypeEntryPoint();
-            this.primsAtEndOrder = null;
-            this.invoker = invoker0;
-            return;
-        }
-
-        // next, it will reorder primitives after references
-        MethodType primsAtEnd = MethodTypeImpl.of(entryType).primsAtEnd();
-        // at the same time, it will "forget" all primitive types except int/long
-        this.primsAtEndOrder = MethodTypeImpl.primsAtEndOrder(entryType);
-        if (primsAtEndOrder != null) {
-            // reordering is required; build on top of a simpler ToGeneric
-            ToGeneric va2 = ToGeneric.of(primsAtEnd);
-            this.adapter = va2.adapter;
-            if (true) throw new UnsupportedOperationException("NYI: primitive parameters must follow references; entryType = "+entryType);
-            this.entryPoint = MethodHandleImpl.convertArguments(Access.TOKEN,
-                    va2.entryPoint, primsAtEnd, entryType, primsAtEndOrder);
-            // example: for entryType of (int,Object,Object), the reordered
-            // type is (Object,Object,int) and the order is {1,2,0},
-            // and putPAE is (mh,int0,obj1,obj2) => mh.invokeExact(obj1,obj2,int0)
-            return;
-        }
-
-        // after any needed argument reordering, it will reinterpret
-        // primitive arguments according to their "raw" types int/long
-        MethodType intsAtEnd = MethodTypeImpl.of(primsAtEnd).primsAsInts();
-        ad = findAdapter(rawEntryTypeInit = intsAtEnd);
-        MethodHandle rawEntryPoint;
-        if (ad != null) {
-            rawEntryPoint = ad.prototypeEntryPoint();
-        } else {
-            // Perhaps the adapter is available only for longs.
-            // If so, we can use it, but there will have to be a little
-            // more stack motion on each call.
-            MethodType longsAtEnd = MethodTypeImpl.of(primsAtEnd).primsAsLongs();
-            ad = findAdapter(rawEntryTypeInit = longsAtEnd);
-            if (ad != null) {
-                MethodType eptWithLongs = longsAtEnd.insertParameterTypes(0, ad.getClass());
-                MethodType eptWithInts  =  intsAtEnd.insertParameterTypes(0, ad.getClass());
-                rawEntryPoint = ad.prototypeEntryPoint();
-                MethodType midType = eptWithLongs;  // will change longs to ints
-                for (int i = 0, nargs = midType.parameterCount(); i < nargs; i++) {
-                    if (midType.parameterType(i) != eptWithInts.parameterType(i)) {
-                        assert(midType.parameterType(i) == long.class);
-                        assert(eptWithInts.parameterType(i) == int.class);
-                        MethodType nextType = midType.changeParameterType(i, int.class);
-                        rawEntryPoint = MethodHandle.convertArguments(Access.TOKEN,
-                                rawEntryPoint, nextType, midType, null);
-                        midType = nextType;
-                    }
-                }
-                assert(midType == eptWithInts);
-            } else {
-                // If there is no statically compiled adapter,
-                // build one by means of dynamic bytecode generation.
-                ad = buildAdapterFromBytecodes(rawEntryTypeInit = intsAtEnd);
-                rawEntryPoint = ad.prototypeEntryPoint();
-            }
-        }
-        MethodType tepType = entryType.insertParameterTypes(0, ad.getClass());
-        this.entryPoint =
-            AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, tepType, rawEntryPoint);
-        if (this.entryPoint == null)
-            throw new UnsupportedOperationException("cannot retype to "+entryType
-                    +" from "+rawEntryPoint.type().dropParameterTypes(0, 1));
-        this.returnConversion = computeReturnConversion(entryType, rawEntryTypeInit, false);
-        this.rawEntryType = rawEntryTypeInit;
-        this.adapter = ad;
-        this.invoker = makeRawArgumentFilter(invoker0, rawEntryTypeInit, entryType);
-    }
-
-    /** A generic argument list will be created by a call of type 'raw'.
-     *  The values need to be reboxed for to match 'cooked'.
-     *  Do this on the fly.
-     */
-    // TO DO: Use a generic argument converter in a different file
-    static MethodHandle makeRawArgumentFilter(MethodHandle invoker,
-            MethodType raw, MethodType cooked) {
-        MethodHandle filteredInvoker = null;
-        for (int i = 0, nargs = raw.parameterCount(); i < nargs; i++) {
-            Class<?> src = raw.parameterType(i);
-            Class<?> dst = cooked.parameterType(i);
-            if (src == dst)  continue;
-            assert(src.isPrimitive() && dst.isPrimitive());
-            if (filteredInvoker == null) {
-                filteredInvoker =
-                        AdapterMethodHandle.makeCheckCast(Access.TOKEN,
-                            invoker.type().generic(), invoker, 0, MethodHandle.class);
-                if (filteredInvoker == null)  throw new UnsupportedOperationException("NYI");
-            }
-            MethodHandle reboxer = ValueConversions.rebox(dst, false);
-            filteredInvoker = FilterGeneric.makeArgumentFilter(1+i, reboxer, filteredInvoker);
-            if (filteredInvoker == null)  throw new InternalError();
-        }
-        if (filteredInvoker == null)  return invoker;
-        return AdapterMethodHandle.makeRetypeOnly(Access.TOKEN, invoker.type(), filteredInvoker);
-    }
-
-    /**
-     * Caller will be expecting a result from a call to {@code type},
-     * while the internal adapter entry point is rawEntryType.
-     * Also, the internal target method will be returning a boxed value,
-     * as an untyped object.
-     * <p>
-     * Produce a value converter which will be typed to convert from
-     * {@code Object} to the return value of {@code rawEntryType}, and will
-     * in fact ensure that the value is compatible with the return type of
-     * {@code type}.
-     */
-    private static MethodHandle computeReturnConversion(
-            MethodType type, MethodType rawEntryType, boolean mustCast) {
-        Class<?> tret = type.returnType();
-        Class<?> rret = rawEntryType.returnType();
-        if (mustCast || !tret.isPrimitive()) {
-            assert(!tret.isPrimitive());
-            assert(!rret.isPrimitive());
-            if (rret == Object.class && !mustCast)
-                return null;
-            return ValueConversions.cast(tret, false);
-        } else if (tret == rret) {
-            return ValueConversions.unbox(tret, false);
-        } else {
-            assert(rret.isPrimitive());
-            assert(tret == double.class ? rret == long.class : rret == int.class);
-            return ValueConversions.unboxRaw(tret, false);
-        }
-    }
-
-    Adapter makeInstance(MethodType type, MethodHandle genericTarget) {
-        genericTarget.getClass();  // check for NPE
-        MethodHandle convert = returnConversion;
-        if (primsAtEndOrder != null)
-            // reorder arguments passed to genericTarget, if primsAtEndOrder
-            throw new UnsupportedOperationException("NYI");
-        if (type == entryType) {
-            if (convert == null)  convert = ValueConversions.identity();
-            return adapter.makeInstance(entryPoint, invoker, convert, genericTarget);
-        }
-        // my erased-type is not exactly the same as the desired type
-        assert(type.erase() == entryType);  // else we are busted
-        if (convert == null)
-            convert = computeReturnConversion(type, rawEntryType, true);
-        // retype erased reference arguments (the cast makes it safe to do this)
-        MethodType tepType = type.insertParameterTypes(0, adapter.getClass());
-        MethodHandle typedEntryPoint =
-            AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, tepType, entryPoint);
-        return adapter.makeInstance(typedEntryPoint, invoker, convert, genericTarget);
-    }
-
-    /** Build an adapter of the given type, which invokes genericTarget
-     *  on the incoming arguments, after boxing as necessary.
-     *  The return value is unboxed if necessary.
-     * @param type  the required type of the
-     * @param genericTarget the target, which must accept and return only Object values
-     * @return an adapter method handle
-     */
-    public static MethodHandle make(MethodType type, MethodHandle genericTarget) {
-        MethodType gtype = genericTarget.type();
-        if (type.generic() != gtype)
-            throw newIllegalArgumentException("type must be generic");
-        if (type == gtype)  return genericTarget;
-        return ToGeneric.of(type).makeInstance(type, genericTarget);
-    }
-
-    /** Return the adapter information for this type's erasure. */
-    static ToGeneric of(MethodType type) {
-        MethodTypeImpl form = MethodTypeImpl.of(type);
-        ToGeneric toGen = form.toGeneric;
-        if (toGen == null)
-            form.toGeneric = toGen = new ToGeneric(form.erasedType());
-        return toGen;
-    }
-
-    public String toString() {
-        return "ToGeneric"+entryType
-                +(primsAtEndOrder!=null?"[reorder]":"");
-    }
-
-    /* Create an adapter for the given incoming call type. */
-    static Adapter findAdapter(MethodType entryPointType) {
-        MethodTypeImpl form = MethodTypeImpl.of(entryPointType);
-        Class<?> rtype = entryPointType.returnType();
-        int argc = form.parameterCount();
-        int lac = form.longPrimitiveParameterCount();
-        int iac = form.primitiveParameterCount() - lac;
-        String intsAndLongs = (iac > 0 ? "I"+iac : "")+(lac > 0 ? "J"+lac : "");
-        String rawReturn = String.valueOf(Wrapper.forPrimitiveType(rtype).basicTypeChar());
-        String iname0 = "invoke_"+rawReturn;
-        String iname1 = "invoke";
-        String[] inames = { iname0, iname1 };
-        String cname0 = rawReturn + argc;
-        String cname1 = "A"       + argc;
-        String[] cnames = { cname1, cname1+intsAndLongs, cname0, cname0+intsAndLongs };
-        // e.g., D5I2, D5, L5I2, L5
-        for (String cname : cnames) {
-            Class<? extends Adapter> acls = Adapter.findSubClass(cname);
-            if (acls == null)  continue;
-            // see if it has the required invoke method
-            for (String iname : inames) {
-                MethodHandle entryPoint = null;
-                try {
-                    entryPoint = MethodHandleImpl.IMPL_LOOKUP.
-                                    findSpecial(acls, iname, entryPointType, acls);
-                } catch (ReflectiveOperationException ex) {
-                }
-                if (entryPoint == null)  continue;
-                Constructor<? extends Adapter> ctor = null;
-                try {
-                    // Prototype builder:
-                    ctor = acls.getDeclaredConstructor(MethodHandle.class);
-                } catch (NoSuchMethodException ex) {
-                } catch (SecurityException ex) {
-                }
-                if (ctor == null)  continue;
-                try {
-                    return ctor.newInstance(entryPoint);
-                } catch (IllegalArgumentException ex) {
-                } catch (InvocationTargetException wex) {
-                    Throwable ex = wex.getTargetException();
-                    if (ex instanceof Error)  throw (Error)ex;
-                    if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
-                } catch (InstantiationException ex) {
-                } catch (IllegalAccessException ex) {
-                }
-            }
-        }
-        return null;
-    }
-
-    static Adapter buildAdapterFromBytecodes(MethodType entryPointType) {
-        throw new UnsupportedOperationException("NYI");
-    }
-
-    /**
-     * The invoke method takes some particular but unconstrained spread
-     * of raw argument types, and returns a raw return type (in L/I/J/F/D).
-     * Internally, it converts the incoming arguments uniformly into objects.
-     * This series of objects is then passed to the {@code target} method,
-     * which returns a result object.  This result is finally converted,
-     * via another method handle {@code convert}, which is responsible for
-     * converting the object result into the raw return value.
-     */
-    static abstract class Adapter extends BoundMethodHandle {
-        /*
-         * class X<<R,A...>> extends Adapter {
-         *   Object...=>Object target;
-         *   Object=>R convert;
-         *   R invoke(A... a...) = convert(invoker(target, a...)))
-         * }
-         */
-        protected final MethodHandle invoker;  // (MH, Object...) -> Object
-        protected final MethodHandle target;   // Object... -> Object
-        protected final MethodHandle convert;  // Object -> R
-
-        @Override
-        public String toString() {
-            return target == null ? "prototype:"+convert : MethodHandleImpl.addTypeString(target, this);
-        }
-
-        protected boolean isPrototype() { return target == null; }
-        /* Prototype constructor. */
-        protected Adapter(MethodHandle entryPoint) {
-            super(Access.TOKEN, entryPoint);
-            this.invoker = null;
-            this.convert = entryPoint;
-            this.target = null;
-            assert(isPrototype());
-        }
-        protected MethodHandle prototypeEntryPoint() {
-            if (!isPrototype())  throw new InternalError();
-            return convert;
-        }
-
-        protected Adapter(MethodHandle entryPoint, MethodHandle invoker, MethodHandle convert, MethodHandle target) {
-            super(Access.TOKEN, entryPoint);
-            this.invoker = invoker;
-            this.convert = convert;
-            this.target = target;
-        }
-
-        /** Make a copy of self, with new fields. */
-        protected abstract Adapter makeInstance(MethodHandle entryPoint,
-                MethodHandle invoker, MethodHandle convert, MethodHandle target);
-        // { return new ThisType(entryPoint, convert, target); }
-
-        // Code to run when the arguments (<= 4) have all been boxed.
-        protected Object target()               throws Throwable { return invoker.invokeExact(target); }
-        protected Object target(Object a0)      throws Throwable { return invoker.invokeExact(target, a0); }
-        protected Object target(Object a0, Object a1)
-                                                throws Throwable { return invoker.invokeExact(target, a0, a1); }
-        protected Object target(Object a0, Object a1, Object a2)
-                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3)
-                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3); }
-        /*
-        protected Object target_0(Object... av) throws Throwable { return invoker.invokeExact(target, av); }
-        protected Object target_1(Object a0, Object... av)
-                                                throws Throwable { return invoker.invokeExact(target, a0, (Object)av); }
-        protected Object target_2(Object a0, Object a1, Object... av)
-                                                throws Throwable { return invoker.invokeExact(target, a0, a1, (Object)av); }
-        protected Object target_3(Object a0, Object a1, Object a2, Object... av)
-                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2, (Object)av); }
-        protected Object target_4(Object a0, Object a1, Object a2, Object a3, Object... av)
-                                                throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, (Object)av); }
-        // */
-        // (For more than 4 arguments, generate the code in the adapter itself.)
-
-        // Code to run when the generic target has finished and produced a value.
-        protected Object return_L(Object res) throws Throwable { return (Object)convert.invokeExact(res); }
-        protected int    return_I(Object res) throws Throwable { return (int)   convert.invokeExact(res); }
-        protected long   return_J(Object res) throws Throwable { return (long)  convert.invokeExact(res); }
-        protected float  return_F(Object res) throws Throwable { return (float) convert.invokeExact(res); }
-        protected double return_D(Object res) throws Throwable { return (double)convert.invokeExact(res); }
-
-        static private final String CLASS_PREFIX; // "sun.dyn.ToGeneric$"
-        static {
-            String aname = Adapter.class.getName();
-            String sname = Adapter.class.getSimpleName();
-            if (!aname.endsWith(sname))  throw new InternalError();
-            CLASS_PREFIX = aname.substring(0, aname.length() - sname.length());
-        }
-        /** Find a sibing class of Adapter. */
-        static Class<? extends Adapter> findSubClass(String name) {
-            String cname = Adapter.CLASS_PREFIX + name;
-            try {
-                return Class.forName(cname).asSubclass(Adapter.class);
-            } catch (ClassNotFoundException ex) {
-                return null;
-            } catch (ClassCastException ex) {
-                return null;
-            }
-        }
-    }
-
-    /* generated classes follow this pattern:
-    static class A1 extends Adapter {
-        protected A1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); }
-        protected Object target(Object a0)   throws Throwable { return invoker.invokeExact(target, a0); }
-        protected Object targetA1(Object a0) throws Throwable { return target(a0); }
-        protected Object targetA1(int    a0) throws Throwable { return target(a0); }
-        protected Object targetA1(long   a0) throws Throwable { return target(a0); }
-        protected Object invoke_L(Object a0) throws Throwable { return return_L(targetA1(a0)); }
-        protected int    invoke_I(Object a0) throws Throwable { return return_I(targetA1(a0)); }
-        protected long   invoke_J(Object a0) throws Throwable { return return_J(targetA1(a0)); }
-        protected float  invoke_F(Object a0) throws Throwable { return return_F(targetA1(a0)); }
-        protected double invoke_D(Object a0) throws Throwable { return return_D(targetA1(a0)); }
-        protected Object invoke_L(int    a0) throws Throwable { return return_L(targetA1(a0)); }
-        protected int    invoke_I(int    a0) throws Throwable { return return_I(targetA1(a0)); }
-        protected long   invoke_J(int    a0) throws Throwable { return return_J(targetA1(a0)); }
-        protected float  invoke_F(int    a0) throws Throwable { return return_F(targetA1(a0)); }
-        protected double invoke_D(int    a0) throws Throwable { return return_D(targetA1(a0)); }
-        protected Object invoke_L(long   a0) throws Throwable { return return_L(targetA1(a0)); }
-        protected int    invoke_I(long   a0) throws Throwable { return return_I(targetA1(a0)); }
-        protected long   invoke_J(long   a0) throws Throwable { return return_J(targetA1(a0)); }
-        protected float  invoke_F(long   a0) throws Throwable { return return_F(targetA1(a0)); }
-        protected double invoke_D(long   a0) throws Throwable { return return_D(targetA1(a0)); }
-    }
-    // */
-
-/*
-: SHELL; n=ToGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~
-//{{{
-import java.util.*;
-class genclasses {
-    static String[] TYPES = { "Object", "int   ", "long  ", "float ", "double" };
-    static String[] TCHARS = { "L",     "I",      "J",      "F",      "D",     "A" };
-    static String[][] TEMPLATES = { {
-        "@for@ arity=0..3   rcat<=4 nrefs<=99 nints<=99 nlongs<=99",
-        "@for@ arity=4..5   rcat<=2 nrefs<=99 nints<=99 nlongs<=99",
-        "@for@ arity=6..10  rcat<=2 nrefs<=99 nints=0   nlongs<=99",
-        "    //@each-cat@",
-        "    static class @cat@ extends Adapter {",
-        "        protected @cat@(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype",
-        "        protected @cat@(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }",
-        "        protected @cat@ makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new @cat@(e, i, c, t); }",
-        "        protected Object target(@Ovav@)   throws Throwable { return invoker.invokeExact(target, @av@); }",
-        "        //@each-Tv@",
-        "        protected Object target@cat@(@Tvav@) throws Throwable { return target(@av@); }",
-        "        //@end-Tv@",
-        "        //@each-Tv@",
-        "        //@each-R@",
-        "        protected @R@ invoke_@Rc@(@Tvav@) throws Throwable { return return_@Rc@(target@cat@(@av@)); }",
-        "        //@end-R@",
-        "        //@end-Tv@",
-        "    }",
-    } };
-    enum VAR {
-        cat, R, Rc, Tv, av, Tvav, Ovav;
-        public final String pattern = "@"+toString().replace('_','.')+"@";
-        public String binding;
-        static void makeBindings(boolean topLevel, int rcat, int nrefs, int nints, int nlongs) {
-            int nargs = nrefs + nints + nlongs;
-            if (topLevel)
-                VAR.cat.binding = catstr(ALL_RETURN_TYPES ? TYPES.length : rcat, nrefs, nints, nlongs);
-            VAR.R.binding = TYPES[rcat];
-            VAR.Rc.binding = TCHARS[rcat];
-            String[] Tv = new String[nargs];
-            String[] av = new String[nargs];
-            String[] Tvav = new String[nargs];
-            String[] Ovav = new String[nargs];
-            for (int i = 0; i < nargs; i++) {
-                int tcat = (i < nrefs) ? 0 : (i < nrefs + nints) ? 1 : 2;
-                Tv[i] = TYPES[tcat];
-                av[i] = arg(i);
-                Tvav[i] = param(Tv[i], av[i]);
-                Ovav[i] = param("Object", av[i]);
-            }
-            VAR.Tv.binding = comma(Tv);
-            VAR.av.binding = comma(av);
-            VAR.Tvav.binding = comma(Tvav);
-            VAR.Ovav.binding = comma(Ovav);
-        }
-        static String arg(int i) { return "a"+i; }
-        static String param(String t, String a) { return t+" "+a; }
-        static String comma(String[] v) { return comma(v, ""); }
-        static String comma(String sep, String[] v) {
-            if (v.length == 0)  return "";
-            String res = sep+v[0];
-            for (int i = 1; i < v.length; i++)  res += ", "+v[i];
-            return res;
-        }
-        static String transform(String string) {
-            for (VAR var : values())
-                string = string.replaceAll(var.pattern, var.binding);
-            return string;
-        }
-    }
-    static String[] stringsIn(String[] strings, int beg, int end) {
-        return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length));
-    }
-    static String[] stringsBefore(String[] strings, int pos) {
-        return stringsIn(strings, 0, pos);
-    }
-    static String[] stringsAfter(String[] strings, int pos) {
-        return stringsIn(strings, pos, strings.length);
-    }
-    static int indexAfter(String[] strings, int pos, String tag) {
-        return Math.min(indexBefore(strings, pos, tag) + 1, strings.length);
-    }
-    static int indexBefore(String[] strings, int pos, String tag) {
-        for (int i = pos, end = strings.length; ; i++) {
-            if (i == end || strings[i].endsWith(tag))  return i;
-        }
-    }
-    static int MIN_ARITY, MAX_ARITY, MAX_RCAT, MAX_REFS, MAX_INTS, MAX_LONGS;
-    static boolean ALL_ARG_TYPES, ALL_RETURN_TYPES;
-    static HashSet<String> done = new HashSet<String>();
-    public static void main(String... av) {
-        for (String[] template : TEMPLATES) {
-            int forLinesLimit = indexBefore(template, 0, "@each-cat@");
-            String[] forLines = stringsBefore(template, forLinesLimit);
-            template = stringsAfter(template, forLinesLimit);
-            for (String forLine : forLines)
-                expandTemplate(forLine, template);
-        }
-    }
-    static void expandTemplate(String forLine, String[] template) {
-        String[] params = forLine.split("[^0-9]+");
-        if (params[0].length() == 0)  params = stringsAfter(params, 1);
-        System.out.println("//params="+Arrays.asList(params));
-        int pcur = 0;
-        MIN_ARITY = Integer.valueOf(params[pcur++]);
-        MAX_ARITY = Integer.valueOf(params[pcur++]);
-        MAX_RCAT  = Integer.valueOf(params[pcur++]);
-        MAX_REFS  = Integer.valueOf(params[pcur++]);
-        MAX_INTS  = Integer.valueOf(params[pcur++]);
-        MAX_LONGS = Integer.valueOf(params[pcur++]);
-        if (pcur != params.length)  throw new RuntimeException("bad extra param: "+forLine);
-        if (MAX_RCAT >= TYPES.length)  MAX_RCAT = TYPES.length - 1;
-        ALL_ARG_TYPES = (indexBefore(template, 0, "@each-Tv@") < template.length);
-        ALL_RETURN_TYPES = (indexBefore(template, 0, "@each-R@") < template.length);
-        for (int nargs = MIN_ARITY; nargs <= MAX_ARITY; nargs++) {
-            for (int rcat = 0; rcat <= MAX_RCAT; rcat++) {
-                expandTemplate(template, true, rcat, nargs, 0, 0);
-                if (ALL_ARG_TYPES)  break;
-                expandTemplateForPrims(template, true, rcat, nargs, 1, 1);
-                if (ALL_RETURN_TYPES)  break;
-            }
-        }
-    }
-    static String catstr(int rcat, int nrefs, int nints, int nlongs) {
-        int nargs = nrefs + nints + nlongs;
-        String cat = TCHARS[rcat] + nargs;
-        if (!ALL_ARG_TYPES)  cat += (nints==0?"":"I"+nints)+(nlongs==0?"":"J"+nlongs);
-        return cat;
-    }
-    static void expandTemplateForPrims(String[] template, boolean topLevel, int rcat, int nargs, int minints, int minlongs) {
-        for (int isLong = 0; isLong <= 1; isLong++) {
-            for (int nprims = 1; nprims <= nargs; nprims++) {
-                int nrefs = nargs - nprims;
-                int nints = ((1-isLong) * nprims);
-                int nlongs = (isLong * nprims);
-                expandTemplate(template, topLevel, rcat, nrefs, nints, nlongs);
-            }
-        }
-    }
-    static void expandTemplate(String[] template, boolean topLevel,
-                               int rcat, int nrefs, int nints, int nlongs) {
-        int nargs = nrefs + nints + nlongs;
-        if (nrefs > MAX_REFS || nints > MAX_INTS || nlongs > MAX_LONGS)  return;
-        VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
-        if (topLevel && !done.add(VAR.cat.binding)) {
-            System.out.println("    //repeat "+VAR.cat.binding);
-            return;
-        }
-        for (int i = 0; i < template.length; i++) {
-            String line = template[i];
-            if (line.endsWith("@each-cat@")) {
-                // ignore
-            } else if (line.endsWith("@each-R@")) {
-                int blockEnd = indexAfter(template, i, "@end-R@");
-                String[] block = stringsIn(template, i+1, blockEnd-1);
-                for (int rcat1 = rcat; rcat1 <= MAX_RCAT; rcat1++)
-                    expandTemplate(block, false, rcat1, nrefs, nints, nlongs);
-                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
-                i = blockEnd-1; continue;
-            } else if (line.endsWith("@each-Tv@")) {
-                int blockEnd = indexAfter(template, i, "@end-Tv@");
-                String[] block = stringsIn(template, i+1, blockEnd-1);
-                expandTemplate(block, false, rcat, nrefs, nints, nlongs);
-                expandTemplateForPrims(block, false, rcat, nargs, nints+1, nlongs+1);
-                VAR.makeBindings(topLevel, rcat, nrefs, nints, nlongs);
-                i = blockEnd-1; continue;
-            } else {
-                System.out.println(VAR.transform(line));
-            }
-        }
-    }
-}
-//}}} */
-//params=[0, 3, 4, 99, 99, 99]
-    static class A0 extends Adapter {
-        protected A0(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A0(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A0 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A0(e, i, c, t); }
-        protected Object target()   throws Throwable { return invoker.invokeExact(target); }
-        protected Object targetA0() throws Throwable { return target(); }
-        protected Object invoke_L() throws Throwable { return return_L(targetA0()); }
-        protected int    invoke_I() throws Throwable { return return_I(targetA0()); }
-        protected long   invoke_J() throws Throwable { return return_J(targetA0()); }
-        protected float  invoke_F() throws Throwable { return return_F(targetA0()); }
-        protected double invoke_D() throws Throwable { return return_D(targetA0()); }
-    }
-    static class A1 extends Adapter {
-        protected A1(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); }
-        protected Object target(Object a0)   throws Throwable { return invoker.invokeExact(target, a0); }
-        protected Object targetA1(Object a0) throws Throwable { return target(a0); }
-        protected Object targetA1(int    a0) throws Throwable { return target(a0); }
-        protected Object targetA1(long   a0) throws Throwable { return target(a0); }
-        protected Object invoke_L(Object a0) throws Throwable { return return_L(targetA1(a0)); }
-        protected int    invoke_I(Object a0) throws Throwable { return return_I(targetA1(a0)); }
-        protected long   invoke_J(Object a0) throws Throwable { return return_J(targetA1(a0)); }
-        protected float  invoke_F(Object a0) throws Throwable { return return_F(targetA1(a0)); }
-        protected double invoke_D(Object a0) throws Throwable { return return_D(targetA1(a0)); }
-        protected Object invoke_L(int    a0) throws Throwable { return return_L(targetA1(a0)); }
-        protected int    invoke_I(int    a0) throws Throwable { return return_I(targetA1(a0)); }
-        protected long   invoke_J(int    a0) throws Throwable { return return_J(targetA1(a0)); }
-        protected float  invoke_F(int    a0) throws Throwable { return return_F(targetA1(a0)); }
-        protected double invoke_D(int    a0) throws Throwable { return return_D(targetA1(a0)); }
-        protected Object invoke_L(long   a0) throws Throwable { return return_L(targetA1(a0)); }
-        protected int    invoke_I(long   a0) throws Throwable { return return_I(targetA1(a0)); }
-        protected long   invoke_J(long   a0) throws Throwable { return return_J(targetA1(a0)); }
-        protected float  invoke_F(long   a0) throws Throwable { return return_F(targetA1(a0)); }
-        protected double invoke_D(long   a0) throws Throwable { return return_D(targetA1(a0)); }
-    }
-    static class A2 extends Adapter {
-        protected A2(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A2(e, i, c, t); }
-        protected Object target(Object a0, Object a1)   throws Throwable { return invoker.invokeExact(target, a0, a1); }
-        protected Object targetA2(Object a0, Object a1) throws Throwable { return target(a0, a1); }
-        protected Object targetA2(Object a0, int    a1) throws Throwable { return target(a0, a1); }
-        protected Object targetA2(int    a0, int    a1) throws Throwable { return target(a0, a1); }
-        protected Object targetA2(Object a0, long   a1) throws Throwable { return target(a0, a1); }
-        protected Object targetA2(long   a0, long   a1) throws Throwable { return target(a0, a1); }
-        protected Object invoke_L(Object a0, Object a1) throws Throwable { return return_L(targetA2(a0, a1)); }
-        protected int    invoke_I(Object a0, Object a1) throws Throwable { return return_I(targetA2(a0, a1)); }
-        protected long   invoke_J(Object a0, Object a1) throws Throwable { return return_J(targetA2(a0, a1)); }
-        protected float  invoke_F(Object a0, Object a1) throws Throwable { return return_F(targetA2(a0, a1)); }
-        protected double invoke_D(Object a0, Object a1) throws Throwable { return return_D(targetA2(a0, a1)); }
-        protected Object invoke_L(Object a0, int    a1) throws Throwable { return return_L(targetA2(a0, a1)); }
-        protected int    invoke_I(Object a0, int    a1) throws Throwable { return return_I(targetA2(a0, a1)); }
-        protected long   invoke_J(Object a0, int    a1) throws Throwable { return return_J(targetA2(a0, a1)); }
-        protected float  invoke_F(Object a0, int    a1) throws Throwable { return return_F(targetA2(a0, a1)); }
-        protected double invoke_D(Object a0, int    a1) throws Throwable { return return_D(targetA2(a0, a1)); }
-        protected Object invoke_L(int    a0, int    a1) throws Throwable { return return_L(targetA2(a0, a1)); }
-        protected int    invoke_I(int    a0, int    a1) throws Throwable { return return_I(targetA2(a0, a1)); }
-        protected long   invoke_J(int    a0, int    a1) throws Throwable { return return_J(targetA2(a0, a1)); }
-        protected float  invoke_F(int    a0, int    a1) throws Throwable { return return_F(targetA2(a0, a1)); }
-        protected double invoke_D(int    a0, int    a1) throws Throwable { return return_D(targetA2(a0, a1)); }
-        protected Object invoke_L(Object a0, long   a1) throws Throwable { return return_L(targetA2(a0, a1)); }
-        protected int    invoke_I(Object a0, long   a1) throws Throwable { return return_I(targetA2(a0, a1)); }
-        protected long   invoke_J(Object a0, long   a1) throws Throwable { return return_J(targetA2(a0, a1)); }
-        protected float  invoke_F(Object a0, long   a1) throws Throwable { return return_F(targetA2(a0, a1)); }
-        protected double invoke_D(Object a0, long   a1) throws Throwable { return return_D(targetA2(a0, a1)); }
-        protected Object invoke_L(long   a0, long   a1) throws Throwable { return return_L(targetA2(a0, a1)); }
-        protected int    invoke_I(long   a0, long   a1) throws Throwable { return return_I(targetA2(a0, a1)); }
-        protected long   invoke_J(long   a0, long   a1) throws Throwable { return return_J(targetA2(a0, a1)); }
-        protected float  invoke_F(long   a0, long   a1) throws Throwable { return return_F(targetA2(a0, a1)); }
-        protected double invoke_D(long   a0, long   a1) throws Throwable { return return_D(targetA2(a0, a1)); }
-    }
-    static class A3 extends Adapter {
-        protected A3(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A3(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A3 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A3(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2); }
-        protected Object targetA3(Object a0, Object a1, Object a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object targetA3(Object a0, Object a1, int    a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object targetA3(Object a0, int    a1, int    a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object targetA3(int    a0, int    a1, int    a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object targetA3(Object a0, Object a1, long   a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object targetA3(Object a0, long   a1, long   a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object targetA3(long   a0, long   a1, long   a2) throws Throwable { return target(a0, a1, a2); }
-        protected Object invoke_L(Object a0, Object a1, Object a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(Object a0, Object a1, Object a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(Object a0, Object a1, Object a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-        protected Object invoke_L(Object a0, Object a1, int    a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(Object a0, Object a1, int    a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(Object a0, Object a1, int    a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(Object a0, Object a1, int    a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(Object a0, Object a1, int    a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-        protected Object invoke_L(Object a0, int    a1, int    a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(Object a0, int    a1, int    a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(Object a0, int    a1, int    a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(Object a0, int    a1, int    a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(Object a0, int    a1, int    a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-        protected Object invoke_L(int    a0, int    a1, int    a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(int    a0, int    a1, int    a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(int    a0, int    a1, int    a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(int    a0, int    a1, int    a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(int    a0, int    a1, int    a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(Object a0, Object a1, long   a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(Object a0, Object a1, long   a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(Object a0, long   a1, long   a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(Object a0, long   a1, long   a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); }
-        protected float  invoke_F(long   a0, long   a1, long   a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); }
-        protected double invoke_D(long   a0, long   a1, long   a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); }
-    }
-//params=[4, 5, 2, 99, 99, 99]
-    static class A4 extends Adapter {
-        protected A4(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A4(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A4 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A4(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, Object a1, Object a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, Object a1, int    a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, int    a1, int    a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(int    a0, int    a1, int    a2, int    a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, Object a1, Object a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, Object a1, long   a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(Object a0, long   a1, long   a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object targetA4(long   a0, long   a1, long   a2, long   a3) throws Throwable { return target(a0, a1, a2, a3); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, Object a1, int    a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, int    a1, int    a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(int    a0, int    a1, int    a2, int    a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); }
-    }
-    static class A5 extends Adapter {
-        protected A5(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A5(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A5 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A5(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object targetA5(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return target(a0, a1, a2, a3, a4); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, int    a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(int    a0, int    a1, int    a2, int    a3, int    a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); }
-    }
-//params=[6, 10, 2, 99, 0, 99]
-    static class A6 extends Adapter {
-        protected A6(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A6(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A6 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A6(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object targetA6(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); }
-    }
-    static class A7 extends Adapter {
-        protected A7(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A7(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A7 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A7(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object targetA7(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); }
-    }
-    static class A8 extends Adapter {
-        protected A8(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A8(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A8 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A8(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object targetA8(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); }
-    }
-    static class A9 extends Adapter {
-        protected A9(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A9(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A9 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A9(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object targetA9(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); }
-    }
-    static class A10 extends Adapter {
-        protected A10(MethodHandle entryPoint) { super(entryPoint); }  // to build prototype
-        protected A10(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }
-        protected A10 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A10(e, i, c, t); }
-        protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9)   throws Throwable { return invoker.invokeExact(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object targetA10(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, Object a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, Object a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, Object a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(Object a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected Object invoke_L(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected int    invoke_I(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-        protected long   invoke_J(long   a0, long   a1, long   a2, long   a3, long   a4, long   a5, long   a6, long   a7, long   a8, long   a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); }
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/WrapperInstance.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2011, 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 sun.dyn;
-
-import java.dyn.MethodHandle;
-
-/**
- * Private API used inside of java.dyn.MethodHandles.
- * Interface implemented by every object which is produced by
- * {@link java.dyn.MethodHandles#asInstance MethodHandles.asInstance}.
- * The methods of this interface allow a caller to recover the parameters
- * to {@code asInstance}.
- * This allows applications to repeatedly convert between method handles
- * and SAM objects, without the risk of creating unbounded delegation chains.
- */
-public interface WrapperInstance {
-    /** Produce or recover a target method handle which is behaviorally
-     *  equivalent to the SAM method of this object.
-     */
-    public MethodHandle getWrapperInstanceTarget();
-    /** Recover the SAM type for which this object was created.
-     */
-    public Class<?> getWrapperInstanceType();
-}
-
--- a/jdk/src/share/classes/sun/dyn/anon/AnonymousClassLoader.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn.anon;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import sun.misc.IOUtils;
-
-/**
- * Anonymous class loader.  Will load any valid classfile, producing
- * a {@link Class} metaobject, without installing that class in the
- * system dictionary.  Therefore, {@link Class#forName(String)} will never
- * produce a reference to an anonymous class.
- * <p>
- * The access permissions of the anonymous class are borrowed from
- * a <em>host class</em>.  The new class behaves as if it were an
- * inner class of the host class.  It can access the host's private
- * members, if the creator of the class loader has permission to
- * do so (or to create accessible reflective objects).
- * <p>
- * When the anonymous class is loaded, elements of its constant pool
- * can be patched to new values.  This provides a hook to pre-resolve
- * named classes in the constant pool to other classes, including
- * anonymous ones.  Also, string constants can be pre-resolved to
- * any reference.  (The verifier treats non-string, non-class reference
- * constants as plain objects.)
- *  <p>
- * Why include the patching function?  It makes some use cases much easier.
- * Second, the constant pool needed some internal patching anyway,
- * to anonymize the loaded class itself.  Finally, if you are going
- * to use this seriously, you'll want to build anonymous classes
- * on top of pre-existing anonymous classes, and that requires patching.
- *
- * <p>%%% TO-DO:
- * <ul>
- * <li>needs better documentation</li>
- * <li>needs more security work (for safe delegation)</li>
- * <li>needs a clearer story about error processing</li>
- * <li>patch member references also (use ';' as delimiter char)</li>
- * <li>patch method references to (conforming) method handles</li>
- * </ul>
- *
- * @author jrose
- * @author Remi Forax
- * @see <a href="http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm">
- *      http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm</a>
- */
-
-public class AnonymousClassLoader {
-    final Class<?> hostClass;
-
-    // Note: Do not refactor the calls to checkHostClass unless you
-    //       also adjust this constant:
-    private static int CHC_CALLERS = 3;
-
-    public AnonymousClassLoader() {
-        this.hostClass = checkHostClass(null);
-    }
-    public AnonymousClassLoader(Class<?> hostClass) {
-        this.hostClass = checkHostClass(hostClass);
-    }
-
-    private static Class<?> getTopLevelClass(Class<?> clazz) {
-      for(Class<?> outer = clazz.getDeclaringClass(); outer != null;
-          outer = outer.getDeclaringClass()) {
-        clazz = outer;
-      }
-      return clazz;
-    }
-
-    private static Class<?> checkHostClass(Class<?> hostClass) {
-        // called only from the constructor
-        // does a context-sensitive check on caller class
-        // CC[0..3] = {Reflection, this.checkHostClass, this.<init>, caller}
-        Class<?> caller = sun.reflect.Reflection.getCallerClass(CHC_CALLERS);
-
-        if (caller == null) {
-            // called from the JVM directly
-            if (hostClass == null)
-                return AnonymousClassLoader.class; // anything central will do
-            return hostClass;
-        }
-
-        if (hostClass == null)
-            hostClass = caller; // default value is caller itself
-
-        // anonymous class will access hostClass on behalf of caller
-        Class<?> callee = hostClass;
-
-        if (caller == callee)
-            // caller can always nominate itself to grant caller's own access rights
-            return hostClass;
-
-        // normalize caller and callee to their top-level classes:
-        caller = getTopLevelClass(caller);
-        callee = getTopLevelClass(callee);
-        if (caller == callee)
-            return caller;
-
-        ClassLoader callerCL = caller.getClassLoader();
-        if (callerCL == null) {
-            // caller is trusted code, so accept the proposed hostClass
-            return hostClass;
-        }
-
-        // %%% should do something with doPrivileged, because trusted
-        // code should have a way to execute on behalf of
-        // partially-trusted clients
-
-        // Does the caller have the right to access the private
-        // members of the callee?  If not, raise an error.
-        final int ACC_PRIVATE = 2;
-        try {
-            sun.reflect.Reflection.ensureMemberAccess(caller, callee, null, ACC_PRIVATE);
-        } catch (IllegalAccessException ee) {
-            throw new IllegalArgumentException(ee);
-        }
-
-        return hostClass;
-    }
-
-    public Class<?> loadClass(byte[] classFile) {
-        if (defineAnonymousClass == null) {
-            // no JVM support; try to fake an approximation
-            try {
-                return fakeLoadClass(new ConstantPoolParser(classFile).createPatch());
-            } catch (InvalidConstantPoolFormatException ee) {
-                throw new IllegalArgumentException(ee);
-            }
-        }
-        return loadClass(classFile, null);
-    }
-
-    public Class<?> loadClass(ConstantPoolPatch classPatch) {
-        if (defineAnonymousClass == null) {
-            // no JVM support; try to fake an approximation
-            return fakeLoadClass(classPatch);
-        }
-        Object[] patches = classPatch.patchArray;
-        // Convert class names (this late in the game)
-        // to use slash '/' instead of dot '.'.
-        // Java likes dots, but the JVM likes slashes.
-        for (int i = 0; i < patches.length; i++) {
-            Object value = patches[i];
-            if (value != null) {
-                byte tag = classPatch.getTag(i);
-                switch (tag) {
-                case ConstantPoolVisitor.CONSTANT_Class:
-                    if (value instanceof String) {
-                        if (patches == classPatch.patchArray)
-                            patches = patches.clone();
-                        patches[i] = ((String)value).replace('.', '/');
-                    }
-                    break;
-                case ConstantPoolVisitor.CONSTANT_Fieldref:
-                case ConstantPoolVisitor.CONSTANT_Methodref:
-                case ConstantPoolVisitor.CONSTANT_InterfaceMethodref:
-                case ConstantPoolVisitor.CONSTANT_NameAndType:
-                    // When/if the JVM supports these patches,
-                    // we'll probably need to reformat them also.
-                    // Meanwhile, let the class loader create the error.
-                    break;
-                }
-            }
-        }
-        return loadClass(classPatch.outer.classFile, classPatch.patchArray);
-    }
-
-    private Class<?> loadClass(byte[] classFile, Object[] patchArray) {
-        try {
-            return (Class<?>)
-                defineAnonymousClass.invoke(unsafe,
-                                            hostClass, classFile, patchArray);
-        } catch (Exception ex) {
-            throwReflectedException(ex);
-            throw new RuntimeException("error loading into "+hostClass, ex);
-        }
-    }
-
-    private static void throwReflectedException(Exception ex) {
-        if (ex instanceof InvocationTargetException) {
-            Throwable tex = ((InvocationTargetException)ex).getTargetException();
-            if (tex instanceof Error)
-                throw (Error) tex;
-            ex = (Exception) tex;
-        }
-        if (ex instanceof RuntimeException) {
-            throw (RuntimeException) ex;
-        }
-    }
-
-    private Class<?> fakeLoadClass(ConstantPoolPatch classPatch) {
-        // Implementation:
-        // 1. Make up a new name nobody has used yet.
-        // 2. Inspect the tail-header of the class to find the this_class index.
-        // 3. Patch the CONSTANT_Class for this_class to the new name.
-        // 4. Add other CP entries required by (e.g.) string patches.
-        // 5. Flatten Class constants down to their names, making sure that
-        //    the host class loader can pick them up again accurately.
-        // 6. Generate the edited class file bytes.
-        //
-        // Potential limitations:
-        // * The class won't be truly anonymous, and may interfere with others.
-        // * Flattened class constants might not work, because of loader issues.
-        // * Pseudo-string constants will not flatten down to real strings.
-        // * Method handles will (of course) fail to flatten to linkage strings.
-        if (true)  throw new UnsupportedOperationException("NYI");
-        Object[] cpArray;
-        try {
-            cpArray = classPatch.getOriginalCP();
-        } catch (InvalidConstantPoolFormatException ex) {
-            throw new RuntimeException(ex);
-        }
-        int thisClassIndex = classPatch.getParser().getThisClassIndex();
-        String thisClassName = (String) cpArray[thisClassIndex];
-        synchronized (AnonymousClassLoader.class) {
-            thisClassName = thisClassName+"\\|"+(++fakeNameCounter);
-        }
-        classPatch.putUTF8(thisClassIndex, thisClassName);
-        byte[] classFile = null;
-        return unsafe.defineClass(null, classFile, 0, classFile.length,
-                                  hostClass.getClassLoader(),
-                                  hostClass.getProtectionDomain());
-    }
-    private static int fakeNameCounter = 99999;
-
-    // ignore two warnings on this line:
-    static sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
-    // preceding line requires that this class be on the boot class path
-
-    static private final Method defineAnonymousClass;
-    static {
-        Method dac = null;
-        Class<? extends sun.misc.Unsafe> unsafeClass = unsafe.getClass();
-        try {
-            dac = unsafeClass.getMethod("defineAnonymousClass",
-                                        Class.class,
-                                        byte[].class,
-                                        Object[].class);
-        } catch (Exception ee) {
-            dac = null;
-        }
-        defineAnonymousClass = dac;
-    }
-
-    private static void noJVMSupport() {
-        throw new UnsupportedOperationException("no JVM support for anonymous classes");
-    }
-
-
-    private static native Class<?> loadClassInternal(Class<?> hostClass,
-                                                     byte[] classFile,
-                                                     Object[] patchArray);
-
-    public static byte[] readClassFile(Class<?> templateClass) throws IOException {
-        String templateName = templateClass.getName();
-        int lastDot = templateName.lastIndexOf('.');
-        java.net.URL url = templateClass.getResource(templateName.substring(lastDot+1)+".class");
-        java.net.URLConnection connection = url.openConnection();
-        int contentLength = connection.getContentLength();
-        if (contentLength < 0)
-            throw new IOException("invalid content length "+contentLength);
-
-        return IOUtils.readFully(connection.getInputStream(), contentLength, true);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/anon/ConstantPoolParser.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-
-import static sun.dyn.anon.ConstantPoolVisitor.*;
-
-/** A constant pool parser.
- */
-public class ConstantPoolParser {
-    final byte[] classFile;
-    final byte[] tags;
-    final char[] firstHeader;  // maghi, maglo, minor, major, cplen
-
-    // these are filled in on first parse:
-    int endOffset;
-    char[] secondHeader;       // flags, this_class, super_class, intlen
-
-    // used to decode UTF8 array
-    private char[] charArray = new char[80];
-
-    /** Creates a constant pool parser.
-     * @param classFile an array of bytes containing a class.
-     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
-     */
-    public ConstantPoolParser(byte[] classFile) throws InvalidConstantPoolFormatException {
-        this.classFile = classFile;
-        this.firstHeader = parseHeader(classFile);
-        this.tags = new byte[firstHeader[4]];
-    }
-
-    /** Create a constant pool parser by loading the bytecodes of the
-     *  class taken as argument.
-     *
-     * @param templateClass the class to parse.
-     *
-     * @throws IOException raised if an I/O occurs when loading
-     *  the bytecode of the template class.
-     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
-     *
-     * @see #ConstantPoolParser(byte[])
-     * @see AnonymousClassLoader#readClassFile(Class)
-     */
-    public ConstantPoolParser(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
-        this(AnonymousClassLoader.readClassFile(templateClass));
-    }
-
-    /** Creates an empty patch to patch the class file
-     *  used by the current parser.
-     * @return a new class patch.
-     */
-    public ConstantPoolPatch createPatch() {
-        return new ConstantPoolPatch(this);
-    }
-
-    /** Report the tag of the indicated CP entry.
-     * @param index
-     * @return one of {@link ConstantPoolVisitor#CONSTANT_Utf8}, etc.
-     */
-    public byte getTag(int index) {
-        getEndOffset();  // trigger an exception if we haven't parsed yet
-        return tags[index];
-    }
-
-    /** Report the length of the constant pool. */
-    public int getLength() {
-        return firstHeader[4];
-    }
-
-    /** Report the offset, within the class file, of the start of the constant pool. */
-    public int getStartOffset() {
-        return firstHeader.length * 2;
-    }
-
-    /** Report the offset, within the class file, of the end of the constant pool. */
-    public int getEndOffset() {
-        if (endOffset == 0)
-            throw new IllegalStateException("class file has not yet been parsed");
-        return endOffset;
-    }
-
-    /** Report the CP index of this class's own name. */
-    public int getThisClassIndex() {
-        getEndOffset();   // provoke exception if not yet parsed
-        return secondHeader[1];
-    }
-
-    /** Report the total size of the class file. */
-    public int getTailLength() {
-        return classFile.length - getEndOffset();
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the class file to the indicated stream.
-     */
-    public void writeHead(OutputStream out) throws IOException {
-        out.write(classFile, 0, getEndOffset());
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the class file to the indicated stream,
-     *  incorporating the non-null entries of the given array
-     *  as patches.
-     */
-    void writePatchedHead(OutputStream out, Object[] patchArray) {
-        // this will be useful to partially emulate the class loader on old JVMs
-        throw new UnsupportedOperationException("Not yet implemented");
-    }
-
-    /** Write the tail (everything after the constant pool)
-     *  of the class file to the indicated stream.
-     */
-    public void writeTail(OutputStream out) throws IOException {
-        out.write(classFile, getEndOffset(), getTailLength());
-    }
-
-    private static char[] parseHeader(byte[] classFile) throws InvalidConstantPoolFormatException {
-        char[] result = new char[5];
-        ByteBuffer buffer = ByteBuffer.wrap(classFile);
-        for (int i = 0; i < result.length; i++)
-            result[i] = (char) getUnsignedShort(buffer);
-        int magic = result[0] << 16 | result[1] << 0;
-        if (magic != 0xCAFEBABE)
-            throw new InvalidConstantPoolFormatException("invalid magic number "+magic);
-        // skip major, minor version
-        int len = result[4];
-        if (len < 1)
-            throw new InvalidConstantPoolFormatException("constant pool length < 1");
-        return result;
-    }
-
-    /** Parse the constant pool of the class
-     *  calling a method visit* each time a constant pool entry is parsed.
-     *
-     *  The order of the calls to visit* is not guaranteed to be the same
-     *  than the order of the constant pool entry in the bytecode array.
-     *
-     * @param visitor
-     * @throws InvalidConstantPoolFormatException
-     */
-    public void parse(ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
-        ByteBuffer buffer = ByteBuffer.wrap(classFile);
-        buffer.position(getStartOffset()); //skip header
-
-        Object[] values = new Object[getLength()];
-        try {
-            parseConstantPool(buffer, values, visitor);
-        } catch(BufferUnderflowException e) {
-            throw new InvalidConstantPoolFormatException(e);
-        }
-        if (endOffset == 0) {
-            endOffset = buffer.position();
-            secondHeader = new char[4];
-            for (int i = 0; i < secondHeader.length; i++) {
-                secondHeader[i] = (char) getUnsignedShort(buffer);
-            }
-        }
-        resolveConstantPool(values, visitor);
-    }
-
-    private char[] getCharArray(int utfLength) {
-        if (utfLength <= charArray.length)
-            return charArray;
-        return charArray = new char[utfLength];
-    }
-
-    private void parseConstantPool(ByteBuffer buffer, Object[] values, ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
-        for (int i = 1; i < tags.length; ) {
-            byte tag = (byte) getUnsignedByte(buffer);
-            assert(tags[i] == 0 || tags[i] == tag);
-            tags[i] = tag;
-            switch (tag) {
-                case CONSTANT_Utf8:
-                    int utfLen = getUnsignedShort(buffer);
-                    String value = getUTF8(buffer, utfLen, getCharArray(utfLen));
-                    visitor.visitUTF8(i, CONSTANT_Utf8, value);
-                    tags[i] = tag;
-                    values[i++] = value;
-                    break;
-                case CONSTANT_Integer:
-                    visitor.visitConstantValue(i, tag, buffer.getInt());
-                    i++;
-                    break;
-                case CONSTANT_Float:
-                    visitor.visitConstantValue(i, tag, buffer.getFloat());
-                    i++;
-                    break;
-                case CONSTANT_Long:
-                    visitor.visitConstantValue(i, tag, buffer.getLong());
-                    i+=2;
-                    break;
-                case CONSTANT_Double:
-                    visitor.visitConstantValue(i, tag, buffer.getDouble());
-                    i+=2;
-                    break;
-
-                case CONSTANT_Class:    // fall through:
-                case CONSTANT_String:
-                    tags[i] = tag;
-                    values[i++] = new int[] { getUnsignedShort(buffer) };
-                    break;
-
-                case CONSTANT_Fieldref:           // fall through:
-                case CONSTANT_Methodref:          // fall through:
-                case CONSTANT_InterfaceMethodref: // fall through:
-                case CONSTANT_NameAndType:
-                    tags[i] = tag;
-                    values[i++] = new int[] { getUnsignedShort(buffer), getUnsignedShort(buffer) };
-                    break;
-                default:
-                    throw new AssertionError("invalid constant "+tag);
-            }
-        }
-    }
-
-    private void resolveConstantPool(Object[] values, ConstantPoolVisitor visitor) {
-        // clean out the int[] values, which are temporary
-        for (int beg = 1, end = values.length-1, beg2, end2;
-             beg <= end;
-             beg = beg2, end = end2) {
-             beg2 = end; end2 = beg-1;
-             //System.out.println("CP resolve pass: "+beg+".."+end);
-             for (int i = beg; i <= end; i++) {
-                  Object value = values[i];
-                  if (!(value instanceof int[]))
-                      continue;
-                  int[] array = (int[]) value;
-                  byte tag = tags[i];
-                  switch (tag) {
-                      case CONSTANT_String:
-                          String stringBody = (String) values[array[0]];
-                          visitor.visitConstantString(i, tag, stringBody, array[0]);
-                          values[i] = null;
-                          break;
-                      case CONSTANT_Class: {
-                          String className = (String) values[array[0]];
-                          // use the external form favored by Class.forName:
-                          className = className.replace('/', '.');
-                          visitor.visitConstantString(i, tag, className, array[0]);
-                          values[i] = className;
-                          break;
-                      }
-                      case CONSTANT_NameAndType: {
-                          String memberName = (String) values[array[0]];
-                          String signature  = (String) values[array[1]];
-                          visitor.visitDescriptor(i, tag, memberName, signature,
-                                                  array[0], array[1]);
-                          values[i] = new String[] {memberName, signature};
-                          break;
-                      }
-                      case CONSTANT_Fieldref:           // fall through:
-                      case CONSTANT_Methodref:          // fall through:
-                      case CONSTANT_InterfaceMethodref: {
-                              Object className   = values[array[0]];
-                              Object nameAndType = values[array[1]];
-                              if (!(className instanceof String) ||
-                                  !(nameAndType instanceof String[])) {
-                                   // one more pass is needed
-                                   if (beg2 > i)  beg2 = i;
-                                   if (end2 < i)  end2 = i;
-                                   continue;
-                              }
-                              String[] nameAndTypeArray = (String[]) nameAndType;
-                              visitor.visitMemberRef(i, tag,
-                                  (String)className,
-                                  nameAndTypeArray[0],
-                                  nameAndTypeArray[1],
-                                  array[0], array[1]);
-                              values[i] = null;
-                          }
-                          break;
-                      default:
-                          continue;
-                }
-            }
-        }
-    }
-
-    private static int getUnsignedByte(ByteBuffer buffer) {
-        return buffer.get() & 0xFF;
-    }
-
-    private static int getUnsignedShort(ByteBuffer buffer) {
-        int b1 = getUnsignedByte(buffer);
-        int b2 = getUnsignedByte(buffer);
-        return (b1 << 8) + (b2 << 0);
-    }
-
-    private static String getUTF8(ByteBuffer buffer, int utfLen, char[] charArray) throws InvalidConstantPoolFormatException {
-      int utfLimit = buffer.position() + utfLen;
-      int index = 0;
-      while (buffer.position() < utfLimit) {
-          int c = buffer.get() & 0xff;
-          if (c > 127) {
-              buffer.position(buffer.position() - 1);
-              return getUTF8Extended(buffer, utfLimit, charArray, index);
-          }
-          charArray[index++] = (char)c;
-      }
-      return new String(charArray, 0, index);
-    }
-
-    private static String getUTF8Extended(ByteBuffer buffer, int utfLimit, char[] charArray, int index) throws InvalidConstantPoolFormatException {
-        int c, c2, c3;
-        while (buffer.position() < utfLimit) {
-            c = buffer.get() & 0xff;
-            switch (c >> 4) {
-                case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
-                    /* 0xxxxxxx*/
-                    charArray[index++] = (char)c;
-                    break;
-                case 12: case 13:
-                    /* 110x xxxx   10xx xxxx*/
-                    c2 = buffer.get();
-                    if ((c2 & 0xC0) != 0x80)
-                        throw new InvalidConstantPoolFormatException(
-                            "malformed input around byte " + buffer.position());
-                     charArray[index++] = (char)(((c  & 0x1F) << 6) |
-                                                  (c2 & 0x3F));
-                    break;
-                case 14:
-                    /* 1110 xxxx  10xx xxxx  10xx xxxx */
-                    c2 = buffer.get();
-                    c3 = buffer.get();
-                    if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
-                       throw new InvalidConstantPoolFormatException(
-                          "malformed input around byte " + (buffer.position()));
-                    charArray[index++] = (char)(((c  & 0x0F) << 12) |
-                                                ((c2 & 0x3F) << 6)  |
-                                                ((c3 & 0x3F) << 0));
-                    break;
-                default:
-                    /* 10xx xxxx,  1111 xxxx */
-                    throw new InvalidConstantPoolFormatException(
-                        "malformed input around byte " + buffer.position());
-            }
-        }
-        // The number of chars produced may be less than utflen
-        return new String(charArray, 0, index);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/anon/ConstantPoolPatch.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import static sun.dyn.anon.ConstantPoolVisitor.*;
-
-/** A class and its patched constant pool.
- *
- *  This class allow to modify (patch) a constant pool
- *  by changing the value of its entry.
- *  Entry are referenced using index that can be get
- *  by parsing the constant pool using
- *  {@link ConstantPoolParser#parse(ConstantPoolVisitor)}.
- *
- * @see ConstantPoolVisitor
- * @see ConstantPoolParser#createPatch()
- */
-public class ConstantPoolPatch {
-    final ConstantPoolParser outer;
-    final Object[] patchArray;
-
-    ConstantPoolPatch(ConstantPoolParser outer) {
-        this.outer      = outer;
-        this.patchArray = new Object[outer.getLength()];
-    }
-
-    /** Create a {@link ConstantPoolParser} and
-     *  a {@link ConstantPoolPatch} in one step.
-     *  Equivalent to {@code new ConstantPoolParser(classFile).createPatch()}.
-     *
-     * @param classFile an array of bytes containing a class.
-     * @see #ConstantPoolParser(Class)
-     */
-    public ConstantPoolPatch(byte[] classFile) throws InvalidConstantPoolFormatException {
-        this(new ConstantPoolParser(classFile));
-    }
-
-    /** Create a {@link ConstantPoolParser} and
-     *  a {@link ConstantPoolPatch} in one step.
-     *  Equivalent to {@code new ConstantPoolParser(templateClass).createPatch()}.
-     *
-     * @param templateClass the class to parse.
-     * @see #ConstantPoolParser(Class)
-     */
-    public ConstantPoolPatch(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
-        this(new ConstantPoolParser(templateClass));
-    }
-
-
-    /** Creates a patch from an existing patch.
-     *  All changes are copied from that patch.
-     * @param patch a patch
-     *
-     * @see ConstantPoolParser#createPatch()
-     */
-    public ConstantPoolPatch(ConstantPoolPatch patch) {
-        outer      = patch.outer;
-        patchArray = patch.patchArray.clone();
-    }
-
-    /** Which parser built this patch? */
-    public ConstantPoolParser getParser() {
-        return outer;
-    }
-
-    /** Report the tag at the given index in the constant pool. */
-    public byte getTag(int index) {
-        return outer.getTag(index);
-    }
-
-    /** Report the current patch at the given index of the constant pool.
-     *  Null means no patch will be made.
-     *  To observe the unpatched entry at the given index, use
-     *  {@link #getParser()}{@code .}@link ConstantPoolParser#parse(ConstantPoolVisitor)}
-     */
-    public Object getPatch(int index) {
-        Object value = patchArray[index];
-        if (value == null)  return null;
-        switch (getTag(index)) {
-        case CONSTANT_Fieldref:
-        case CONSTANT_Methodref:
-        case CONSTANT_InterfaceMethodref:
-            if (value instanceof String)
-                value = stripSemis(2, (String) value);
-            break;
-        case CONSTANT_NameAndType:
-            if (value instanceof String)
-                value = stripSemis(1, (String) value);
-            break;
-        }
-        return value;
-    }
-
-    /** Clear all patches. */
-    public void clear() {
-        Arrays.fill(patchArray, null);
-    }
-
-    /** Clear one patch. */
-    public void clear(int index) {
-        patchArray[index] = null;
-    }
-
-    /** Produce the patches as an array. */
-    public Object[] getPatches() {
-        return patchArray.clone();
-    }
-
-    /** Produce the original constant pool as an array. */
-    public Object[] getOriginalCP() throws InvalidConstantPoolFormatException {
-        return getOriginalCP(0, patchArray.length, -1);
-    }
-
-    /** Walk the constant pool, applying patches using the given map.
-     *
-     * @param utf8Map Utf8 strings to modify, if encountered
-     * @param classMap Classes (or their names) to modify, if encountered
-     * @param valueMap Constant values to modify, if encountered
-     * @param deleteUsedEntries if true, delete map entries that are used
-     */
-    public void putPatches(final Map<String,String> utf8Map,
-                           final Map<String,Object> classMap,
-                           final Map<Object,Object> valueMap,
-                           boolean deleteUsedEntries) throws InvalidConstantPoolFormatException {
-        final HashSet<String> usedUtf8Keys;
-        final HashSet<String> usedClassKeys;
-        final HashSet<Object> usedValueKeys;
-        if (deleteUsedEntries) {
-            usedUtf8Keys  = (utf8Map  == null) ? null : new HashSet<String>();
-            usedClassKeys = (classMap == null) ? null : new HashSet<String>();
-            usedValueKeys = (valueMap == null) ? null : new HashSet<Object>();
-        } else {
-            usedUtf8Keys = null;
-            usedClassKeys = null;
-            usedValueKeys = null;
-        }
-
-        outer.parse(new ConstantPoolVisitor() {
-
-            @Override
-            public void visitUTF8(int index, byte tag, String utf8) {
-                putUTF8(index, utf8Map.get(utf8));
-                if (usedUtf8Keys != null)  usedUtf8Keys.add(utf8);
-            }
-
-            @Override
-            public void visitConstantValue(int index, byte tag, Object value) {
-                putConstantValue(index, tag, valueMap.get(value));
-                if (usedValueKeys != null)  usedValueKeys.add(value);
-            }
-
-            @Override
-            public void visitConstantString(int index, byte tag, String name, int nameIndex) {
-                if (tag == CONSTANT_Class) {
-                    putConstantValue(index, tag, classMap.get(name));
-                    if (usedClassKeys != null)  usedClassKeys.add(name);
-                } else {
-                    assert(tag == CONSTANT_String);
-                    visitConstantValue(index, tag, name);
-                }
-            }
-        });
-        if (usedUtf8Keys != null)   utf8Map.keySet().removeAll(usedUtf8Keys);
-        if (usedClassKeys != null)  classMap.keySet().removeAll(usedClassKeys);
-        if (usedValueKeys != null)  valueMap.keySet().removeAll(usedValueKeys);
-    }
-
-    Object[] getOriginalCP(final int startIndex,
-                           final int endIndex,
-                           final int tagMask) throws InvalidConstantPoolFormatException {
-        final Object[] cpArray = new Object[endIndex - startIndex];
-        outer.parse(new ConstantPoolVisitor() {
-
-            void show(int index, byte tag, Object value) {
-                if (index < startIndex || index >= endIndex)  return;
-                if (((1 << tag) & tagMask) == 0)  return;
-                cpArray[index - startIndex] = value;
-            }
-
-            @Override
-            public void visitUTF8(int index, byte tag, String utf8) {
-                show(index, tag, utf8);
-            }
-
-            @Override
-            public void visitConstantValue(int index, byte tag, Object value) {
-                assert(tag != CONSTANT_String);
-                show(index, tag, value);
-            }
-
-            @Override
-            public void visitConstantString(int index, byte tag,
-                                            String value, int j) {
-                show(index, tag, value);
-            }
-
-            @Override
-            public void visitMemberRef(int index, byte tag,
-                    String className, String memberName,
-                    String signature,
-                    int j, int k) {
-                show(index, tag, new String[]{ className, memberName, signature });
-            }
-
-            @Override
-            public void visitDescriptor(int index, byte tag,
-                    String memberName, String signature,
-                    int j, int k) {
-                show(index, tag, new String[]{ memberName, signature });
-            }
-        });
-        return cpArray;
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the patched class file to the indicated stream.
-     */
-    void writeHead(OutputStream out) throws IOException {
-        outer.writePatchedHead(out, patchArray);
-    }
-
-    /** Write the tail (everything after the constant pool)
-     *  of the patched class file to the indicated stream.
-     */
-    void writeTail(OutputStream out) throws IOException {
-        outer.writeTail(out);
-    }
-
-    private void checkConstantTag(byte tag, Object value) {
-        if (value == null)
-            throw new IllegalArgumentException(
-                    "invalid null constant value");
-        if (classForTag(tag) != value.getClass())
-            throw new IllegalArgumentException(
-                    "invalid constant value"
-                    + (tag == CONSTANT_None ? ""
-                        : " for tag "+tagName(tag))
-                    + " of class "+value.getClass());
-    }
-
-    private void checkTag(int index, byte putTag) {
-        byte tag = outer.tags[index];
-        if (tag != putTag)
-            throw new IllegalArgumentException(
-                "invalid put operation"
-                + " for " + tagName(putTag)
-                + " at index " + index + " found " + tagName(tag));
-    }
-
-    private void checkTagMask(int index, int tagBitMask) {
-        byte tag = outer.tags[index];
-        int tagBit = ((tag & 0x1F) == tag) ? (1 << tag) : 0;
-        if ((tagBit & tagBitMask) == 0)
-            throw new IllegalArgumentException(
-                "invalid put operation"
-                + " at index " + index + " found " + tagName(tag));
-    }
-
-    private static void checkMemberName(String memberName) {
-        if (memberName.indexOf(';') >= 0)
-            throw new IllegalArgumentException("memberName " + memberName + " contains a ';'");
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new string.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        {@link ConstantPoolVisitor#CONSTANT_Utf8} value.
-     * @param utf8 a string
-     *
-     * @see ConstantPoolVisitor#visitUTF8(int, byte, String)
-     */
-    public void putUTF8(int index, String utf8) {
-        if (utf8 == null) { clear(index); return; }
-        checkTag(index, CONSTANT_Utf8);
-        patchArray[index] = utf8;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new value, depending on its dynamic type.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        one of the following structures:
-     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
-     *        {@link ConstantPoolVisitor#CONSTANT_Float},
-     *        {@link ConstantPoolVisitor#CONSTANT_Long},
-     *        {@link ConstantPoolVisitor#CONSTANT_Double},
-     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
-     *        {@link ConstantPoolVisitor#CONSTANT_Class}
-     * @param value a boxed int, float, long or double; or a string or class object
-     * @throws IllegalArgumentException if the type of the constant does not
-     *         match the constant pool entry type,
-     *         as reported by {@link #getTag(int)}
-     *
-     * @see #putConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
-     */
-    public void putConstantValue(int index, Object value) {
-        if (value == null) { clear(index); return; }
-        byte tag = tagForConstant(value.getClass());
-        checkConstantTag(tag, value);
-        checkTag(index, tag);
-        patchArray[index] = value;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new value.
-     *
-     * @param index an index to a constant pool entry matching the given tag
-     * @param tag one of the following values:
-     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
-     *        {@link ConstantPoolVisitor#CONSTANT_Float},
-     *        {@link ConstantPoolVisitor#CONSTANT_Long},
-     *        {@link ConstantPoolVisitor#CONSTANT_Double},
-     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
-     *        {@link ConstantPoolVisitor#CONSTANT_Class}
-     * @param value a boxed number, string, or class object
-     * @throws IllegalArgumentException if the type of the constant does not
-     *         match the constant pool entry type, or if a class name contains
-     *         '/' or ';'
-     *
-     * @see #putConstantValue(int, Object)
-     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
-     */
-    public void putConstantValue(int index, byte tag, Object value) {
-        if (value == null) { clear(index); return; }
-        checkTag(index, tag);
-        if (tag == CONSTANT_Class && value instanceof String) {
-            checkClassName((String) value);
-        } else if (tag == CONSTANT_String) {
-            // the JVM accepts any object as a patch for a string
-        } else {
-            // make sure the incoming value is the right type
-            checkConstantTag(tag, value);
-        }
-        checkTag(index, tag);
-        patchArray[index] = value;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
-     * @param memberName a memberName
-     * @param signature a signature
-     * @throws IllegalArgumentException if memberName contains the character ';'
-     *
-     * @see ConstantPoolVisitor#visitDescriptor(int, byte, String, String, int, int)
-     */
-    public void putDescriptor(int index, String memberName, String signature) {
-        checkTag(index, CONSTANT_NameAndType);
-        checkMemberName(memberName);
-        patchArray[index] = addSemis(memberName, signature);
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new {@link ConstantPoolVisitor#CONSTANT_Fieldref},
-     *  {@link ConstantPoolVisitor#CONSTANT_Methodref}, or
-     *  {@link ConstantPoolVisitor#CONSTANT_InterfaceMethodref} value.
-     *
-     * @param index an index to a constant pool entry containing a member reference
-     * @param className a class name
-     * @param memberName a field or method name
-     * @param signature a field or method signature
-     * @throws IllegalArgumentException if memberName contains the character ';'
-     *             or signature is not a correct signature
-     *
-     * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
-     */
-    public void putMemberRef(int index, byte tag,
-                    String className, String memberName, String signature) {
-        checkTagMask(tag, CONSTANT_MemberRef_MASK);
-        checkTag(index, tag);
-        checkClassName(className);
-        checkMemberName(memberName);
-        if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
-            throw new IllegalArgumentException("bad signature: "+signature);
-        patchArray[index] = addSemis(className, memberName, signature);
-    }
-
-    static private final int CONSTANT_MemberRef_MASK =
-              CONSTANT_Fieldref
-            | CONSTANT_Methodref
-            | CONSTANT_InterfaceMethodref;
-
-    private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
-        = new IdentityHashMap<Class<?>, Byte>();
-    private static final Class[] CONSTANT_VALUE_CLASS = new Class[16];
-    static {
-        Object[][] values = {
-            {Integer.class, CONSTANT_Integer},
-            {Long.class, CONSTANT_Long},
-            {Float.class, CONSTANT_Float},
-            {Double.class, CONSTANT_Double},
-            {String.class, CONSTANT_String},
-            {Class.class, CONSTANT_Class}
-        };
-        for (Object[] value : values) {
-            Class<?> cls = (Class<?>)value[0];
-            Byte     tag = (Byte) value[1];
-            CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
-            CONSTANT_VALUE_CLASS[(byte)tag] = cls;
-        }
-    }
-
-    static Class<?> classForTag(byte tag) {
-        if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
-            return null;
-        return CONSTANT_VALUE_CLASS[tag];
-    }
-
-    static byte tagForConstant(Class<?> cls) {
-        Byte tag = CONSTANT_VALUE_CLASS_TAG.get(cls);
-        return (tag == null) ? CONSTANT_None : (byte)tag;
-    }
-
-    private static void checkClassName(String className) {
-        if (className.indexOf('/') >= 0 || className.indexOf(';') >= 0)
-            throw new IllegalArgumentException("invalid class name " + className);
-    }
-
-    static String addSemis(String name, String... names) {
-        StringBuilder buf = new StringBuilder(name.length() * 5);
-        buf.append(name);
-        for (String name2 : names) {
-            buf.append(';').append(name2);
-        }
-        String res = buf.toString();
-        assert(stripSemis(names.length, res)[0].equals(name));
-        assert(stripSemis(names.length, res)[1].equals(names[0]));
-        assert(names.length == 1 ||
-               stripSemis(names.length, res)[2].equals(names[1]));
-        return res;
-    }
-
-    static String[] stripSemis(int count, String string) {
-        String[] res = new String[count+1];
-        int pos = 0;
-        for (int i = 0; i < count; i++) {
-            int pos2 = string.indexOf(';', pos);
-            if (pos2 < 0)  pos2 = string.length();  // yuck
-            res[i] = string.substring(pos, pos2);
-            pos = pos2;
-        }
-        res[count] = string.substring(pos);
-        return res;
-    }
-
-    public String toString() {
-        StringBuilder buf = new StringBuilder(this.getClass().getName());
-        buf.append("{");
-        Object[] origCP = null;
-        for (int i = 0; i < patchArray.length; i++) {
-            if (patchArray[i] == null)  continue;
-            if (origCP != null) {
-                buf.append(", ");
-            } else {
-                try {
-                    origCP = getOriginalCP();
-                } catch (InvalidConstantPoolFormatException ee) {
-                    origCP = new Object[0];
-                }
-            }
-            Object orig = (i < origCP.length) ? origCP[i] : "?";
-            buf.append(orig).append("=").append(patchArray[i]);
-        }
-        buf.append("}");
-        return buf.toString();
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/anon/ConstantPoolVisitor.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn.anon;
-
-/**
- * A visitor called by {@link ConstantPoolParser#parse(ConstantPoolVisitor)}
- * when a constant pool entry is parsed.
- * <p>
- * A visit* method is called when a constant pool entry is parsed.
- * The first argument is always the constant pool index.
- * The second argument is always the constant pool tag,
- * even for methods like {@link #visitUTF8(int, byte, String)} which only apply to one tag.
- * String arguments refer to Utf8 or NameAndType entries declared elsewhere,
- * and are always accompanied by the indexes of those entries.
- * <p>
- * The order of the calls to the visit* methods is not necessarily related
- * to the order of the entries in the constant pool.
- * If one entry has a reference to another entry, the latter (lower-level)
- * entry will be visited first.
- * <p>
- * The following table shows the relation between constant pool entry
- * types and the corresponding visit* methods:
- *
- * <table border=1 cellpadding=5 summary="constant pool visitor methods">
- * <tr><th>Tag(s)</th><th>Method</th></tr>
- * <tr>
- *   <td>{@link #CONSTANT_Utf8}</td>
- *   <td>{@link #visitUTF8(int, byte, String)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_Integer}, {@link #CONSTANT_Float},
- *       {@link #CONSTANT_Long}, {@link #CONSTANT_Double}</td>
- *   <td>{@link #visitConstantValue(int, byte, Object)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_String}, {@link #CONSTANT_Class}</td>
- *   <td>{@link #visitConstantString(int, byte, String, int)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_NameAndType}</td>
- *   <td>{@link #visitDescriptor(int, byte, String, String, int, int)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_Fieldref},
- *       {@link #CONSTANT_Methodref},
- *       {@link #CONSTANT_InterfaceMethodref}</td>
- *   <td>{@link #visitMemberRef(int, byte, String, String, String, int, int)}</td>
- * </tr>
- * </table>
- *
- * @see ConstantPoolPatch
- * @author Remi Forax
- * @author jrose
- */
-public class ConstantPoolVisitor {
-  /** Called each time an UTF8 constant pool entry is found.
-   * @param index the constant pool index
-   * @param tag always {@link #CONSTANT_Utf8}
-   * @param utf8 string encoded in modified UTF-8 format passed as a {@code String}
-   *
-   * @see ConstantPoolPatch#putUTF8(int, String)
-   */
-  public void visitUTF8(int index, byte tag, String utf8) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes an integer,
-   *  a float, a long, or a double.
-   *  Constant strings and classes are not managed by this method but
-   *  by {@link #visitConstantString(int, byte, String, int)}.
-   *
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_Integer},
-   *            {@link #CONSTANT_Float},
-   *            {@link #CONSTANT_Long},
-   *            or {@link #CONSTANT_Double}
-   * @param value encoded value
-   *
-   * @see ConstantPoolPatch#putConstantValue(int, Object)
-   */
-  public void visitConstantValue(int index, byte tag, Object value) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a string or a class.
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_String},
-   *            {@link #CONSTANT_Class},
-   * @param name string body or class name (using dot separator)
-   * @param nameIndex the index of the Utf8 string for the name
-   *
-   * @see ConstantPoolPatch#putConstantValue(int, byte, Object)
-   */
-  public void visitConstantString(int index, byte tag,
-                                  String name, int nameIndex) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a name and type.
-   * @param index the constant pool index
-   * @param tag always {@link #CONSTANT_NameAndType}
-   * @param memberName a field or method name
-   * @param signature the member signature
-   * @param memberNameIndex index of the Utf8 string for the member name
-   * @param signatureIndex index of the Utf8 string for the signature
-   *
-   * @see ConstantPoolPatch#putDescriptor(int, String, String)
-   */
-  public void visitDescriptor(int index, byte tag,
-                              String memberName, String signature,
-                              int memberNameIndex, int signatureIndex) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a field or method.
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_Fieldref},
-   *            or {@link #CONSTANT_Methodref},
-   *            or {@link #CONSTANT_InterfaceMethodref}
-   * @param className the class name (using dot separator)
-   * @param memberName name of the field or method
-   * @param signature the field or method signature
-   * @param classNameIndex index of the Utf8 string for the class name
-   * @param descriptorIndex index of the NameAndType descriptor constant
-   *
-   * @see ConstantPoolPatch#putMemberRef(int, byte, String, String, String)
-   */
-  public void visitMemberRef(int index, byte tag,
-                             String className, String memberName, String signature,
-                             int classNameIndex, int descriptorIndex) {
-    // do nothing
-  }
-
-    public static final byte
-      CONSTANT_None = 0,
-      CONSTANT_Utf8 = 1,
-      //CONSTANT_Unicode = 2,               /* unused */
-      CONSTANT_Integer = 3,
-      CONSTANT_Float = 4,
-      CONSTANT_Long = 5,
-      CONSTANT_Double = 6,
-      CONSTANT_Class = 7,
-      CONSTANT_String = 8,
-      CONSTANT_Fieldref = 9,
-      CONSTANT_Methodref = 10,
-      CONSTANT_InterfaceMethodref = 11,
-      CONSTANT_NameAndType = 12;
-
-    private static String[] TAG_NAMES = {
-        "Empty",
-        "Utf8",
-        null, //"Unicode",
-        "Integer",
-        "Float",
-        "Long",
-        "Double",
-        "Class",
-        "String",
-        "Fieldref",
-        "Methodref",
-        "InterfaceMethodref",
-        "NameAndType"
-    };
-
-    public static String tagName(byte tag) {
-        String name = null;
-        if ((tag & 0xFF) < TAG_NAMES.length)
-            name = TAG_NAMES[tag];
-        if (name == null)
-            name = "Unknown#"+(tag&0xFF);
-        return name;
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/anon/InvalidConstantPoolFormatException.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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 sun.dyn.anon;
-
-/** Exception used when there is an error in the constant pool
- *  format.
- */
-public class InvalidConstantPoolFormatException extends Exception {
-    private static final long serialVersionUID=-6103888330523770949L;
-
-    public InvalidConstantPoolFormatException(String message,Throwable cause) {
-        super(message,cause);
-    }
-
-    public InvalidConstantPoolFormatException(String message) {
-        super(message);
-    }
-
-    public InvalidConstantPoolFormatException(Throwable cause) {
-        super(cause);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/empty/Empty.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, 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 sun.dyn.empty;
-
-/**
- * An empty class in an empty package.
- * Used as a proxy for unprivileged code, since making access checks
- * against it will only succeed against public methods in public types.
- * <p>
- * This class also stands (internally to sun.dyn) for the type of a
- * value that cannot be produced, because the expression of this type
- * always returns abnormally.  (Cf. Nothing in the closures proposal.)
- * @author jrose
- */
-public class Empty {
-    private Empty() { throw new InternalError(); }
-}
--- a/jdk/src/share/classes/sun/dyn/package-info.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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.
- */
-
-/**
- * Implementation details for JSR 292 RI, package java.dyn.
- * @author jrose
- */
-
-package sun.dyn;
--- a/jdk/src/share/classes/sun/dyn/util/BytecodeDescriptor.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn.util;
-
-import java.dyn.MethodType;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Utility routines for dealing with bytecode-level signatures.
- * @author jrose
- */
-public class BytecodeDescriptor {
-
-    private BytecodeDescriptor() { }  // cannot instantiate
-
-    public static List<Class<?>> parseMethod(String bytecodeSignature, ClassLoader loader) {
-        return parseMethod(bytecodeSignature, 0, bytecodeSignature.length(), loader);
-    }
-
-    static List<Class<?>> parseMethod(String bytecodeSignature,
-            int start, int end, ClassLoader loader) {
-        if (loader == null)
-            loader = ClassLoader.getSystemClassLoader();
-        String str = bytecodeSignature;
-        int[] i = {start};
-        ArrayList<Class<?>> ptypes = new ArrayList<Class<?>>();
-        if (i[0] < end && str.charAt(i[0]) == '(') {
-            ++i[0];  // skip '('
-            while (i[0] < end && str.charAt(i[0]) != ')') {
-                Class<?> pt = parseSig(str, i, end, loader);
-                if (pt == null || pt == void.class)
-                    parseError(str, "bad argument type");
-                ptypes.add(pt);
-            }
-            ++i[0];  // skip ')'
-        } else {
-            parseError(str, "not a method type");
-        }
-        Class<?> rtype = parseSig(str, i, end, loader);
-        if (rtype == null || i[0] != end)
-            parseError(str, "bad return type");
-        ptypes.add(rtype);
-        return ptypes;
-    }
-
-    static private void parseError(String str, String msg) {
-        throw new IllegalArgumentException("bad signature: "+str+": "+msg);
-    }
-
-    static private Class<?> parseSig(String str, int[] i, int end, ClassLoader loader) {
-        if (i[0] == end)  return null;
-        char c = str.charAt(i[0]++);
-        if (c == 'L') {
-            int begc = i[0], endc = str.indexOf(';', begc);
-            if (endc < 0)  return null;
-            i[0] = endc+1;
-            String name = str.substring(begc, endc).replace('/', '.');
-            try {
-                return loader.loadClass(name);
-            } catch (ClassNotFoundException ex) {
-                throw new TypeNotPresentException(name, ex);
-            }
-        } else if (c == '[') {
-            Class<?> t = parseSig(str, i, end, loader);
-            if (t != null)
-                t = java.lang.reflect.Array.newInstance(t, 0).getClass();
-            return t;
-        } else {
-            return Wrapper.forBasicType(c).primitiveType();
-        }
-    }
-
-    public static String unparse(Class<?> type) {
-        StringBuilder sb = new StringBuilder();
-        unparseSig(type, sb);
-        return sb.toString();
-    }
-
-    public static String unparse(MethodType type) {
-        return unparseMethod(type.returnType(), type.parameterList());
-    }
-
-    public static String unparse(Object type) {
-        if (type instanceof Class<?>)
-            return unparse((Class<?>) type);
-        if (type instanceof MethodType)
-            return unparse((MethodType) type);
-        return (String) type;
-    }
-
-    public static String unparseMethod(Class<?> rtype, List<Class<?>> ptypes) {
-        StringBuilder sb = new StringBuilder();
-        sb.append('(');
-        for (Class<?> pt : ptypes)
-            unparseSig(pt, sb);
-        sb.append(')');
-        unparseSig(rtype, sb);
-        return sb.toString();
-    }
-
-    static private void unparseSig(Class<?> t, StringBuilder sb) {
-        char c = Wrapper.forBasicType(t).basicTypeChar();
-        if (c != 'L') {
-            sb.append(c);
-        } else {
-            boolean lsemi = (!t.isArray());
-            if (lsemi)  sb.append('L');
-            sb.append(t.getName().replace('.', '/'));
-            if (lsemi)  sb.append(';');
-        }
-    }
-
-}
--- a/jdk/src/share/classes/sun/dyn/util/BytecodeName.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,627 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, 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 sun.dyn.util;
-
-/**
- * Utility routines for dealing with bytecode-level names.
- * Includes universal mangling rules for the JVM.
- *
- * <h3>Avoiding Dangerous Characters </h3>
- *
- * <p>
- * The JVM defines a very small set of characters which are illegal
- * in name spellings.  We will slightly extend and regularize this set
- * into a group of <cite>dangerous characters</cite>.
- * These characters will then be replaced, in mangled names, by escape sequences.
- * In addition, accidental escape sequences must be further escaped.
- * Finally, a special prefix will be applied if and only if
- * the mangling would otherwise fail to begin with the escape character.
- * This happens to cover the corner case of the null string,
- * and also clearly marks symbols which need demangling.
- * </p>
- * <p>
- * Dangerous characters are the union of all characters forbidden
- * or otherwise restricted by the JVM specification,
- * plus their mates, if they are brackets
- * (<code><big><b>[</b></big></code> and <code><big><b>]</b></big></code>,
- * <code><big><b>&lt;</b></big></code> and <code><big><b>&gt;</b></big></code>),
- * plus, arbitrarily, the colon character <code><big><b>:</b></big></code>.
- * There is no distinction between type, method, and field names.
- * This makes it easier to convert between mangled names of different
- * types, since they do not need to be decoded (demangled).
- * </p>
- * <p>
- * The escape character is backslash <code><big><b>\</b></big></code>
- * (also known as reverse solidus).
- * This character is, until now, unheard of in bytecode names,
- * but traditional in the proposed role.
- *
- * </p>
- * <h3> Replacement Characters </h3>
- *
- *
- * <p>
- * Every escape sequence is two characters
- * (in fact, two UTF8 bytes) beginning with
- * the escape character and followed by a
- * <cite>replacement character</cite>.
- * (Since the replacement character is never a backslash,
- * iterated manglings do not double in size.)
- * </p>
- * <p>
- * Each dangerous character has some rough visual similarity
- * to its corresponding replacement character.
- * This makes mangled symbols easier to recognize by sight.
- * </p>
- * <p>
- * The dangerous characters are
- * <code><big><b>/</b></big></code> (forward slash, used to delimit package components),
- * <code><big><b>.</b></big></code> (dot, also a package delimiter),
- * <code><big><b>;</b></big></code> (semicolon, used in signatures),
- * <code><big><b>$</b></big></code> (dollar, used in inner classes and synthetic members),
- * <code><big><b>&lt;</b></big></code> (left angle),
- * <code><big><b>&gt;</b></big></code> (right angle),
- * <code><big><b>[</b></big></code> (left square bracket, used in array types),
- * <code><big><b>]</b></big></code> (right square bracket, reserved in this scheme for language use),
- * and <code><big><b>:</b></big></code> (colon, reserved in this scheme for language use).
- * Their replacements are, respectively,
- * <code><big><b>|</b></big></code> (vertical bar),
- * <code><big><b>,</b></big></code> (comma),
- * <code><big><b>?</b></big></code> (question mark),
- * <code><big><b>%</b></big></code> (percent),
- * <code><big><b>^</b></big></code> (caret),
- * <code><big><b>_</b></big></code> (underscore), and
- * <code><big><b>{</b></big></code> (left curly bracket),
- * <code><big><b>}</b></big></code> (right curly bracket),
- * <code><big><b>!</b></big></code> (exclamation mark).
- * In addition, the replacement character for the escape character itself is
- * <code><big><b>-</b></big></code> (hyphen),
- * and the replacement character for the null prefix is
- * <code><big><b>=</b></big></code> (equal sign).
- * </p>
- * <p>
- * An escape character <code><big><b>\</b></big></code>
- * followed by any of these replacement characters
- * is an escape sequence, and there are no other escape sequences.
- * An equal sign is only part of an escape sequence
- * if it is the second character in the whole string, following a backslash.
- * Two consecutive backslashes do <em>not</em> form an escape sequence.
- * </p>
- * <p>
- * Each escape sequence replaces a so-called <cite>original character</cite>
- * which is either one of the dangerous characters or the escape character.
- * A null prefix replaces an initial null string, not a character.
- * </p>
- * <p>
- * All this implies that escape sequences cannot overlap and may be
- * determined all at once for a whole string.  Note that a spelling
- * string can contain <cite>accidental escapes</cite>, apparent escape
- * sequences which must not be interpreted as manglings.
- * These are disabled by replacing their leading backslash with an
- * escape sequence (<code><big><b>\-</b></big></code>).  To mangle a string, three logical steps
- * are required, though they may be carried out in one pass:
- * </p>
- * <ol>
- *   <li>In each accidental escape, replace the backslash with an escape sequence
- * (<code><big><b>\-</b></big></code>).</li>
- *   <li>Replace each dangerous character with an escape sequence
- * (<code><big><b>\|</b></big></code> for <code><big><b>/</b></big></code>, etc.).</li>
- *   <li>If the first two steps introduced any change, <em>and</em>
- * if the string does not already begin with a backslash, prepend a null prefix (<code><big><b>\=</b></big></code>).</li>
- * </ol>
- *
- * To demangle a mangled string that begins with an escape,
- * remove any null prefix, and then replace (in parallel)
- * each escape sequence by its original character.
- * <p>Spelling strings which contain accidental
- * escapes <em>must</em> have them replaced, even if those
- * strings do not contain dangerous characters.
- * This restriction means that mangling a string always
- * requires a scan of the string for escapes.
- * But then, a scan would be required anyway,
- * to check for dangerous characters.
- *
- * </p>
- * <h3> Nice Properties </h3>
- *
- * <p>
- * If a bytecode name does not contain any escape sequence,
- * demangling is a no-op:  The string demangles to itself.
- * Such a string is called <cite>self-mangling</cite>.
- * Almost all strings are self-mangling.
- * In practice, to demangle almost any name &ldquo;found in nature&rdquo;,
- * simply verify that it does not begin with a backslash.
- * </p>
- * <p>
- * Mangling is a one-to-one function, while demangling
- * is a many-to-one function.
- * A mangled string is defined as <cite>validly mangled</cite> if
- * it is in fact the unique mangling of its spelling string.
- * Three examples of invalidly mangled strings are <code><big><b>\=foo</b></big></code>,
- * <code><big><b>\-bar</b></big></code>, and <code><big><b>baz\!</b></big></code>, which demangle to <code><big><b>foo</b></big></code>, <code><big><b>\bar</b></big></code>, and
- * <code><big><b>baz\!</b></big></code>, but then remangle to <code><big><b>foo</b></big></code>, <code><big><b>\bar</b></big></code>, and <code><big><b>\=baz\-!</b></big></code>.
- * If a language back-end or runtime is using mangled names,
- * it should never present an invalidly mangled bytecode
- * name to the JVM.  If the runtime encounters one,
- * it should also report an error, since such an occurrence
- * probably indicates a bug in name encoding which
- * will lead to errors in linkage.
- * However, this note does not propose that the JVM verifier
- * detect invalidly mangled names.
- * </p>
- * <p>
- * As a result of these rules, it is a simple matter to
- * compute validly mangled substrings and concatenations
- * of validly mangled strings, and (with a little care)
- * these correspond to corresponding operations on their
- * spelling strings.
- * </p>
- * <ul>
- *   <li>Any prefix of a validly mangled string is also validly mangled,
- * although a null prefix may need to be removed.</li>
- *   <li>Any suffix of a validly mangled string is also validly mangled,
- * although a null prefix may need to be added.</li>
- *   <li>Two validly mangled strings, when concatenated,
- * are also validly mangled, although any null prefix
- * must be removed from the second string,
- * and a trailing backslash on the first string may need escaping,
- * if it would participate in an accidental escape when followed
- * by the first character of the second string.</li>
- * </ul>
- * <p>If languages that include non-Java symbol spellings use this
- * mangling convention, they will enjoy the following advantages:
- * </p>
- * <ul>
- *   <li>They can interoperate via symbols they share in common.</li>
- *   <li>Low-level tools, such as backtrace printers, will have readable displays.</li>
- *   <li>Future JVM and language extensions can safely use the dangerous characters
- * for structuring symbols, but will never interfere with valid spellings.</li>
- *   <li>Runtimes and compilers can use standard libraries for mangling and demangling.</li>
- *   <li>Occasional transliterations and name composition will be simple and regular,
- * for classes, methods, and fields.</li>
- *   <li>Bytecode names will continue to be compact.
- * When mangled, spellings will at most double in length, either in
- * UTF8 or UTF16 format, and most will not change at all.</li>
- * </ul>
- *
- *
- * <h3> Suggestions for Human Readable Presentations </h3>
- *
- *
- * <p>
- * For human readable displays of symbols,
- * it will be better to present a string-like quoted
- * representation of the spelling, because JVM users
- * are generally familiar with such tokens.
- * We suggest using single or double quotes before and after
- * mangled symbols which are not valid Java identifiers,
- * with quotes, backslashes, and non-printing characters
- * escaped as if for literals in the Java language.
- * </p>
- * <p>
- * For example, an HTML-like spelling
- * <code><big><b>&lt;pre&gt;</b></big></code> mangles to
- * <code><big><b>\^pre\_</b></big></code> and could
- * display more cleanly as
- * <code><big><b>'&lt;pre&gt;'</b></big></code>,
- * with the quotes included.
- * Such string-like conventions are <em>not</em> suitable
- * for mangled bytecode names, in part because
- * dangerous characters must be eliminated, rather
- * than just quoted.  Otherwise internally structured
- * strings like package prefixes and method signatures
- * could not be reliably parsed.
- * </p>
- * <p>
- * In such human-readable displays, invalidly mangled
- * names should <em>not</em> be demangled and quoted,
- * for this would be misleading.  Likewise, JVM symbols
- * which contain dangerous characters (like dots in field
- * names or brackets in method names) should not be
- * simply quoted.  The bytecode names
- * <code><big><b>\=phase\,1</b></big></code> and
- * <code><big><b>phase.1</b></big></code> are distinct,
- * and in demangled displays they should be presented as
- * <code><big><b>'phase.1'</b></big></code> and something like
- * <code><big><b>'phase'.1</b></big></code>, respectively.
- * </p>
- *
- * @author John Rose
- * @version 1.2, 02/06/2008
- * @see http://blogs.sun.com/jrose/entry/symbolic_freedom_in_the_vm
- */
-public class BytecodeName {
-    private BytecodeName() { }  // static only class
-
-    /** Given a source name, produce the corresponding bytecode name.
-     * The source name should not be qualified, because any syntactic
-     * markers (dots, slashes, dollar signs, colons, etc.) will be mangled.
-     * @param s the source name
-     * @return a valid bytecode name which represents the source name
-     */
-    public static String toBytecodeName(String s) {
-        String bn = mangle(s);
-        assert((Object)bn == s || looksMangled(bn)) : bn;
-        assert(s.equals(toSourceName(bn))) : s;
-        return bn;
-    }
-
-    /** Given an unqualified bytecode name, produce the corresponding source name.
-     * The bytecode name must not contain dangerous characters.
-     * In particular, it must not be qualified or segmented by colon {@code ':'}.
-     * @param s the bytecode name
-     * @return the source name, which may possibly have unsafe characters
-     * @throws IllegalArgumentException if the bytecode name is not {@link #isSafeBytecodeName safe}
-     * @see #isSafeBytecodeName(java.lang.String)
-     */
-    public static String toSourceName(String s) {
-        checkSafeBytecodeName(s);
-        String sn = s;
-        if (looksMangled(s)) {
-            sn = demangle(s);
-            assert(s.equals(mangle(sn))) : s+" => "+sn+" => "+mangle(sn);
-        }
-        return sn;
-    }
-
-    /**
-     * Given a bytecode name from a classfile, separate it into
-     * components delimited by dangerous characters.
-     * Each resulting array element will be either a dangerous character,
-     * or else a safe bytecode name.
-     * (The safe name might possibly be mangled to hide further dangerous characters.)
-     * For example, the qualified class name {@code java/lang/String}
-     * will be parsed into the array {@code {"java", '/', "lang", '/', "String"}}.
-     * The name {@code &lt;init&gt;} will be parsed into { '&lt;', "init", '&gt;'}}
-     * The name {@code foo/bar$:baz} will be parsed into
-     * {@code {"foo", '/', "bar", '$', ':', "baz"}}.
-     * The name {@code ::\=:foo:\=bar\!baz} will be parsed into
-     * {@code {':', ':', "", ':', "foo", ':', "bar:baz"}}.
-     */
-    public static Object[] parseBytecodeName(String s) {
-        int slen = s.length();
-        Object[] res = null;
-        for (int pass = 0; pass <= 1; pass++) {
-            int fillp = 0;
-            int lasti = 0;
-            for (int i = 0; i <= slen; i++) {
-                int whichDC = -1;
-                if (i < slen) {
-                    whichDC = DANGEROUS_CHARS.indexOf(s.charAt(i));
-                    if (whichDC < DANGEROUS_CHAR_FIRST_INDEX)  continue;
-                }
-                // got to end of string or next dangerous char
-                if (lasti < i) {
-                    // normal component
-                    if (pass != 0)
-                        res[fillp] = toSourceName(s.substring(lasti, i));
-                    fillp++;
-                    lasti = i+1;
-                }
-                if (whichDC >= DANGEROUS_CHAR_FIRST_INDEX) {
-                    if (pass != 0)
-                        res[fillp] = DANGEROUS_CHARS_CA[whichDC];
-                    fillp++;
-                    lasti = i+1;
-                }
-            }
-            if (pass != 0)  break;
-            // between passes, build the result array
-            res = new Object[fillp];
-            if (fillp <= 1 && lasti == 0) {
-                if (fillp != 0)  res[0] = toSourceName(s);
-                break;
-            }
-        }
-        return res;
-    }
-
-    /**
-     * Given a series of components, create a bytecode name for a classfile.
-     * This is the inverse of {@link #parseBytecodeName(java.lang.String)}.
-     * Each component must either be an interned one-character string of
-     * a dangerous character, or else a safe bytecode name.
-     * @param components a series of name components
-     * @return the concatenation of all components
-     * @throws IllegalArgumentException if any component contains an unsafe
-     *          character, and is not an interned one-character string
-     * @throws NullPointerException if any component is null
-     */
-    public static String unparseBytecodeName(Object[] components) {
-        Object[] components0 = components;
-        for (int i = 0; i < components.length; i++) {
-            Object c = components[i];
-            if (c instanceof String) {
-                String mc = toBytecodeName((String) c);
-                if (i == 0 && components.length == 1)
-                    return mc;  // usual case
-                if ((Object)mc != c) {
-                    if (components == components0)
-                        components = components.clone();
-                    components[i] = c = mc;
-                }
-            }
-        }
-        return appendAll(components);
-    }
-    private static String appendAll(Object[] components) {
-        if (components.length <= 1) {
-            if (components.length == 1) {
-                return String.valueOf(components[0]);
-            }
-            return "";
-        }
-        int slen = 0;
-        for (Object c : components) {
-            if (c instanceof String)
-                slen += String.valueOf(c).length();
-            else
-                slen += 1;
-        }
-        StringBuilder sb = new StringBuilder(slen);
-        for (Object c : components) {
-            sb.append(c);
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Given a bytecode name, produce the corresponding display name.
-     * This is the source name, plus quotes if needed.
-     * If the bytecode name contains dangerous characters,
-     * assume that they are being used as punctuation,
-     * and pass them through unchanged.
-     * Non-empty runs of non-dangerous characters are demangled
-     * if necessary, and the resulting names are quoted if
-     * they are not already valid Java identifiers, or if
-     * they contain a dangerous character (i.e., dollar sign "$").
-     * Single quotes are used when quoting.
-     * Within quoted names, embedded single quotes and backslashes
-     * are further escaped by prepended backslashes.
-     *
-     * @param s the original bytecode name (which may be qualified)
-     * @return a human-readable presentation
-     */
-    public static String toDisplayName(String s) {
-        Object[] components = parseBytecodeName(s);
-        for (int i = 0; i < components.length; i++) {
-            if (!(components[i] instanceof String))
-                continue;
-            String sn = (String) components[i];
-            // note that the name is already demangled!
-            //sn = toSourceName(sn);
-            if (!isJavaIdent(sn) || sn.indexOf('$') >=0 ) {
-                components[i] = quoteDisplay(sn);
-            }
-        }
-        return appendAll(components);
-    }
-    private static boolean isJavaIdent(String s) {
-        int slen = s.length();
-        if (slen == 0)  return false;
-        if (!Character.isJavaIdentifierStart(s.charAt(0)))
-            return false;
-        for (int i = 1; i < slen; i++) {
-            if (!Character.isJavaIdentifierPart(s.charAt(i)))
-                return false;
-        }
-        return true;
-    }
-    private static String quoteDisplay(String s) {
-        // TO DO:  Replace wierd characters in s by C-style escapes.
-        return "'"+s.replaceAll("['\\\\]", "\\\\$0")+"'";
-    }
-
-    private static void checkSafeBytecodeName(String s)
-            throws IllegalArgumentException {
-        if (!isSafeBytecodeName(s)) {
-            throw new IllegalArgumentException(s);
-        }
-    }
-
-    /**
-     * Report whether a simple name is safe as a bytecode name.
-     * Such names are acceptable in class files as class, method, and field names.
-     * Additionally, they are free of "dangerous" characters, even if those
-     * characters are legal in some (or all) names in class files.
-     * @param s the proposed bytecode name
-     * @return true if the name is non-empty and all of its characters are safe
-     */
-    public static boolean isSafeBytecodeName(String s) {
-        if (s.length() == 0)  return false;
-        // check occurrences of each DANGEROUS char
-        for (char xc : DANGEROUS_CHARS_A) {
-            if (xc == ESCAPE_C)  continue;  // not really that dangerous
-            if (s.indexOf(xc) >= 0)  return false;
-        }
-        return true;
-    }
-
-    /**
-     * Report whether a character is safe in a bytecode name.
-     * This is true of any unicode character except the following
-     * <em>dangerous characters</em>: {@code ".;:$[]<>/"}.
-     * @param s the proposed character
-     * @return true if the character is safe to use in classfiles
-     */
-    public static boolean isSafeBytecodeChar(char c) {
-        return DANGEROUS_CHARS.indexOf(c) < DANGEROUS_CHAR_FIRST_INDEX;
-    }
-
-    private static boolean looksMangled(String s) {
-        return s.charAt(0) == ESCAPE_C;
-    }
-
-    private static String mangle(String s) {
-        if (s.length() == 0)
-            return NULL_ESCAPE;
-
-        // build this lazily, when we first need an escape:
-        StringBuilder sb = null;
-
-        for (int i = 0, slen = s.length(); i < slen; i++) {
-            char c = s.charAt(i);
-
-            boolean needEscape = false;
-            if (c == ESCAPE_C) {
-                if (i+1 < slen) {
-                    char c1 = s.charAt(i+1);
-                    if ((i == 0 && c1 == NULL_ESCAPE_C)
-                        || c1 != originalOfReplacement(c1)) {
-                        // an accidental escape
-                        needEscape = true;
-                    }
-                }
-            } else {
-                needEscape = isDangerous(c);
-            }
-
-            if (!needEscape) {
-                if (sb != null)  sb.append(c);
-                continue;
-            }
-
-            // build sb if this is the first escape
-            if (sb == null) {
-                sb = new StringBuilder(s.length()+10);
-                // mangled names must begin with a backslash:
-                if (s.charAt(0) != ESCAPE_C && i > 0)
-                    sb.append(NULL_ESCAPE);
-                // append the string so far, which is unremarkable:
-                sb.append(s.substring(0, i));
-            }
-
-            // rewrite \ to \-, / to \|, etc.
-            sb.append(ESCAPE_C);
-            sb.append(replacementOf(c));
-        }
-
-        if (sb != null)   return sb.toString();
-
-        return s;
-    }
-
-    private static String demangle(String s) {
-        // build this lazily, when we first meet an escape:
-        StringBuilder sb = null;
-
-        int stringStart = 0;
-        if (s.startsWith(NULL_ESCAPE))
-            stringStart = 2;
-
-        for (int i = stringStart, slen = s.length(); i < slen; i++) {
-            char c = s.charAt(i);
-
-            if (c == ESCAPE_C && i+1 < slen) {
-                // might be an escape sequence
-                char rc = s.charAt(i+1);
-                char oc = originalOfReplacement(rc);
-                if (oc != rc) {
-                    // build sb if this is the first escape
-                    if (sb == null) {
-                        sb = new StringBuilder(s.length());
-                        // append the string so far, which is unremarkable:
-                        sb.append(s.substring(stringStart, i));
-                    }
-                    ++i;  // skip both characters
-                    c = oc;
-                }
-            }
-
-            if (sb != null)
-                sb.append(c);
-        }
-
-        if (sb != null)   return sb.toString();
-
-        return s.substring(stringStart);
-    }
-
-    static char ESCAPE_C = '\\';
-    // empty escape sequence to avoid a null name or illegal prefix
-    static char NULL_ESCAPE_C = '=';
-    static String NULL_ESCAPE = ESCAPE_C+""+NULL_ESCAPE_C;
-
-    static final String DANGEROUS_CHARS   = "\\/.;:$[]<>"; // \\ must be first
-    static final String REPLACEMENT_CHARS =  "-|,?!%{}^_";
-    static final int DANGEROUS_CHAR_FIRST_INDEX = 1; // index after \\
-    static char[] DANGEROUS_CHARS_A   = DANGEROUS_CHARS.toCharArray();
-    static char[] REPLACEMENT_CHARS_A = REPLACEMENT_CHARS.toCharArray();
-    static final Character[] DANGEROUS_CHARS_CA;
-    static {
-        Character[] dcca = new Character[DANGEROUS_CHARS.length()];
-        for (int i = 0; i < dcca.length; i++)
-            dcca[i] = Character.valueOf(DANGEROUS_CHARS.charAt(i));
-        DANGEROUS_CHARS_CA = dcca;
-    }
-
-    static final long[] SPECIAL_BITMAP = new long[2];  // 128 bits
-    static {
-        String SPECIAL = DANGEROUS_CHARS + REPLACEMENT_CHARS;
-        //System.out.println("SPECIAL = "+SPECIAL);
-        for (char c : SPECIAL.toCharArray()) {
-            SPECIAL_BITMAP[c >>> 6] |= 1L << c;
-        }
-    }
-    static boolean isSpecial(char c) {
-        if ((c >>> 6) < SPECIAL_BITMAP.length)
-            return ((SPECIAL_BITMAP[c >>> 6] >> c) & 1) != 0;
-        else
-            return false;
-    }
-    static char replacementOf(char c) {
-        if (!isSpecial(c))  return c;
-        int i = DANGEROUS_CHARS.indexOf(c);
-        if (i < 0)  return c;
-        return REPLACEMENT_CHARS.charAt(i);
-    }
-    static char originalOfReplacement(char c) {
-        if (!isSpecial(c))  return c;
-        int i = REPLACEMENT_CHARS.indexOf(c);
-        if (i < 0)  return c;
-        return DANGEROUS_CHARS.charAt(i);
-    }
-    static boolean isDangerous(char c) {
-        if (!isSpecial(c))  return false;
-        return (DANGEROUS_CHARS.indexOf(c) >= DANGEROUS_CHAR_FIRST_INDEX);
-    }
-    static int indexOfDangerousChar(String s, int from) {
-        for (int i = from, slen = s.length(); i < slen; i++) {
-            if (isDangerous(s.charAt(i)))
-                return i;
-        }
-        return -1;
-    }
-    static int lastIndexOfDangerousChar(String s, int from) {
-        for (int i = Math.min(from, s.length()-1); i >= 0; i--) {
-            if (isDangerous(s.charAt(i)))
-                return i;
-        }
-        return -1;
-    }
-
-
-}
--- a/jdk/src/share/classes/sun/dyn/util/ValueConversions.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,807 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn.util;
-
-import java.dyn.*;
-import java.dyn.MethodHandles.Lookup;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumMap;
-import java.util.List;
-import sun.dyn.Access;
-import sun.dyn.AdapterMethodHandle;
-import sun.dyn.MethodHandleImpl;
-import static sun.dyn.MemberName.uncaughtException;
-
-public class ValueConversions {
-    private static final Access IMPL_TOKEN = Access.getToken();
-    private static final Lookup IMPL_LOOKUP = MethodHandleImpl.getLookup(IMPL_TOKEN);
-
-    private static EnumMap<Wrapper, MethodHandle>[] newWrapperCaches(int n) {
-        @SuppressWarnings("unchecked")
-        EnumMap<Wrapper, MethodHandle>[] caches
-                = (EnumMap<Wrapper, MethodHandle>[]) new EnumMap[n];  // unchecked warning expected here
-        for (int i = 0; i < n; i++)
-            caches[i] = new EnumMap<Wrapper, MethodHandle>(Wrapper.class);
-        return caches;
-    }
-
-    /// Converting references to values.
-
-    static int unboxInteger(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Integer) x).intValue();
-    }
-
-    static byte unboxByte(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Byte) x).byteValue();
-    }
-
-    static short unboxShort(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Short) x).shortValue();
-    }
-
-    static boolean unboxBoolean(Object x) {
-        if (x == null)  return false;  // never NPE
-        return ((Boolean) x).booleanValue();
-    }
-
-    static char unboxCharacter(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Character) x).charValue();
-    }
-
-    static long unboxLong(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Long) x).longValue();
-    }
-
-    static float unboxFloat(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Float) x).floatValue();
-    }
-
-    static double unboxDouble(Object x) {
-        if (x == null)  return 0;  // never NPE
-        return ((Double) x).doubleValue();
-    }
-
-    /// Converting references to "raw" values.
-    /// A raw primitive value is always an int or long.
-
-    static int unboxByteRaw(Object x) {
-        return unboxByte(x);
-    }
-
-    static int unboxShortRaw(Object x) {
-        return unboxShort(x);
-    }
-
-    static int unboxBooleanRaw(Object x) {
-        return unboxBoolean(x) ? 1 : 0;
-    }
-
-    static int unboxCharacterRaw(Object x) {
-        return unboxCharacter(x);
-    }
-
-    static int unboxFloatRaw(Object x) {
-        return Float.floatToIntBits(unboxFloat(x));
-    }
-
-    static long unboxDoubleRaw(Object x) {
-        return Double.doubleToRawLongBits(unboxDouble(x));
-    }
-
-    private static MethodType unboxType(Wrapper wrap, boolean raw) {
-        return MethodType.methodType(rawWrapper(wrap, raw).primitiveType(), wrap.wrapperType());
-    }
-
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            UNBOX_CONVERSIONS = newWrapperCaches(4);
-
-    private static MethodHandle unbox(Wrapper wrap, boolean exact, boolean raw) {
-        EnumMap<Wrapper, MethodHandle> cache = UNBOX_CONVERSIONS[(exact?1:0)+(raw?2:0)];
-        MethodHandle mh = cache.get(wrap);
-        if (mh != null) {
-            return mh;
-        }
-        // slow path
-        switch (wrap) {
-            case OBJECT:
-                mh = IDENTITY; break;
-            case VOID:
-                mh = raw ? ALWAYS_ZERO : IGNORE; break;
-            case INT: case LONG:
-                // these guys don't need separate raw channels
-                if (raw)  mh = unbox(wrap, exact, false);
-                break;
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        // look up the method
-        String name = "unbox" + wrap.simpleName() + (raw ? "Raw" : "");
-        MethodType type = unboxType(wrap, raw);
-        if (!exact) {
-            try {
-                // actually, type is wrong; the Java method takes Object
-                mh = IMPL_LOOKUP.findStatic(ValueConversions.class, name, type.erase());
-            } catch (ReflectiveOperationException ex) {
-                mh = null;
-            }
-        } else {
-            mh = retype(type, unbox(wrap, !exact, raw));
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        throw new IllegalArgumentException("cannot find unbox adapter for " + wrap + (raw ? " (raw)" : ""));
-    }
-
-    public static MethodHandle unbox(Wrapper type, boolean exact) {
-        return unbox(type, exact, false);
-    }
-
-    public static MethodHandle unboxRaw(Wrapper type, boolean exact) {
-        return unbox(type, exact, true);
-    }
-
-    public static MethodHandle unbox(Class<?> type, boolean exact) {
-        return unbox(Wrapper.forPrimitiveType(type), exact, false);
-    }
-
-    public static MethodHandle unboxRaw(Class<?> type, boolean exact) {
-        return unbox(Wrapper.forPrimitiveType(type), exact, true);
-    }
-
-    /// Converting primitives to references
-
-    static Integer boxInteger(int x) {
-        return x;
-    }
-
-    static Byte boxByte(byte x) {
-        return x;
-    }
-
-    static Short boxShort(short x) {
-        return x;
-    }
-
-    static Boolean boxBoolean(boolean x) {
-        return x;
-    }
-
-    static Character boxCharacter(char x) {
-        return x;
-    }
-
-    static Long boxLong(long x) {
-        return x;
-    }
-
-    static Float boxFloat(float x) {
-        return x;
-    }
-
-    static Double boxDouble(double x) {
-        return x;
-    }
-
-    /// Converting raw primitives to references
-
-    static Byte boxByteRaw(int x) {
-        return boxByte((byte)x);
-    }
-
-    static Short boxShortRaw(int x) {
-        return boxShort((short)x);
-    }
-
-    static Boolean boxBooleanRaw(int x) {
-        return boxBoolean(x != 0);
-    }
-
-    static Character boxCharacterRaw(int x) {
-        return boxCharacter((char)x);
-    }
-
-    static Float boxFloatRaw(int x) {
-        return boxFloat(Float.intBitsToFloat(x));
-    }
-
-    static Double boxDoubleRaw(long x) {
-        return boxDouble(Double.longBitsToDouble(x));
-    }
-
-    // a raw void value is (arbitrarily) a garbage int
-    static Void boxVoidRaw(int x) {
-        return null;
-    }
-
-    private static MethodType boxType(Wrapper wrap, boolean raw) {
-        // be exact, since return casts are hard to compose
-        Class<?> boxType = wrap.wrapperType();
-        return MethodType.methodType(boxType, rawWrapper(wrap, raw).primitiveType());
-    }
-
-    private static Wrapper rawWrapper(Wrapper wrap, boolean raw) {
-        if (raw)  return wrap.isDoubleWord() ? Wrapper.LONG : Wrapper.INT;
-        return wrap;
-    }
-
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            BOX_CONVERSIONS = newWrapperCaches(4);
-
-    private static MethodHandle box(Wrapper wrap, boolean exact, boolean raw) {
-        EnumMap<Wrapper, MethodHandle> cache = BOX_CONVERSIONS[(exact?1:0)+(raw?2:0)];
-        MethodHandle mh = cache.get(wrap);
-        if (mh != null) {
-            return mh;
-        }
-        // slow path
-        switch (wrap) {
-            case OBJECT:
-                mh = IDENTITY; break;
-            case VOID:
-                if (!raw)  mh = ZERO_OBJECT;
-                break;
-            case INT: case LONG:
-                // these guys don't need separate raw channels
-                if (raw)  mh = box(wrap, exact, false);
-                break;
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        // look up the method
-        String name = "box" + wrap.simpleName() + (raw ? "Raw" : "");
-        MethodType type = boxType(wrap, raw);
-        if (exact) {
-            try {
-                mh = IMPL_LOOKUP.findStatic(ValueConversions.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-                mh = null;
-            }
-        } else {
-            mh = retype(type.erase(), box(wrap, !exact, raw));
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        throw new IllegalArgumentException("cannot find box adapter for " + wrap + (raw ? " (raw)" : ""));
-    }
-
-    public static MethodHandle box(Class<?> type, boolean exact) {
-        return box(Wrapper.forPrimitiveType(type), exact, false);
-    }
-
-    public static MethodHandle boxRaw(Class<?> type, boolean exact) {
-        return box(Wrapper.forPrimitiveType(type), exact, true);
-    }
-
-    public static MethodHandle box(Wrapper type, boolean exact) {
-        return box(type, exact, false);
-    }
-
-    public static MethodHandle boxRaw(Wrapper type, boolean exact) {
-        return box(type, exact, true);
-    }
-
-    /// Kludges for when raw values get accidentally boxed.
-
-    static int unboxRawInteger(Object x) {
-        if (x instanceof Integer)
-            return unboxInteger(x);
-        else
-            return (int) unboxLong(x);
-    }
-
-    static Integer reboxRawInteger(Object x) {
-        if (x instanceof Integer)
-            return (Integer) x;
-        else
-            return (int) unboxLong(x);
-    }
-
-    static Byte reboxRawByte(Object x) {
-        if (x instanceof Byte)  return (Byte) x;
-        return boxByteRaw(unboxRawInteger(x));
-    }
-
-    static Short reboxRawShort(Object x) {
-        if (x instanceof Short)  return (Short) x;
-        return boxShortRaw(unboxRawInteger(x));
-    }
-
-    static Boolean reboxRawBoolean(Object x) {
-        if (x instanceof Boolean)  return (Boolean) x;
-        return boxBooleanRaw(unboxRawInteger(x));
-    }
-
-    static Character reboxRawCharacter(Object x) {
-        if (x instanceof Character)  return (Character) x;
-        return boxCharacterRaw(unboxRawInteger(x));
-    }
-
-    static Float reboxRawFloat(Object x) {
-        if (x instanceof Float)  return (Float) x;
-        return boxFloatRaw(unboxRawInteger(x));
-    }
-
-    static Long reboxRawLong(Object x) {
-        return (Long) x;  //never a rebox
-    }
-
-    static Double reboxRawDouble(Object x) {
-        if (x instanceof Double)  return (Double) x;
-        return boxDoubleRaw(unboxLong(x));
-    }
-
-    private static MethodType reboxType(Wrapper wrap) {
-        Class<?> boxType = wrap.wrapperType();
-        return MethodType.methodType(boxType, Object.class);
-    }
-
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            REBOX_CONVERSIONS = newWrapperCaches(2);
-
-    /**
-     * Because we normalize primitive types to reduce the number of signatures,
-     * primitives are sometimes manipulated under an "erased" type,
-     * either int (for types other than long/double) or long (for all types).
-     * When the erased primitive value is then boxed into an Integer or Long,
-     * the final boxed primitive is sometimes required.  This transformation
-     * is called a "rebox".  It takes an Integer or Long and produces some
-     * other boxed value.
-     */
-    public static MethodHandle rebox(Wrapper wrap, boolean exact) {
-        EnumMap<Wrapper, MethodHandle> cache = REBOX_CONVERSIONS[exact?1:0];
-        MethodHandle mh = cache.get(wrap);
-        if (mh != null) {
-            return mh;
-        }
-        // slow path
-        switch (wrap) {
-            case OBJECT:
-                mh = IDENTITY; break;
-            case VOID:
-                throw new IllegalArgumentException("cannot rebox a void");
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        // look up the method
-        String name = "reboxRaw" + wrap.simpleName();
-        MethodType type = reboxType(wrap);
-        if (exact) {
-            try {
-                mh = IMPL_LOOKUP.findStatic(ValueConversions.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-                mh = null;
-            }
-        } else {
-            mh = retype(IDENTITY.type(), rebox(wrap, !exact));
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        throw new IllegalArgumentException("cannot find rebox adapter for " + wrap);
-    }
-
-    public static MethodHandle rebox(Class<?> type, boolean exact) {
-        return rebox(Wrapper.forPrimitiveType(type), exact);
-    }
-
-    /// Width-changing conversions between int and long.
-
-    static long widenInt(int x) {
-        return (long) x;
-    }
-
-    static Long widenBoxedInt(Integer x) {
-        return (long)(int)x;
-    }
-
-    static int narrowLong(long x) {
-        return (int) x;
-    }
-
-    static Integer narrowBoxedLong(Long x) {
-        return (int)(long) x;
-    }
-
-    /// Constant functions
-
-    static void ignore(Object x) {
-        // no value to return; this is an unbox of null
-        return;
-    }
-
-    static void empty() {
-        return;
-    }
-
-    static Object zeroObject() {
-        return null;
-    }
-
-    static int zeroInteger() {
-        return 0;
-    }
-
-    static long zeroLong() {
-        return 0;
-    }
-
-    static float zeroFloat() {
-        return 0;
-    }
-
-    static double zeroDouble() {
-        return 0;
-    }
-
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            CONSTANT_FUNCTIONS = newWrapperCaches(2);
-
-    public static MethodHandle zeroConstantFunction(Wrapper wrap) {
-        EnumMap<Wrapper, MethodHandle> cache = CONSTANT_FUNCTIONS[0];
-        MethodHandle mh = cache.get(wrap);
-        if (mh != null) {
-            return mh;
-        }
-        // slow path
-        MethodType type = MethodType.methodType(wrap.primitiveType());
-        switch (wrap) {
-            case VOID:
-                mh = EMPTY;
-                break;
-            case INT: case LONG: case FLOAT: case DOUBLE:
-                try {
-                    mh = IMPL_LOOKUP.findStatic(ValueConversions.class, "zero"+wrap.simpleName(), type);
-                } catch (ReflectiveOperationException ex) {
-                    mh = null;
-                }
-                break;
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-
-        // use the raw method
-        Wrapper rawWrap = wrap.rawPrimitive();
-        if (rawWrap != wrap) {
-            mh = retype(type, zeroConstantFunction(rawWrap));
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        throw new IllegalArgumentException("cannot find zero constant for " + wrap);
-    }
-
-    /// Converting references to references.
-
-    /**
-     * Value-killing function.
-     * @param x an arbitrary reference value
-     * @return a null
-     */
-    static Object alwaysNull(Object x) {
-        return null;
-    }
-
-    /**
-     * Value-killing function.
-     * @param x an arbitrary reference value
-     * @return a zero
-     */
-    static int alwaysZero(Object x) {
-        return 0;
-    }
-
-    /**
-     * Identity function.
-     * @param x an arbitrary reference value
-     * @return the same value x
-     */
-    static <T> T identity(T x) {
-        return x;
-    }
-
-    /**
-     * Identity function on ints.
-     * @param x an arbitrary int value
-     * @return the same value x
-     */
-    static int identity(int x) {
-        return x;
-    }
-
-    /**
-     * Identity function on longs.
-     * @param x an arbitrary long value
-     * @return the same value x
-     */
-    static long identity(long x) {
-        return x;
-    }
-
-    /**
-     * Identity function, with reference cast.
-     * @param t an arbitrary reference type
-     * @param x an arbitrary reference value
-     * @return the same value x
-     */
-    static <T,U> T castReference(Class<? extends T> t, U x) {
-        return t.cast(x);
-    }
-
-    private static final MethodHandle IDENTITY, IDENTITY_I, IDENTITY_J, CAST_REFERENCE, ALWAYS_NULL, ALWAYS_ZERO, ZERO_OBJECT, IGNORE, EMPTY;
-    static {
-        try {
-            MethodType idType = MethodType.genericMethodType(1);
-            MethodType castType = idType.insertParameterTypes(0, Class.class);
-            MethodType alwaysZeroType = idType.changeReturnType(int.class);
-            MethodType ignoreType = idType.changeReturnType(void.class);
-            MethodType zeroObjectType = MethodType.genericMethodType(0);
-            IDENTITY = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", idType);
-            IDENTITY_I = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", MethodType.methodType(int.class, int.class));
-            IDENTITY_J = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", MethodType.methodType(long.class, long.class));
-            //CAST_REFERENCE = IMPL_LOOKUP.findVirtual(Class.class, "cast", idType);
-            CAST_REFERENCE = IMPL_LOOKUP.findStatic(ValueConversions.class, "castReference", castType);
-            ALWAYS_NULL = IMPL_LOOKUP.findStatic(ValueConversions.class, "alwaysNull", idType);
-            ALWAYS_ZERO = IMPL_LOOKUP.findStatic(ValueConversions.class, "alwaysZero", alwaysZeroType);
-            ZERO_OBJECT = IMPL_LOOKUP.findStatic(ValueConversions.class, "zeroObject", zeroObjectType);
-            IGNORE = IMPL_LOOKUP.findStatic(ValueConversions.class, "ignore", ignoreType);
-            EMPTY = IMPL_LOOKUP.findStatic(ValueConversions.class, "empty", ignoreType.dropParameterTypes(0, 1));
-        } catch (Exception ex) {
-            throw uncaughtException(ex);
-        }
-    }
-
-    private static final EnumMap<Wrapper, MethodHandle> WRAPPER_CASTS
-            = new EnumMap<Wrapper, MethodHandle>(Wrapper.class);
-
-    private static final EnumMap<Wrapper, MethodHandle> EXACT_WRAPPER_CASTS
-            = new EnumMap<Wrapper, MethodHandle>(Wrapper.class);
-
-    /** Return a method that casts its sole argument (an Object) to the given type
-     *  and returns it as the given type (if exact is true), or as plain Object (if erase is true).
-     */
-    public static MethodHandle cast(Class<?> type, boolean exact) {
-        if (type.isPrimitive())  throw new IllegalArgumentException("cannot cast primitive type "+type);
-        MethodHandle mh = null;
-        Wrapper wrap = null;
-        EnumMap<Wrapper, MethodHandle> cache = null;
-        if (Wrapper.isWrapperType(type)) {
-            wrap = Wrapper.forWrapperType(type);
-            cache = (exact ? EXACT_WRAPPER_CASTS : WRAPPER_CASTS);
-            mh = cache.get(wrap);
-            if (mh != null)  return mh;
-        }
-        if (VerifyType.isNullReferenceConversion(Object.class, type))
-            mh = IDENTITY;
-        else if (VerifyType.isNullType(type))
-            mh = ALWAYS_NULL;
-        else
-            mh = MethodHandles.insertArguments(CAST_REFERENCE, 0, type);
-        if (exact) {
-            MethodType xmt = MethodType.methodType(type, Object.class);
-            mh = AdapterMethodHandle.makeRetypeRaw(IMPL_TOKEN, xmt, mh);
-        }
-        if (cache != null)
-            cache.put(wrap, mh);
-        return mh;
-    }
-
-    public static MethodHandle identity() {
-        return IDENTITY;
-    }
-
-    public static MethodHandle identity(Class<?> type) {
-        if (type == Object.class)
-            return IDENTITY;
-        else if (!type.isPrimitive())
-            return retype(MethodType.methodType(type, type), IDENTITY);
-        else
-            return identity(Wrapper.forPrimitiveType(type));
-    }
-
-    static MethodHandle identity(Wrapper wrap) {
-        EnumMap<Wrapper, MethodHandle> cache = CONSTANT_FUNCTIONS[1];
-        MethodHandle mh = cache.get(wrap);
-        if (mh != null) {
-            return mh;
-        }
-        // slow path
-        MethodType type = MethodType.methodType(wrap.primitiveType());
-        if (wrap != Wrapper.VOID)
-            type = type.appendParameterTypes(wrap.primitiveType());
-        try {
-            mh = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", type);
-        } catch (ReflectiveOperationException ex) {
-            mh = null;
-        }
-        if (mh == null && wrap == Wrapper.VOID) {
-            mh = EMPTY;  // #(){} : #()void
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-
-        // use a raw conversion
-        if (wrap.isSingleWord() && wrap != Wrapper.INT) {
-            mh = retype(type, identity(Wrapper.INT));
-        } else if (wrap.isDoubleWord() && wrap != Wrapper.LONG) {
-            mh = retype(type, identity(Wrapper.LONG));
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        throw new IllegalArgumentException("cannot find identity for " + wrap);
-    }
-
-    private static MethodHandle retype(MethodType type, MethodHandle mh) {
-        return AdapterMethodHandle.makeRetypeRaw(IMPL_TOKEN, type, mh);
-    }
-
-    private static final Object[] NO_ARGS_ARRAY = {};
-    private static Object[] makeArray(Object... args) { return args; }
-    private static Object[] array() { return NO_ARGS_ARRAY; }
-    private static Object[] array(Object a0)
-                { return makeArray(a0); }
-    private static Object[] array(Object a0, Object a1)
-                { return makeArray(a0, a1); }
-    private static Object[] array(Object a0, Object a1, Object a2)
-                { return makeArray(a0, a1, a2); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3)
-                { return makeArray(a0, a1, a2, a3); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4)
-                { return makeArray(a0, a1, a2, a3, a4); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5)
-                { return makeArray(a0, a1, a2, a3, a4, a5); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8, Object a9)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-    static MethodHandle[] makeArrays() {
-        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
-        MethodHandles.Lookup lookup = IMPL_LOOKUP;
-        for (;;) {
-            int nargs = arrays.size();
-            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(Object[].class);
-            String name = "array";
-            MethodHandle array = null;
-            try {
-                array = lookup.findStatic(ValueConversions.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-            }
-            if (array == null)  break;
-            arrays.add(array);
-        }
-        assert(arrays.size() == 11);  // current number of methods
-        return arrays.toArray(new MethodHandle[0]);
-    }
-    static final MethodHandle[] ARRAYS = makeArrays();
-
-    /** Return a method handle that takes the indicated number of Object
-     *  arguments and returns an Object array of them, as if for varargs.
-     */
-    public static MethodHandle varargsArray(int nargs) {
-        if (nargs < ARRAYS.length)
-            return ARRAYS[nargs];
-        // else need to spin bytecode or do something else fancy
-        throw new UnsupportedOperationException("NYI: cannot form a varargs array of length "+nargs);
-    }
-
-    private static final List<Object> NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY);
-    private static List<Object> makeList(Object... args) { return Arrays.asList(args); }
-    private static List<Object> list() { return NO_ARGS_LIST; }
-    private static List<Object> list(Object a0)
-                { return makeList(a0); }
-    private static List<Object> list(Object a0, Object a1)
-                { return makeList(a0, a1); }
-    private static List<Object> list(Object a0, Object a1, Object a2)
-                { return makeList(a0, a1, a2); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3)
-                { return makeList(a0, a1, a2, a3); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4)
-                { return makeList(a0, a1, a2, a3, a4); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5)
-                { return makeList(a0, a1, a2, a3, a4, a5); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7,
-                                     Object a8)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7,
-                                     Object a8, Object a9)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-    static MethodHandle[] makeLists() {
-        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
-        MethodHandles.Lookup lookup = IMPL_LOOKUP;
-        for (;;) {
-            int nargs = arrays.size();
-            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(List.class);
-            String name = "list";
-            MethodHandle array = null;
-            try {
-                array = lookup.findStatic(ValueConversions.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-            }
-            if (array == null)  break;
-            arrays.add(array);
-        }
-        assert(arrays.size() == 11);  // current number of methods
-        return arrays.toArray(new MethodHandle[0]);
-    }
-    static final MethodHandle[] LISTS = makeLists();
-
-    /** Return a method handle that takes the indicated number of Object
-     *  arguments and returns List.
-     */
-    public static MethodHandle varargsList(int nargs) {
-        if (nargs < LISTS.length)
-            return LISTS[nargs];
-        // else need to spin bytecode or do something else fancy
-        throw new UnsupportedOperationException("NYI");
-    }
-}
-
--- a/jdk/src/share/classes/sun/dyn/util/VerifyAccess.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn.util;
-
-import java.lang.reflect.Modifier;
-import sun.dyn.MemberName;
-import sun.dyn.MethodHandleImpl;
-import sun.dyn.empty.Empty;
-import static java.lang.reflect.Modifier.*;
-
-/**
- * This class centralizes information about the JVM's linkage access control.
- * @author jrose
- */
-public class VerifyAccess {
-
-    private VerifyAccess() { }  // cannot instantiate
-
-    private static final int PACKAGE_ONLY = 0;
-    private static final int ALL_ACCESS_MODES = (PUBLIC|PRIVATE|PROTECTED|PACKAGE_ONLY);
-    private static final boolean ALLOW_NESTMATE_ACCESS = false;
-
-    /**
-     * Evaluate the JVM linkage rules for access to the given method
-     * on behalf of a caller class which proposes to perform the access.
-     * Return true if the caller class has privileges to invoke a method
-     * or access a field with the given properties.
-     * This requires an accessibility check of the referencing class,
-     * plus an accessibility check of the member within the class,
-     * which depends on the member's modifier flags.
-     * <p>
-     * The relevant properties include the defining class ({@code defc})
-     * of the member, and its modifier flags ({@code mods}).
-     * Also relevant is the class used to make the initial symbolic reference
-     * to the member ({@code refc}).  If this latter class is not distinguished,
-     * the defining class should be passed for both arguments ({@code defc == refc}).
-     * <h3>JVM Specification, 5.4.4 "Access Control"</h3>
-     * A field or method R is accessible to a class or interface D if
-     * and only if any of the following conditions is true:<ul>
-     * <li>R is public.
-     * <li>R is protected and is declared in a class C, and D is either
-     *     a subclass of C or C itself.  Furthermore, if R is not
-     *     static, then the symbolic reference to R must contain a
-     *     symbolic reference to a class T, such that T is either a
-     *     subclass of D, a superclass of D or D itself.
-     * <li>R is either protected or has default access (that is,
-     *     neither public nor protected nor private), and is declared
-     *     by a class in the same runtime package as D.
-     * <li>R is private and is declared in D.
-     * </ul>
-     * This discussion of access control omits a related restriction
-     * on the target of a protected field access or method invocation
-     * (the target must be of class D or a subtype of D). That
-     * requirement is checked as part of the verification process
-     * (5.4.1); it is not part of link-time access control.
-     * @param refc the class used in the symbolic reference to the proposed member
-     * @param defc the class in which the proposed member is actually defined
-     * @param mods modifier flags for the proposed member
-     * @param lookupClass the class for which the access check is being made
-     * @return true iff the the accessing class can access such a member
-     */
-    public static boolean isMemberAccessible(Class<?> refc,  // symbolic ref class
-                                             Class<?> defc,  // actual def class
-                                             int      mods,  // actual member mods
-                                             Class<?> lookupClass) {
-        // Usually refc and defc are the same, but if they differ, verify them both.
-        if (refc != defc) {
-            if (!isClassAccessible(refc, lookupClass)) {
-                // Note that defc is verified in the switch below.
-                return false;
-            }
-            if ((mods & (ALL_ACCESS_MODES|STATIC)) == (PROTECTED|STATIC)) {
-                // Apply the special rules for refc here.
-                if (!isRelatedClass(refc, lookupClass))
-                    return isSamePackage(defc, lookupClass);
-                // If refc == defc, the call to isPublicSuperClass will do
-                // the whole job, since in that case refc (as defc) will be
-                // a superclass of the lookup class.
-            }
-        }
-        if (defc == lookupClass)
-            return true;        // easy check; all self-access is OK
-        switch (mods & ALL_ACCESS_MODES) {
-        case PUBLIC:
-            if (refc != defc)  return true;  // already checked above
-            return isClassAccessible(refc, lookupClass);
-        case PROTECTED:
-            return isSamePackage(defc, lookupClass) || isPublicSuperClass(defc, lookupClass);
-        case PACKAGE_ONLY:
-            return isSamePackage(defc, lookupClass);
-        case PRIVATE:
-            // Loosened rules for privates follows access rules for inner classes.
-            return (ALLOW_NESTMATE_ACCESS &&
-                    isSamePackageMember(defc, lookupClass));
-        default:
-            throw new IllegalArgumentException("bad modifiers: "+Modifier.toString(mods));
-        }
-    }
-
-    static boolean isRelatedClass(Class<?> refc, Class<?> lookupClass) {
-        return (refc == lookupClass ||
-                refc.isAssignableFrom(lookupClass) ||
-                lookupClass.isAssignableFrom(refc));
-    }
-
-    static boolean isPublicSuperClass(Class<?> defc, Class<?> lookupClass) {
-        return isPublic(defc.getModifiers()) && defc.isAssignableFrom(lookupClass);
-    }
-
-    /**
-     * Evaluate the JVM linkage rules for access to the given class on behalf of caller.
-     * <h3>JVM Specification, 5.4.4 "Access Control"</h3>
-     * A class or interface C is accessible to a class or interface D
-     * if and only if either of the following conditions are true:<ul>
-     * <li>C is public.
-     * <li>C and D are members of the same runtime package.
-     * </ul>
-     * @param refc the symbolic reference class to which access is being checked (C)
-     * @param lookupClass the class performing the lookup (D)
-     */
-    public static boolean isClassAccessible(Class<?> refc, Class<?> lookupClass) {
-        int mods = refc.getModifiers();
-        if (isPublic(mods))
-            return true;
-        if (isSamePackage(lookupClass, refc))
-            return true;
-        return false;
-    }
-
-    /**
-     * Test if two classes have the same class loader and package qualifier.
-     * @param class1
-     * @param class2
-     * @return whether they are in the same package
-     */
-    public static boolean isSamePackage(Class<?> class1, Class<?> class2) {
-        if (class1 == class2)
-            return true;
-        if (!loadersAreRelated(class1.getClassLoader(), class2.getClassLoader()))
-            return false;
-        String name1 = class1.getName(), name2 = class2.getName();
-        int dot = name1.lastIndexOf('.');
-        if (dot != name2.lastIndexOf('.'))
-            return false;
-        for (int i = 0; i < dot; i++) {
-            if (name1.charAt(i) != name2.charAt(i))
-                return false;
-        }
-        return true;
-    }
-
-    /**
-     * Test if two classes are defined as part of the same package member (top-level class).
-     * If this is true, they can share private access with each other.
-     * @param class1
-     * @param class2
-     * @return whether they are identical or nested together
-     */
-    public static boolean isSamePackageMember(Class<?> class1, Class<?> class2) {
-        if (class1 == class2)
-            return true;
-        if (!isSamePackage(class1, class2))
-            return false;
-        if (getOutermostEnclosingClass(class1) != getOutermostEnclosingClass(class2))
-            return false;
-        return true;
-    }
-
-    private static Class<?> getOutermostEnclosingClass(Class<?> c) {
-        Class<?> pkgmem = c;
-        for (Class<?> enc = c; (enc = enc.getEnclosingClass()) != null; )
-            pkgmem = enc;
-        return pkgmem;
-    }
-
-    private static boolean loadersAreRelated(ClassLoader loader1, ClassLoader loader2) {
-        if (loader1 == loader2 || loader1 == null || loader2 == null) {
-            return true;
-        }
-        for (ClassLoader scan1 = loader1;
-                scan1 != null; scan1 = scan1.getParent()) {
-            if (scan1 == loader2)  return true;
-        }
-        for (ClassLoader scan2 = loader2;
-                scan2 != null; scan2 = scan2.getParent()) {
-            if (scan2 == loader1)  return true;
-        }
-        return false;
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/util/VerifyType.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn.util;
-
-import java.dyn.MethodType;
-import sun.dyn.empty.Empty;
-
-/**
- * This class centralizes information about the JVM verifier
- * and its requirements about type correctness.
- * @author jrose
- */
-public class VerifyType {
-
-    private VerifyType() { }  // cannot instantiate
-
-    /**
-     * True if a value can be stacked as the source type and unstacked as the
-     * destination type, without violating the JVM's type consistency.
-     *
-     * @param call the type of a stacked value
-     * @param recv the type by which we'd like to treat it
-     * @return whether the retyping can be done without motion or reformatting
-     */
-    public static boolean isNullConversion(Class<?> src, Class<?> dst) {
-        if (src == dst)            return true;
-        // Verifier allows any interface to be treated as Object:
-        if (dst.isInterface())     dst = Object.class;
-        if (src.isInterface())     src = Object.class;
-        if (src == dst)            return true;  // check again
-        if (dst == void.class)     return true;  // drop any return value
-        if (isNullType(src))       return !dst.isPrimitive();
-        if (!src.isPrimitive())    return dst.isAssignableFrom(src);
-        // Verifier allows an int to carry byte, short, char, or even boolean:
-        if (dst == int.class)      return Wrapper.forPrimitiveType(src).isSubwordOrInt();
-        return false;
-    }
-
-    /**
-     * Specialization of isNullConversion to reference types.
-
-     * @param call the type of a stacked value
-     * @param recv the reference type by which we'd like to treat it
-     * @return whether the retyping can be done without a cast
-     */
-    public static boolean isNullReferenceConversion(Class<?> src, Class<?> dst) {
-        assert(!dst.isPrimitive());
-        if (dst.isInterface())  return true;   // verifier allows this
-        if (isNullType(src))    return true;
-        return dst.isAssignableFrom(src);
-    }
-
-    /**
-     * Is the given type java.lang.Null or an equivalent null-only type?
-     */
-    public static boolean isNullType(Class<?> type) {
-        if (type == null)  return false;
-        return type == NULL_CLASS
-            // This one may also be used as a null type.
-            // TO DO: Decide if we really want to legitimize it here.
-            // Probably we do, unless java.lang.Null really makes it into Java 7
-            //|| type == Void.class
-            // Locally known null-only class:
-            || type == Empty.class
-            ;
-    }
-    private static final Class<?> NULL_CLASS;
-    static {
-        Class<?> nullClass = null;
-        try {
-            nullClass = Class.forName("java.lang.Null");
-        } catch (ClassNotFoundException ex) {
-            // OK, we'll cope
-        }
-        NULL_CLASS = nullClass;
-    }
-
-    /**
-     * True if a method handle can receive a call under a slightly different
-     * method type, without moving or reformatting any stack elements.
-     *
-     * @param call the type of call being made
-     * @param recv the type of the method handle receiving the call
-     * @return whether the retyping can be done without motion or reformatting
-     */
-    public static boolean isNullConversion(MethodType call, MethodType recv) {
-        if (call == recv)  return true;
-        int len = call.parameterCount();
-        if (len != recv.parameterCount())  return false;
-        for (int i = 0; i < len; i++)
-            if (!isNullConversion(call.parameterType(i), recv.parameterType(i)))
-                return false;
-        return isNullConversion(recv.returnType(), call.returnType());
-    }
-
-    //TO DO: isRawConversion
-
-    /**
-     * Determine if the JVM verifier allows a value of type call to be
-     * passed to a formal parameter (or return variable) of type recv.
-     * Returns 1 if the verifier allows the types to match without conversion.
-     * Returns -1 if the types can be made to match by a JVM-supported adapter.
-     * Cases supported are:
-     * <ul><li>checkcast
-     * </li><li>conversion between any two integral types (but not floats)
-     * </li><li>unboxing from a wrapper to its corresponding primitive type
-     * </li><li>conversion in either direction between float and double
-     * </li></ul>
-     * (Autoboxing is not supported here; it must be done via Java code.)
-     * Returns 0 otherwise.
-     */
-    public static int canPassUnchecked(Class<?> src, Class<?> dst) {
-        if (src == dst)
-            return 1;
-
-        if (dst.isPrimitive()) {
-            if (dst == void.class)
-                // Return anything to a caller expecting void.
-                // This is a property of the implementation, which links
-                // return values via a register rather than via a stack push.
-                // This makes it possible to ignore cleanly.
-                return 1;
-            if (src == void.class)
-                return 0;  // void-to-something?
-            if (!src.isPrimitive())
-                // Cannot pass a reference to any primitive type (exc. void).
-                return 0;
-            Wrapper sw = Wrapper.forPrimitiveType(src);
-            Wrapper dw = Wrapper.forPrimitiveType(dst);
-            if (sw.isSubwordOrInt() && dw.isSubwordOrInt()) {
-                if (sw.bitWidth() >= dw.bitWidth())
-                    return -1;   // truncation may be required
-                if (!dw.isSigned() && sw.isSigned())
-                    return -1;   // sign elimination may be required
-            }
-            if (src == float.class || dst == float.class) {
-                if (src == double.class || dst == double.class)
-                    return -1;   // floating conversion may be required
-                else
-                    return 0;    // other primitive conversions NYI
-            } else {
-                // all fixed-point conversions are supported
-                return 0;
-            }
-        } else if (src.isPrimitive()) {
-            // Cannot pass a primitive to any reference type.
-            // (Maybe allow null.class?)
-            return 0;
-        }
-
-        // Handle reference types in the rest of the block:
-
-        // The verifier treats interfaces exactly like Object.
-        if (isNullReferenceConversion(src, dst))
-            // pass any reference to object or an arb. interface
-            return 1;
-        // else it's a definite "maybe" (cast is required)
-        return -1;
-    }
-
-    public static int canPassRaw(Class<?> src, Class<?> dst) {
-        if (dst.isPrimitive()) {
-            if (dst == void.class)
-                // As above, return anything to a caller expecting void.
-                return 1;
-            if (src == void.class)
-                // Special permission for raw conversions: allow a void
-                // to be captured as a garbage int.
-                // Caller promises that the actual value will be disregarded.
-                return dst == int.class ? 1 : 0;
-            if (isNullType(src))
-                // Special permission for raw conversions: allow a null
-                // to be reinterpreted as anything.  For objects, it is safe,
-                // and for primitives you get a garbage value (probably zero).
-                return 1;
-            if (!src.isPrimitive())
-                return 0;
-            Wrapper sw = Wrapper.forPrimitiveType(src);
-            Wrapper dw = Wrapper.forPrimitiveType(dst);
-            if (sw.stackSlots() == dw.stackSlots())
-                return 1;  // can do a reinterpret-cast on a stacked primitive
-            if (sw.isSubwordOrInt() && dw == Wrapper.VOID)
-                return 1;  // can drop an outgoing int value
-            return 0;
-        } else if (src.isPrimitive()) {
-            return 0;
-        }
-
-        // Both references.
-        if (isNullReferenceConversion(src, dst))
-            return 1;
-        return -1;
-    }
-
-    public static boolean isSpreadArgType(Class<?> spreadArg) {
-        return spreadArg.isArray();
-    }
-    public static Class<?> spreadArgElementType(Class<?> spreadArg, int i) {
-        return spreadArg.getComponentType();
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/util/Wrapper.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,562 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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 sun.dyn.util;
-
-public enum Wrapper {
-    BOOLEAN(Boolean.class, boolean.class, 'Z', (Boolean)false, Format.unsigned(1)),
-    // These must be in the order defined for widening primitive conversions in JLS 5.1.2
-    BYTE(Byte.class, byte.class, 'B', (Byte)(byte)0, Format.signed(8)),
-    SHORT(Short.class, short.class, 'S', (Short)(short)0, Format.signed(16)),
-    CHAR(Character.class, char.class, 'C', (Character)(char)0, Format.unsigned(16)),
-    INT(Integer.class, int.class, 'I', (Integer)(int)0, Format.signed(32)),
-    LONG(Long.class, long.class, 'J', (Long)(long)0, Format.signed(64)),
-    FLOAT(Float.class, float.class, 'F', (Float)(float)0, Format.floating(32)),
-    DOUBLE(Double.class, double.class, 'D', (Double)(double)0, Format.floating(64)),
-    //NULL(Null.class, null.class, 'N', null, Format.other(1)),
-    OBJECT(Object.class, Object.class, 'L', null, Format.other(1)),
-    // VOID must be the last type, since it is "assignable" from any other type:
-    VOID(Void.class, void.class, 'V', null, Format.other(0)),
-    ;
-
-    private final Class<?> wrapperType;
-    private final Class<?> primitiveType;
-    private final char     basicTypeChar;
-    private final Object   zero;
-    private final int      format;
-    private final String   simpleName;
-
-    private Wrapper(Class<?> wtype, Class<?> ptype, char tchar, Object zero, int format) {
-        this.wrapperType = wtype;
-        this.primitiveType = ptype;
-        this.basicTypeChar = tchar;
-        this.zero = zero;
-        this.format = format;
-        this.simpleName = wtype.getSimpleName();
-    }
-
-    private static abstract class Format {
-        static final int SLOT_SHIFT = 0, SIZE_SHIFT = 2, KIND_SHIFT = 12;
-        static final int
-                SIGNED   = (-1) << KIND_SHIFT,
-                UNSIGNED = 0    << KIND_SHIFT,
-                FLOATING = 1    << KIND_SHIFT;
-        static final int
-                SLOT_MASK = ((1<<(SIZE_SHIFT-SLOT_SHIFT))-1),
-                SIZE_MASK = ((1<<(KIND_SHIFT-SIZE_SHIFT))-1);
-        static int format(int kind, int size, int slots) {
-            assert(((kind >> KIND_SHIFT) << KIND_SHIFT) == kind);
-            assert((size & (size-1)) == 0); // power of two
-            assert((kind == SIGNED)   ? (size > 0) :
-                   (kind == UNSIGNED) ? (size > 0) :
-                   (kind == FLOATING) ? (size == 32 || size == 64)  :
-                   false);
-            assert((slots == 2) ? (size == 64) :
-                   (slots == 1) ? (size <= 32) :
-                   false);
-            return kind | (size << SIZE_SHIFT) | (slots << SLOT_SHIFT);
-        }
-        static final int
-                INT      = SIGNED   | (32 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
-                SHORT    = SIGNED   | (16 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
-                BOOLEAN  = UNSIGNED | (1  << SIZE_SHIFT) | (1 << SLOT_SHIFT),
-                CHAR     = UNSIGNED | (16 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
-                FLOAT    = FLOATING | (32 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
-                VOID     = UNSIGNED | (0  << SIZE_SHIFT) | (0 << SLOT_SHIFT),
-                NUM_MASK = (-1) << SIZE_SHIFT;
-        static int signed(int size)   { return format(SIGNED,   size, (size > 32 ? 2 : 1)); }
-        static int unsigned(int size) { return format(UNSIGNED, size, (size > 32 ? 2 : 1)); }
-        static int floating(int size) { return format(FLOATING, size, (size > 32 ? 2 : 1)); }
-        static int other(int slots)   { return slots << SLOT_SHIFT; }
-    }
-
-    /// format queries:
-
-    /** How many bits are in the wrapped value?  Returns 0 for OBJECT or VOID. */
-    public int     bitWidth()      { return (format >> Format.SIZE_SHIFT) & Format.SIZE_MASK; }
-    /** How many JVM stack slots occupied by the wrapped value?  Returns 0 for VOID. */
-    public int     stackSlots()    { return (format >> Format.SLOT_SHIFT) & Format.SLOT_MASK; }
-    /** Does the wrapped value occupy a single JVM stack slot? */
-    public boolean isSingleWord()  { return (format & (1 << Format.SLOT_SHIFT)) != 0; }
-    /** Does the wrapped value occupy two JVM stack slots? */
-    public boolean isDoubleWord()  { return (format & (2 << Format.SLOT_SHIFT)) != 0; }
-    /** Is the wrapped type numeric (not void or object)? */
-    public boolean isNumeric()     { return (format & Format.NUM_MASK) != 0; }
-    /** Is the wrapped type a primitive other than float, double, or void? */
-    public boolean isIntegral()    { return isNumeric() && format < Format.FLOAT; }
-    /** Is the wrapped type one of int, boolean, byte, char, or short? */
-    public boolean isSubwordOrInt() { return isIntegral() && isSingleWord(); }
-    /* Is the wrapped value a signed integral type (one of byte, short, int, or long)? */
-    public boolean isSigned()      { return format < Format.VOID; }
-    /* Is the wrapped value an unsigned integral type (one of boolean or char)? */
-    public boolean isUnsigned()    { return format >= Format.BOOLEAN && format < Format.FLOAT; }
-    /** Is the wrapped type either float or double? */
-    public boolean isFloating()    { return format >= Format.FLOAT; }
-
-    /** Does the JVM verifier allow a variable of this wrapper's
-     *  primitive type to be assigned from a value of the given wrapper's primitive type?
-     *  Cases:
-     *  <ul>
-     *  <li>unboxing followed by widening primitive conversion
-     *  <li>any type converted to {@code void}
-     *  <li>boxing conversion followed by widening reference conversion to {@code Object}
-     *  <li>conversion of {@code boolean} to any type
-     *  </ul>
-     */
-    public boolean isConvertibleFrom(Wrapper source) {
-        if (this == source)  return true;
-        if (this.compareTo(source) < 0) {
-            // At best, this is a narrowing conversion.
-            return false;
-        }
-        if ((this.format ^ source.format) == (Format.SHORT ^ Format.CHAR)) {
-            assert (this == SHORT && source == CHAR) || (this == CHAR && source == SHORT);
-            return false;
-        }
-        return true;
-    }
-
-    /** Produce a zero value for the given wrapper type.
-     *  This will be a numeric zero for a number or character,
-     *  false for a boolean, and null for a reference or void.
-     *  The common thread is that this is what is contained
-     *  in a default-initialized variable of the given primitive
-     *  type.  (For void, it is what a reflective method returns
-     *  instead of no value at all.)
-     */
-    public Object zero() { return zero; }
-
-    /** Produce a zero value for the given wrapper type T.
-     *  The optional argument must a type compatible with this wrapper.
-     *  Equivalent to {@code this.cast(this.zero(), type)}.
-     */
-    public <T> T zero(Class<T> type) { return convert(zero, type); }
-
-//    /** Produce a wrapper for the given wrapper or primitive type. */
-//    public static Wrapper valueOf(Class<?> type) {
-//        if (isPrimitiveType(type))
-//            return forPrimitiveType(type);
-//        else
-//            return forWrapperType(type);
-//    }
-
-    /** Return the wrapper that wraps values of the given type.
-     *  The type may be {@code Object}, meaning the {@code OBJECT} wrapper.
-     *  Otherwise, the type must be a primitive.
-     *  @throws IllegalArgumentException for unexpected types
-     */
-    public static Wrapper forPrimitiveType(Class<?> type) {
-        Wrapper w = findPrimitiveType(type);
-        if (w != null)  return w;
-        if (type.isPrimitive())
-            throw new InternalError(); // redo hash function
-        throw newIllegalArgumentException("not primitive: "+type);
-    }
-
-    static Wrapper findPrimitiveType(Class<?> type) {
-        Wrapper w = FROM_PRIM[hashPrim(type)];
-        if (w != null && w.primitiveType == type) {
-            return w;
-        }
-        return null;
-    }
-
-    /** Return the wrapper that wraps values into the given wrapper type.
-     *  If it is {@code Object} or an interface, return {@code OBJECT}.
-     *  Otherwise, it must be a wrapper type.
-     *  The type must not be a primitive type.
-     *  @throws IllegalArgumentException for unexpected types
-     */
-    public static Wrapper forWrapperType(Class<?> type) {
-        Wrapper w = findWrapperType(type);
-        if (w != null)  return w;
-        for (Wrapper x : values())
-            if (x.wrapperType == type)
-                throw new InternalError(); // redo hash function
-        throw newIllegalArgumentException("not wrapper: "+type);
-    }
-
-    static Wrapper findWrapperType(Class<?> type) {
-        Wrapper w = FROM_WRAP[hashWrap(type)];
-        if (w != null && w.wrapperType == type) {
-            return w;
-        }
-        if (type.isInterface())
-            return OBJECT;
-        return null;
-    }
-
-    /** Return the wrapper that corresponds to the given bytecode
-     *  signature character.  Return {@code OBJECT} for the character 'L'.
-     *  @throws IllegalArgumentException for any non-signature character or {@code '['}.
-     */
-    public static Wrapper forBasicType(char type) {
-        Wrapper w = FROM_CHAR[hashChar(type)];
-        if (w != null && w.basicTypeChar == type) {
-            return w;
-        }
-        for (Wrapper x : values())
-            if (w.basicTypeChar == type)
-                throw new InternalError(); // redo hash function
-        throw newIllegalArgumentException("not basic type char: "+type);
-    }
-
-    /** Return the wrapper for the given type, if it is
-     *  a primitive type, else return {@code OBJECT}.
-     */
-    public static Wrapper forBasicType(Class<?> type) {
-        if (type.isPrimitive())
-            return forPrimitiveType(type);
-        return OBJECT;  // any reference, including wrappers or arrays
-    }
-
-    // Note on perfect hashes:
-    //   for signature chars c, do (c + (c >> 1)) % 16
-    //   for primitive type names n, do (n[0] + n[2]) % 16
-    // The type name hash works for both primitive and wrapper names.
-    // You can add "java/lang/Object" to the primitive names.
-    // But you add the wrapper name Object, use (n[2] + (3*n[1])) % 16.
-    private static final Wrapper[] FROM_PRIM = new Wrapper[16];
-    private static final Wrapper[] FROM_WRAP = new Wrapper[16];
-    private static final Wrapper[] FROM_CHAR = new Wrapper[16];
-    private static int hashPrim(Class<?> x) {
-        String xn = x.getName();
-        if (xn.length() < 3)  return 0;
-        return (xn.charAt(0) + xn.charAt(2)) % 16;
-    }
-    private static int hashWrap(Class<?> x) {
-        String xn = x.getName();
-        final int offset = 10; assert(offset == "java.lang.".length());
-        if (xn.length() < offset+3)  return 0;
-        return (3*xn.charAt(offset+1) + xn.charAt(offset+2)) % 16;
-    }
-    private static int hashChar(char x) {
-        return (x + (x >> 1)) % 16;
-    }
-    static {
-        for (Wrapper w : values()) {
-            int pi = hashPrim(w.primitiveType);
-            int wi = hashWrap(w.wrapperType);
-            int ci = hashChar(w.basicTypeChar);
-            assert(FROM_PRIM[pi] == null);
-            assert(FROM_WRAP[wi] == null);
-            assert(FROM_CHAR[ci] == null);
-            FROM_PRIM[pi] = w;
-            FROM_WRAP[wi] = w;
-            FROM_CHAR[ci] = w;
-        }
-        //assert(jdk.sun.dyn.util.WrapperTest.test(false));
-    }
-
-    /** What is the primitive type wrapped by this wrapper? */
-    public Class<?> primitiveType() { return primitiveType; }
-
-    /** What is the wrapper type for this wrapper? */
-    public Class<?> wrapperType() { return wrapperType; }
-
-    /** What is the wrapper type for this wrapper?
-     * Otherwise, the example type must be the wrapper type,
-     * or the corresponding primitive type.
-     * (For {@code OBJECT}, the example type can be any non-primitive,
-     * and is normalized to {@code Object.class}.)
-     * The resulting class type has the same type parameter.
-     */
-    public <T> Class<T> wrapperType(Class<T> exampleType) {
-        if (exampleType == wrapperType) {
-            return exampleType;
-        } else if (exampleType == primitiveType ||
-                   wrapperType == Object.class ||
-                   exampleType.isInterface()) {
-            return forceType(wrapperType, exampleType);
-        }
-        throw newClassCastException(exampleType, primitiveType);
-    }
-
-    private static ClassCastException newClassCastException(Class<?> actual, Class<?> expected) {
-        return new ClassCastException(actual + " is not compatible with " + expected);
-    }
-
-    /** If {@code type} is a primitive type, return the corresponding
-     *  wrapper type, else return {@code type} unchanged.
-     */
-    public static <T> Class<T> asWrapperType(Class<T> type) {
-        if (type.isPrimitive()) {
-            return forPrimitiveType(type).wrapperType(type);
-        }
-        return type;
-    }
-
-    /** If {@code type} is a wrapper type, return the corresponding
-     *  primitive type, else return {@code type} unchanged.
-     */
-    public static <T> Class<T> asPrimitiveType(Class<T> type) {
-        Wrapper w = findWrapperType(type);
-        if (w != null) {
-            return forceType(w.primitiveType(), type);
-        }
-        return type;
-    }
-
-    /** Query:  Is the given type a wrapper, such as {@code Integer} or {@code Void}? */
-    public static boolean isWrapperType(Class<?> type) {
-        return findWrapperType(type) != null;
-    }
-
-    /** Query:  Is the given type a primitive, such as {@code int} or {@code void}? */
-    public static boolean isPrimitiveType(Class<?> type) {
-        return type.isPrimitive();
-    }
-
-    /** What is the bytecode signature character for this type?
-     *  All non-primitives, including array types, report as 'L', the signature character for references.
-     */
-    public static char basicTypeChar(Class<?> type) {
-        if (!type.isPrimitive())
-            return 'L';
-        else
-            return forPrimitiveType(type).basicTypeChar();
-    }
-
-    /** What is the bytecode signature character for this wrapper's
-     *  primitive type?
-     */
-    public char basicTypeChar() { return basicTypeChar; }
-
-    /** What is the simple name of the wrapper type?
-     */
-    public String simpleName() { return simpleName; }
-
-//    /** Wrap a value in the given type, which may be either a primitive or wrapper type.
-//     *  Performs standard primitive conversions, including truncation and float conversions.
-//     */
-//    public static <T> T wrap(Object x, Class<T> type) {
-//        return Wrapper.valueOf(type).cast(x, type);
-//    }
-
-    /** Cast a wrapped value to the given type, which may be either a primitive or wrapper type.
-     *  The given target type must be this wrapper's primitive or wrapper type.
-     *  If this wrapper is OBJECT, the target type may also be an interface, perform no runtime check.
-     *  Performs standard primitive conversions, including truncation and float conversions.
-     *  The given type must be compatible with this wrapper.  That is, it must either
-     *  be the wrapper type (or a subtype, in the case of {@code OBJECT}) or else
-     *  it must be the wrapper's primitive type.
-     *  Primitive conversions are only performed if the given type is itself a primitive.
-     *  @throws ClassCastException if the given type is not compatible with this wrapper
-     */
-    public <T> T cast(Object x, Class<T> type) {
-        return convert(x, type, true);
-    }
-
-    /** Convert a wrapped value to the given type.
-     *  The given target type must be this wrapper's primitive or wrapper type.
-     *  This is equivalent to {@link #cast}, except that it refuses to perform
-     *  narrowing primitive conversions.
-     */
-    public <T> T convert(Object x, Class<T> type) {
-        return convert(x, type, false);
-    }
-
-    private <T> T convert(Object x, Class<T> type, boolean isCast) {
-        if (this == OBJECT) {
-            // If the target wrapper is OBJECT, just do a reference cast.
-            // If the target type is an interface, perform no runtime check.
-            // (This loophole is safe, and is allowed by the JVM verifier.)
-            // If the target type is a primitive, change it to a wrapper.
-            @SuppressWarnings("unchecked")
-            T result = (T) x;  // unchecked warning is expected here
-            return result;
-        }
-        Class<T> wtype = wrapperType(type);
-        if (wtype.isInstance(x)) {
-            @SuppressWarnings("unchecked")
-            T result = (T) x;  // unchecked warning is expected here
-            return result;
-        }
-        Class<?> sourceType = x.getClass();  // throw NPE if x is null
-        if (!isCast) {
-            Wrapper source = findWrapperType(sourceType);
-            if (source == null || !this.isConvertibleFrom(source)) {
-                throw newClassCastException(wtype, sourceType);
-            }
-        }
-        @SuppressWarnings("unchecked")
-        T result = (T) wrap(x);  // unchecked warning is expected here
-        assert result.getClass() == wtype;
-        return result;
-    }
-
-    /** Cast a reference type to another reference type.
-     * If the target type is an interface, perform no runtime check.
-     * (This loophole is safe, and is allowed by the JVM verifier.)
-     * If the target type is a primitive, change it to a wrapper.
-     */
-    static <T> Class<T> forceType(Class<?> type, Class<T> exampleType) {
-        boolean z = (type == exampleType ||
-               type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
-               exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
-               type == Object.class && !exampleType.isPrimitive());
-        if (!z)
-            System.out.println(type+" <= "+exampleType);
-        assert(type == exampleType ||
-               type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
-               exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
-               type == Object.class && !exampleType.isPrimitive());
-        @SuppressWarnings("unchecked")
-        Class<T> result = (Class<T>) type;  // unchecked warning is expected here
-        return result;
-    }
-
-    /** Wrap a value in this wrapper's type.
-     * Performs standard primitive conversions, including truncation and float conversions.
-     * Performs returns the unchanged reference for {@code OBJECT}.
-     * Returns null for {@code VOID}.
-     * Returns a zero value for a null input.
-     * @throws ClassCastException if this wrapper is numeric and the operand
-     *                            is not a number, character, boolean, or null
-     */
-    public Object wrap(Object x) {
-        // do non-numeric wrappers first
-        switch (basicTypeChar) {
-            case 'L': return x;
-            case 'V': return null;
-        }
-        Number xn = numberValue(x);
-        switch (basicTypeChar) {
-            case 'I': return Integer.valueOf(xn.intValue());
-            case 'J': return Long.valueOf(xn.longValue());
-            case 'F': return Float.valueOf(xn.floatValue());
-            case 'D': return Double.valueOf(xn.doubleValue());
-            case 'S': return Short.valueOf((short) xn.intValue());
-            case 'B': return Byte.valueOf((byte) xn.intValue());
-            case 'C': return Character.valueOf((char) xn.intValue());
-            case 'Z': return Boolean.valueOf(boolValue(xn.longValue()));
-        }
-        throw new InternalError("bad wrapper");
-    }
-
-    /** Wrap a value (an int or smaller value) in this wrapper's type.
-     * Performs standard primitive conversions, including truncation and float conversions.
-     * Produces an {@code Integer} for {@code OBJECT}, although the exact type
-     * of the operand is not known.
-     * Returns null for {@code VOID}.
-     */
-    public Object wrap(int x) {
-        if (basicTypeChar == 'L')  return (Integer)x;
-        switch (basicTypeChar) {
-            case 'L': throw newIllegalArgumentException("cannot wrap to object type");
-            case 'V': return null;
-            case 'I': return Integer.valueOf((int)x);
-            case 'J': return Long.valueOf(x);
-            case 'F': return Float.valueOf(x);
-            case 'D': return Double.valueOf(x);
-            case 'S': return Short.valueOf((short) x);
-            case 'B': return Byte.valueOf((byte) x);
-            case 'C': return Character.valueOf((char) x);
-            case 'Z': return Boolean.valueOf(boolValue(x));
-        }
-        throw new InternalError("bad wrapper");
-    }
-
-    /** Wrap a value (a long or smaller value) in this wrapper's type.
-     * Does not perform floating point conversion.
-     * Produces a {@code Long} for {@code OBJECT}, although the exact type
-     * of the operand is not known.
-     * Returns null for {@code VOID}.
-     */
-    public Object wrapRaw(long x) {
-        switch (basicTypeChar) {
-            case 'F':  return Float.valueOf(Float.intBitsToFloat((int)x));
-            case 'D':  return Double.valueOf(Double.longBitsToDouble(x));
-            case 'L':  // same as 'J':
-            case 'J':  return (Long) x;
-        }
-        // Other wrapping operations are just the same, given that the
-        // operand is already promoted to an int.
-        return wrap((int)x);
-    }
-
-    /** Produce bitwise value which encodes the given wrapped value.
-     * Does not perform floating point conversion.
-     * Returns zero for {@code VOID}.
-     */
-    public long unwrapRaw(Object x) {
-        switch (basicTypeChar) {
-            case 'F':  return Float.floatToRawIntBits((Float) x);
-            case 'D':  return Double.doubleToRawLongBits((Double) x);
-
-            case 'L': throw newIllegalArgumentException("cannot unwrap from sobject type");
-            case 'V': return 0;
-            case 'I': return (int)(Integer) x;
-            case 'J': return (long)(Long) x;
-            case 'S': return (short)(Short) x;
-            case 'B': return (byte)(Byte) x;
-            case 'C': return (char)(Character) x;
-            case 'Z': return (boolean)(Boolean) x ? 1 : 0;
-        }
-        throw new InternalError("bad wrapper");
-    }
-
-    /** Report what primitive type holds this guy's raw value. */
-    public Class<?> rawPrimitiveType() {
-        return rawPrimitive().primitiveType();
-    }
-
-    /** Report, as a wrapper, what primitive type holds this guy's raw value.
-     *  Returns self for INT, LONG, OBJECT; returns LONG for DOUBLE,
-     *  else returns INT.
-     */
-    public Wrapper rawPrimitive() {
-        switch (basicTypeChar) {
-            case 'S': case 'B':
-            case 'C': case 'Z':
-            case 'V':
-            case 'F':
-                return INT;
-            case 'D':
-                return LONG;
-        }
-        return this;
-    }
-
-    private static Number numberValue(Object x) {
-        if (x instanceof Number)     return (Number)x;
-        if (x instanceof Character)  return (int)(Character)x;
-        if (x instanceof Boolean)    return (Boolean)x ? 1 : 0;
-        // Remaining allowed case of void:  Must be a null reference.
-        return (Number)x;
-    }
-
-    private static boolean boolValue(long bits) {
-        //bits &= 1;  // simple 31-bit zero extension
-        return (bits != 0);
-    }
-
-    private static RuntimeException newIllegalArgumentException(String message, Object x) {
-        return newIllegalArgumentException(message + x);
-    }
-    private static RuntimeException newIllegalArgumentException(String message) {
-        return new IllegalArgumentException(message);
-    }
-}
--- a/jdk/src/share/classes/sun/dyn/util/package-info.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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.
- */
-
-/**
- * Extra support for using JSR 292 RI, package java.dyn.
- * @author jrose
- */
-
-package sun.dyn.util;
--- a/jdk/src/share/classes/sun/font/FileFont.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/font/FileFont.java	Thu Mar 31 22:07:32 2011 -0700
@@ -32,22 +32,13 @@
 import java.awt.geom.Rectangle2D;
 import java.io.File;
 import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
 import sun.java2d.Disposer;
 import sun.java2d.DisposerRecord;
 
-import java.lang.ref.WeakReference;
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteOrder;
-import java.nio.MappedByteBuffer;
-import java.nio.BufferUnderflowException;
-import java.nio.channels.ClosedChannelException;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.awt.Font;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 
 public abstract class FileFont extends PhysicalFont {
 
@@ -286,4 +277,49 @@
             });
         }
     }
+
+    protected String getPublicFileName() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            return platName;
+        }
+        boolean canReadProperty = true;
+
+        try {
+            sm.checkPropertyAccess("java.io.tmpdir");
+        } catch (SecurityException e) {
+            canReadProperty = false;
+        }
+
+        if (canReadProperty) {
+            return platName;
+        }
+
+        final File f = new File(platName);
+
+        Boolean isTmpFile = Boolean.FALSE;
+        try {
+            isTmpFile = AccessController.doPrivileged(
+                new PrivilegedExceptionAction<Boolean>() {
+                    public Boolean run() {
+                        File tmp = new File(System.getProperty("java.io.tmpdir"));
+                        try {
+                            String tpath = tmp.getCanonicalPath();
+                            String fpath = f.getCanonicalPath();
+
+                            return (fpath == null) || fpath.startsWith(tpath);
+                        } catch (IOException e) {
+                            return Boolean.TRUE;
+                        }
+                    }
+                }
+            );
+        } catch (PrivilegedActionException e) {
+            // unable to verify whether value of java.io.tempdir will be
+            // exposed, so return only a name of the font file.
+            isTmpFile = Boolean.TRUE;
+        }
+
+        return  isTmpFile ? "temp file" : platName;
+    }
 }
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	Thu Mar 31 22:07:32 2011 -0700
@@ -519,7 +519,8 @@
                 break;
 
             default:
-                throw new FontFormatException("Unsupported sfnt " + platName);
+                throw new FontFormatException("Unsupported sfnt " +
+                                              getPublicFileName());
             }
 
             /* Now have the offset of this TT font (possibly within a TTC)
@@ -1680,7 +1681,6 @@
     @Override
     public String toString() {
         return "** TrueType Font: Family="+familyName+ " Name="+fullName+
-            " style="+style+" fileName="+platName;
+            " style="+style+" fileName="+getPublicFileName();
     }
-
 }
--- a/jdk/src/share/classes/sun/font/Type1Font.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/font/Type1Font.java	Thu Mar 31 22:07:32 2011 -0700
@@ -677,6 +677,6 @@
 
     public String toString() {
         return "** Type1 Font: Family="+familyName+ " Name="+fullName+
-            " style="+style+" fileName="+platName;
+            " style="+style+" fileName="+getPublicFileName();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/WrapperInstance.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2011, 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 sun.invoke;
+
+import java.lang.invoke.MethodHandle;
+
+/**
+ * Private API used inside of java.lang.invoke.MethodHandles.
+ * Interface implemented by every object which is produced by
+ * {@link java.lang.invoke.MethodHandles#asInstance MethodHandles.asInstance}.
+ * The methods of this interface allow a caller to recover the parameters
+ * to {@code asInstance}.
+ * This allows applications to repeatedly convert between method handles
+ * and SAM objects, without the risk of creating unbounded delegation chains.
+ */
+public interface WrapperInstance {
+    /** Produce or recover a target method handle which is behaviorally
+     *  equivalent to the SAM method of this object.
+     */
+    public MethodHandle getWrapperInstanceTarget();
+    /** Recover the SAM type for which this object was created.
+     */
+    public Class<?> getWrapperInstanceType();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/anon/AnonymousClassLoader.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import sun.misc.IOUtils;
+
+/**
+ * Anonymous class loader.  Will load any valid classfile, producing
+ * a {@link Class} metaobject, without installing that class in the
+ * system dictionary.  Therefore, {@link Class#forName(String)} will never
+ * produce a reference to an anonymous class.
+ * <p>
+ * The access permissions of the anonymous class are borrowed from
+ * a <em>host class</em>.  The new class behaves as if it were an
+ * inner class of the host class.  It can access the host's private
+ * members, if the creator of the class loader has permission to
+ * do so (or to create accessible reflective objects).
+ * <p>
+ * When the anonymous class is loaded, elements of its constant pool
+ * can be patched to new values.  This provides a hook to pre-resolve
+ * named classes in the constant pool to other classes, including
+ * anonymous ones.  Also, string constants can be pre-resolved to
+ * any reference.  (The verifier treats non-string, non-class reference
+ * constants as plain objects.)
+ *  <p>
+ * Why include the patching function?  It makes some use cases much easier.
+ * Second, the constant pool needed some internal patching anyway,
+ * to anonymize the loaded class itself.  Finally, if you are going
+ * to use this seriously, you'll want to build anonymous classes
+ * on top of pre-existing anonymous classes, and that requires patching.
+ *
+ * <p>%%% TO-DO:
+ * <ul>
+ * <li>needs better documentation</li>
+ * <li>needs more security work (for safe delegation)</li>
+ * <li>needs a clearer story about error processing</li>
+ * <li>patch member references also (use ';' as delimiter char)</li>
+ * <li>patch method references to (conforming) method handles</li>
+ * </ul>
+ *
+ * @author jrose
+ * @author Remi Forax
+ * @see <a href="http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm">
+ *      http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm</a>
+ */
+
+public class AnonymousClassLoader {
+    final Class<?> hostClass;
+
+    // Note: Do not refactor the calls to checkHostClass unless you
+    //       also adjust this constant:
+    private static int CHC_CALLERS = 3;
+
+    public AnonymousClassLoader() {
+        this.hostClass = checkHostClass(null);
+    }
+    public AnonymousClassLoader(Class<?> hostClass) {
+        this.hostClass = checkHostClass(hostClass);
+    }
+
+    private static Class<?> getTopLevelClass(Class<?> clazz) {
+      for(Class<?> outer = clazz.getDeclaringClass(); outer != null;
+          outer = outer.getDeclaringClass()) {
+        clazz = outer;
+      }
+      return clazz;
+    }
+
+    private static Class<?> checkHostClass(Class<?> hostClass) {
+        // called only from the constructor
+        // does a context-sensitive check on caller class
+        // CC[0..3] = {Reflection, this.checkHostClass, this.<init>, caller}
+        Class<?> caller = sun.reflect.Reflection.getCallerClass(CHC_CALLERS);
+
+        if (caller == null) {
+            // called from the JVM directly
+            if (hostClass == null)
+                return AnonymousClassLoader.class; // anything central will do
+            return hostClass;
+        }
+
+        if (hostClass == null)
+            hostClass = caller; // default value is caller itself
+
+        // anonymous class will access hostClass on behalf of caller
+        Class<?> callee = hostClass;
+
+        if (caller == callee)
+            // caller can always nominate itself to grant caller's own access rights
+            return hostClass;
+
+        // normalize caller and callee to their top-level classes:
+        caller = getTopLevelClass(caller);
+        callee = getTopLevelClass(callee);
+        if (caller == callee)
+            return caller;
+
+        ClassLoader callerCL = caller.getClassLoader();
+        if (callerCL == null) {
+            // caller is trusted code, so accept the proposed hostClass
+            return hostClass;
+        }
+
+        // %%% should do something with doPrivileged, because trusted
+        // code should have a way to execute on behalf of
+        // partially-trusted clients
+
+        // Does the caller have the right to access the private
+        // members of the callee?  If not, raise an error.
+        final int ACC_PRIVATE = 2;
+        try {
+            sun.reflect.Reflection.ensureMemberAccess(caller, callee, null, ACC_PRIVATE);
+        } catch (IllegalAccessException ee) {
+            throw new IllegalArgumentException(ee);
+        }
+
+        return hostClass;
+    }
+
+    public Class<?> loadClass(byte[] classFile) {
+        if (defineAnonymousClass == null) {
+            // no JVM support; try to fake an approximation
+            try {
+                return fakeLoadClass(new ConstantPoolParser(classFile).createPatch());
+            } catch (InvalidConstantPoolFormatException ee) {
+                throw new IllegalArgumentException(ee);
+            }
+        }
+        return loadClass(classFile, null);
+    }
+
+    public Class<?> loadClass(ConstantPoolPatch classPatch) {
+        if (defineAnonymousClass == null) {
+            // no JVM support; try to fake an approximation
+            return fakeLoadClass(classPatch);
+        }
+        Object[] patches = classPatch.patchArray;
+        // Convert class names (this late in the game)
+        // to use slash '/' instead of dot '.'.
+        // Java likes dots, but the JVM likes slashes.
+        for (int i = 0; i < patches.length; i++) {
+            Object value = patches[i];
+            if (value != null) {
+                byte tag = classPatch.getTag(i);
+                switch (tag) {
+                case ConstantPoolVisitor.CONSTANT_Class:
+                    if (value instanceof String) {
+                        if (patches == classPatch.patchArray)
+                            patches = patches.clone();
+                        patches[i] = ((String)value).replace('.', '/');
+                    }
+                    break;
+                case ConstantPoolVisitor.CONSTANT_Fieldref:
+                case ConstantPoolVisitor.CONSTANT_Methodref:
+                case ConstantPoolVisitor.CONSTANT_InterfaceMethodref:
+                case ConstantPoolVisitor.CONSTANT_NameAndType:
+                    // When/if the JVM supports these patches,
+                    // we'll probably need to reformat them also.
+                    // Meanwhile, let the class loader create the error.
+                    break;
+                }
+            }
+        }
+        return loadClass(classPatch.outer.classFile, classPatch.patchArray);
+    }
+
+    private Class<?> loadClass(byte[] classFile, Object[] patchArray) {
+        try {
+            return (Class<?>)
+                defineAnonymousClass.invoke(unsafe,
+                                            hostClass, classFile, patchArray);
+        } catch (Exception ex) {
+            throwReflectedException(ex);
+            throw new RuntimeException("error loading into "+hostClass, ex);
+        }
+    }
+
+    private static void throwReflectedException(Exception ex) {
+        if (ex instanceof InvocationTargetException) {
+            Throwable tex = ((InvocationTargetException)ex).getTargetException();
+            if (tex instanceof Error)
+                throw (Error) tex;
+            ex = (Exception) tex;
+        }
+        if (ex instanceof RuntimeException) {
+            throw (RuntimeException) ex;
+        }
+    }
+
+    private Class<?> fakeLoadClass(ConstantPoolPatch classPatch) {
+        // Implementation:
+        // 1. Make up a new name nobody has used yet.
+        // 2. Inspect the tail-header of the class to find the this_class index.
+        // 3. Patch the CONSTANT_Class for this_class to the new name.
+        // 4. Add other CP entries required by (e.g.) string patches.
+        // 5. Flatten Class constants down to their names, making sure that
+        //    the host class loader can pick them up again accurately.
+        // 6. Generate the edited class file bytes.
+        //
+        // Potential limitations:
+        // * The class won't be truly anonymous, and may interfere with others.
+        // * Flattened class constants might not work, because of loader issues.
+        // * Pseudo-string constants will not flatten down to real strings.
+        // * Method handles will (of course) fail to flatten to linkage strings.
+        if (true)  throw new UnsupportedOperationException("NYI");
+        Object[] cpArray;
+        try {
+            cpArray = classPatch.getOriginalCP();
+        } catch (InvalidConstantPoolFormatException ex) {
+            throw new RuntimeException(ex);
+        }
+        int thisClassIndex = classPatch.getParser().getThisClassIndex();
+        String thisClassName = (String) cpArray[thisClassIndex];
+        synchronized (AnonymousClassLoader.class) {
+            thisClassName = thisClassName+"\\|"+(++fakeNameCounter);
+        }
+        classPatch.putUTF8(thisClassIndex, thisClassName);
+        byte[] classFile = null;
+        return unsafe.defineClass(null, classFile, 0, classFile.length,
+                                  hostClass.getClassLoader(),
+                                  hostClass.getProtectionDomain());
+    }
+    private static int fakeNameCounter = 99999;
+
+    // ignore two warnings on this line:
+    static sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
+    // preceding line requires that this class be on the boot class path
+
+    static private final Method defineAnonymousClass;
+    static {
+        Method dac = null;
+        Class<? extends sun.misc.Unsafe> unsafeClass = unsafe.getClass();
+        try {
+            dac = unsafeClass.getMethod("defineAnonymousClass",
+                                        Class.class,
+                                        byte[].class,
+                                        Object[].class);
+        } catch (Exception ee) {
+            dac = null;
+        }
+        defineAnonymousClass = dac;
+    }
+
+    private static void noJVMSupport() {
+        throw new UnsupportedOperationException("no JVM support for anonymous classes");
+    }
+
+
+    private static native Class<?> loadClassInternal(Class<?> hostClass,
+                                                     byte[] classFile,
+                                                     Object[] patchArray);
+
+    public static byte[] readClassFile(Class<?> templateClass) throws IOException {
+        String templateName = templateClass.getName();
+        int lastDot = templateName.lastIndexOf('.');
+        java.net.URL url = templateClass.getResource(templateName.substring(lastDot+1)+".class");
+        java.net.URLConnection connection = url.openConnection();
+        int contentLength = connection.getContentLength();
+        if (contentLength < 0)
+            throw new IOException("invalid content length "+contentLength);
+
+        return IOUtils.readFully(connection.getInputStream(), contentLength, true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/anon/ConstantPoolParser.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+
+import static sun.invoke.anon.ConstantPoolVisitor.*;
+
+/** A constant pool parser.
+ */
+public class ConstantPoolParser {
+    final byte[] classFile;
+    final byte[] tags;
+    final char[] firstHeader;  // maghi, maglo, minor, major, cplen
+
+    // these are filled in on first parse:
+    int endOffset;
+    char[] secondHeader;       // flags, this_class, super_class, intlen
+
+    // used to decode UTF8 array
+    private char[] charArray = new char[80];
+
+    /** Creates a constant pool parser.
+     * @param classFile an array of bytes containing a class.
+     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
+     */
+    public ConstantPoolParser(byte[] classFile) throws InvalidConstantPoolFormatException {
+        this.classFile = classFile;
+        this.firstHeader = parseHeader(classFile);
+        this.tags = new byte[firstHeader[4]];
+    }
+
+    /** Create a constant pool parser by loading the bytecodes of the
+     *  class taken as argument.
+     *
+     * @param templateClass the class to parse.
+     *
+     * @throws IOException raised if an I/O occurs when loading
+     *  the bytecode of the template class.
+     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
+     *
+     * @see #ConstantPoolParser(byte[])
+     * @see AnonymousClassLoader#readClassFile(Class)
+     */
+    public ConstantPoolParser(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
+        this(AnonymousClassLoader.readClassFile(templateClass));
+    }
+
+    /** Creates an empty patch to patch the class file
+     *  used by the current parser.
+     * @return a new class patch.
+     */
+    public ConstantPoolPatch createPatch() {
+        return new ConstantPoolPatch(this);
+    }
+
+    /** Report the tag of the indicated CP entry.
+     * @param index
+     * @return one of {@link ConstantPoolVisitor#CONSTANT_Utf8}, etc.
+     */
+    public byte getTag(int index) {
+        getEndOffset();  // trigger an exception if we haven't parsed yet
+        return tags[index];
+    }
+
+    /** Report the length of the constant pool. */
+    public int getLength() {
+        return firstHeader[4];
+    }
+
+    /** Report the offset, within the class file, of the start of the constant pool. */
+    public int getStartOffset() {
+        return firstHeader.length * 2;
+    }
+
+    /** Report the offset, within the class file, of the end of the constant pool. */
+    public int getEndOffset() {
+        if (endOffset == 0)
+            throw new IllegalStateException("class file has not yet been parsed");
+        return endOffset;
+    }
+
+    /** Report the CP index of this class's own name. */
+    public int getThisClassIndex() {
+        getEndOffset();   // provoke exception if not yet parsed
+        return secondHeader[1];
+    }
+
+    /** Report the total size of the class file. */
+    public int getTailLength() {
+        return classFile.length - getEndOffset();
+    }
+
+    /** Write the head (header plus constant pool)
+     *  of the class file to the indicated stream.
+     */
+    public void writeHead(OutputStream out) throws IOException {
+        out.write(classFile, 0, getEndOffset());
+    }
+
+    /** Write the head (header plus constant pool)
+     *  of the class file to the indicated stream,
+     *  incorporating the non-null entries of the given array
+     *  as patches.
+     */
+    void writePatchedHead(OutputStream out, Object[] patchArray) {
+        // this will be useful to partially emulate the class loader on old JVMs
+        throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    /** Write the tail (everything after the constant pool)
+     *  of the class file to the indicated stream.
+     */
+    public void writeTail(OutputStream out) throws IOException {
+        out.write(classFile, getEndOffset(), getTailLength());
+    }
+
+    private static char[] parseHeader(byte[] classFile) throws InvalidConstantPoolFormatException {
+        char[] result = new char[5];
+        ByteBuffer buffer = ByteBuffer.wrap(classFile);
+        for (int i = 0; i < result.length; i++)
+            result[i] = (char) getUnsignedShort(buffer);
+        int magic = result[0] << 16 | result[1] << 0;
+        if (magic != 0xCAFEBABE)
+            throw new InvalidConstantPoolFormatException("invalid magic number "+magic);
+        // skip major, minor version
+        int len = result[4];
+        if (len < 1)
+            throw new InvalidConstantPoolFormatException("constant pool length < 1");
+        return result;
+    }
+
+    /** Parse the constant pool of the class
+     *  calling a method visit* each time a constant pool entry is parsed.
+     *
+     *  The order of the calls to visit* is not guaranteed to be the same
+     *  than the order of the constant pool entry in the bytecode array.
+     *
+     * @param visitor
+     * @throws InvalidConstantPoolFormatException
+     */
+    public void parse(ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
+        ByteBuffer buffer = ByteBuffer.wrap(classFile);
+        buffer.position(getStartOffset()); //skip header
+
+        Object[] values = new Object[getLength()];
+        try {
+            parseConstantPool(buffer, values, visitor);
+        } catch(BufferUnderflowException e) {
+            throw new InvalidConstantPoolFormatException(e);
+        }
+        if (endOffset == 0) {
+            endOffset = buffer.position();
+            secondHeader = new char[4];
+            for (int i = 0; i < secondHeader.length; i++) {
+                secondHeader[i] = (char) getUnsignedShort(buffer);
+            }
+        }
+        resolveConstantPool(values, visitor);
+    }
+
+    private char[] getCharArray(int utfLength) {
+        if (utfLength <= charArray.length)
+            return charArray;
+        return charArray = new char[utfLength];
+    }
+
+    private void parseConstantPool(ByteBuffer buffer, Object[] values, ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
+        for (int i = 1; i < tags.length; ) {
+            byte tag = (byte) getUnsignedByte(buffer);
+            assert(tags[i] == 0 || tags[i] == tag);
+            tags[i] = tag;
+            switch (tag) {
+                case CONSTANT_Utf8:
+                    int utfLen = getUnsignedShort(buffer);
+                    String value = getUTF8(buffer, utfLen, getCharArray(utfLen));
+                    visitor.visitUTF8(i, CONSTANT_Utf8, value);
+                    tags[i] = tag;
+                    values[i++] = value;
+                    break;
+                case CONSTANT_Integer:
+                    visitor.visitConstantValue(i, tag, buffer.getInt());
+                    i++;
+                    break;
+                case CONSTANT_Float:
+                    visitor.visitConstantValue(i, tag, buffer.getFloat());
+                    i++;
+                    break;
+                case CONSTANT_Long:
+                    visitor.visitConstantValue(i, tag, buffer.getLong());
+                    i+=2;
+                    break;
+                case CONSTANT_Double:
+                    visitor.visitConstantValue(i, tag, buffer.getDouble());
+                    i+=2;
+                    break;
+
+                case CONSTANT_Class:    // fall through:
+                case CONSTANT_String:
+                    tags[i] = tag;
+                    values[i++] = new int[] { getUnsignedShort(buffer) };
+                    break;
+
+                case CONSTANT_Fieldref:           // fall through:
+                case CONSTANT_Methodref:          // fall through:
+                case CONSTANT_InterfaceMethodref: // fall through:
+                case CONSTANT_NameAndType:
+                    tags[i] = tag;
+                    values[i++] = new int[] { getUnsignedShort(buffer), getUnsignedShort(buffer) };
+                    break;
+                default:
+                    throw new AssertionError("invalid constant "+tag);
+            }
+        }
+    }
+
+    private void resolveConstantPool(Object[] values, ConstantPoolVisitor visitor) {
+        // clean out the int[] values, which are temporary
+        for (int beg = 1, end = values.length-1, beg2, end2;
+             beg <= end;
+             beg = beg2, end = end2) {
+             beg2 = end; end2 = beg-1;
+             //System.out.println("CP resolve pass: "+beg+".."+end);
+             for (int i = beg; i <= end; i++) {
+                  Object value = values[i];
+                  if (!(value instanceof int[]))
+                      continue;
+                  int[] array = (int[]) value;
+                  byte tag = tags[i];
+                  switch (tag) {
+                      case CONSTANT_String:
+                          String stringBody = (String) values[array[0]];
+                          visitor.visitConstantString(i, tag, stringBody, array[0]);
+                          values[i] = null;
+                          break;
+                      case CONSTANT_Class: {
+                          String className = (String) values[array[0]];
+                          // use the external form favored by Class.forName:
+                          className = className.replace('/', '.');
+                          visitor.visitConstantString(i, tag, className, array[0]);
+                          values[i] = className;
+                          break;
+                      }
+                      case CONSTANT_NameAndType: {
+                          String memberName = (String) values[array[0]];
+                          String signature  = (String) values[array[1]];
+                          visitor.visitDescriptor(i, tag, memberName, signature,
+                                                  array[0], array[1]);
+                          values[i] = new String[] {memberName, signature};
+                          break;
+                      }
+                      case CONSTANT_Fieldref:           // fall through:
+                      case CONSTANT_Methodref:          // fall through:
+                      case CONSTANT_InterfaceMethodref: {
+                              Object className   = values[array[0]];
+                              Object nameAndType = values[array[1]];
+                              if (!(className instanceof String) ||
+                                  !(nameAndType instanceof String[])) {
+                                   // one more pass is needed
+                                   if (beg2 > i)  beg2 = i;
+                                   if (end2 < i)  end2 = i;
+                                   continue;
+                              }
+                              String[] nameAndTypeArray = (String[]) nameAndType;
+                              visitor.visitMemberRef(i, tag,
+                                  (String)className,
+                                  nameAndTypeArray[0],
+                                  nameAndTypeArray[1],
+                                  array[0], array[1]);
+                              values[i] = null;
+                          }
+                          break;
+                      default:
+                          continue;
+                }
+            }
+        }
+    }
+
+    private static int getUnsignedByte(ByteBuffer buffer) {
+        return buffer.get() & 0xFF;
+    }
+
+    private static int getUnsignedShort(ByteBuffer buffer) {
+        int b1 = getUnsignedByte(buffer);
+        int b2 = getUnsignedByte(buffer);
+        return (b1 << 8) + (b2 << 0);
+    }
+
+    private static String getUTF8(ByteBuffer buffer, int utfLen, char[] charArray) throws InvalidConstantPoolFormatException {
+      int utfLimit = buffer.position() + utfLen;
+      int index = 0;
+      while (buffer.position() < utfLimit) {
+          int c = buffer.get() & 0xff;
+          if (c > 127) {
+              buffer.position(buffer.position() - 1);
+              return getUTF8Extended(buffer, utfLimit, charArray, index);
+          }
+          charArray[index++] = (char)c;
+      }
+      return new String(charArray, 0, index);
+    }
+
+    private static String getUTF8Extended(ByteBuffer buffer, int utfLimit, char[] charArray, int index) throws InvalidConstantPoolFormatException {
+        int c, c2, c3;
+        while (buffer.position() < utfLimit) {
+            c = buffer.get() & 0xff;
+            switch (c >> 4) {
+                case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
+                    /* 0xxxxxxx*/
+                    charArray[index++] = (char)c;
+                    break;
+                case 12: case 13:
+                    /* 110x xxxx   10xx xxxx*/
+                    c2 = buffer.get();
+                    if ((c2 & 0xC0) != 0x80)
+                        throw new InvalidConstantPoolFormatException(
+                            "malformed input around byte " + buffer.position());
+                     charArray[index++] = (char)(((c  & 0x1F) << 6) |
+                                                  (c2 & 0x3F));
+                    break;
+                case 14:
+                    /* 1110 xxxx  10xx xxxx  10xx xxxx */
+                    c2 = buffer.get();
+                    c3 = buffer.get();
+                    if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
+                       throw new InvalidConstantPoolFormatException(
+                          "malformed input around byte " + (buffer.position()));
+                    charArray[index++] = (char)(((c  & 0x0F) << 12) |
+                                                ((c2 & 0x3F) << 6)  |
+                                                ((c3 & 0x3F) << 0));
+                    break;
+                default:
+                    /* 10xx xxxx,  1111 xxxx */
+                    throw new InvalidConstantPoolFormatException(
+                        "malformed input around byte " + buffer.position());
+            }
+        }
+        // The number of chars produced may be less than utflen
+        return new String(charArray, 0, index);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/anon/ConstantPoolPatch.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,503 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+import static sun.invoke.anon.ConstantPoolVisitor.*;
+
+/** A class and its patched constant pool.
+ *
+ *  This class allow to modify (patch) a constant pool
+ *  by changing the value of its entry.
+ *  Entry are referenced using index that can be get
+ *  by parsing the constant pool using
+ *  {@link ConstantPoolParser#parse(ConstantPoolVisitor)}.
+ *
+ * @see ConstantPoolVisitor
+ * @see ConstantPoolParser#createPatch()
+ */
+public class ConstantPoolPatch {
+    final ConstantPoolParser outer;
+    final Object[] patchArray;
+
+    ConstantPoolPatch(ConstantPoolParser outer) {
+        this.outer      = outer;
+        this.patchArray = new Object[outer.getLength()];
+    }
+
+    /** Create a {@link ConstantPoolParser} and
+     *  a {@link ConstantPoolPatch} in one step.
+     *  Equivalent to {@code new ConstantPoolParser(classFile).createPatch()}.
+     *
+     * @param classFile an array of bytes containing a class.
+     * @see #ConstantPoolParser(Class)
+     */
+    public ConstantPoolPatch(byte[] classFile) throws InvalidConstantPoolFormatException {
+        this(new ConstantPoolParser(classFile));
+    }
+
+    /** Create a {@link ConstantPoolParser} and
+     *  a {@link ConstantPoolPatch} in one step.
+     *  Equivalent to {@code new ConstantPoolParser(templateClass).createPatch()}.
+     *
+     * @param templateClass the class to parse.
+     * @see #ConstantPoolParser(Class)
+     */
+    public ConstantPoolPatch(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
+        this(new ConstantPoolParser(templateClass));
+    }
+
+
+    /** Creates a patch from an existing patch.
+     *  All changes are copied from that patch.
+     * @param patch a patch
+     *
+     * @see ConstantPoolParser#createPatch()
+     */
+    public ConstantPoolPatch(ConstantPoolPatch patch) {
+        outer      = patch.outer;
+        patchArray = patch.patchArray.clone();
+    }
+
+    /** Which parser built this patch? */
+    public ConstantPoolParser getParser() {
+        return outer;
+    }
+
+    /** Report the tag at the given index in the constant pool. */
+    public byte getTag(int index) {
+        return outer.getTag(index);
+    }
+
+    /** Report the current patch at the given index of the constant pool.
+     *  Null means no patch will be made.
+     *  To observe the unpatched entry at the given index, use
+     *  {@link #getParser()}{@code .}@link ConstantPoolParser#parse(ConstantPoolVisitor)}
+     */
+    public Object getPatch(int index) {
+        Object value = patchArray[index];
+        if (value == null)  return null;
+        switch (getTag(index)) {
+        case CONSTANT_Fieldref:
+        case CONSTANT_Methodref:
+        case CONSTANT_InterfaceMethodref:
+            if (value instanceof String)
+                value = stripSemis(2, (String) value);
+            break;
+        case CONSTANT_NameAndType:
+            if (value instanceof String)
+                value = stripSemis(1, (String) value);
+            break;
+        }
+        return value;
+    }
+
+    /** Clear all patches. */
+    public void clear() {
+        Arrays.fill(patchArray, null);
+    }
+
+    /** Clear one patch. */
+    public void clear(int index) {
+        patchArray[index] = null;
+    }
+
+    /** Produce the patches as an array. */
+    public Object[] getPatches() {
+        return patchArray.clone();
+    }
+
+    /** Produce the original constant pool as an array. */
+    public Object[] getOriginalCP() throws InvalidConstantPoolFormatException {
+        return getOriginalCP(0, patchArray.length, -1);
+    }
+
+    /** Walk the constant pool, applying patches using the given map.
+     *
+     * @param utf8Map Utf8 strings to modify, if encountered
+     * @param classMap Classes (or their names) to modify, if encountered
+     * @param valueMap Constant values to modify, if encountered
+     * @param deleteUsedEntries if true, delete map entries that are used
+     */
+    public void putPatches(final Map<String,String> utf8Map,
+                           final Map<String,Object> classMap,
+                           final Map<Object,Object> valueMap,
+                           boolean deleteUsedEntries) throws InvalidConstantPoolFormatException {
+        final HashSet<String> usedUtf8Keys;
+        final HashSet<String> usedClassKeys;
+        final HashSet<Object> usedValueKeys;
+        if (deleteUsedEntries) {
+            usedUtf8Keys  = (utf8Map  == null) ? null : new HashSet<String>();
+            usedClassKeys = (classMap == null) ? null : new HashSet<String>();
+            usedValueKeys = (valueMap == null) ? null : new HashSet<Object>();
+        } else {
+            usedUtf8Keys = null;
+            usedClassKeys = null;
+            usedValueKeys = null;
+        }
+
+        outer.parse(new ConstantPoolVisitor() {
+
+            @Override
+            public void visitUTF8(int index, byte tag, String utf8) {
+                putUTF8(index, utf8Map.get(utf8));
+                if (usedUtf8Keys != null)  usedUtf8Keys.add(utf8);
+            }
+
+            @Override
+            public void visitConstantValue(int index, byte tag, Object value) {
+                putConstantValue(index, tag, valueMap.get(value));
+                if (usedValueKeys != null)  usedValueKeys.add(value);
+            }
+
+            @Override
+            public void visitConstantString(int index, byte tag, String name, int nameIndex) {
+                if (tag == CONSTANT_Class) {
+                    putConstantValue(index, tag, classMap.get(name));
+                    if (usedClassKeys != null)  usedClassKeys.add(name);
+                } else {
+                    assert(tag == CONSTANT_String);
+                    visitConstantValue(index, tag, name);
+                }
+            }
+        });
+        if (usedUtf8Keys != null)   utf8Map.keySet().removeAll(usedUtf8Keys);
+        if (usedClassKeys != null)  classMap.keySet().removeAll(usedClassKeys);
+        if (usedValueKeys != null)  valueMap.keySet().removeAll(usedValueKeys);
+    }
+
+    Object[] getOriginalCP(final int startIndex,
+                           final int endIndex,
+                           final int tagMask) throws InvalidConstantPoolFormatException {
+        final Object[] cpArray = new Object[endIndex - startIndex];
+        outer.parse(new ConstantPoolVisitor() {
+
+            void show(int index, byte tag, Object value) {
+                if (index < startIndex || index >= endIndex)  return;
+                if (((1 << tag) & tagMask) == 0)  return;
+                cpArray[index - startIndex] = value;
+            }
+
+            @Override
+            public void visitUTF8(int index, byte tag, String utf8) {
+                show(index, tag, utf8);
+            }
+
+            @Override
+            public void visitConstantValue(int index, byte tag, Object value) {
+                assert(tag != CONSTANT_String);
+                show(index, tag, value);
+            }
+
+            @Override
+            public void visitConstantString(int index, byte tag,
+                                            String value, int j) {
+                show(index, tag, value);
+            }
+
+            @Override
+            public void visitMemberRef(int index, byte tag,
+                    String className, String memberName,
+                    String signature,
+                    int j, int k) {
+                show(index, tag, new String[]{ className, memberName, signature });
+            }
+
+            @Override
+            public void visitDescriptor(int index, byte tag,
+                    String memberName, String signature,
+                    int j, int k) {
+                show(index, tag, new String[]{ memberName, signature });
+            }
+        });
+        return cpArray;
+    }
+
+    /** Write the head (header plus constant pool)
+     *  of the patched class file to the indicated stream.
+     */
+    void writeHead(OutputStream out) throws IOException {
+        outer.writePatchedHead(out, patchArray);
+    }
+
+    /** Write the tail (everything after the constant pool)
+     *  of the patched class file to the indicated stream.
+     */
+    void writeTail(OutputStream out) throws IOException {
+        outer.writeTail(out);
+    }
+
+    private void checkConstantTag(byte tag, Object value) {
+        if (value == null)
+            throw new IllegalArgumentException(
+                    "invalid null constant value");
+        if (classForTag(tag) != value.getClass())
+            throw new IllegalArgumentException(
+                    "invalid constant value"
+                    + (tag == CONSTANT_None ? ""
+                        : " for tag "+tagName(tag))
+                    + " of class "+value.getClass());
+    }
+
+    private void checkTag(int index, byte putTag) {
+        byte tag = outer.tags[index];
+        if (tag != putTag)
+            throw new IllegalArgumentException(
+                "invalid put operation"
+                + " for " + tagName(putTag)
+                + " at index " + index + " found " + tagName(tag));
+    }
+
+    private void checkTagMask(int index, int tagBitMask) {
+        byte tag = outer.tags[index];
+        int tagBit = ((tag & 0x1F) == tag) ? (1 << tag) : 0;
+        if ((tagBit & tagBitMask) == 0)
+            throw new IllegalArgumentException(
+                "invalid put operation"
+                + " at index " + index + " found " + tagName(tag));
+    }
+
+    private static void checkMemberName(String memberName) {
+        if (memberName.indexOf(';') >= 0)
+            throw new IllegalArgumentException("memberName " + memberName + " contains a ';'");
+    }
+
+    /** Set the entry of the constant pool indexed by index to
+     *  a new string.
+     *
+     * @param index an index to a constant pool entry containing a
+     *        {@link ConstantPoolVisitor#CONSTANT_Utf8} value.
+     * @param utf8 a string
+     *
+     * @see ConstantPoolVisitor#visitUTF8(int, byte, String)
+     */
+    public void putUTF8(int index, String utf8) {
+        if (utf8 == null) { clear(index); return; }
+        checkTag(index, CONSTANT_Utf8);
+        patchArray[index] = utf8;
+    }
+
+    /** Set the entry of the constant pool indexed by index to
+     *  a new value, depending on its dynamic type.
+     *
+     * @param index an index to a constant pool entry containing a
+     *        one of the following structures:
+     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
+     *        {@link ConstantPoolVisitor#CONSTANT_Float},
+     *        {@link ConstantPoolVisitor#CONSTANT_Long},
+     *        {@link ConstantPoolVisitor#CONSTANT_Double},
+     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
+     *        {@link ConstantPoolVisitor#CONSTANT_Class}
+     * @param value a boxed int, float, long or double; or a string or class object
+     * @throws IllegalArgumentException if the type of the constant does not
+     *         match the constant pool entry type,
+     *         as reported by {@link #getTag(int)}
+     *
+     * @see #putConstantValue(int, byte, Object)
+     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
+     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
+     */
+    public void putConstantValue(int index, Object value) {
+        if (value == null) { clear(index); return; }
+        byte tag = tagForConstant(value.getClass());
+        checkConstantTag(tag, value);
+        checkTag(index, tag);
+        patchArray[index] = value;
+    }
+
+    /** Set the entry of the constant pool indexed by index to
+     *  a new value.
+     *
+     * @param index an index to a constant pool entry matching the given tag
+     * @param tag one of the following values:
+     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
+     *        {@link ConstantPoolVisitor#CONSTANT_Float},
+     *        {@link ConstantPoolVisitor#CONSTANT_Long},
+     *        {@link ConstantPoolVisitor#CONSTANT_Double},
+     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
+     *        {@link ConstantPoolVisitor#CONSTANT_Class}
+     * @param value a boxed number, string, or class object
+     * @throws IllegalArgumentException if the type of the constant does not
+     *         match the constant pool entry type, or if a class name contains
+     *         '/' or ';'
+     *
+     * @see #putConstantValue(int, Object)
+     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
+     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
+     */
+    public void putConstantValue(int index, byte tag, Object value) {
+        if (value == null) { clear(index); return; }
+        checkTag(index, tag);
+        if (tag == CONSTANT_Class && value instanceof String) {
+            checkClassName((String) value);
+        } else if (tag == CONSTANT_String) {
+            // the JVM accepts any object as a patch for a string
+        } else {
+            // make sure the incoming value is the right type
+            checkConstantTag(tag, value);
+        }
+        checkTag(index, tag);
+        patchArray[index] = value;
+    }
+
+    /** Set the entry of the constant pool indexed by index to
+     *  a new {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
+     *
+     * @param index an index to a constant pool entry containing a
+     *        {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
+     * @param memberName a memberName
+     * @param signature a signature
+     * @throws IllegalArgumentException if memberName contains the character ';'
+     *
+     * @see ConstantPoolVisitor#visitDescriptor(int, byte, String, String, int, int)
+     */
+    public void putDescriptor(int index, String memberName, String signature) {
+        checkTag(index, CONSTANT_NameAndType);
+        checkMemberName(memberName);
+        patchArray[index] = addSemis(memberName, signature);
+    }
+
+    /** Set the entry of the constant pool indexed by index to
+     *  a new {@link ConstantPoolVisitor#CONSTANT_Fieldref},
+     *  {@link ConstantPoolVisitor#CONSTANT_Methodref}, or
+     *  {@link ConstantPoolVisitor#CONSTANT_InterfaceMethodref} value.
+     *
+     * @param index an index to a constant pool entry containing a member reference
+     * @param className a class name
+     * @param memberName a field or method name
+     * @param signature a field or method signature
+     * @throws IllegalArgumentException if memberName contains the character ';'
+     *             or signature is not a correct signature
+     *
+     * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
+     */
+    public void putMemberRef(int index, byte tag,
+                    String className, String memberName, String signature) {
+        checkTagMask(tag, CONSTANT_MemberRef_MASK);
+        checkTag(index, tag);
+        checkClassName(className);
+        checkMemberName(memberName);
+        if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
+            throw new IllegalArgumentException("bad signature: "+signature);
+        patchArray[index] = addSemis(className, memberName, signature);
+    }
+
+    static private final int CONSTANT_MemberRef_MASK =
+              CONSTANT_Fieldref
+            | CONSTANT_Methodref
+            | CONSTANT_InterfaceMethodref;
+
+    private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
+        = new IdentityHashMap<Class<?>, Byte>();
+    private static final Class[] CONSTANT_VALUE_CLASS = new Class[16];
+    static {
+        Object[][] values = {
+            {Integer.class, CONSTANT_Integer},
+            {Long.class, CONSTANT_Long},
+            {Float.class, CONSTANT_Float},
+            {Double.class, CONSTANT_Double},
+            {String.class, CONSTANT_String},
+            {Class.class, CONSTANT_Class}
+        };
+        for (Object[] value : values) {
+            Class<?> cls = (Class<?>)value[0];
+            Byte     tag = (Byte) value[1];
+            CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
+            CONSTANT_VALUE_CLASS[(byte)tag] = cls;
+        }
+    }
+
+    static Class<?> classForTag(byte tag) {
+        if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
+            return null;
+        return CONSTANT_VALUE_CLASS[tag];
+    }
+
+    static byte tagForConstant(Class<?> cls) {
+        Byte tag = CONSTANT_VALUE_CLASS_TAG.get(cls);
+        return (tag == null) ? CONSTANT_None : (byte)tag;
+    }
+
+    private static void checkClassName(String className) {
+        if (className.indexOf('/') >= 0 || className.indexOf(';') >= 0)
+            throw new IllegalArgumentException("invalid class name " + className);
+    }
+
+    static String addSemis(String name, String... names) {
+        StringBuilder buf = new StringBuilder(name.length() * 5);
+        buf.append(name);
+        for (String name2 : names) {
+            buf.append(';').append(name2);
+        }
+        String res = buf.toString();
+        assert(stripSemis(names.length, res)[0].equals(name));
+        assert(stripSemis(names.length, res)[1].equals(names[0]));
+        assert(names.length == 1 ||
+               stripSemis(names.length, res)[2].equals(names[1]));
+        return res;
+    }
+
+    static String[] stripSemis(int count, String string) {
+        String[] res = new String[count+1];
+        int pos = 0;
+        for (int i = 0; i < count; i++) {
+            int pos2 = string.indexOf(';', pos);
+            if (pos2 < 0)  pos2 = string.length();  // yuck
+            res[i] = string.substring(pos, pos2);
+            pos = pos2;
+        }
+        res[count] = string.substring(pos);
+        return res;
+    }
+
+    public String toString() {
+        StringBuilder buf = new StringBuilder(this.getClass().getName());
+        buf.append("{");
+        Object[] origCP = null;
+        for (int i = 0; i < patchArray.length; i++) {
+            if (patchArray[i] == null)  continue;
+            if (origCP != null) {
+                buf.append(", ");
+            } else {
+                try {
+                    origCP = getOriginalCP();
+                } catch (InvalidConstantPoolFormatException ee) {
+                    origCP = new Object[0];
+                }
+            }
+            Object orig = (i < origCP.length) ? origCP[i] : "?";
+            buf.append(orig).append("=").append(patchArray[i]);
+        }
+        buf.append("}");
+        return buf.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/anon/ConstantPoolVisitor.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
+
+/**
+ * A visitor called by {@link ConstantPoolParser#parse(ConstantPoolVisitor)}
+ * when a constant pool entry is parsed.
+ * <p>
+ * A visit* method is called when a constant pool entry is parsed.
+ * The first argument is always the constant pool index.
+ * The second argument is always the constant pool tag,
+ * even for methods like {@link #visitUTF8(int, byte, String)} which only apply to one tag.
+ * String arguments refer to Utf8 or NameAndType entries declared elsewhere,
+ * and are always accompanied by the indexes of those entries.
+ * <p>
+ * The order of the calls to the visit* methods is not necessarily related
+ * to the order of the entries in the constant pool.
+ * If one entry has a reference to another entry, the latter (lower-level)
+ * entry will be visited first.
+ * <p>
+ * The following table shows the relation between constant pool entry
+ * types and the corresponding visit* methods:
+ *
+ * <table border=1 cellpadding=5 summary="constant pool visitor methods">
+ * <tr><th>Tag(s)</th><th>Method</th></tr>
+ * <tr>
+ *   <td>{@link #CONSTANT_Utf8}</td>
+ *   <td>{@link #visitUTF8(int, byte, String)}</td>
+ * </tr><tr>
+ *   <td>{@link #CONSTANT_Integer}, {@link #CONSTANT_Float},
+ *       {@link #CONSTANT_Long}, {@link #CONSTANT_Double}</td>
+ *   <td>{@link #visitConstantValue(int, byte, Object)}</td>
+ * </tr><tr>
+ *   <td>{@link #CONSTANT_String}, {@link #CONSTANT_Class}</td>
+ *   <td>{@link #visitConstantString(int, byte, String, int)}</td>
+ * </tr><tr>
+ *   <td>{@link #CONSTANT_NameAndType}</td>
+ *   <td>{@link #visitDescriptor(int, byte, String, String, int, int)}</td>
+ * </tr><tr>
+ *   <td>{@link #CONSTANT_Fieldref},
+ *       {@link #CONSTANT_Methodref},
+ *       {@link #CONSTANT_InterfaceMethodref}</td>
+ *   <td>{@link #visitMemberRef(int, byte, String, String, String, int, int)}</td>
+ * </tr>
+ * </table>
+ *
+ * @see ConstantPoolPatch
+ * @author Remi Forax
+ * @author jrose
+ */
+public class ConstantPoolVisitor {
+  /** Called each time an UTF8 constant pool entry is found.
+   * @param index the constant pool index
+   * @param tag always {@link #CONSTANT_Utf8}
+   * @param utf8 string encoded in modified UTF-8 format passed as a {@code String}
+   *
+   * @see ConstantPoolPatch#putUTF8(int, String)
+   */
+  public void visitUTF8(int index, byte tag, String utf8) {
+    // do nothing
+  }
+
+  /** Called for each constant pool entry that encodes an integer,
+   *  a float, a long, or a double.
+   *  Constant strings and classes are not managed by this method but
+   *  by {@link #visitConstantString(int, byte, String, int)}.
+   *
+   * @param index the constant pool index
+   * @param tag one of {@link #CONSTANT_Integer},
+   *            {@link #CONSTANT_Float},
+   *            {@link #CONSTANT_Long},
+   *            or {@link #CONSTANT_Double}
+   * @param value encoded value
+   *
+   * @see ConstantPoolPatch#putConstantValue(int, Object)
+   */
+  public void visitConstantValue(int index, byte tag, Object value) {
+    // do nothing
+  }
+
+  /** Called for each constant pool entry that encodes a string or a class.
+   * @param index the constant pool index
+   * @param tag one of {@link #CONSTANT_String},
+   *            {@link #CONSTANT_Class},
+   * @param name string body or class name (using dot separator)
+   * @param nameIndex the index of the Utf8 string for the name
+   *
+   * @see ConstantPoolPatch#putConstantValue(int, byte, Object)
+   */
+  public void visitConstantString(int index, byte tag,
+                                  String name, int nameIndex) {
+    // do nothing
+  }
+
+  /** Called for each constant pool entry that encodes a name and type.
+   * @param index the constant pool index
+   * @param tag always {@link #CONSTANT_NameAndType}
+   * @param memberName a field or method name
+   * @param signature the member signature
+   * @param memberNameIndex index of the Utf8 string for the member name
+   * @param signatureIndex index of the Utf8 string for the signature
+   *
+   * @see ConstantPoolPatch#putDescriptor(int, String, String)
+   */
+  public void visitDescriptor(int index, byte tag,
+                              String memberName, String signature,
+                              int memberNameIndex, int signatureIndex) {
+    // do nothing
+  }
+
+  /** Called for each constant pool entry that encodes a field or method.
+   * @param index the constant pool index
+   * @param tag one of {@link #CONSTANT_Fieldref},
+   *            or {@link #CONSTANT_Methodref},
+   *            or {@link #CONSTANT_InterfaceMethodref}
+   * @param className the class name (using dot separator)
+   * @param memberName name of the field or method
+   * @param signature the field or method signature
+   * @param classNameIndex index of the Utf8 string for the class name
+   * @param descriptorIndex index of the NameAndType descriptor constant
+   *
+   * @see ConstantPoolPatch#putMemberRef(int, byte, String, String, String)
+   */
+  public void visitMemberRef(int index, byte tag,
+                             String className, String memberName, String signature,
+                             int classNameIndex, int descriptorIndex) {
+    // do nothing
+  }
+
+    public static final byte
+      CONSTANT_None = 0,
+      CONSTANT_Utf8 = 1,
+      //CONSTANT_Unicode = 2,               /* unused */
+      CONSTANT_Integer = 3,
+      CONSTANT_Float = 4,
+      CONSTANT_Long = 5,
+      CONSTANT_Double = 6,
+      CONSTANT_Class = 7,
+      CONSTANT_String = 8,
+      CONSTANT_Fieldref = 9,
+      CONSTANT_Methodref = 10,
+      CONSTANT_InterfaceMethodref = 11,
+      CONSTANT_NameAndType = 12;
+
+    private static String[] TAG_NAMES = {
+        "Empty",
+        "Utf8",
+        null, //"Unicode",
+        "Integer",
+        "Float",
+        "Long",
+        "Double",
+        "Class",
+        "String",
+        "Fieldref",
+        "Methodref",
+        "InterfaceMethodref",
+        "NameAndType"
+    };
+
+    public static String tagName(byte tag) {
+        String name = null;
+        if ((tag & 0xFF) < TAG_NAMES.length)
+            name = TAG_NAMES[tag];
+        if (name == null)
+            name = "Unknown#"+(tag&0xFF);
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/anon/InvalidConstantPoolFormatException.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
+
+/** Exception used when there is an error in the constant pool
+ *  format.
+ */
+public class InvalidConstantPoolFormatException extends Exception {
+    private static final long serialVersionUID=-6103888330523770949L;
+
+    public InvalidConstantPoolFormatException(String message,Throwable cause) {
+        super(message,cause);
+    }
+
+    public InvalidConstantPoolFormatException(String message) {
+        super(message);
+    }
+
+    public InvalidConstantPoolFormatException(Throwable cause) {
+        super(cause);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/empty/Empty.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2009, 2011, 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 sun.invoke.empty;
+
+/**
+ * An empty class in an empty package.
+ * Used as a proxy for unprivileged code, since making access checks
+ * against it will only succeed against public methods in public types.
+ * <p>
+ * This class also stands (internally to sun.invoke) for the type of a
+ * value that cannot be produced, because the expression of this type
+ * always returns abnormally.  (Cf. Nothing in the closures proposal.)
+ * @author jrose
+ */
+public class Empty {
+    private Empty() { throw new InternalError(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/package-info.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2008, 2010, 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.
+ */
+
+/**
+ * Implementation details for JSR 292 RI, package java.lang.invoke.
+ * @author jrose
+ */
+
+package sun.invoke;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/BytecodeDescriptor.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.util;
+
+import java.lang.invoke.MethodType;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Utility routines for dealing with bytecode-level signatures.
+ * @author jrose
+ */
+public class BytecodeDescriptor {
+
+    private BytecodeDescriptor() { }  // cannot instantiate
+
+    public static List<Class<?>> parseMethod(String bytecodeSignature, ClassLoader loader) {
+        return parseMethod(bytecodeSignature, 0, bytecodeSignature.length(), loader);
+    }
+
+    static List<Class<?>> parseMethod(String bytecodeSignature,
+            int start, int end, ClassLoader loader) {
+        if (loader == null)
+            loader = ClassLoader.getSystemClassLoader();
+        String str = bytecodeSignature;
+        int[] i = {start};
+        ArrayList<Class<?>> ptypes = new ArrayList<Class<?>>();
+        if (i[0] < end && str.charAt(i[0]) == '(') {
+            ++i[0];  // skip '('
+            while (i[0] < end && str.charAt(i[0]) != ')') {
+                Class<?> pt = parseSig(str, i, end, loader);
+                if (pt == null || pt == void.class)
+                    parseError(str, "bad argument type");
+                ptypes.add(pt);
+            }
+            ++i[0];  // skip ')'
+        } else {
+            parseError(str, "not a method type");
+        }
+        Class<?> rtype = parseSig(str, i, end, loader);
+        if (rtype == null || i[0] != end)
+            parseError(str, "bad return type");
+        ptypes.add(rtype);
+        return ptypes;
+    }
+
+    static private void parseError(String str, String msg) {
+        throw new IllegalArgumentException("bad signature: "+str+": "+msg);
+    }
+
+    static private Class<?> parseSig(String str, int[] i, int end, ClassLoader loader) {
+        if (i[0] == end)  return null;
+        char c = str.charAt(i[0]++);
+        if (c == 'L') {
+            int begc = i[0], endc = str.indexOf(';', begc);
+            if (endc < 0)  return null;
+            i[0] = endc+1;
+            String name = str.substring(begc, endc).replace('/', '.');
+            try {
+                return loader.loadClass(name);
+            } catch (ClassNotFoundException ex) {
+                throw new TypeNotPresentException(name, ex);
+            }
+        } else if (c == '[') {
+            Class<?> t = parseSig(str, i, end, loader);
+            if (t != null)
+                t = java.lang.reflect.Array.newInstance(t, 0).getClass();
+            return t;
+        } else {
+            return Wrapper.forBasicType(c).primitiveType();
+        }
+    }
+
+    public static String unparse(Class<?> type) {
+        StringBuilder sb = new StringBuilder();
+        unparseSig(type, sb);
+        return sb.toString();
+    }
+
+    public static String unparse(MethodType type) {
+        return unparseMethod(type.returnType(), type.parameterList());
+    }
+
+    public static String unparse(Object type) {
+        if (type instanceof Class<?>)
+            return unparse((Class<?>) type);
+        if (type instanceof MethodType)
+            return unparse((MethodType) type);
+        return (String) type;
+    }
+
+    public static String unparseMethod(Class<?> rtype, List<Class<?>> ptypes) {
+        StringBuilder sb = new StringBuilder();
+        sb.append('(');
+        for (Class<?> pt : ptypes)
+            unparseSig(pt, sb);
+        sb.append(')');
+        unparseSig(rtype, sb);
+        return sb.toString();
+    }
+
+    static private void unparseSig(Class<?> t, StringBuilder sb) {
+        char c = Wrapper.forBasicType(t).basicTypeChar();
+        if (c != 'L') {
+            sb.append(c);
+        } else {
+            boolean lsemi = (!t.isArray());
+            if (lsemi)  sb.append('L');
+            sb.append(t.getName().replace('.', '/'));
+            if (lsemi)  sb.append(';');
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/BytecodeName.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,627 @@
+/*
+ * Copyright (c) 2007, 2011, 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 sun.invoke.util;
+
+/**
+ * Utility routines for dealing with bytecode-level names.
+ * Includes universal mangling rules for the JVM.
+ *
+ * <h3>Avoiding Dangerous Characters </h3>
+ *
+ * <p>
+ * The JVM defines a very small set of characters which are illegal
+ * in name spellings.  We will slightly extend and regularize this set
+ * into a group of <cite>dangerous characters</cite>.
+ * These characters will then be replaced, in mangled names, by escape sequences.
+ * In addition, accidental escape sequences must be further escaped.
+ * Finally, a special prefix will be applied if and only if
+ * the mangling would otherwise fail to begin with the escape character.
+ * This happens to cover the corner case of the null string,
+ * and also clearly marks symbols which need demangling.
+ * </p>
+ * <p>
+ * Dangerous characters are the union of all characters forbidden
+ * or otherwise restricted by the JVM specification,
+ * plus their mates, if they are brackets
+ * (<code><big><b>[</b></big></code> and <code><big><b>]</b></big></code>,
+ * <code><big><b>&lt;</b></big></code> and <code><big><b>&gt;</b></big></code>),
+ * plus, arbitrarily, the colon character <code><big><b>:</b></big></code>.
+ * There is no distinction between type, method, and field names.
+ * This makes it easier to convert between mangled names of different
+ * types, since they do not need to be decoded (demangled).
+ * </p>
+ * <p>
+ * The escape character is backslash <code><big><b>\</b></big></code>
+ * (also known as reverse solidus).
+ * This character is, until now, unheard of in bytecode names,
+ * but traditional in the proposed role.
+ *
+ * </p>
+ * <h3> Replacement Characters </h3>
+ *
+ *
+ * <p>
+ * Every escape sequence is two characters
+ * (in fact, two UTF8 bytes) beginning with
+ * the escape character and followed by a
+ * <cite>replacement character</cite>.
+ * (Since the replacement character is never a backslash,
+ * iterated manglings do not double in size.)
+ * </p>
+ * <p>
+ * Each dangerous character has some rough visual similarity
+ * to its corresponding replacement character.
+ * This makes mangled symbols easier to recognize by sight.
+ * </p>
+ * <p>
+ * The dangerous characters are
+ * <code><big><b>/</b></big></code> (forward slash, used to delimit package components),
+ * <code><big><b>.</b></big></code> (dot, also a package delimiter),
+ * <code><big><b>;</b></big></code> (semicolon, used in signatures),
+ * <code><big><b>$</b></big></code> (dollar, used in inner classes and synthetic members),
+ * <code><big><b>&lt;</b></big></code> (left angle),
+ * <code><big><b>&gt;</b></big></code> (right angle),
+ * <code><big><b>[</b></big></code> (left square bracket, used in array types),
+ * <code><big><b>]</b></big></code> (right square bracket, reserved in this scheme for language use),
+ * and <code><big><b>:</b></big></code> (colon, reserved in this scheme for language use).
+ * Their replacements are, respectively,
+ * <code><big><b>|</b></big></code> (vertical bar),
+ * <code><big><b>,</b></big></code> (comma),
+ * <code><big><b>?</b></big></code> (question mark),
+ * <code><big><b>%</b></big></code> (percent),
+ * <code><big><b>^</b></big></code> (caret),
+ * <code><big><b>_</b></big></code> (underscore), and
+ * <code><big><b>{</b></big></code> (left curly bracket),
+ * <code><big><b>}</b></big></code> (right curly bracket),
+ * <code><big><b>!</b></big></code> (exclamation mark).
+ * In addition, the replacement character for the escape character itself is
+ * <code><big><b>-</b></big></code> (hyphen),
+ * and the replacement character for the null prefix is
+ * <code><big><b>=</b></big></code> (equal sign).
+ * </p>
+ * <p>
+ * An escape character <code><big><b>\</b></big></code>
+ * followed by any of these replacement characters
+ * is an escape sequence, and there are no other escape sequences.
+ * An equal sign is only part of an escape sequence
+ * if it is the second character in the whole string, following a backslash.
+ * Two consecutive backslashes do <em>not</em> form an escape sequence.
+ * </p>
+ * <p>
+ * Each escape sequence replaces a so-called <cite>original character</cite>
+ * which is either one of the dangerous characters or the escape character.
+ * A null prefix replaces an initial null string, not a character.
+ * </p>
+ * <p>
+ * All this implies that escape sequences cannot overlap and may be
+ * determined all at once for a whole string.  Note that a spelling
+ * string can contain <cite>accidental escapes</cite>, apparent escape
+ * sequences which must not be interpreted as manglings.
+ * These are disabled by replacing their leading backslash with an
+ * escape sequence (<code><big><b>\-</b></big></code>).  To mangle a string, three logical steps
+ * are required, though they may be carried out in one pass:
+ * </p>
+ * <ol>
+ *   <li>In each accidental escape, replace the backslash with an escape sequence
+ * (<code><big><b>\-</b></big></code>).</li>
+ *   <li>Replace each dangerous character with an escape sequence
+ * (<code><big><b>\|</b></big></code> for <code><big><b>/</b></big></code>, etc.).</li>
+ *   <li>If the first two steps introduced any change, <em>and</em>
+ * if the string does not already begin with a backslash, prepend a null prefix (<code><big><b>\=</b></big></code>).</li>
+ * </ol>
+ *
+ * To demangle a mangled string that begins with an escape,
+ * remove any null prefix, and then replace (in parallel)
+ * each escape sequence by its original character.
+ * <p>Spelling strings which contain accidental
+ * escapes <em>must</em> have them replaced, even if those
+ * strings do not contain dangerous characters.
+ * This restriction means that mangling a string always
+ * requires a scan of the string for escapes.
+ * But then, a scan would be required anyway,
+ * to check for dangerous characters.
+ *
+ * </p>
+ * <h3> Nice Properties </h3>
+ *
+ * <p>
+ * If a bytecode name does not contain any escape sequence,
+ * demangling is a no-op:  The string demangles to itself.
+ * Such a string is called <cite>self-mangling</cite>.
+ * Almost all strings are self-mangling.
+ * In practice, to demangle almost any name &ldquo;found in nature&rdquo;,
+ * simply verify that it does not begin with a backslash.
+ * </p>
+ * <p>
+ * Mangling is a one-to-one function, while demangling
+ * is a many-to-one function.
+ * A mangled string is defined as <cite>validly mangled</cite> if
+ * it is in fact the unique mangling of its spelling string.
+ * Three examples of invalidly mangled strings are <code><big><b>\=foo</b></big></code>,
+ * <code><big><b>\-bar</b></big></code>, and <code><big><b>baz\!</b></big></code>, which demangle to <code><big><b>foo</b></big></code>, <code><big><b>\bar</b></big></code>, and
+ * <code><big><b>baz\!</b></big></code>, but then remangle to <code><big><b>foo</b></big></code>, <code><big><b>\bar</b></big></code>, and <code><big><b>\=baz\-!</b></big></code>.
+ * If a language back-end or runtime is using mangled names,
+ * it should never present an invalidly mangled bytecode
+ * name to the JVM.  If the runtime encounters one,
+ * it should also report an error, since such an occurrence
+ * probably indicates a bug in name encoding which
+ * will lead to errors in linkage.
+ * However, this note does not propose that the JVM verifier
+ * detect invalidly mangled names.
+ * </p>
+ * <p>
+ * As a result of these rules, it is a simple matter to
+ * compute validly mangled substrings and concatenations
+ * of validly mangled strings, and (with a little care)
+ * these correspond to corresponding operations on their
+ * spelling strings.
+ * </p>
+ * <ul>
+ *   <li>Any prefix of a validly mangled string is also validly mangled,
+ * although a null prefix may need to be removed.</li>
+ *   <li>Any suffix of a validly mangled string is also validly mangled,
+ * although a null prefix may need to be added.</li>
+ *   <li>Two validly mangled strings, when concatenated,
+ * are also validly mangled, although any null prefix
+ * must be removed from the second string,
+ * and a trailing backslash on the first string may need escaping,
+ * if it would participate in an accidental escape when followed
+ * by the first character of the second string.</li>
+ * </ul>
+ * <p>If languages that include non-Java symbol spellings use this
+ * mangling convention, they will enjoy the following advantages:
+ * </p>
+ * <ul>
+ *   <li>They can interoperate via symbols they share in common.</li>
+ *   <li>Low-level tools, such as backtrace printers, will have readable displays.</li>
+ *   <li>Future JVM and language extensions can safely use the dangerous characters
+ * for structuring symbols, but will never interfere with valid spellings.</li>
+ *   <li>Runtimes and compilers can use standard libraries for mangling and demangling.</li>
+ *   <li>Occasional transliterations and name composition will be simple and regular,
+ * for classes, methods, and fields.</li>
+ *   <li>Bytecode names will continue to be compact.
+ * When mangled, spellings will at most double in length, either in
+ * UTF8 or UTF16 format, and most will not change at all.</li>
+ * </ul>
+ *
+ *
+ * <h3> Suggestions for Human Readable Presentations </h3>
+ *
+ *
+ * <p>
+ * For human readable displays of symbols,
+ * it will be better to present a string-like quoted
+ * representation of the spelling, because JVM users
+ * are generally familiar with such tokens.
+ * We suggest using single or double quotes before and after
+ * mangled symbols which are not valid Java identifiers,
+ * with quotes, backslashes, and non-printing characters
+ * escaped as if for literals in the Java language.
+ * </p>
+ * <p>
+ * For example, an HTML-like spelling
+ * <code><big><b>&lt;pre&gt;</b></big></code> mangles to
+ * <code><big><b>\^pre\_</b></big></code> and could
+ * display more cleanly as
+ * <code><big><b>'&lt;pre&gt;'</b></big></code>,
+ * with the quotes included.
+ * Such string-like conventions are <em>not</em> suitable
+ * for mangled bytecode names, in part because
+ * dangerous characters must be eliminated, rather
+ * than just quoted.  Otherwise internally structured
+ * strings like package prefixes and method signatures
+ * could not be reliably parsed.
+ * </p>
+ * <p>
+ * In such human-readable displays, invalidly mangled
+ * names should <em>not</em> be demangled and quoted,
+ * for this would be misleading.  Likewise, JVM symbols
+ * which contain dangerous characters (like dots in field
+ * names or brackets in method names) should not be
+ * simply quoted.  The bytecode names
+ * <code><big><b>\=phase\,1</b></big></code> and
+ * <code><big><b>phase.1</b></big></code> are distinct,
+ * and in demangled displays they should be presented as
+ * <code><big><b>'phase.1'</b></big></code> and something like
+ * <code><big><b>'phase'.1</b></big></code>, respectively.
+ * </p>
+ *
+ * @author John Rose
+ * @version 1.2, 02/06/2008
+ * @see http://blogs.sun.com/jrose/entry/symbolic_freedom_in_the_vm
+ */
+public class BytecodeName {
+    private BytecodeName() { }  // static only class
+
+    /** Given a source name, produce the corresponding bytecode name.
+     * The source name should not be qualified, because any syntactic
+     * markers (dots, slashes, dollar signs, colons, etc.) will be mangled.
+     * @param s the source name
+     * @return a valid bytecode name which represents the source name
+     */
+    public static String toBytecodeName(String s) {
+        String bn = mangle(s);
+        assert((Object)bn == s || looksMangled(bn)) : bn;
+        assert(s.equals(toSourceName(bn))) : s;
+        return bn;
+    }
+
+    /** Given an unqualified bytecode name, produce the corresponding source name.
+     * The bytecode name must not contain dangerous characters.
+     * In particular, it must not be qualified or segmented by colon {@code ':'}.
+     * @param s the bytecode name
+     * @return the source name, which may possibly have unsafe characters
+     * @throws IllegalArgumentException if the bytecode name is not {@link #isSafeBytecodeName safe}
+     * @see #isSafeBytecodeName(java.lang.String)
+     */
+    public static String toSourceName(String s) {
+        checkSafeBytecodeName(s);
+        String sn = s;
+        if (looksMangled(s)) {
+            sn = demangle(s);
+            assert(s.equals(mangle(sn))) : s+" => "+sn+" => "+mangle(sn);
+        }
+        return sn;
+    }
+
+    /**
+     * Given a bytecode name from a classfile, separate it into
+     * components delimited by dangerous characters.
+     * Each resulting array element will be either a dangerous character,
+     * or else a safe bytecode name.
+     * (The safe name might possibly be mangled to hide further dangerous characters.)
+     * For example, the qualified class name {@code java/lang/String}
+     * will be parsed into the array {@code {"java", '/', "lang", '/', "String"}}.
+     * The name {@code &lt;init&gt;} will be parsed into { '&lt;', "init", '&gt;'}}
+     * The name {@code foo/bar$:baz} will be parsed into
+     * {@code {"foo", '/', "bar", '$', ':', "baz"}}.
+     * The name {@code ::\=:foo:\=bar\!baz} will be parsed into
+     * {@code {':', ':', "", ':', "foo", ':', "bar:baz"}}.
+     */
+    public static Object[] parseBytecodeName(String s) {
+        int slen = s.length();
+        Object[] res = null;
+        for (int pass = 0; pass <= 1; pass++) {
+            int fillp = 0;
+            int lasti = 0;
+            for (int i = 0; i <= slen; i++) {
+                int whichDC = -1;
+                if (i < slen) {
+                    whichDC = DANGEROUS_CHARS.indexOf(s.charAt(i));
+                    if (whichDC < DANGEROUS_CHAR_FIRST_INDEX)  continue;
+                }
+                // got to end of string or next dangerous char
+                if (lasti < i) {
+                    // normal component
+                    if (pass != 0)
+                        res[fillp] = toSourceName(s.substring(lasti, i));
+                    fillp++;
+                    lasti = i+1;
+                }
+                if (whichDC >= DANGEROUS_CHAR_FIRST_INDEX) {
+                    if (pass != 0)
+                        res[fillp] = DANGEROUS_CHARS_CA[whichDC];
+                    fillp++;
+                    lasti = i+1;
+                }
+            }
+            if (pass != 0)  break;
+            // between passes, build the result array
+            res = new Object[fillp];
+            if (fillp <= 1 && lasti == 0) {
+                if (fillp != 0)  res[0] = toSourceName(s);
+                break;
+            }
+        }
+        return res;
+    }
+
+    /**
+     * Given a series of components, create a bytecode name for a classfile.
+     * This is the inverse of {@link #parseBytecodeName(java.lang.String)}.
+     * Each component must either be an interned one-character string of
+     * a dangerous character, or else a safe bytecode name.
+     * @param components a series of name components
+     * @return the concatenation of all components
+     * @throws IllegalArgumentException if any component contains an unsafe
+     *          character, and is not an interned one-character string
+     * @throws NullPointerException if any component is null
+     */
+    public static String unparseBytecodeName(Object[] components) {
+        Object[] components0 = components;
+        for (int i = 0; i < components.length; i++) {
+            Object c = components[i];
+            if (c instanceof String) {
+                String mc = toBytecodeName((String) c);
+                if (i == 0 && components.length == 1)
+                    return mc;  // usual case
+                if ((Object)mc != c) {
+                    if (components == components0)
+                        components = components.clone();
+                    components[i] = c = mc;
+                }
+            }
+        }
+        return appendAll(components);
+    }
+    private static String appendAll(Object[] components) {
+        if (components.length <= 1) {
+            if (components.length == 1) {
+                return String.valueOf(components[0]);
+            }
+            return "";
+        }
+        int slen = 0;
+        for (Object c : components) {
+            if (c instanceof String)
+                slen += String.valueOf(c).length();
+            else
+                slen += 1;
+        }
+        StringBuilder sb = new StringBuilder(slen);
+        for (Object c : components) {
+            sb.append(c);
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Given a bytecode name, produce the corresponding display name.
+     * This is the source name, plus quotes if needed.
+     * If the bytecode name contains dangerous characters,
+     * assume that they are being used as punctuation,
+     * and pass them through unchanged.
+     * Non-empty runs of non-dangerous characters are demangled
+     * if necessary, and the resulting names are quoted if
+     * they are not already valid Java identifiers, or if
+     * they contain a dangerous character (i.e., dollar sign "$").
+     * Single quotes are used when quoting.
+     * Within quoted names, embedded single quotes and backslashes
+     * are further escaped by prepended backslashes.
+     *
+     * @param s the original bytecode name (which may be qualified)
+     * @return a human-readable presentation
+     */
+    public static String toDisplayName(String s) {
+        Object[] components = parseBytecodeName(s);
+        for (int i = 0; i < components.length; i++) {
+            if (!(components[i] instanceof String))
+                continue;
+            String sn = (String) components[i];
+            // note that the name is already demangled!
+            //sn = toSourceName(sn);
+            if (!isJavaIdent(sn) || sn.indexOf('$') >=0 ) {
+                components[i] = quoteDisplay(sn);
+            }
+        }
+        return appendAll(components);
+    }
+    private static boolean isJavaIdent(String s) {
+        int slen = s.length();
+        if (slen == 0)  return false;
+        if (!Character.isJavaIdentifierStart(s.charAt(0)))
+            return false;
+        for (int i = 1; i < slen; i++) {
+            if (!Character.isJavaIdentifierPart(s.charAt(i)))
+                return false;
+        }
+        return true;
+    }
+    private static String quoteDisplay(String s) {
+        // TO DO:  Replace wierd characters in s by C-style escapes.
+        return "'"+s.replaceAll("['\\\\]", "\\\\$0")+"'";
+    }
+
+    private static void checkSafeBytecodeName(String s)
+            throws IllegalArgumentException {
+        if (!isSafeBytecodeName(s)) {
+            throw new IllegalArgumentException(s);
+        }
+    }
+
+    /**
+     * Report whether a simple name is safe as a bytecode name.
+     * Such names are acceptable in class files as class, method, and field names.
+     * Additionally, they are free of "dangerous" characters, even if those
+     * characters are legal in some (or all) names in class files.
+     * @param s the proposed bytecode name
+     * @return true if the name is non-empty and all of its characters are safe
+     */
+    public static boolean isSafeBytecodeName(String s) {
+        if (s.length() == 0)  return false;
+        // check occurrences of each DANGEROUS char
+        for (char xc : DANGEROUS_CHARS_A) {
+            if (xc == ESCAPE_C)  continue;  // not really that dangerous
+            if (s.indexOf(xc) >= 0)  return false;
+        }
+        return true;
+    }
+
+    /**
+     * Report whether a character is safe in a bytecode name.
+     * This is true of any unicode character except the following
+     * <em>dangerous characters</em>: {@code ".;:$[]<>/"}.
+     * @param s the proposed character
+     * @return true if the character is safe to use in classfiles
+     */
+    public static boolean isSafeBytecodeChar(char c) {
+        return DANGEROUS_CHARS.indexOf(c) < DANGEROUS_CHAR_FIRST_INDEX;
+    }
+
+    private static boolean looksMangled(String s) {
+        return s.charAt(0) == ESCAPE_C;
+    }
+
+    private static String mangle(String s) {
+        if (s.length() == 0)
+            return NULL_ESCAPE;
+
+        // build this lazily, when we first need an escape:
+        StringBuilder sb = null;
+
+        for (int i = 0, slen = s.length(); i < slen; i++) {
+            char c = s.charAt(i);
+
+            boolean needEscape = false;
+            if (c == ESCAPE_C) {
+                if (i+1 < slen) {
+                    char c1 = s.charAt(i+1);
+                    if ((i == 0 && c1 == NULL_ESCAPE_C)
+                        || c1 != originalOfReplacement(c1)) {
+                        // an accidental escape
+                        needEscape = true;
+                    }
+                }
+            } else {
+                needEscape = isDangerous(c);
+            }
+
+            if (!needEscape) {
+                if (sb != null)  sb.append(c);
+                continue;
+            }
+
+            // build sb if this is the first escape
+            if (sb == null) {
+                sb = new StringBuilder(s.length()+10);
+                // mangled names must begin with a backslash:
+                if (s.charAt(0) != ESCAPE_C && i > 0)
+                    sb.append(NULL_ESCAPE);
+                // append the string so far, which is unremarkable:
+                sb.append(s.substring(0, i));
+            }
+
+            // rewrite \ to \-, / to \|, etc.
+            sb.append(ESCAPE_C);
+            sb.append(replacementOf(c));
+        }
+
+        if (sb != null)   return sb.toString();
+
+        return s;
+    }
+
+    private static String demangle(String s) {
+        // build this lazily, when we first meet an escape:
+        StringBuilder sb = null;
+
+        int stringStart = 0;
+        if (s.startsWith(NULL_ESCAPE))
+            stringStart = 2;
+
+        for (int i = stringStart, slen = s.length(); i < slen; i++) {
+            char c = s.charAt(i);
+
+            if (c == ESCAPE_C && i+1 < slen) {
+                // might be an escape sequence
+                char rc = s.charAt(i+1);
+                char oc = originalOfReplacement(rc);
+                if (oc != rc) {
+                    // build sb if this is the first escape
+                    if (sb == null) {
+                        sb = new StringBuilder(s.length());
+                        // append the string so far, which is unremarkable:
+                        sb.append(s.substring(stringStart, i));
+                    }
+                    ++i;  // skip both characters
+                    c = oc;
+                }
+            }
+
+            if (sb != null)
+                sb.append(c);
+        }
+
+        if (sb != null)   return sb.toString();
+
+        return s.substring(stringStart);
+    }
+
+    static char ESCAPE_C = '\\';
+    // empty escape sequence to avoid a null name or illegal prefix
+    static char NULL_ESCAPE_C = '=';
+    static String NULL_ESCAPE = ESCAPE_C+""+NULL_ESCAPE_C;
+
+    static final String DANGEROUS_CHARS   = "\\/.;:$[]<>"; // \\ must be first
+    static final String REPLACEMENT_CHARS =  "-|,?!%{}^_";
+    static final int DANGEROUS_CHAR_FIRST_INDEX = 1; // index after \\
+    static char[] DANGEROUS_CHARS_A   = DANGEROUS_CHARS.toCharArray();
+    static char[] REPLACEMENT_CHARS_A = REPLACEMENT_CHARS.toCharArray();
+    static final Character[] DANGEROUS_CHARS_CA;
+    static {
+        Character[] dcca = new Character[DANGEROUS_CHARS.length()];
+        for (int i = 0; i < dcca.length; i++)
+            dcca[i] = Character.valueOf(DANGEROUS_CHARS.charAt(i));
+        DANGEROUS_CHARS_CA = dcca;
+    }
+
+    static final long[] SPECIAL_BITMAP = new long[2];  // 128 bits
+    static {
+        String SPECIAL = DANGEROUS_CHARS + REPLACEMENT_CHARS;
+        //System.out.println("SPECIAL = "+SPECIAL);
+        for (char c : SPECIAL.toCharArray()) {
+            SPECIAL_BITMAP[c >>> 6] |= 1L << c;
+        }
+    }
+    static boolean isSpecial(char c) {
+        if ((c >>> 6) < SPECIAL_BITMAP.length)
+            return ((SPECIAL_BITMAP[c >>> 6] >> c) & 1) != 0;
+        else
+            return false;
+    }
+    static char replacementOf(char c) {
+        if (!isSpecial(c))  return c;
+        int i = DANGEROUS_CHARS.indexOf(c);
+        if (i < 0)  return c;
+        return REPLACEMENT_CHARS.charAt(i);
+    }
+    static char originalOfReplacement(char c) {
+        if (!isSpecial(c))  return c;
+        int i = REPLACEMENT_CHARS.indexOf(c);
+        if (i < 0)  return c;
+        return DANGEROUS_CHARS.charAt(i);
+    }
+    static boolean isDangerous(char c) {
+        if (!isSpecial(c))  return false;
+        return (DANGEROUS_CHARS.indexOf(c) >= DANGEROUS_CHAR_FIRST_INDEX);
+    }
+    static int indexOfDangerousChar(String s, int from) {
+        for (int i = from, slen = s.length(); i < slen; i++) {
+            if (isDangerous(s.charAt(i)))
+                return i;
+        }
+        return -1;
+    }
+    static int lastIndexOfDangerousChar(String s, int from) {
+        for (int i = Math.min(from, s.length()-1); i >= 0; i--) {
+            if (isDangerous(s.charAt(i)))
+                return i;
+        }
+        return -1;
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,817 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.util;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.List;
+
+public class ValueConversions {
+    private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
+
+    private static EnumMap<Wrapper, MethodHandle>[] newWrapperCaches(int n) {
+        @SuppressWarnings("unchecked")
+        EnumMap<Wrapper, MethodHandle>[] caches
+                = (EnumMap<Wrapper, MethodHandle>[]) new EnumMap[n];  // unchecked warning expected here
+        for (int i = 0; i < n; i++)
+            caches[i] = new EnumMap<Wrapper, MethodHandle>(Wrapper.class);
+        return caches;
+    }
+
+    /// Converting references to values.
+
+    static int unboxInteger(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Integer) x).intValue();
+    }
+
+    static byte unboxByte(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Byte) x).byteValue();
+    }
+
+    static short unboxShort(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Short) x).shortValue();
+    }
+
+    static boolean unboxBoolean(Object x) {
+        if (x == null)  return false;  // never NPE
+        return ((Boolean) x).booleanValue();
+    }
+
+    static char unboxCharacter(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Character) x).charValue();
+    }
+
+    static long unboxLong(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Long) x).longValue();
+    }
+
+    static float unboxFloat(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Float) x).floatValue();
+    }
+
+    static double unboxDouble(Object x) {
+        if (x == null)  return 0;  // never NPE
+        return ((Double) x).doubleValue();
+    }
+
+    /// Converting references to "raw" values.
+    /// A raw primitive value is always an int or long.
+
+    static int unboxByteRaw(Object x) {
+        return unboxByte(x);
+    }
+
+    static int unboxShortRaw(Object x) {
+        return unboxShort(x);
+    }
+
+    static int unboxBooleanRaw(Object x) {
+        return unboxBoolean(x) ? 1 : 0;
+    }
+
+    static int unboxCharacterRaw(Object x) {
+        return unboxCharacter(x);
+    }
+
+    static int unboxFloatRaw(Object x) {
+        return Float.floatToIntBits(unboxFloat(x));
+    }
+
+    static long unboxDoubleRaw(Object x) {
+        return Double.doubleToRawLongBits(unboxDouble(x));
+    }
+
+    private static MethodType unboxType(Wrapper wrap, boolean raw) {
+        return MethodType.methodType(rawWrapper(wrap, raw).primitiveType(), wrap.wrapperType());
+    }
+
+    private static final EnumMap<Wrapper, MethodHandle>[]
+            UNBOX_CONVERSIONS = newWrapperCaches(4);
+
+    private static MethodHandle unbox(Wrapper wrap, boolean exact, boolean raw) {
+        EnumMap<Wrapper, MethodHandle> cache = UNBOX_CONVERSIONS[(exact?1:0)+(raw?2:0)];
+        MethodHandle mh = cache.get(wrap);
+        if (mh != null) {
+            return mh;
+        }
+        // slow path
+        switch (wrap) {
+            case OBJECT:
+                mh = IDENTITY; break;
+            case VOID:
+                mh = raw ? ALWAYS_ZERO : IGNORE; break;
+            case INT: case LONG:
+                // these guys don't need separate raw channels
+                if (raw)  mh = unbox(wrap, exact, false);
+                break;
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        // look up the method
+        String name = "unbox" + wrap.simpleName() + (raw ? "Raw" : "");
+        MethodType type = unboxType(wrap, raw);
+        if (!exact) {
+            try {
+                // actually, type is wrong; the Java method takes Object
+                mh = IMPL_LOOKUP.findStatic(ValueConversions.class, name, type.erase());
+            } catch (ReflectiveOperationException ex) {
+                mh = null;
+            }
+        } else {
+            mh = unbox(wrap, !exact, raw).asType(type);
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        throw new IllegalArgumentException("cannot find unbox adapter for " + wrap + (raw ? " (raw)" : ""));
+    }
+
+    public static MethodHandle unbox(Wrapper type, boolean exact) {
+        return unbox(type, exact, false);
+    }
+
+    public static MethodHandle unboxRaw(Wrapper type, boolean exact) {
+        return unbox(type, exact, true);
+    }
+
+    public static MethodHandle unbox(Class<?> type, boolean exact) {
+        return unbox(Wrapper.forPrimitiveType(type), exact, false);
+    }
+
+    public static MethodHandle unboxRaw(Class<?> type, boolean exact) {
+        return unbox(Wrapper.forPrimitiveType(type), exact, true);
+    }
+
+    /// Converting primitives to references
+
+    static Integer boxInteger(int x) {
+        return x;
+    }
+
+    static Byte boxByte(byte x) {
+        return x;
+    }
+
+    static Short boxShort(short x) {
+        return x;
+    }
+
+    static Boolean boxBoolean(boolean x) {
+        return x;
+    }
+
+    static Character boxCharacter(char x) {
+        return x;
+    }
+
+    static Long boxLong(long x) {
+        return x;
+    }
+
+    static Float boxFloat(float x) {
+        return x;
+    }
+
+    static Double boxDouble(double x) {
+        return x;
+    }
+
+    /// Converting raw primitives to references
+
+    static Byte boxByteRaw(int x) {
+        return boxByte((byte)x);
+    }
+
+    static Short boxShortRaw(int x) {
+        return boxShort((short)x);
+    }
+
+    static Boolean boxBooleanRaw(int x) {
+        return boxBoolean(x != 0);
+    }
+
+    static Character boxCharacterRaw(int x) {
+        return boxCharacter((char)x);
+    }
+
+    static Float boxFloatRaw(int x) {
+        return boxFloat(Float.intBitsToFloat(x));
+    }
+
+    static Double boxDoubleRaw(long x) {
+        return boxDouble(Double.longBitsToDouble(x));
+    }
+
+    // a raw void value is (arbitrarily) a garbage int
+    static Void boxVoidRaw(int x) {
+        return null;
+    }
+
+    private static MethodType boxType(Wrapper wrap, boolean raw) {
+        // be exact, since return casts are hard to compose
+        Class<?> boxType = wrap.wrapperType();
+        return MethodType.methodType(boxType, rawWrapper(wrap, raw).primitiveType());
+    }
+
+    private static Wrapper rawWrapper(Wrapper wrap, boolean raw) {
+        if (raw)  return wrap.isDoubleWord() ? Wrapper.LONG : Wrapper.INT;
+        return wrap;
+    }
+
+    private static final EnumMap<Wrapper, MethodHandle>[]
+            BOX_CONVERSIONS = newWrapperCaches(4);
+
+    private static MethodHandle box(Wrapper wrap, boolean exact, boolean raw) {
+        EnumMap<Wrapper, MethodHandle> cache = BOX_CONVERSIONS[(exact?1:0)+(raw?2:0)];
+        MethodHandle mh = cache.get(wrap);
+        if (mh != null) {
+            return mh;
+        }
+        // slow path
+        switch (wrap) {
+            case OBJECT:
+                mh = IDENTITY; break;
+            case VOID:
+                if (!raw)  mh = ZERO_OBJECT;
+                break;
+            case INT: case LONG:
+                // these guys don't need separate raw channels
+                if (raw)  mh = box(wrap, exact, false);
+                break;
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        // look up the method
+        String name = "box" + wrap.simpleName() + (raw ? "Raw" : "");
+        MethodType type = boxType(wrap, raw);
+        if (exact) {
+            try {
+                mh = IMPL_LOOKUP.findStatic(ValueConversions.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+                mh = null;
+            }
+        } else {
+            mh = box(wrap, !exact, raw).asType(type.erase());
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        throw new IllegalArgumentException("cannot find box adapter for " + wrap + (raw ? " (raw)" : ""));
+    }
+
+    public static MethodHandle box(Class<?> type, boolean exact) {
+        return box(Wrapper.forPrimitiveType(type), exact, false);
+    }
+
+    public static MethodHandle boxRaw(Class<?> type, boolean exact) {
+        return box(Wrapper.forPrimitiveType(type), exact, true);
+    }
+
+    public static MethodHandle box(Wrapper type, boolean exact) {
+        return box(type, exact, false);
+    }
+
+    public static MethodHandle boxRaw(Wrapper type, boolean exact) {
+        return box(type, exact, true);
+    }
+
+    /// Kludges for when raw values get accidentally boxed.
+
+    static int unboxRawInteger(Object x) {
+        if (x instanceof Integer)
+            return unboxInteger(x);
+        else
+            return (int) unboxLong(x);
+    }
+
+    static Integer reboxRawInteger(Object x) {
+        if (x instanceof Integer)
+            return (Integer) x;
+        else
+            return (int) unboxLong(x);
+    }
+
+    static Byte reboxRawByte(Object x) {
+        if (x instanceof Byte)  return (Byte) x;
+        return boxByteRaw(unboxRawInteger(x));
+    }
+
+    static Short reboxRawShort(Object x) {
+        if (x instanceof Short)  return (Short) x;
+        return boxShortRaw(unboxRawInteger(x));
+    }
+
+    static Boolean reboxRawBoolean(Object x) {
+        if (x instanceof Boolean)  return (Boolean) x;
+        return boxBooleanRaw(unboxRawInteger(x));
+    }
+
+    static Character reboxRawCharacter(Object x) {
+        if (x instanceof Character)  return (Character) x;
+        return boxCharacterRaw(unboxRawInteger(x));
+    }
+
+    static Float reboxRawFloat(Object x) {
+        if (x instanceof Float)  return (Float) x;
+        return boxFloatRaw(unboxRawInteger(x));
+    }
+
+    static Long reboxRawLong(Object x) {
+        return (Long) x;  //never a rebox
+    }
+
+    static Double reboxRawDouble(Object x) {
+        if (x instanceof Double)  return (Double) x;
+        return boxDoubleRaw(unboxLong(x));
+    }
+
+    private static MethodType reboxType(Wrapper wrap) {
+        Class<?> boxType = wrap.wrapperType();
+        return MethodType.methodType(boxType, Object.class);
+    }
+
+    private static final EnumMap<Wrapper, MethodHandle>[]
+            REBOX_CONVERSIONS = newWrapperCaches(2);
+
+    /**
+     * Because we normalize primitive types to reduce the number of signatures,
+     * primitives are sometimes manipulated under an "erased" type,
+     * either int (for types other than long/double) or long (for all types).
+     * When the erased primitive value is then boxed into an Integer or Long,
+     * the final boxed primitive is sometimes required.  This transformation
+     * is called a "rebox".  It takes an Integer or Long and produces some
+     * other boxed value.
+     */
+    public static MethodHandle rebox(Wrapper wrap, boolean exact) {
+        EnumMap<Wrapper, MethodHandle> cache = REBOX_CONVERSIONS[exact?1:0];
+        MethodHandle mh = cache.get(wrap);
+        if (mh != null) {
+            return mh;
+        }
+        // slow path
+        switch (wrap) {
+            case OBJECT:
+                mh = IDENTITY; break;
+            case VOID:
+                throw new IllegalArgumentException("cannot rebox a void");
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        // look up the method
+        String name = "reboxRaw" + wrap.simpleName();
+        MethodType type = reboxType(wrap);
+        if (exact) {
+            try {
+                mh = IMPL_LOOKUP.findStatic(ValueConversions.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+                mh = null;
+            }
+        } else {
+            mh = rebox(wrap, !exact).asType(IDENTITY.type());
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        throw new IllegalArgumentException("cannot find rebox adapter for " + wrap);
+    }
+
+    public static MethodHandle rebox(Class<?> type, boolean exact) {
+        return rebox(Wrapper.forPrimitiveType(type), exact);
+    }
+
+    /// Width-changing conversions between int and long.
+
+    static long widenInt(int x) {
+        return (long) x;
+    }
+
+    static Long widenBoxedInt(Integer x) {
+        return (long)(int)x;
+    }
+
+    static int narrowLong(long x) {
+        return (int) x;
+    }
+
+    static Integer narrowBoxedLong(Long x) {
+        return (int)(long) x;
+    }
+
+    /// Constant functions
+
+    static void ignore(Object x) {
+        // no value to return; this is an unbox of null
+        return;
+    }
+
+    static void empty() {
+        return;
+    }
+
+    static Object zeroObject() {
+        return null;
+    }
+
+    static int zeroInteger() {
+        return 0;
+    }
+
+    static long zeroLong() {
+        return 0;
+    }
+
+    static float zeroFloat() {
+        return 0;
+    }
+
+    static double zeroDouble() {
+        return 0;
+    }
+
+    private static final EnumMap<Wrapper, MethodHandle>[]
+            CONSTANT_FUNCTIONS = newWrapperCaches(2);
+
+    public static MethodHandle zeroConstantFunction(Wrapper wrap) {
+        EnumMap<Wrapper, MethodHandle> cache = CONSTANT_FUNCTIONS[0];
+        MethodHandle mh = cache.get(wrap);
+        if (mh != null) {
+            return mh;
+        }
+        // slow path
+        MethodType type = MethodType.methodType(wrap.primitiveType());
+        switch (wrap) {
+            case VOID:
+                mh = EMPTY;
+                break;
+            case INT: case LONG: case FLOAT: case DOUBLE:
+                try {
+                    mh = IMPL_LOOKUP.findStatic(ValueConversions.class, "zero"+wrap.simpleName(), type);
+                } catch (ReflectiveOperationException ex) {
+                    mh = null;
+                }
+                break;
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+
+        // use the raw method
+        Wrapper rawWrap = wrap.rawPrimitive();
+        if (mh == null && rawWrap != wrap) {
+            mh = MethodHandles.explicitCastArguments(zeroConstantFunction(rawWrap), type);
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        throw new IllegalArgumentException("cannot find zero constant for " + wrap);
+    }
+
+    /// Converting references to references.
+
+    /**
+     * Value-killing function.
+     * @param x an arbitrary reference value
+     * @return a null
+     */
+    static Object alwaysNull(Object x) {
+        return null;
+    }
+
+    /**
+     * Value-killing function.
+     * @param x an arbitrary reference value
+     * @return a zero
+     */
+    static int alwaysZero(Object x) {
+        return 0;
+    }
+
+    /**
+     * Identity function.
+     * @param x an arbitrary reference value
+     * @return the same value x
+     */
+    static <T> T identity(T x) {
+        return x;
+    }
+
+    /**
+     * Identity function on ints.
+     * @param x an arbitrary int value
+     * @return the same value x
+     */
+    static int identity(int x) {
+        return x;
+    }
+
+    static byte identity(byte x) {
+        return x;
+    }
+
+    static short identity(short x) {
+        return x;
+    }
+
+    static boolean identity(boolean x) {
+        return x;
+    }
+
+    static char identity(char x) {
+        return x;
+    }
+
+    /**
+     * Identity function on longs.
+     * @param x an arbitrary long value
+     * @return the same value x
+     */
+    static long identity(long x) {
+        return x;
+    }
+
+    static float identity(float x) {
+        return x;
+    }
+
+    static double identity(double x) {
+        return x;
+    }
+
+    /**
+     * Identity function, with reference cast.
+     * @param t an arbitrary reference type
+     * @param x an arbitrary reference value
+     * @return the same value x
+     */
+    static <T,U> T castReference(Class<? extends T> t, U x) {
+        return t.cast(x);
+    }
+
+    private static final MethodHandle IDENTITY, IDENTITY_I, IDENTITY_J, CAST_REFERENCE, ALWAYS_NULL, ALWAYS_ZERO, ZERO_OBJECT, IGNORE, EMPTY;
+    static {
+        try {
+            MethodType idType = MethodType.genericMethodType(1);
+            MethodType castType = idType.insertParameterTypes(0, Class.class);
+            MethodType alwaysZeroType = idType.changeReturnType(int.class);
+            MethodType ignoreType = idType.changeReturnType(void.class);
+            MethodType zeroObjectType = MethodType.genericMethodType(0);
+            IDENTITY = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", idType);
+            IDENTITY_I = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", MethodType.methodType(int.class, int.class));
+            IDENTITY_J = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", MethodType.methodType(long.class, long.class));
+            //CAST_REFERENCE = IMPL_LOOKUP.findVirtual(Class.class, "cast", idType);
+            CAST_REFERENCE = IMPL_LOOKUP.findStatic(ValueConversions.class, "castReference", castType);
+            ALWAYS_NULL = IMPL_LOOKUP.findStatic(ValueConversions.class, "alwaysNull", idType);
+            ALWAYS_ZERO = IMPL_LOOKUP.findStatic(ValueConversions.class, "alwaysZero", alwaysZeroType);
+            ZERO_OBJECT = IMPL_LOOKUP.findStatic(ValueConversions.class, "zeroObject", zeroObjectType);
+            IGNORE = IMPL_LOOKUP.findStatic(ValueConversions.class, "ignore", ignoreType);
+            EMPTY = IMPL_LOOKUP.findStatic(ValueConversions.class, "empty", ignoreType.dropParameterTypes(0, 1));
+        } catch (Exception ex) {
+            Error err = new InternalError("uncaught exception");
+            err.initCause(ex);
+            throw err;
+        }
+    }
+
+    private static final EnumMap<Wrapper, MethodHandle> WRAPPER_CASTS
+            = new EnumMap<Wrapper, MethodHandle>(Wrapper.class);
+
+    private static final EnumMap<Wrapper, MethodHandle> EXACT_WRAPPER_CASTS
+            = new EnumMap<Wrapper, MethodHandle>(Wrapper.class);
+
+    /** Return a method that casts its sole argument (an Object) to the given type
+     *  and returns it as the given type (if exact is true), or as plain Object (if erase is true).
+     */
+    public static MethodHandle cast(Class<?> type, boolean exact) {
+        if (type.isPrimitive())  throw new IllegalArgumentException("cannot cast primitive type "+type);
+        MethodHandle mh = null;
+        Wrapper wrap = null;
+        EnumMap<Wrapper, MethodHandle> cache = null;
+        if (Wrapper.isWrapperType(type)) {
+            wrap = Wrapper.forWrapperType(type);
+            cache = (exact ? EXACT_WRAPPER_CASTS : WRAPPER_CASTS);
+            mh = cache.get(wrap);
+            if (mh != null)  return mh;
+        }
+        if (VerifyType.isNullReferenceConversion(Object.class, type))
+            mh = IDENTITY;
+        else if (VerifyType.isNullType(type))
+            mh = ALWAYS_NULL;
+        else
+            mh = MethodHandles.insertArguments(CAST_REFERENCE, 0, type);
+        if (exact) {
+            MethodType xmt = MethodType.methodType(type, Object.class);
+            mh = MethodHandles.explicitCastArguments(mh, xmt);
+            //mh = AdapterMethodHandle.makeRetypeRaw(IMPL_TOKEN, xmt, mh);
+        }
+        if (cache != null)
+            cache.put(wrap, mh);
+        return mh;
+    }
+
+    public static MethodHandle identity() {
+        return IDENTITY;
+    }
+
+    public static MethodHandle identity(Class<?> type) {
+        // This stuff has been moved into MethodHandles:
+        return MethodHandles.identity(type);
+    }
+
+    public static MethodHandle identity(Wrapper wrap) {
+        EnumMap<Wrapper, MethodHandle> cache = CONSTANT_FUNCTIONS[1];
+        MethodHandle mh = cache.get(wrap);
+        if (mh != null) {
+            return mh;
+        }
+        // slow path
+        MethodType type = MethodType.methodType(wrap.primitiveType());
+        if (wrap != Wrapper.VOID)
+            type = type.appendParameterTypes(wrap.primitiveType());
+        try {
+            mh = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", type);
+        } catch (ReflectiveOperationException ex) {
+            mh = null;
+        }
+        if (mh == null && wrap == Wrapper.VOID) {
+            mh = EMPTY;  // #(){} : #()void
+        }
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+
+        if (mh != null) {
+            cache.put(wrap, mh);
+            return mh;
+        }
+        throw new IllegalArgumentException("cannot find identity for " + wrap);
+    }
+
+    private static final Object[] NO_ARGS_ARRAY = {};
+    private static Object[] makeArray(Object... args) { return args; }
+    private static Object[] array() { return NO_ARGS_ARRAY; }
+    private static Object[] array(Object a0)
+                { return makeArray(a0); }
+    private static Object[] array(Object a0, Object a1)
+                { return makeArray(a0, a1); }
+    private static Object[] array(Object a0, Object a1, Object a2)
+                { return makeArray(a0, a1, a2); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3)
+                { return makeArray(a0, a1, a2, a3); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4)
+                { return makeArray(a0, a1, a2, a3, a4); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5)
+                { return makeArray(a0, a1, a2, a3, a4, a5); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8, Object a9)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+    static MethodHandle[] makeArrays() {
+        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
+        MethodHandles.Lookup lookup = IMPL_LOOKUP;
+        for (;;) {
+            int nargs = arrays.size();
+            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(Object[].class);
+            String name = "array";
+            MethodHandle array = null;
+            try {
+                array = lookup.findStatic(ValueConversions.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+            }
+            if (array == null)  break;
+            arrays.add(array);
+        }
+        assert(arrays.size() == 11);  // current number of methods
+        return arrays.toArray(new MethodHandle[0]);
+    }
+    static final MethodHandle[] ARRAYS = makeArrays();
+
+    /** Return a method handle that takes the indicated number of Object
+     *  arguments and returns an Object array of them, as if for varargs.
+     */
+    public static MethodHandle varargsArray(int nargs) {
+        if (nargs < ARRAYS.length)
+            return ARRAYS[nargs];
+        // else need to spin bytecode or do something else fancy
+        throw new UnsupportedOperationException("NYI: cannot form a varargs array of length "+nargs);
+    }
+
+    private static final List<Object> NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY);
+    private static List<Object> makeList(Object... args) { return Arrays.asList(args); }
+    private static List<Object> list() { return NO_ARGS_LIST; }
+    private static List<Object> list(Object a0)
+                { return makeList(a0); }
+    private static List<Object> list(Object a0, Object a1)
+                { return makeList(a0, a1); }
+    private static List<Object> list(Object a0, Object a1, Object a2)
+                { return makeList(a0, a1, a2); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3)
+                { return makeList(a0, a1, a2, a3); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4)
+                { return makeList(a0, a1, a2, a3, a4); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5)
+                { return makeList(a0, a1, a2, a3, a4, a5); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6, Object a7)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6, Object a7,
+                                     Object a8)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6, Object a7,
+                                     Object a8, Object a9)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+    static MethodHandle[] makeLists() {
+        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
+        MethodHandles.Lookup lookup = IMPL_LOOKUP;
+        for (;;) {
+            int nargs = arrays.size();
+            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(List.class);
+            String name = "list";
+            MethodHandle array = null;
+            try {
+                array = lookup.findStatic(ValueConversions.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+            }
+            if (array == null)  break;
+            arrays.add(array);
+        }
+        assert(arrays.size() == 11);  // current number of methods
+        return arrays.toArray(new MethodHandle[0]);
+    }
+    static final MethodHandle[] LISTS = makeLists();
+
+    /** Return a method handle that takes the indicated number of Object
+     *  arguments and returns List.
+     */
+    public static MethodHandle varargsList(int nargs) {
+        if (nargs < LISTS.length)
+            return LISTS[nargs];
+        // else need to spin bytecode or do something else fancy
+        throw new UnsupportedOperationException("NYI");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.util;
+
+import java.lang.reflect.Modifier;
+import static java.lang.reflect.Modifier.*;
+
+/**
+ * This class centralizes information about the JVM's linkage access control.
+ * @author jrose
+ */
+public class VerifyAccess {
+
+    private VerifyAccess() { }  // cannot instantiate
+
+    private static final int PACKAGE_ONLY = 0;
+    private static final int ALL_ACCESS_MODES = (PUBLIC|PRIVATE|PROTECTED|PACKAGE_ONLY);
+    private static final boolean ALLOW_NESTMATE_ACCESS = false;
+
+    /**
+     * Evaluate the JVM linkage rules for access to the given method
+     * on behalf of a caller class which proposes to perform the access.
+     * Return true if the caller class has privileges to invoke a method
+     * or access a field with the given properties.
+     * This requires an accessibility check of the referencing class,
+     * plus an accessibility check of the member within the class,
+     * which depends on the member's modifier flags.
+     * <p>
+     * The relevant properties include the defining class ({@code defc})
+     * of the member, and its modifier flags ({@code mods}).
+     * Also relevant is the class used to make the initial symbolic reference
+     * to the member ({@code refc}).  If this latter class is not distinguished,
+     * the defining class should be passed for both arguments ({@code defc == refc}).
+     * <h3>JVM Specification, 5.4.4 "Access Control"</h3>
+     * A field or method R is accessible to a class or interface D if
+     * and only if any of the following conditions is true:<ul>
+     * <li>R is public.
+     * <li>R is protected and is declared in a class C, and D is either
+     *     a subclass of C or C itself.  Furthermore, if R is not
+     *     static, then the symbolic reference to R must contain a
+     *     symbolic reference to a class T, such that T is either a
+     *     subclass of D, a superclass of D or D itself.
+     * <li>R is either protected or has default access (that is,
+     *     neither public nor protected nor private), and is declared
+     *     by a class in the same runtime package as D.
+     * <li>R is private and is declared in D.
+     * </ul>
+     * This discussion of access control omits a related restriction
+     * on the target of a protected field access or method invocation
+     * (the target must be of class D or a subtype of D). That
+     * requirement is checked as part of the verification process
+     * (5.4.1); it is not part of link-time access control.
+     * @param refc the class used in the symbolic reference to the proposed member
+     * @param defc the class in which the proposed member is actually defined
+     * @param mods modifier flags for the proposed member
+     * @param lookupClass the class for which the access check is being made
+     * @return true iff the the accessing class can access such a member
+     */
+    public static boolean isMemberAccessible(Class<?> refc,  // symbolic ref class
+                                             Class<?> defc,  // actual def class
+                                             int      mods,  // actual member mods
+                                             Class<?> lookupClass) {
+        // Usually refc and defc are the same, but if they differ, verify them both.
+        if (refc != defc) {
+            if (!isClassAccessible(refc, lookupClass)) {
+                // Note that defc is verified in the switch below.
+                return false;
+            }
+            if ((mods & (ALL_ACCESS_MODES|STATIC)) == (PROTECTED|STATIC)) {
+                // Apply the special rules for refc here.
+                if (!isRelatedClass(refc, lookupClass))
+                    return isSamePackage(defc, lookupClass);
+                // If refc == defc, the call to isPublicSuperClass will do
+                // the whole job, since in that case refc (as defc) will be
+                // a superclass of the lookup class.
+            }
+        }
+        if (defc == lookupClass)
+            return true;        // easy check; all self-access is OK
+        switch (mods & ALL_ACCESS_MODES) {
+        case PUBLIC:
+            if (refc != defc)  return true;  // already checked above
+            return isClassAccessible(refc, lookupClass);
+        case PROTECTED:
+            return isSamePackage(defc, lookupClass) || isPublicSuperClass(defc, lookupClass);
+        case PACKAGE_ONLY:
+            return isSamePackage(defc, lookupClass);
+        case PRIVATE:
+            // Loosened rules for privates follows access rules for inner classes.
+            return (ALLOW_NESTMATE_ACCESS &&
+                    isSamePackageMember(defc, lookupClass));
+        default:
+            throw new IllegalArgumentException("bad modifiers: "+Modifier.toString(mods));
+        }
+    }
+
+    static boolean isRelatedClass(Class<?> refc, Class<?> lookupClass) {
+        return (refc == lookupClass ||
+                refc.isAssignableFrom(lookupClass) ||
+                lookupClass.isAssignableFrom(refc));
+    }
+
+    static boolean isPublicSuperClass(Class<?> defc, Class<?> lookupClass) {
+        return isPublic(defc.getModifiers()) && defc.isAssignableFrom(lookupClass);
+    }
+
+    /**
+     * Evaluate the JVM linkage rules for access to the given class on behalf of caller.
+     * <h3>JVM Specification, 5.4.4 "Access Control"</h3>
+     * A class or interface C is accessible to a class or interface D
+     * if and only if either of the following conditions are true:<ul>
+     * <li>C is public.
+     * <li>C and D are members of the same runtime package.
+     * </ul>
+     * @param refc the symbolic reference class to which access is being checked (C)
+     * @param lookupClass the class performing the lookup (D)
+     */
+    public static boolean isClassAccessible(Class<?> refc, Class<?> lookupClass) {
+        int mods = refc.getModifiers();
+        if (isPublic(mods))
+            return true;
+        if (isSamePackage(lookupClass, refc))
+            return true;
+        return false;
+    }
+
+    /**
+     * Test if two classes have the same class loader and package qualifier.
+     * @param class1
+     * @param class2
+     * @return whether they are in the same package
+     */
+    public static boolean isSamePackage(Class<?> class1, Class<?> class2) {
+        if (class1 == class2)
+            return true;
+        if (!loadersAreRelated(class1.getClassLoader(), class2.getClassLoader()))
+            return false;
+        String name1 = class1.getName(), name2 = class2.getName();
+        int dot = name1.lastIndexOf('.');
+        if (dot != name2.lastIndexOf('.'))
+            return false;
+        for (int i = 0; i < dot; i++) {
+            if (name1.charAt(i) != name2.charAt(i))
+                return false;
+        }
+        return true;
+    }
+
+    /**
+     * Test if two classes are defined as part of the same package member (top-level class).
+     * If this is true, they can share private access with each other.
+     * @param class1
+     * @param class2
+     * @return whether they are identical or nested together
+     */
+    public static boolean isSamePackageMember(Class<?> class1, Class<?> class2) {
+        if (class1 == class2)
+            return true;
+        if (!isSamePackage(class1, class2))
+            return false;
+        if (getOutermostEnclosingClass(class1) != getOutermostEnclosingClass(class2))
+            return false;
+        return true;
+    }
+
+    private static Class<?> getOutermostEnclosingClass(Class<?> c) {
+        Class<?> pkgmem = c;
+        for (Class<?> enc = c; (enc = enc.getEnclosingClass()) != null; )
+            pkgmem = enc;
+        return pkgmem;
+    }
+
+    private static boolean loadersAreRelated(ClassLoader loader1, ClassLoader loader2) {
+        if (loader1 == loader2 || loader1 == null || loader2 == null) {
+            return true;
+        }
+        for (ClassLoader scan1 = loader1;
+                scan1 != null; scan1 = scan1.getParent()) {
+            if (scan1 == loader2)  return true;
+        }
+        for (ClassLoader scan2 = loader2;
+                scan2 != null; scan2 = scan2.getParent()) {
+            if (scan2 == loader1)  return true;
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/VerifyType.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.util;
+
+import java.lang.invoke.MethodType;
+import sun.invoke.empty.Empty;
+
+/**
+ * This class centralizes information about the JVM verifier
+ * and its requirements about type correctness.
+ * @author jrose
+ */
+public class VerifyType {
+
+    private VerifyType() { }  // cannot instantiate
+
+    /**
+     * True if a value can be stacked as the source type and unstacked as the
+     * destination type, without violating the JVM's type consistency.
+     *
+     * @param call the type of a stacked value
+     * @param recv the type by which we'd like to treat it
+     * @return whether the retyping can be done without motion or reformatting
+     */
+    public static boolean isNullConversion(Class<?> src, Class<?> dst) {
+        if (src == dst)            return true;
+        // Verifier allows any interface to be treated as Object:
+        if (dst.isInterface())     dst = Object.class;
+        if (src.isInterface())     src = Object.class;
+        if (src == dst)            return true;  // check again
+        if (dst == void.class)     return true;  // drop any return value
+        if (isNullType(src))       return !dst.isPrimitive();
+        if (!src.isPrimitive())    return dst.isAssignableFrom(src);
+        // Verifier allows an int to carry byte, short, char, or even boolean:
+        if (dst == int.class)      return Wrapper.forPrimitiveType(src).isSubwordOrInt();
+        return false;
+    }
+
+    /**
+     * Specialization of isNullConversion to reference types.
+
+     * @param call the type of a stacked value
+     * @param recv the reference type by which we'd like to treat it
+     * @return whether the retyping can be done without a cast
+     */
+    public static boolean isNullReferenceConversion(Class<?> src, Class<?> dst) {
+        assert(!dst.isPrimitive());
+        if (dst.isInterface())  return true;   // verifier allows this
+        if (isNullType(src))    return true;
+        return dst.isAssignableFrom(src);
+    }
+
+    /**
+     * Is the given type java.lang.Null or an equivalent null-only type?
+     */
+    public static boolean isNullType(Class<?> type) {
+        if (type == null)  return false;
+        return type == NULL_CLASS
+            // This one may also be used as a null type.
+            // TO DO: Decide if we really want to legitimize it here.
+            // Probably we do, unless java.lang.Null really makes it into Java 7
+            //|| type == Void.class
+            // Locally known null-only class:
+            || type == Empty.class
+            ;
+    }
+    private static final Class<?> NULL_CLASS;
+    static {
+        Class<?> nullClass = null;
+        try {
+            nullClass = Class.forName("java.lang.Null");
+        } catch (ClassNotFoundException ex) {
+            // OK, we'll cope
+        }
+        NULL_CLASS = nullClass;
+    }
+
+    /**
+     * True if a method handle can receive a call under a slightly different
+     * method type, without moving or reformatting any stack elements.
+     *
+     * @param call the type of call being made
+     * @param recv the type of the method handle receiving the call
+     * @return whether the retyping can be done without motion or reformatting
+     */
+    public static boolean isNullConversion(MethodType call, MethodType recv) {
+        if (call == recv)  return true;
+        int len = call.parameterCount();
+        if (len != recv.parameterCount())  return false;
+        for (int i = 0; i < len; i++)
+            if (!isNullConversion(call.parameterType(i), recv.parameterType(i)))
+                return false;
+        return isNullConversion(recv.returnType(), call.returnType());
+    }
+
+    //TO DO: isRawConversion
+
+    /**
+     * Determine if the JVM verifier allows a value of type call to be
+     * passed to a formal parameter (or return variable) of type recv.
+     * Returns 1 if the verifier allows the types to match without conversion.
+     * Returns -1 if the types can be made to match by a JVM-supported adapter.
+     * Cases supported are:
+     * <ul><li>checkcast
+     * </li><li>conversion between any two integral types (but not floats)
+     * </li><li>unboxing from a wrapper to its corresponding primitive type
+     * </li><li>conversion in either direction between float and double
+     * </li></ul>
+     * (Autoboxing is not supported here; it must be done via Java code.)
+     * Returns 0 otherwise.
+     */
+    public static int canPassUnchecked(Class<?> src, Class<?> dst) {
+        if (src == dst)
+            return 1;
+
+        if (dst.isPrimitive()) {
+            if (dst == void.class)
+                // Return anything to a caller expecting void.
+                // This is a property of the implementation, which links
+                // return values via a register rather than via a stack push.
+                // This makes it possible to ignore cleanly.
+                return 1;
+            if (src == void.class)
+                return 0;  // void-to-something?
+            if (!src.isPrimitive())
+                // Cannot pass a reference to any primitive type (exc. void).
+                return 0;
+            Wrapper sw = Wrapper.forPrimitiveType(src);
+            Wrapper dw = Wrapper.forPrimitiveType(dst);
+            if (sw.isSubwordOrInt() && dw.isSubwordOrInt()) {
+                if (sw.bitWidth() >= dw.bitWidth())
+                    return -1;   // truncation may be required
+                if (!dw.isSigned() && sw.isSigned())
+                    return -1;   // sign elimination may be required
+            }
+            if (src == float.class || dst == float.class) {
+                if (src == double.class || dst == double.class)
+                    return -1;   // floating conversion may be required
+                else
+                    return 0;    // other primitive conversions NYI
+            } else {
+                // all fixed-point conversions are supported
+                return 0;
+            }
+        } else if (src.isPrimitive()) {
+            // Cannot pass a primitive to any reference type.
+            // (Maybe allow null.class?)
+            return 0;
+        }
+
+        // Handle reference types in the rest of the block:
+
+        // The verifier treats interfaces exactly like Object.
+        if (isNullReferenceConversion(src, dst))
+            // pass any reference to object or an arb. interface
+            return 1;
+        // else it's a definite "maybe" (cast is required)
+        return -1;
+    }
+
+    public static int canPassRaw(Class<?> src, Class<?> dst) {
+        if (dst.isPrimitive()) {
+            if (dst == void.class)
+                // As above, return anything to a caller expecting void.
+                return 1;
+            if (src == void.class)
+                // Special permission for raw conversions: allow a void
+                // to be captured as a garbage int.
+                // Caller promises that the actual value will be disregarded.
+                return dst == int.class ? 1 : 0;
+            if (isNullType(src))
+                // Special permission for raw conversions: allow a null
+                // to be reinterpreted as anything.  For objects, it is safe,
+                // and for primitives you get a garbage value (probably zero).
+                return 1;
+            if (!src.isPrimitive())
+                return 0;
+            Wrapper sw = Wrapper.forPrimitiveType(src);
+            Wrapper dw = Wrapper.forPrimitiveType(dst);
+            if (sw.stackSlots() == dw.stackSlots())
+                return 1;  // can do a reinterpret-cast on a stacked primitive
+            if (sw.isSubwordOrInt() && dw == Wrapper.VOID)
+                return 1;  // can drop an outgoing int value
+            return 0;
+        } else if (src.isPrimitive()) {
+            return 0;
+        }
+
+        // Both references.
+        if (isNullReferenceConversion(src, dst))
+            return 1;
+        return -1;
+    }
+
+    public static boolean isSpreadArgType(Class<?> spreadArg) {
+        return spreadArg.isArray();
+    }
+    public static Class<?> spreadArgElementType(Class<?> spreadArg, int i) {
+        return spreadArg.getComponentType();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/Wrapper.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,562 @@
+/*
+ * Copyright (c) 2008, 2011, 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 sun.invoke.util;
+
+public enum Wrapper {
+    BOOLEAN(Boolean.class, boolean.class, 'Z', (Boolean)false, Format.unsigned(1)),
+    // These must be in the order defined for widening primitive conversions in JLS 5.1.2
+    BYTE(Byte.class, byte.class, 'B', (Byte)(byte)0, Format.signed(8)),
+    SHORT(Short.class, short.class, 'S', (Short)(short)0, Format.signed(16)),
+    CHAR(Character.class, char.class, 'C', (Character)(char)0, Format.unsigned(16)),
+    INT(Integer.class, int.class, 'I', (Integer)(int)0, Format.signed(32)),
+    LONG(Long.class, long.class, 'J', (Long)(long)0, Format.signed(64)),
+    FLOAT(Float.class, float.class, 'F', (Float)(float)0, Format.floating(32)),
+    DOUBLE(Double.class, double.class, 'D', (Double)(double)0, Format.floating(64)),
+    //NULL(Null.class, null.class, 'N', null, Format.other(1)),
+    OBJECT(Object.class, Object.class, 'L', null, Format.other(1)),
+    // VOID must be the last type, since it is "assignable" from any other type:
+    VOID(Void.class, void.class, 'V', null, Format.other(0)),
+    ;
+
+    private final Class<?> wrapperType;
+    private final Class<?> primitiveType;
+    private final char     basicTypeChar;
+    private final Object   zero;
+    private final int      format;
+    private final String   simpleName;
+
+    private Wrapper(Class<?> wtype, Class<?> ptype, char tchar, Object zero, int format) {
+        this.wrapperType = wtype;
+        this.primitiveType = ptype;
+        this.basicTypeChar = tchar;
+        this.zero = zero;
+        this.format = format;
+        this.simpleName = wtype.getSimpleName();
+    }
+
+    private static abstract class Format {
+        static final int SLOT_SHIFT = 0, SIZE_SHIFT = 2, KIND_SHIFT = 12;
+        static final int
+                SIGNED   = (-1) << KIND_SHIFT,
+                UNSIGNED = 0    << KIND_SHIFT,
+                FLOATING = 1    << KIND_SHIFT;
+        static final int
+                SLOT_MASK = ((1<<(SIZE_SHIFT-SLOT_SHIFT))-1),
+                SIZE_MASK = ((1<<(KIND_SHIFT-SIZE_SHIFT))-1);
+        static int format(int kind, int size, int slots) {
+            assert(((kind >> KIND_SHIFT) << KIND_SHIFT) == kind);
+            assert((size & (size-1)) == 0); // power of two
+            assert((kind == SIGNED)   ? (size > 0) :
+                   (kind == UNSIGNED) ? (size > 0) :
+                   (kind == FLOATING) ? (size == 32 || size == 64)  :
+                   false);
+            assert((slots == 2) ? (size == 64) :
+                   (slots == 1) ? (size <= 32) :
+                   false);
+            return kind | (size << SIZE_SHIFT) | (slots << SLOT_SHIFT);
+        }
+        static final int
+                INT      = SIGNED   | (32 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
+                SHORT    = SIGNED   | (16 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
+                BOOLEAN  = UNSIGNED | (1  << SIZE_SHIFT) | (1 << SLOT_SHIFT),
+                CHAR     = UNSIGNED | (16 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
+                FLOAT    = FLOATING | (32 << SIZE_SHIFT) | (1 << SLOT_SHIFT),
+                VOID     = UNSIGNED | (0  << SIZE_SHIFT) | (0 << SLOT_SHIFT),
+                NUM_MASK = (-1) << SIZE_SHIFT;
+        static int signed(int size)   { return format(SIGNED,   size, (size > 32 ? 2 : 1)); }
+        static int unsigned(int size) { return format(UNSIGNED, size, (size > 32 ? 2 : 1)); }
+        static int floating(int size) { return format(FLOATING, size, (size > 32 ? 2 : 1)); }
+        static int other(int slots)   { return slots << SLOT_SHIFT; }
+    }
+
+    /// format queries:
+
+    /** How many bits are in the wrapped value?  Returns 0 for OBJECT or VOID. */
+    public int     bitWidth()      { return (format >> Format.SIZE_SHIFT) & Format.SIZE_MASK; }
+    /** How many JVM stack slots occupied by the wrapped value?  Returns 0 for VOID. */
+    public int     stackSlots()    { return (format >> Format.SLOT_SHIFT) & Format.SLOT_MASK; }
+    /** Does the wrapped value occupy a single JVM stack slot? */
+    public boolean isSingleWord()  { return (format & (1 << Format.SLOT_SHIFT)) != 0; }
+    /** Does the wrapped value occupy two JVM stack slots? */
+    public boolean isDoubleWord()  { return (format & (2 << Format.SLOT_SHIFT)) != 0; }
+    /** Is the wrapped type numeric (not void or object)? */
+    public boolean isNumeric()     { return (format & Format.NUM_MASK) != 0; }
+    /** Is the wrapped type a primitive other than float, double, or void? */
+    public boolean isIntegral()    { return isNumeric() && format < Format.FLOAT; }
+    /** Is the wrapped type one of int, boolean, byte, char, or short? */
+    public boolean isSubwordOrInt() { return isIntegral() && isSingleWord(); }
+    /* Is the wrapped value a signed integral type (one of byte, short, int, or long)? */
+    public boolean isSigned()      { return format < Format.VOID; }
+    /* Is the wrapped value an unsigned integral type (one of boolean or char)? */
+    public boolean isUnsigned()    { return format >= Format.BOOLEAN && format < Format.FLOAT; }
+    /** Is the wrapped type either float or double? */
+    public boolean isFloating()    { return format >= Format.FLOAT; }
+
+    /** Does the JVM verifier allow a variable of this wrapper's
+     *  primitive type to be assigned from a value of the given wrapper's primitive type?
+     *  Cases:
+     *  <ul>
+     *  <li>unboxing followed by widening primitive conversion
+     *  <li>any type converted to {@code void}
+     *  <li>boxing conversion followed by widening reference conversion to {@code Object}
+     *  <li>conversion of {@code boolean} to any type
+     *  </ul>
+     */
+    public boolean isConvertibleFrom(Wrapper source) {
+        if (this == source)  return true;
+        if (this.compareTo(source) < 0) {
+            // At best, this is a narrowing conversion.
+            return false;
+        }
+        if ((this.format ^ source.format) == (Format.SHORT ^ Format.CHAR)) {
+            assert (this == SHORT && source == CHAR) || (this == CHAR && source == SHORT);
+            return false;
+        }
+        return true;
+    }
+
+    /** Produce a zero value for the given wrapper type.
+     *  This will be a numeric zero for a number or character,
+     *  false for a boolean, and null for a reference or void.
+     *  The common thread is that this is what is contained
+     *  in a default-initialized variable of the given primitive
+     *  type.  (For void, it is what a reflective method returns
+     *  instead of no value at all.)
+     */
+    public Object zero() { return zero; }
+
+    /** Produce a zero value for the given wrapper type T.
+     *  The optional argument must a type compatible with this wrapper.
+     *  Equivalent to {@code this.cast(this.zero(), type)}.
+     */
+    public <T> T zero(Class<T> type) { return convert(zero, type); }
+
+//    /** Produce a wrapper for the given wrapper or primitive type. */
+//    public static Wrapper valueOf(Class<?> type) {
+//        if (isPrimitiveType(type))
+//            return forPrimitiveType(type);
+//        else
+//            return forWrapperType(type);
+//    }
+
+    /** Return the wrapper that wraps values of the given type.
+     *  The type may be {@code Object}, meaning the {@code OBJECT} wrapper.
+     *  Otherwise, the type must be a primitive.
+     *  @throws IllegalArgumentException for unexpected types
+     */
+    public static Wrapper forPrimitiveType(Class<?> type) {
+        Wrapper w = findPrimitiveType(type);
+        if (w != null)  return w;
+        if (type.isPrimitive())
+            throw new InternalError(); // redo hash function
+        throw newIllegalArgumentException("not primitive: "+type);
+    }
+
+    static Wrapper findPrimitiveType(Class<?> type) {
+        Wrapper w = FROM_PRIM[hashPrim(type)];
+        if (w != null && w.primitiveType == type) {
+            return w;
+        }
+        return null;
+    }
+
+    /** Return the wrapper that wraps values into the given wrapper type.
+     *  If it is {@code Object} or an interface, return {@code OBJECT}.
+     *  Otherwise, it must be a wrapper type.
+     *  The type must not be a primitive type.
+     *  @throws IllegalArgumentException for unexpected types
+     */
+    public static Wrapper forWrapperType(Class<?> type) {
+        Wrapper w = findWrapperType(type);
+        if (w != null)  return w;
+        for (Wrapper x : values())
+            if (x.wrapperType == type)
+                throw new InternalError(); // redo hash function
+        throw newIllegalArgumentException("not wrapper: "+type);
+    }
+
+    static Wrapper findWrapperType(Class<?> type) {
+        Wrapper w = FROM_WRAP[hashWrap(type)];
+        if (w != null && w.wrapperType == type) {
+            return w;
+        }
+        if (type.isInterface())
+            return OBJECT;
+        return null;
+    }
+
+    /** Return the wrapper that corresponds to the given bytecode
+     *  signature character.  Return {@code OBJECT} for the character 'L'.
+     *  @throws IllegalArgumentException for any non-signature character or {@code '['}.
+     */
+    public static Wrapper forBasicType(char type) {
+        Wrapper w = FROM_CHAR[hashChar(type)];
+        if (w != null && w.basicTypeChar == type) {
+            return w;
+        }
+        for (Wrapper x : values())
+            if (w.basicTypeChar == type)
+                throw new InternalError(); // redo hash function
+        throw newIllegalArgumentException("not basic type char: "+type);
+    }
+
+    /** Return the wrapper for the given type, if it is
+     *  a primitive type, else return {@code OBJECT}.
+     */
+    public static Wrapper forBasicType(Class<?> type) {
+        if (type.isPrimitive())
+            return forPrimitiveType(type);
+        return OBJECT;  // any reference, including wrappers or arrays
+    }
+
+    // Note on perfect hashes:
+    //   for signature chars c, do (c + (c >> 1)) % 16
+    //   for primitive type names n, do (n[0] + n[2]) % 16
+    // The type name hash works for both primitive and wrapper names.
+    // You can add "java/lang/Object" to the primitive names.
+    // But you add the wrapper name Object, use (n[2] + (3*n[1])) % 16.
+    private static final Wrapper[] FROM_PRIM = new Wrapper[16];
+    private static final Wrapper[] FROM_WRAP = new Wrapper[16];
+    private static final Wrapper[] FROM_CHAR = new Wrapper[16];
+    private static int hashPrim(Class<?> x) {
+        String xn = x.getName();
+        if (xn.length() < 3)  return 0;
+        return (xn.charAt(0) + xn.charAt(2)) % 16;
+    }
+    private static int hashWrap(Class<?> x) {
+        String xn = x.getName();
+        final int offset = 10; assert(offset == "java.lang.".length());
+        if (xn.length() < offset+3)  return 0;
+        return (3*xn.charAt(offset+1) + xn.charAt(offset+2)) % 16;
+    }
+    private static int hashChar(char x) {
+        return (x + (x >> 1)) % 16;
+    }
+    static {
+        for (Wrapper w : values()) {
+            int pi = hashPrim(w.primitiveType);
+            int wi = hashWrap(w.wrapperType);
+            int ci = hashChar(w.basicTypeChar);
+            assert(FROM_PRIM[pi] == null);
+            assert(FROM_WRAP[wi] == null);
+            assert(FROM_CHAR[ci] == null);
+            FROM_PRIM[pi] = w;
+            FROM_WRAP[wi] = w;
+            FROM_CHAR[ci] = w;
+        }
+        //assert(jdk.sun.invoke.util.WrapperTest.test(false));
+    }
+
+    /** What is the primitive type wrapped by this wrapper? */
+    public Class<?> primitiveType() { return primitiveType; }
+
+    /** What is the wrapper type for this wrapper? */
+    public Class<?> wrapperType() { return wrapperType; }
+
+    /** What is the wrapper type for this wrapper?
+     * Otherwise, the example type must be the wrapper type,
+     * or the corresponding primitive type.
+     * (For {@code OBJECT}, the example type can be any non-primitive,
+     * and is normalized to {@code Object.class}.)
+     * The resulting class type has the same type parameter.
+     */
+    public <T> Class<T> wrapperType(Class<T> exampleType) {
+        if (exampleType == wrapperType) {
+            return exampleType;
+        } else if (exampleType == primitiveType ||
+                   wrapperType == Object.class ||
+                   exampleType.isInterface()) {
+            return forceType(wrapperType, exampleType);
+        }
+        throw newClassCastException(exampleType, primitiveType);
+    }
+
+    private static ClassCastException newClassCastException(Class<?> actual, Class<?> expected) {
+        return new ClassCastException(actual + " is not compatible with " + expected);
+    }
+
+    /** If {@code type} is a primitive type, return the corresponding
+     *  wrapper type, else return {@code type} unchanged.
+     */
+    public static <T> Class<T> asWrapperType(Class<T> type) {
+        if (type.isPrimitive()) {
+            return forPrimitiveType(type).wrapperType(type);
+        }
+        return type;
+    }
+
+    /** If {@code type} is a wrapper type, return the corresponding
+     *  primitive type, else return {@code type} unchanged.
+     */
+    public static <T> Class<T> asPrimitiveType(Class<T> type) {
+        Wrapper w = findWrapperType(type);
+        if (w != null) {
+            return forceType(w.primitiveType(), type);
+        }
+        return type;
+    }
+
+    /** Query:  Is the given type a wrapper, such as {@code Integer} or {@code Void}? */
+    public static boolean isWrapperType(Class<?> type) {
+        return findWrapperType(type) != null;
+    }
+
+    /** Query:  Is the given type a primitive, such as {@code int} or {@code void}? */
+    public static boolean isPrimitiveType(Class<?> type) {
+        return type.isPrimitive();
+    }
+
+    /** What is the bytecode signature character for this type?
+     *  All non-primitives, including array types, report as 'L', the signature character for references.
+     */
+    public static char basicTypeChar(Class<?> type) {
+        if (!type.isPrimitive())
+            return 'L';
+        else
+            return forPrimitiveType(type).basicTypeChar();
+    }
+
+    /** What is the bytecode signature character for this wrapper's
+     *  primitive type?
+     */
+    public char basicTypeChar() { return basicTypeChar; }
+
+    /** What is the simple name of the wrapper type?
+     */
+    public String simpleName() { return simpleName; }
+
+//    /** Wrap a value in the given type, which may be either a primitive or wrapper type.
+//     *  Performs standard primitive conversions, including truncation and float conversions.
+//     */
+//    public static <T> T wrap(Object x, Class<T> type) {
+//        return Wrapper.valueOf(type).cast(x, type);
+//    }
+
+    /** Cast a wrapped value to the given type, which may be either a primitive or wrapper type.
+     *  The given target type must be this wrapper's primitive or wrapper type.
+     *  If this wrapper is OBJECT, the target type may also be an interface, perform no runtime check.
+     *  Performs standard primitive conversions, including truncation and float conversions.
+     *  The given type must be compatible with this wrapper.  That is, it must either
+     *  be the wrapper type (or a subtype, in the case of {@code OBJECT}) or else
+     *  it must be the wrapper's primitive type.
+     *  Primitive conversions are only performed if the given type is itself a primitive.
+     *  @throws ClassCastException if the given type is not compatible with this wrapper
+     */
+    public <T> T cast(Object x, Class<T> type) {
+        return convert(x, type, true);
+    }
+
+    /** Convert a wrapped value to the given type.
+     *  The given target type must be this wrapper's primitive or wrapper type.
+     *  This is equivalent to {@link #cast}, except that it refuses to perform
+     *  narrowing primitive conversions.
+     */
+    public <T> T convert(Object x, Class<T> type) {
+        return convert(x, type, false);
+    }
+
+    private <T> T convert(Object x, Class<T> type, boolean isCast) {
+        if (this == OBJECT) {
+            // If the target wrapper is OBJECT, just do a reference cast.
+            // If the target type is an interface, perform no runtime check.
+            // (This loophole is safe, and is allowed by the JVM verifier.)
+            // If the target type is a primitive, change it to a wrapper.
+            @SuppressWarnings("unchecked")
+            T result = (T) x;  // unchecked warning is expected here
+            return result;
+        }
+        Class<T> wtype = wrapperType(type);
+        if (wtype.isInstance(x)) {
+            @SuppressWarnings("unchecked")
+            T result = (T) x;  // unchecked warning is expected here
+            return result;
+        }
+        Class<?> sourceType = x.getClass();  // throw NPE if x is null
+        if (!isCast) {
+            Wrapper source = findWrapperType(sourceType);
+            if (source == null || !this.isConvertibleFrom(source)) {
+                throw newClassCastException(wtype, sourceType);
+            }
+        }
+        @SuppressWarnings("unchecked")
+        T result = (T) wrap(x);  // unchecked warning is expected here
+        assert result.getClass() == wtype;
+        return result;
+    }
+
+    /** Cast a reference type to another reference type.
+     * If the target type is an interface, perform no runtime check.
+     * (This loophole is safe, and is allowed by the JVM verifier.)
+     * If the target type is a primitive, change it to a wrapper.
+     */
+    static <T> Class<T> forceType(Class<?> type, Class<T> exampleType) {
+        boolean z = (type == exampleType ||
+               type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
+               exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
+               type == Object.class && !exampleType.isPrimitive());
+        if (!z)
+            System.out.println(type+" <= "+exampleType);
+        assert(type == exampleType ||
+               type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
+               exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
+               type == Object.class && !exampleType.isPrimitive());
+        @SuppressWarnings("unchecked")
+        Class<T> result = (Class<T>) type;  // unchecked warning is expected here
+        return result;
+    }
+
+    /** Wrap a value in this wrapper's type.
+     * Performs standard primitive conversions, including truncation and float conversions.
+     * Performs returns the unchanged reference for {@code OBJECT}.
+     * Returns null for {@code VOID}.
+     * Returns a zero value for a null input.
+     * @throws ClassCastException if this wrapper is numeric and the operand
+     *                            is not a number, character, boolean, or null
+     */
+    public Object wrap(Object x) {
+        // do non-numeric wrappers first
+        switch (basicTypeChar) {
+            case 'L': return x;
+            case 'V': return null;
+        }
+        Number xn = numberValue(x);
+        switch (basicTypeChar) {
+            case 'I': return Integer.valueOf(xn.intValue());
+            case 'J': return Long.valueOf(xn.longValue());
+            case 'F': return Float.valueOf(xn.floatValue());
+            case 'D': return Double.valueOf(xn.doubleValue());
+            case 'S': return Short.valueOf((short) xn.intValue());
+            case 'B': return Byte.valueOf((byte) xn.intValue());
+            case 'C': return Character.valueOf((char) xn.intValue());
+            case 'Z': return Boolean.valueOf(boolValue(xn.longValue()));
+        }
+        throw new InternalError("bad wrapper");
+    }
+
+    /** Wrap a value (an int or smaller value) in this wrapper's type.
+     * Performs standard primitive conversions, including truncation and float conversions.
+     * Produces an {@code Integer} for {@code OBJECT}, although the exact type
+     * of the operand is not known.
+     * Returns null for {@code VOID}.
+     */
+    public Object wrap(int x) {
+        if (basicTypeChar == 'L')  return (Integer)x;
+        switch (basicTypeChar) {
+            case 'L': throw newIllegalArgumentException("cannot wrap to object type");
+            case 'V': return null;
+            case 'I': return Integer.valueOf((int)x);
+            case 'J': return Long.valueOf(x);
+            case 'F': return Float.valueOf(x);
+            case 'D': return Double.valueOf(x);
+            case 'S': return Short.valueOf((short) x);
+            case 'B': return Byte.valueOf((byte) x);
+            case 'C': return Character.valueOf((char) x);
+            case 'Z': return Boolean.valueOf(boolValue(x));
+        }
+        throw new InternalError("bad wrapper");
+    }
+
+    /** Wrap a value (a long or smaller value) in this wrapper's type.
+     * Does not perform floating point conversion.
+     * Produces a {@code Long} for {@code OBJECT}, although the exact type
+     * of the operand is not known.
+     * Returns null for {@code VOID}.
+     */
+    public Object wrapRaw(long x) {
+        switch (basicTypeChar) {
+            case 'F':  return Float.valueOf(Float.intBitsToFloat((int)x));
+            case 'D':  return Double.valueOf(Double.longBitsToDouble(x));
+            case 'L':  // same as 'J':
+            case 'J':  return (Long) x;
+        }
+        // Other wrapping operations are just the same, given that the
+        // operand is already promoted to an int.
+        return wrap((int)x);
+    }
+
+    /** Produce bitwise value which encodes the given wrapped value.
+     * Does not perform floating point conversion.
+     * Returns zero for {@code VOID}.
+     */
+    public long unwrapRaw(Object x) {
+        switch (basicTypeChar) {
+            case 'F':  return Float.floatToRawIntBits((Float) x);
+            case 'D':  return Double.doubleToRawLongBits((Double) x);
+
+            case 'L': throw newIllegalArgumentException("cannot unwrap from sobject type");
+            case 'V': return 0;
+            case 'I': return (int)(Integer) x;
+            case 'J': return (long)(Long) x;
+            case 'S': return (short)(Short) x;
+            case 'B': return (byte)(Byte) x;
+            case 'C': return (char)(Character) x;
+            case 'Z': return (boolean)(Boolean) x ? 1 : 0;
+        }
+        throw new InternalError("bad wrapper");
+    }
+
+    /** Report what primitive type holds this guy's raw value. */
+    public Class<?> rawPrimitiveType() {
+        return rawPrimitive().primitiveType();
+    }
+
+    /** Report, as a wrapper, what primitive type holds this guy's raw value.
+     *  Returns self for INT, LONG, OBJECT; returns LONG for DOUBLE,
+     *  else returns INT.
+     */
+    public Wrapper rawPrimitive() {
+        switch (basicTypeChar) {
+            case 'S': case 'B':
+            case 'C': case 'Z':
+            case 'V':
+            case 'F':
+                return INT;
+            case 'D':
+                return LONG;
+        }
+        return this;
+    }
+
+    private static Number numberValue(Object x) {
+        if (x instanceof Number)     return (Number)x;
+        if (x instanceof Character)  return (int)(Character)x;
+        if (x instanceof Boolean)    return (Boolean)x ? 1 : 0;
+        // Remaining allowed case of void:  Must be a null reference.
+        return (Number)x;
+    }
+
+    private static boolean boolValue(long bits) {
+        //bits &= 1;  // simple 31-bit zero extension
+        return (bits != 0);
+    }
+
+    private static RuntimeException newIllegalArgumentException(String message, Object x) {
+        return newIllegalArgumentException(message + x);
+    }
+    private static RuntimeException newIllegalArgumentException(String message) {
+        return new IllegalArgumentException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/invoke/util/package-info.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2008, 2011, 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.
+ */
+
+/**
+ * Extra support for using JSR 292 RI, package java.lang.invoke.
+ * @author jrose
+ */
+
+package sun.invoke.util;
--- a/jdk/src/share/classes/sun/java2d/pisces/Helpers.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/Helpers.java	Thu Mar 31 22:07:32 2011 -0700
@@ -154,9 +154,6 @@
     // These use a hardcoded factor of 2 for increasing sizes. Perhaps this
     // should be provided as an argument.
     static float[] widenArray(float[] in, final int cursize, final int numToAdd) {
-        if (in == null) {
-            return new float[5 * numToAdd];
-        }
         if (in.length >= cursize + numToAdd) {
             return in;
         }
--- a/jdk/src/share/classes/sun/java2d/pisces/PiscesTileGenerator.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/PiscesTileGenerator.java	Thu Mar 31 22:07:32 2011 -0700
@@ -191,8 +191,7 @@
                     System.out.println("len = "+runLen);
                     System.out.print(cache.toString());
                     e0.printStackTrace();
-                    System.exit(1);
-                    return;
+                    throw e0;
                 }
 
                 int rx0 = cx;
@@ -215,8 +214,7 @@
                         System.out.println("len = "+runLen);
                         System.out.print(cache.toString());
                         e.printStackTrace();
-                        System.exit(1);
-                        return;
+                        throw e;
                     }
                 }
                 pos += 2;
@@ -250,4 +248,5 @@
      * No further calls will be made on this instance.
      */
     public void dispose() {}
-}
\ No newline at end of file
+}
+
--- a/jdk/src/share/classes/sun/java2d/pisces/Renderer.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/Renderer.java	Thu Mar 31 22:07:32 2011 -0700
@@ -47,16 +47,16 @@
 
         private static final int INIT_CROSSINGS_SIZE = 10;
 
-        private ScanlineIterator() {
+        // Preconditions: Only subpixel scanlines in the range
+        // (start <= subpixel_y <= end) will be evaluated. No
+        // edge may have a valid (i.e. inside the supplied clip)
+        // crossing that would be generated outside that range.
+        private ScanlineIterator(int start, int end) {
             crossings = new int[INIT_CROSSINGS_SIZE];
             edgePtrs = new int[INIT_CROSSINGS_SIZE];
 
-            // We don't care if we clip some of the line off with ceil, since
-            // no scan line crossings will be eliminated (in fact, the ceil is
-            // the y of the first scan line crossing).
-            final int minY = getFirstScanLineCrossing();
-            nextY = minY;
-            maxY = getScanLineCrossingEnd()-1;
+            nextY = start;
+            maxY = end;
             edgeCount = 0;
         }
 
@@ -148,6 +148,7 @@
     // don't just set NULL to -1, because we want NULL+NEXT to be negative.
     private static final int NULL = -SIZEOF_EDGE;
     private float[] edges = null;
+    private static final int INIT_NUM_EDGES = 8;
     private int[] edgeBuckets = null;
     private int[] edgeBucketCounts = null; // 2*newedges + (1 if pruning needed)
     private int numEdges;
@@ -156,7 +157,7 @@
     private static final float INC_BND = 8f;
 
     // each bucket is a linked list. this method adds eptr to the
-    // start "bucket"th linked list.
+    // start of the "bucket"th linked list.
     private void addEdgeToBucket(final int eptr, final int bucket) {
         edges[eptr+NEXT] = edgeBuckets[bucket];
         edgeBuckets[bucket] = eptr;
@@ -168,7 +169,8 @@
     // X0, Y0, D*[X|Y], COUNT; not variables used for computing scanline crossings).
     private void quadBreakIntoLinesAndAdd(float x0, float y0,
                                           final Curve c,
-                                          final float x2, final float y2) {
+                                          final float x2, final float y2)
+    {
         final float QUAD_DEC_BND = 32;
         final int countlg = 4;
         int count = 1 << countlg;
@@ -204,7 +206,8 @@
     // here, but then too many numbers are passed around.
     private void curveBreakIntoLinesAndAdd(float x0, float y0,
                                            final Curve c,
-                                           final float x3, final float y3) {
+                                           final float x3, final float y3)
+    {
         final int countlg = 3;
         int count = 1 << countlg;
 
@@ -259,8 +262,6 @@
         }
     }
 
-    // Preconditions: y2 > y1 and the curve must cross some scanline
-    // i.e.: y1 <= y < y2 for some y such that boundsMinY <= y < boundsMaxY
     private void addLine(float x1, float y1, float x2, float y2) {
         float or = 1; // orientation of the line. 1 if y increases, 0 otherwise.
         if (y2 < y1) {
@@ -272,12 +273,11 @@
             x1 = or;
             or = 0;
         }
-        final int firstCrossing = Math.max((int) Math.ceil(y1), boundsMinY);
+        final int firstCrossing = Math.max((int)Math.ceil(y1), boundsMinY);
         final int lastCrossing = Math.min((int)Math.ceil(y2), boundsMaxY);
         if (firstCrossing >= lastCrossing) {
             return;
         }
-
         if (y1 < edgeMinY) { edgeMinY = y1; }
         if (y2 > edgeMaxY) { edgeMaxY = y2; }
 
@@ -297,22 +297,10 @@
         edges[ptr+OR] = or;
         edges[ptr+CURX] = x1 + (firstCrossing - y1) * slope;
         edges[ptr+SLOPE] = slope;
-        edges[ptr+YMAX] = y2;
+        edges[ptr+YMAX] = lastCrossing;
         final int bucketIdx = firstCrossing - boundsMinY;
         addEdgeToBucket(ptr, bucketIdx);
-        if (lastCrossing < boundsMaxY) {
-            edgeBucketCounts[lastCrossing - boundsMinY] |= 1;
-        }
-    }
-
-    // preconditions: should not be called before the last line has been added
-    // to the edge list (even though it will return a correct answer at that
-    // point in time, it's not meant to be used that way).
-    private int getFirstScanLineCrossing() {
-        return Math.max(boundsMinY, (int)Math.ceil(edgeMinY));
-    }
-    private int getScanLineCrossingEnd() {
-        return Math.min(boundsMaxY, (int)Math.ceil(edgeMaxY));
+        edgeBucketCounts[lastCrossing - boundsMinY] |= 1;
     }
 
 // END EDGE LIST
@@ -366,9 +354,11 @@
         this.boundsMaxX = (pix_boundsX + pix_boundsWidth) * SUBPIXEL_POSITIONS_X;
         this.boundsMaxY = (pix_boundsY + pix_boundsHeight) * SUBPIXEL_POSITIONS_Y;
 
+        edges = new float[INIT_NUM_EDGES * SIZEOF_EDGE];
+        numEdges = 0;
         edgeBuckets = new int[boundsMaxY - boundsMinY];
         java.util.Arrays.fill(edgeBuckets, NULL);
-        edgeBucketCounts = new int[edgeBuckets.length];
+        edgeBucketCounts = new int[edgeBuckets.length + 1];
     }
 
     private float tosubpixx(float pix_x) {
@@ -394,7 +384,7 @@
         y0 = y1;
     }
 
-    Curve c = new Curve();
+    private Curve c = new Curve();
     @Override public void curveTo(float x1, float y1,
                                   float x2, float y2,
                                   float x3, float y3)
@@ -431,8 +421,8 @@
         throw new InternalError("Renderer does not use a native consumer.");
     }
 
-    private void _endRendering(final int pix_bboxx0, final int pix_bboxy0,
-                               final int pix_bboxx1, final int pix_bboxy1)
+    private void _endRendering(final int pix_bboxx0, final int pix_bboxx1,
+                               int ymin, int ymax)
     {
         // Mask to determine the relevant bit of the crossing sum
         // 0x1 if EVEN_ODD, all bits if NON_ZERO
@@ -455,7 +445,7 @@
         int pix_minX = Integer.MAX_VALUE;
 
         int y = boundsMinY; // needs to be declared here so we emit the last row properly.
-        ScanlineIterator it = this.new ScanlineIterator();
+        ScanlineIterator it = this.new ScanlineIterator(ymin, ymax);
         for ( ; it.hasNext(); ) {
             int numCrossings = it.next();
             int[] crossings = it.crossings;
@@ -477,7 +467,7 @@
                 int curxo = crossings[i];
                 int curx = curxo >> 1;
                 // to turn {0, 1} into {-1, 1}, multiply by 2 and subtract 1.
-                int crorientation = ((curxo & 0x1) << 1) -1;
+                int crorientation = ((curxo & 0x1) << 1) - 1;
                 if ((sum & mask) != 0) {
                     int x0 = Math.max(prev, bboxx0);
                     int x1 = Math.min(curx, bboxx1);
@@ -541,7 +531,7 @@
         }
 
         this.cache = new PiscesCache(pminX, pminY, pmaxX, pmaxY);
-        _endRendering(pminX, pminY, pmaxX, pmaxY);
+        _endRendering(pminX, pmaxX, spminY, spmaxY);
     }
 
     public PiscesCache getCache() {
--- a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java	Thu Mar 31 22:07:32 2011 -0700
@@ -764,6 +764,11 @@
     private static final int MAX_N_CURVES = 11;
     private float[] subdivTs = new float[MAX_N_CURVES - 1];
 
+    // If this class is compiled with ecj, then Hotspot crashes when OSR
+    // compiling this function. See bugs 7004570 and 6675699
+    // TODO: until those are fixed, we should work around that by
+    // manually inlining this into curveTo and quadTo.
+/******************************* WORKAROUND **********************************
     private void somethingTo(final int type) {
         // need these so we can update the state at the end of this method
         final float xf = middle[type-2], yf = middle[type-1];
@@ -866,6 +871,7 @@
         this.cy0 = yf;
         this.prev = DRAWING_OP_TO;
     }
+****************************** END WORKAROUND *******************************/
 
     // finds values of t where the curve in pts should be subdivided in order
     // to get good offset curves a distance of w away from the middle curve.
@@ -932,18 +938,168 @@
         middle[2] = x1;  middle[3] = y1;
         middle[4] = x2;  middle[5] = y2;
         middle[6] = x3;  middle[7] = y3;
-        somethingTo(8);
-    }
+
+        // inlined version of somethingTo(8);
+        // See the TODO on somethingTo
+
+        // need these so we can update the state at the end of this method
+        final float xf = middle[6], yf = middle[7];
+        float dxs = middle[2] - middle[0];
+        float dys = middle[3] - middle[1];
+        float dxf = middle[6] - middle[4];
+        float dyf = middle[7] - middle[5];
+
+        boolean p1eqp2 = (dxs == 0f && dys == 0f);
+        boolean p3eqp4 = (dxf == 0f && dyf == 0f);
+        if (p1eqp2) {
+            dxs = middle[4] - middle[0];
+            dys = middle[5] - middle[1];
+            if (dxs == 0f && dys == 0f) {
+                dxs = middle[6] - middle[0];
+                dys = middle[7] - middle[1];
+            }
+        }
+        if (p3eqp4) {
+            dxf = middle[6] - middle[2];
+            dyf = middle[7] - middle[3];
+            if (dxf == 0f && dyf == 0f) {
+                dxf = middle[6] - middle[0];
+                dyf = middle[7] - middle[1];
+            }
+        }
+        if (dxs == 0f && dys == 0f) {
+            // this happens iff the "curve" is just a point
+            lineTo(middle[0], middle[1]);
+            return;
+        }
 
-    @Override public long getNativeConsumer() {
-        throw new InternalError("Stroker doesn't use a native consumer");
+        // if these vectors are too small, normalize them, to avoid future
+        // precision problems.
+        if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
+            float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+            dxs /= len;
+            dys /= len;
+        }
+        if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
+            float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+            dxf /= len;
+            dyf /= len;
+        }
+
+        computeOffset(dxs, dys, lineWidth2, offset[0]);
+        final float mx = offset[0][0];
+        final float my = offset[0][1];
+        drawJoin(cdx, cdy, cx0, cy0, dxs, dys, cmx, cmy, mx, my);
+
+        int nSplits = findSubdivPoints(middle, subdivTs, 8, lineWidth2);
+
+        int kind = 0;
+        Iterator<Integer> it = Curve.breakPtsAtTs(middle, 8, subdivTs, nSplits);
+        while(it.hasNext()) {
+            int curCurveOff = it.next();
+
+            kind = computeOffsetCubic(middle, curCurveOff, lp, rp);
+            if (kind != 0) {
+                emitLineTo(lp[0], lp[1]);
+                switch(kind) {
+                case 8:
+                    emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
+                    emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
+                    break;
+                case 4:
+                    emitLineTo(lp[2], lp[3]);
+                    emitLineTo(rp[0], rp[1], true);
+                    break;
+                }
+                emitLineTo(rp[kind - 2], rp[kind - 1], true);
+            }
+        }
+
+        this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
+        this.cmy = (lp[kind - 1] - rp[kind - 1]) / 2;
+        this.cdx = dxf;
+        this.cdy = dyf;
+        this.cx0 = xf;
+        this.cy0 = yf;
+        this.prev = DRAWING_OP_TO;
     }
 
     @Override public void quadTo(float x1, float y1, float x2, float y2) {
         middle[0] = cx0; middle[1] = cy0;
         middle[2] = x1;  middle[3] = y1;
         middle[4] = x2;  middle[5] = y2;
-        somethingTo(6);
+
+        // inlined version of somethingTo(8);
+        // See the TODO on somethingTo
+
+        // need these so we can update the state at the end of this method
+        final float xf = middle[4], yf = middle[5];
+        float dxs = middle[2] - middle[0];
+        float dys = middle[3] - middle[1];
+        float dxf = middle[4] - middle[2];
+        float dyf = middle[5] - middle[3];
+        if ((dxs == 0f && dys == 0f) || (dxf == 0f && dyf == 0f)) {
+            dxs = dxf = middle[4] - middle[0];
+            dys = dyf = middle[5] - middle[1];
+        }
+        if (dxs == 0f && dys == 0f) {
+            // this happens iff the "curve" is just a point
+            lineTo(middle[0], middle[1]);
+            return;
+        }
+        // if these vectors are too small, normalize them, to avoid future
+        // precision problems.
+        if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
+            float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+            dxs /= len;
+            dys /= len;
+        }
+        if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
+            float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+            dxf /= len;
+            dyf /= len;
+        }
+
+        computeOffset(dxs, dys, lineWidth2, offset[0]);
+        final float mx = offset[0][0];
+        final float my = offset[0][1];
+        drawJoin(cdx, cdy, cx0, cy0, dxs, dys, cmx, cmy, mx, my);
+
+        int nSplits = findSubdivPoints(middle, subdivTs, 6, lineWidth2);
+
+        int kind = 0;
+        Iterator<Integer> it = Curve.breakPtsAtTs(middle, 6, subdivTs, nSplits);
+        while(it.hasNext()) {
+            int curCurveOff = it.next();
+
+            kind = computeOffsetQuad(middle, curCurveOff, lp, rp);
+            if (kind != 0) {
+                emitLineTo(lp[0], lp[1]);
+                switch(kind) {
+                case 6:
+                    emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
+                    emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
+                    break;
+                case 4:
+                    emitLineTo(lp[2], lp[3]);
+                    emitLineTo(rp[0], rp[1], true);
+                    break;
+                }
+                emitLineTo(rp[kind - 2], rp[kind - 1], true);
+            }
+        }
+
+        this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
+        this.cmy = (lp[kind - 1] - rp[kind - 1]) / 2;
+        this.cdx = dxf;
+        this.cdy = dyf;
+        this.cx0 = xf;
+        this.cy0 = yf;
+        this.prev = DRAWING_OP_TO;
+    }
+
+    @Override public long getNativeConsumer() {
+        throw new InternalError("Stroker doesn't use a native consumer");
     }
 
     // a stack of polynomial curves where each curve shares endpoints with
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/misc/JavaSecurityAccess.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 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 sun.misc;
+
+import java.security.AccessControlContext;
+import java.security.PrivilegedAction;
+
+public interface JavaSecurityAccess {
+
+    <T> T doIntersectionPrivilege(PrivilegedAction<T> action,
+                                  AccessControlContext stack,
+                                  AccessControlContext context);
+
+    <T> T doIntersectionPrivilege(PrivilegedAction<T> action,
+                                  AccessControlContext context);
+
+}
--- a/jdk/src/share/classes/sun/misc/SharedSecrets.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/SharedSecrets.java	Thu Mar 31 22:07:32 2011 -0700
@@ -30,6 +30,8 @@
 import java.io.FileDescriptor;
 import java.security.ProtectionDomain;
 
+import java.security.AccessController;
+
 /** A repository of "shared secrets", which are a mechanism for
     calling implementation-private methods in another package without
     using reflection. A package-private class implements a public
@@ -48,6 +50,7 @@
     private static JavaNioAccess javaNioAccess;
     private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
     private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
+    private static JavaSecurityAccess javaSecurityAccess;
 
     public static JavaUtilJarAccess javaUtilJarAccess() {
         if (javaUtilJarAccess == null) {
@@ -125,4 +128,15 @@
                 unsafe.ensureClassInitialized(ProtectionDomain.class);
             return javaSecurityProtectionDomainAccess;
     }
+
+    public static void setJavaSecurityAccess(JavaSecurityAccess jsa) {
+        javaSecurityAccess = jsa;
+    }
+
+    public static JavaSecurityAccess getJavaSecurityAccess() {
+        if (javaSecurityAccess == null) {
+            unsafe.ensureClassInitialized(AccessController.class);
+        }
+        return javaSecurityAccess;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/net/ResourceManager.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2011, 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 sun.net;
+
+import java.net.SocketException;
+import java.util.concurrent.atomic.AtomicInteger;
+import sun.security.action.GetPropertyAction;
+
+/**
+ * Manages count of total number of UDP sockets and ensures
+ * that exception is thrown if we try to create more than the
+ * configured limit.
+ *
+ * This functionality could be put in NetHooks some time in future.
+ */
+
+public class ResourceManager {
+
+    /* default maximum number of udp sockets per VM
+     * when a security manager is enabled.
+     * The default is 1024 which is high enough to be useful
+     * but low enough to be well below the maximum number
+     * of port numbers actually available on all OSes for
+     * such sockets (5000 on some versions of windows)
+     */
+
+    private static final int DEFAULT_MAX_SOCKETS = 1024;
+    private static final int maxSockets;
+    private static final AtomicInteger numSockets;
+
+    static {
+        String prop = java.security.AccessController.doPrivileged(
+            new GetPropertyAction("sun.net.maxDatagramSockets")
+        );
+        int defmax = DEFAULT_MAX_SOCKETS;
+        try {
+            if (prop != null) {
+                defmax = Integer.parseInt(prop);
+            }
+        } catch (NumberFormatException e) {}
+        maxSockets = defmax;
+        numSockets = new AtomicInteger(0);
+    }
+
+    public static void beforeUdpCreate() throws SocketException {
+        if (System.getSecurityManager() != null) {
+            if (numSockets.incrementAndGet() > maxSockets) {
+                numSockets.decrementAndGet();
+                throw new SocketException("maximum number of DatagramSockets reached");
+            }
+        }
+    }
+
+    public static void afterUdpClose() {
+        if (System.getSecurityManager() != null) {
+            numSockets.decrementAndGet();
+        }
+    }
+}
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Mar 31 22:07:32 2011 -0700
@@ -2173,6 +2173,13 @@
                         if (tryTransparentNTLMServer) {
                             tryTransparentNTLMServer =
                                     NTLMAuthenticationProxy.proxy.supportsTransparentAuth;
+                            /* If the platform supports transparent authentication
+                             * then check if we are in a secure environment
+                             * whether, or not, we should try transparent authentication.*/
+                            if (tryTransparentNTLMServer) {
+                                tryTransparentNTLMServer =
+                                        NTLMAuthenticationProxy.proxy.isTrustedSite(url);
+                            }
                         }
                         a = null;
                         if (tryTransparentNTLMServer) {
--- a/jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java	Thu Mar 31 22:07:32 2011 -0700
@@ -36,12 +36,14 @@
  */
 class NTLMAuthenticationProxy {
     private static Method supportsTA;
+    private static Method isTrustedSite;
     private static final String clazzStr = "sun.net.www.protocol.http.ntlm.NTLMAuthentication";
     private static final String supportsTAStr = "supportsTransparentAuth";
+    private static final String isTrustedSiteStr = "isTrustedSite";
 
     static final NTLMAuthenticationProxy proxy = tryLoadNTLMAuthentication();
     static final boolean supported = proxy != null ? true : false;
-    static final boolean supportsTransparentAuth = supported ? supportsTransparentAuth(supportsTA) : false;
+    static final boolean supportsTransparentAuth = supported ? supportsTransparentAuth() : false;
 
     private final Constructor<? extends AuthenticationInfo> threeArgCtr;
     private final Constructor<? extends AuthenticationInfo> fiveArgCtr;
@@ -82,9 +84,22 @@
      * authentication (try with the current users credentials before
      * prompting for username and password, etc).
      */
-    private static boolean supportsTransparentAuth(Method method) {
+    private static boolean supportsTransparentAuth() {
         try {
-            return (Boolean)method.invoke(null);
+            return (Boolean)supportsTA.invoke(null);
+        } catch (ReflectiveOperationException roe) {
+            finest(roe);
+        }
+
+        return false;
+    }
+
+    /* Transparent authentication should only be tried with a trusted
+     * site ( when running in a secure environment ).
+     */
+    public static boolean isTrustedSite(URL url) {
+        try {
+            return (Boolean)isTrustedSite.invoke(null, url);
         } catch (ReflectiveOperationException roe) {
             finest(roe);
         }
@@ -112,6 +127,7 @@
                                             int.class,
                                             PasswordAuthentication.class);
                 supportsTA = cl.getDeclaredMethod(supportsTAStr);
+                isTrustedSite = cl.getDeclaredMethod(isTrustedSiteStr, java.net.URL.class);
                 return new NTLMAuthenticationProxy(threeArg,
                                                    fiveArg);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2011, 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 sun.net.www.protocol.http.ntlm;
+
+import java.net.URL;
+
+/**
+ * This class is used to call back to deployment to determine if a given
+ * URL is trusted. Transparent authentication (try with logged in users
+ * credentials without prompting) should only be tried with trusted sites.
+ */
+public abstract class NTLMAuthenticationCallback {
+    private static volatile NTLMAuthenticationCallback callback =
+            new DefaultNTLMAuthenticationCallback();
+
+    public static void setNTLMAuthenticationCallback(
+            NTLMAuthenticationCallback callback) {
+        NTLMAuthenticationCallback.callback = callback;
+    }
+
+    public static NTLMAuthenticationCallback getNTLMAuthenticationCallback() {
+        return callback;
+    }
+
+    /**
+     * Returns true if the given site is trusted, i.e. we can try
+     * transparent Authentication.
+     */
+    public abstract boolean isTrustedSite(URL url);
+
+    static class DefaultNTLMAuthenticationCallback extends NTLMAuthenticationCallback {
+        @Override
+        public boolean isTrustedSite(URL url) { return true; }
+    }
+}
+
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -32,6 +32,7 @@
 import java.nio.channels.*;
 import java.nio.channels.spi.*;
 import java.util.*;
+import sun.net.ResourceManager;
 
 
 /**
@@ -101,14 +102,22 @@
         throws IOException
     {
         super(sp);
-        this.family = Net.isIPv6Available() ?
-            StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
-        this.fd = Net.socket(family, false);
-        this.fdVal = IOUtil.fdVal(fd);
-        this.state = ST_UNCONNECTED;
+        ResourceManager.beforeUdpCreate();
+        try {
+            this.family = Net.isIPv6Available() ?
+                StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+            this.fd = Net.socket(family, false);
+            this.fdVal = IOUtil.fdVal(fd);
+            this.state = ST_UNCONNECTED;
+        } catch (IOException ioe) {
+            ResourceManager.afterUdpClose();
+            throw ioe;
+        }
     }
 
-    public DatagramChannelImpl(SelectorProvider sp, ProtocolFamily family) {
+    public DatagramChannelImpl(SelectorProvider sp, ProtocolFamily family)
+        throws IOException
+    {
         super(sp);
         if ((family != StandardProtocolFamily.INET) &&
             (family != StandardProtocolFamily.INET6))
@@ -957,6 +966,7 @@
     protected void implCloseSelectableChannel() throws IOException {
         synchronized (stateLock) {
             nd.preClose(fd);
+            ResourceManager.afterUdpClose();
 
             // if member of mulitcast group then invalidate all keys
             if (registry != null)
--- a/jdk/src/share/classes/sun/nio/ch/Net.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/Net.java	Thu Mar 31 22:07:32 2011 -0700
@@ -312,11 +312,12 @@
 
     private static native boolean canJoin6WithIPv4Group0();
 
-    static FileDescriptor socket(boolean stream) {
+    static FileDescriptor socket(boolean stream) throws IOException {
         return socket(UNSPEC, stream);
     }
 
-    static FileDescriptor socket(ProtocolFamily family, boolean stream) {
+    static FileDescriptor socket(ProtocolFamily family, boolean stream)
+        throws IOException {
         boolean preferIPv6 = isIPv6Available() &&
             (family != StandardProtocolFamily.INET);
         return IOUtil.newFD(socket0(preferIPv6, stream, false));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/resources/CollationData_sr_Latn.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/*
+ */
+
+/*
+ * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation
+ * is copyrighted and owned by Taligent, Inc., a wholly-owned
+ * subsidiary of IBM. These materials are provided under terms
+ * of a License Agreement between Taligent and Sun. This technology
+ * is protected by multiple US and International patents.
+ *
+ * This notice and attribution to Taligent may not be removed.
+ * Taligent is a registered trademark of Taligent, Inc.
+ *
+ */
+
+package sun.text.resources;
+
+import java.util.ListResourceBundle;
+
+public class CollationData_sr_Latn extends ListResourceBundle {
+
+    protected final Object[][] getContents() {
+        return new Object[][] {
+            { "Rule",
+                /* for sr-Latin, default sorting except for the following: */
+
+                /* add dz "ligature" between d and d<stroke>. */
+                /* add d<stroke> between d and e. */
+                /* add lj "ligature" between l and l<stroke>. */
+                /* add l<stroke> between l and m. */
+                /* add nj "ligature" between n and o. */
+                /* add z<abovedot> after z.       */
+                "& \u200f = \u030c "
+                + "& \u0306 = \u030d "
+                + "& C < c\u030c , C\u030c "  // C < c-caron
+                + "< c\u0301 , C\u0301 "      // c-acute
+                + "& D < \u01f3 , \u01f2 , \u01f1 "  // dz
+                + "< dz , dZ , Dz , DZ "      // dz ligature
+                + "< \u01c6 , \u01c5 , \u01c4 "  // dz-caron
+                + "< \u0111 , \u0110 "           // d-stroke
+                + "& L < lj , lJ , Lj , LJ " // l < lj ligature
+                + "& N < nj , nJ , Nj , NJ " // n < nj ligature
+                + "& S < s\u030c , S\u030c "  // s < s-caron
+                + "& Z < z\u030c , Z\u030c "  // z < z-caron
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/resources/FormatData_sr_Latn.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ */
+
+/*
+ * COPYRIGHT AND PERMISSION NOTICE
+ *
+ * Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+ * Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of the Unicode data files and any associated documentation (the
+ * "Data Files") or Unicode software and any associated documentation
+ * (the "Software") to deal in the Data Files or Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, and/or sell copies of the Data
+ * Files or Software, and to permit persons to whom the Data Files or
+ * Software are furnished to do so, provided that (a) the above copyright
+ * notice(s) and this permission notice appear with all copies of the
+ * Data Files or Software, (b) both the above copyright notice(s) and
+ * this permission notice appear in associated documentation, and (c)
+ * there is clear notice in each modified Data File or in the Software as
+ * well as in the documentation associated with the Data File(s) or
+ * Software that the data or software has been modified.
+ *
+ * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+ * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+ * ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in these Data Files or Software without prior
+ * written authorization of the copyright holder.
+ */
+
+// Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+package sun.text.resources;
+
+import java.util.ListResourceBundle;
+
+public class FormatData_sr_Latn extends ListResourceBundle {
+    protected final Object[][] getContents() {
+        return new Object[][] {
+            { "MonthNames",
+                new String[] {
+                    "januar",
+                    "februar",
+                    "mart",
+                    "april",
+                    "maj",
+                    "jun",
+                    "jul",
+                    "avgust",
+                    "septembar",
+                    "oktobar",
+                    "novembar",
+                    "decembar",
+                    "",
+                }
+            },
+            { "MonthAbbreviations",
+                new String[] {
+                    "jan",
+                    "feb",
+                    "mar",
+                    "apr",
+                    "maj",
+                    "jun",
+                    "jul",
+                    "avg",
+                    "sep",
+                    "okt",
+                    "nov",
+                    "dec",
+                    "",
+                }
+            },
+            { "DayNames",
+                new String[] {
+                    "nedelja",
+                    "ponedeljak",
+                    "utorak",
+                    "sreda",
+                    "\u010detvrtak",
+                    "petak",
+                    "subota",
+                }
+            },
+            { "DayAbbreviations",
+                new String[] {
+                    "ned",
+                    "pon",
+                    "uto",
+                    "sre",
+                    "\u010det",
+                    "pet",
+                    "sub",
+                }
+            },
+            { "Eras",
+                new String[] {
+                    "p. n. e.",
+                    "n. e",
+                }
+            },
+            { "NumberPatterns",
+                new String[] {
+                    "#,##0.###",
+                    "\u00a4\u00a0#,##0.00",
+                    "#,##0%",
+                }
+            },
+            { "NumberElements",
+                new String[] {
+                    ".",
+                    ",",
+                    ";",
+                    "%",
+                    "0",
+                    "#",
+                    "-",
+                    "E",
+                    "\u2030",
+                    "\u221e",
+                    "NaN",
+                }
+            },
+            { "DateTimePatterns",
+                new String[] {
+                    "HH.mm.ss zzzz",
+                    "HH.mm.ss z",
+                    "HH.mm.ss",
+                    "HH.mm",
+                    "EEEE, dd. MMMM y.",
+                    "dd. MMMM y.",
+                    "dd.MM.y.",
+                    "d.M.yy.",
+                    "{1} {0}",
+                }
+            },
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/resources/FormatData_sr_Latn_BA.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ */
+
+/*
+ * COPYRIGHT AND PERMISSION NOTICE
+ *
+ * Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+ * Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of the Unicode data files and any associated documentation (the
+ * "Data Files") or Unicode software and any associated documentation
+ * (the "Software") to deal in the Data Files or Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, and/or sell copies of the Data
+ * Files or Software, and to permit persons to whom the Data Files or
+ * Software are furnished to do so, provided that (a) the above copyright
+ * notice(s) and this permission notice appear with all copies of the
+ * Data Files or Software, (b) both the above copyright notice(s) and
+ * this permission notice appear in associated documentation, and (c)
+ * there is clear notice in each modified Data File or in the Software as
+ * well as in the documentation associated with the Data File(s) or
+ * Software that the data or software has been modified.
+ *
+ * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+ * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+ * ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in these Data Files or Software without prior
+ * written authorization of the copyright holder.
+ */
+
+// Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+package sun.text.resources;
+
+import sun.util.EmptyListResourceBundle;
+
+public class FormatData_sr_Latn_BA extends EmptyListResourceBundle {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/resources/FormatData_sr_Latn_ME.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ */
+
+/*
+ * COPYRIGHT AND PERMISSION NOTICE
+ *
+ * Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+ * Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of the Unicode data files and any associated documentation (the
+ * "Data Files") or Unicode software and any associated documentation
+ * (the "Software") to deal in the Data Files or Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, and/or sell copies of the Data
+ * Files or Software, and to permit persons to whom the Data Files or
+ * Software are furnished to do so, provided that (a) the above copyright
+ * notice(s) and this permission notice appear with all copies of the
+ * Data Files or Software, (b) both the above copyright notice(s) and
+ * this permission notice appear in associated documentation, and (c)
+ * there is clear notice in each modified Data File or in the Software as
+ * well as in the documentation associated with the Data File(s) or
+ * Software that the data or software has been modified.
+ *
+ * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+ * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+ * ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in these Data Files or Software without prior
+ * written authorization of the copyright holder.
+ */
+
+// Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+package sun.text.resources;
+
+import java.util.ListResourceBundle;
+
+public class FormatData_sr_Latn_ME extends ListResourceBundle {
+    protected final Object[][] getContents() {
+        return new Object[][] {
+            { "DateTimePatterns",
+                new String[] {
+                    "HH.mm.ss zzzz",
+                    "HH.mm.ss z",
+                    "HH.mm.ss",
+                    "HH.mm",
+                    "EEEE, dd. MMMM y.",
+                    "d.MM.yyyy.",
+                    "dd.MM.y.",
+                    "d.M.yy.",
+                    "{1} {0}",
+                }
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/resources/FormatData_sr_Latn_RS.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ */
+
+/*
+ * COPYRIGHT AND PERMISSION NOTICE
+ *
+ * Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+ * Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of the Unicode data files and any associated documentation (the
+ * "Data Files") or Unicode software and any associated documentation
+ * (the "Software") to deal in the Data Files or Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, and/or sell copies of the Data
+ * Files or Software, and to permit persons to whom the Data Files or
+ * Software are furnished to do so, provided that (a) the above copyright
+ * notice(s) and this permission notice appear with all copies of the
+ * Data Files or Software, (b) both the above copyright notice(s) and
+ * this permission notice appear in associated documentation, and (c)
+ * there is clear notice in each modified Data File or in the Software as
+ * well as in the documentation associated with the Data File(s) or
+ * Software that the data or software has been modified.
+ *
+ * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+ * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+ * ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in these Data Files or Software without prior
+ * written authorization of the copyright holder.
+ */
+
+// Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+package sun.text.resources;
+
+import sun.util.EmptyListResourceBundle;
+
+public class FormatData_sr_Latn_RS extends EmptyListResourceBundle {
+}
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_ja.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_ja.java	Thu Mar 31 22:07:32 2011 -0700
@@ -44,7 +44,7 @@
  * or if the keys ends with ".mnemonic", an element
  * representing a mnemomic keycode <code>int</code> or <code>char</code>.
  */
-public class JConsoleResources_ja extends ListResourceBundle {
+public class JConsoleResources_ja extends JConsoleResources {
 
     /**
      * Returns the contents of this <code>ResourceBundle</code>.
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_zh_CN.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_zh_CN.java	Thu Mar 31 22:07:32 2011 -0700
@@ -44,7 +44,7 @@
  * or if the keys ends with ".mnemonic", an element
  * representing a mnemomic keycode <code>int</code> or <code>char</code>.
  */
-public class JConsoleResources_zh_CN extends ListResourceBundle {
+public class JConsoleResources_zh_CN extends JConsoleResources {
 
     /**
      * Returns the contents of this <code>ResourceBundle</code>.
--- a/jdk/src/share/classes/sun/util/logging/resources/logging.properties	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/resources/logging.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -25,13 +25,22 @@
 
 # Localizations for Level names.  For the US locale
 # these are the same as the non-localized level name.
+
+# The following ALL CAPS words should be translated.
 ALL=ALL
+# The following ALL CAPS words should be translated.
 SEVERE=SEVERE
+# The following ALL CAPS words should be translated.
 WARNING=WARNING
+# The following ALL CAPS words should be translated.
 INFO=INFO
+# The following ALL CAPS words should be translated.
 CONFIG= CONFIG
+# The following ALL CAPS words should be translated.
 FINE=FINE
+# The following ALL CAPS words should be translated.
 FINER=FINER
+# The following ALL CAPS words should be translated.
 FINEST=FINEST
+# The following ALL CAPS words should be translated.
 OFF=OFF
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CalendarData_sr_Latn_BA.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+minimalDaysInFirstWeek=4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CalendarData_sr_Latn_ME.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+minimalDaysInFirstWeek=4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CalendarData_sr_Latn_RS.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+minimalDaysInFirstWeek=4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_pt.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,250 @@
+#
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of the Unicode data files and any associated documentation (the "Data
+# Files") or Unicode software and any associated documentation (the
+# "Software") to deal in the Data Files or Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, and/or sell copies of the Data Files or Software, and
+# to permit persons to whom the Data Files or Software are furnished to do
+# so, provided that (a) the above copyright notice(s) and this permission
+# notice appear with all copies of the Data Files or Software, (b) both the
+# above copyright notice(s) and this permission notice appear in associated
+# documentation, and (c) there is clear notice in each modified Data File or
+# in the Software as well as in the documentation associated with the Data
+# File(s) or Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
+# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
+# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder shall not
+# be used in advertising or otherwise to promote the sale, use or other
+# dealings in these Data Files or Software without prior written
+# authorization of the copyright holder.
+#
+ 
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+
+adp=Peseta de Andorra
+aed=Dir\u00e9m dos Emirados \u00c1rabes Unidos
+afa=Afegane (1927-2002)
+afn=Afegane
+all=Lek Alban\u00eas
+amd=Dram arm\u00eanio
+ang=Guilder das Antilhas Holandesas
+aoa=Cuanza angolano
+ars=Peso argentino
+ats=Xelim austr\u00edaco
+aud=D\u00f3lar australiano
+awg=Guilder de Aruba
+azm=Manat azerbaijano
+azn=Manat do Azerbaij\u00e3o
+bam=Marco b\u00f3snio-herzegovino convers\u00edvel
+bbd=D\u00f3lar de Barbados
+bdt=Taka de Bangladesh
+bef=Franco belga
+bgl=Lev forte b\u00falgaro
+bgn=Lev novo b\u00falgaro
+bhd=Dinar bareinita
+bif=Franco do Burundi
+bmd=D\u00f3lar das Bermudas
+bnd=D\u00f3lar do Brunei
+bov=Mvdol boliviano
+brl=Real brasileiro
+bsd=D\u00f3lar das Bahamas
+btn=Ngultrum do But\u00e3o
+bwp=Pula botsuanesa
+byb=Rublo novo bielo-russo (1994-1999)
+byr=Rublo bielo-russo
+bzd=D\u00f3lar do Belize
+cad=D\u00f3lar canadense
+cdf=Franco congol\u00eas
+chf=Franco su\u00ed\u00e7o
+clf=Unidades de Fomento chilenas
+clp=Peso chileno
+cny=Yuan Renminbi chin\u00eas
+cop=Peso colombiano
+crc=Colon da Costa Rica
+csd=Dinar s\u00e9rvio antigo
+cup=Peso cubano
+cve=Escudo cabo-verdiano
+cyp=Libra cipriota
+czk=Coroa checa
+dem=Marco alem\u00e3o
+djf=Franco do Djibuti
+dkk=Coroa dinamarquesa
+dop=Peso dominicano
+dzd=Dinar argelino
+eek=Coroa estoniana
+egp=Libra eg\u00edpcia
+ern=Nakfa da Eritreia
+esp=Peseta espanhola
+etb=Birr et\u00edope
+fim=Marca finlandesa
+fjd=D\u00f3lar de Fiji
+fkp=Libra das Malvinas
+frf=Franco franc\u00eas
+gbp=Libra esterlina brit\u00e2nica
+gel=Lari georgiano
+ghc=Cedi de Gana (1979-2007)
+ghs=Cedi gan\u00eas
+gip=Libra de Gibraltar
+gmd=Dalasi de G\u00e2mbia
+gnf=Franco de Guin\u00e9
+grd=Dracma grego
+gtq=Quet\u00e7al da Guatemala
+gwp=Peso da Guin\u00e9-Bissau
+gyd=D\u00f3lar da Guiana
+hkd=D\u00f3lar de Hong Kong
+hnl=Lempira de Honduras
+hrk=Kuna croata
+htg=Gurde do Haiti
+huf=Forinte h\u00fangaro
+idr=Rupia indon\u00e9sia
+iep=Libra irlandesa
+ils=Sheqel Novo israelita
+inr=R\u00fapia indiana
+iqd=Dinar iraquiano
+irr=Rial iraniano
+isk=Coroa islandesa
+itl=Lira italiana
+jmd=D\u00f3lar jamaicano
+jod=Dinar jordaniano
+jpy=Iene japon\u00eas
+kes=Xelim queniano
+kgs=Som quirguiz
+khr=Riel cambojano
+kmf=Franco de Comores
+kpw=Won norte-coreano
+krw=Won sul-coreano
+kwd=Dinar coveitiano
+kyd=D\u00f3lar das Ilhas Caiman
+kzt=Tenge do Cazaquist\u00e3o
+lak=Kip de Laos
+lbp=Libra libanesa
+lkr=Rupia do Sri Lanka
+lrd=D\u00f3lar liberiano
+lsl=Loti do Lesoto
+ltl=Lita lituano
+luf=Franco luxemburgu\u00eas
+lvl=Lats let\u00e3o
+lyd=Dinar l\u00edbio
+mad=Dir\u00e9m marroquino
+mdl=Leu mold\u00e1vio
+mga=Ariary de Madagascar
+mgf=Franco de Madagascar
+mkd=Dinar maced\u00f4nio
+mmk=Kyat de Mianmar
+mnt=Tugrik mongol
+mop=Pataca macaense
+mro=Ouguiya da Maurit\u00e2nia
+mtl=Lira maltesa
+mur=Rupia de Maur\u00edcio
+mvr=Rupias das Ilhas Maldivas
+mwk=Cuacha do Mal\u00e1ui
+mxn=Peso mexicano
+mxv=Unidade Mexicana de Investimento (UDI)
+myr=Ringgit malaio
+mzm=Metical antigo de Mo\u00e7ambique
+mzn=Metical do Mo\u00e7ambique
+nad=D\u00f3lar da Nam\u00edbia
+ngn=Naira nigeriana
+nio=C\u00f3rdoba Ouro nicaraguense
+nlg=Florim holand\u00eas
+nok=Coroa norueguesa
+npr=Rupia nepalesa
+nzd=D\u00f3lar da Nova Zel\u00e2ndia
+omr=Rial de Om\u00e3
+pab=Balboa panamenho
+pen=Sol Novo peruano
+pgk=Kina da Papua-Nova Guin\u00e9
+php=Peso filipino
+pkr=Rupia paquistanesa
+pln=Zloti polon\u00eas
+pte=Escudo portugu\u00eas
+pyg=Guarani paraguaio
+qar=Rial catariano
+rol=Leu romeno antigo
+ron=Leu romeno
+rsd=Dinar s\u00e9rvio
+rub=Rublo russo
+rur=Rublo russo (1991-1998)
+rwf=Franco ruand\u00eas
+sar=Rial saudita
+sbd=D\u00f3lar das Ilhas Salom\u00e3o
+scr=Rupia das Seychelles
+sdd=Dinar sudan\u00eas
+sdg=Libra sudanesa
+sek=Coroa sueca
+sgd=D\u00f3lar de Cingapura
+shp=Libra de Santa Helena
+sit=Tolar Bons esloveno
+skk=Coroa eslovaca
+sll=Leone de Serra Leoa
+sos=Xelim somali
+srd=D\u00f3lar do Suriname
+srg=Florim do Suriname
+std=Dobra de S\u00e3o Tom\u00e9 e Pr\u00edncipe
+svc=Colom salvadorenho
+syp=Libra s\u00edria
+szl=Lilangeni da Suazil\u00e2ndia
+thb=Baht tailand\u00eas
+tjs=Somoni tadjique
+tmm=Manat do Turcomenist\u00e3o
+tnd=Dinar tunisiano
+top=Pa\u02bbanga de Tonga
+tpe=Escudo timorense
+trl=Lira turca antiga
+try=Lira turca
+ttd=D\u00f3lar de Trinidad e Tobago
+twd=D\u00f3lar Novo de Taiwan
+tzs=Xelim da Tanz\u00e2nia
+uah=Hryvnia ucraniano
+ugx=Xelim ugandense
+usd=D\u00f3lar norte-americano
+usn=D\u00f3lar norte-americano (Dia seguinte)
+uss=D\u00f3lar norte-americano (Mesmo dia)
+uyu=Peso uruguaio
+uzs=Sum do Usbequist\u00e3o
+veb=Bol\u00edvar venezuelano
+vef=Bol\u00edvar v enezuelano forte
+vnd=Dong vietnamita
+vuv=Vatu de Vanuatu
+wst=Tala samoano
+xaf=Franco CFA BEAC
+xag=Prata
+xau=Ouro
+xba=Unidade Composta Europeia
+xbb=Unidade Monet\u00e1ria Europeia
+xbc=Unidade de Conta Europeia (XBC)
+xbd=Unidade de Conta Europeia (XBD)
+xcd=D\u00f3lar do Caribe Oriental
+xdr=Direitos Especiais de Giro
+xfo=Franco-ouro franc\u00eas
+xfu=Franco UIC franc\u00eas
+xof=Franco CFA BCEAO
+xpd=Pal\u00e1dio
+xpf=Franco CFP
+xpt=Platina
+xts=C\u00f3digo de Moeda de Teste
+xxx=Moeda Desconhecida ou Inv\u00e1lida
+yer=Rial iemenita
+yum=Dinar noviy iugoslavo
+zar=Rand sul-africano
+zmk=Cuacha zambiano
+zwd=D\u00f3lar do Zimb\u00e1bue
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_BA.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,69 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+BAM=KM
+bam=bosansko-hercegova\u010dkih konvertibilnih maraka
+EUR=\u20ac
+eur=evra
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_ME.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+EUR=\u20ac
+eur=evra
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_RS.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+RSD=din.
+rsd=srpski dinari
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_RS.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of the Unicode data files and any associated documentation (the "Data
+# Files") or Unicode software and any associated documentation (the
+# "Software") to deal in the Data Files or Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, and/or sell copies of the Data Files or Software, and
+# to permit persons to whom the Data Files or Software are furnished to do
+# so, provided that (a) the above copyright notice(s) and this permission
+# notice appear with all copies of the Data Files or Software, (b) both the
+# above copyright notice(s) and this permission notice appear in associated
+# documentation, and (c) there is clear notice in each modified Data File or
+# in the Software as well as in the documentation associated with the Data
+# File(s) or Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
+# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
+# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder shall not
+# be used in advertising or otherwise to promote the sale, use or other
+# dealings in these Data Files or Software without prior written
+# authorization of the copyright holder.
+#
+ 
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+
+RSD=\u0434\u0438\u043d.
--- a/jdk/src/share/classes/sun/util/resources/LocaleData.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/LocaleData.java	Thu Mar 31 22:07:32 2011 -0700
@@ -171,16 +171,21 @@
             /* Get the locale string list from LocaleDataMetaInfo class. */
             String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName);
 
-            if (localeString.length() == 0) {
+      if (localeString.length() == 0) {
                 return candidates;
             }
 
             for (Iterator<Locale> l = candidates.iterator(); l.hasNext(); ) {
-                String lstr = l.next().toString();
-                /* truncate extra segment introduced by Java 7 for script and extesions */
-                int idx = lstr.indexOf("_#");
-                if (idx >= 0) {
-                    lstr = lstr.substring(0, idx);
+                Locale loc = l.next();
+                String lstr = null;
+                if (loc.getScript().length() > 0) {
+                    lstr = loc.toLanguageTag().replace('-', '_');
+                } else {
+                    lstr = loc.toString();
+                    int idx = lstr.indexOf("_#");
+                    if (idx >= 0) {
+                        lstr = lstr.substring(0, idx);
+                    }
                 }
                 /* Every locale string in the locale string list returned from
                    the above getSupportedLocaleString is enclosed
@@ -265,28 +270,15 @@
 
         Locale[] locales = new Locale[localeStringTokenizer.countTokens()];
         for (int i = 0; i < locales.length; i++) {
-            String currentToken = localeStringTokenizer.nextToken();
-            int p2 = 0;
-            int p1 = currentToken.indexOf('_');
-            String language = "";
-            String country = "";
-            String variant = "";
-
-            if (p1 == -1) {
-                language = currentToken;
-            } else {
-                language = currentToken.substring(0, p1);
-                p2 = currentToken.indexOf('_', p1 + 1);
-                if (p2 == -1) {
-                    country = currentToken.substring(p1 + 1);
-                } else {
-                    country = currentToken.substring(p1 + 1, p2);
-                    if (p2 < currentToken.length()) {
-                        variant = currentToken.substring(p2 + 1);
-                    }
-                }
+            String currentToken = localeStringTokenizer.nextToken().replace('_','-');
+            if (currentToken.equals("ja-JP-JP")) {
+                currentToken = "ja-JP-u-ca-japanese-x-lvariant-JP";
+            } else if (currentToken.equals("th-TH-TH")) {
+                currentToken = "th-TH-u-nu-thai-x-lvariant-TH";
+            } else if (currentToken.equals("no-NO-NY")) {
+                currentToken = "no-NO-x-lvariant-NY";
             }
-            locales[i] = new Locale(language, country, variant);
+            locales[i] = Locale.forLanguageTag(currentToken);
         }
         return locales;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/LocaleNames_sr_Latn.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,471 @@
+#
+# Copyright (c) 2005, 2011, 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.
+#
+
+#
+# COPYRIGHT AND PERMISSION NOTICE
+#
+# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of the Unicode data files and any associated documentation (the
+# "Data Files") or Unicode software and any associated documentation
+# (the "Software") to deal in the Data Files or Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, and/or sell copies of the Data
+# Files or Software, and to permit persons to whom the Data Files or
+# Software are furnished to do so, provided that (a) the above copyright
+# notice(s) and this permission notice appear with all copies of the
+# Data Files or Software, (b) both the above copyright notice(s) and
+# this permission notice appear in associated documentation, and (c)
+# there is clear notice in each modified Data File or in the Software as
+# well as in the documentation associated with the Data File(s) or
+# Software that the data or software has been modified.
+#
+# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in these Data Files or Software without prior
+# written authorization of the copyright holder.
+
+#
+# Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
+#
+aa=Afarski
+ab=Abkazijski
+ae=Avestanski
+af=Afrikanerski
+am=Amharski
+an=Aragone\u017eanski
+ar=Arapski
+as=Asemijski
+av=Avarski
+ay=Ajmara
+az=Azerbejd\u017eanski
+ba=Ba\u0161kir
+be=Beloruski
+bg=Bugarski
+bh=Biharski
+bn=Bengalski
+bo=Tibetanski
+br=Bretonski
+bs=Bosanski
+ca=Katalonski
+ce=\u010ce\u010denski
+ch=\u010camoro
+co=Korzikanski
+cr=Kri
+cs=\u010ce\u0161ki
+cu=Staroslovenski
+cv=\u010cuva\u0161ki
+cy=Vel\u0161ki
+da=Danski
+de=Nema\u010dki
+dv=Divehijski
+dz=D\u017eonga
+ee=Eve
+el=Gr\u010dki
+en=Engleski
+eo=Esperanto
+es=\u0160panski
+et=Estonski
+eu=Baskijski
+fa=Persijski
+fi=Finski
+fj=Fid\u017eijski
+fo=Farski
+fr=Francuski
+fy=Frizijski
+ga=Irski
+gd=\u0160kotski Galski
+gl=Galski
+gn=Gvarani
+gu=Gud\u017earati
+gv=Manks
+he=Hebrejski
+hi=Hindi
+hr=Hrvatski
+ht=Hai\u0107anski
+hu=Ma\u0111arski
+hy=Jermenski
+ia=Interlingva
+id=Indonezijski
+ie=Interlingve
+ii=Si\u010duan ji
+ik=Inupiak
+in=Indonezijski
+is=Islandski
+it=Italijanski
+iw=Hebrejski
+ja=Japanski
+ji=Jidi\u0161
+jv=Javanski
+ka=Gruzijski
+ki=Kikuju
+kj=Kuanjama
+kk=Koza\u010dki
+kl=Kalalisutski
+km=Kmerski
+kn=Kanada
+ko=Korejski
+ks=Ka\u0161miri
+ku=Kurdski
+kw=Korni\u0161ki
+ky=Kirgiski
+la=Latinski
+lb=Luksembur\u0161ki
+li=Limburgi\u0161
+lo=Lao\u0161ki
+lt=Litvanski
+lu=Luba-katanga
+lv=Letonski
+mg=Malagazijski
+mh=Mar\u0161alski
+mi=Maorski
+mk=Makedonski
+ml=Malajalam
+mn=Mongolski
+mo=Moldavski
+mr=Marati
+ms=Malajski
+mt=Melte\u0161ki
+my=Burmanski
+nb=Norve\u0161ki bokm\u00e5l
+nd=Severni ndebele
+ne=Nepalski
+nl=Holandski
+nn=Norve\u0161ki njorsk
+no=Norve\u0161ki
+nr=Ju\u017eni ndebele
+nv=Navaho
+ny=Njanja
+oc=Provansalski
+oj=Ojibva
+or=Orijski
+os=Osetski
+pa=Pand\u017eabski
+pl=Poljski
+ps=Pa\u0161tunski
+pt=Portugalski
+qu=Kven\u010da
+rm=Reto-Romanski
+ro=Rumunski
+ru=Ruski
+rw=Kinjarvanda
+sa=Sanskrit
+sc=Sardinijski
+sd=Sindi
+se=Severni sami
+si=Singaleski
+sk=Slova\u010dki
+sl=Slovena\u010dki
+sm=Samoanski
+sn=\u0160ona
+so=Somalski
+sq=Albanski
+sr=Srpski
+ss=Svati
+st=Sesoto
+su=Sudanski
+sv=\u0160vedski
+sw=Svahili
+ta=Tamilski
+tg=Ta\u0111ik
+th=Tajlandski
+ti=Tigrinja
+tk=Turkmenski
+tl=Tagalski
+tn=Tsvana
+tr=Turski
+tt=Tatarski
+tw=Tvi
+ty=Tahi\u0107anski
+ug=Ujgurski
+uk=Ukrajinski
+uz=Uzbe\u010dki
+vi=Vijetnamski
+wa=Valun
+wo=Volof
+xh=Khosa
+yi=Jidi\u0161
+yo=Jorubanski
+za=Zuang
+zh=Kineski
+AD=Andora
+AE=Ujedinjeni Arapski Emirati
+AF=Avganistan
+AG=Antigva i Barbuda
+AI=Angvila
+AL=Albanija
+AM=Armenija
+AN=Holandski Antili
+AO=Angola
+AQ=Antarktika
+AR=Argentina
+AS=Ameri\u010dka Samoa
+AT=Austrija
+AU=Australija
+AW=Aruba
+AX=Alandska ostrva
+AZ=Azerbejd\u017ean
+BA=Bosna i Hercegovina
+BB=Barbados
+BD=Banglade\u0161
+BE=Belgija
+BF=Burkina Faso
+BG=Bugarska
+BH=Bahrein
+BI=Burundi
+BJ=Benin
+BL=Sv. Bartolomej
+BM=Bermuda
+BN=Brunej
+BO=Bolivija
+BR=Brazil
+BS=Bahami
+BT=Butan
+BV=Buve Ostrva
+BW=Bocvana
+BY=Belorusija
+BZ=Belise
+CA=Kanada
+CC=Kokos (Keling) Ostrva
+CD=Demokratska Republika Kongo
+CF=Centralno Afri\u010dka Republika
+CG=Kongo
+CH=\u0160vajcarska
+CI=Obala Slonova\u010de
+CK=Kukova Ostrva
+CL=\u010cile
+CM=Kamerun
+CN=Kina
+CO=Kolumbija
+CR=Kostarika
+CU=Kuba
+CV=Kape Verde
+CX=Bo\u017ei\u0107na Ostrva
+CY=Kipar
+CZ=\u010ce\u0161ka
+DE=Nema\u010dka
+DJ=D\u017eibuti
+DK=Danska
+DM=Dominika
+DO=Dominikanska Republika
+DZ=Al\u017eir
+EC=Ekvador
+EE=Estonija
+EG=Egipat
+EH=Zapadna Sahara
+ER=Eritreja
+ES=\u0160panija
+ET=Etiopija
+FI=Finska
+FJ=Fid\u017ei
+FK=Folklandska Ostrva
+FM=Mikronezija
+FO=Farska Ostrva
+FR=Francuska
+GA=Gabon
+GB=Velika Britanija
+GD=Grenada
+GE=Gruzija
+GF=Francuska Gvajana
+GG=Gurnsi
+GH=Gana
+GI=Gibraltar
+GL=Grenland
+GM=Gambija
+GN=Gvineja
+GP=Gvadelupe
+GQ=Ekvatorijalna Gvineja
+GR=Gr\u010dka
+GS=Ju\u017ena D\u017eord\u017eija i Ju\u017ena Sendvi\u010d Ostrva
+GT=Gvatemala
+GU=Guam
+GW=Gvineja-Bisao
+GY=Gvajana
+HK=Hong Kong (S. A. R. Kina)
+HM=Herd i Mekdonald Ostrva
+HN=Honduras
+HR=Hrvatska
+HT=Haiti
+HU=Ma\u0111arska
+ID=Indonezija
+IE=Irska
+IL=Izrael
+IM=Ostrvo Man
+IN=Indija
+IO=Britansko Indijska Okeanska Teritorija
+IQ=Irak
+IR=Iran
+IS=Island
+IT=Italija
+JE=D\u017eersi
+JM=Jamajka
+JO=Jordan
+JP=Japan
+KE=Kenija
+KG=Kirgizstan
+KH=Kambod\u017ea
+KI=Kiribati
+KM=Komorska Ostrva
+KN=Sent Kits i Nevis
+KP=Severna Koreja
+KR=Ju\u017ena Koreja
+KW=Kuvajt
+KY=Kajmanska Ostrva
+KZ=Kazahstan
+LA=Laos
+LB=Liban
+LC=Sent Lucija
+LI=Lihten\u0161tajn
+LK=\u0160ri Lanka
+LR=Liberija
+LS=Lesoto
+LT=Litvanija
+LU=Luksemburg
+LV=Letonija
+LY=Libija
+MA=Maroko
+MC=Monako
+MD=Moldavija
+ME=Crna Gora
+MF=Sv. Martin
+MG=Madagaskar
+MH=Mar\u0161alska Ostrva
+MK=Makedonija
+ML=Mali
+MM=Mijanmar
+MN=Mongolija
+MO=Makao (S. A. R. Kina)
+MP=Severna Marijanska Ostrva
+MQ=Martinik
+MR=Mauritanija
+MS=Monserat
+MT=Malta
+MU=Mauricius
+MV=Maldivi
+MW=Malavi
+MX=Meksiko
+MY=Malezija
+MZ=Mozambik
+NA=Namibija
+NC=Nova Kaledonija
+NE=Niger
+NF=Norfolk Ostrvo
+NG=Nigerija
+NI=Nikaragva
+NL=Holandija
+NO=Norve\u0161ka
+NP=Nepal
+NR=Nauru
+NU=Niue
+NZ=Novi Zeland
+OM=Oman
+PA=Panama
+PE=Peru
+PF=Francuska Polinezija
+PG=Papua Nova Gvineja
+PH=Filipini
+PK=Pakistan
+PL=Poljska
+PM=Sen Pjer i Mikelon
+PN=Pitcairn
+PR=Porto Riko
+PS=Palestinska Teritorija
+PT=Portugal
+PW=Palau
+PY=Paragvaj
+QA=Katar
+RE=Rejunion
+RO=Rumunija
+RS=Srbija
+RU=Rusija
+RW=Ruanda
+SA=Saudijska Arabija
+SB=Solomonska Ostrva
+SC=Sej\u0161eli
+SD=Sudan
+SE=\u0160vedska
+SG=Singapur
+SH=Sveta Jelena
+SI=Slovenija
+SJ=Svalbard i Janmajen Ostrva
+SK=Slova\u010dka
+SL=Sijera Leone
+SM=San Marino
+SN=Senegal
+SO=Somalija
+SR=Surinam
+ST=Sao Tome i Principe
+SV=Salvador
+SY=Sirija
+SZ=Svazilend
+TC=Turks i Kajkos Ostrva
+TD=\u010cad
+TF=Francuske Ju\u017ene Teritorije
+TG=Togo
+TH=Tajland
+TJ=Tad\u017eikistan
+TK=Tokelau
+TL=Isto\u010dni Timor
+TM=Turkmenistan
+TN=Tunis
+TO=Tonga
+TR=Turska
+TT=Trinidad i Tobago
+TV=Tuvalu
+TW=Tajvan
+TZ=Tanzanija
+UA=Ukrajina
+UG=Uganda
+UM=Manja Udaljena Ostrva SAD
+US=Sjedinjene Ameri\u010dke Dr\u017eave
+UY=Urugvaj
+UZ=Uzbekistan
+VA=Vatikan
+VC=Sent Vinsent i Grenadini
+VE=Venecuela
+VG=Britanska Devi\u010danska Ostrva
+VI=S.A.D. Devi\u010danska Ostrva
+VN=Vijetnam
+VU=Vanuatu
+WF=Valis i Futuna Ostrva
+WS=Samoa
+YE=Jemen
+YT=Majote
+ZA=Ju\u017enoafri\u010dka Republika
+ZM=Zambija
+ZW=Zimbabve
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"Pierre & Miquelon Standard Time", "PMST",
                                                "Pierre & Miquelon Daylight Time", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"Pierre & Miquelon Normalzeit", "PMST",
                                                "Pierre & Miquelon Sommerzeit", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"Hora est\u00e1ndar de Pierre & Miquelon", "PMST",
                                                "Hora de verano de Pierre & Miquelon", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"Heure normale de Saint-Pierre et Miquelon", "PMST",
                                                "Heure avanc\u00e9e de Saint-Pierre et Miquelon", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"Ora solare di Saint-Pierre e Miquelon", "PMST",
                                                "Ora legale di Saint-Pierre e Miquelon", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"\u30b5\u30f3\u30d4\u30a8\u30fc\u30eb\u30fb\u30df\u30af\u30ed\u30f3\u8af8\u5cf6\u6a19\u6e96\u6642", "PMST",
                                                "\u30b5\u30f3\u30d4\u30a8\u30fc\u30eb\u30fb\u30df\u30af\u30ed\u30f3\u8af8\u5cf6\u590f\u6642\u9593", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"\ud53c\uc5d0\ub974 \ubbf8\ud06c\ub860 \ud45c\uc900\uc2dc", "PMST",
                                                "\ud53c\uc5d0\ub974 \ubbf8\ud06c\ub860 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java	Thu Mar 31 22:07:32 2011 -0700
@@ -217,6 +217,7 @@
         {"America/Anchorage", AKST},
         {"AST", AKST},
         {"America/Halifax", AST},
+        {"America/Sitka", AKST},
         {"America/St_Johns", NST},
         {"CNT", NST},
         {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
         {"America/Mendoza", AGT},
         {"America/Menominee", CST},
         {"America/Merida", CST},
+        {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                             "Metlakatla Daylight Time", "MeDT"}},
         {"America/Mexico_City", CST},
         {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST",
                            "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"Saint-Pierre-et-Miquelon, normaltid", "PMST",
                                                "Saint-Pierre-et-Miquelon, sommartid", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"\u76ae\u57c3\u5c14\u5c9b\u53ca\u5bc6\u514b\u9686\u5c9b\u6807\u51c6\u65f6\u95f4", "PMST",
                                                "\u76ae\u57c3\u5c14\u5c9b\u53ca\u5bc6\u514b\u9686\u5c9b\u590f\u4ee4\u65f6", "PMDT"}},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Thu Mar 31 22:07:32 2011 -0700
@@ -216,6 +216,7 @@
             {"America/Anchorage", AKST},
             {"AST", AKST},
             {"America/Halifax", AST},
+            {"America/Sitka", AKST},
             {"America/St_Johns", NST},
             {"CNT", NST},
             {"Europe/Paris", CET},
@@ -392,6 +393,8 @@
             {"America/Mendoza", AGT},
             {"America/Menominee", CST},
             {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
             {"America/Mexico_City", CST},
             {"America/Miquelon", new String[] {"\u76ae\u57c3\u723e\u5cf6\u53ca\u5bc6\u514b\u9686\u5cf6\u6a19\u6e96\u6642\u9593", "PMST",
                                                "\u76ae\u57c3\u723e\u5cf6\u53ca\u5bc6\u514b\u9686\u5cf6\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "PMDT"}},
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -3,12 +3,15 @@
 
 Title=Notepad
 ElementTreeFrameTitle=Elements
+# The following string should NOT be translated: ViewportBackingStore
 ViewportBackingStore=false
 
 # menubar definition
 #
 # Each of the strings that follow form a key to be 
 # used to the actual menu definition.
+
+# The following string should NOT be translated: menubar
 menubar=file edit debug
 
 # file Menu definition
@@ -20,6 +23,8 @@
 # new  ->  Notepad.newAction
 # save ->  Notepad.saveAction
 # exit ->  Notepad.exitAction
+
+# The following string should NOT be translated: file
 file=new open save - exit
 fileLabel=File
 openLabel=Open
@@ -36,28 +41,38 @@
 # cut   -> JTextComponent.cutAction
 # copy  -> JTextComponent.copyAction
 # paste -> JTextComponent.pasteAction
+
+# The following string should NOT be translated: edit
 edit=cut copy paste - undo redo
 editLabel=Edit
 cutLabel=Cut
+# The following string should NOT be translated: cutAction
 cutAction=cut-to-clipboard
 cutImage=resources/cut.gif
 copyLabel=Copy
+# The following string should NOT be translated: copyAction
 copyAction=copy-to-clipboard
 copyImage=resources/copy.gif
 pasteLabel=Paste
+# The following string should NOT be translated: pasteAction
 pasteAction=paste-from-clipboard
 pasteImage=resources/paste.gif
 undoLabel=Undo
+# The following string should NOT be translated: undoAction
 undoAction=Undo
 redoLabel=Redo
+# The following string should NOT be translated: redoAction
 redoAction=Redo
 
 #
 # debug Menu definition
 #
+
+# The following string should NOT be translated: debug
 debug=dump showElementTree
 debugLabel=Debug
 dumpLabel=Dump model to System.err
+# The following string should NOT be translated: dumpAction
 dumpAction=dump-model
 showElementTreeLabel=Show Elements
 
@@ -67,6 +82,8 @@
 # used as the basis of the tool definition.  Actions
 # are of course sharable, and in this case are shared
 # with the menu items.
+
+# The following string should NOT be translated: toolbar
 toolbar=new open save - cut copy paste
 newTooltip=Create a new file
 openTooltip=Open a file
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_ja.properties	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad_ja.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -9,7 +9,7 @@
 #
 # Each of the strings that follow form a key to be 
 # used to the actual menu definition.
-menubar=\u30D5\u30A1\u30A4\u30EB \u7DE8\u96C6 \u30C7\u30D0\u30C3\u30B0
+menubar=file edit debug
 
 # file Menu definition
 #
@@ -20,7 +20,7 @@
 # new  ->  Notepad.newAction
 # save ->  Notepad.saveAction
 # exit ->  Notepad.exitAction
-file=\u65B0\u898F \u958B\u304F \u4FDD\u5B58 - \u7D42\u4E86
+file=new open save - exit
 fileLabel=\u30D5\u30A1\u30A4\u30EB
 openLabel=\u958B\u304F
 openImage=resources/open.gif
@@ -36,7 +36,7 @@
 # cut   -> JTextComponent.cutAction
 # copy  -> JTextComponent.copyAction
 # paste -> JTextComponent.pasteAction
-edit=\u5207\u53D6\u308A \u30B3\u30D4\u30FC \u8CBC\u4ED8\u3051 - \u5143\u306B\u623B\u3059 \u518D\u5B9F\u884C
+edit=cut copy paste - undo redo
 editLabel=\u7DE8\u96C6
 cutLabel=\u5207\u53D6\u308A
 cutAction=cut-to-clipboard
@@ -48,14 +48,14 @@
 pasteAction=paste-from-clipboard
 pasteImage=resources/paste.gif
 undoLabel=\u5143\u306B\u623B\u3059
-undoAction=\u5143\u306B\u623B\u3059
+undoAction=Undo
 redoLabel=\u518D\u5B9F\u884C
-redoAction=\u518D\u5B9F\u884C
+redoAction=Redo
 
 #
 # debug Menu definition
 #
-debug=showElementTree\u306E\u30C0\u30F3\u30D7
+debug=dump showElementTree
 debugLabel=\u30C7\u30D0\u30C3\u30B0
 dumpLabel=\u30E2\u30C7\u30EB\u3092System.err\u306B\u30C0\u30F3\u30D7
 dumpAction=dump-model
@@ -67,7 +67,7 @@
 # used as the basis of the tool definition.  Actions
 # are of course sharable, and in this case are shared
 # with the menu items.
-toolbar=\u65B0\u898F \u958B\u304F \u4FDD\u5B58 - \u5207\u53D6\u308A \u30B3\u30D4\u30FC \u8CBC\u4ED8\u3051
+toolbar=new open save - cut copy paste
 newTooltip=\u30D5\u30A1\u30A4\u30EB\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B
 openTooltip=\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F
 saveTooltip=\u30D5\u30A1\u30A4\u30EB\u306B\u4FDD\u5B58
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_zh_CN.properties	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad_zh_CN.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -48,9 +48,9 @@
 pasteAction=paste-from-clipboard
 pasteImage=resources/paste.gif
 undoLabel=\u64A4\u6D88
-undoAction=\u64A4\u6D88
+undoAction=Undo
 redoLabel=\u91CD\u505A
-redoAction=\u91CD\u505A
+redoAction=Redo
 
 #
 # debug Menu definition
--- a/jdk/src/share/native/common/check_code.c	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/native/common/check_code.c	Thu Mar 31 22:07:32 2011 -0700
@@ -2685,11 +2685,11 @@
                     switch (type_table[operand]) {
                     case JVM_CONSTANT_MethodType:
                       full_info = make_class_info_from_name(context,
-                                                            "java/dyn/MethodType");
+                                                            "java/lang/invoke/MethodType");
                       break;
                     default: //JVM_CONSTANT_MethodHandle
                       full_info = make_class_info_from_name(context,
-                                                            "java/dyn/MethodHandle");
+                                                            "java/lang/invoke/MethodHandle");
                       break;
                     }
                     break;
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Thu Mar 31 22:07:32 2011 -0700
@@ -40,7 +40,7 @@
 #include <setjmp.h>
 #include <assert.h>
 #include <string.h>
-
+#include <limits.h>
 
 /* java native interface headers */
 #include "jni.h"
@@ -2657,7 +2657,7 @@
         (destWidth < 0) || (destWidth > srcWidth) ||
         (destHeight < 0) ||
         (stepX < 0) || (stepY < 0) ||
-        ((scanLineSize / numBands) < destWidth))  /* destWidth causes an integer overflow */
+        ((INT_MAX / numBands) < destWidth))  /* destWidth causes an integer overflow */
     {
         JNU_ThrowByName(env, "javax/imageio/IIOException",
                         "Invalid argument to native writeImage");
--- a/jdk/src/share/native/sun/font/layout/KernTable.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/KernTable.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -210,7 +210,7 @@
       // all the elements ahead of time and store them in the font
 
       const PairInfo* p = pairs;
-      const PairInfo* tp = (const PairInfo*)(p + rangeShift);
+      const PairInfo* tp = (const PairInfo*)(p + (rangeShift/KERN_PAIRINFO_SIZE)); /* rangeshift is in original table bytes */
       if (key > tp->key) {
         p = tp;
       }
@@ -222,7 +222,7 @@
       le_uint32 probe = searchRange;
       while (probe > 1) {
         probe >>= 1;
-        tp = (const PairInfo*)(p + probe);
+        tp = (const PairInfo*)(p + (probe/KERN_PAIRINFO_SIZE));
         le_uint32 tkey = tp->key;
 #if DEBUG
         fprintf(stdout, "   %.3d (%0.8x)\n", (tp - pairs), tkey);
--- a/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -251,6 +251,10 @@
         return 0;
     }
 
+    if ((fTypoFlags & 0x4) == 0) { // no canonical processing
+      return count;
+    }
+
     const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
     LETag scriptTag  = OpenTypeLayoutEngine::getScriptTag(fScriptCode);
     LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode);
--- a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c	Thu Mar 31 22:07:32 2011 -0700
@@ -118,19 +118,25 @@
         jint Y1 = (fY1) >> MDP_PREC;                                        \
         jint res;                                                           \
                                                                             \
-        /* Checking bounds and clipping if necessary */                     \
+        /* Checking bounds and clipping if necessary.                       \
+         * REMIND: It's temporary solution to avoid OOB in rendering code.  \
+         * Current approach uses float equations which are unreliable for   \
+         * clipping and makes assumptions about the line biases of the      \
+         * rendering algorithm. Also, clipping code should be moved down    \
+         * into only those output renderers that need it.                   \
+         */                                                                 \
         if (checkBounds) {                                                  \
-            TESTANDCLIP(hnd->dhnd->yMin, hnd->dhnd->yMax, Y0, X0, Y1, X1,   \
-                        jint, res);                                         \
+            jfloat xMinf = hnd->dhnd->xMinf + 0.5f;                         \
+            jfloat yMinf = hnd->dhnd->yMinf + 0.5f;                         \
+            jfloat xMaxf = hnd->dhnd->xMaxf + 0.5f;                         \
+            jfloat yMaxf = hnd->dhnd->yMaxf + 0.5f;                         \
+            TESTANDCLIP(yMinf, yMaxf, Y0, X0, Y1, X1, jint, res);           \
             if (res == CRES_INVISIBLE) break;                               \
-            TESTANDCLIP(hnd->dhnd->yMin, hnd->dhnd->yMax, Y1, X1, Y0, X0,   \
-                        jint, res);                                         \
+            TESTANDCLIP(yMinf, yMaxf, Y1, X1, Y0, X0, jint, res);           \
             if (res == CRES_INVISIBLE) break;                               \
-            TESTANDCLIP(hnd->dhnd->xMin, hnd->dhnd->xMax, X0, Y0, X1, Y1,   \
-                        jint, res);                                         \
+            TESTANDCLIP(xMinf, xMaxf, X0, Y0, X1, Y1, jint, res);           \
             if (res == CRES_INVISIBLE) break;                               \
-            TESTANDCLIP(hnd->dhnd->xMin, hnd->dhnd->xMax, X1, Y1, X0, Y0,   \
-                        jint, res);                                         \
+            TESTANDCLIP(xMinf, xMaxf, X1, Y1, X0, Y0, jint, res);           \
             if (res == CRES_INVISIBLE) break;                               \
         }                                                                   \
                                                                             \
--- a/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java	Thu Mar 31 22:07:32 2011 -0700
@@ -68,6 +68,9 @@
 public class NTLMAuthentication extends AuthenticationInfo {
     private static final long serialVersionUID = 170L;
 
+    private static final NTLMAuthenticationCallback NTLMAuthCallback =
+        NTLMAuthenticationCallback.getNTLMAuthenticationCallback();
+
     private String hostname;
     private static String defaultDomain; /* Domain to use if not specified by user */
 
@@ -81,6 +84,14 @@
         return false;
     }
 
+    /**
+     * Returns true if the given site is trusted, i.e. we can try
+     * transparent Authentication.
+     */
+    public static boolean isTrustedSite(URL url) {
+        return NTLMAuthCallback.isTrustedSite(url);
+    }
+
     private void init0() {
 
         hostname = java.security.AccessController.doPrivileged(
--- a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c	Thu Mar 31 22:07:32 2011 -0700
@@ -302,6 +302,7 @@
 #ifdef DEBUG
         fprintf(stderr, "Drawing Surface Info is NULL\n");
 #endif
+        return;
     }
     free(dsi->platformInfo);
     free(dsi);
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Thu Mar 31 22:07:32 2011 -0700
@@ -240,7 +240,7 @@
 
     AwtGraphicsConfigDataPtr defaultConfig;
     int xinawareScreen = 0;
-    VisualID forcedVisualID, defaultVisualID;
+    VisualID forcedVisualID = 0, defaultVisualID;
     char *forcedVisualStr;
     XVisualInfo vinfo;
     long mask;
@@ -254,7 +254,7 @@
 
     if ((forcedVisualStr = getenv("FORCEDEFVIS"))) {
         mask = VisualIDMask | VisualScreenMask;
-        if (sscanf(forcedVisualStr, "%x", &forcedVisualID) > 0 &&
+        if (sscanf(forcedVisualStr, "%lx", &forcedVisualID) > 0 &&
             forcedVisualID > 0)
         {
             vinfo.visualid = forcedVisualID;
--- a/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,6 +26,7 @@
 
 import java.io.IOException;
 import java.io.FileDescriptor;
+import sun.net.ResourceManager;
 
 /**
  * This class defines the plain DatagramSocketImpl that is used for all
@@ -108,6 +109,7 @@
     protected void close() {
         if (fd != null || fd1 != null) {
             datagramSocketClose();
+            ResourceManager.afterUdpClose();
             fd = null;
             fd1 = null;
         }
--- a/jdk/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java	Thu Mar 31 22:07:32 2011 -0700
@@ -45,6 +45,9 @@
 
     private static final long serialVersionUID = 100L;
 
+    private static final NTLMAuthenticationCallback NTLMAuthCallback =
+        NTLMAuthenticationCallback.getNTLMAuthenticationCallback();
+
     private String hostname;
     private static String defaultDomain; /* Domain to use if not specified by user */
 
@@ -143,6 +146,14 @@
     }
 
     /**
+     * Returns true if the given site is trusted, i.e. we can try
+     * transparent Authentication.
+     */
+    public static boolean isTrustedSite(URL url) {
+        return NTLMAuthCallback.isTrustedSite(url);
+    }
+
+    /**
      * Not supported. Must use the setHeaders() method
      */
     @Override
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp	Thu Mar 31 22:07:32 2011 -0700
@@ -3699,7 +3699,9 @@
                            double* newWid, double *newHgt,
                            WORD* paperSize) {
 
-    const double epsilon = 0.50;
+    // Tolerated differences in comparing page dimensions between passed in
+    // "orig" media with that of Windows' device.
+    const double epsilon = 3.6; // (1/72) of an inch
     const double tolerance = (1.0 * 72.0);  // # inches * 72
 
     *newWid = origWid;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/TextLayout/CombiningPerf.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 6328154 6962082
+ * @summary ensure that ascii, and latin-1 text without combining marks, both layout faster
+ *  than latin-1 text with combining marks.  The presumption is then that the canonical
+ *  GSUB table is being run only on the latter and not on either of the former.
+ */
+
+import java.awt.Font;
+import java.awt.GraphicsEnvironment;
+import java.awt.font.FontRenderContext;
+import java.awt.font.TextLayout;
+
+import static java.awt.Font.*;
+
+public class CombiningPerf {
+    private static Font font;
+    private static FontRenderContext frc;
+
+    public static void main(String[] args) throws Exception {
+        System.err.println("start");
+
+        GraphicsEnvironment.getLocalGraphicsEnvironment();
+
+        font = new Font("Lucida Sans Regular", PLAIN, 12);
+        frc = new FontRenderContext(null, false, false);
+
+        String ascii = "the characters are critical noodles?";
+        String french = "l'aper\u00e7u caract\u00e8re one \u00e9t\u00e9 cr\u00e9\u00e9s";
+        String frenchX = "l'aper\u00e7u caracte\u0300re one e\u0301te\u0301 ere\u0301e\u0301s";
+
+        // warmup
+        for (int i = 0; i < 100; ++i) {
+            TextLayout tl = new TextLayout(french, font, frc);
+            tl = new TextLayout(ascii, font, frc);
+            tl = new TextLayout(frenchX, font, frc);
+        }
+        /**/
+        long atime = test(ascii);
+        System.err.println("atime: " + (atime/1000000.0) + " length: " + ascii.length());
+
+        long ftime = test(french);
+        System.err.println("ftime: " + (ftime/1000000.0) + " length: " + french.length());
+
+        long xtime = test(frenchX);
+        System.err.println("xtime: " + (xtime/1000000.0) + " length: " + frenchX.length());
+
+        long limit = xtime * 2 / 3;
+        if (atime > limit || ftime > limit) {
+            throw new Exception("took too long");
+        }
+        /**/
+    }
+
+    private static long test(String text) {
+        long start = System.nanoTime();
+        for (int i = 0; i < 2000; ++i) {
+            TextLayout tl = new TextLayout(text, font, frc);
+        }
+        return System.nanoTime() - start;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/TextLayout/KernCrash.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.awt.*;
+import java.awt.font.*;
+import java.util.*;
+
+/**
+ * Shows (top) with kerning, (middle) without, (bottom) also without.
+ *
+ * @bug 7017324
+ */
+public class KernCrash extends Frame {
+    private static Font font0;
+    private static Font font1;
+    private static Font font2;
+
+    public static void main(String[] args) throws Exception {
+        HashMap attrs = new HashMap();
+        font0 = Font.createFont(Font.TRUETYPE_FONT, new File("Vera.ttf"));
+        System.out.println("using " + font0);
+        attrs.put(TextAttribute.SIZE, new Float(58f));
+        font1 = font0.deriveFont(attrs);
+        attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
+        font2 = font0.deriveFont(attrs);
+
+        KernCrash f = new KernCrash();
+        f.setTitle("Kerning Crash");
+        f.setSize(600, 300);
+        f.setForeground(Color.black);
+        f.show();
+    }
+
+    public void paint(Graphics g) {
+        Graphics2D g2 = (Graphics2D)g;
+        FontRenderContext frc = g2.getFontRenderContext();
+        TextLayout layout = new TextLayout("text", font2, frc);
+        layout.draw(g2, 10, 150);
+
+        String s = "WAVATastic";
+        TextLayout layout2 = new TextLayout(s, font1, frc);
+        layout2.draw(g2, 10, 200);
+        TextLayout layout3 = new TextLayout(s, font2, frc);
+        layout3.draw(g2, 10, 100);
+    }
+}
--- a/jdk/test/java/dyn/ClassValueTest.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- */
-
-/* @test
- * @summary tests for class-specific values
- * @compile ClassValueTest.java
- * @run junit/othervm test.java.dyn.ClassValueTest
- */
-
-/*
-  Manually:
-   $ $JAVA7X_HOME/bin/javac -d foo -cp $JUNIT4_JAR test/java/dyn/ClassValueTest.java
-   $ $JAVA7X_HOME/bin/java -cp foo:$JUNIT4_JAR org.junit.runner.JUnitCore test.java.dyn.ClassValueTest
-  Output: .testAdd => 1000 : Integer
- */
-
-package test.java.dyn;
-
-import java.util.*;
-
-import java.dyn.*;
-
-import org.junit.*;
-import static org.junit.Assert.*;
-
-/**
- * @author jrose
- */
-public class ClassValueTest {
-    static String nameForCV1(Class<?> type) {
-        return "CV1:" + type.getName();
-    }
-    static int countForCV1;
-    static final ClassValue<String> CV1 = new CV1();
-    private static class CV1 extends ClassValue<String> {
-        protected String computeValue(Class<?> type) {
-            countForCV1++;
-            return nameForCV1(type);
-        }
-    }
-
-    static final Class[] CLASSES = {
-        String.class,
-        Integer.class,
-        int.class,
-        boolean[].class,
-        char[][].class,
-        ClassValueTest.class
-    };
-
-    @Test
-    public void testGet() {
-        countForCV1 = 0;
-        for (Class c : CLASSES) {
-            assertEquals(nameForCV1(c), CV1.get(c));
-        }
-        assertEquals(CLASSES.length, countForCV1);
-        for (Class c : CLASSES) {
-            assertEquals(nameForCV1(c), CV1.get(c));
-        }
-        assertEquals(CLASSES.length, countForCV1);
-    }
-
-    @Test
-    public void testRemove() {
-        for (Class c : CLASSES) {
-            CV1.get(c);
-        }
-        countForCV1 = 0;
-        int REMCOUNT = 3;
-        for (int i = 0; i < REMCOUNT; i++) {
-            CV1.remove(CLASSES[i]);
-        }
-        assertEquals(0, countForCV1);  // no change
-        for (Class c : CLASSES) {
-            assertEquals(nameForCV1(c), CV1.get(c));
-        }
-        assertEquals(REMCOUNT, countForCV1);
-    }
-
-    static String nameForCVN(Class<?> type, int n) {
-        return "CV[" + n + "]" + type.getName();
-    }
-    static int countForCVN;
-    static class CVN extends ClassValue<String> {
-        final int n;
-        CVN(int n) { this.n = n; }
-        protected String computeValue(Class<?> type) {
-            countForCVN++;
-            return nameForCVN(type, n);
-        }
-    };
-
-    @Test
-    public void testGetMany() {
-        int CVN_COUNT1 = 100, CVN_COUNT2 = 100;
-        CVN cvns[] = new CVN[CVN_COUNT1 * CVN_COUNT2];
-        for (int n = 0; n < cvns.length; n++) {
-            cvns[n] = new CVN(n);
-        }
-        countForCVN = 0;
-        for (int pass = 0; pass <= 2; pass++) {
-            for (int i1 = 0; i1 < CVN_COUNT1; i1++) {
-                eachClass:
-                for (Class c : CLASSES) {
-                    for (int i2 = 0; i2 < CVN_COUNT2; i2++) {
-                        int n = i1*CVN_COUNT2 + i2;
-                        assertEquals(0, countForCVN);
-                        assertEquals(nameForCVN(c, n), cvns[n].get(c));
-                        cvns[n].get(c);  //get it again
-                        //System.out.println("getting "+n+":"+cvns[n].get(c));
-                        boolean doremove = (((i1 + i2) & 3) == 0);
-                        switch (pass) {
-                        case 0:
-                            assertEquals(1, countForCVN);
-                            break;
-                        case 1:
-                            // remove on middle pass
-                            assertEquals(0, countForCVN);
-                            if (doremove) {
-                                //System.out.println("removing "+n+":"+cvns[n].get(c));
-                                cvns[n].remove(c);
-                                assertEquals(0, countForCVN);
-                            }
-                            break;
-                        case 2:
-                            assertEquals(doremove ? 1 : 0, countForCVN);
-                            break;
-                        }
-                        countForCVN = 0;
-                        if (i1 > i2 && i1 < i2+5)  continue eachClass;  // leave diagonal gap
-                    }
-                }
-            }
-        }
-        assertEquals(countForCVN, 0);
-        for (int n = 0; n < cvns.length; n++) {
-            for (Class c : CLASSES) {
-                assertEquals(nameForCVN(c, n), cvns[n].get(c));
-            }
-        }
-    }
-}
--- a/jdk/test/java/dyn/InvokeDynamicPrintArgs.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- * @summary smoke test for invokedynamic instructions
- * @build indify.Indify
- * @compile InvokeDynamicPrintArgs.java
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic
- *      indify.Indify
- *      --verify-specifier-count=3 --transitionalJSR292=false
- *      --expand-properties --classpath ${test.classes}
- *      --java test.java.dyn.InvokeDynamicPrintArgs --check-output
- */
-
-package test.java.dyn;
-
-import org.junit.Test;
-
-import java.util.*;
-import java.io.*;
-
-import java.dyn.*;
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
-
-public class InvokeDynamicPrintArgs {
-    public static void main(String... av) throws Throwable {
-        if (av.length > 0)  openBuf();  // --check-output mode
-        System.out.println("Printing some argument lists, starting with a empty one:");
-        INDY_nothing().invokeExact();                 // BSM specifier #0 = {bsm}
-        INDY_bar().invokeExact("bar arg", 1);         // BSM specifier #1 = {bsm2, Void.class, "void type"}
-        INDY_bar2().invokeExact("bar2 arg", 222);     // BSM specifier #1 = (same)
-        INDY_baz().invokeExact("baz arg", 2, 3.14);   // BSM specifier #2 = {bsm2, 1234.5}
-        INDY_foo().invokeExact("foo arg");            // BSM specifier #0 = (same)
-        // Hence, BSM specifier count should be 3.  See "--verify-specifier-count=3" above.
-        System.out.println("Done printing argument lists.");
-        closeBuf();
-    }
-
-    @Test
-    public void testInvokeDynamicPrintArgs() throws IOException {
-        System.err.println(System.getProperties());
-        String testClassPath = System.getProperty("build.test.classes.dir");
-        if (testClassPath == null)  throw new RuntimeException();
-        String[] args = new String[]{
-            "--verify-specifier-count=3", "--transitionalJSR292=false",
-            "--expand-properties", "--classpath", testClassPath,
-            "--java", "test.java.dyn.InvokeDynamicPrintArgs", "--check-output"
-        };
-        System.err.println("Indify: "+Arrays.toString(args));
-        indify.Indify.main(args);
-    }
-
-    private static PrintStream oldOut;
-    private static ByteArrayOutputStream buf;
-    private static void openBuf() {
-        oldOut = System.out;
-        buf = new ByteArrayOutputStream();
-        System.setOut(new PrintStream(buf));
-    }
-    private static void closeBuf() {
-        if (buf == null)  return;
-        System.out.flush();
-        System.setOut(oldOut);
-        String[] haveLines = new String(buf.toByteArray()).split("[\n\r]+");
-        for (String line : haveLines)  System.out.println(line);
-        Iterator<String> iter = Arrays.asList(haveLines).iterator();
-        for (String want : EXPECT_OUTPUT) {
-            String have = iter.hasNext() ? iter.next() : "[EOF]";
-            if (want.equals(have))  continue;
-            System.err.println("want line: "+want);
-            System.err.println("have line: "+have);
-            throw new AssertionError("unexpected output: "+have);
-        }
-        if (iter.hasNext())
-            throw new AssertionError("unexpected output: "+iter.next());
-    }
-    private static final String[] EXPECT_OUTPUT = {
-        "Printing some argument lists, starting with a empty one:",
-        "[test.java.dyn.InvokeDynamicPrintArgs, nothing, ()void][]",
-        "[test.java.dyn.InvokeDynamicPrintArgs, bar, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar arg, 1]",
-        "[test.java.dyn.InvokeDynamicPrintArgs, bar2, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar2 arg, 222]",
-        "[test.java.dyn.InvokeDynamicPrintArgs, baz, (String,int,double)void, 1234.5][baz arg, 2, 3.14]",
-        "[test.java.dyn.InvokeDynamicPrintArgs, foo, (String)void][foo arg]",
-        "Done printing argument lists."
-    };
-
-    private static void printArgs(Object bsmInfo, Object... args) {
-        System.out.println(bsmInfo+Arrays.deepToString(args));
-    }
-    private static MethodHandle MH_printArgs() throws ReflectiveOperationException {
-        shouldNotCallThis();
-        return lookup().findStatic(lookup().lookupClass(),
-                                   "printArgs", methodType(void.class, Object.class, Object[].class));
-    }
-
-    private static CallSite bsm(Lookup caller, String name, MethodType type) throws ReflectiveOperationException {
-        // ignore caller and name, but match the type:
-        Object bsmInfo = Arrays.asList(caller, name, type);
-        return new ConstantCallSite(MH_printArgs().bindTo(bsmInfo).asCollector(Object[].class, type.parameterCount()).asType(type));
-    }
-    private static MethodType MT_bsm() {
-        shouldNotCallThis();
-        return methodType(CallSite.class, Lookup.class, String.class, MethodType.class);
-    }
-    private static MethodHandle MH_bsm() throws ReflectiveOperationException {
-        shouldNotCallThis();
-        return lookup().findStatic(lookup().lookupClass(), "bsm", MT_bsm());
-    }
-
-    private static CallSite bsm2(Lookup caller, String name, MethodType type, Object... arg) throws ReflectiveOperationException {
-        // ignore caller and name, but match the type:
-        List<Object> bsmInfo = new ArrayList<>(Arrays.asList(caller, name, type));
-        bsmInfo.addAll(Arrays.asList((Object[])arg));
-        return new ConstantCallSite(MH_printArgs().bindTo(bsmInfo).asCollector(Object[].class, type.parameterCount()).asType(type));
-    }
-    private static MethodType MT_bsm2() {
-        shouldNotCallThis();
-        return methodType(CallSite.class, Lookup.class, String.class, MethodType.class, Object[].class);
-    }
-    private static MethodHandle MH_bsm2() throws ReflectiveOperationException {
-        shouldNotCallThis();
-        return lookup().findStatic(lookup().lookupClass(), "bsm2", MT_bsm2());
-    }
-
-    private static MethodHandle INDY_nothing() throws Throwable {
-        shouldNotCallThis();
-        return ((CallSite) MH_bsm().invokeGeneric(lookup(),
-                                                  "nothing", methodType(void.class)
-                                                  )).dynamicInvoker();
-    }
-    private static MethodHandle INDY_foo() throws Throwable {
-        shouldNotCallThis();
-        return ((CallSite) MH_bsm().invokeGeneric(lookup(),
-                                                  "foo", methodType(void.class, String.class)
-                                                  )).dynamicInvoker();
-    }
-    private static MethodHandle INDY_bar() throws Throwable {
-        shouldNotCallThis();
-        return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
-                                                  "bar", methodType(void.class, String.class, int.class)
-                                                  , new Object[] { Void.class, "void type!",
-                                                                   1, 234.5F, 67.5, (long)89 }
-                                                  )).dynamicInvoker();
-    }
-    private static MethodHandle INDY_bar2() throws Throwable {
-        shouldNotCallThis();
-        return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
-                                                  "bar2", methodType(void.class, String.class, int.class)
-                                                  , new Object[] { Void.class, "void type!",
-                                                                   1, 234.5F, 67.5, (long)89 }
-                                                  )).dynamicInvoker();
-    }
-    private static MethodHandle INDY_baz() throws Throwable {
-        shouldNotCallThis();
-        return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
-                                                  "baz", methodType(void.class, String.class, int.class, double.class)
-                                                  , 1234.5
-                                                  )).dynamicInvoker();
-    }
-
-    private static void shouldNotCallThis() {
-        // if this gets called, the transformation has not taken place
-        if (System.getProperty("InvokeDynamicPrintArgs.allow-untransformed") != null)  return;
-        throw new AssertionError("this code should be statically transformed away by Indify");
-    }
-}
--- a/jdk/test/java/dyn/InvokeGenericTest.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,484 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, 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.
- */
-
-/* @test
- * @summary unit tests for java.dyn.MethodHandle.invokeGeneric
- * @compile -XDallowTransitionalJSR292=no -target 7 InvokeGenericTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.InvokeGenericTest
- */
-
-package test.java.dyn;
-
-import java.dyn.*;
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
-import java.lang.reflect.*;
-import java.util.*;
-import org.junit.*;
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
-
-
-/**
- *
- * @author jrose
- */
-public class InvokeGenericTest {
-    // How much output?
-    static int verbosity = 0;
-    static {
-        String vstr = System.getProperty("test.java.dyn.InvokeGenericTest.verbosity");
-        if (vstr != null)  verbosity = Integer.parseInt(vstr);
-    }
-
-    @Test
-    public void testFirst() throws Throwable {
-        verbosity += 9; try {
-            // left blank for debugging
-        } finally { printCounts(); verbosity -= 9; }
-    }
-
-    public InvokeGenericTest() {
-    }
-
-    @Before
-    public void checkImplementedPlatform() {
-        boolean platformOK = false;
-        Properties properties = System.getProperties();
-        String vers = properties.getProperty("java.vm.version");
-        String name = properties.getProperty("java.vm.name");
-        String arch = properties.getProperty("os.arch");
-        if ((arch.equals("amd64") || arch.equals("i386") || arch.equals("x86") ||
-             arch.equals("sparc") || arch.equals("sparcv9")) &&
-            (name.contains("Client") || name.contains("Server"))
-            ) {
-            platformOK = true;
-        } else {
-            System.err.println("Skipping tests for unsupported platform: "+Arrays.asList(vers, name, arch));
-        }
-        assumeTrue(platformOK);
-    }
-
-    String testName;
-    static int allPosTests, allNegTests;
-    int posTests, negTests;
-    @After
-    public void printCounts() {
-        if (verbosity >= 2 && (posTests | negTests) != 0) {
-            System.out.println();
-            if (posTests != 0)  System.out.println("=== "+testName+": "+posTests+" positive test cases run");
-            if (negTests != 0)  System.out.println("=== "+testName+": "+negTests+" negative test cases run");
-            allPosTests += posTests;
-            allNegTests += negTests;
-            posTests = negTests = 0;
-        }
-    }
-    void countTest(boolean positive) {
-        if (positive) ++posTests;
-        else          ++negTests;
-    }
-    void countTest() { countTest(true); }
-    void startTest(String name) {
-        if (testName != null)  printCounts();
-        if (verbosity >= 1)
-            System.out.println(name);
-        posTests = negTests = 0;
-        testName = name;
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-        calledLog.clear();
-        calledLog.add(null);
-        nextArgVal = INITIAL_ARG_VAL;
-    }
-
-    @AfterClass
-    public static void tearDownClass() throws Exception {
-        int posTests = allPosTests, negTests = allNegTests;
-        if (verbosity >= 2 && (posTests | negTests) != 0) {
-            System.out.println();
-            if (posTests != 0)  System.out.println("=== "+posTests+" total positive test cases");
-            if (negTests != 0)  System.out.println("=== "+negTests+" total negative test cases");
-        }
-    }
-
-    static List<Object> calledLog = new ArrayList<Object>();
-    static Object logEntry(String name, Object... args) {
-        return Arrays.asList(name, Arrays.asList(args));
-    }
-    static Object called(String name, Object... args) {
-        Object entry = logEntry(name, args);
-        calledLog.add(entry);
-        return entry;
-    }
-    static void assertCalled(String name, Object... args) {
-        Object expected = logEntry(name, args);
-        Object actual   = calledLog.get(calledLog.size() - 1);
-        if (expected.equals(actual) && verbosity < 9)  return;
-        System.out.println("assertCalled "+name+":");
-        System.out.println("expected:   "+expected);
-        System.out.println("actual:     "+actual);
-        System.out.println("ex. types:  "+getClasses(expected));
-        System.out.println("act. types: "+getClasses(actual));
-        assertEquals("previous method call", expected, actual);
-    }
-    static void printCalled(MethodHandle target, String name, Object... args) {
-        if (verbosity >= 3)
-            System.out.println("calling MH="+target+" to "+name+Arrays.toString(args));
-    }
-
-    static Object castToWrapper(Object value, Class<?> dst) {
-        Object wrap = null;
-        if (value instanceof Number)
-            wrap = castToWrapperOrNull(((Number)value).longValue(), dst);
-        if (value instanceof Character)
-            wrap = castToWrapperOrNull((char)(Character)value, dst);
-        if (wrap != null)  return wrap;
-        return dst.cast(value);
-    }
-
-    static Object castToWrapperOrNull(long value, Class<?> dst) {
-        if (dst == int.class || dst == Integer.class)
-            return (int)(value);
-        if (dst == long.class || dst == Long.class)
-            return (long)(value);
-        if (dst == char.class || dst == Character.class)
-            return (char)(value);
-        if (dst == short.class || dst == Short.class)
-            return (short)(value);
-        if (dst == float.class || dst == Float.class)
-            return (float)(value);
-        if (dst == double.class || dst == Double.class)
-            return (double)(value);
-        if (dst == byte.class || dst == Byte.class)
-            return (byte)(value);
-        if (dst == boolean.class || dst == boolean.class)
-            return ((value % 29) & 1) == 0;
-        return null;
-    }
-
-    static final int ONE_MILLION = (1000*1000),  // first int value
-                     TEN_BILLION = (10*1000*1000*1000),  // scale factor to reach upper 32 bits
-                     INITIAL_ARG_VAL = ONE_MILLION << 1;  // <<1 makes space for sign bit;
-    static long nextArgVal;
-    static long nextArg(boolean moreBits) {
-        long val = nextArgVal++;
-        long sign = -(val & 1); // alternate signs
-        val >>= 1;
-        if (moreBits)
-            // Guarantee some bits in the high word.
-            // In any case keep the decimal representation simple-looking,
-            // with lots of zeroes, so as not to make the printed decimal
-            // strings unnecessarily noisy.
-            val += (val % ONE_MILLION) * TEN_BILLION;
-        return val ^ sign;
-    }
-    static int nextArg() {
-        // Produce a 32-bit result something like ONE_MILLION+(smallint).
-        // Example: 1_000_042.
-        return (int) nextArg(false);
-    }
-    static long nextArg(Class<?> kind) {
-        if (kind == long.class   || kind == Long.class ||
-            kind == double.class || kind == Double.class)
-            // produce a 64-bit result something like
-            // ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
-            // Example: 10_000_420_001_000_042.
-            return nextArg(true);
-        return (long) nextArg();
-    }
-
-    static Object randomArg(Class<?> param) {
-        Object wrap = castToWrapperOrNull(nextArg(param), param);
-        if (wrap != null) {
-            return wrap;
-        }
-//        import sun.dyn.util.Wrapper;
-//        Wrapper wrap = Wrapper.forBasicType(dst);
-//        if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
-//            wrap = Wrapper.forWrapperType(dst);
-//        if (wrap != Wrapper.OBJECT)
-//            return wrap.wrap(nextArg++);
-        if (param.isInterface()) {
-            for (Class<?> c : param.getClasses()) {
-                if (param.isAssignableFrom(c) && !c.isInterface())
-                    { param = c; break; }
-            }
-        }
-        if (param.isInterface() || param.isAssignableFrom(String.class))
-            return "#"+nextArg();
-        else
-            try {
-                return param.newInstance();
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
-            }
-        return null;  // random class not Object, String, Integer, etc.
-    }
-    static Object[] randomArgs(Class<?>... params) {
-        Object[] args = new Object[params.length];
-        for (int i = 0; i < args.length; i++)
-            args[i] = randomArg(params[i]);
-        return args;
-    }
-    static Object[] randomArgs(int nargs, Class<?> param) {
-        Object[] args = new Object[nargs];
-        for (int i = 0; i < args.length; i++)
-            args[i] = randomArg(param);
-        return args;
-    }
-
-    static final Object ANON_OBJ = new Object();
-    static Object zeroArg(Class<?> param) {
-        Object x = castToWrapperOrNull(0L, param);
-        if (x != null)  return x;
-        if (param.isInterface() || param.isAssignableFrom(String.class))  return "\"\"";
-        if (param == Object.class)  return ANON_OBJ;
-        if (param.getComponentType() != null)  return Array.newInstance(param.getComponentType(), 0);
-        return null;
-    }
-    static Object[] zeroArgs(Class<?>... params) {
-        Object[] args = new Object[params.length];
-        for (int i = 0; i < args.length; i++)
-            args[i] = zeroArg(params[i]);
-        return args;
-    }
-    static Object[] zeroArgs(List<Class<?>> params) {
-        return zeroArgs(params.toArray(new Class<?>[0]));
-    }
-
-    static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
-        return Arrays.copyOf(a, a.length, atype);
-    }
-    static <T> T[] cat(T[] a, T... b) {
-        int alen = a.length, blen = b.length;
-        if (blen == 0)  return a;
-        T[] c = Arrays.copyOf(a, alen + blen);
-        System.arraycopy(b, 0, c, alen, blen);
-        return c;
-    }
-    static Integer[] boxAll(int... vx) {
-        Integer[] res = new Integer[vx.length];
-        for (int i = 0; i < res.length; i++) {
-            res[i] = vx[i];
-        }
-        return res;
-    }
-    static Object getClasses(Object x) {
-        if (x == null)  return x;
-        if (x instanceof String)  return x;  // keep the name
-        if (x instanceof List) {
-            // recursively report classes of the list elements
-            Object[] xa = ((List)x).toArray();
-            for (int i = 0; i < xa.length; i++)
-                xa[i] = getClasses(xa[i]);
-            return Arrays.asList(xa);
-        }
-        return x.getClass().getSimpleName();
-    }
-
-    static MethodHandle changeArgTypes(MethodHandle target, Class<?> argType) {
-        return changeArgTypes(target, 0, 999, argType);
-    }
-    static MethodHandle changeArgTypes(MethodHandle target,
-            int beg, int end, Class<?> argType) {
-        MethodType targetType = target.type();
-        end = Math.min(end, targetType.parameterCount());
-        ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>(targetType.parameterList());
-        Collections.fill(argTypes.subList(beg, end), argType);
-        MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
-        return MethodHandles.convertArguments(target, ttype2);
-    }
-
-    // This lookup is good for all members in and under InvokeGenericTest.
-    static final Lookup LOOKUP = MethodHandles.lookup();
-
-    Map<List<Class<?>>, MethodHandle> CALLABLES = new HashMap<List<Class<?>>, MethodHandle>();
-    MethodHandle callable(List<Class<?>> params) {
-        MethodHandle mh = CALLABLES.get(params);
-        if (mh == null) {
-            mh = collector_MH.asType(methodType(Object.class, params));
-            CALLABLES.put(params, mh);
-        }
-        return mh;
-    }
-    MethodHandle callable(Class<?>... params) {
-        return callable(Arrays.asList(params));
-    }
-    private static Object collector(Object... args) {
-        return Arrays.asList(args);
-    }
-    private static final MethodHandle collector_MH;
-    static {
-        try {
-            collector_MH
-                = LOOKUP.findStatic(LOOKUP.lookupClass(),
-                                    "collector",
-                                    methodType(Object.class, Object[].class));
-        } catch (ReflectiveOperationException ex) {
-            throw new RuntimeException(ex);
-        }
-    }
-
-    @Test
-    public void testSimple() throws Throwable {
-        startTest("testSimple");
-        countTest();
-        String[] args = { "one", "two" };
-        MethodHandle mh = callable(Object.class, String.class);
-        Object res; List resl;
-        res = resl = (List) mh.invokeGeneric((String)args[0], (Object)args[1]);
-        //System.out.println(res);
-        assertEquals(Arrays.asList(args), res);
-    }
-
-    @Test
-    public void testWrongArgumentCount() throws Throwable {
-        startTest("testWrongArgumentCount");
-        for (int i = 0; i <= 10; i++) {
-            testWrongArgumentCount(Collections.<Class<?>>nCopies(i, Integer.class));
-            if (i <= 4) {
-                testWrongArgumentCount(Collections.<Class<?>>nCopies(i, int.class));
-                testWrongArgumentCount(Collections.<Class<?>>nCopies(i, long.class));
-            }
-        }
-    }
-    public void testWrongArgumentCount(List<Class<?>> params) throws Throwable {
-        int max = params.size();
-        for (int i = 0; i < max; i++) {
-            List<Class<?>> params2 = params.subList(0, i);
-            for (int k = 0; k <= 2; k++) {
-                if (k == 1)  params  = methodType(Object.class,  params).generic().parameterList();
-                if (k == 2)  params2 = methodType(Object.class, params2).generic().parameterList();
-                testWrongArgumentCount(params, params2);
-                testWrongArgumentCount(params2, params);
-            }
-        }
-    }
-    public void testWrongArgumentCount(List<Class<?>> expect, List<Class<?>> observe) throws Throwable {
-        countTest(false);
-        if (expect.equals(observe))
-            assert(false);
-        MethodHandle target = callable(expect);
-        Object[] args = zeroArgs(observe);
-        Object junk;
-        try {
-            switch (args.length) {
-            case 0:
-                junk = target.invokeGeneric(); break;
-            case 1:
-                junk = target.invokeGeneric(args[0]); break;
-            case 2:
-                junk = target.invokeGeneric(args[0], args[1]); break;
-            case 3:
-                junk = target.invokeGeneric(args[0], args[1], args[2]); break;
-            case 4:
-                junk = target.invokeGeneric(args[0], args[1], args[2], args[3]); break;
-            default:
-                junk = target.invokeWithArguments(args); break;
-            }
-        } catch (WrongMethodTypeException ex) {
-            return;
-        } catch (Exception ex) {
-            throw new RuntimeException("wrong exception calling "+target+target.type()+" on "+Arrays.asList(args)+" : "+ex);
-        }
-        throw new RuntimeException("bad success calling "+target+target.type()+" on "+Arrays.asList(args));
-    }
-
-    /** Make a list of all combinations of the given types, with the given arities.
-     *  A void return type is possible iff the first type is void.class.
-     */
-    static List<MethodType> allMethodTypes(int minargc, int maxargc, Class<?>... types) {
-        ArrayList<MethodType> result = new ArrayList<MethodType>();
-        if (types.length > 0) {
-            ArrayList<MethodType> argcTypes = new ArrayList<MethodType>();
-            // build arity-zero types first
-            for (Class<?> rtype : types) {
-                argcTypes.add(MethodType.methodType(rtype));
-            }
-            if (types[0] == void.class)
-                // void is not an argument type
-                types = Arrays.copyOfRange(types, 1, types.length);
-            for (int argc = 0; argc <= maxargc; argc++) {
-                if (argc >= minargc)
-                    result.addAll(argcTypes);
-                if (argc >= maxargc)
-                    break;
-                ArrayList<MethodType> prevTypes = argcTypes;
-                argcTypes = new ArrayList<MethodType>();
-                for (MethodType prevType : prevTypes) {
-                    for (Class<?> ptype : types) {
-                        argcTypes.add(prevType.insertParameterTypes(argc, ptype));
-                    }
-                }
-            }
-        }
-        return Collections.unmodifiableList(result);
-    }
-    static List<MethodType> allMethodTypes(int argc, Class<?>... types) {
-        return allMethodTypes(argc, argc, types);
-    }
-
-    interface RandomInterface { }
-
-    MethodHandle toString_MH;
-
-    @Test
-    public void testReferenceConversions() throws Throwable {
-        startTest("testReferenceConversions");
-        toString_MH = LOOKUP.
-            findVirtual(Object.class, "toString", MethodType.methodType(String.class));
-        String[] args = { "one", "two" };
-        for (MethodType type : allMethodTypes(2, Object.class, String.class, RandomInterface.class)) {
-            testReferenceConversions(type, args);
-        }
-    }
-    public void testReferenceConversions(MethodType type, Object... args) throws Throwable {
-        countTest();
-        if (verbosity > 3)  System.out.println("target type: "+type);
-        MethodHandle mh = callable(type.parameterList());
-        MethodHandle tsdrop = MethodHandles.dropArguments(toString_MH, 1, type.parameterList());
-        mh = MethodHandles.foldArguments(tsdrop, mh);
-        mh = mh.asType(type);
-        Object res = mh.invokeGeneric((String)args[0], (Object)args[1]);
-        //System.out.println(res);
-        assertEquals(Arrays.asList(args).toString(), res);
-    }
-
-
-    @Test @Ignore("known failure pending 6939861")
-    public void testBoxConversions() throws Throwable {
-        startTest("testBoxConversions");
-        countTest();
-        Integer[] args = { 1, 2 };
-        MethodHandle mh = callable(Object.class, int.class);
-        Object res; List resl;
-        res = resl = (List) mh.invokeGeneric((int)args[0], (Object)args[1]);
-        //System.out.println(res);
-        assertEquals(Arrays.asList(args), res);
-    }
-
-}
--- a/jdk/test/java/dyn/JavaDocExamplesTest.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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.
- */
-
-/* @test
- * @summary example code used in javadoc for java.dyn API
- * @compile -XDallowTransitionalJSR292=no JavaDocExamplesTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.JavaDocExamplesTest
- */
-
-/*
----- To run outside jtreg:
-$ $JAVA7X_HOME/bin/javac -cp $JUNIT4_JAR -d /tmp/Classes \
-   $DAVINCI/sources/jdk/test/java/dyn/JavaDocExamplesTest.java
-$ $JAVA7X_HOME/bin/java   -cp $JUNIT4_JAR:/tmp/Classes \
-   -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles \
-   -Dtest.java.dyn.JavaDocExamplesTest.verbosity=1 \
-     test.java.dyn.JavaDocExamplesTest
-----
-*/
-
-package test.java.dyn;
-
-import java.dyn.*;
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import org.junit.*;
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
-
-
-/**
- * @author jrose
- */
-public class JavaDocExamplesTest {
-    /** Wrapper for running the JUnit tests in this module.
-     *  Put JUnit on the classpath!
-     */
-    public static void main(String... ignore) {
-        org.junit.runner.JUnitCore.runClasses(JavaDocExamplesTest.class);
-    }
-    // How much output?
-    static int verbosity = Integer.getInteger("test.java.dyn.JavaDocExamplesTest.verbosity", 0);
-
-{}
-static final private Lookup LOOKUP = lookup();
-// static final private MethodHandle CONCAT_1 = LOOKUP.findVirtual(String.class,
-//     "concat", methodType(String.class, String.class));
-// static final private MethodHandle HASHCODE_1 = LOOKUP.findVirtual(Object.class,
-//     "hashCode", methodType(int.class));
-
-// form required if ReflectiveOperationException is intercepted:
-static final private MethodHandle CONCAT_2, HASHCODE_2;
-static {
-  try {
-    CONCAT_2 = LOOKUP.findVirtual(String.class,
-      "concat", methodType(String.class, String.class));
-    HASHCODE_2 = LOOKUP.findVirtual(Object.class,
-      "hashCode", methodType(int.class));
-   } catch (ReflectiveOperationException ex) {
-     throw new RuntimeException(ex);
-   }
-}
-{}
-
-    @Test public void testFindVirtual() throws Throwable {
-{}
-MethodHandle CONCAT_3 = LOOKUP.findVirtual(String.class,
-  "concat", methodType(String.class, String.class));
-MethodHandle HASHCODE_3 = LOOKUP.findVirtual(Object.class,
-  "hashCode", methodType(int.class));
-//assertEquals("xy", (String) CONCAT_1.invokeExact("x", "y"));
-assertEquals("xy", (String) CONCAT_2.invokeExact("x", "y"));
-assertEquals("xy", (String) CONCAT_3.invokeExact("x", "y"));
-//assertEquals("xy".hashCode(), (int) HASHCODE_1.invokeExact((Object)"xy"));
-assertEquals("xy".hashCode(), (int) HASHCODE_2.invokeExact((Object)"xy"));
-assertEquals("xy".hashCode(), (int) HASHCODE_3.invokeExact((Object)"xy"));
-{}
-    }
-    @Test public void testDropArguments() throws Throwable {
-        {{
-{} /// JAVADOC
-MethodHandle cat = lookup().findVirtual(String.class,
-  "concat", methodType(String.class, String.class));
-assertEquals("xy", (String) cat.invokeExact("x", "y"));
-MethodHandle d0 = dropArguments(cat, 0, String.class);
-assertEquals("yz", (String) d0.invokeExact("x", "y", "z"));
-MethodHandle d1 = dropArguments(cat, 1, String.class);
-assertEquals("xz", (String) d1.invokeExact("x", "y", "z"));
-MethodHandle d2 = dropArguments(cat, 2, String.class);
-assertEquals("xy", (String) d2.invokeExact("x", "y", "z"));
-MethodHandle d12 = dropArguments(cat, 1, int.class, boolean.class);
-assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
-            }}
-    }
-
-    @Test public void testFilterArguments() throws Throwable {
-        {{
-{} /// JAVADOC
-MethodHandle cat = lookup().findVirtual(String.class,
-  "concat", methodType(String.class, String.class));
-MethodHandle upcase = lookup().findVirtual(String.class,
-  "toUpperCase", methodType(String.class));
-assertEquals("xy", (String) cat.invokeExact("x", "y"));
-MethodHandle f0 = filterArguments(cat, 0, upcase);
-assertEquals("Xy", (String) f0.invokeExact("x", "y")); // Xy
-MethodHandle f1 = filterArguments(cat, 1, upcase);
-assertEquals("xY", (String) f1.invokeExact("x", "y")); // xY
-MethodHandle f2 = filterArguments(cat, 0, upcase, upcase);
-assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
-            }}
-    }
-
-    static void assertEquals(Object exp, Object act) {
-        if (verbosity > 0)
-            System.out.println("result: "+act);
-        Assert.assertEquals(exp, act);
-    }
-
-    @Test public void testMethodHandlesSummary() throws Throwable {
-        {{
-{} /// JAVADOC
-Object x, y; String s; int i;
-MethodType mt; MethodHandle mh;
-MethodHandles.Lookup lookup = MethodHandles.lookup();
-// mt is (char,char)String
-mt = MethodType.methodType(String.class, char.class, char.class);
-mh = lookup.findVirtual(String.class, "replace", mt);
-s = (String) mh.invokeExact("daddy",'d','n');
-// invokeExact(Ljava/lang/String;CC)Ljava/lang/String;
-assert(s.equals("nanny"));
-// weakly typed invocation (using MHs.invoke)
-s = (String) mh.invokeWithArguments("sappy", 'p', 'v');
-assert(s.equals("savvy"));
-// mt is (Object[])List
-mt = MethodType.methodType(java.util.List.class, Object[].class);
-mh = lookup.findStatic(java.util.Arrays.class, "asList", mt);
-assert(mh.isVarargsCollector());
-x = mh.invokeGeneric("one", "two");
-// invokeGeneric(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
-assert(x.equals(java.util.Arrays.asList("one","two")));
-// mt is (Object,Object,Object)Object
-mt = MethodType.genericMethodType(3);
-mh = mh.asType(mt);
-x = mh.invokeExact((Object)1, (Object)2, (Object)3);
-// invokeExact(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
-assert(x.equals(java.util.Arrays.asList(1,2,3)));
-// mt is { =&gt; int}
-mt = MethodType.methodType(int.class);
-mh = lookup.findVirtual(java.util.List.class, "size", mt);
-i = (int) mh.invokeExact(java.util.Arrays.asList(1,2,3));
-// invokeExact(Ljava/util/List;)I
-assert(i == 3);
-mt = MethodType.methodType(void.class, String.class);
-mh = lookup.findVirtual(java.io.PrintStream.class, "println", mt);
-mh.invokeExact(System.out, "Hello, world.");
-// invokeExact(Ljava/io/PrintStream;Ljava/lang/String;)V
-{}
-            }}
-    }
-
-    @Test public void testAsVarargsCollector() throws Throwable {
-        {{
-{} /// JAVADOC
-MethodHandle asList = publicLookup()
-  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
-  .asVarargsCollector(Object[].class);
-assertEquals("[]", asList.invokeGeneric().toString());
-assertEquals("[1]", asList.invokeGeneric(1).toString());
-assertEquals("[two, too]", asList.invokeGeneric("two", "too").toString());
-Object[] argv = { "three", "thee", "tee" };
-assertEquals("[three, thee, tee]", asList.invokeGeneric(argv).toString());
-List ls = (List) asList.invokeGeneric((Object)argv);
-assertEquals(1, ls.size());
-assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
-            }}
-    }
-
-    @Test public void testVarargsCollectorSuppression() throws Throwable {
-        {{
-{} /// JAVADOC
-MethodHandle vamh = publicLookup()
-  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
-  .asVarargsCollector(Object[].class);
-MethodHandle mh = MethodHandles.exactInvoker(vamh.type()).bindTo(vamh);
-assert(vamh.type().equals(mh.type()));
-assertEquals("[1, 2, 3]", vamh.invokeGeneric(1,2,3).toString());
-boolean failed = false;
-try { mh.invokeGeneric(1,2,3); }
-catch (WrongMethodTypeException ex) { failed = true; }
-assert(failed);
-{}
-            }}
-    }
-}
--- a/jdk/test/java/dyn/MethodHandlesTest.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2400 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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.
- */
-
-/* @test
- * @summary unit tests for java.dyn.MethodHandles
- * @compile -source 7 -target 7 -XDallowTransitionalJSR292=no MethodHandlesTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.MethodHandlesTest
- */
-
-package test.java.dyn;
-
-import java.dyn.*;
-import java.dyn.MethodHandles.Lookup;
-import java.lang.reflect.*;
-import java.util.*;
-import org.junit.*;
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
-
-
-/**
- *
- * @author jrose
- */
-public class MethodHandlesTest {
-    // How much output?
-    static int verbosity = 0;
-    static {
-        String vstr = System.getProperty("test.java.dyn.MethodHandlesTest.verbosity");
-        if (vstr != null)  verbosity = Integer.parseInt(vstr);
-    }
-
-    // Set this true during development if you want to fast-forward to
-    // a particular new, non-working test.  Tests which are known to
-    // work (or have recently worked) test this flag and return on true.
-    static boolean CAN_SKIP_WORKING = false;
-    //static { CAN_SKIP_WORKING = true; }
-
-    // Set true to test more calls.  If false, some tests are just
-    // lookups, without exercising the actual method handle.
-    static boolean DO_MORE_CALLS = true;
-
-    @Test
-    public void testFirst() throws Throwable {
-        verbosity += 9; try {
-            // left blank for debugging
-        } finally { printCounts(); verbosity -= 9; }
-    }
-
-    // current failures
-    @Test @Ignore("failure in call to makeRawRetypeOnly in ToGeneric")
-    public void testFail_1() throws Throwable {
-        // AMH.<init>: IllegalArgumentException: bad adapter (conversion=0xfffab300): adapter pushes too many parameters
-        testSpreadArguments(int.class, 0, 6);
-    }
-    @Test @Ignore("failure in JVM when expanding the stack using asm stub for _adapter_spread_args")
-    public void testFail_2() throws Throwable {
-        // if CONV_OP_IMPLEMENTED_MASK includes OP_SPREAD_ARGS, this crashes:
-        testSpreadArguments(Object.class, 0, 2);
-    }
-    @Test @Ignore("IllArgEx failure in call to ToGeneric.make")
-    public void testFail_3() throws Throwable {
-        // ToGeneric.<init>: UnsupportedOperationException: NYI: primitive parameters must follow references; entryType = (int,java.lang.Object)java.lang.Object
-        testSpreadArguments(int.class, 1, 2);
-    }
-    @Test @Ignore("IllArgEx failure in call to ToGeneric.make")
-    public void testFail_4() throws Throwable {
-        // ToGeneric.<init>: UnsupportedOperationException: NYI: primitive parameters must follow references; entryType = (int,java.lang.Object)java.lang.Object
-        testCollectArguments(int.class, 1, 2);
-    }
-    @Test @Ignore("cannot collect leading primitive types")
-    public void testFail_5() throws Throwable {
-        // ToGeneric.<init>: UnsupportedOperationException: NYI: primitive parameters must follow references; entryType = (int,java.lang.Object)java.lang.Object
-        testInvokers(MethodType.genericMethodType(2).changeParameterType(0, int.class));
-    }
-    @Test @Ignore("should not insert arguments beyond MethodHandlePushLimit")
-    public void testFail_6() throws Throwable {
-        // ValueConversions.varargsArray: UnsupportedOperationException: NYI: cannot form a varargs array of length 13
-        testInsertArguments(0, 0, MAX_ARG_INCREASE+10);
-    }
-    static final int MAX_ARG_INCREASE = 3;
-
-    public MethodHandlesTest() {
-    }
-
-    @Before
-    public void checkImplementedPlatform() {
-        boolean platformOK = false;
-        Properties properties = System.getProperties();
-        String vers = properties.getProperty("java.vm.version");
-        String name = properties.getProperty("java.vm.name");
-        String arch = properties.getProperty("os.arch");
-        if ((arch.equals("amd64") || arch.equals("i386") || arch.equals("x86") ||
-             arch.equals("sparc") || arch.equals("sparcv9")) &&
-            (name.contains("Client") || name.contains("Server"))
-            ) {
-            platformOK = true;
-        } else {
-            System.err.println("Skipping tests for unsupported platform: "+Arrays.asList(vers, name, arch));
-        }
-        assumeTrue(platformOK);
-    }
-
-    String testName;
-    static int allPosTests, allNegTests;
-    int posTests, negTests;
-    @After
-    public void printCounts() {
-        if (verbosity >= 2 && (posTests | negTests) != 0) {
-            System.out.println();
-            if (posTests != 0)  System.out.println("=== "+testName+": "+posTests+" positive test cases run");
-            if (negTests != 0)  System.out.println("=== "+testName+": "+negTests+" negative test cases run");
-            allPosTests += posTests;
-            allNegTests += negTests;
-            posTests = negTests = 0;
-        }
-    }
-    void countTest(boolean positive) {
-        if (positive) ++posTests;
-        else          ++negTests;
-    }
-    void countTest() { countTest(true); }
-    void startTest(String name) {
-        if (testName != null)  printCounts();
-        if (verbosity >= 1)
-            System.out.println(name);
-        posTests = negTests = 0;
-        testName = name;
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-        calledLog.clear();
-        calledLog.add(null);
-        nextArgVal = INITIAL_ARG_VAL;
-    }
-
-    @AfterClass
-    public static void tearDownClass() throws Exception {
-        int posTests = allPosTests, negTests = allNegTests;
-        if (verbosity >= 2 && (posTests | negTests) != 0) {
-            System.out.println();
-            if (posTests != 0)  System.out.println("=== "+posTests+" total positive test cases");
-            if (negTests != 0)  System.out.println("=== "+negTests+" total negative test cases");
-        }
-    }
-
-    static List<Object> calledLog = new ArrayList<Object>();
-    static Object logEntry(String name, Object... args) {
-        return Arrays.asList(name, Arrays.asList(args));
-    }
-    static Object called(String name, Object... args) {
-        Object entry = logEntry(name, args);
-        calledLog.add(entry);
-        return entry;
-    }
-    static void assertCalled(String name, Object... args) {
-        Object expected = logEntry(name, args);
-        Object actual   = calledLog.get(calledLog.size() - 1);
-        if (expected.equals(actual) && verbosity < 9)  return;
-        System.out.println("assertCalled "+name+":");
-        System.out.println("expected:   "+expected);
-        System.out.println("actual:     "+actual);
-        System.out.println("ex. types:  "+getClasses(expected));
-        System.out.println("act. types: "+getClasses(actual));
-        assertEquals("previous method call", expected, actual);
-    }
-    static void printCalled(MethodHandle target, String name, Object... args) {
-        if (verbosity >= 3)
-            System.out.println("calling MH="+target+" to "+name+Arrays.toString(args));
-    }
-
-    static Object castToWrapper(Object value, Class<?> dst) {
-        Object wrap = null;
-        if (value instanceof Number)
-            wrap = castToWrapperOrNull(((Number)value).longValue(), dst);
-        if (value instanceof Character)
-            wrap = castToWrapperOrNull((char)(Character)value, dst);
-        if (wrap != null)  return wrap;
-        return dst.cast(value);
-    }
-
-    static Object castToWrapperOrNull(long value, Class<?> dst) {
-        if (dst == int.class || dst == Integer.class)
-            return (int)(value);
-        if (dst == long.class || dst == Long.class)
-            return (long)(value);
-        if (dst == char.class || dst == Character.class)
-            return (char)(value);
-        if (dst == short.class || dst == Short.class)
-            return (short)(value);
-        if (dst == float.class || dst == Float.class)
-            return (float)(value);
-        if (dst == double.class || dst == Double.class)
-            return (double)(value);
-        if (dst == byte.class || dst == Byte.class)
-            return (byte)(value);
-        if (dst == boolean.class || dst == boolean.class)
-            return ((value % 29) & 1) == 0;
-        return null;
-    }
-
-    static final int ONE_MILLION = (1000*1000),  // first int value
-                     TEN_BILLION = (10*1000*1000*1000),  // scale factor to reach upper 32 bits
-                     INITIAL_ARG_VAL = ONE_MILLION << 1;  // <<1 makes space for sign bit;
-    static long nextArgVal;
-    static long nextArg(boolean moreBits) {
-        long val = nextArgVal++;
-        long sign = -(val & 1); // alternate signs
-        val >>= 1;
-        if (moreBits)
-            // Guarantee some bits in the high word.
-            // In any case keep the decimal representation simple-looking,
-            // with lots of zeroes, so as not to make the printed decimal
-            // strings unnecessarily noisy.
-            val += (val % ONE_MILLION) * TEN_BILLION;
-        return val ^ sign;
-    }
-    static int nextArg() {
-        // Produce a 32-bit result something like ONE_MILLION+(smallint).
-        // Example: 1_000_042.
-        return (int) nextArg(false);
-    }
-    static long nextArg(Class<?> kind) {
-        if (kind == long.class   || kind == Long.class ||
-            kind == double.class || kind == Double.class)
-            // produce a 64-bit result something like
-            // ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
-            // Example: 10_000_420_001_000_042.
-            return nextArg(true);
-        return (long) nextArg();
-    }
-
-    static Object randomArg(Class<?> param) {
-        Object wrap = castToWrapperOrNull(nextArg(param), param);
-        if (wrap != null) {
-            return wrap;
-        }
-//        import sun.dyn.util.Wrapper;
-//        Wrapper wrap = Wrapper.forBasicType(dst);
-//        if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
-//            wrap = Wrapper.forWrapperType(dst);
-//        if (wrap != Wrapper.OBJECT)
-//            return wrap.wrap(nextArg++);
-        if (param.isInterface()) {
-            for (Class<?> c : param.getClasses()) {
-                if (param.isAssignableFrom(c) && !c.isInterface())
-                    { param = c; break; }
-            }
-        }
-        if (param.isInterface() || param.isAssignableFrom(String.class))
-            return "#"+nextArg();
-        else
-            try {
-                return param.newInstance();
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
-            }
-        return null;  // random class not Object, String, Integer, etc.
-    }
-    static Object[] randomArgs(Class<?>... params) {
-        Object[] args = new Object[params.length];
-        for (int i = 0; i < args.length; i++)
-            args[i] = randomArg(params[i]);
-        return args;
-    }
-    static Object[] randomArgs(int nargs, Class<?> param) {
-        Object[] args = new Object[nargs];
-        for (int i = 0; i < args.length; i++)
-            args[i] = randomArg(param);
-        return args;
-    }
-
-    static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
-        return Arrays.copyOf(a, a.length, atype);
-    }
-    static <T> T[] cat(T[] a, T... b) {
-        int alen = a.length, blen = b.length;
-        if (blen == 0)  return a;
-        T[] c = Arrays.copyOf(a, alen + blen);
-        System.arraycopy(b, 0, c, alen, blen);
-        return c;
-    }
-    static Integer[] boxAll(int... vx) {
-        Integer[] res = new Integer[vx.length];
-        for (int i = 0; i < res.length; i++) {
-            res[i] = vx[i];
-        }
-        return res;
-    }
-    static Object getClasses(Object x) {
-        if (x == null)  return x;
-        if (x instanceof String)  return x;  // keep the name
-        if (x instanceof List) {
-            // recursively report classes of the list elements
-            Object[] xa = ((List)x).toArray();
-            for (int i = 0; i < xa.length; i++)
-                xa[i] = getClasses(xa[i]);
-            return Arrays.asList(xa);
-        }
-        return x.getClass().getSimpleName();
-    }
-
-    /** Return lambda(arg...[arity]) { new Object[]{ arg... } } */
-    static MethodHandle varargsList(int arity) {
-        return ValueConversions.varargsList(arity);
-    }
-    /** Return lambda(arg...[arity]) { Arrays.asList(arg...) } */
-    static MethodHandle varargsArray(int arity) {
-        return ValueConversions.varargsArray(arity);
-    }
-    /** Variation of varargsList, but with the given rtype. */
-    static MethodHandle varargsList(int arity, Class<?> rtype) {
-        MethodHandle list = varargsList(arity);
-        MethodType listType = list.type().changeReturnType(rtype);
-        if (List.class.isAssignableFrom(rtype) || rtype == void.class || rtype == Object.class) {
-            // OK
-        } else if (rtype.isAssignableFrom(String.class)) {
-            if (LIST_TO_STRING == null)
-                try {
-                    LIST_TO_STRING = PRIVATE.findStatic(PRIVATE.lookupClass(), "listToString",
-                                                        MethodType.methodType(String.class, List.class));
-                } catch (Exception ex) { throw new RuntimeException(ex); }
-            list = MethodHandles.filterReturnValue(list, LIST_TO_STRING);
-        } else if (rtype.isPrimitive()) {
-            if (LIST_TO_INT == null)
-                try {
-                    LIST_TO_INT = PRIVATE.findStatic(PRIVATE.lookupClass(), "listToInt",
-                                                     MethodType.methodType(int.class, List.class));
-                } catch (Exception ex) { throw new RuntimeException(ex); }
-            list = MethodHandles.filterReturnValue(list, LIST_TO_INT);
-            list = MethodHandles.explicitCastArguments(list, listType);
-        } else {
-            throw new RuntimeException("varargsList: "+rtype);
-        }
-        return list.asType(listType);
-    }
-    private static MethodHandle LIST_TO_STRING, LIST_TO_INT;
-    private static String listToString(List x) { return x.toString(); }
-    private static int listToInt(List x) { return x.toString().hashCode(); }
-
-    static MethodHandle changeArgTypes(MethodHandle target, Class<?> argType) {
-        return changeArgTypes(target, 0, 999, argType);
-    }
-    static MethodHandle changeArgTypes(MethodHandle target,
-            int beg, int end, Class<?> argType) {
-        MethodType targetType = target.type();
-        end = Math.min(end, targetType.parameterCount());
-        ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>(targetType.parameterList());
-        Collections.fill(argTypes.subList(beg, end), argType);
-        MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
-        return MethodHandles.convertArguments(target, ttype2);
-    }
-
-    // This lookup is good for all members in and under MethodHandlesTest.
-    static final Lookup PRIVATE = MethodHandles.lookup();
-    // This lookup is good for package-private members but not private ones.
-    static final Lookup PACKAGE = PackageSibling.lookup();
-    // This lookup is good only for public members.
-    static final Lookup PUBLIC  = MethodHandles.publicLookup();
-
-    // Subject methods...
-    static class Example implements IntExample {
-        final String name;
-        public Example() { name = "Example#"+nextArg(); }
-        protected Example(String name) { this.name = name; }
-        protected Example(int x) { this(); called("protected <init>", this, x); }
-        @Override public String toString() { return name; }
-
-        public void            v0()     { called("v0", this); }
-        void                   pkg_v0() { called("pkg_v0", this); }
-        private void           pri_v0() { called("pri_v0", this); }
-        public static void     s0()     { called("s0"); }
-        static void            pkg_s0() { called("pkg_s0"); }
-        private static void    pri_s0() { called("pri_s0"); }
-
-        public Object          v1(Object x) { return called("v1", this, x); }
-        public Object          v2(Object x, Object y) { return called("v2", this, x, y); }
-        public Object          v2(Object x, int    y) { return called("v2", this, x, y); }
-        public Object          v2(int    x, Object y) { return called("v2", this, x, y); }
-        public Object          v2(int    x, int    y) { return called("v2", this, x, y); }
-        public static Object   s1(Object x) { return called("s1", x); }
-        public static Object   s2(int x)    { return called("s2", x); }
-        public static Object   s3(long x)   { return called("s3", x); }
-        public static Object   s4(int x, int y) { return called("s4", x, y); }
-        public static Object   s5(long x, int y) { return called("s5", x, y); }
-        public static Object   s6(int x, long y) { return called("s6", x, y); }
-        public static Object   s7(float x, double y) { return called("s7", x, y); }
-
-        static final Lookup EXAMPLE = MethodHandles.lookup();  // for testing findSpecial
-    }
-    static final Lookup EXAMPLE = Example.EXAMPLE;
-    public static class PubExample extends Example {
-        public PubExample() { super("PubExample#"+nextArg()); }
-    }
-    static class SubExample extends Example {
-        @Override public void  v0()     { called("Sub/v0", this); }
-        @Override void         pkg_v0() { called("Sub/pkg_v0", this); }
-        private      SubExample(int x)  { called("<init>", this, x); }
-        public SubExample() { super("SubExample#"+nextArg()); }
-    }
-    public static interface IntExample {
-        public void            v0();
-        public static class Impl implements IntExample {
-            public void        v0()     { called("Int/v0", this); }
-            final String name;
-            public Impl() { name = "Impl#"+nextArg(); }
-            @Override public String toString() { return name; }
-        }
-    }
-
-    static final Object[][][] ACCESS_CASES = {
-        { { false, PUBLIC }, { false, PACKAGE }, { false, PRIVATE }, { false, EXAMPLE } }, //[0]: all false
-        { { false, PUBLIC }, { false, PACKAGE }, { true,  PRIVATE }, { true,  EXAMPLE } }, //[1]: only PRIVATE
-        { { false, PUBLIC }, { true,  PACKAGE }, { true,  PRIVATE }, { true,  EXAMPLE } }, //[2]: PUBLIC false
-        { { true,  PUBLIC }, { true,  PACKAGE }, { true,  PRIVATE }, { true,  EXAMPLE } }, //[3]: all true
-    };
-
-    static Object[][] accessCases(Class<?> defc, String name, boolean isSpecial) {
-        Object[][] cases;
-        if (name.contains("pri_") || isSpecial) {
-            cases = ACCESS_CASES[1]; // PRIVATE only
-        } else if (name.contains("pkg_") || !Modifier.isPublic(defc.getModifiers())) {
-            cases = ACCESS_CASES[2]; // not PUBLIC
-        } else {
-            assertTrue(name.indexOf('_') < 0);
-            boolean pubc = Modifier.isPublic(defc.getModifiers());
-            if (pubc)
-                cases = ACCESS_CASES[3]; // all access levels
-            else
-                cases = ACCESS_CASES[2]; // PACKAGE but not PUBLIC
-        }
-        if (defc != Example.class && cases[cases.length-1][1] == EXAMPLE)
-            cases = Arrays.copyOfRange(cases, 0, cases.length-1);
-        return cases;
-    }
-    static Object[][] accessCases(Class<?> defc, String name) {
-        return accessCases(defc, name, false);
-    }
-
-    @Test
-    public void testFindStatic() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("findStatic");
-        testFindStatic(PubExample.class, void.class, "s0");
-        testFindStatic(Example.class, void.class, "s0");
-        testFindStatic(Example.class, void.class, "pkg_s0");
-        testFindStatic(Example.class, void.class, "pri_s0");
-
-        testFindStatic(Example.class, Object.class, "s1", Object.class);
-        testFindStatic(Example.class, Object.class, "s2", int.class);
-        testFindStatic(Example.class, Object.class, "s3", long.class);
-        testFindStatic(Example.class, Object.class, "s4", int.class, int.class);
-        testFindStatic(Example.class, Object.class, "s5", long.class, int.class);
-        testFindStatic(Example.class, Object.class, "s6", int.class, long.class);
-        testFindStatic(Example.class, Object.class, "s7", float.class, double.class);
-
-        testFindStatic(false, PRIVATE, Example.class, void.class, "bogus");
-    }
-
-    void testFindStatic(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        for (Object[] ac : accessCases(defc, name)) {
-            testFindStatic((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params);
-        }
-    }
-    void testFindStatic(Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        testFindStatic(true, lookup, defc, ret, name, params);
-    }
-    void testFindStatic(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        countTest(positive);
-        MethodType type = MethodType.methodType(ret, params);
-        MethodHandle target = null;
-        Exception noAccess = null;
-        try {
-            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
-            target = lookup.in(defc).findStatic(defc, name, type);
-        } catch (ReflectiveOperationException ex) {
-            noAccess = ex;
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
-        }
-        if (verbosity >= 3)
-            System.out.println("findStatic "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
-                    +(noAccess == null ? "" : " !! "+noAccess));
-        if (positive && noAccess != null)  throw noAccess;
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
-        if (!positive)  return; // negative test failed as expected
-        assertEquals(type, target.type());
-        assertNameStringContains(target, name);
-        if (!DO_MORE_CALLS && lookup != PRIVATE)  return;
-        Object[] args = randomArgs(params);
-        printCalled(target, name, args);
-        target.invokeWithArguments(args);
-        assertCalled(name, args);
-        if (verbosity >= 1)
-            System.out.print(':');
-    }
-
-    // rough check of name string
-    static void assertNameStringContains(Object x, String s) {
-        if (x.toString().contains(s))  return;
-        assertEquals(s, x);
-    }
-
-    @Test
-    public void testFindVirtual() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("findVirtual");
-        testFindVirtual(Example.class, void.class, "v0");
-        testFindVirtual(Example.class, void.class, "pkg_v0");
-        testFindVirtual(Example.class, void.class, "pri_v0");
-        testFindVirtual(Example.class, Object.class, "v1", Object.class);
-        testFindVirtual(Example.class, Object.class, "v2", Object.class, Object.class);
-        testFindVirtual(Example.class, Object.class, "v2", Object.class, int.class);
-        testFindVirtual(Example.class, Object.class, "v2", int.class, Object.class);
-        testFindVirtual(Example.class, Object.class, "v2", int.class, int.class);
-        testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus");
-        // test dispatch
-        testFindVirtual(SubExample.class,      SubExample.class, void.class, "Sub/v0");
-        testFindVirtual(SubExample.class,         Example.class, void.class, "Sub/v0");
-        testFindVirtual(SubExample.class,      IntExample.class, void.class, "Sub/v0");
-        testFindVirtual(SubExample.class,      SubExample.class, void.class, "Sub/pkg_v0");
-        testFindVirtual(SubExample.class,         Example.class, void.class, "Sub/pkg_v0");
-        testFindVirtual(Example.class,         IntExample.class, void.class, "v0");
-        testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0");
-    }
-
-    void testFindVirtual(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        Class<?> rcvc = defc;
-        testFindVirtual(rcvc, defc, ret, name, params);
-    }
-    void testFindVirtual(Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        for (Object[] ac : accessCases(defc, name)) {
-            testFindVirtual((Boolean)ac[0], (Lookup)ac[1], rcvc, defc, ret, name, params);
-        }
-    }
-    void testFindVirtual(Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        testFindVirtual(true, lookup, rcvc, defc, ret, name, params);
-    }
-    void testFindVirtual(boolean positive, Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        countTest(positive);
-        String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
-        MethodType type = MethodType.methodType(ret, params);
-        MethodHandle target = null;
-        Exception noAccess = null;
-        try {
-            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
-            target = lookup.in(defc).findVirtual(defc, methodName, type);
-        } catch (ReflectiveOperationException ex) {
-            noAccess = ex;
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
-        }
-        if (verbosity >= 3)
-            System.out.println("findVirtual "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
-                    +(noAccess == null ? "" : " !! "+noAccess));
-        if (positive && noAccess != null)  throw noAccess;
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
-        if (!positive)  return; // negative test failed as expected
-        Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)defc), params);
-        MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf);
-        assertEquals(typeWithSelf, target.type());
-        assertNameStringContains(target, methodName);
-        if (!DO_MORE_CALLS && lookup != PRIVATE)  return;
-        Object[] argsWithSelf = randomArgs(paramsWithSelf);
-        if (rcvc != defc)  argsWithSelf[0] = randomArg(rcvc);
-        printCalled(target, name, argsWithSelf);
-        target.invokeWithArguments(argsWithSelf);
-        assertCalled(name, argsWithSelf);
-        if (verbosity >= 1)
-            System.out.print(':');
-    }
-
-    @Test
-    public void testFindSpecial() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("findSpecial");
-        testFindSpecial(SubExample.class, Example.class, void.class, "v0");
-        testFindSpecial(SubExample.class, Example.class, void.class, "pkg_v0");
-        // Do some negative testing:
-        testFindSpecial(false, EXAMPLE, SubExample.class, Example.class, void.class, "bogus");
-        testFindSpecial(false, PRIVATE, SubExample.class, Example.class, void.class, "bogus");
-        for (Lookup lookup : new Lookup[]{ PRIVATE, EXAMPLE, PACKAGE, PUBLIC }) {
-            testFindSpecial(false, lookup, Object.class, Example.class, void.class, "v0");
-            testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", int.class);
-            testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "s0");
-        }
-    }
-
-    void testFindSpecial(Class<?> specialCaller,
-                         Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        testFindSpecial(true,  EXAMPLE, specialCaller, defc, ret, name, params);
-        testFindSpecial(true,  PRIVATE, specialCaller, defc, ret, name, params);
-        testFindSpecial(false, PACKAGE, specialCaller, defc, ret, name, params);
-        testFindSpecial(false, PUBLIC,  specialCaller, defc, ret, name, params);
-    }
-    void testFindSpecial(boolean positive, Lookup lookup, Class<?> specialCaller,
-                         Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        countTest(positive);
-        MethodType type = MethodType.methodType(ret, params);
-        MethodHandle target = null;
-        Exception noAccess = null;
-        try {
-            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
-            if (verbosity >= 5)  System.out.println("  lookup => "+lookup.in(specialCaller));
-            target = lookup.in(specialCaller).findSpecial(defc, name, type, specialCaller);
-        } catch (ReflectiveOperationException ex) {
-            noAccess = ex;
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
-        }
-        if (verbosity >= 3)
-            System.out.println("findSpecial from "+specialCaller.getName()+" to "+defc.getName()+"."+name+"/"+type+" => "+target
-                               +(target == null ? "" : target.type())
-                               +(noAccess == null ? "" : " !! "+noAccess));
-        if (positive && noAccess != null)  throw noAccess;
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
-        if (!positive)  return; // negative test failed as expected
-        assertEquals(specialCaller, target.type().parameterType(0));
-        assertEquals(type,          target.type().dropParameterTypes(0,1));
-        Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)specialCaller), params);
-        MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf);
-        assertNameStringContains(target, name);
-        if (!DO_MORE_CALLS && lookup != PRIVATE && lookup != EXAMPLE)  return;
-        Object[] args = randomArgs(paramsWithSelf);
-        printCalled(target, name, args);
-        target.invokeWithArguments(args);
-        assertCalled(name, args);
-    }
-
-    @Test
-    public void testBind() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("bind");
-        testBind(Example.class, void.class, "v0");
-        testBind(Example.class, void.class, "pkg_v0");
-        testBind(Example.class, void.class, "pri_v0");
-        testBind(Example.class, Object.class, "v1", Object.class);
-        testBind(Example.class, Object.class, "v2", Object.class, Object.class);
-        testBind(Example.class, Object.class, "v2", Object.class, int.class);
-        testBind(Example.class, Object.class, "v2", int.class, Object.class);
-        testBind(Example.class, Object.class, "v2", int.class, int.class);
-        testBind(false, PRIVATE, Example.class, void.class, "bogus");
-        testBind(SubExample.class, void.class, "Sub/v0");
-        testBind(SubExample.class, void.class, "Sub/pkg_v0");
-        testBind(IntExample.Impl.class, void.class, "Int/v0");
-    }
-
-    void testBind(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        for (Object[] ac : accessCases(defc, name)) {
-            testBind((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params);
-        }
-    }
-
-    void testBind(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        countTest(positive);
-        String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
-        MethodType type = MethodType.methodType(ret, params);
-        Object receiver = randomArg(defc);
-        MethodHandle target = null;
-        Exception noAccess = null;
-        try {
-            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
-            target = lookup.in(defc).bind(receiver, methodName, type);
-        } catch (ReflectiveOperationException ex) {
-            noAccess = ex;
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
-        }
-        if (verbosity >= 3)
-            System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target
-                    +(noAccess == null ? "" : " !! "+noAccess));
-        if (positive && noAccess != null)  throw noAccess;
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
-        if (!positive)  return; // negative test failed as expected
-        assertEquals(type, target.type());
-        Object[] args = randomArgs(params);
-        printCalled(target, name, args);
-        target.invokeWithArguments(args);
-        Object[] argsWithReceiver = cat(array(Object[].class, receiver), args);
-        assertCalled(name, argsWithReceiver);
-        if (verbosity >= 1)
-            System.out.print(':');
-    }
-
-    @Test
-    public void testUnreflect() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("unreflect");
-        testUnreflect(Example.class, true, void.class, "s0");
-        testUnreflect(Example.class, true, void.class, "pkg_s0");
-        testUnreflect(Example.class, true, void.class, "pri_s0");
-
-        testUnreflect(Example.class, true, Object.class, "s1", Object.class);
-        testUnreflect(Example.class, true, Object.class, "s2", int.class);
-        testUnreflect(Example.class, true, Object.class, "s3", long.class);
-        testUnreflect(Example.class, true, Object.class, "s4", int.class, int.class);
-        testUnreflect(Example.class, true, Object.class, "s5", long.class, int.class);
-        testUnreflect(Example.class, true, Object.class, "s6", int.class, long.class);
-
-        testUnreflect(Example.class, false, void.class, "v0");
-        testUnreflect(Example.class, false, void.class, "pkg_v0");
-        testUnreflect(Example.class, false, void.class, "pri_v0");
-        testUnreflect(Example.class, false, Object.class, "v1", Object.class);
-        testUnreflect(Example.class, false, Object.class, "v2", Object.class, Object.class);
-        testUnreflect(Example.class, false, Object.class, "v2", Object.class, int.class);
-        testUnreflect(Example.class, false, Object.class, "v2", int.class, Object.class);
-        testUnreflect(Example.class, false, Object.class, "v2", int.class, int.class);
-    }
-
-    void testUnreflect(Class<?> defc, boolean isStatic, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        for (Object[] ac : accessCases(defc, name)) {
-            testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, (isStatic ? null : defc), ret, name, params);
-        }
-    }
-    void testUnreflect(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        for (Object[] ac : accessCases(defc, name)) {
-            testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params);
-        }
-    }
-    void testUnreflectMaybeSpecial(Class<?> specialCaller,
-                                   boolean positive, Lookup lookup,
-                                   Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        countTest(positive);
-        MethodType type = MethodType.methodType(ret, params);
-        Method rmethod = defc.getDeclaredMethod(name, params);
-        MethodHandle target = null;
-        Exception noAccess = null;
-        boolean isStatic = (rcvc == null);
-        boolean isSpecial = (specialCaller != null);
-        try {
-            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
-            if (isSpecial)
-                target = lookup.in(specialCaller).unreflectSpecial(rmethod, specialCaller);
-            else
-                target = lookup.in(defc).unreflect(rmethod);
-        } catch (ReflectiveOperationException ex) {
-            noAccess = ex;
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
-        }
-        if (verbosity >= 3)
-            System.out.println("unreflect"+(isSpecial?"Special":"")+" "+defc.getName()+"."+name+"/"+type
-                               +(!isSpecial ? "" : " specialCaller="+specialCaller)
-                               +( isStatic  ? "" : " receiver="+rcvc)
-                               +" => "+target
-                               +(noAccess == null ? "" : " !! "+noAccess));
-        if (positive && noAccess != null)  throw noAccess;
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
-        if (!positive)  return; // negative test failed as expected
-        assertEquals(isStatic, Modifier.isStatic(rmethod.getModifiers()));
-        Class<?>[] paramsMaybeWithSelf = params;
-        if (!isStatic) {
-            paramsMaybeWithSelf = cat(array(Class[].class, (Class)rcvc), params);
-        }
-        MethodType typeMaybeWithSelf = MethodType.methodType(ret, paramsMaybeWithSelf);
-        if (isStatic) {
-            assertEquals(typeMaybeWithSelf, target.type());
-        } else {
-            if (isSpecial)
-                assertEquals(specialCaller, target.type().parameterType(0));
-            else
-                assertEquals(defc, target.type().parameterType(0));
-            assertEquals(typeMaybeWithSelf, target.type().changeParameterType(0, rcvc));
-        }
-        Object[] argsMaybeWithSelf = randomArgs(paramsMaybeWithSelf);
-        printCalled(target, name, argsMaybeWithSelf);
-        target.invokeWithArguments(argsMaybeWithSelf);
-        assertCalled(name, argsMaybeWithSelf);
-        if (verbosity >= 1)
-            System.out.print(':');
-    }
-
-    void testUnreflectSpecial(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable {
-        for (Object[] ac : accessCases(defc, name, true)) {
-            Class<?> specialCaller = rcvc;
-            testUnreflectMaybeSpecial(specialCaller, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params);
-        }
-    }
-
-    @Test
-    public void testUnreflectSpecial() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("unreflectSpecial");
-        testUnreflectSpecial(Example.class,    Example.class, void.class, "v0");
-        testUnreflectSpecial(Example.class, SubExample.class, void.class, "v0");
-        testUnreflectSpecial(Example.class,    Example.class, void.class, "pkg_v0");
-        testUnreflectSpecial(Example.class, SubExample.class, void.class, "pkg_v0");
-        testUnreflectSpecial(Example.class,    Example.class, Object.class, "v2", int.class, int.class);
-        testUnreflectSpecial(Example.class, SubExample.class, Object.class, "v2", int.class, int.class);
-        testUnreflectMaybeSpecial(Example.class, false, PRIVATE, Example.class, Example.class, void.class, "s0");
-    }
-
-    public static class HasFields {
-        boolean fZ = false;
-        byte fB = (byte)'B';
-        short fS = (short)'S';
-        char fC = 'C';
-        int fI = 'I';
-        long fJ = 'J';
-        float fF = 'F';
-        double fD = 'D';
-        static boolean sZ = true;
-        static byte sB = 1+(byte)'B';
-        static short sS = 1+(short)'S';
-        static char sC = 1+'C';
-        static int sI = 1+'I';
-        static long sJ = 1+'J';
-        static float sF = 1+'F';
-        static double sD = 1+'D';
-
-        Object fL = 'L';
-        String fR = "R";
-        static Object sL = 'M';
-        static String sR = "S";
-
-        static final Object[][] CASES;
-        static {
-            ArrayList<Object[]> cases = new ArrayList<Object[]>();
-            Object types[][] = {
-                {'L',Object.class}, {'R',String.class},
-                {'I',int.class}, {'J',long.class},
-                {'F',float.class}, {'D',double.class},
-                {'Z',boolean.class}, {'B',byte.class},
-                {'S',short.class}, {'C',char.class},
-            };
-            HasFields fields = new HasFields();
-            for (Object[] t : types) {
-                for (int kind = 0; kind <= 1; kind++) {
-                    boolean isStatic = (kind != 0);
-                    char btc = (Character)t[0];
-                    String name = (isStatic ? "s" : "f") + btc;
-                    Class<?> type = (Class<?>) t[1];
-                    Object value;
-                    Field field;
-                    try {
-                        field = HasFields.class.getDeclaredField(name);
-                    } catch (Exception ex) {
-                        throw new InternalError("no field HasFields."+name);
-                    }
-                    try {
-                        value = field.get(fields);
-                    } catch (Exception ex) {
-                        throw new InternalError("cannot fetch field HasFields."+name);
-                    }
-                    if (type == float.class) {
-                        float v = 'F';
-                        if (isStatic)  v++;
-                        assertTrue(value.equals(v));
-                    }
-                    assertTrue(name.equals(field.getName()));
-                    assertTrue(type.equals(field.getType()));
-                    assertTrue(isStatic == (Modifier.isStatic(field.getModifiers())));
-                    cases.add(new Object[]{ field, value });
-                }
-            }
-            cases.add(new Object[]{ new Object[]{ false, HasFields.class, "bogus_fD", double.class }, Error.class });
-            cases.add(new Object[]{ new Object[]{ true,  HasFields.class, "bogus_sL", Object.class }, Error.class });
-            CASES = cases.toArray(new Object[0][]);
-        }
-    }
-
-    static final int TEST_UNREFLECT = 1, TEST_FIND_FIELD = 2, TEST_FIND_STATIC = 3, TEST_SETTER = 0x10;
-    static boolean testModeMatches(int testMode, boolean isStatic) {
-        switch (testMode) {
-        case TEST_FIND_STATIC:          return isStatic;
-        case TEST_FIND_FIELD:           return !isStatic;
-        case TEST_UNREFLECT:            return true;  // unreflect matches both
-        }
-        throw new InternalError("testMode="+testMode);
-    }
-
-    @Test
-    public void testUnreflectGetter() throws Throwable {
-        startTest("unreflectGetter");
-        testGetter(TEST_UNREFLECT);
-    }
-    @Test
-    public void testFindGetter() throws Throwable {
-        startTest("findGetter");
-        testGetter(TEST_FIND_FIELD);
-    }
-    @Test
-    public void testFindStaticGetter() throws Throwable {
-        startTest("findStaticGetter");
-        testGetter(TEST_FIND_STATIC);
-    }
-    public void testGetter(int testMode) throws Throwable {
-        Lookup lookup = PRIVATE;  // FIXME: test more lookups than this one
-        for (Object[] c : HasFields.CASES) {
-            boolean positive = (c[1] != Error.class);
-            testGetter(positive, lookup, c[0], c[1], testMode);
-        }
-        testGetter(true, lookup,
-                   new Object[]{ true,  System.class, "out", java.io.PrintStream.class },
-                   System.out, testMode);
-        for (int isStaticN = 0; isStaticN <= 1; isStaticN++) {
-            testGetter(false, lookup,
-                       new Object[]{ (isStaticN != 0), System.class, "bogus", char.class },
-                       null, testMode);
-        }
-    }
-    public void testGetter(boolean positive, MethodHandles.Lookup lookup,
-                           Object fieldRef, Object value, int testMode) throws Throwable {
-        testAccessor(positive, lookup, fieldRef, value, testMode);
-    }
-
-    public void testAccessor(boolean positive, MethodHandles.Lookup lookup,
-                             Object fieldRef, Object value, int testMode0) throws Throwable {
-        boolean isGetter = ((testMode0 & TEST_SETTER) == 0);
-        int testMode = testMode0 & ~TEST_SETTER;
-        boolean isStatic;
-        Class<?> fclass;
-        String   fname;
-        Class<?> ftype;
-        Field f = (fieldRef instanceof Field ? (Field)fieldRef : null);
-        if (f != null) {
-            isStatic = Modifier.isStatic(f.getModifiers());
-            fclass   = f.getDeclaringClass();
-            fname    = f.getName();
-            ftype    = f.getType();
-        } else {
-            Object[] scnt = (Object[]) fieldRef;
-            isStatic = (Boolean)  scnt[0];
-            fclass   = (Class<?>) scnt[1];
-            fname    = (String)   scnt[2];
-            ftype    = (Class<?>) scnt[3];
-            try {
-                f = fclass.getDeclaredField(fname);
-            } catch (ReflectiveOperationException ex) {
-                f = null;
-            }
-        }
-        if (!testModeMatches(testMode, isStatic))  return;
-        if (f == null && testMode == TEST_UNREFLECT)  return;
-        countTest(positive);
-        MethodType expType;
-        if (isGetter)
-            expType = MethodType.methodType(ftype, HasFields.class);
-        else
-            expType = MethodType.methodType(void.class, HasFields.class, ftype);
-        if (isStatic)  expType = expType.dropParameterTypes(0, 1);
-        Exception noAccess = null;
-        MethodHandle mh;
-        try {
-            switch (testMode0) {
-            case TEST_UNREFLECT:   mh = lookup.unreflectGetter(f);                      break;
-            case TEST_FIND_FIELD:  mh = lookup.findGetter(fclass, fname, ftype);        break;
-            case TEST_FIND_STATIC: mh = lookup.findStaticGetter(fclass, fname, ftype);  break;
-            case TEST_SETTER|
-                 TEST_UNREFLECT:   mh = lookup.unreflectSetter(f);                      break;
-            case TEST_SETTER|
-                 TEST_FIND_FIELD:  mh = lookup.findSetter(fclass, fname, ftype);        break;
-            case TEST_SETTER|
-                 TEST_FIND_STATIC: mh = lookup.findStaticSetter(fclass, fname, ftype);  break;
-            default:
-                throw new InternalError("testMode="+testMode);
-            }
-        } catch (ReflectiveOperationException ex) {
-            mh = null;
-            noAccess = ex;
-            if (fname.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchFieldException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
-        }
-        if (verbosity >= 3)
-            System.out.println("find"+(isStatic?"Static":"")+(isGetter?"Getter":"Setter")+" "+fclass.getName()+"."+fname+"/"+ftype
-                               +" => "+mh
-                               +(noAccess == null ? "" : " !! "+noAccess));
-        if (positive && noAccess != null)  throw new RuntimeException(noAccess);
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, mh != null);
-        if (!positive)  return; // negative test failed as expected
-        assertEquals((isStatic ? 0 : 1)+(isGetter ? 0 : 1), mh.type().parameterCount());
-
-
-        assertSame(mh.type(), expType);
-        assertNameStringContains(mh, fname);
-        HasFields fields = new HasFields();
-        Object sawValue;
-        Class<?> vtype = ftype;
-        if (ftype != int.class)  vtype = Object.class;
-        if (isGetter) {
-            mh = MethodHandles.convertArguments(mh, mh.type().generic()
-                                                .changeReturnType(vtype));
-        } else {
-            int last = mh.type().parameterCount() - 1;
-            mh = MethodHandles.convertArguments(mh, mh.type().generic()
-                                                .changeReturnType(void.class)
-                                                .changeParameterType(last, vtype));
-        }
-        if (f != null && f.getDeclaringClass() == HasFields.class) {
-            assertEquals(f.get(fields), value);  // clean to start with
-        }
-        if (isGetter) {
-            Object expValue = value;
-            for (int i = 0; i <= 1; i++) {
-                if (isStatic) {
-                    if (ftype == int.class)
-                        sawValue = (int) mh.invokeExact();  // do these exactly
-                    else
-                        sawValue = mh.invokeExact();
-                } else {
-                    if (ftype == int.class)
-                        sawValue = (int) mh.invokeExact((Object) fields);
-                    else
-                        sawValue = mh.invokeExact((Object) fields);
-                }
-                assertEquals(sawValue, expValue);
-                if (f != null && f.getDeclaringClass() == HasFields.class
-                    && !Modifier.isFinal(f.getModifiers())) {
-                    Object random = randomArg(ftype);
-                    f.set(fields, random);
-                    expValue = random;
-                } else {
-                    break;
-                }
-            }
-        } else {
-            for (int i = 0; i <= 1; i++) {
-                Object putValue = randomArg(ftype);
-                if (isStatic) {
-                    if (ftype == int.class)
-                        mh.invokeExact((int)putValue);  // do these exactly
-                    else
-                        mh.invokeExact(putValue);
-                } else {
-                    if (ftype == int.class)
-                        mh.invokeExact((Object) fields, (int)putValue);
-                    else
-                        mh.invokeExact((Object) fields, putValue);
-                }
-                if (f != null && f.getDeclaringClass() == HasFields.class) {
-                    assertEquals(f.get(fields), putValue);
-                }
-            }
-        }
-        if (f != null && f.getDeclaringClass() == HasFields.class) {
-            f.set(fields, value);  // put it back
-        }
-    }
-
-
-    @Test
-    public void testUnreflectSetter() throws Throwable {
-        startTest("unreflectSetter");
-        testSetter(TEST_UNREFLECT);
-    }
-    @Test
-    public void testFindSetter() throws Throwable {
-        startTest("findSetter");
-        testSetter(TEST_FIND_FIELD);
-    }
-    @Test
-    public void testFindStaticSetter() throws Throwable {
-        startTest("findStaticSetter");
-        testSetter(TEST_FIND_STATIC);
-    }
-    public void testSetter(int testMode) throws Throwable {
-        Lookup lookup = PRIVATE;  // FIXME: test more lookups than this one
-        startTest("unreflectSetter");
-        for (Object[] c : HasFields.CASES) {
-            boolean positive = (c[1] != Error.class);
-            testSetter(positive, lookup, c[0], c[1], testMode);
-        }
-        for (int isStaticN = 0; isStaticN <= 1; isStaticN++) {
-            testSetter(false, lookup,
-                       new Object[]{ (isStaticN != 0), System.class, "bogus", char.class },
-                       null, testMode);
-        }
-    }
-    public void testSetter(boolean positive, MethodHandles.Lookup lookup,
-                           Object fieldRef, Object value, int testMode) throws Throwable {
-        testAccessor(positive, lookup, fieldRef, value, testMode | TEST_SETTER);
-    }
-
-    @Test
-    public void testArrayElementGetter() throws Throwable {
-        startTest("arrayElementGetter");
-        testArrayElementGetterSetter(false);
-    }
-
-    @Test
-    public void testArrayElementSetter() throws Throwable {
-        startTest("arrayElementSetter");
-        testArrayElementGetterSetter(true);
-    }
-
-    public void testArrayElementGetterSetter(boolean testSetter) throws Throwable {
-        testArrayElementGetterSetter(new Object[10], testSetter);
-        testArrayElementGetterSetter(new String[10], testSetter);
-        testArrayElementGetterSetter(new boolean[10], testSetter);
-        testArrayElementGetterSetter(new byte[10], testSetter);
-        testArrayElementGetterSetter(new char[10], testSetter);
-        testArrayElementGetterSetter(new short[10], testSetter);
-        testArrayElementGetterSetter(new int[10], testSetter);
-        testArrayElementGetterSetter(new float[10], testSetter);
-        testArrayElementGetterSetter(new long[10], testSetter);
-        testArrayElementGetterSetter(new double[10], testSetter);
-    }
-
-    public void testArrayElementGetterSetter(Object array, boolean testSetter) throws Throwable {
-        countTest(true);
-        if (verbosity >= 2)  System.out.println("array type = "+array.getClass().getComponentType().getName()+"["+Array.getLength(array)+"]");
-        Class<?> arrayType = array.getClass();
-        Class<?> elemType = arrayType.getComponentType();
-        MethodType expType = !testSetter
-                ? MethodType.methodType(elemType,   arrayType, int.class)
-                : MethodType.methodType(void.class, arrayType, int.class, elemType);
-        MethodHandle mh = !testSetter
-                ? MethodHandles.arrayElementGetter(arrayType)
-                : MethodHandles.arrayElementSetter(arrayType);
-        assertSame(mh.type(), expType);
-        if (elemType != int.class && elemType != boolean.class) {
-            MethodType gtype;
-            if (true) { // FIXME: remove this path (and remove <void> below in the mh.invokes)
-                gtype = mh.type().changeParameterType(0, Object.class);
-                if (testSetter)
-                    gtype = gtype.changeParameterType(2, Object.class);
-                else
-                    gtype = gtype.changeReturnType(Object.class);
-            } else
-                // FIXME: This simpler path hits a bug in convertArguments => ToGeneric
-                gtype = mh.type().generic().changeParameterType(1, int.class);
-            mh = MethodHandles.convertArguments(mh, gtype);
-        }
-        Object sawValue, expValue;
-        List<Object> model = array2list(array);
-        int length = Array.getLength(array);
-        for (int i = 0; i < length; i++) {
-            // update array element
-            Object random = randomArg(elemType);
-            model.set(i, random);
-            if (testSetter) {
-                if (elemType == int.class)
-                    mh.invokeExact((int[]) array, i, (int)random);
-                else if (elemType == boolean.class)
-                    mh.invokeExact((boolean[]) array, i, (boolean)random);
-                else
-                    mh.invokeExact(array, i, random);
-                assertEquals(model, array2list(array));
-            } else {
-                Array.set(array, i, random);
-            }
-            if (verbosity >= 5) {
-                List<Object> array2list = array2list(array);
-                System.out.println("a["+i+"]="+random+" => "+array2list);
-                if (!array2list.equals(model))
-                    System.out.println("***   != "+model);
-            }
-            // observe array element
-            sawValue = Array.get(array, i);
-            if (!testSetter) {
-                expValue = sawValue;
-                if (elemType == int.class)
-                    sawValue = (int) mh.invokeExact((int[]) array, i);
-                else if (elemType == boolean.class)
-                    sawValue = (boolean) mh.invokeExact((boolean[]) array, i);
-                else
-                    sawValue = mh.invokeExact(array, i);
-                assertEquals(sawValue, expValue);
-                assertEquals(model, array2list(array));
-            }
-        }
-    }
-
-    List<Object> array2list(Object array) {
-        int length = Array.getLength(array);
-        ArrayList<Object> model = new ArrayList<Object>(length);
-        for (int i = 0; i < length; i++)
-            model.add(Array.get(array, i));
-        return model;
-    }
-
-    static class Callee {
-        static Object id() { return called("id"); }
-        static Object id(Object x) { return called("id", x); }
-        static Object id(Object x, Object y) { return called("id", x, y); }
-        static Object id(Object x, Object y, Object z) { return called("id", x, y, z); }
-        static Object id(Object... vx) { return called("id", vx); }
-        static MethodHandle ofType(int n) {
-            return ofType(Object.class, n);
-        }
-        static MethodHandle ofType(Class<?> rtype, int n) {
-            if (n == -1)
-                return ofType(MethodType.methodType(rtype, Object[].class));
-            return ofType(MethodType.genericMethodType(n).changeReturnType(rtype));
-        }
-        static MethodHandle ofType(Class<?> rtype, Class<?>... ptypes) {
-            return ofType(MethodType.methodType(rtype, ptypes));
-        }
-        static MethodHandle ofType(MethodType type) {
-            Class<?> rtype = type.returnType();
-            String pfx = "";
-            if (rtype != Object.class)
-                pfx = rtype.getSimpleName().substring(0, 1).toLowerCase();
-            String name = pfx+"id";
-            try {
-                return PRIVATE.findStatic(Callee.class, name, type);
-            } catch (Exception ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-    }
-
-    @Test
-    public void testConvertArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("convertArguments");
-        testConvert(Callee.ofType(1), null, "id", int.class);
-        testConvert(Callee.ofType(1), null, "id", String.class);
-        testConvert(Callee.ofType(1), null, "id", Integer.class);
-        testConvert(Callee.ofType(1), null, "id", short.class);
-        testConvert(Callee.ofType(1), null, "id", char.class);
-        testConvert(Callee.ofType(1), null, "id", byte.class);
-    }
-
-    void testConvert(MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable {
-        testConvert(true, false, id, rtype, name, params);
-        testConvert(true, true,  id, rtype, name, params);
-    }
-
-    void testConvert(boolean positive, boolean useAsType,
-                     MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable {
-        countTest(positive);
-        MethodType idType = id.type();
-        if (rtype == null)  rtype = idType.returnType();
-        for (int i = 0; i < params.length; i++) {
-            if (params[i] == null)  params[i] = idType.parameterType(i);
-        }
-        // simulate the pairwise conversion
-        MethodType newType = MethodType.methodType(rtype, params);
-        Object[] args = randomArgs(newType.parameterArray());
-        Object[] convArgs = args.clone();
-        for (int i = 0; i < args.length; i++) {
-            Class<?> src = newType.parameterType(i);
-            Class<?> dst = idType.parameterType(i);
-            if (src != dst)
-                convArgs[i] = castToWrapper(convArgs[i], dst);
-        }
-        Object convResult = id.invokeWithArguments(convArgs);
-        {
-            Class<?> dst = newType.returnType();
-            Class<?> src = idType.returnType();
-            if (src != dst)
-                convResult = castToWrapper(convResult, dst);
-        }
-        MethodHandle target = null;
-        RuntimeException error = null;
-        try {
-            if (useAsType)
-                target = id.asType(newType);
-            else
-                target = MethodHandles.convertArguments(id, newType);
-        } catch (RuntimeException ex) {
-            error = ex;
-        }
-        if (verbosity >= 3)
-            System.out.println("convert "+id+ " to "+newType+" => "+target
-                    +(error == null ? "" : " !! "+error));
-        if (positive && error != null)  throw error;
-        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
-        if (!positive)  return; // negative test failed as expected
-        assertEquals(newType, target.type());
-        printCalled(target, id.toString(), args);
-        Object result = target.invokeWithArguments(args);
-        assertCalled(name, convArgs);
-        assertEquals(convResult, result);
-        if (verbosity >= 1)
-            System.out.print(':');
-    }
-
-    @Test
-    public void testVarargsCollector() throws Throwable {
-        MethodHandle vac0 = PRIVATE.findStatic(MethodHandlesTest.class, "called",
-                               MethodType.methodType(Object.class, String.class, Object[].class));
-        vac0 = vac0.bindTo("vac");
-        MethodHandle vac = vac0.asVarargsCollector(Object[].class);
-        testConvert(true,  true,  vac.asType(MethodType.genericMethodType(0)), null, "vac");
-        testConvert(true,  true,  vac.asType(MethodType.genericMethodType(0)), null, "vac");
-        for (Class<?> at : new Class[] { Object.class, String.class, Integer.class }) {
-            testConvert(true,  true,  vac.asType(MethodType.genericMethodType(1)), null, "vac", at);
-            testConvert(true,  true,  vac.asType(MethodType.genericMethodType(2)), null, "vac", at, at);
-        }
-    }
-
-    @Test
-    public void testPermuteArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("permuteArguments");
-        testPermuteArguments(4, Integer.class,  2, String.class,  0);
-        //testPermuteArguments(6, Integer.class,  0, null,         30);
-        //testPermuteArguments(4, Integer.class,  1, int.class,     6);
-    }
-    public void testPermuteArguments(int max, Class<?> type1, int t2c, Class<?> type2, int dilution) throws Throwable {
-        if (verbosity >= 2)
-            System.out.println("permuteArguments "+max+"*"+type1.getName()
-                    +(t2c==0?"":"/"+t2c+"*"+type2.getName())
-                    +(dilution > 0 ? " with dilution "+dilution : ""));
-        int t2pos = t2c == 0 ? 0 : 1;
-        for (int inargs = t2pos+1; inargs <= max; inargs++) {
-            Class<?>[] types = new Class<?>[inargs];
-            Arrays.fill(types, type1);
-            if (t2c != 0) {
-                // Fill in a middle range with type2:
-                Arrays.fill(types, t2pos, Math.min(t2pos+t2c, inargs), type2);
-            }
-            Object[] args = randomArgs(types);
-            int numcases = 1;
-            for (int outargs = 0; outargs <= max; outargs++) {
-                if (outargs - inargs >= MAX_ARG_INCREASE)  continue;
-                int[] reorder = new int[outargs];
-                int casStep = dilution + 1;
-                // Avoid some common factors:
-                while ((casStep > 2 && casStep % 2 == 0 && inargs % 2 == 0) ||
-                       (casStep > 3 && casStep % 3 == 0 && inargs % 3 == 0))
-                    casStep++;
-                for (int cas = 0; cas < numcases; cas += casStep) {
-                    for (int i = 0, c = cas; i < outargs; i++) {
-                        reorder[i] = c % inargs;
-                        c /= inargs;
-                    }
-                    testPermuteArguments(args, types, reorder);
-                }
-                numcases *= inargs;
-                if (dilution > 10 && outargs >= 4) {
-                    // Do some special patterns, which we probably missed.
-                    // Replication of a single argument or argument pair.
-                    for (int i = 0; i < inargs; i++) {
-                        Arrays.fill(reorder, i);
-                        testPermuteArguments(args, types, reorder);
-                        for (int d = 1; d <= 2; d++) {
-                            if (i + d >= inargs)  continue;
-                            for (int j = 1; j < outargs; j += 2)
-                                reorder[j] += 1;
-                            testPermuteArguments(args, types, reorder);
-                            testPermuteArguments(args, types, reverse(reorder));
-                        }
-                    }
-                    // Repetition of a sequence of 3 or more arguments.
-                    for (int i = 1; i < inargs; i++) {
-                        for (int len = 3; len <= inargs; len++) {
-                            for (int j = 0; j < outargs; j++)
-                                reorder[j] = (i + (j % len)) % inargs;
-                            testPermuteArguments(args, types, reorder);
-                            testPermuteArguments(args, types, reverse(reorder));
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    static int[] reverse(int[] reorder) {
-        reorder = reorder.clone();
-        for (int i = 0, imax = reorder.length / 2; i < imax; i++) {
-            int j = reorder.length - 1 - i;
-            int tem = reorder[i];
-            reorder[i] = reorder[j];
-            reorder[j] = tem;
-        }
-        return reorder;
-    }
-
-    void testPermuteArguments(Object[] args, Class<?>[] types, int[] reorder) throws Throwable {
-        countTest();
-        if (args == null && types == null) {
-            int max = 0;
-            for (int j : reorder) {
-                if (max < j)  max = j;
-            }
-            args = randomArgs(max+1, Integer.class);
-        }
-        if (args == null) {
-            args = randomArgs(types);
-        }
-        if (types == null) {
-            types = new Class<?>[args.length];
-            for (int i = 0; i < args.length; i++)
-                types[i] = args[i].getClass();
-        }
-        int inargs = args.length, outargs = reorder.length;
-        assertTrue(inargs == types.length);
-        if (verbosity >= 3)
-            System.out.println("permuteArguments "+Arrays.toString(reorder));
-        Object[] permArgs = new Object[outargs];
-        Class<?>[] permTypes = new Class<?>[outargs];
-        for (int i = 0; i < outargs; i++) {
-            permArgs[i] = args[reorder[i]];
-            permTypes[i] = types[reorder[i]];
-        }
-        if (verbosity >= 4) {
-            System.out.println("in args:   "+Arrays.asList(args));
-            System.out.println("out args:  "+Arrays.asList(permArgs));
-            System.out.println("in types:  "+Arrays.asList(types));
-            System.out.println("out types: "+Arrays.asList(permTypes));
-        }
-        MethodType inType  = MethodType.methodType(Object.class, types);
-        MethodType outType = MethodType.methodType(Object.class, permTypes);
-        MethodHandle target = MethodHandles.convertArguments(varargsList(outargs), outType);
-        MethodHandle newTarget = MethodHandles.permuteArguments(target, inType, reorder);
-        Object result = newTarget.invokeWithArguments(args);
-        Object expected = Arrays.asList(permArgs);
-        assertEquals(expected, result);
-    }
-
-
-    @Test
-    public void testSpreadArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("spreadArguments");
-        for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
-            if (verbosity >= 3)
-                System.out.println("spreadArguments "+argType);
-            // FIXME: enable _adapter_spread_args and fix Fail_2
-            for (int nargs = 0; nargs < 10; nargs++) {
-                if (argType == int.class && nargs >= 6)  continue; // FIXME Fail_1
-                for (int pos = 0; pos < nargs; pos++) {
-                    if (argType == int.class && pos > 0)  continue; // FIXME Fail_3
-                     testSpreadArguments(argType, pos, nargs);
-                }
-            }
-        }
-    }
-    public void testSpreadArguments(Class<?> argType, int pos, int nargs) throws Throwable {
-        countTest();
-        MethodHandle target = varargsArray(nargs);
-        MethodHandle target2 = changeArgTypes(target, argType);
-        if (verbosity >= 3)
-            System.out.println("spread into "+target2+" ["+pos+".."+nargs+"]");
-        Object[] args = randomArgs(target2.type().parameterArray());
-        // make sure the target does what we think it does:
-        if (pos == 0 && nargs < 5) {
-            Object[] check = (Object[]) target.invokeWithArguments(args);
-            assertArrayEquals(args, check);
-            switch (nargs) {
-                case 0:
-                    check = (Object[]) target.invokeExact();
-                    assertArrayEquals(args, check);
-                    break;
-                case 1:
-                    check = (Object[]) target.invokeExact(args[0]);
-                    assertArrayEquals(args, check);
-                    break;
-                case 2:
-                    check = (Object[]) target.invokeExact(args[0], args[1]);
-                    assertArrayEquals(args, check);
-                    break;
-            }
-        }
-        List<Class<?>> newParams = new ArrayList<Class<?>>(target2.type().parameterList());
-        {   // modify newParams in place
-            List<Class<?>> spreadParams = newParams.subList(pos, nargs);
-            spreadParams.clear(); spreadParams.add(Object[].class);
-        }
-        MethodType newType = MethodType.methodType(Object.class, newParams);
-        MethodHandle result = target2.asSpreader(Object[].class, nargs-pos).asType(newType);
-        Object[] returnValue;
-        if (pos == 0) {
-            // In the following line, the first cast implies
-            // normal Object return value for the MH call (Object[])->Object,
-            // while the second cast dynamically converts to an Object array.
-            // Such a double cast is typical of MH.invokeExact.
-            returnValue = (Object[]) (Object) result.invokeExact(args);
-        } else {
-            Object[] args1 = Arrays.copyOfRange(args, 0, pos+1);
-            args1[pos] = Arrays.copyOfRange(args, pos, args.length);
-            returnValue = (Object[]) result.invokeWithArguments(args1);
-        }
-        assertArrayEquals(args, returnValue);
-    }
-
-    @Test
-    public void testCollectArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("collectArguments");
-        for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
-            if (verbosity >= 3)
-                System.out.println("collectArguments "+argType);
-            for (int nargs = 0; nargs < 10; nargs++) {
-                for (int pos = 0; pos < nargs; pos++) {
-                    if (argType == int.class)  continue; // FIXME Fail_4
-                    testCollectArguments(argType, pos, nargs);
-                }
-            }
-        }
-    }
-    public void testCollectArguments(Class<?> argType, int pos, int nargs) throws Throwable {
-        countTest();
-        // fake up a MH with the same type as the desired adapter:
-        MethodHandle fake = varargsArray(nargs);
-        fake = changeArgTypes(fake, argType);
-        MethodType newType = fake.type();
-        Object[] args = randomArgs(newType.parameterArray());
-        // here is what should happen:
-        Object[] collectedArgs = Arrays.copyOfRange(args, 0, pos+1);
-        collectedArgs[pos] = Arrays.copyOfRange(args, pos, args.length);
-        // here is the MH which will witness the collected argument tail:
-        MethodHandle target = varargsArray(pos+1);
-        target = changeArgTypes(target, 0, pos, argType);
-        target = changeArgTypes(target, pos, pos+1, Object[].class);
-        if (verbosity >= 3)
-            System.out.println("collect from "+Arrays.asList(args)+" ["+pos+".."+nargs+"]");
-        MethodHandle result = target.asCollector(Object[].class, nargs-pos).asType(newType);
-        Object[] returnValue = (Object[]) result.invokeWithArguments(args);
-//        assertTrue(returnValue.length == pos+1 && returnValue[pos] instanceof Object[]);
-//        returnValue[pos] = Arrays.asList((Object[]) returnValue[pos]);
-//        collectedArgs[pos] = Arrays.asList((Object[]) collectedArgs[pos]);
-        assertArrayEquals(collectedArgs, returnValue);
-    }
-
-    @Test
-    public void testInsertArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("insertArguments");
-        for (int nargs = 0; nargs <= 4; nargs++) {
-            for (int ins = 0; ins <= 4; ins++) {
-                if (ins > MAX_ARG_INCREASE)  continue;  // FIXME Fail_6
-                for (int pos = 0; pos <= nargs; pos++) {
-                    testInsertArguments(nargs, pos, ins);
-                }
-            }
-        }
-    }
-
-    void testInsertArguments(int nargs, int pos, int ins) throws Throwable {
-        countTest();
-        MethodHandle target = varargsArray(nargs + ins);
-        Object[] args = randomArgs(target.type().parameterArray());
-        List<Object> resList = Arrays.asList(args);
-        List<Object> argsToPass = new ArrayList<Object>(resList);
-        List<Object> argsToInsert = argsToPass.subList(pos, pos + ins);
-        if (verbosity >= 3)
-            System.out.println("insert: "+argsToInsert+" into "+target);
-        MethodHandle target2 = MethodHandles.insertArguments(target, pos,
-                (Object[]) argsToInsert.toArray());
-        argsToInsert.clear();  // remove from argsToInsert
-        Object res2 = target2.invokeWithArguments(argsToPass);
-        Object res2List = Arrays.asList((Object[])res2);
-        if (verbosity >= 3)
-            System.out.println("result: "+res2List);
-        //if (!resList.equals(res2List))
-        //    System.out.println("*** fail at n/p/i = "+nargs+"/"+pos+"/"+ins+": "+resList+" => "+res2List);
-        assertEquals(resList, res2List);
-    }
-
-    @Test
-    public void testFilterReturnValue() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("filterReturnValue");
-        Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass();
-        assertTrue(List.class.isAssignableFrom(classOfVCList));
-        for (int nargs = 0; nargs <= 3; nargs++) {
-            for (Class<?> rtype : new Class[] { Object.class,
-                                                List.class,
-                                                int.class,
-                                                //byte.class, //FIXME: add this
-                                                //long.class, //FIXME: add this
-                                                CharSequence.class,
-                                                String.class }) {
-                testFilterReturnValue(nargs, rtype);
-            }
-        }
-    }
-
-    void testFilterReturnValue(int nargs, Class<?> rtype) throws Throwable {
-        countTest();
-        MethodHandle target = varargsList(nargs, rtype);
-        MethodHandle filter;
-        if (List.class.isAssignableFrom(rtype) || rtype.isAssignableFrom(List.class))
-            filter = varargsList(1);  // add another layer of list-ness
-        else
-            filter = MethodHandles.identity(rtype);
-        filter = filter.asType(MethodType.methodType(target.type().returnType(), rtype));
-        Object[] argsToPass = randomArgs(nargs, Object.class);
-        if (verbosity >= 3)
-            System.out.println("filter "+target+" to "+rtype.getSimpleName()+" with "+filter);
-        MethodHandle target2 = MethodHandles.filterReturnValue(target, filter);
-        if (verbosity >= 4)
-            System.out.println("filtered target: "+target2);
-        // Simulate expected effect of filter on return value:
-        Object unfiltered = target.invokeWithArguments(argsToPass);
-        Object expected = filter.invokeWithArguments(unfiltered);
-        if (verbosity >= 4)
-            System.out.println("unfiltered: "+unfiltered+" : "+unfiltered.getClass().getSimpleName());
-        if (verbosity >= 4)
-            System.out.println("expected: "+expected+" : "+expected.getClass().getSimpleName());
-        Object result = target2.invokeWithArguments(argsToPass);
-        if (verbosity >= 3)
-            System.out.println("result: "+result+" : "+result.getClass().getSimpleName());
-        if (!expected.equals(result))
-            System.out.println("*** fail at n/rt = "+nargs+"/"+rtype.getSimpleName()+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected);
-        assertEquals(expected, result);
-    }
-
-    @Test
-    public void testFilterArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("filterArguments");
-        for (int nargs = 1; nargs <= 6; nargs++) {
-            for (int pos = 0; pos < nargs; pos++) {
-                testFilterArguments(nargs, pos);
-            }
-        }
-    }
-
-    void testFilterArguments(int nargs, int pos) throws Throwable {
-        countTest();
-        MethodHandle target = varargsList(nargs);
-        MethodHandle filter = varargsList(1);
-        filter = MethodHandles.convertArguments(filter, filter.type().generic());
-        Object[] argsToPass = randomArgs(nargs, Object.class);
-        if (verbosity >= 3)
-            System.out.println("filter "+target+" at "+pos+" with "+filter);
-        MethodHandle target2 = MethodHandles.filterArguments(target, pos, filter);
-        // Simulate expected effect of filter on arglist:
-        Object[] filteredArgs = argsToPass.clone();
-        filteredArgs[pos] = filter.invokeExact(filteredArgs[pos]);
-        List<Object> expected = Arrays.asList(filteredArgs);
-        Object result = target2.invokeWithArguments(argsToPass);
-        if (verbosity >= 3)
-            System.out.println("result: "+result);
-        if (!expected.equals(result))
-            System.out.println("*** fail at n/p = "+nargs+"/"+pos+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected);
-        assertEquals(expected, result);
-    }
-
-    @Test
-    public void testFoldArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("foldArguments");
-        for (int nargs = 0; nargs <= 4; nargs++) {
-            for (int fold = 0; fold <= nargs; fold++) {
-                for (int pos = 0; pos <= nargs; pos++) {
-                    testFoldArguments(nargs, pos, fold);
-                }
-            }
-        }
-    }
-
-    void testFoldArguments(int nargs, int pos, int fold) throws Throwable {
-        if (pos != 0)  return;  // can fold only at pos=0 for now
-        countTest();
-        MethodHandle target = varargsList(1 + nargs);
-        MethodHandle combine = varargsList(fold).asType(MethodType.genericMethodType(fold));
-        List<Object> argsToPass = Arrays.asList(randomArgs(nargs, Object.class));
-        if (verbosity >= 3)
-            System.out.println("fold "+target+" with "+combine);
-        MethodHandle target2 = MethodHandles.foldArguments(target, combine);
-        // Simulate expected effect of combiner on arglist:
-        List<Object> expected = new ArrayList<Object>(argsToPass);
-        List<Object> argsToFold = expected.subList(pos, pos + fold);
-        if (verbosity >= 3)
-            System.out.println("fold: "+argsToFold+" into "+target2);
-        Object foldedArgs = combine.invokeWithArguments(argsToFold);
-        argsToFold.add(0, foldedArgs);
-        Object result = target2.invokeWithArguments(argsToPass);
-        if (verbosity >= 3)
-            System.out.println("result: "+result);
-        if (!expected.equals(result))
-            System.out.println("*** fail at n/p/f = "+nargs+"/"+pos+"/"+fold+": "+argsToPass+" => "+result+" != "+expected);
-        assertEquals(expected, result);
-    }
-
-    @Test
-    public void testDropArguments() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("dropArguments");
-        for (int nargs = 0; nargs <= 4; nargs++) {
-            for (int drop = 1; drop <= 4; drop++) {
-                for (int pos = 0; pos <= nargs; pos++) {
-                    testDropArguments(nargs, pos, drop);
-                }
-            }
-        }
-    }
-
-    void testDropArguments(int nargs, int pos, int drop) throws Throwable {
-        countTest();
-        MethodHandle target = varargsArray(nargs);
-        Object[] args = randomArgs(target.type().parameterArray());
-        MethodHandle target2 = MethodHandles.dropArguments(target, pos,
-                Collections.nCopies(drop, Object.class).toArray(new Class[0]));
-        List<Object> resList = Arrays.asList(args);
-        List<Object> argsToDrop = new ArrayList<Object>(resList);
-        for (int i = drop; i > 0; i--) {
-            argsToDrop.add(pos, "blort#"+i);
-        }
-        Object res2 = target2.invokeWithArguments(argsToDrop);
-        Object res2List = Arrays.asList((Object[])res2);
-        //if (!resList.equals(res2List))
-        //    System.out.println("*** fail at n/p/d = "+nargs+"/"+pos+"/"+drop+": "+argsToDrop+" => "+res2List);
-        assertEquals(resList, res2List);
-    }
-
-    @Test
-    public void testInvokers() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker");
-        // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker
-        Set<MethodType> done = new HashSet<MethodType>();
-        for (int i = 0; i <= 6; i++) {
-            MethodType gtype = MethodType.genericMethodType(i);
-            for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
-                for (int j = -1; j < i; j++) {
-                    MethodType type = gtype;
-                    if (j < 0)
-                        type = type.changeReturnType(argType);
-                    else if (argType == void.class)
-                        continue;
-                    else
-                        type = type.changeParameterType(j, argType);
-                    if (argType.isPrimitive() && j != i-1)  continue; // FIXME Fail_5
-                    if (done.add(type))
-                        testInvokers(type);
-                    MethodType vtype = type.changeReturnType(void.class);
-                    if (done.add(vtype))
-                        testInvokers(vtype);
-                }
-            }
-        }
-    }
-
-    public void testInvokers(MethodType type) throws Throwable {
-        if (verbosity >= 3)
-            System.out.println("test invokers for "+type);
-        int nargs = type.parameterCount();
-        boolean testRetCode = type.returnType() != void.class;
-        MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "invokee",
-                                MethodType.genericMethodType(0, true));
-        assertTrue(target.isVarargsCollector());
-        target = target.asType(type);
-        Object[] args = randomArgs(type.parameterArray());
-        List<Object> targetPlusArgs = new ArrayList<Object>(Arrays.asList(args));
-        targetPlusArgs.add(0, target);
-        int code = (Integer) invokee(args);
-        Object log = logEntry("invokee", args);
-        assertEquals(log.hashCode(), code);
-        assertCalled("invokee", args);
-        MethodHandle inv;
-        Object result;
-        // exact invoker
-        countTest();
-        calledLog.clear();
-        inv = MethodHandles.exactInvoker(type);
-        result = inv.invokeWithArguments(targetPlusArgs);
-        if (testRetCode)  assertEquals(code, result);
-        assertCalled("invokee", args);
-        // generic invoker
-        countTest();
-        inv = MethodHandles.genericInvoker(type);
-        if (nargs <= 3) {
-            calledLog.clear();
-            switch (nargs) {
-            case 0:
-                result = inv.invokeExact(target);
-                break;
-            case 1:
-                result = inv.invokeExact(target, args[0]);
-                break;
-            case 2:
-                result = inv.invokeExact(target, args[0], args[1]);
-                break;
-            case 3:
-                result = inv.invokeExact(target, args[0], args[1], args[2]);
-                break;
-            }
-            if (testRetCode)  assertEquals(code, result);
-            assertCalled("invokee", args);
-        }
-        calledLog.clear();
-        result = inv.invokeWithArguments(targetPlusArgs);
-        if (testRetCode)  assertEquals(code, result);
-        assertCalled("invokee", args);
-        // varargs invoker #0
-        calledLog.clear();
-        inv = MethodHandles.spreadInvoker(type, 0);
-        result = inv.invokeExact(target, args);
-        if (testRetCode)  assertEquals(code, result);
-        assertCalled("invokee", args);
-        if (nargs >= 1) {
-            // varargs invoker #1
-            calledLog.clear();
-            inv = MethodHandles.spreadInvoker(type, 1);
-            result = inv.invokeExact(target, args[0], Arrays.copyOfRange(args, 1, nargs));
-            if (testRetCode)  assertEquals(code, result);
-            assertCalled("invokee", args);
-        }
-        if (nargs >= 2) {
-            // varargs invoker #2
-            calledLog.clear();
-            inv = MethodHandles.spreadInvoker(type, 2);
-            result = inv.invokeExact(target, args[0], args[1], Arrays.copyOfRange(args, 2, nargs));
-            if (testRetCode)  assertEquals(code, result);
-            assertCalled("invokee", args);
-        }
-        if (nargs >= 3) {
-            // varargs invoker #3
-            calledLog.clear();
-            inv = MethodHandles.spreadInvoker(type, 3);
-            result = inv.invokeExact(target, args[0], args[1], args[2], Arrays.copyOfRange(args, 3, nargs));
-            if (testRetCode)  assertEquals(code, result);
-            assertCalled("invokee", args);
-        }
-        for (int k = 0; k <= nargs; k++) {
-            // varargs invoker #0..N
-            countTest();
-            calledLog.clear();
-            inv = MethodHandles.spreadInvoker(type, k);
-            List<Object> targetPlusVarArgs = new ArrayList<Object>(targetPlusArgs);
-            List<Object> tailList = targetPlusVarArgs.subList(1+k, 1+nargs);
-            Object[] tail = tailList.toArray();
-            tailList.clear(); tailList.add(tail);
-            result = inv.invokeWithArguments(targetPlusVarArgs);
-            if (testRetCode)  assertEquals(code, result);
-            assertCalled("invokee", args);
-        }
-
-        // dynamic invoker
-        countTest();
-        CallSite site = new MutableCallSite(type);
-        inv = site.dynamicInvoker();
-
-        // see if we get the result of the original target:
-        try {
-            result = inv.invokeWithArguments(args);
-            assertTrue("should not reach here", false);
-        } catch (IllegalStateException ex) {
-            String msg = ex.getMessage();
-            assertTrue(msg, msg.contains("site"));
-        }
-
-        // set new target after invoker is created, to make sure we track target
-        site.setTarget(target);
-        calledLog.clear();
-        result = inv.invokeWithArguments(args);
-        if (testRetCode)  assertEquals(code, result);
-        assertCalled("invokee", args);
-    }
-
-    static Object invokee(Object... args) {
-        return called("invokee", args).hashCode();
-    }
-
-    private static final String MISSING_ARG = "missingArg";
-    static Object targetIfEquals() {
-        return called("targetIfEquals");
-    }
-    static Object fallbackIfNotEquals() {
-        return called("fallbackIfNotEquals");
-    }
-    static Object targetIfEquals(Object x) {
-        assertEquals(x, MISSING_ARG);
-        return called("targetIfEquals", x);
-    }
-    static Object fallbackIfNotEquals(Object x) {
-        assertFalse(x.toString(), x.equals(MISSING_ARG));
-        return called("fallbackIfNotEquals", x);
-    }
-    static Object targetIfEquals(Object x, Object y) {
-        assertEquals(x, y);
-        return called("targetIfEquals", x, y);
-    }
-    static Object fallbackIfNotEquals(Object x, Object y) {
-        assertFalse(x.toString(), x.equals(y));
-        return called("fallbackIfNotEquals", x, y);
-    }
-    static Object targetIfEquals(Object x, Object y, Object z) {
-        assertEquals(x, y);
-        return called("targetIfEquals", x, y, z);
-    }
-    static Object fallbackIfNotEquals(Object x, Object y, Object z) {
-        assertFalse(x.toString(), x.equals(y));
-        return called("fallbackIfNotEquals", x, y, z);
-    }
-
-    @Test
-    public void testGuardWithTest() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("guardWithTest");
-        for (int nargs = 0; nargs <= 3; nargs++) {
-            if (nargs != 2)  continue;  // FIXME: test more later
-            testGuardWithTest(nargs, Object.class);
-            testGuardWithTest(nargs, String.class);
-        }
-    }
-    void testGuardWithTest(int nargs, Class<?> argClass) throws Throwable {
-        countTest();
-        MethodHandle test = PRIVATE.findVirtual(Object.class, "equals", MethodType.methodType(boolean.class, Object.class));
-        MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "targetIfEquals", MethodType.genericMethodType(nargs));
-        MethodHandle fallback = PRIVATE.findStatic(MethodHandlesTest.class, "fallbackIfNotEquals", MethodType.genericMethodType(nargs));
-        while (test.type().parameterCount() < nargs)
-            test = MethodHandles.dropArguments(test, test.type().parameterCount()-1, Object.class);
-        while (test.type().parameterCount() > nargs)
-            test = MethodHandles.insertArguments(test, 0, MISSING_ARG);
-        if (argClass != Object.class) {
-            test = changeArgTypes(test, argClass);
-            target = changeArgTypes(target, argClass);
-            fallback = changeArgTypes(fallback, argClass);
-        }
-        MethodHandle mh = MethodHandles.guardWithTest(test, target, fallback);
-        assertEquals(target.type(), mh.type());
-        Object[][] argLists = {
-            { },
-            { "foo" }, { MISSING_ARG },
-            { "foo", "foo" }, { "foo", "bar" },
-            { "foo", "foo", "baz" }, { "foo", "bar", "baz" }
-        };
-        for (Object[] argList : argLists) {
-            if (argList.length != nargs)  continue;
-            boolean equals;
-            switch (nargs) {
-            case 0:   equals = true; break;
-            case 1:   equals = MISSING_ARG.equals(argList[0]); break;
-            default:  equals = argList[0].equals(argList[1]); break;
-            }
-            String willCall = (equals ? "targetIfEquals" : "fallbackIfNotEquals");
-            if (verbosity >= 3)
-                System.out.println(logEntry(willCall, argList));
-            Object result = mh.invokeWithArguments(argList);
-            assertCalled(willCall, argList);
-        }
-    }
-
-    @Test
-    public void testCatchException() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("catchException");
-        for (int nargs = 2; nargs <= 6; nargs++) {
-            for (int ti = 0; ti <= 1; ti++) {
-                boolean throwIt = (ti != 0);
-                testCatchException(int.class, new ClassCastException("testing"), throwIt, nargs);
-                testCatchException(void.class, new java.io.IOException("testing"), throwIt, nargs);
-                testCatchException(String.class, new LinkageError("testing"), throwIt, nargs);
-            }
-        }
-    }
-
-    private static <T extends Throwable>
-    Object throwOrReturn(Object normal, T exception) throws T {
-        if (exception != null)  throw exception;
-        return normal;
-    }
-
-    void testCatchException(Class<?> returnType, Throwable thrown, boolean throwIt, int nargs) throws Throwable {
-        countTest();
-        if (verbosity >= 3)
-            System.out.println("catchException rt="+returnType+" throw="+throwIt+" nargs="+nargs);
-        Class<? extends Throwable> exType = thrown.getClass();
-        MethodHandle throwOrReturn
-                = PRIVATE.findStatic(MethodHandlesTest.class, "throwOrReturn",
-                    MethodType.methodType(Object.class, Object.class, Throwable.class));
-        MethodHandle thrower = throwOrReturn.asType(MethodType.genericMethodType(2));
-        while (thrower.type().parameterCount() < nargs)
-            thrower = MethodHandles.dropArguments(thrower, thrower.type().parameterCount(), Object.class);
-        MethodHandle catcher = varargsList(1+nargs).asType(MethodType.genericMethodType(1+nargs));
-        MethodHandle target = MethodHandles.catchException(thrower,
-                thrown.getClass(), catcher);
-        assertEquals(thrower.type(), target.type());
-        //System.out.println("catching with "+target+" : "+throwOrReturn);
-        Object[] args = randomArgs(nargs, Object.class);
-        args[1] = (throwIt ? thrown : null);
-        Object returned = target.invokeWithArguments(args);
-        //System.out.println("return from "+target+" : "+returned);
-        if (!throwIt) {
-            assertSame(args[0], returned);
-        } else {
-            List<Object> catchArgs = new ArrayList<Object>(Arrays.asList(args));
-            catchArgs.add(0, thrown);
-            assertEquals(catchArgs, returned);
-        }
-    }
-
-    @Test
-    public void testThrowException() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("throwException");
-        testThrowException(int.class, new ClassCastException("testing"));
-        testThrowException(void.class, new java.io.IOException("testing"));
-        testThrowException(String.class, new LinkageError("testing"));
-    }
-
-    void testThrowException(Class<?> returnType, Throwable thrown) throws Throwable {
-        countTest();
-        Class<? extends Throwable> exType = thrown.getClass();
-        MethodHandle target = MethodHandles.throwException(returnType, exType);
-        //System.out.println("throwing with "+target+" : "+thrown);
-        MethodType expectedType = MethodType.methodType(returnType, exType);
-        assertEquals(expectedType, target.type());
-        target = MethodHandles.convertArguments(target, target.type().generic());
-        Throwable caught = null;
-        try {
-            Object res = target.invokeExact((Object) thrown);
-            fail("got "+res+" instead of throwing "+thrown);
-        } catch (Throwable ex) {
-            if (ex != thrown) {
-                if (ex instanceof Error)  throw (Error)ex;
-                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
-            }
-            caught = ex;
-        }
-        assertSame(thrown, caught);
-    }
-
-    @Test
-    public void testCastFailure() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("testCastFailure");
-        testCastFailure("cast/argument", 11000);
-        testCastFailure("unbox/argument", 11000);
-        testCastFailure("cast/return", 11000);
-        testCastFailure("unbox/return", 11000);
-    }
-
-    static class Surprise {
-        public MethodHandle asMethodHandle() {
-            return VALUE.bindTo(this);
-        }
-        Object value(Object x) {
-            trace("value", x);
-            if (boo != null)  return boo;
-            return x;
-        }
-        Object boo;
-        void boo(Object x) { boo = x; }
-
-        static void trace(String x, Object y) {
-            if (verbosity > 8) System.out.println(x+"="+y);
-        }
-        static Object  refIdentity(Object x)  { trace("ref.x", x); return x; }
-        static Integer boxIdentity(Integer x) { trace("box.x", x); return x; }
-        static int     intIdentity(int x)     { trace("int.x", x); return x; }
-        static MethodHandle VALUE, REF_IDENTITY, BOX_IDENTITY, INT_IDENTITY;
-        static {
-            try {
-                VALUE = PRIVATE.findVirtual(
-                    Surprise.class, "value",
-                        MethodType.methodType(Object.class, Object.class));
-                REF_IDENTITY = PRIVATE.findStatic(
-                    Surprise.class, "refIdentity",
-                        MethodType.methodType(Object.class, Object.class));
-                BOX_IDENTITY = PRIVATE.findStatic(
-                    Surprise.class, "boxIdentity",
-                        MethodType.methodType(Integer.class, Integer.class));
-                INT_IDENTITY = PRIVATE.findStatic(
-                    Surprise.class, "intIdentity",
-                        MethodType.methodType(int.class, int.class));
-            } catch (Exception ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-    }
-
-    void testCastFailure(String mode, int okCount) throws Throwable {
-        countTest(false);
-        if (verbosity > 2)  System.out.println("mode="+mode);
-        Surprise boo = new Surprise();
-        MethodHandle identity = Surprise.REF_IDENTITY, surprise0 = boo.asMethodHandle(), surprise = surprise0;
-        if (mode.endsWith("/return")) {
-            if (mode.equals("unbox/return")) {
-                // fail on return to ((Integer)surprise).intValue
-                surprise = MethodHandles.convertArguments(surprise, MethodType.methodType(int.class, Object.class));
-                identity = MethodHandles.convertArguments(identity, MethodType.methodType(int.class, Object.class));
-            } else if (mode.equals("cast/return")) {
-                // fail on return to (Integer)surprise
-                surprise = MethodHandles.convertArguments(surprise, MethodType.methodType(Integer.class, Object.class));
-                identity = MethodHandles.convertArguments(identity, MethodType.methodType(Integer.class, Object.class));
-            }
-        } else if (mode.endsWith("/argument")) {
-            MethodHandle callee = null;
-            if (mode.equals("unbox/argument")) {
-                // fail on handing surprise to int argument
-                callee = Surprise.INT_IDENTITY;
-            } else if (mode.equals("cast/argument")) {
-                // fail on handing surprise to Integer argument
-                callee = Surprise.BOX_IDENTITY;
-            }
-            if (callee != null) {
-                callee = MethodHandles.convertArguments(callee, MethodType.genericMethodType(1));
-                surprise = MethodHandles.filterArguments(callee, 0, surprise);
-                identity = MethodHandles.filterArguments(callee, 0, identity);
-            }
-        }
-        assertNotSame(mode, surprise, surprise0);
-        identity = MethodHandles.convertArguments(identity, MethodType.genericMethodType(1));
-        surprise = MethodHandles.convertArguments(surprise, MethodType.genericMethodType(1));
-        Object x = 42;
-        for (int i = 0; i < okCount; i++) {
-            Object y = identity.invokeExact(x);
-            assertEquals(x, y);
-            Object z = surprise.invokeExact(x);
-            assertEquals(x, z);
-        }
-        boo.boo("Boo!");
-        Object y = identity.invokeExact(x);
-        assertEquals(x, y);
-        try {
-            Object z = surprise.invokeExact(x);
-            System.out.println("Failed to throw; got z="+z);
-            assertTrue(false);
-        } catch (Exception ex) {
-            if (verbosity > 2)
-                System.out.println("caught "+ex);
-            if (verbosity > 3)
-                ex.printStackTrace();
-            assertTrue(ex instanceof ClassCastException
-                    // FIXME: accept only one of the two for any given unit test
-                    || ex instanceof WrongMethodTypeException
-                    );
-        }
-    }
-
-    static Example userMethod(Object o, String s, int i) {
-        called("userMethod", o, s, i);
-        return null;
-    }
-
-    @Test
-    public void testUserClassInSignature() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        startTest("testUserClassInSignature");
-        Lookup lookup = MethodHandles.lookup();
-        String name; MethodType mt; MethodHandle mh;
-        Object[] args;
-
-        // Try a static method.
-        name = "userMethod";
-        mt = MethodType.methodType(Example.class, Object.class, String.class, int.class);
-        mh = lookup.findStatic(lookup.lookupClass(), name, mt);
-        assertEquals(mt, mh.type());
-        assertEquals(Example.class, mh.type().returnType());
-        args = randomArgs(mh.type().parameterArray());
-        mh.invokeWithArguments(args);
-        assertCalled(name, args);
-
-        // Try a virtual method.
-        name = "v2";
-        mt = MethodType.methodType(Object.class, Object.class, int.class);
-        mh = lookup.findVirtual(Example.class, name, mt);
-        assertEquals(mt, mh.type().dropParameterTypes(0,1));
-        assertTrue(mh.type().parameterList().contains(Example.class));
-        args = randomArgs(mh.type().parameterArray());
-        mh.invokeWithArguments(args);
-        assertCalled(name, args);
-    }
-
-    static void runForRunnable() {
-        called("runForRunnable");
-    }
-    private interface Fooable {
-        Object foo(Fooable x, Object y);
-        // this is for randomArg:
-        public class Impl implements Fooable {
-            public Object foo(Fooable x, Object y) {
-                throw new RuntimeException("do not call");
-            }
-            final String name;
-            public Impl() { name = "Fooable#"+nextArg(); }
-            @Override public String toString() { return name; }
-        }
-    }
-    static Object fooForFooable(Fooable x, Object y) {
-        return called("fooForFooable", x, y);
-    }
-    private static class MyCheckedException extends Exception {
-    }
-    private interface WillThrow {
-        void willThrow() throws MyCheckedException;
-    }
-
-    @Test
-    public void testAsInstance() throws Throwable {
-        if (CAN_SKIP_WORKING)  return;
-        Lookup lookup = MethodHandles.lookup();
-        {
-            MethodType mt = MethodType.methodType(void.class);
-            MethodHandle mh = lookup.findStatic(MethodHandlesTest.class, "runForRunnable", mt);
-            Runnable proxy = MethodHandles.asInstance(mh, Runnable.class);
-            proxy.run();
-            assertCalled("runForRunnable");
-        }
-        {
-            MethodType mt = MethodType.methodType(Object.class, Fooable.class, Object.class);
-            MethodHandle mh = lookup.findStatic(MethodHandlesTest.class, "fooForFooable", mt);
-            Fooable proxy = MethodHandles.asInstance(mh, Fooable.class);
-            Object[] args = randomArgs(mt.parameterArray());
-            Object result = proxy.foo((Fooable) args[0], args[1]);
-            assertCalled("fooForFooable", args);
-            assertEquals(result, logEntry("fooForFooable", args));
-        }
-        for (Throwable ex : new Throwable[] { new NullPointerException("ok"),
-                                              new InternalError("ok"),
-                                              new Throwable("fail"),
-                                              new Exception("fail"),
-                                              new MyCheckedException()
-                                            }) {
-            MethodHandle mh = MethodHandles.throwException(void.class, Throwable.class);
-            mh = MethodHandles.insertArguments(mh, 0, ex);
-            WillThrow proxy = MethodHandles.asInstance(mh, WillThrow.class);
-            try {
-                proxy.willThrow();
-                System.out.println("Failed to throw: "+ex);
-                assertTrue(false);
-            } catch (Throwable ex1) {
-                if (verbosity > 2) {
-                    System.out.println("throw "+ex);
-                    System.out.println("catch "+(ex == ex1 ? "UNWRAPPED" : ex1));
-                }
-                if (ex instanceof RuntimeException ||
-                    ex instanceof Error) {
-                    assertSame("must pass unchecked exception out without wrapping", ex, ex1);
-                } else if (ex instanceof MyCheckedException) {
-                    assertSame("must pass declared exception out without wrapping", ex, ex1);
-                } else {
-                    assertNotSame("must pass undeclared checked exception with wrapping", ex, ex1);
-                    UndeclaredThrowableException utex = (UndeclaredThrowableException) ex1;
-                    assertSame(ex, utex.getCause());
-                }
-            }
-        }
-        // Test error checking:
-        for (Class<?> nonSAM : new Class[] { Object.class,
-                                             String.class,
-                                             CharSequence.class,
-                                             Example.class }) {
-            try {
-                MethodHandles.asInstance(varargsArray(0), nonSAM);
-                System.out.println("Failed to throw");
-                assertTrue(false);
-            } catch (IllegalArgumentException ex) {
-            }
-        }
-    }
-}
-// Local abbreviated copy of sun.dyn.util.ValueConversions
-class ValueConversions {
-    private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
-    private static final Object[] NO_ARGS_ARRAY = {};
-    private static Object[] makeArray(Object... args) { return args; }
-    private static Object[] array() { return NO_ARGS_ARRAY; }
-    private static Object[] array(Object a0)
-                { return makeArray(a0); }
-    private static Object[] array(Object a0, Object a1)
-                { return makeArray(a0, a1); }
-    private static Object[] array(Object a0, Object a1, Object a2)
-                { return makeArray(a0, a1, a2); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3)
-                { return makeArray(a0, a1, a2, a3); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4)
-                { return makeArray(a0, a1, a2, a3, a4); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5)
-                { return makeArray(a0, a1, a2, a3, a4, a5); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8, Object a9)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-    static MethodHandle[] makeArrays() {
-        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
-        MethodHandles.Lookup lookup = IMPL_LOOKUP;
-        for (;;) {
-            int nargs = arrays.size();
-            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(Object[].class);
-            String name = "array";
-            MethodHandle array = null;
-            try {
-                array = lookup.findStatic(ValueConversions.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-                // break from loop!
-            }
-            if (array == null)  break;
-            arrays.add(array);
-        }
-        assertTrue(arrays.size() == 11);  // current number of methods
-        return arrays.toArray(new MethodHandle[0]);
-    }
-    static final MethodHandle[] ARRAYS = makeArrays();
-
-    /** Return a method handle that takes the indicated number of Object
-     *  arguments and returns an Object array of them, as if for varargs.
-     */
-    public static MethodHandle varargsArray(int nargs) {
-        if (nargs < ARRAYS.length)
-            return ARRAYS[nargs];
-        // else need to spin bytecode or do something else fancy
-        throw new UnsupportedOperationException("NYI: cannot form a varargs array of length "+nargs);
-    }
-
-    private static final List<Object> NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY);
-    private static List<Object> makeList(Object... args) { return Arrays.asList(args); }
-    private static List<Object> list() { return NO_ARGS_LIST; }
-    private static List<Object> list(Object a0)
-                { return makeList(a0); }
-    private static List<Object> list(Object a0, Object a1)
-                { return makeList(a0, a1); }
-    private static List<Object> list(Object a0, Object a1, Object a2)
-                { return makeList(a0, a1, a2); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3)
-                { return makeList(a0, a1, a2, a3); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4)
-                { return makeList(a0, a1, a2, a3, a4); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5)
-                { return makeList(a0, a1, a2, a3, a4, a5); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7,
-                                     Object a8)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7,
-                                     Object a8, Object a9)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-    static MethodHandle[] makeLists() {
-        ArrayList<MethodHandle> lists = new ArrayList<MethodHandle>();
-        MethodHandles.Lookup lookup = IMPL_LOOKUP;
-        for (;;) {
-            int nargs = lists.size();
-            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(List.class);
-            String name = "list";
-            MethodHandle list = null;
-            try {
-                list = lookup.findStatic(ValueConversions.class, name, type);
-            } catch (ReflectiveOperationException ex) {
-                // break from loop!
-            }
-            if (list == null)  break;
-            lists.add(list);
-        }
-        assertTrue(lists.size() == 11);  // current number of methods
-        return lists.toArray(new MethodHandle[0]);
-    }
-    static final MethodHandle[] LISTS = makeLists();
-
-    /** Return a method handle that takes the indicated number of Object
-     *  arguments and returns List.
-     */
-    public static MethodHandle varargsList(int nargs) {
-        if (nargs < LISTS.length)
-            return LISTS[nargs];
-        // else need to spin bytecode or do something else fancy
-        throw new UnsupportedOperationException("NYI");
-    }
-}
-// This guy tests access from outside the same package member, but inside
-// the package itself.
-class PackageSibling {
-    static Lookup lookup() {
-        return MethodHandles.lookup();
-    }
-}
--- a/jdk/test/java/dyn/MethodTypeTest.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,542 +0,0 @@
-/*
- * Copyright 2008, 2011 Sun Microsystems, Inc.  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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/* @test
- * @summary unit tests for java.dyn.MethodType
- * @compile MethodTypeTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.MethodTypeTest
- */
-
-package test.java.dyn;
-
-import sun.dyn.MemberName;
-import java.dyn.MethodType;
-import java.lang.reflect.Method;
-
-import java.util.*;
-import org.junit.*;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author jrose
- */
-public class MethodTypeTest {
-
-    private Class<?> rtype;
-    private Class<?>[] ptypes;
-    private MethodType mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov;
-    private MethodType mt_iSI, mt_ISi, mt_ISI, mt_iSi;
-    private MethodType mt_viO, mt_iO2, mt_OOi, mt_iOi;
-    private MethodType mt_VIO, mt_IO2, mt_OOI, mt_IOI, mt_VIS;
-    private MethodType mt_vOiSzA, mt_OO99;
-    private MethodType[] GALLERY;
-    private Method compareTo;
-
-    @Before
-    public void setUp() throws Exception {
-        rtype = void.class;
-        ptypes = new Class<?>[] { int.class, String.class };
-
-        mt_viS = MethodType.methodType(void.class, int.class, String.class);
-        mt_OO = MethodType.methodType(Object.class, Object.class);
-        mt_OO2 = MethodType.methodType(Object.class, Object.class, Object.class);
-        mt_vv = MethodType.methodType(void.class);
-        mt_Vv = MethodType.methodType(Void.class);
-        mt_Ov = MethodType.methodType(Object.class);
-        mt_iSI = MethodType.methodType(int.class, String.class, Integer.class);
-        mt_ISi = MethodType.methodType(Integer.class, String.class, int.class);
-        mt_ISI = MethodType.methodType(Integer.class, String.class, Integer.class);
-        mt_iSi = MethodType.methodType(int.class, String.class, int.class);
-
-        compareTo = String.class.getDeclaredMethod("compareTo", String.class);
-
-        mt_viO = MethodType.methodType(void.class, int.class, Object.class);
-        mt_iO2 = MethodType.methodType(int.class, Object.class, Object.class);
-        mt_OOi = MethodType.methodType(Object.class, Object.class, int.class);
-        mt_iOi = MethodType.methodType(int.class, Object.class, int.class);
-
-        mt_VIO = MethodType.methodType(Void.class, Integer.class, Object.class);
-        mt_IO2 = MethodType.methodType(Integer.class, Object.class, Object.class);
-        mt_OOI = MethodType.methodType(Object.class, Object.class, Integer.class);
-        mt_IOI = MethodType.methodType(Integer.class, Object.class, Integer.class);
-        mt_VIS = MethodType.methodType(Void.class, Integer.class, String.class);
-
-        mt_vOiSzA = MethodType.methodType(void.class, Object.class, int.class, String.class, boolean.class, Object[].class);
-        mt_OO99 = MethodType.genericMethodType(99);
-
-        GALLERY = new MethodType[] {
-            mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov,
-            mt_iSI, mt_ISi, mt_ISI, mt_iSi,
-            mt_viO, mt_iO2, mt_OOi, mt_iOi,
-            mt_VIO, mt_IO2, mt_OOI, mt_IOI,
-            mt_VIS, mt_vOiSzA, mt_OO99
-        };
-    }
-
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    /** Make sure the method types are all distinct. */
-    @Test
-    public void testDistinct() {
-        List<MethodType> gallery2 = new ArrayList<>();
-        for (MethodType mt : GALLERY) {
-            assertFalse(mt.toString(), gallery2.contains(mt));
-            gallery2.add(mt);
-        }
-        // check self-equality also:
-        assertEquals(Arrays.asList(GALLERY), gallery2);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_Class_ClassArr() {
-        System.out.println("make (from type array)");
-        MethodType result = MethodType.methodType(rtype, ptypes);
-        assertSame(mt_viS, result);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_Class_List() {
-        System.out.println("make (from type list)");
-        MethodType result = MethodType.methodType(rtype, Arrays.asList(ptypes));
-        assertSame(mt_viS, result);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_3args() {
-        System.out.println("make (from type with varargs)");
-        MethodType result = MethodType.methodType(rtype, ptypes[0], ptypes[1]);
-        assertSame(mt_viS, result);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_Class() {
-        System.out.println("make (from single type)");
-        Class<?> rt = Integer.class;
-        MethodType expResult = MethodType.methodType(rt, new Class<?>[0]);
-        MethodType result = MethodType.methodType(rt);
-        assertSame(expResult, result);
-    }
-
-    @Test
-    public void testMakeGeneric() {
-        System.out.println("makeGeneric");
-        int objectArgCount = 2;
-        MethodType expResult = mt_OO2;
-        MethodType result = MethodType.genericMethodType(objectArgCount);
-        assertSame(expResult, result);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_Method() {
-        System.out.println("make (via MemberName.getMethodType)");
-        MethodType expResult = MethodType.methodType(int.class, String.class);
-        MemberName name = new MemberName(compareTo);
-        MethodType result = name.getMethodType();
-        assertSame(expResult, result);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_MethodType() {
-        System.out.println("make (from rtype, MethodType)");
-        MethodType expResult = mt_iO2;
-        MethodType result = MethodType.methodType(int.class, mt_IO2);
-        assertSame(expResult, result);
-    }
-
-    /**
-     * Test of make method, of class MethodType.
-     */
-    @Test
-    public void testMake_String_ClassLoader() {
-        System.out.println("make (from bytecode signature)");
-        ClassLoader loader = null;
-        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        String obj = "Ljava/lang/Object;";
-        assertEquals(obj, concat(Object.class));
-        String[] expResults = {
-            "(ILjava/lang/String;)V",
-            concat("(", obj, 2, ")", Object.class),
-            "()V", "()"+obj,
-            concat("(", String.class, Integer.class, ")I"),
-            concat("(", String.class, "I)", Integer.class),
-            concat("(", String.class, Integer.class, ")", Integer.class),
-            concat("(", String.class, "I)I")
-        };
-        for (int i = 0; i < instances.length; i++) {
-            MethodType instance = instances[i];
-            String result = instance.toMethodDescriptorString();
-            assertEquals("#"+i, expResults[i], result);
-            MethodType parsed = MethodType.fromMethodDescriptorString(result, loader);
-            assertSame("--#"+i, instance, parsed);
-        }
-    }
-    private static String concat(Object... parts) {
-        StringBuilder sb = new StringBuilder();
-        Object prevPart = "";
-        for (Object part : parts) {
-            if (part instanceof Class) {
-                part = "L"+((Class)part).getName()+";";
-            }
-            if (part instanceof Integer) {
-                for (int n = (Integer) part; n > 1; n--)
-                    sb.append(prevPart);
-                part = "";
-            }
-            sb.append(part);
-            prevPart = part;
-        }
-        return sb.toString().replace('.', '/');
-    }
-
-    @Test
-    public void testHasPrimitives() {
-        System.out.println("hasPrimitives");
-        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        boolean[] expResults =   {true,   false,  true,  false, true,   true,   false,  true};
-        for (int i = 0; i < instances.length; i++) {
-            boolean result = instances[i].hasPrimitives();
-            assertEquals("#"+i, expResults[i], result);
-        }
-    }
-
-    @Test
-    public void testHasWrappers() {
-        System.out.println("hasWrappers");
-        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        boolean[] expResults =   {false,  false,  false, false, true,   true,   true,   false};
-        for (int i = 0; i < instances.length; i++) {
-            System.out.println("  hasWrappers "+instances[i]);
-            boolean result = instances[i].hasWrappers();
-            assertEquals("#"+i, expResults[i], result);
-        }
-    }
-
-    @Test
-    public void testErase() {
-        System.out.println("erase");
-        MethodType[] instances  = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        MethodType[] expResults = {mt_viO, mt_OO2, mt_vv, mt_Ov, mt_iO2, mt_OOi, mt_OO2, mt_iOi};
-        for (int i = 0; i < instances.length; i++) {
-            MethodType result = instances[i].erase();
-            assertSame("#"+i, expResults[i], result);
-        }
-    }
-
-    @Test
-    public void testGeneric() {
-        System.out.println("generic");
-        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        MethodType[] expResults = {mt_OO2, mt_OO2, mt_Ov, mt_Ov, mt_OO2, mt_OO2, mt_OO2, mt_OO2};
-        for (int i = 0; i < instances.length; i++) {
-            MethodType result = instances[i].generic();
-            assertSame("#"+i, expResults[i], result);
-        }
-    }
-
-    @Test
-    public void testWrap() {
-        System.out.println("wrap");
-        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        MethodType[] expResults = {mt_VIS, mt_OO2, mt_Vv, mt_Ov, mt_ISI, mt_ISI, mt_ISI, mt_ISI};
-        for (int i = 0; i < instances.length; i++) {
-            MethodType result = instances[i].wrap();
-            assertSame("#"+i, expResults[i], result);
-        }
-    }
-
-    @Test
-    public void testUnwrap() {
-        System.out.println("unwrap");
-        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        MethodType[] expResults = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSi, mt_iSi, mt_iSi, mt_iSi};
-        for (int i = 0; i < instances.length; i++) {
-            MethodType result = instances[i].unwrap();
-            assertSame("#"+i, expResults[i], result);
-        }
-    }
-
-    /**
-     * Test of parameterType method, of class MethodType.
-     */
-    @Test
-    public void testParameterType() {
-        System.out.println("parameterType");
-        for (int num = 0; num < ptypes.length; num++) {
-            MethodType instance = mt_viS;
-            Class<?> expResult = ptypes[num];
-            Class<?> result = instance.parameterType(num);
-            assertSame(expResult, result);
-        }
-    }
-
-    /**
-     * Test of parameterCount method, of class MethodType.
-     */
-    @Test
-    public void testParameterCount() {
-        System.out.println("parameterCount");
-        MethodType instance = mt_viS;
-        int expResult = 2;
-        int result = instance.parameterCount();
-        assertEquals(expResult, result);
-    }
-
-    /**
-     * Test of returnType method, of class MethodType.
-     */
-    @Test
-    public void testReturnType() {
-        System.out.println("returnType");
-        MethodType instance = mt_viS;
-        Class<?> expResult = void.class;
-        Class<?> result = instance.returnType();
-        assertSame(expResult, result);
-    }
-
-    /**
-     * Test of parameterList method, of class MethodType.
-     */
-    @Test
-    public void testParameterList() {
-        System.out.println("parameterList");
-        MethodType instance = mt_viS;
-        List<Class<?>> expResult = Arrays.asList(ptypes);
-        List<Class<?>> result = instance.parameterList();
-        assertEquals(expResult, result);
-    }
-
-    /**
-     * Test of parameterArray method, of class MethodType.
-     */
-    @Test
-    public void testParameterArray() {
-        System.out.println("parameterArray");
-        MethodType instance = mt_viS;
-        Class<?>[] expResult = ptypes;
-        Class<?>[] result = instance.parameterArray();
-        assertEquals(Arrays.asList(expResult), Arrays.asList(result));
-    }
-
-    /**
-     * Test of equals method, of class MethodType.
-     */
-    @Test
-    public void testEquals_Object() {
-        System.out.println("equals");
-        Object x = null;
-        MethodType instance = mt_viS;
-        boolean expResult = false;
-        boolean result = instance.equals(x);
-        assertEquals(expResult, result);
-    }
-
-    /**
-     * Test of equals method, of class MethodType.
-     */
-    @Test
-    public void testEquals_MethodType() {
-        System.out.println("equals");
-        MethodType that = mt_viS;
-        MethodType instance = mt_viS;
-        boolean expResult = true;
-        boolean result = instance.equals(that);
-        assertEquals(expResult, result);
-    }
-
-    /**
-     * Test of hashCode method, of class MethodType.
-     */
-    @Test
-    public void testHashCode() {
-        System.out.println("hashCode");
-        MethodType instance = mt_viS;
-        ArrayList<Class<?>> types = new ArrayList<Class<?>>();
-        types.add(instance.returnType());
-        types.addAll(instance.parameterList());
-        int expResult = types.hashCode();
-        int result = instance.hashCode();
-        assertEquals(expResult, result);
-    }
-
-    /**
-     * Test of toString method, of class MethodType.
-     */
-    @Test
-    public void testToString() {
-        System.out.println("toString");
-        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
-        //String expResult = "void[int, class java.lang.String]";
-        String[] expResults = {
-            "(int,String)void",
-            "(Object,Object)Object",
-            "()void",
-            "()Object",
-            "(String,Integer)int",
-            "(String,int)Integer",
-            "(String,Integer)Integer",
-            "(String,int)int"
-        };
-        for (int i = 0; i < instances.length; i++) {
-            MethodType instance = instances[i];
-            String result = instance.toString();
-            System.out.println("#"+i+":"+result);
-            assertEquals("#"+i, expResults[i], result);
-        }
-    }
-
-    private static byte[] writeSerial(Object x) throws java.io.IOException {
-        try (java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
-             java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(bout)
-             ) {
-            out.writeObject(x);
-            out.flush();
-            return bout.toByteArray();
-        }
-    }
-    private static Object readSerial(byte[] wire) throws java.io.IOException, ClassNotFoundException {
-        try (java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(wire);
-             java.io.ObjectInputStream in = new java.io.ObjectInputStream(bin)) {
-            return in.readObject();
-        }
-    }
-    private static void testSerializedEquality(Object x) throws java.io.IOException, ClassNotFoundException {
-        if (x instanceof Object[])
-            x = Arrays.asList((Object[]) x);  // has proper equals method
-        byte[] wire = writeSerial(x);
-        Object y = readSerial(wire);
-        assertEquals(x, y);
-    }
-
-    /** Test (de-)serialization. */
-    @Test
-    public void testSerialization() throws Throwable {
-        System.out.println("serialization");
-        for (MethodType mt : GALLERY) {
-            testSerializedEquality(mt);
-        }
-        testSerializedEquality(GALLERY);
-
-        // Make a list of mixed objects:
-        List<Object> stuff = new ArrayList<>();
-        Collections.addAll(stuff, GALLERY);  // copy #1
-        Object[] triples = Arrays.copyOfRange(GALLERY, 0, GALLERY.length/2);
-        Collections.addAll(stuff, triples);  // copy #3 (partial)
-        for (MethodType mt : GALLERY) {
-            Collections.addAll(stuff, mt.parameterArray());
-        }
-        Collections.shuffle(stuff, new Random(292));
-        Collections.addAll(stuff, GALLERY);  // copy #2
-        testSerializedEquality(stuff);
-    }
-
-    /** Test serialization formats. */
-    @Test
-    public void testPortableSerialFormat() throws Throwable {
-        System.out.println("portable serial format");
-        Object[][] cases = {
-            { mt_vv, new byte[] {  // ()void
-                    (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x13,
-                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x64, (byte)0x79, (byte)0x6e,
-                    (byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
-                    (byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-                    (byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
-                    (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x04, (byte)0x76, (byte)0x6f, (byte)0x69, (byte)0x64,
-                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x75, (byte)0x72, (byte)0x00,
-                    (byte)0x12, (byte)0x5b, (byte)0x4c, (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e,
-                    (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x43, (byte)0x6c, (byte)0x61,
-                    (byte)0x73, (byte)0x73, (byte)0x3b, (byte)0xab, (byte)0x16, (byte)0xd7, (byte)0xae, (byte)0xcb,
-                    (byte)0xcd, (byte)0x5a, (byte)0x99, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
-                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
-                } },
-            { mt_OO, new byte[] {  // (Object)Object
-                    (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x13,
-                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x64, (byte)0x79, (byte)0x6e,
-                    (byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
-                    (byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-                    (byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
-                    (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x10, (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61,
-                    (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x4f, (byte)0x62,
-                    (byte)0x6a, (byte)0x65, (byte)0x63, (byte)0x74, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
-                    (byte)0x70, (byte)0x75, (byte)0x72, (byte)0x00, (byte)0x12, (byte)0x5b, (byte)0x4c, (byte)0x6a,
-                    (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67,
-                    (byte)0x2e, (byte)0x43, (byte)0x6c, (byte)0x61, (byte)0x73, (byte)0x73, (byte)0x3b, (byte)0xab,
-                    (byte)0x16, (byte)0xd7, (byte)0xae, (byte)0xcb, (byte)0xcd, (byte)0x5a, (byte)0x99, (byte)0x02,
-                    (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
-                    (byte)0x71, (byte)0x00, (byte)0x7e, (byte)0x00, (byte)0x03, (byte)0x78,
-                } },
-        };
-        boolean generateData = false;
-        //generateData = true;
-        for (Object[] c : cases) {
-            MethodType mt = (MethodType) c[0];
-            System.out.println("deserialize "+mt);
-            byte[] wire = (byte[]) c[1];
-            if (generateData) {
-                wire = writeSerial(mt);
-                final String INDENT = "                ";
-                System.out.print("{  // "+mt);
-                for (int i = 0; i < wire.length; i++) {
-                    if (i % 8 == 0) { System.out.println(); System.out.print(INDENT+"   "); }
-                    String hex = Integer.toHexString(wire[i] & 0xFF);
-                    if (hex.length() == 1)  hex = "0"+hex;
-                    System.out.print(" (byte)0x"+hex+",");
-                }
-                System.out.println();
-                System.out.println(INDENT+"}");
-                System.out.flush();
-            }
-            Object decode;
-            try {
-                decode = readSerial(wire);
-            } catch (Exception ex) {
-                decode = ex;  // oops!
-            }
-            assertEquals(mt, decode);
-        }
-    }
-}
--- a/jdk/test/java/dyn/indify/Indify.java	Thu Mar 31 19:09:02 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1890 +0,0 @@
-/*
- * Copyright (c) 2010, 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 indify;
-
-import java.util.*;
-import java.io.*;
-import java.lang.reflect.Modifier;
-import java.util.regex.*;
-
-/**
- * Transform one or more class files to incorporate JSR 292 features,
- * such as {@code invokedynamic}.
- * <p>
- * This is a standalone program in a single source file.
- * In this form, it may be useful for test harnesses, small experiments, and javadoc examples.
- * Copies of this file may show up in multiple locations for standalone usage.
- * The primary maintained location of this file is as follows:
- * <a href="http://kenai.com/projects/ninja/sources/indify-repo/content/src/indify/Indify.java">
- * http://kenai.com/projects/ninja/sources/indify-repo/content/src/indify/Indify.java</a>
- * <p>
- * Static private methods named MH_x and MT_x (where x is arbitrary)
- * must be stereotyped generators of MethodHandle and MethodType
- * constants.  All calls to them are transformed to {@code CONSTANT_MethodHandle}
- * and {@code CONSTANT_MethodType} "ldc" instructions.
- * The stereotyped code must create method types by calls to {@code methodType} or
- * {@code fromMethodDescriptorString}.  The "lookup" argument must be created
- * by calls to {@code java.dyn.MethodHandles#lookup MethodHandles.lookup}.
- * The class and string arguments must be constant.
- * The following methods of {@code java.dyn.MethodHandle.Lookup Lookup} are
- * allowed for method handle creation: {@code findStatic}, {@code findVirtual},
- * {@code findConstructor}, {@code findSpecial},
- * {@code findGetter}, {@code findSetter},
- * {@code findStaticGetter}, or {@code findStaticSetter}.
- * The call to one of these methods must be followed immediately
- * by an {@code areturn} instruction.
- * The net result of the call to the MH_x or MT_x method must be
- * the creation of a constant method handle.  Thus, replacing calls
- * to MH_x or MT_x methods by {@code ldc} instructions should leave
- * the meaning of the program unchanged.
- * <p>
- * Static private methods named INDY_x must be stereotyped generators
- * of {@code invokedynamic} call sites.
- * All calls to them must be immediately followed by
- * {@code invokeExact} calls.
- * All such pairs of calls are transformed to {@code invokedynamic}
- * instructions.  Each INDY_x method must begin with a call to a
- * MH_x method, which is taken to be its bootstrap method.
- * The method must be immediately invoked (via {@code invokeGeneric}
- * on constant lookup, name, and type arguments.  An object array of
- * constants may also be appended to the {@code invokeGeneric call}.
- * This call must be cast to {@code CallSite}, and the result must be
- * immediately followed by a call to {@code dynamicInvoker}, with the
- * resulting method handle returned.
- * <p>
- * The net result of all of these actions is equivalent to the JVM's
- * execution of an {@code invokedynamic} instruction in the unlinked state.
- * Running this code once should produce the same results as running
- * the corresponding {@code invokedynamic} instruction.
- * In order to model the caching behavior, the code of an INDY_x
- * method is allowed to begin with getstatic, aaload, and if_acmpne
- * instructions which load a static method handle value and return it
- * if the value is non-null.
- * <p>
- * Example usage:
- * <blockquote><pre>
-$ JAVA_HOME=(some recent OpenJDK 7 build)
-$ ant
-$ $JAVA_HOME/bin/java -cp build/classes indify.Indify --overwrite --dest build/testout build/classes/indify/Example.class
-$ $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp build/classes indify.Example
-MT = (java.lang.Object)java.lang.Object
-MH = adder(int,int)java.lang.Integer
-adder(1,2) = 3
-calling indy:  42
-$ $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp build/testout indify.Example
-(same output as above)
- * </pre></blockquote>
- * <p>
- * Before OpenJDK build b123, the format of {@code CONSTANT_InvokeDynamic} is in transition,
- * and the switch {@code --transitionalJSR292=yes} is recommended.
- * It is turned <em>off</em> by default, but users of earlier builds may need to turn it on.
- * <p>
- * A version of this transformation built on top of <a href="http://asm.ow2.org/">http://asm.ow2.org/</a> would be welcome.
- * @author John Rose
- */
-public class Indify {
-    public static void main(String... av) throws IOException {
-        new Indify().run(av);
-    }
-
-    public File dest;
-    public String[] classpath = {"."};
-    public boolean keepgoing = false;
-    public boolean expandProperties = false;
-    public boolean overwrite = false;
-    public boolean quiet = false;
-    public boolean verbose = false;
-    public boolean transitionalJSR292 = false;  // final version is distributed
-    public boolean all = false;
-    public int verifySpecifierCount = -1;
-
-    public void run(String... av) throws IOException {
-        List<String> avl = new ArrayList<>(Arrays.asList(av));
-        parseOptions(avl);
-        if (avl.isEmpty())
-            throw new IllegalArgumentException("Usage: indify [--dest dir] [option...] file...");
-        if ("--java".equals(avl.get(0))) {
-            avl.remove(0);
-            try {
-                runApplication(avl.toArray(new String[0]));
-            } catch (Exception ex) {
-                if (ex instanceof RuntimeException)  throw (RuntimeException) ex;
-                throw new RuntimeException(ex);
-            }
-            return;
-        }
-        Exception err = null;
-        for (String a : avl) {
-            try {
-                indify(a);
-            } catch (Exception ex) {
-                if (err == null)  err = ex;
-                System.err.println("failure on "+a);
-                if (!keepgoing)  break;
-            }
-        }
-        if (err != null) {
-            if (err instanceof IOException)  throw (IOException) err;
-            throw (RuntimeException) err;
-        }
-    }
-
-    /** Execute the given application under a class loader which indifies all application classes. */
-    public void runApplication(String... av) throws Exception {
-        List<String> avl = new ArrayList<>(Arrays.asList(av));
-        String mainClassName = avl.remove(0);
-        av = avl.toArray(new String[0]);
-        Class<?> mainClass = Class.forName(mainClassName, true, makeClassLoader());
-        java.lang.reflect.Method main = mainClass.getMethod("main", String[].class);
-        try { main.setAccessible(true); } catch (SecurityException ex) { }
-        main.invoke(null, (Object) av);
-    }
-
-    public void parseOptions(List<String> av) throws IOException {
-        for (; !av.isEmpty(); av.remove(0)) {
-            String a = av.get(0);
-            if (a.startsWith("-")) {
-                String a2 = null;
-                int eq = a.indexOf('=');
-                if (eq > 0) {
-                    a2 = maybeExpandProperties(a.substring(eq+1));
-                    a = a.substring(0, eq+1);
-                }
-                switch (a) {
-                case "--java":
-                    return;  // keep this argument
-                case "-d": case "--dest": case "-d=": case "--dest=":
-                    dest = new File(a2 != null ? a2 : maybeExpandProperties(av.remove(1)));
-                    break;
-                case "-cp": case "--classpath":
-                    classpath = maybeExpandProperties(av.remove(1)).split("["+File.pathSeparatorChar+"]");
-                    break;
-                case "-k": case "--keepgoing": case "--keepgoing=":
-                    keepgoing = booleanOption(a2);  // print errors but keep going
-                    break;
-                case "--expand-properties": case "--expand-properties=":
-                    expandProperties = booleanOption(a2);  // expand property references in subsequent arguments
-                    break;
-                case "--verify-specifier-count": case "--verify-specifier-count=":
-                    verifySpecifierCount = Integer.valueOf(a2);
-                    break;
-                case "--overwrite": case "--overwrite=":
-                    overwrite = booleanOption(a2);  // overwrite output files
-                    break;
-                case "--all": case "--all=":
-                    all = booleanOption(a2);  // copy all classes, even if no patterns
-                    break;
-                case "-q": case "--quiet": case "--quiet=":
-                    quiet = booleanOption(a2);  // less output
-                    break;
-                case "-v": case "--verbose": case "--verbose=":
-                    verbose = booleanOption(a2);  // more output
-                    break;
-                case "--transitionalJSR292": case "--transitionalJSR292=":
-                    transitionalJSR292 = booleanOption(a2);  // use older invokedynamic format
-                    break;
-                default:
-                    throw new IllegalArgumentException("unrecognized flag: "+a);
-                }
-                continue;
-            } else {
-                break;
-            }
-        }
-        if (dest == null && !overwrite)
-            throw new RuntimeException("no output specified; need --dest d or --overwrite");
-        if (expandProperties) {
-            for (int i = 0; i < av.size(); i++)
-                av.set(i, maybeExpandProperties(av.get(i)));
-        }
-    }
-
-    private boolean booleanOption(String s) {
-        if (s == null)  return true;
-        switch (s) {
-        case "true":  case "yes": case "on":  case "1": return true;
-        case "false": case "no":  case "off": case "0": return false;
-        }
-        throw new IllegalArgumentException("unrecognized boolean flag="+s);
-    }
-
-    private String maybeExpandProperties(String s) {
-        if (!expandProperties)  return s;
-        Set<String> propsDone = new HashSet<>();
-        while (s.contains("${")) {
-            int lbrk = s.indexOf("${");
-            int rbrk = s.indexOf('}', lbrk);
-            if (rbrk < 0)  break;
-            String prop = s.substring(lbrk+2, rbrk);
-            if (!propsDone.add(prop))  break;
-            String value = System.getProperty(prop);
-            if (verbose)  System.err.println("expanding ${"+prop+"} => "+value);
-            if (value == null)  break;
-            s = s.substring(0, lbrk) + value + s.substring(rbrk+1);
-        }
-        return s;
-    }
-
-    public void indify(String a) throws IOException {
-        File f = new File(a);
-        String fn = f.getName();
-        if (fn.endsWith(".class") && f.isFile())
-            indifyFile(f, dest);
-        else if (fn.endsWith(".jar") && f.isFile())
-            indifyJar(f, dest);
-        else if (f.isDirectory())
-            indifyTree(f, dest);
-        else if (!keepgoing)
-            throw new RuntimeException("unrecognized file: "+a);
-    }
-
-    private void ensureDirectory(File dir) {
-        if (dir.mkdirs() && !quiet)
-            System.err.println("created "+dir);
-    }
-
-    public void indifyFile(File f, File dest) throws IOException {
-        if (verbose)  System.err.println("reading "+f);
-        ClassFile cf = new ClassFile(f);
-        Logic logic = new Logic(cf);
-        boolean changed = logic.transform();
-        logic.reportPatternMethods(quiet, keepgoing);
-        if (changed || all) {
-            File outfile;
-            if (dest != null) {
-                ensureDirectory(dest);
-                outfile = classPathFile(dest, cf.nameString());
-            } else {
-                outfile = f;  // overwrite input file, no matter where it is
-            }
-            cf.writeTo(outfile);
-            if (!quiet)  System.err.println("wrote "+outfile);
-        }
-    }
-
-    File classPathFile(File pathDir, String className) {
-        String qualname = className.replace('.','/')+".class";
-        qualname = qualname.replace('/', File.separatorChar);
-        return new File(pathDir, qualname);
-    }
-
-    public void indifyJar(File f, Object dest) throws IOException {
-        throw new UnsupportedOperationException("Not yet implemented");
-    }
-
-    public void indifyTree(File f, File dest) throws IOException {
-        if (verbose)  System.err.println("reading directory: "+f);
-        for (File f2 : f.listFiles(new FilenameFilter() {
-                public boolean accept(File dir, String name) {
-                    if (name.endsWith(".class"))  return true;
-                    if (name.contains("."))  return false;
-                    // return true if it might be a package name:
-                    return Character.isJavaIdentifierStart(name.charAt(0));
-                }})) {
-            if (f2.getName().endsWith(".class"))
-                indifyFile(f2, dest);
-            else if (f2.isDirectory())
-                indifyTree(f2, dest);
-        }
-    }
-
-    public ClassLoader makeClassLoader() {
-        return new Loader();
-    }
-    private class Loader extends ClassLoader {
-        Loader() {
-            this(Indify.class.getClassLoader());
-        }
-        Loader(ClassLoader parent) {
-            super(parent);
-        }
-        public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-            File f = findClassInPath(name);
-            if (f != null) {
-                try {
-                    Class<?> c = transformAndLoadClass(f);
-                    if (c != null) {
-                        if (resolve)  resolveClass(c);
-                        return c;
-                    }
-                } catch (Exception ex) {
-                    if (ex instanceof IllegalArgumentException)
-                        // pass error from reportPatternMethods
-                        throw (IllegalArgumentException) ex;
-                }
-            }
-            return super.loadClass(name, resolve);
-        }
-        private File findClassInPath(String name) {
-            for (String s : classpath) {
-                File f = classPathFile(new File(s), name);
-                //System.out.println("Checking for "+f);
-                if (f.exists() && f.canRead()) {
-                    return f;
-                }
-            }
-            return null;
-        }
-        protected Class<?> findClass(String name) throws ClassNotFoundException {
-            try {
-                return transformAndLoadClass(findClassInPath(name));
-            } catch (IOException ex) {
-                throw new ClassNotFoundException("IO error", ex);
-            }
-        }
-        private Class<?> transformAndLoadClass(File f) throws ClassNotFoundException, IOException {
-            if (verbose)  System.err.println("Loading class from "+f);
-            ClassFile cf = new ClassFile(f);
-            Logic logic = new Logic(cf);
-            boolean changed = logic.transform();
-            if (verbose && !changed)  System.err.println("(no change)");
-            logic.reportPatternMethods(!verbose, keepgoing);
-            byte[] bytes = cf.toByteArray();
-            return defineClass(null, bytes, 0, bytes.length);
-        }
-    }
-
-    private class Logic {
-        // Indify logic, per se.
-        ClassFile cf;
-        final char[] poolMarks;
-        final Map<Method,Constant> constants = new HashMap<>();
-        final Map<Method,String> indySignatures = new HashMap<>();
-        Logic(ClassFile cf) {
-            this.cf = cf;
-            poolMarks = new char[cf.pool.size()];
-        }
-        boolean transform() {
-            if (!initializeMarks())  return false;
-            if (!findPatternMethods())  return false;
-            Pool pool = cf.pool;
-            //for (Constant c : cp)  System.out.println("  # "+c);
-            for (Method m : cf.methods) {
-                if (constants.containsKey(m))  continue;  // don't bother
-                // Transform references.
-                int blab = 0;
-                for (Instruction i = m.instructions(); i != null; i = i.next()) {
-                    if (i.bc != opc_invokestatic)  continue;
-                    int methi = i.u2At(1);
-                    if (poolMarks[methi] == 0)  continue;
-                    Short[] ref = pool.getMemberRef((short)methi);
-                    Method conm = findMember(cf.methods, ref[1], ref[2]);
-                    if (conm == null)  continue;
-                    Constant con = constants.get(conm);
-                    if (con == null)  continue;
-                    if (blab++ == 0 && !quiet)
-                        System.err.println("patching "+cf.nameString()+"."+m);
-                    //if (blab == 1) { for (Instruction j = m.instructions(); j != null; j = j.next()) System.out.println("  |"+j); }
-                    if (con.tag == CONSTANT_InvokeDynamic ||
-                        con.tag == CONSTANT_InvokeDynamic_17) {
-                        // need to patch the following instruction too,
-                        // but there are usually intervening argument pushes too
-                        Instruction i2 = findPop(i);
-                        Short[] ref2 = null;
-                        short ref2i = 0;
-                        if (i2 != null && i2.bc == opc_invokevirtual &&
-                                poolMarks[(char)(ref2i = (short) i2.u2At(1))] == 'D')
-                            ref2 = pool.getMemberRef(ref2i);
-                        if (ref2 == null || !"invokeExact".equals(pool.getString(ref2[1]))) {
-                            System.err.println(m+": failed to create invokedynamic at "+i.pc);
-                            continue;
-                        }
-                        String invType = pool.getString(ref2[2]);
-                        String bsmType = indySignatures.get(conm);
-                        if (!invType.equals(bsmType)) {
-                            System.err.println(m+": warning: "+conm+" call type and local invoke type differ: "
-                                    +bsmType+", "+invType);
-                        }
-                        assert(i.len == 3 || i2.len == 3);
-                        if (!quiet)  System.err.println(i+" "+conm+";...; "+i2+" => invokedynamic "+con);
-                        int start = i.pc + 3, end = i2.pc;
-                        System.arraycopy(i.codeBase, start, i.codeBase, i.pc, end-start);
-                        i.forceNext(0);  // force revisit of new instruction
-                        i2.u1AtPut(-3, opc_invokedynamic);
-                        i2.u2AtPut(-2, con.index);
-                        i2.u2AtPut(0, (short)0);
-                        i2.u1AtPut(2, opc_nop);
-                        //System.out.println(new Instruction(i.codeBase, i2.pc-3));
-                    } else {
-                        if (!quiet)  System.err.println(i+" "+conm+" => ldc "+con);
-                        assert(i.len == 3);
-                        i.u1AtPut(0, opc_ldc_w);
-                        i.u2AtPut(1, con.index);
-                    }
-                }
-                //if (blab >= 1) { for (Instruction j = m.instructions(); j != null; j = j.next()) System.out.println("    |"+j); }
-            }
-            cf.methods.removeAll(constants.keySet());
-            return true;
-        }
-
-        // Scan forward from the instruction to find where the stack p
-        // below the current sp at the instruction.
-        Instruction findPop(Instruction i) {
-            //System.out.println("findPop from "+i);
-            Pool pool = cf.pool;
-            JVMState jvm = new JVMState();
-        decode:
-            for (i = i.clone().next(); i != null; i = i.next()) {
-                String pops = INSTRUCTION_POPS[i.bc];
-                //System.out.println("  "+i+" "+jvm.stack+" : "+pops.replace("$", " => "));
-                if (pops == null)  break;
-                if (jvm.stackMotion(i.bc))  continue decode;
-                if (pops.indexOf('Q') >= 0) {
-                    Short[] ref = pool.getMemberRef((short) i.u2At(1));
-                    String type = simplifyType(pool.getString(CONSTANT_Utf8, ref[2]));
-                    switch (i.bc) {
-                    case opc_getstatic:
-                    case opc_getfield:
-                    case opc_putstatic:
-                    case opc_putfield:
-                        pops = pops.replace("Q", type);
-                        break;
-                    default:
-                        if (!type.startsWith("("))
-                            throw new InternalError(i.toString());
-                        pops = pops.replace("Q$Q", type.substring(1).replace(")","$"));
-                        break;
-                    }
-                    //System.out.println("special type: "+type+" => "+pops);
-                }
-                int npops = pops.indexOf('$');
-                if (npops < 0)  throw new InternalError();
-                if (npops > jvm.sp())  return i;
-                List<Object> args = jvm.args(npops);
-                int k = 0;
-                for (Object x : args) {
-                    char have = (Character) x;
-                    char want = pops.charAt(k++);
-                    if (have == 'X' || want == 'X')  continue;
-                    if (have != want)  break decode;
-                }
-                if (pops.charAt(k++) != '$')  break decode;
-                args.clear();
-                while (k < pops.length())
-                    args.add(pops.charAt(k++));
-            }
-            System.err.println("*** bailout on jvm: "+jvm.stack+" "+i);
-            return null;
-        }
-
-        boolean findPatternMethods() {
-            boolean found = false;
-            for (char mark : "THI".toCharArray()) {
-                for (Method m : cf.methods) {
-                    if (!Modifier.isPrivate(m.access))  continue;
-                    if (!Modifier.isStatic(m.access))  continue;
-                    if (nameAndTypeMark(m.name, m.type) == mark) {
-                        Constant con = scanPattern(m, mark);
-                        if (con == null)  continue;
-                        constants.put(m, con);
-                        found = true;
-                    }
-                }
-            }
-            return found;
-        }
-
-        void reportPatternMethods(boolean quietly, boolean allowMatchFailure) {
-            if (!quietly && !constants.keySet().isEmpty())
-                System.err.println("pattern methods removed: "+constants.keySet());
-            for (Method m : cf.methods) {
-                if (nameMark(cf.pool.getString(m.name)) != 0 &&
-                    constants.get(m) == null) {
-                    String failure = "method has special name but fails to match pattern: "+m;
-                    if (!allowMatchFailure)
-                        throw new IllegalArgumentException(failure);
-                    else if (!quietly)
-                        System.err.println("warning: "+failure);
-                }
-            }
-            if (verifySpecifierCount >= 0) {
-                List<Object[]> specs = bootstrapMethodSpecifiers(false);
-                int specsLen = (specs == null ? 0 : specs.size());
-                if (specsLen != verifySpecifierCount) {
-                    throw new IllegalArgumentException("BootstrapMethods length is "+specsLen+" but should be "+verifySpecifierCount);
-                }
-            }
-            if (!quiet)  System.err.flush();
-        }
-
-        // mark constant pool entries according to participation in patterns
-        boolean initializeMarks() {
-            boolean changed = false;
-            for (;;) {
-                boolean changed1 = false;
-                int cpindex = -1;
-                for (Constant e : cf.pool) {
-                    ++cpindex;
-                    if (e == null)  continue;
-                    char mark = poolMarks[cpindex];
-                    if (mark != 0)  continue;
-                    switch (e.tag) {
-                    case CONSTANT_Utf8:
-                        mark = nameMark(e.itemString()); break;
-                    case CONSTANT_NameAndType:
-                        mark = nameAndTypeMark(e.itemIndexes()); break;
-                    case CONSTANT_Class: {
-                        int n1 = e.itemIndex();
-                        char nmark = poolMarks[(char)n1];
-                        if ("DJ".indexOf(nmark) >= 0)
-                            mark = nmark;
-                        break;
-                    }
-                    case CONSTANT_Field:
-                    case CONSTANT_Method: {
-                        Short[] n12 = e.itemIndexes();
-                        short cl = n12[0];
-                        short nt = n12[1];
-                        char cmark = poolMarks[(char)cl];
-                        if (cmark != 0) {
-                            mark = cmark;  // it is a java.dyn.* or java.lang.* method
-                            break;
-                        }
-                        String cls = cf.pool.getString(CONSTANT_Class, cl);
-                        if (cls.equals(cf.nameString())) {
-                            switch (poolMarks[(char)nt]) {
-                            // it is a private MH/MT/INDY method
-                            case 'T': case 'H': case 'I':
-                                mark = poolMarks[(char)nt];
-                                break;
-                            }
-                        }
-                        break;
-                    }
-                    default:  break;
-                    }
-                    if (mark != 0) {
-                        poolMarks[cpindex] = mark;
-                        changed1 = true;
-                    }
-                }
-                if (!changed1)
-                    break;
-                changed = true;
-            }
-            return changed;
-        }
-        char nameMark(String s) {
-            if (s.startsWith("MT_"))                return 'T';
-            else if (s.startsWith("MH_"))           return 'H';
-            else if (s.startsWith("INDY_"))         return 'I';
-            else if (s.startsWith("java/dyn/"))     return 'D';
-            else if (s.startsWith("java/lang/"))    return 'J';
-            return 0;
-        }
-        char nameAndTypeMark(Short[] n12) {
-            return nameAndTypeMark(n12[0], n12[1]);
-        }
-        char nameAndTypeMark(short n1, short n2) {
-            char mark = poolMarks[(char)n1];
-            if (mark == 0)  return 0;
-            String descr = cf.pool.getString(CONSTANT_Utf8, n2);
-            String requiredType;
-            switch (poolMarks[(char)n1]) {
-            case 'H': requiredType = "()Ljava/dyn/MethodHandle;";  break;
-            case 'T': requiredType = "()Ljava/dyn/MethodType;";    break;
-            case 'I': requiredType = "()Ljava/dyn/MethodHandle;";  break;
-            default:  return 0;
-            }
-            if (descr.equals(requiredType))  return mark;
-            return 0;
-        }
-
-        private class JVMState {
-            final List<Object> stack = new ArrayList<>();
-            int sp() { return stack.size(); }
-            void push(Object x) { stack.add(x); }
-            void push2(Object x) { stack.add(EMPTY_SLOT); stack.add(x); }
-            void pushAt(int pos, Object x) { stack.add(stack.size()+pos, x); }
-            Object pop() { return stack.remove(sp()-1); }
-            Object top() { return stack.get(sp()-1); }
-            List<Object> args(boolean hasRecv, String type) {
-                return args(argsize(type) + (hasRecv ? 1 : 0));
-            }
-            List<Object> args(int argsize) {
-                return stack.subList(sp()-argsize, sp());
-            }
-            boolean stackMotion(int bc) {
-                switch (bc) {
-                case opc_pop:    pop();             break;
-                case opc_pop2:   pop(); pop();      break;
-                case opc_swap:   pushAt(-1, pop()); break;
-                case opc_dup:    push(top());       break;
-                case opc_dup_x1: pushAt(-2, top()); break;
-                case opc_dup_x2: pushAt(-3, top()); break;
-                // ? also: dup2{,_x1,_x2}
-                default:  return false;
-                }
-                return true;
-            }
-        }
-        private final String EMPTY_SLOT = "_";
-        private void removeEmptyJVMSlots(List<Object> args) {
-            for (;;) {
-                int i = args.indexOf(EMPTY_SLOT);
-                if (i >= 0 && i+1 < args.size()
-                    && (isConstant(args.get(i+1), CONSTANT_Long) ||
-                        isConstant(args.get(i+1), CONSTANT_Double)))
-                    args.remove(i);
-                else  break;
-            }
-        }
-
-        private Constant scanPattern(Method m, char patternMark) {
-            if (verbose)  System.err.println("scan "+m+" for pattern="+patternMark);
-            int wantTag;
-            switch (patternMark) {
-            case 'T': wantTag = CONSTANT_MethodType; break;
-            case 'H': wantTag = CONSTANT_MethodHandle; break;
-            case 'I': wantTag = CONSTANT_InvokeDynamic; break;
-            default: throw new InternalError();
-            }
-            Instruction i = m.instructions();
-            JVMState jvm = new JVMState();
-            Pool pool = cf.pool;
-            int branchCount = 0;
-            Object arg;
-            List<Object> args;
-            List<Object> bsmArgs = null;  // args to invokeGeneric
-        decode:
-            for (; i != null; i = i.next()) {
-                //System.out.println(jvm.stack+" "+i);
-                int bc = i.bc;
-                switch (bc) {
-                case opc_ldc:           jvm.push(pool.get(i.u1At(1)));   break;
-                case opc_ldc_w:         jvm.push(pool.get(i.u2At(1)));   break;
-                case opc_ldc2_w:        jvm.push2(pool.get(i.u2At(1)));  break;
-                case opc_aconst_null:   jvm.push(null);                  break;
-                case opc_bipush:        jvm.push((int)(byte) i.u1At(1)); break;
-                case opc_sipush:        jvm.push((int)(short)i.u2At(1)); break;
-
-                // these support creation of a restarg array
-                case opc_anewarray:
-                    arg = jvm.pop();
-                    if (!(arg instanceof Integer))  break decode;
-                    arg = Arrays.asList(new Object[(Integer)arg]);
-                    jvm.push(arg);
-                    break;
-                case opc_dup:
-                    jvm.push(jvm.top()); break;
-                case opc_aastore:
-                    args = jvm.args(3);  // array, index, value
-                    if (args.get(0) instanceof List &&
-                        args.get(1) instanceof Integer) {
-                        ((List<Object>)args.get(0)).set( (Integer)args.get(1), args.get(2) );
-                    }
-                    args.clear();
-                    break;
-
-                case opc_new:
-                {
-                    String type = pool.getString(CONSTANT_Class, (short)i.u2At(1));
-                    //System.out.println("new "+type);
-                    switch (type) {
-                    case "java/lang/StringBuilder":
-                        jvm.push("StringBuilder");
-                        continue decode;  // go to next instruction
-                    }
-                    break decode;  // bail out
-                }
-
-                case opc_getstatic:
-                {
-                    // int.class compiles to getstatic Integer.TYPE
-                    int fieldi = i.u2At(1);
-                    char mark = poolMarks[fieldi];
-                    //System.err.println("getstatic "+fieldi+Arrays.asList(pool.getStrings(pool.getMemberRef((short)fieldi)))+mark);
-                    if (mark == 'J') {
-                        Short[] ref = pool.getMemberRef((short) fieldi);
-                        String name = pool.getString(CONSTANT_Utf8, ref[1]);
-                        if ("TYPE".equals(name)) {
-                            String wrapperName = pool.getString(CONSTANT_Class, ref[0]).replace('/', '.');
-                            // a primitive type descriptor
-                            Class<?> primClass;
-                            try {
-                                primClass = (Class<?>) Class.forName(wrapperName).getField(name).get(null);
-                            } catch (Exception ex) {
-                                throw new InternalError("cannot load "+wrapperName+"."+name);
-                            }
-                            jvm.push(primClass);
-                            break;
-                        }
-                    }
-                    // unknown field; keep going...
-                    jvm.push(UNKNOWN_CON);
-                    break;
-                }
-                case opc_putstatic:
-                {
-                    if (patternMark != 'I')  break decode;
-                    jvm.pop();
-                    // unknown field; keep going...
-                    break;
-                }
-
-                case opc_invokestatic:
-                case opc_invokevirtual:
-                case opc_invokespecial:
-                {
-                    boolean hasRecv = (bc != opc_invokestatic);
-                    int methi = i.u2At(1);
-                    char mark = poolMarks[methi];
-                    Short[] ref = pool.getMemberRef((short)methi);
-                    String type = pool.getString(CONSTANT_Utf8, ref[2]);
-                    //System.out.println("invoke "+pool.getString(CONSTANT_Utf8, ref[1])+" "+Arrays.asList(ref)+" : "+type);
-                    args = jvm.args(hasRecv, type);
-                    String intrinsic = null;
-                    Constant con;
-                    if (mark == 'D' || mark == 'J') {
-                        intrinsic = pool.getString(CONSTANT_Utf8, ref[1]);
-                        if (mark == 'J') {
-                            String cls = pool.getString(CONSTANT_Class, ref[0]);
-                            cls = cls.substring(1+cls.lastIndexOf('/'));
-                            intrinsic = cls+"."+intrinsic;
-                        }
-                        //System.out.println("recognized intrinsic "+intrinsic);
-                        byte refKind = -1;
-                        switch (intrinsic) {
-                        case "findGetter":          refKind = REF_getField;         break;
-                        case "findStaticGetter":    refKind = REF_getStatic;        break;
-                        case "findSetter":          refKind = REF_putField;         break;
-                        case "findStaticSetter":    refKind = REF_putStatic;        break;
-                        case "findVirtual":         refKind = REF_invokeVirtual;    break;
-                        case "findStatic":          refKind = REF_invokeStatic;     break;
-                        case "findSpecial":         refKind = REF_invokeSpecial;    break;
-                        case "findConstructor":     refKind = REF_newInvokeSpecial; break;
-                        }
-                        if (refKind >= 0 && (con = parseMemberLookup(refKind, args)) != null) {
-                            args.clear(); args.add(con);
-                            continue;
-                        }
-                    }
-                    Method ownMethod = null;
-                    if (mark == 'T' || mark == 'H' || mark == 'I') {
-                        ownMethod = findMember(cf.methods, ref[1], ref[2]);
-                    }
-                    //if (intrinsic != null)  System.out.println("intrinsic = "+intrinsic);
-                    switch (intrinsic == null ? "" : intrinsic) {
-                    case "fromMethodDescriptorString":
-                        con = makeMethodTypeCon(args.get(0));
-                        args.clear(); args.add(con);
-                        continue;
-                    case "methodType": {
-                        flattenVarargs(args);  // there are several overloadings, some with varargs
-                        StringBuilder buf = new StringBuilder();
-                        String rtype = null;
-                        for (Object typeArg : args) {
-                            if (typeArg instanceof Class) {
-                                Class<?> argClass = (Class<?>) typeArg;
-                                if (argClass.isPrimitive()) {
-                                    char tchar;
-                                    switch (argClass.getName()) {
-                                    case "void":    tchar = 'V'; break;
-                                    case "boolean": tchar = 'Z'; break;
-                                    case "byte":    tchar = 'B'; break;
-                                    case "char":    tchar = 'C'; break;
-                                    case "short":   tchar = 'S'; break;
-                                    case "int":     tchar = 'I'; break;
-                                    case "long":    tchar = 'J'; break;
-                                    case "float":   tchar = 'F'; break;
-                                    case "double":  tchar = 'D'; break;
-                                    default:  throw new InternalError(argClass.toString());
-                                    }
-                                    buf.append(tchar);
-                                } else {
-                                    // should not happen, but...
-                                    buf.append('L').append(argClass.getName().replace('.','/')).append(';');
-                                }
-                            } else if (typeArg instanceof Constant) {
-                                Constant argCon = (Constant) typeArg;
-                                if (argCon.tag == CONSTANT_Class) {
-                                    String cn = pool.get(argCon.itemIndex()).itemString();
-                                    if (cn.endsWith(";"))
-                                        buf.append(cn);
-                                    else
-                                        buf.append('L').append(cn).append(';');
-                                } else {
-                                    break decode;
-                                }
-                            } else {
-                                break decode;
-                            }
-                            if (rtype == null) {
-                                // first arg is treated differently
-                                rtype = buf.toString();
-                                buf.setLength(0);
-                                buf.append('(');
-                            }
-                        }
-                        buf.append(')').append(rtype);
-                        con = con = makeMethodTypeCon(buf.toString());
-                        args.clear(); args.add(con);
-                        continue;
-                    }
-                    case "lookup":
-                    case "dynamicInvoker":
-                        args.clear(); args.add(intrinsic);
-                        continue;
-                    case "lookupClass":
-                        if (args.equals(Arrays.asList("lookup"))) {
-                            // fold lookup().lookupClass() to the enclosing class
-                            args.clear(); args.add(pool.get(cf.thisc));
-                            continue;
-                        }
-                        break;
-                    case "invokeGeneric":
-                    case "invokeWithArguments":
-                        if (patternMark != 'I')  break decode;
-                        if ("invokeWithArguments".equals(intrinsic))
-                            flattenVarargs(args);
-                        bsmArgs = new ArrayList(args);
-                        args.clear(); args.add("invokeGeneric");
-                        continue;
-                    case "Integer.valueOf":
-                    case "Float.valueOf":
-                    case "Long.valueOf":
-                    case "Double.valueOf":
-                        removeEmptyJVMSlots(args);
-                        if (args.size() == 1) {
-                            arg = args.remove(0);
-                            assert(3456 == (CONSTANT_Integer*1000 + CONSTANT_Float*100 + CONSTANT_Long*10 + CONSTANT_Double));
-                            if (isConstant(arg, CONSTANT_Integer + "IFLD".indexOf(intrinsic.charAt(0)))
-                                || arg instanceof Number) {
-                                args.add(arg); continue;
-                            }
-                        }
-                        break decode;
-                    case "StringBuilder.append":
-                        // allow calls like ("value = "+x)
-                        removeEmptyJVMSlots(args);
-                        args.subList(1, args.size()).clear();
-                        continue;
-                    case "StringBuilder.toString":
-                        args.clear();
-                        args.add(intrinsic);
-                        continue;
-                    }
-                    if (!hasRecv && ownMethod != null && patternMark != 0) {
-                        con = constants.get(ownMethod);
-                        if (con == null)  break decode;
-                        args.clear(); args.add(con);
-                        continue;
-                    } else if (type.endsWith(")V")) {
-                        // allow calls like println("reached the pattern method")
-                        args.clear();
-                        continue;
-                    }
-                    break decode;  // bail out for most calls
-                }
-                case opc_areturn:
-                {
-                    ++branchCount;
-                    if (bsmArgs != null) {
-                        // parse bsmArgs as (MH, lookup, String, MT, [extra])
-                        Constant indyCon = makeInvokeDynamicCon(bsmArgs);
-                        if (indyCon != null) {
-                            Constant typeCon = (Constant) bsmArgs.get(3);
-                            indySignatures.put(m, pool.getString(typeCon.itemIndex()));
-                            return indyCon;
-                        }
-                        System.err.println(m+": inscrutable bsm arguments: "+bsmArgs);
-                        break decode;  // bail out
-                    }
-                    arg = jvm.pop();
-                    if (branchCount == 2 && UNKNOWN_CON.equals(arg))
-                        break;  // merge to next path
-                    if (isConstant(arg, wantTag))
-                        return (Constant) arg;
-                    break decode;  // bail out
-                }
-                default:
-                    if (jvm.stackMotion(i.bc))  break;
-                    if (bc >= opc_nconst_MIN && bc <= opc_nconst_MAX)
-                        { jvm.push(INSTRUCTION_CONSTANTS[bc - opc_nconst_MIN]); break; }
-                    if (patternMark == 'I') {
-                        // these support caching paths in INDY_x methods
-                        if (bc == opc_aload || bc >= opc_aload_0 && bc <= opc_aload_MAX)
-                            { jvm.push(UNKNOWN_CON); break; }
-                        if (bc == opc_astore || bc >= opc_astore_0 && bc <= opc_astore_MAX)
-                            { jvm.pop(); break; }
-                        switch (bc) {
-                        case opc_getfield:
-                        case opc_aaload:
-                            jvm.push(UNKNOWN_CON); break;
-                        case opc_ifnull:
-                        case opc_ifnonnull:
-                            // ignore branch target
-                            if (++branchCount != 1)  break decode;
-                            jvm.pop();
-                            break;
-                        case opc_checkcast:
-                            arg = jvm.top();
-                            if ("invokeWithArguments".equals(arg) ||
-                                "invokeGeneric".equals(arg))
-                                break;  // assume it is a helpful cast
-                            break decode;
-                        default:
-                            break decode;  // bail out
-                        }
-                        continue decode; // go to next instruction
-                    }
-                    break decode;  // bail out
-                } //end switch
-            }
-            System.err.println(m+": bailout on "+i+" jvm stack: "+jvm.stack);
-            return null;
-        }
-        private final String UNKNOWN_CON = "<unknown>";
-
-        private void flattenVarargs(List<Object> args) {
-            int size = args.size();
-            if (size > 0 && args.get(size-1) instanceof List)
-                args.addAll((List<Object>) args.remove(size-1));
-        }
-
-        private boolean isConstant(Object x, int tag) {
-            return x instanceof Constant && ((Constant)x).tag == tag;
-        }
-        private Constant makeMethodTypeCon(Object x) {
-            short utfIndex;
-            if (x instanceof String)
-                utfIndex = (short) cf.pool.addConstant(CONSTANT_Utf8, x).index;
-            else if (isConstant(x, CONSTANT_String))
-                utfIndex = ((Constant)x).itemIndex();
-            else  return null;
-            return cf.pool.addConstant(CONSTANT_MethodType, utfIndex);
-        }
-        private Constant parseMemberLookup(byte refKind, List<Object> args) {
-            // E.g.: lookup().findStatic(Foo.class, "name", MethodType)
-            if (args.size() != 4)  return null;
-            int argi = 0;
-            if (!"lookup".equals(args.get(argi++)))  return null;
-            short refindex, cindex, ntindex, nindex, tindex;
-            Object con;
-            if (!isConstant(con = args.get(argi++), CONSTANT_Class))  return null;
-            cindex = (short)((Constant)con).index;
-            if (!isConstant(con = args.get(argi++), CONSTANT_String))  return null;
-            nindex = ((Constant)con).itemIndex();
-            if (isConstant(con = args.get(argi++), CONSTANT_MethodType) ||
-                isConstant(con, CONSTANT_Class)) {
-                tindex = ((Constant)con).itemIndex();
-            } else return null;
-            ntindex = (short) cf.pool.addConstant(CONSTANT_NameAndType,
-                    new Short[]{ nindex, tindex }).index;
-            byte reftag = CONSTANT_Method;
-            if (refKind <= REF_putStatic)
-                reftag = CONSTANT_Field;
-            else if (refKind == REF_invokeInterface)
-                reftag = CONSTANT_InterfaceMethod;
-            Constant ref = cf.pool.addConstant(reftag, new Short[]{ cindex, ntindex });
-            return cf.pool.addConstant(CONSTANT_MethodHandle, new Object[]{ refKind, (short)ref.index });
-        }
-        private Constant makeInvokeDynamicCon(List<Object> args) {
-            // E.g.: MH_bsm.invokeGeneric(lookup(), "name", MethodType, "extraArg")
-            removeEmptyJVMSlots(args);
-            if (args.size() != 4 && args.size() != 5)  return null;
-            int argi = 0;
-            short nindex, tindex, ntindex, bsmindex;
-            Object con;
-            if (!isConstant(con = args.get(argi++), CONSTANT_MethodHandle))  return null;
-            bsmindex = (short) ((Constant)con).index;
-            if (!"lookup".equals(args.get(argi++)))  return null;
-            if (!isConstant(con = args.get(argi++), CONSTANT_String))  return null;
-            nindex = ((Constant)con).itemIndex();
-            if (!isConstant(con = args.get(argi++), CONSTANT_MethodType))  return null;
-            tindex = ((Constant)con).itemIndex();
-            ntindex = (short) cf.pool.addConstant(CONSTANT_NameAndType,
-                                                  new Short[]{ nindex, tindex }).index;
-            if (transitionalJSR292) {
-                if (argi != args.size()) {
-                    System.err.println("BSM specifier has extra arguments but transitionalJSR292=1");
-                    return null;
-                }
-                return cf.pool.addConstant(CONSTANT_InvokeDynamic_17,
-                        new Short[]{ bsmindex, ntindex });
-            }
-            List<Object> extraArgs = Collections.emptyList();
-            if (argi < args.size()) {
-                Object arg = args.get(argi);
-                if (arg instanceof List)
-                    extraArgs = (List<Object>) arg;
-                else
-                    extraArgs = Arrays.asList(arg);
-                removeEmptyJVMSlots(args);
-            }
-            List<Short> extraArgIndexes = new CountedList<>(Short.class);
-            for (Object x : extraArgs) {
-                if (x instanceof Number) {
-                    Object num = null; byte numTag = 0;
-                    if (x instanceof Integer) { num = x; numTag = CONSTANT_Integer; }
-                    if (x instanceof Float)   { num = Float.floatToRawIntBits((Float)x); numTag = CONSTANT_Float; }
-                    if (x instanceof Long)    { num = x; numTag = CONSTANT_Long; }
-                    if (x instanceof Double)  { num = Double.doubleToRawLongBits((Double)x); numTag = CONSTANT_Double; }
-                    if (num != null)  x = cf.pool.addConstant(numTag, x);
-                }
-                if (!(x instanceof Constant))  return null;
-                extraArgIndexes.add((short) ((Constant)x).index);
-            }
-            List<Object[]> specs = bootstrapMethodSpecifiers(true);
-            int specindex = -1;
-            Object[] spec = new Object[]{ bsmindex, extraArgIndexes };
-            for (Object[] spec1 : specs) {
-                if (Arrays.equals(spec1, spec)) {
-                    specindex = specs.indexOf(spec1);
-                    if (verbose)  System.err.println("reusing BSM specifier: "+spec1[0]+spec1[1]);
-                    break;
-                }
-            }
-            if (specindex == -1) {
-                specindex = (short) specs.size();
-                specs.add(spec);
-                if (verbose)  System.err.println("adding BSM specifier: "+spec[0]+spec[1]);
-            }
-            return cf.pool.addConstant(CONSTANT_InvokeDynamic,
-                        new Short[]{ (short)specindex, ntindex });
-        }
-
-        List<Object[]> bootstrapMethodSpecifiers(boolean createIfNotFound) {
-            Attr bsms = cf.findAttr("BootstrapMethods");
-            if (bsms == null) {
-                if (!createIfNotFound)  return null;
-                bsms = new Attr(cf, "BootstrapMethods", new byte[]{0,0});
-                assert(bsms == cf.findAttr("BootstrapMethods"));
-            }
-            if (bsms.item instanceof byte[]) {
-                // unflatten
-                List<Object[]> specs = new CountedList<>(Object[].class);
-                DataInputStream in = new DataInputStream(new ByteArrayInputStream((byte[]) bsms.item));
-                try {
-                    int len = (char) in.readShort();
-                    for (int i = 0; i < len; i++) {
-                        short bsm = in.readShort();
-                        int argc = (char) in.readShort();
-                        List<Short> argv = new CountedList<>(Short.class);
-                        for (int j = 0; j < argc; j++)
-                            argv.add(in.readShort());
-                        specs.add(new Object[]{ bsm, argv });
-                    }
-                } catch (IOException ex) { throw new InternalError(); }
-                bsms.item = specs;
-            }
-            return (List<Object[]>) bsms.item;
-        }
-    }
-
-    private DataInputStream openInput(File f) throws IOException {
-        return new DataInputStream(new BufferedInputStream(new FileInputStream(f)));
-    }
-
-    private DataOutputStream openOutput(File f) throws IOException {
-        if (!overwrite && f.exists())
-            throw new IOException("file already exists: "+f);
-        ensureDirectory(f.getParentFile());
-        return new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
-    }
-
-    static byte[] readRawBytes(DataInputStream in, int size) throws IOException {
-        byte[] bytes = new byte[size];
-        int nr = in.read(bytes);
-        if (nr != size)
-            throw new InternalError("wrong size: "+nr);
-        return bytes;
-    }
-
-    private interface Chunk {
-        void readFrom(DataInputStream in) throws IOException;
-        void writeTo(DataOutputStream out) throws IOException;
-    }
-
-    private static class CountedList<T> extends ArrayList<T> implements Chunk {
-        final Class<? extends T> itemClass;
-        final int rowlen;
-        CountedList(Class<? extends T> itemClass, int rowlen) {
-            this.itemClass = itemClass;
-            this.rowlen = rowlen;
-        }
-        CountedList(Class<? extends T> itemClass) { this(itemClass, -1); }
-        public void readFrom(DataInputStream in) throws IOException {
-            int count = in.readUnsignedShort();
-            while (size() < count) {
-                if (rowlen < 0) {
-                    add(readInput(in, itemClass));
-                } else {
-                    Class<?> elemClass = itemClass.getComponentType();
-                    Object[] row = (Object[]) java.lang.reflect.Array.newInstance(elemClass, rowlen);
-                    for (int i = 0; i < rowlen; i++)
-                        row[i] = readInput(in, elemClass);
-                    add(itemClass.cast(row));
-                }
-            }
-        }
-        public void writeTo(DataOutputStream out) throws IOException {
-            out.writeShort((short)size());
-            for (T item : this) {
-                writeOutput(out, item);
-            }
-        }
-    }
-
-    private static <T> T readInput(DataInputStream in, Class<T> dataClass) throws IOException {
-        Object data;
-        if (dataClass == Integer.class) {
-            data = in.readInt();
-        } else if (dataClass == Short.class) {
-            data = in.readShort();
-        } else if (dataClass == Byte.class) {
-            data = in.readByte();
-        } else if (dataClass == String.class) {
-            data = in.readUTF();
-        } else if (Chunk.class.isAssignableFrom(dataClass)) {
-            T obj;
-            try { obj = dataClass.newInstance(); }
-                catch (Exception ex) { throw new RuntimeException(ex); }
-            ((Chunk)obj).readFrom(in);
-            data = obj;
-        } else {
-            throw new InternalError("bad input datum: "+dataClass);
-        }
-        return dataClass.cast(data);
-    }
-    private static <T> T readInput(byte[] bytes, Class<T> dataClass) {
-        try {
-            return readInput(new DataInputStream(new ByteArrayInputStream(bytes)), dataClass);
-        } catch (IOException ex) {
-            throw new InternalError();
-        }
-    }
-    private static void readInputs(DataInputStream in, Object... data) throws IOException {
-        for (Object x : data)  ((Chunk)x).readFrom(in);
-    }
-
-    private static void writeOutput(DataOutputStream out, Object data) throws IOException {
-        if (data == null) {
-            return;
-        } if (data instanceof Integer) {
-            out.writeInt((Integer)data);
-        } else if (data instanceof Long) {
-            out.writeLong((Long)data);
-        } else if (data instanceof Short) {
-            out.writeShort((Short)data);
-        } else if (data instanceof Byte) {
-            out.writeByte((Byte)data);
-        } else if (data instanceof String) {
-            out.writeUTF((String)data);
-        } else if (data instanceof byte[]) {
-            out.write((byte[])data);
-        } else if (data instanceof Object[]) {
-            for (Object x : (Object[]) data)
-                writeOutput(out, x);
-        } else if (data instanceof Chunk) {
-            Chunk x = (Chunk) data;
-            x.writeTo(out);
-        } else if (data instanceof List) {
-            for (Object x : (List<?>) data)
-                writeOutput(out, x);
-        } else {
-            throw new InternalError("bad output datum: "+data+" : "+data.getClass().getName());
-        }
-    }
-    private static void writeOutputs(DataOutputStream out, Object... data) throws IOException {
-        for (Object x : data)  writeOutput(out, x);
-    }
-
-    public static abstract class Outer {
-        public abstract List<? extends Inner> inners();
-        protected void linkInners() {
-            for (Inner i : inners()) {
-                i.linkOuter(this);
-                if (i instanceof Outer)
-                    ((Outer)i).linkInners();
-            }
-        }
-        public <T extends Outer> T outer(Class<T> c) {
-            for (Outer walk = this;; walk = ((Inner)walk).outer()) {
-                if (c.isInstance(walk))
-                    return c.cast(walk);
-                //if (!(walk instanceof Inner))  return null;
-            }
-        }
-
-        public abstract List<Attr> attrs();
-        public Attr findAttr(String name) {
-            return findAttr(outer(ClassFile.class).pool.stringIndex(name, false));
-        }
-        public Attr findAttr(int name) {
-            if (name == 0)  return null;
-            for (Attr a : attrs()) {
-                if (a.name == name)  return a;
-            }
-            return null;
-        }
-    }
-    public interface Inner { Outer outer(); void linkOuter(Outer o); }
-    public static abstract class InnerOuter extends Outer implements Inner {
-        public Outer outer;
-        public Outer outer() { return outer; }
-        public void linkOuter(Outer o) { assert(outer == null); outer = o; }
-    }
-    public static class Constant<T> implements Chunk {
-        public final byte tag;
-        public final T item;
-        public final int index;
-        public Constant(int index, byte tag, T item) {
-            this.index = index;
-            this.tag = tag;
-            this.item = item;
-        }
-        public Constant checkTag(byte tag) {
-            if (this.tag != tag)  throw new InternalError(this.toString());
-            return this;
-        }
-        public String itemString() { return (String)item; }
-        public Short itemIndex() { return (Short)item; }
-        public Short[] itemIndexes() { return (Short[])item; }
-        public void readFrom(DataInputStream in) throws IOException {
-            throw new InternalError("do not call");
-        }
-        public void writeTo(DataOutputStream out) throws IOException {
-            writeOutputs(out, tag, item);
-        }
-        public boolean equals(Object x) { return (x instanceof Constant && equals((Constant)x)); }
-        public boolean equals(Constant that) {
-            return (this.tag == that.tag && this.itemAsComparable().equals(that.itemAsComparable()));
-        }
-        public int hashCode() { return (tag * 31) + this.itemAsComparable().hashCode(); }
-        public Object itemAsComparable() {
-            switch (tag) {
-            case CONSTANT_Double:   return Double.longBitsToDouble((Long)item);
-            case CONSTANT_Float:    return Float.intBitsToFloat((Integer)item);
-            }
-            return (item instanceof Object[] ? Arrays.asList((Object[])item) : item);
-        }
-        public String toString() {
-            String itstr = String.valueOf(itemAsComparable());
-            return (index + ":" + tagName(tag) + (itstr.startsWith("[")?"":"=") + itstr);
-        }
-        private static String[] TAG_NAMES;
-        public static String tagName(byte tag) {  // used for error messages
-            if (TAG_NAMES == null)
-                TAG_NAMES = ("None Utf8 Unicode Integer Float Long Double Class String"
-                             +" Fieldref Methodref InterfaceMethodref NameAndType #13 #14"
-                             +" MethodHandle MethodType InvokeDynamic#17 InvokeDynamic").split(" ");
-            if ((tag & 0xFF) >= TAG_NAMES.length)  return "#"+(tag & 0xFF);
-            return TAG_NAMES[tag & 0xFF];
-        }
-    }
-
-    public static class Pool extends CountedList<Constant> implements Chunk {
-        private Map<String,Short> strings = new TreeMap<>();
-
-        public Pool() {
-            super(Constant.class);
-        }
-        public void readFrom(DataInputStream in) throws IOException {
-            int count = in.readUnsignedShort();
-            add(null);  // always ignore first item
-            while (size() < count) {
-                readConstant(in);
-            }
-        }
-        public <T> Constant<T> addConstant(byte tag, T item) {
-            Constant<T> con = new Constant<>(size(), tag, item);
-            int idx = indexOf(con);
-            if (idx >= 0)  return get(idx);
-            add(con);
-            if (tag == CONSTANT_Utf8)  strings.put((String)item, (short) con.index);
-            return con;
-        }
-        private void readConstant(DataInputStream in) throws IOException {
-            byte tag = in.readByte();
-            int index = size();
-            Object arg;
-            switch (tag) {
-            case CONSTANT_Utf8:
-                arg = in.readUTF();
-                strings.put((String) arg, (short) size());
-                break;
-            case CONSTANT_Integer:
-            case CONSTANT_Float:
-                arg = in.readInt(); break;
-            case CONSTANT_Long:
-            case CONSTANT_Double:
-                add(new Constant(index, tag, in.readLong()));
-                add(null);
-                return;
-            case CONSTANT_Class:
-            case CONSTANT_String:
-                arg = in.readShort(); break;
-            case CONSTANT_Field:
-            case CONSTANT_Method:
-            case CONSTANT_InterfaceMethod:
-            case CONSTANT_NameAndType:
-            case CONSTANT_InvokeDynamic_17:
-            case CONSTANT_InvokeDynamic:
-                // read an ordered pair
-                arg = new Short[] { in.readShort(), in.readShort() };
-                break;
-            case CONSTANT_MethodHandle:
-                // read an ordered pair; first part is a u1 (not u2)
-                arg = new Object[] { in.readByte(), in.readShort() };
-                break;
-            case CONSTANT_MethodType:
-                arg = in.readShort(); break;
-            default:
-                throw new InternalError("bad CP tag "+tag);
-            }
-            add(new Constant(index, tag, arg));
-        }
-
-        // Access:
-        public Constant get(int index) {
-            // extra 1-bits get into the shorts
-            return super.get((char) index);
-        }
-        String getString(byte tag, short index) {
-            get(index).checkTag(tag);
-            return getString(index);
-        }
-        String getString(short index) {
-            Object v = get(index).item;
-            if (v instanceof Short)
-                v = get((Short)v).checkTag(CONSTANT_Utf8).item;
-            return (String) v;
-        }
-        String[] getStrings(Short[] indexes) {
-            String[] res = new String[indexes.length];
-            for (int i = 0; i < indexes.length; i++)
-                res[i] = getString(indexes[i]);
-            return res;
-        }
-        int stringIndex(String name, boolean createIfNotFound) {
-            Short x = strings.get(name);
-            if (x != null)  return (char)(int) x;
-            if (!createIfNotFound)  return 0;
-            return addConstant(CONSTANT_Utf8, name).index;
-        }
-        Short[] getMemberRef(short index) {
-            Short[] cls_nnt = get(index).itemIndexes();
-            Short[] name_type = get(cls_nnt[1]).itemIndexes();
-            return new Short[]{ cls_nnt[0], name_type[0], name_type[1] };
-        }
-    }
-
-    public class ClassFile extends Outer implements Chunk {
-        ClassFile(File f) throws IOException {
-            DataInputStream in = openInput(f);
-            try {
-                readFrom(in);
-            } finally {
-                if (in != null)  in.close();
-            }
-        }
-
-        public int                magic, version;  // <min:maj>
-        public final Pool         pool       = new Pool();
-        public short              access, thisc, superc;
-        public final List<Short>  interfaces = new CountedList<>(Short.class);
-        public final List<Field>  fields     = new CountedList<>(Field.class);
-        public final List<Method> methods    = new CountedList<>(Method.class);
-        public final List<Attr>   attrs      = new CountedList<>(Attr.class);
-
-        public final void readFrom(DataInputStream in) throws IOException {
-            magic = in.readInt(); version = in.readInt();
-            if (magic != 0xCAFEBABE)  throw new IOException("bad magic number");
-            pool.readFrom(in);
-            Code_index = pool.stringIndex("Code", false);
-            access = in.readShort(); thisc = in.readShort(); superc = in.readShort();
-            readInputs(in, interfaces, fields, methods, attrs);
-            if (in.read() >= 0)  throw new IOException("junk after end of file");
-            linkInners();
-        }
-
-        void writeTo(File f) throws IOException {
-            DataOutputStream out = openOutput(f);
-            try {
-                writeTo(out);
-            } finally {
-                out.close();
-            }
-        }
-
-        public void writeTo(DataOutputStream out) throws IOException {
-            writeOutputs(out, magic, version, pool,
-                         access, thisc, superc, interfaces,
-                         fields, methods, attrs);
-        }
-
-        public byte[] toByteArray() {
-            try {
-                ByteArrayOutputStream buf = new ByteArrayOutputStream();
-                writeTo(new DataOutputStream(buf));
-                return buf.toByteArray();
-            } catch (IOException ex) {
-                throw new InternalError();
-            }
-        }
-
-        public List<Inner> inners() {
-            List<Inner> inns = new ArrayList<>();
-            inns.addAll(fields); inns.addAll(methods); inns.addAll(attrs);
-            return inns;
-        }
-        public List<Attr> attrs() { return attrs; }
-
-        // derived stuff:
-        public String nameString() { return pool.getString(CONSTANT_Class, thisc); }
-        int Code_index;
-    }
-
-    private static <T extends Member> T findMember(List<T> mems, int name, int type) {
-        if (name == 0 || type == 0)  return null;
-        for (T m : mems) {
-            if (m.name == name && m.type == type)  return m;
-        }
-        return null;
-    }
-
-    public static class Member extends InnerOuter implements Chunk {
-        public short access, name, type;
-        public final List<Attr> attrs = new CountedList<>(Attr.class);
-        public void readFrom(DataInputStream in) throws IOException {
-            access = in.readShort(); name = in.readShort(); type = in.readShort();
-            readInputs(in, attrs);
-        }
-        public void writeTo(DataOutputStream out) throws IOException {
-            writeOutputs(out, access, name, type, attrs);
-        }
-        public List<Attr> inners() { return attrs; }
-        public List<Attr> attrs() { return attrs; }
-        public ClassFile outer() { return (ClassFile) outer; }
-        public String nameString() { return outer().pool.getString(CONSTANT_Utf8, name); }
-        public String typeString() { return outer().pool.getString(CONSTANT_Utf8, type); }
-        public String toString() {
-            if (outer == null)  return super.toString();
-            return nameString() + (this instanceof Method ? "" : ":")
-                    + simplifyType(typeString());
-        }
-    }
-    public static class Field extends Member {
-    }
-    public static class Method extends Member {
-        public Code code() {
-            Attr a = findAttr("Code");
-            if (a == null)  return null;
-            return (Code) a.item;
-        }
-        public Instruction instructions() {
-            Code code = code();
-            if (code == null)  return null;
-            return code.instructions();
-        }
-    }
-
-    public static class Attr extends InnerOuter implements Chunk {
-        public short name;
-        public int size = -1;  // no pre-declared size
-        public Object item;
-
-        public Attr() {}
-        public Attr(Outer outer, String name, Object item) {
-            ClassFile cf = outer.outer(ClassFile.class);
-            linkOuter(outer);
-            this.name = (short) cf.pool.stringIndex(name, true);
-            this.item = item;
-            outer.attrs().add(this);
-        }
-        public void readFrom(DataInputStream in) throws IOException {
-            name = in.readShort();
-            size = in.readInt();
-            item = readRawBytes(in, size);
-        }
-        public void writeTo(DataOutputStream out) throws IOException {
-            out.writeShort(name);
-            // write the 4-byte size header and then the contents:
-            byte[] bytes;
-            int trueSize;
-            if (item instanceof byte[]) {
-                bytes = (byte[]) item;
-                out.writeInt(trueSize = bytes.length);
-                out.write(bytes);
-            } else {
-                trueSize = flatten(out);
-                //if (!(item instanceof Code))  System.err.println("wrote complex attr name="+(int)(char)name+" size="+trueSize+" data="+Arrays.toString(flatten()));
-            }
-            if (trueSize != size && size >= 0)
-                System.err.println("warning: attribute size changed "+size+" to "+trueSize);
-        }
-        public void linkOuter(Outer o) {
-            super.linkOuter(o);
-            if (item instanceof byte[] &&
-                outer instanceof Method &&
-                ((Method)outer).outer().Code_index == name) {
-                    item = readInput((byte[])item, Code.class);
-            }
-        }
-        public List<Inner> inners() {
-            if (item instanceof Inner)
-                return Collections.nCopies(1, (Inner)item);
-            return Collections.emptyList();
-        }
-        public List<Attr> attrs() { return null; }  // Code overrides this
-        public byte[] flatten() {
-            ByteArrayOutputStream buf = new ByteArrayOutputStream(Math.max(20, size));
-            flatten(buf);
-            return buf.toByteArray();
-        }
-        public int flatten(DataOutputStream out) throws IOException {
-            ByteArrayOutputStream buf = new ByteArrayOutputStream(Math.max(20, size));
-            int trueSize = flatten(buf);
-            out.writeInt(trueSize);
-            buf.writeTo(out);
-            return trueSize;
-        }
-        private int flatten(ByteArrayOutputStream buf) {
-            try {
-                writeOutput(new DataOutputStream(buf), item);
-                return buf.size();
-            } catch (IOException ex) {
-                throw new InternalError();
-            }
-        }
-        public String nameString() {
-            ClassFile cf = outer(ClassFile.class);
-            if (cf == null)  return "#"+name;
-            return cf.pool.getString(name);
-        }
-        public String toString() {
-            return nameString()+(size < 0 ? "=" : "["+size+"]=")+item;
-        }
-    }
-
-    public static class Code extends InnerOuter implements Chunk {
-        public short stacks, locals;
-        public byte[] bytes;
-        public final List<Short[]> etable = new CountedList<>(Short[].class, 4);
-        public final List<Attr> attrs = new CountedList<>(Attr.class);
-        // etable[N] = (N)*{ startpc, endpc, handlerpc, catchtype }
-        public void readFrom(DataInputStream in) throws IOException {
-            stacks = in.readShort(); locals = in.readShort();
-            bytes = readRawBytes(in, in.readInt());
-            readInputs(in, etable, attrs);
-        }
-        public void writeTo(DataOutputStream out) throws IOException {
-            writeOutputs(out, stacks, locals, bytes.length, bytes, etable, attrs);
-        }
-        public List<Attr> inners() { return attrs; }
-        public List<Attr> attrs() { return attrs; }
-        public Instruction instructions() {
-            return new Instruction(bytes, 0);
-        }
-    }
-
-    // lots of constants
-    private static final byte
-        CONSTANT_Utf8              = 1,
-        CONSTANT_Integer           = 3,
-        CONSTANT_Float             = 4,
-        CONSTANT_Long              = 5,
-        CONSTANT_Double            = 6,
-        CONSTANT_Class             = 7,
-        CONSTANT_String            = 8,
-        CONSTANT_Field             = 9,
-        CONSTANT_Method            = 10,
-        CONSTANT_InterfaceMethod   = 11,
-        CONSTANT_NameAndType       = 12,
-        CONSTANT_MethodHandle      = 15,  // JSR 292
-        CONSTANT_MethodType        = 16,  // JSR 292
-        CONSTANT_InvokeDynamic_17  = 17,  // JSR 292, only occurs in old class files
-        CONSTANT_InvokeDynamic     = 18;  // JSR 292
-    private static final byte
-        REF_getField               = 1,
-        REF_getStatic              = 2,
-        REF_putField               = 3,
-        REF_putStatic              = 4,
-        REF_invokeVirtual          = 5,
-        REF_invokeStatic           = 6,
-        REF_invokeSpecial          = 7,
-        REF_newInvokeSpecial       = 8,
-        REF_invokeInterface        = 9;
-
-    private static final int
-        opc_nop                    = 0,
-        opc_aconst_null            = 1,
-        opc_nconst_MIN             = 2,  // iconst_m1
-        opc_nconst_MAX             = 15, // dconst_1
-        opc_bipush                 = 16,
-        opc_sipush                 = 17,
-        opc_ldc                    = 18,
-        opc_ldc_w                  = 19,
-        opc_ldc2_w                 = 20,
-        opc_aload                  = 25,
-        opc_aload_0                = 42,
-        opc_aload_MAX              = 45,
-        opc_aaload                 = 50,
-        opc_astore                 = 58,
-        opc_astore_0               = 75,
-        opc_astore_MAX             = 78,
-        opc_aastore                = 83,
-        opc_pop                    = 87,
-        opc_pop2                   = 88,
-        opc_dup                    = 89,
-        opc_dup_x1                 = 90,
-        opc_dup_x2                 = 91,
-        opc_dup2                   = 92,
-        opc_dup2_x1                = 93,
-        opc_dup2_x2                = 94,
-        opc_swap                   = 95,
-        opc_tableswitch            = 170,
-        opc_lookupswitch           = 171,
-        opc_areturn                = 176,
-        opc_getstatic              = 178,
-        opc_putstatic              = 179,
-        opc_getfield               = 180,
-        opc_putfield               = 181,
-        opc_invokevirtual          = 182,
-        opc_invokespecial          = 183,
-        opc_invokestatic           = 184,
-        opc_invokeinterface        = 185,
-        opc_invokedynamic          = 186,
-        opc_new                    = 187,
-        opc_anewarray              = 189,
-        opc_checkcast              = 192,
-        opc_ifnull                 = 198,
-        opc_ifnonnull              = 199,
-        opc_wide                   = 196;
-
-    private static final Object[] INSTRUCTION_CONSTANTS = {
-        -1, 0, 1, 2, 3, 4, 5, 0L, 1L, 0.0F, 1.0F, 2.0F, 0.0D, 1.0D
-    };
-
-    private static final String INSTRUCTION_FORMATS =
-        "nop$ aconst_null$L iconst_m1$I iconst_0$I iconst_1$I "+
-        "iconst_2$I iconst_3$I iconst_4$I iconst_5$I lconst_0$J_ "+
-        "lconst_1$J_ fconst_0$F fconst_1$F fconst_2$F dconst_0$D_ "+
-        "dconst_1$D_ bipush=bx$I sipush=bxx$I ldc=bk$X ldc_w=bkk$X "+
-        "ldc2_w=bkk$X_ iload=bl/wbll$I lload=bl/wbll$J_ fload=bl/wbll$F "+
-        "dload=bl/wbll$D_ aload=bl/wbll$L iload_0$I iload_1$I "+
-        "iload_2$I iload_3$I lload_0$J_ lload_1$J_ lload_2$J_ "+
-        "lload_3$J_ fload_0$F fload_1$F fload_2$F fload_3$F dload_0$D_ "+
-        "dload_1$D_ dload_2$D_ dload_3$D_ aload_0$L aload_1$L "+
-        "aload_2$L aload_3$L iaload$LI$I laload$LI$J_ faload$LI$F "+
-        "daload$LI$D_ aaload$LI$L baload$LI$I caload$LI$I saload$LI$I "+
-        "istore=bl/wbll$I$ lstore=bl/wbll$J_$ fstore=bl/wbll$F$ "+
-        "dstore=bl/wbll$D_$ astore=bl/wbll$L$ istore_0$I$ istore_1$I$ "+
-        "istore_2$I$ istore_3$I$ lstore_0$J_$ lstore_1$J_$ "+
-        "lstore_2$J_$ lstore_3$J_$ fstore_0$F$ fstore_1$F$ fstore_2$F$ "+
-        "fstore_3$F$ dstore_0$D_$ dstore_1$D_$ dstore_2$D_$ "+
-        "dstore_3$D_$ astore_0$L$ astore_1$L$ astore_2$L$ astore_3$L$ "+
-        "iastore$LII$ lastore$LIJ_$ fastore$LIF$ dastore$LID_$ "+
-        "aastore$LIL$ bastore$LII$ castore$LII$ sastore$LII$ pop$X$ "+
-        "pop2$XX$ dup$X$XX dup_x1$XX$XXX dup_x2$XXX$XXXX dup2$XX$XXXX "+
-        "dup2_x1$XXX$XXXXX dup2_x2$XXXX$XXXXXX swap$XX$XX "+
-        "iadd$II$I ladd$J_J_$J_ fadd$FF$F dadd$D_D_$D_ isub$II$I "+
-        "lsub$J_J_$J_ fsub$FF$F dsub$D_D_$D_ imul$II$I lmul$J_J_$J_ "+
-        "fmul$FF$F dmul$D_D_$D_ idiv$II$I ldiv$J_J_$J_ fdiv$FF$F "+
-        "ddiv$D_D_$D_ irem$II$I lrem$J_J_$J_ frem$FF$F drem$D_D_$D_ "+
-        "ineg$I$I lneg$J_$J_ fneg$F$F dneg$D_$D_ ishl$II$I lshl$J_I$J_ "+
-        "ishr$II$I lshr$J_I$J_ iushr$II$I lushr$J_I$J_ iand$II$I "+
-        "land$J_J_$J_ ior$II$I lor$J_J_$J_ ixor$II$I lxor$J_J_$J_ "+
-        "iinc=blx/wbllxx$ i2l$I$J_ i2f$I$F i2d$I$D_ l2i$J_$I l2f$J_$F "+
-        "l2d$J_$D_ f2i$F$I f2l$F$J_ f2d$F$D_ d2i$D_$I d2l$D_$J_ "+
-        "d2f$D_$F i2b$I$I i2c$I$I i2s$I$I lcmp fcmpl fcmpg dcmpl dcmpg "+
-        "ifeq=boo ifne=boo iflt=boo ifge=boo ifgt=boo ifle=boo "+
-        "if_icmpeq=boo if_icmpne=boo if_icmplt=boo if_icmpge=boo "+
-        "if_icmpgt=boo if_icmple=boo if_acmpeq=boo if_acmpne=boo "+
-        "goto=boo jsr=boo ret=bl/wbll tableswitch=* lookupswitch=* "+
-        "ireturn lreturn freturn dreturn areturn return "+
-        "getstatic=bkf$Q putstatic=bkf$Q$ getfield=bkf$L$Q "+
-        "putfield=bkf$LQ$ invokevirtual=bkm$LQ$Q "+
-        "invokespecial=bkm$LQ$Q invokestatic=bkm$Q$Q "+
-        "invokeinterface=bkixx$LQ$Q invokedynamic=bkd__$Q$Q new=bkc$L "+
-        "newarray=bx$I$L anewarray=bkc$I$L arraylength$L$I athrow "+
-        "checkcast=bkc$L$L instanceof=bkc$L$I monitorenter$L "+
-        "monitorexit$L wide=* multianewarray=bkcx ifnull=boo "+
-        "ifnonnull=boo goto_w=boooo jsr_w=boooo ";
-    private static final String[] INSTRUCTION_NAMES;
-    private static final String[] INSTRUCTION_POPS;
-    private static final int[] INSTRUCTION_INFO;
-    static {
-        String[] insns = INSTRUCTION_FORMATS.split(" ");
-        assert(insns[opc_lookupswitch].startsWith("lookupswitch"));
-        assert(insns[opc_tableswitch].startsWith("tableswitch"));
-        assert(insns[opc_wide].startsWith("wide"));
-        assert(insns[opc_invokedynamic].startsWith("invokedynamic"));
-        int[] info = new int[256];
-        String[] names = new String[256];
-        String[] pops = new String[256];
-        for (int i = 0; i < insns.length; i++) {
-            String insn = insns[i];
-            int dl = insn.indexOf('$');
-            if (dl > 0) {
-                String p = insn.substring(dl+1);
-                if (p.indexOf('$') < 0)  p = "$" + p;
-                pops[i] = p;
-                insn = insn.substring(0, dl);
-            }
-            int eq = insn.indexOf('=');
-            if (eq < 0) {
-                info[i] = 1;
-                names[i] = insn;
-                continue;
-            }
-            names[i] = insn.substring(0, eq);
-            String fmt = insn.substring(eq+1);
-            if (fmt.equals("*")) {
-                info[i] = 0;
-                continue;
-            }
-            int sl = fmt.indexOf('/');
-            if (sl < 0) {
-                info[i] = (char) fmt.length();
-            } else {
-                String wfmt = fmt.substring(sl+1);
-                fmt = fmt.substring(0, sl);
-                info[i] = (char)( fmt.length() + (wfmt.length() * 16) );
-            }
-        }
-        INSTRUCTION_INFO = info;
-        INSTRUCTION_NAMES = names;
-        INSTRUCTION_POPS = pops;
-    }
-
-    public static class Instruction implements Cloneable {
-        byte[] codeBase;
-        int pc;
-        int bc;
-        int info;
-        int wide;
-        int len;
-        Instruction(byte[] codeBase, int pc) {
-            this.codeBase = codeBase;
-            init(pc);
-        }
-        public Instruction clone() {
-            try {
-                return (Instruction) super.clone();
-            } catch (CloneNotSupportedException ex) {
-                throw new InternalError();
-            }
-        }
-        private Instruction init(int pc) {
-            this.pc = pc;
-            this.bc = codeBase[pc] & 0xFF;
-            this.info = INSTRUCTION_INFO[bc];
-            this.wide = 0;
-            this.len = (info & 0x0F);
-            if (len == 0)
-                computeLength();
-            return this;
-        }
-        Instruction next() {
-            if (len == 0 && bc != 0)  throw new InternalError();
-            int npc = pc + len;
-            if (npc == codeBase.length)
-                return null;
-            return init(npc);
-        }
-        void forceNext(int newLen) {
-            bc = opc_nop;
-            len = newLen;
-        }
-
-        public String toString() {
-            StringBuilder buf = new StringBuilder();
-            buf.append(pc).append(":").append(INSTRUCTION_NAMES[bc]);
-            switch (len) {
-            case 3: buf.append(" ").append(u2At(1)); break;
-            case 5: buf.append(" ").append(u2At(1)).append(" ").append(u2At(3)); break;
-            default:  for (int i = 1; i < len; i++)  buf.append(" ").append(u1At(1));
-            }
-            return buf.toString();
-        }
-
-        // these are the hard parts
-        private void computeLength() {
-            int cases;
-            switch (bc) {
-            case opc_wide:
-                bc = codeBase[pc + 1];
-                info = INSTRUCTION_INFO[bc];
-                len = ((info >> 4) & 0x0F);
-                if (len == 0)  throw new RuntimeException("misplaced wide bytecode: "+bc);
-                return;
-
-            case opc_tableswitch:
-                cases = (u4At(alignedIntOffset(2)) - u4At(alignedIntOffset(1)) + 1);
-                len = alignedIntOffset(3 + cases*1);
-                return;
-
-            case opc_lookupswitch:
-                cases = u4At(alignedIntOffset(1));
-                len = alignedIntOffset(2 + cases*2);
-                return;
-
-            default:
-                throw new RuntimeException("unknown bytecode: "+bc);
-            }
-        }
-        // switch code
-        // clget the Nth int (where 0 is the first after the opcode itself)
-        public int alignedIntOffset(int n) {
-            int pos = pc + 1;
-            pos += ((-pos) & 0x03);  // align it
-            pos += (n * 4);
-            return pos - pc;
-        }
-        public int u1At(int pos) {
-            return (codeBase[pc+pos] & 0xFF);
-        }
-        public int u2At(int pos) {
-            return (u1At(pos+0)<<8) + u1At(pos+1);
-        }
-        public int u4At(int pos) {
-            return (u2At(pos+0)<<16) + u2At(pos+2);
-        }
-        public void u1AtPut(int pos, int x) {
-            codeBase[pc+pos] = (byte)x;
-        }
-        public void u2AtPut(int pos, int x) {
-            codeBase[pc+pos+0] = (byte)(x >> 8);
-            codeBase[pc+pos+1] = (byte)(x >> 0);
-        }
-    }
-
-    static String simplifyType(String type) {
-        String simpleType = OBJ_SIGNATURE.matcher(type).replaceAll("L");
-        assert(simpleType.matches("^\\([A-Z]*\\)[A-Z]$"));
-        // change (DD)D to (D_D_)D_
-        simpleType = WIDE_SIGNATURE.matcher(simpleType).replaceAll("\\0_");
-        return simpleType;
-    }
-    static int argsize(String type) {
-        return simplifyType(type).length()-3;
-    }
-    private static final Pattern OBJ_SIGNATURE = Pattern.compile("\\[*L[^;]*;|\\[+[A-Z]");
-    private static final Pattern WIDE_SIGNATURE = Pattern.compile("[JD]");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/6987555/Test6987555.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6987555
+ * @summary JSR 292 unboxing to a boolean value fails on big-endian SPARC
+ *
+ * @run main/othervm -Xint -ea -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6987555
+ */
+
+import java.lang.invoke.*;
+
+public class Test6987555 {
+    private static final Class   CLASS = Test6987555.class;
+    private static final String  NAME  = "foo";
+    private static final boolean DEBUG = false;
+
+    public static void main(String[] args) throws Throwable {
+        testboolean();
+        testbyte();
+        testchar();
+        testshort();
+        testint();
+    }
+
+    // boolean
+    static void testboolean() throws Throwable {
+        doboolean(false);
+        doboolean(true);
+    }
+    static void doboolean(boolean x) throws Throwable {
+        if (DEBUG)  System.out.println("boolean=" + x);
+        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(boolean.class, boolean.class));
+        MethodHandle mh2 = mh1.asType(MethodType.methodType(boolean.class, Boolean.class));
+        boolean a = (boolean) mh1.invokeExact(x);
+        boolean b = (boolean) mh2.invokeExact(Boolean.valueOf(x));
+        assert a == b : a + " != " + b;
+    }
+
+    // byte
+    static void testbyte() throws Throwable {
+        byte[] a = new byte[] {
+            Byte.MIN_VALUE,
+            Byte.MIN_VALUE + 1,
+            -0x0F,
+            -1,
+            0,
+            1,
+            0x0F,
+            Byte.MAX_VALUE - 1,
+            Byte.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            dobyte(a[i]);
+        }
+    }
+    static void dobyte(byte x) throws Throwable {
+        if (DEBUG)  System.out.println("byte=" + x);
+        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(byte.class, byte.class));
+        MethodHandle mh2 = mh1.asType(MethodType.methodType(byte.class, Byte.class));
+        byte a = (byte) mh1.invokeExact(x);
+        byte b = (byte) mh2.invokeExact(Byte.valueOf(x));
+        assert a == b : a + " != " + b;
+    }
+
+    // char
+    static void testchar() throws Throwable {
+        char[] a = new char[] {
+            Character.MIN_VALUE,
+            Character.MIN_VALUE + 1,
+            0x000F,
+            0x00FF,
+            0x0FFF,
+            Character.MAX_VALUE - 1,
+            Character.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            dochar(a[i]);
+        }
+    }
+    static void dochar(char x) throws Throwable {
+        if (DEBUG)  System.out.println("char=" + x);
+        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(char.class, char.class));
+        MethodHandle mh2 = mh1.asType(MethodType.methodType(char.class, Character.class));
+        char a = (char) mh1.invokeExact(x);
+        char b = (char) mh2.invokeExact(Character.valueOf(x));
+        assert a == b : a + " != " + b;
+    }
+
+    // short
+    static void testshort() throws Throwable {
+        short[] a = new short[] {
+            Short.MIN_VALUE,
+            Short.MIN_VALUE + 1,
+            -0x0FFF,
+            -0x00FF,
+            -0x000F,
+            -1,
+            0,
+            1,
+            0x000F,
+            0x00FF,
+            0x0FFF,
+            Short.MAX_VALUE - 1,
+            Short.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            doshort(a[i]);
+        }
+    }
+    static void doshort(short x) throws Throwable {
+        if (DEBUG)  System.out.println("short=" + x);
+        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(short.class, short.class));
+        MethodHandle mh2 = mh1.asType(MethodType.methodType(short.class, Short.class));
+        short a = (short) mh1.invokeExact(x);
+        short b = (short) mh2.invokeExact(Short.valueOf(x));
+        assert a == b : a + " != " + b;
+    }
+
+    // int
+    static void testint() throws Throwable {
+        int[] a = new int[] {
+            Integer.MIN_VALUE,
+            Integer.MIN_VALUE + 1,
+            -0x00000FFF,
+            -0x000000FF,
+            -0x0000000F,
+            -1,
+            0,
+            1,
+            0x0000000F,
+            0x000000FF,
+            0x00000FFF,
+            Integer.MAX_VALUE - 1,
+            Integer.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            doint(a[i]);
+        }
+    }
+    static void doint(int x) throws Throwable {
+        if (DEBUG)  System.out.println("int=" + x);
+        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(int.class, int.class));
+        MethodHandle mh2 = mh1.asType(MethodType.methodType(int.class, Integer.class));
+        int a = (int) mh1.invokeExact(x);
+        int b = (int) mh2.invokeExact(Integer.valueOf(x));
+        assert a == b : a + " != " + b;
+    }
+
+    public static boolean foo(boolean i) { return i; }
+    public static byte    foo(byte    i) { return i; }
+    public static char    foo(char    i) { return i; }
+    public static short   foo(short   i) { return i; }
+    public static int     foo(int     i) { return i; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/6991596/Test6991596.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6991596
+ * @summary JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
+ *
+ * @run main/othervm -ea -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6991596
+ */
+
+import java.lang.invoke.*;
+
+public class Test6991596 {
+    private static final Class   CLASS = Test6991596.class;
+    private static final String  NAME  = "foo";
+    private static final boolean DEBUG = System.getProperty("DEBUG", "false").equals("true");
+
+    public static void main(String[] args) throws Throwable {
+        testboolean();
+        testbyte();
+        testchar();
+        testshort();
+        testint();
+        testlong();
+    }
+
+    // Helpers to get various methods.
+    static MethodHandle getmh1(Class ret, Class arg) throws ReflectiveOperationException {
+        return MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(ret, arg));
+    }
+    static MethodHandle getmh2(MethodHandle mh1, Class ret, Class arg) {
+        return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg));
+    }
+    static MethodHandle getmh3(MethodHandle mh1, Class ret, Class arg) {
+        return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg));
+    }
+
+    // test adapter_opt_i2i
+    static void testboolean() throws Throwable {
+        boolean[] a = new boolean[] {
+            true,
+            false
+        };
+        for (int i = 0; i < a.length; i++) {
+            doboolean(a[i]);
+        }
+    }
+    static void doboolean(boolean x) throws Throwable {
+        if (DEBUG)  System.out.println("boolean=" + x);
+
+        // boolean
+        {
+            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
+            MethodHandle mh2 = getmh2(mh1, boolean.class, boolean.class);
+            // TODO add this for all cases when the bugs are fixed.
+            //MethodHandle mh3 = getmh3(mh1, boolean.class, boolean.class);
+            boolean a = (boolean) mh1.invokeExact((boolean) x);
+            boolean b = (boolean) mh2.invokeExact(x);
+            //boolean c = mh3.<boolean>invokeExact((boolean) x);
+            check(x, a, b);
+            //check(x, c, x);
+        }
+
+        // byte
+        {
+            MethodHandle mh1 = getmh1(     byte.class,    byte.class   );
+            MethodHandle mh2 = getmh2(mh1, byte.class,    boolean.class);
+            byte a = (byte) mh1.invokeExact((byte) (x ? 1 : 0));
+            byte b = (byte) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // char
+        {
+            MethodHandle mh1 = getmh1(     char.class, char.class);
+            MethodHandle mh2 = getmh2(mh1, char.class, boolean.class);
+            char a = (char) mh1.invokeExact((char) (x ? 1 : 0));
+            char b = (char) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // short
+        {
+            MethodHandle mh1 = getmh1(     short.class, short.class);
+            MethodHandle mh2 = getmh2(mh1, short.class, boolean.class);
+            short a = (short) mh1.invokeExact((short) (x ? 1 : 0));
+            short b = (short) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+    }
+
+    static void testbyte() throws Throwable {
+        byte[] a = new byte[] {
+            Byte.MIN_VALUE,
+            Byte.MIN_VALUE + 1,
+            -0x0F,
+            -1,
+            0,
+            1,
+            0x0F,
+            Byte.MAX_VALUE - 1,
+            Byte.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            dobyte(a[i]);
+        }
+    }
+    static void dobyte(byte x) throws Throwable {
+        if (DEBUG)  System.out.println("byte=" + x);
+
+        // boolean
+        {
+            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
+            MethodHandle mh2 = getmh2(mh1, boolean.class, byte.class);
+            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+            boolean b = (boolean) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // byte
+        {
+            MethodHandle mh1 = getmh1(     byte.class, byte.class);
+            MethodHandle mh2 = getmh2(mh1, byte.class, byte.class);
+            byte a = (byte) mh1.invokeExact((byte) x);
+            byte b = (byte) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // char
+        {
+            MethodHandle mh1 = getmh1(     char.class, char.class);
+            MethodHandle mh2 = getmh2(mh1, char.class, byte.class);
+            char a = (char) mh1.invokeExact((char) x);
+            char b = (char) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // short
+        {
+            MethodHandle mh1 = getmh1(     short.class, short.class);
+            MethodHandle mh2 = getmh2(mh1, short.class, byte.class);
+            short a = (short) mh1.invokeExact((short) x);
+            short b = (short) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+    }
+
+    static void testchar() throws Throwable {
+        char[] a = new char[] {
+            Character.MIN_VALUE,
+            Character.MIN_VALUE + 1,
+            0x000F,
+            0x00FF,
+            0x0FFF,
+            Character.MAX_VALUE - 1,
+            Character.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            dochar(a[i]);
+        }
+    }
+    static void dochar(char x) throws Throwable {
+        if (DEBUG)  System.out.println("char=" + x);
+
+        // boolean
+        {
+            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
+            MethodHandle mh2 = getmh2(mh1, boolean.class, char.class);
+            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+            boolean b = (boolean) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // byte
+        {
+            MethodHandle mh1 = getmh1(     byte.class, byte.class);
+            MethodHandle mh2 = getmh2(mh1, byte.class, char.class);
+            byte a = (byte) mh1.invokeExact((byte) x);
+            byte b = (byte) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // char
+        {
+            MethodHandle mh1 = getmh1(     char.class, char.class);
+            MethodHandle mh2 = getmh2(mh1, char.class, char.class);
+            char a = (char) mh1.invokeExact((char) x);
+            char b = (char) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // short
+        {
+            MethodHandle mh1 = getmh1(     short.class, short.class);
+            MethodHandle mh2 = getmh2(mh1, short.class, char.class);
+            short a = (short) mh1.invokeExact((short) x);
+            short b = (short) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+    }
+
+    static void testshort() throws Throwable {
+        short[] a = new short[] {
+            Short.MIN_VALUE,
+            Short.MIN_VALUE + 1,
+            -0x0FFF,
+            -0x00FF,
+            -0x000F,
+            -1,
+            0,
+            1,
+            0x000F,
+            0x00FF,
+            0x0FFF,
+            Short.MAX_VALUE - 1,
+            Short.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            doshort(a[i]);
+        }
+    }
+    static void doshort(short x) throws Throwable {
+        if (DEBUG)  System.out.println("short=" + x);
+
+        // boolean
+        {
+            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
+            MethodHandle mh2 = getmh2(mh1, boolean.class, short.class);
+            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+            boolean b = (boolean) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // byte
+        {
+            MethodHandle mh1 = getmh1(     byte.class, byte.class);
+            MethodHandle mh2 = getmh2(mh1, byte.class, short.class);
+            byte a = (byte) mh1.invokeExact((byte) x);
+            byte b = (byte) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // char
+        {
+            MethodHandle mh1 = getmh1(     char.class, char.class);
+            MethodHandle mh2 = getmh2(mh1, char.class, short.class);
+            char a = (char) mh1.invokeExact((char) x);
+            char b = (char) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // short
+        {
+            MethodHandle mh1 = getmh1(     short.class, short.class);
+            MethodHandle mh2 = getmh2(mh1, short.class, short.class);
+            short a = (short) mh1.invokeExact((short) x);
+            short b = (short) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+    }
+
+    static void testint() throws Throwable {
+        int[] a = new int[] {
+            Integer.MIN_VALUE,
+            Integer.MIN_VALUE + 1,
+            -0x0FFFFFFF,
+            -0x00FFFFFF,
+            -0x000FFFFF,
+            -0x0000FFFF,
+            -0x00000FFF,
+            -0x000000FF,
+            -0x0000000F,
+            -1,
+            0,
+            1,
+            0x0000000F,
+            0x000000FF,
+            0x00000FFF,
+            0x0000FFFF,
+            0x000FFFFF,
+            0x00FFFFFF,
+            0x0FFFFFFF,
+            Integer.MAX_VALUE - 1,
+            Integer.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            doint(a[i]);
+        }
+    }
+    static void doint(int x) throws Throwable {
+        if (DEBUG)  System.out.println("int=" + x);
+
+        // boolean
+        {
+            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
+            MethodHandle mh2 = getmh2(mh1, boolean.class, int.class);
+            boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+            boolean b = (boolean) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // byte
+        {
+            MethodHandle mh1 = getmh1(     byte.class, byte.class);
+            MethodHandle mh2 = getmh2(mh1, byte.class, int.class);
+            byte a = (byte) mh1.invokeExact((byte) x);
+            byte b = (byte) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // char
+        {
+            MethodHandle mh1 = getmh1(     char.class, char.class);
+            MethodHandle mh2 = getmh2(mh1, char.class, int.class);
+            char a = (char) mh1.invokeExact((char) x);
+            char b = (char) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // short
+        {
+            MethodHandle mh1 = getmh1(     short.class, short.class);
+            MethodHandle mh2 = getmh2(mh1, short.class, int.class);
+            short a = (short) mh1.invokeExact((short) x);
+            short b = (short) mh2.invokeExact(x);
+            assert a == b : a + " != " + b;
+            check(x, a, b);
+        }
+
+        // int
+        {
+            MethodHandle mh1 = getmh1(     int.class, int.class);
+            MethodHandle mh2 = getmh2(mh1, int.class, int.class);
+            int a = (int) mh1.invokeExact((int) x);
+            int b = (int) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+    }
+
+    // test adapter_opt_l2i
+    static void testlong() throws Throwable {
+        long[] a = new long[] {
+            Long.MIN_VALUE,
+            Long.MIN_VALUE + 1,
+            -0x000000000FFFFFFFL,
+            -0x0000000000FFFFFFL,
+            -0x00000000000FFFFFL,
+            -0x000000000000FFFFL,
+            -0x0000000000000FFFL,
+            -0x00000000000000FFL,
+            -0x000000000000000FL,
+            -1L,
+            0L,
+            1L,
+            0x000000000000000FL,
+            0x00000000000000FFL,
+            0x0000000000000FFFL,
+            0x0000000000000FFFL,
+            0x000000000000FFFFL,
+            0x00000000000FFFFFL,
+            0x0000000000FFFFFFL,
+            0x000000000FFFFFFFL,
+            Long.MAX_VALUE - 1,
+            Long.MAX_VALUE
+        };
+        for (int i = 0; i < a.length; i++) {
+            dolong(a[i]);
+        }
+    }
+    static void dolong(long x) throws Throwable {
+        if (DEBUG)  System.out.println("long=" + x);
+
+        // boolean
+        {
+            MethodHandle mh1 = getmh1(     boolean.class, boolean.class);
+            MethodHandle mh2 = getmh2(mh1, boolean.class, long.class);
+            boolean a = (boolean) mh1.invokeExact((x & 1L) == 1L);
+            boolean b = (boolean) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // byte
+        {
+            MethodHandle mh1 = getmh1(     byte.class, byte.class);
+            MethodHandle mh2 = getmh2(mh1, byte.class, long.class);
+            byte a = (byte) mh1.invokeExact((byte) x);
+            byte b = (byte) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // char
+        {
+            MethodHandle mh1 = getmh1(     char.class, char.class);
+            MethodHandle mh2 = getmh2(mh1, char.class, long.class);
+            char a = (char) mh1.invokeExact((char) x);
+            char b = (char) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // short
+        {
+            MethodHandle mh1 = getmh1(     short.class, short.class);
+            MethodHandle mh2 = getmh2(mh1, short.class, long.class);
+            short a = (short) mh1.invokeExact((short) x);
+            short b = (short) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+
+        // int
+        {
+            MethodHandle mh1 = getmh1(     int.class, int.class);
+            MethodHandle mh2 = getmh2(mh1, int.class, long.class);
+            int a = (int) mh1.invokeExact((int) x);
+            int b = (int) mh2.invokeExact(x);
+            check(x, a, b);
+        }
+    }
+
+    static void check(boolean x, boolean e, boolean a) { p(z2h(x), z2h(e), z2h(a)); assert e == a : z2h(x) + ": " + z2h(e) + " != " + z2h(a); }
+    static void check(boolean x, byte    e, byte    a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+    static void check(boolean x, int     e, int     a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+
+    static void check(int     x, boolean e, boolean a) { p(i2h(x), z2h(e), z2h(a)); assert e == a : i2h(x) + ": " + z2h(e) + " != " + z2h(a); }
+    static void check(int     x, byte    e, byte    a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+    static void check(int     x, int     e, int     a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+
+    static void check(long    x, boolean e, boolean a) { p(l2h(x), z2h(e), z2h(a)); assert e == a : l2h(x) + ": " + z2h(e) + " != " + z2h(a); }
+    static void check(long    x, byte    e, byte    a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+    static void check(long    x, int     e, int     a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+
+    static void p(String x, String e, String a) { if (DEBUG)  System.out.println(x + ": expected: " + e + ", actual: " + a); }
+
+    static String z2h(boolean x) { return x ? "1" : "0"; }
+    static String i2h(int     x) { return Integer.toHexString(x); }
+    static String l2h(long    x) { return Long.toHexString(x); }
+
+    // to int
+    public static boolean foo(boolean i) { return i; }
+    public static byte    foo(byte    i) { return i; }
+    public static char    foo(char    i) { return i; }
+    public static short   foo(short   i) { return i; }
+    public static int     foo(int     i) { return i; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/ClassValueTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+/* @test
+ * @summary tests for class-specific values
+ * @compile ClassValueTest.java
+ * @run junit/othervm test.java.lang.invoke.ClassValueTest
+ */
+
+/*
+  Manually:
+   $ $JAVA7X_HOME/bin/javac -d foo -cp $JUNIT4_JAR test/java/lang/invoke/ClassValueTest.java
+   $ $JAVA7X_HOME/bin/java -cp foo:$JUNIT4_JAR org.junit.runner.JUnitCore test.java.lang.invoke.ClassValueTest
+  Output: .testAdd => 1000 : Integer
+ */
+
+package test.java.lang.invoke;
+
+import java.util.*;
+
+import java.lang.invoke.*;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ * @author jrose
+ */
+public class ClassValueTest {
+    static String nameForCV1(Class<?> type) {
+        return "CV1:" + type.getName();
+    }
+    static int countForCV1;
+    static final ClassValue<String> CV1 = new CV1();
+    private static class CV1 extends ClassValue<String> {
+        protected String computeValue(Class<?> type) {
+            countForCV1++;
+            return nameForCV1(type);
+        }
+    }
+
+    static final Class[] CLASSES = {
+        String.class,
+        Integer.class,
+        int.class,
+        boolean[].class,
+        char[][].class,
+        ClassValueTest.class
+    };
+
+    @Test
+    public void testGet() {
+        countForCV1 = 0;
+        for (Class c : CLASSES) {
+            assertEquals(nameForCV1(c), CV1.get(c));
+        }
+        assertEquals(CLASSES.length, countForCV1);
+        for (Class c : CLASSES) {
+            assertEquals(nameForCV1(c), CV1.get(c));
+        }
+        assertEquals(CLASSES.length, countForCV1);
+    }
+
+    @Test
+    public void testRemove() {
+        for (Class c : CLASSES) {
+            CV1.get(c);
+        }
+        countForCV1 = 0;
+        int REMCOUNT = 3;
+        for (int i = 0; i < REMCOUNT; i++) {
+            CV1.remove(CLASSES[i]);
+        }
+        assertEquals(0, countForCV1);  // no change
+        for (Class c : CLASSES) {
+            assertEquals(nameForCV1(c), CV1.get(c));
+        }
+        assertEquals(REMCOUNT, countForCV1);
+    }
+
+    static String nameForCVN(Class<?> type, int n) {
+        return "CV[" + n + "]" + type.getName();
+    }
+    static int countForCVN;
+    static class CVN extends ClassValue<String> {
+        final int n;
+        CVN(int n) { this.n = n; }
+        protected String computeValue(Class<?> type) {
+            countForCVN++;
+            return nameForCVN(type, n);
+        }
+    };
+
+    @Test
+    public void testGetMany() {
+        int CVN_COUNT1 = 100, CVN_COUNT2 = 100;
+        CVN cvns[] = new CVN[CVN_COUNT1 * CVN_COUNT2];
+        for (int n = 0; n < cvns.length; n++) {
+            cvns[n] = new CVN(n);
+        }
+        countForCVN = 0;
+        for (int pass = 0; pass <= 2; pass++) {
+            for (int i1 = 0; i1 < CVN_COUNT1; i1++) {
+                eachClass:
+                for (Class c : CLASSES) {
+                    for (int i2 = 0; i2 < CVN_COUNT2; i2++) {
+                        int n = i1*CVN_COUNT2 + i2;
+                        assertEquals(0, countForCVN);
+                        assertEquals(nameForCVN(c, n), cvns[n].get(c));
+                        cvns[n].get(c);  //get it again
+                        //System.out.println("getting "+n+":"+cvns[n].get(c));
+                        boolean doremove = (((i1 + i2) & 3) == 0);
+                        switch (pass) {
+                        case 0:
+                            assertEquals(1, countForCVN);
+                            break;
+                        case 1:
+                            // remove on middle pass
+                            assertEquals(0, countForCVN);
+                            if (doremove) {
+                                //System.out.println("removing "+n+":"+cvns[n].get(c));
+                                cvns[n].remove(c);
+                                assertEquals(0, countForCVN);
+                            }
+                            break;
+                        case 2:
+                            assertEquals(doremove ? 1 : 0, countForCVN);
+                            break;
+                        }
+                        countForCVN = 0;
+                        if (i1 > i2 && i1 < i2+5)  continue eachClass;  // leave diagonal gap
+                    }
+                }
+            }
+        }
+        assertEquals(countForCVN, 0);
+        for (int n = 0; n < cvns.length; n++) {
+            for (Class c : CLASSES) {
+                assertEquals(nameForCVN(c, n), cvns[n].get(c));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/InvokeDynamicPrintArgs.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary smoke test for invokedynamic instructions
+ * @build indify.Indify
+ * @compile InvokeDynamicPrintArgs.java
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic
+ *      indify.Indify
+ *      --verify-specifier-count=3 --transitionalJSR292=false
+ *      --expand-properties --classpath ${test.classes}
+ *      --java test.java.lang.invoke.InvokeDynamicPrintArgs --check-output
+ */
+
+package test.java.lang.invoke;
+
+import org.junit.Test;
+
+import java.util.*;
+import java.io.*;
+
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+
+public class InvokeDynamicPrintArgs {
+    public static void main(String... av) throws Throwable {
+        if (av.length > 0)  openBuf();  // --check-output mode
+        System.out.println("Printing some argument lists, starting with a empty one:");
+        INDY_nothing().invokeExact();                 // BSM specifier #0 = {bsm}
+        INDY_bar().invokeExact("bar arg", 1);         // BSM specifier #1 = {bsm2, Void.class, "void type"}
+        INDY_bar2().invokeExact("bar2 arg", 222);     // BSM specifier #1 = (same)
+        INDY_baz().invokeExact("baz arg", 2, 3.14);   // BSM specifier #2 = {bsm2, 1234.5}
+        INDY_foo().invokeExact("foo arg");            // BSM specifier #0 = (same)
+        // Hence, BSM specifier count should be 3.  See "--verify-specifier-count=3" above.
+        System.out.println("Done printing argument lists.");
+        closeBuf();
+    }
+
+    @Test
+    public void testInvokeDynamicPrintArgs() throws IOException {
+        System.err.println(System.getProperties());
+        String testClassPath = System.getProperty("build.test.classes.dir");
+        if (testClassPath == null)  throw new RuntimeException();
+        String[] args = new String[]{
+            "--verify-specifier-count=3", "--transitionalJSR292=false",
+            "--expand-properties", "--classpath", testClassPath,
+            "--java", "test.java.lang.invoke.InvokeDynamicPrintArgs", "--check-output"
+        };
+        System.err.println("Indify: "+Arrays.toString(args));
+        indify.Indify.main(args);
+    }
+
+    private static PrintStream oldOut;
+    private static ByteArrayOutputStream buf;
+    private static void openBuf() {
+        oldOut = System.out;
+        buf = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(buf));
+    }
+    private static void closeBuf() {
+        if (buf == null)  return;
+        System.out.flush();
+        System.setOut(oldOut);
+        String[] haveLines = new String(buf.toByteArray()).split("[\n\r]+");
+        for (String line : haveLines)  System.out.println(line);
+        Iterator<String> iter = Arrays.asList(haveLines).iterator();
+        for (String want : EXPECT_OUTPUT) {
+            String have = iter.hasNext() ? iter.next() : "[EOF]";
+            if (want.equals(have))  continue;
+            System.err.println("want line: "+want);
+            System.err.println("have line: "+have);
+            throw new AssertionError("unexpected output: "+have);
+        }
+        if (iter.hasNext())
+            throw new AssertionError("unexpected output: "+iter.next());
+    }
+    private static final String[] EXPECT_OUTPUT = {
+        "Printing some argument lists, starting with a empty one:",
+        "[test.java.lang.invoke.InvokeDynamicPrintArgs, nothing, ()void][]",
+        "[test.java.lang.invoke.InvokeDynamicPrintArgs, bar, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar arg, 1]",
+        "[test.java.lang.invoke.InvokeDynamicPrintArgs, bar2, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar2 arg, 222]",
+        "[test.java.lang.invoke.InvokeDynamicPrintArgs, baz, (String,int,double)void, 1234.5][baz arg, 2, 3.14]",
+        "[test.java.lang.invoke.InvokeDynamicPrintArgs, foo, (String)void][foo arg]",
+        "Done printing argument lists."
+    };
+
+    private static void printArgs(Object bsmInfo, Object... args) {
+        System.out.println(bsmInfo+Arrays.deepToString(args));
+    }
+    private static MethodHandle MH_printArgs() throws ReflectiveOperationException {
+        shouldNotCallThis();
+        return lookup().findStatic(lookup().lookupClass(),
+                                   "printArgs", methodType(void.class, Object.class, Object[].class));
+    }
+
+    private static CallSite bsm(Lookup caller, String name, MethodType type) throws ReflectiveOperationException {
+        // ignore caller and name, but match the type:
+        Object bsmInfo = Arrays.asList(caller, name, type);
+        return new ConstantCallSite(MH_printArgs().bindTo(bsmInfo).asCollector(Object[].class, type.parameterCount()).asType(type));
+    }
+    private static MethodType MT_bsm() {
+        shouldNotCallThis();
+        return methodType(CallSite.class, Lookup.class, String.class, MethodType.class);
+    }
+    private static MethodHandle MH_bsm() throws ReflectiveOperationException {
+        shouldNotCallThis();
+        return lookup().findStatic(lookup().lookupClass(), "bsm", MT_bsm());
+    }
+
+    private static CallSite bsm2(Lookup caller, String name, MethodType type, Object... arg) throws ReflectiveOperationException {
+        // ignore caller and name, but match the type:
+        List<Object> bsmInfo = new ArrayList<>(Arrays.asList(caller, name, type));
+        bsmInfo.addAll(Arrays.asList((Object[])arg));
+        return new ConstantCallSite(MH_printArgs().bindTo(bsmInfo).asCollector(Object[].class, type.parameterCount()).asType(type));
+    }
+    private static MethodType MT_bsm2() {
+        shouldNotCallThis();
+        return methodType(CallSite.class, Lookup.class, String.class, MethodType.class, Object[].class);
+    }
+    private static MethodHandle MH_bsm2() throws ReflectiveOperationException {
+        shouldNotCallThis();
+        return lookup().findStatic(lookup().lookupClass(), "bsm2", MT_bsm2());
+    }
+
+    private static MethodHandle INDY_nothing() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invokeGeneric(lookup(),
+                                                  "nothing", methodType(void.class)
+                                                  )).dynamicInvoker();
+    }
+    private static MethodHandle INDY_foo() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invokeGeneric(lookup(),
+                                                  "foo", methodType(void.class, String.class)
+                                                  )).dynamicInvoker();
+    }
+    private static MethodHandle INDY_bar() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
+                                                  "bar", methodType(void.class, String.class, int.class)
+                                                  , new Object[] { Void.class, "void type!",
+                                                                   1, 234.5F, 67.5, (long)89 }
+                                                  )).dynamicInvoker();
+    }
+    private static MethodHandle INDY_bar2() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
+                                                  "bar2", methodType(void.class, String.class, int.class)
+                                                  , new Object[] { Void.class, "void type!",
+                                                                   1, 234.5F, 67.5, (long)89 }
+                                                  )).dynamicInvoker();
+    }
+    private static MethodHandle INDY_baz() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
+                                                  "baz", methodType(void.class, String.class, int.class, double.class)
+                                                  , 1234.5
+                                                  )).dynamicInvoker();
+    }
+
+    private static void shouldNotCallThis() {
+        // if this gets called, the transformation has not taken place
+        if (System.getProperty("InvokeDynamicPrintArgs.allow-untransformed") != null)  return;
+        throw new AssertionError("this code should be statically transformed away by Indify");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/InvokeGenericTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2009, 2011, 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.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.MethodHandle.invokeGeneric
+ * @compile -XDallowTransitionalJSR292=no -target 7 InvokeGenericTest.java
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.lang.invoke.InvokeGenericTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+import java.lang.reflect.*;
+import java.util.*;
+import org.junit.*;
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
+
+
+/**
+ *
+ * @author jrose
+ */
+public class InvokeGenericTest {
+    // How much output?
+    static int verbosity = 0;
+    static {
+        String vstr = System.getProperty("test.java.lang.invoke.InvokeGenericTest.verbosity");
+        if (vstr != null)  verbosity = Integer.parseInt(vstr);
+    }
+
+    @Test
+    public void testFirst() throws Throwable {
+        verbosity += 9; try {
+            // left blank for debugging
+        } finally { printCounts(); verbosity -= 9; }
+    }
+
+    public InvokeGenericTest() {
+    }
+
+    @Before
+    public void checkImplementedPlatform() {
+        boolean platformOK = false;
+        Properties properties = System.getProperties();
+        String vers = properties.getProperty("java.vm.version");
+        String name = properties.getProperty("java.vm.name");
+        String arch = properties.getProperty("os.arch");
+        if ((arch.equals("amd64") || arch.equals("i386") || arch.equals("x86") ||
+             arch.equals("sparc") || arch.equals("sparcv9")) &&
+            (name.contains("Client") || name.contains("Server"))
+            ) {
+            platformOK = true;
+        } else {
+            System.err.println("Skipping tests for unsupported platform: "+Arrays.asList(vers, name, arch));
+        }
+        assumeTrue(platformOK);
+    }
+
+    String testName;
+    static int allPosTests, allNegTests;
+    int posTests, negTests;
+    @After
+    public void printCounts() {
+        if (verbosity >= 2 && (posTests | negTests) != 0) {
+            System.out.println();
+            if (posTests != 0)  System.out.println("=== "+testName+": "+posTests+" positive test cases run");
+            if (negTests != 0)  System.out.println("=== "+testName+": "+negTests+" negative test cases run");
+            allPosTests += posTests;
+            allNegTests += negTests;
+            posTests = negTests = 0;
+        }
+    }
+    void countTest(boolean positive) {
+        if (positive) ++posTests;
+        else          ++negTests;
+    }
+    void countTest() { countTest(true); }
+    void startTest(String name) {
+        if (testName != null)  printCounts();
+        if (verbosity >= 1)
+            System.out.println(name);
+        posTests = negTests = 0;
+        testName = name;
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        calledLog.clear();
+        calledLog.add(null);
+        nextArgVal = INITIAL_ARG_VAL;
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+        int posTests = allPosTests, negTests = allNegTests;
+        if (verbosity >= 2 && (posTests | negTests) != 0) {
+            System.out.println();
+            if (posTests != 0)  System.out.println("=== "+posTests+" total positive test cases");
+            if (negTests != 0)  System.out.println("=== "+negTests+" total negative test cases");
+        }
+    }
+
+    static List<Object> calledLog = new ArrayList<Object>();
+    static Object logEntry(String name, Object... args) {
+        return Arrays.asList(name, Arrays.asList(args));
+    }
+    static Object called(String name, Object... args) {
+        Object entry = logEntry(name, args);
+        calledLog.add(entry);
+        return entry;
+    }
+    static void assertCalled(String name, Object... args) {
+        Object expected = logEntry(name, args);
+        Object actual   = calledLog.get(calledLog.size() - 1);
+        if (expected.equals(actual) && verbosity < 9)  return;
+        System.out.println("assertCalled "+name+":");
+        System.out.println("expected:   "+expected);
+        System.out.println("actual:     "+actual);
+        System.out.println("ex. types:  "+getClasses(expected));
+        System.out.println("act. types: "+getClasses(actual));
+        assertEquals("previous method call", expected, actual);
+    }
+    static void printCalled(MethodHandle target, String name, Object... args) {
+        if (verbosity >= 3)
+            System.out.println("calling MH="+target+" to "+name+Arrays.toString(args));
+    }
+
+    static Object castToWrapper(Object value, Class<?> dst) {
+        Object wrap = null;
+        if (value instanceof Number)
+            wrap = castToWrapperOrNull(((Number)value).longValue(), dst);
+        if (value instanceof Character)
+            wrap = castToWrapperOrNull((char)(Character)value, dst);
+        if (wrap != null)  return wrap;
+        return dst.cast(value);
+    }
+
+    static Object castToWrapperOrNull(long value, Class<?> dst) {
+        if (dst == int.class || dst == Integer.class)
+            return (int)(value);
+        if (dst == long.class || dst == Long.class)
+            return (long)(value);
+        if (dst == char.class || dst == Character.class)
+            return (char)(value);
+        if (dst == short.class || dst == Short.class)
+            return (short)(value);
+        if (dst == float.class || dst == Float.class)
+            return (float)(value);
+        if (dst == double.class || dst == Double.class)
+            return (double)(value);
+        if (dst == byte.class || dst == Byte.class)
+            return (byte)(value);
+        if (dst == boolean.class || dst == boolean.class)
+            return ((value % 29) & 1) == 0;
+        return null;
+    }
+
+    static final int ONE_MILLION = (1000*1000),  // first int value
+                     TEN_BILLION = (10*1000*1000*1000),  // scale factor to reach upper 32 bits
+                     INITIAL_ARG_VAL = ONE_MILLION << 1;  // <<1 makes space for sign bit;
+    static long nextArgVal;
+    static long nextArg(boolean moreBits) {
+        long val = nextArgVal++;
+        long sign = -(val & 1); // alternate signs
+        val >>= 1;
+        if (moreBits)
+            // Guarantee some bits in the high word.
+            // In any case keep the decimal representation simple-looking,
+            // with lots of zeroes, so as not to make the printed decimal
+            // strings unnecessarily noisy.
+            val += (val % ONE_MILLION) * TEN_BILLION;
+        return val ^ sign;
+    }
+    static int nextArg() {
+        // Produce a 32-bit result something like ONE_MILLION+(smallint).
+        // Example: 1_000_042.
+        return (int) nextArg(false);
+    }
+    static long nextArg(Class<?> kind) {
+        if (kind == long.class   || kind == Long.class ||
+            kind == double.class || kind == Double.class)
+            // produce a 64-bit result something like
+            // ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
+            // Example: 10_000_420_001_000_042.
+            return nextArg(true);
+        return (long) nextArg();
+    }
+
+    static Object randomArg(Class<?> param) {
+        Object wrap = castToWrapperOrNull(nextArg(param), param);
+        if (wrap != null) {
+            return wrap;
+        }
+//        import sun.invoke.util.Wrapper;
+//        Wrapper wrap = Wrapper.forBasicType(dst);
+//        if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
+//            wrap = Wrapper.forWrapperType(dst);
+//        if (wrap != Wrapper.OBJECT)
+//            return wrap.wrap(nextArg++);
+        if (param.isInterface()) {
+            for (Class<?> c : param.getClasses()) {
+                if (param.isAssignableFrom(c) && !c.isInterface())
+                    { param = c; break; }
+            }
+        }
+        if (param.isInterface() || param.isAssignableFrom(String.class))
+            return "#"+nextArg();
+        else
+            try {
+                return param.newInstance();
+            } catch (InstantiationException ex) {
+            } catch (IllegalAccessException ex) {
+            }
+        return null;  // random class not Object, String, Integer, etc.
+    }
+    static Object[] randomArgs(Class<?>... params) {
+        Object[] args = new Object[params.length];
+        for (int i = 0; i < args.length; i++)
+            args[i] = randomArg(params[i]);
+        return args;
+    }
+    static Object[] randomArgs(int nargs, Class<?> param) {
+        Object[] args = new Object[nargs];
+        for (int i = 0; i < args.length; i++)
+            args[i] = randomArg(param);
+        return args;
+    }
+
+    static final Object ANON_OBJ = new Object();
+    static Object zeroArg(Class<?> param) {
+        Object x = castToWrapperOrNull(0L, param);
+        if (x != null)  return x;
+        if (param.isInterface() || param.isAssignableFrom(String.class))  return "\"\"";
+        if (param == Object.class)  return ANON_OBJ;
+        if (param.getComponentType() != null)  return Array.newInstance(param.getComponentType(), 0);
+        return null;
+    }
+    static Object[] zeroArgs(Class<?>... params) {
+        Object[] args = new Object[params.length];
+        for (int i = 0; i < args.length; i++)
+            args[i] = zeroArg(params[i]);
+        return args;
+    }
+    static Object[] zeroArgs(List<Class<?>> params) {
+        return zeroArgs(params.toArray(new Class<?>[0]));
+    }
+
+    static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
+        return Arrays.copyOf(a, a.length, atype);
+    }
+    static <T> T[] cat(T[] a, T... b) {
+        int alen = a.length, blen = b.length;
+        if (blen == 0)  return a;
+        T[] c = Arrays.copyOf(a, alen + blen);
+        System.arraycopy(b, 0, c, alen, blen);
+        return c;
+    }
+    static Integer[] boxAll(int... vx) {
+        Integer[] res = new Integer[vx.length];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = vx[i];
+        }
+        return res;
+    }
+    static Object getClasses(Object x) {
+        if (x == null)  return x;
+        if (x instanceof String)  return x;  // keep the name
+        if (x instanceof List) {
+            // recursively report classes of the list elements
+            Object[] xa = ((List)x).toArray();
+            for (int i = 0; i < xa.length; i++)
+                xa[i] = getClasses(xa[i]);
+            return Arrays.asList(xa);
+        }
+        return x.getClass().getSimpleName();
+    }
+
+    static MethodHandle changeArgTypes(MethodHandle target, Class<?> argType) {
+        return changeArgTypes(target, 0, 999, argType);
+    }
+    static MethodHandle changeArgTypes(MethodHandle target,
+            int beg, int end, Class<?> argType) {
+        MethodType targetType = target.type();
+        end = Math.min(end, targetType.parameterCount());
+        ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>(targetType.parameterList());
+        Collections.fill(argTypes.subList(beg, end), argType);
+        MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
+        return MethodHandles.convertArguments(target, ttype2);
+    }
+
+    // This lookup is good for all members in and under InvokeGenericTest.
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    Map<List<Class<?>>, MethodHandle> CALLABLES = new HashMap<List<Class<?>>, MethodHandle>();
+    MethodHandle callable(List<Class<?>> params) {
+        MethodHandle mh = CALLABLES.get(params);
+        if (mh == null) {
+            mh = collector_MH.asType(methodType(Object.class, params));
+            CALLABLES.put(params, mh);
+        }
+        return mh;
+    }
+    MethodHandle callable(Class<?>... params) {
+        return callable(Arrays.asList(params));
+    }
+    private static Object collector(Object... args) {
+        return Arrays.asList(args);
+    }
+    private static final MethodHandle collector_MH;
+    static {
+        try {
+            collector_MH
+                = LOOKUP.findStatic(LOOKUP.lookupClass(),
+                                    "collector",
+                                    methodType(Object.class, Object[].class));
+        } catch (ReflectiveOperationException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    @Test
+    public void testSimple() throws Throwable {
+        startTest("testSimple");
+        countTest();
+        String[] args = { "one", "two" };
+        MethodHandle mh = callable(Object.class, String.class);
+        Object res; List resl;
+        res = resl = (List) mh.invokeGeneric((String)args[0], (Object)args[1]);
+        //System.out.println(res);
+        assertEquals(Arrays.asList(args), res);
+    }
+
+    @Test
+    public void testWrongArgumentCount() throws Throwable {
+        startTest("testWrongArgumentCount");
+        for (int i = 0; i <= 10; i++) {
+            testWrongArgumentCount(Collections.<Class<?>>nCopies(i, Integer.class));
+            if (i <= 4) {
+                testWrongArgumentCount(Collections.<Class<?>>nCopies(i, int.class));
+                testWrongArgumentCount(Collections.<Class<?>>nCopies(i, long.class));
+            }
+        }
+    }
+    public void testWrongArgumentCount(List<Class<?>> params) throws Throwable {
+        int max = params.size();
+        for (int i = 0; i < max; i++) {
+            List<Class<?>> params2 = params.subList(0, i);
+            for (int k = 0; k <= 2; k++) {
+                if (k == 1)  params  = methodType(Object.class,  params).generic().parameterList();
+                if (k == 2)  params2 = methodType(Object.class, params2).generic().parameterList();
+                testWrongArgumentCount(params, params2);
+                testWrongArgumentCount(params2, params);
+            }
+        }
+    }
+    public void testWrongArgumentCount(List<Class<?>> expect, List<Class<?>> observe) throws Throwable {
+        countTest(false);
+        if (expect.equals(observe))
+            assert(false);
+        MethodHandle target = callable(expect);
+        Object[] args = zeroArgs(observe);
+        Object junk;
+        try {
+            switch (args.length) {
+            case 0:
+                junk = target.invokeGeneric(); break;
+            case 1:
+                junk = target.invokeGeneric(args[0]); break;
+            case 2:
+                junk = target.invokeGeneric(args[0], args[1]); break;
+            case 3:
+                junk = target.invokeGeneric(args[0], args[1], args[2]); break;
+            case 4:
+                junk = target.invokeGeneric(args[0], args[1], args[2], args[3]); break;
+            default:
+                junk = target.invokeWithArguments(args); break;
+            }
+        } catch (WrongMethodTypeException ex) {
+            return;
+        } catch (Exception ex) {
+            throw new RuntimeException("wrong exception calling "+target+target.type()+" on "+Arrays.asList(args)+" : "+ex);
+        }
+        throw new RuntimeException("bad success calling "+target+target.type()+" on "+Arrays.asList(args));
+    }
+
+    /** Make a list of all combinations of the given types, with the given arities.
+     *  A void return type is possible iff the first type is void.class.
+     */
+    static List<MethodType> allMethodTypes(int minargc, int maxargc, Class<?>... types) {
+        ArrayList<MethodType> result = new ArrayList<MethodType>();
+        if (types.length > 0) {
+            ArrayList<MethodType> argcTypes = new ArrayList<MethodType>();
+            // build arity-zero types first
+            for (Class<?> rtype : types) {
+                argcTypes.add(MethodType.methodType(rtype));
+            }
+            if (types[0] == void.class)
+                // void is not an argument type
+                types = Arrays.copyOfRange(types, 1, types.length);
+            for (int argc = 0; argc <= maxargc; argc++) {
+                if (argc >= minargc)
+                    result.addAll(argcTypes);
+                if (argc >= maxargc)
+                    break;
+                ArrayList<MethodType> prevTypes = argcTypes;
+                argcTypes = new ArrayList<MethodType>();
+                for (MethodType prevType : prevTypes) {
+                    for (Class<?> ptype : types) {
+                        argcTypes.add(prevType.insertParameterTypes(argc, ptype));
+                    }
+                }
+            }
+        }
+        return Collections.unmodifiableList(result);
+    }
+    static List<MethodType> allMethodTypes(int argc, Class<?>... types) {
+        return allMethodTypes(argc, argc, types);
+    }
+
+    interface RandomInterface { }
+
+    MethodHandle toString_MH;
+
+    @Test
+    public void testReferenceConversions() throws Throwable {
+        startTest("testReferenceConversions");
+        toString_MH = LOOKUP.
+            findVirtual(Object.class, "toString", MethodType.methodType(String.class));
+        String[] args = { "one", "two" };
+        for (MethodType type : allMethodTypes(2, Object.class, String.class, RandomInterface.class)) {
+            testReferenceConversions(type, args);
+        }
+    }
+    public void testReferenceConversions(MethodType type, Object... args) throws Throwable {
+        countTest();
+        if (verbosity > 3)  System.out.println("target type: "+type);
+        MethodHandle mh = callable(type.parameterList());
+        MethodHandle tsdrop = MethodHandles.dropArguments(toString_MH, 1, type.parameterList());
+        mh = MethodHandles.foldArguments(tsdrop, mh);
+        mh = mh.asType(type);
+        Object res = mh.invokeGeneric((String)args[0], (Object)args[1]);
+        //System.out.println(res);
+        assertEquals(Arrays.asList(args).toString(), res);
+    }
+
+
+    @Test @Ignore("known failure pending 6939861")
+    public void testBoxConversions() throws Throwable {
+        startTest("testBoxConversions");
+        countTest();
+        Integer[] args = { 1, 2 };
+        MethodHandle mh = callable(Object.class, int.class);
+        Object res; List resl;
+        res = resl = (List) mh.invokeGeneric((int)args[0], (Object)args[1]);
+        //System.out.println(res);
+        assertEquals(Arrays.asList(args), res);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2009, 2011, 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.
+ */
+
+/* @test
+ * @summary example code used in javadoc for java.lang.invoke API
+ * @compile -XDallowTransitionalJSR292=no JavaDocExamplesTest.java
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.lang.invoke.JavaDocExamplesTest
+ */
+
+/*
+---- To run outside jtreg:
+$ $JAVA7X_HOME/bin/javac -cp $JUNIT4_JAR -d /tmp/Classes \
+   $DAVINCI/sources/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
+$ $JAVA7X_HOME/bin/java   -cp $JUNIT4_JAR:/tmp/Classes \
+   -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles \
+   -Dtest.java.lang.invoke.JavaDocExamplesTest.verbosity=1 \
+     test.java.lang.invoke.JavaDocExamplesTest
+----
+*/
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
+
+
+/**
+ * @author jrose
+ */
+public class JavaDocExamplesTest {
+    /** Wrapper for running the JUnit tests in this module.
+     *  Put JUnit on the classpath!
+     */
+    public static void main(String... ignore) {
+        org.junit.runner.JUnitCore.runClasses(JavaDocExamplesTest.class);
+    }
+    // How much output?
+    static int verbosity = Integer.getInteger("test.java.lang.invoke.JavaDocExamplesTest.verbosity", 0);
+
+{}
+static final private Lookup LOOKUP = lookup();
+// static final private MethodHandle CONCAT_1 = LOOKUP.findVirtual(String.class,
+//     "concat", methodType(String.class, String.class));
+// static final private MethodHandle HASHCODE_1 = LOOKUP.findVirtual(Object.class,
+//     "hashCode", methodType(int.class));
+
+// form required if ReflectiveOperationException is intercepted:
+static final private MethodHandle CONCAT_2, HASHCODE_2;
+static {
+  try {
+    CONCAT_2 = LOOKUP.findVirtual(String.class,
+      "concat", methodType(String.class, String.class));
+    HASHCODE_2 = LOOKUP.findVirtual(Object.class,
+      "hashCode", methodType(int.class));
+   } catch (ReflectiveOperationException ex) {
+     throw new RuntimeException(ex);
+   }
+}
+{}
+
+    @Test public void testFindVirtual() throws Throwable {
+{}
+MethodHandle CONCAT_3 = LOOKUP.findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+MethodHandle HASHCODE_3 = LOOKUP.findVirtual(Object.class,
+  "hashCode", methodType(int.class));
+//assertEquals("xy", (String) CONCAT_1.invokeExact("x", "y"));
+assertEquals("xy", (String) CONCAT_2.invokeExact("x", "y"));
+assertEquals("xy", (String) CONCAT_3.invokeExact("x", "y"));
+//assertEquals("xy".hashCode(), (int) HASHCODE_1.invokeExact((Object)"xy"));
+assertEquals("xy".hashCode(), (int) HASHCODE_2.invokeExact((Object)"xy"));
+assertEquals("xy".hashCode(), (int) HASHCODE_3.invokeExact((Object)"xy"));
+{}
+    }
+    @Test public void testDropArguments() throws Throwable {
+        {{
+{} /// JAVADOC
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodType bigType = cat.type().insertParameterTypes(0, int.class, String.class);
+MethodHandle d0 = dropArguments(cat, 0, bigType.parameterList().subList(0,2));
+assertEquals(bigType, d0.type());
+assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
+            }}
+        {{
+{} /// JAVADOC
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodHandle d0 = dropArguments(cat, 0, String.class);
+assertEquals("yz", (String) d0.invokeExact("x", "y", "z"));
+MethodHandle d1 = dropArguments(cat, 1, String.class);
+assertEquals("xz", (String) d1.invokeExact("x", "y", "z"));
+MethodHandle d2 = dropArguments(cat, 2, String.class);
+assertEquals("xy", (String) d2.invokeExact("x", "y", "z"));
+MethodHandle d12 = dropArguments(cat, 1, int.class, boolean.class);
+assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
+            }}
+    }
+
+    @Test public void testFilterArguments() throws Throwable {
+        {{
+{} /// JAVADOC
+MethodHandle cat = lookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+MethodHandle upcase = lookup().findVirtual(String.class,
+  "toUpperCase", methodType(String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodHandle f0 = filterArguments(cat, 0, upcase);
+assertEquals("Xy", (String) f0.invokeExact("x", "y")); // Xy
+MethodHandle f1 = filterArguments(cat, 1, upcase);
+assertEquals("xY", (String) f1.invokeExact("x", "y")); // xY
+MethodHandle f2 = filterArguments(cat, 0, upcase, upcase);
+assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
+            }}
+    }
+
+    static void assertEquals(Object exp, Object act) {
+        if (verbosity > 0)
+            System.out.println("result: "+act);
+        Assert.assertEquals(exp, act);
+    }
+
+    @Test public void testMethodHandlesSummary() throws Throwable {
+        {{
+{} /// JAVADOC
+Object x, y; String s; int i;
+MethodType mt; MethodHandle mh;
+MethodHandles.Lookup lookup = MethodHandles.lookup();
+// mt is (char,char)String
+mt = MethodType.methodType(String.class, char.class, char.class);
+mh = lookup.findVirtual(String.class, "replace", mt);
+s = (String) mh.invokeExact("daddy",'d','n');
+// invokeExact(Ljava/lang/String;CC)Ljava/lang/String;
+assert(s.equals("nanny"));
+// weakly typed invocation (using MHs.invoke)
+s = (String) mh.invokeWithArguments("sappy", 'p', 'v');
+assert(s.equals("savvy"));
+// mt is (Object[])List
+mt = MethodType.methodType(java.util.List.class, Object[].class);
+mh = lookup.findStatic(java.util.Arrays.class, "asList", mt);
+assert(mh.isVarargsCollector());
+x = mh.invokeGeneric("one", "two");
+// invokeGeneric(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
+assert(x.equals(java.util.Arrays.asList("one","two")));
+// mt is (Object,Object,Object)Object
+mt = MethodType.genericMethodType(3);
+mh = mh.asType(mt);
+x = mh.invokeExact((Object)1, (Object)2, (Object)3);
+// invokeExact(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+assert(x.equals(java.util.Arrays.asList(1,2,3)));
+// mt is { =&gt; int}
+mt = MethodType.methodType(int.class);
+mh = lookup.findVirtual(java.util.List.class, "size", mt);
+i = (int) mh.invokeExact(java.util.Arrays.asList(1,2,3));
+// invokeExact(Ljava/util/List;)I
+assert(i == 3);
+mt = MethodType.methodType(void.class, String.class);
+mh = lookup.findVirtual(java.io.PrintStream.class, "println", mt);
+mh.invokeExact(System.out, "Hello, world.");
+// invokeExact(Ljava/io/PrintStream;Ljava/lang/String;)V
+{}
+            }}
+    }
+
+    @Test public void testAsVarargsCollector() throws Throwable {
+        {{
+{} /// JAVADOC
+MethodHandle asList = publicLookup()
+  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
+  .asVarargsCollector(Object[].class);
+assertEquals("[]", asList.invokeGeneric().toString());
+assertEquals("[1]", asList.invokeGeneric(1).toString());
+assertEquals("[two, too]", asList.invokeGeneric("two", "too").toString());
+Object[] argv = { "three", "thee", "tee" };
+assertEquals("[three, thee, tee]", asList.invokeGeneric(argv).toString());
+List ls = (List) asList.invokeGeneric((Object)argv);
+assertEquals(1, ls.size());
+assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
+            }}
+    }
+
+    @Test public void testVarargsCollectorSuppression() throws Throwable {
+        {{
+{} /// JAVADOC
+MethodHandle vamh = publicLookup()
+  .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
+  .asVarargsCollector(Object[].class);
+MethodHandle mh = MethodHandles.exactInvoker(vamh.type()).bindTo(vamh);
+assert(vamh.type().equals(mh.type()));
+assertEquals("[1, 2, 3]", vamh.invokeGeneric(1,2,3).toString());
+boolean failed = false;
+try { mh.invokeGeneric(1,2,3); }
+catch (WrongMethodTypeException ex) { failed = true; }
+assert(failed);
+{}
+            }}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,2400 @@
+/*
+ * Copyright (c) 2009, 2011, 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.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.MethodHandles
+ * @compile -source 7 -target 7 -XDallowTransitionalJSR292=no MethodHandlesTest.java
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.lang.invoke.MethodHandlesTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.*;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.reflect.*;
+import java.util.*;
+import org.junit.*;
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
+
+
+/**
+ *
+ * @author jrose
+ */
+public class MethodHandlesTest {
+    // How much output?
+    static int verbosity = 0;
+    static {
+        String vstr = System.getProperty("test.java.lang.invoke.MethodHandlesTest.verbosity");
+        if (vstr != null)  verbosity = Integer.parseInt(vstr);
+    }
+
+    // Set this true during development if you want to fast-forward to
+    // a particular new, non-working test.  Tests which are known to
+    // work (or have recently worked) test this flag and return on true.
+    static boolean CAN_SKIP_WORKING = false;
+    //static { CAN_SKIP_WORKING = true; }
+
+    // Set true to test more calls.  If false, some tests are just
+    // lookups, without exercising the actual method handle.
+    static boolean DO_MORE_CALLS = true;
+
+    @Test
+    public void testFirst() throws Throwable {
+        verbosity += 9; try {
+            // left blank for debugging
+        } finally { printCounts(); verbosity -= 9; }
+    }
+
+    // current failures
+    @Test @Ignore("failure in call to makeRawRetypeOnly in ToGeneric")
+    public void testFail_1() throws Throwable {
+        // AMH.<init>: IllegalArgumentException: bad adapter (conversion=0xfffab300): adapter pushes too many parameters
+        testSpreadArguments(int.class, 0, 6);
+    }
+    @Test @Ignore("failure in JVM when expanding the stack using asm stub for _adapter_spread_args")
+    public void testFail_2() throws Throwable {
+        // if CONV_OP_IMPLEMENTED_MASK includes OP_SPREAD_ARGS, this crashes:
+        testSpreadArguments(Object.class, 0, 2);
+    }
+    @Test @Ignore("IllArgEx failure in call to ToGeneric.make")
+    public void testFail_3() throws Throwable {
+        // ToGeneric.<init>: UnsupportedOperationException: NYI: primitive parameters must follow references; entryType = (int,java.lang.Object)java.lang.Object
+        testSpreadArguments(int.class, 1, 2);
+    }
+    @Test @Ignore("IllArgEx failure in call to ToGeneric.make")
+    public void testFail_4() throws Throwable {
+        // ToGeneric.<init>: UnsupportedOperationException: NYI: primitive parameters must follow references; entryType = (int,java.lang.Object)java.lang.Object
+        testCollectArguments(int.class, 1, 2);
+    }
+    @Test @Ignore("cannot collect leading primitive types")
+    public void testFail_5() throws Throwable {
+        // ToGeneric.<init>: UnsupportedOperationException: NYI: primitive parameters must follow references; entryType = (int,java.lang.Object)java.lang.Object
+        testInvokers(MethodType.genericMethodType(2).changeParameterType(0, int.class));
+    }
+    @Test @Ignore("should not insert arguments beyond MethodHandlePushLimit")
+    public void testFail_6() throws Throwable {
+        // ValueConversions.varargsArray: UnsupportedOperationException: NYI: cannot form a varargs array of length 13
+        testInsertArguments(0, 0, MAX_ARG_INCREASE+10);
+    }
+    static final int MAX_ARG_INCREASE = 3;
+
+    public MethodHandlesTest() {
+    }
+
+    @Before
+    public void checkImplementedPlatform() {
+        boolean platformOK = false;
+        Properties properties = System.getProperties();
+        String vers = properties.getProperty("java.vm.version");
+        String name = properties.getProperty("java.vm.name");
+        String arch = properties.getProperty("os.arch");
+        if ((arch.equals("amd64") || arch.equals("i386") || arch.equals("x86") ||
+             arch.equals("sparc") || arch.equals("sparcv9")) &&
+            (name.contains("Client") || name.contains("Server"))
+            ) {
+            platformOK = true;
+        } else {
+            System.err.println("Skipping tests for unsupported platform: "+Arrays.asList(vers, name, arch));
+        }
+        assumeTrue(platformOK);
+    }
+
+    String testName;
+    static int allPosTests, allNegTests;
+    int posTests, negTests;
+    @After
+    public void printCounts() {
+        if (verbosity >= 2 && (posTests | negTests) != 0) {
+            System.out.println();
+            if (posTests != 0)  System.out.println("=== "+testName+": "+posTests+" positive test cases run");
+            if (negTests != 0)  System.out.println("=== "+testName+": "+negTests+" negative test cases run");
+            allPosTests += posTests;
+            allNegTests += negTests;
+            posTests = negTests = 0;
+        }
+    }
+    void countTest(boolean positive) {
+        if (positive) ++posTests;
+        else          ++negTests;
+    }
+    void countTest() { countTest(true); }
+    void startTest(String name) {
+        if (testName != null)  printCounts();
+        if (verbosity >= 1)
+            System.out.println(name);
+        posTests = negTests = 0;
+        testName = name;
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        calledLog.clear();
+        calledLog.add(null);
+        nextArgVal = INITIAL_ARG_VAL;
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+        int posTests = allPosTests, negTests = allNegTests;
+        if (verbosity >= 2 && (posTests | negTests) != 0) {
+            System.out.println();
+            if (posTests != 0)  System.out.println("=== "+posTests+" total positive test cases");
+            if (negTests != 0)  System.out.println("=== "+negTests+" total negative test cases");
+        }
+    }
+
+    static List<Object> calledLog = new ArrayList<Object>();
+    static Object logEntry(String name, Object... args) {
+        return Arrays.asList(name, Arrays.asList(args));
+    }
+    static Object called(String name, Object... args) {
+        Object entry = logEntry(name, args);
+        calledLog.add(entry);
+        return entry;
+    }
+    static void assertCalled(String name, Object... args) {
+        Object expected = logEntry(name, args);
+        Object actual   = calledLog.get(calledLog.size() - 1);
+        if (expected.equals(actual) && verbosity < 9)  return;
+        System.out.println("assertCalled "+name+":");
+        System.out.println("expected:   "+expected);
+        System.out.println("actual:     "+actual);
+        System.out.println("ex. types:  "+getClasses(expected));
+        System.out.println("act. types: "+getClasses(actual));
+        assertEquals("previous method call", expected, actual);
+    }
+    static void printCalled(MethodHandle target, String name, Object... args) {
+        if (verbosity >= 3)
+            System.out.println("calling MH="+target+" to "+name+Arrays.toString(args));
+    }
+
+    static Object castToWrapper(Object value, Class<?> dst) {
+        Object wrap = null;
+        if (value instanceof Number)
+            wrap = castToWrapperOrNull(((Number)value).longValue(), dst);
+        if (value instanceof Character)
+            wrap = castToWrapperOrNull((char)(Character)value, dst);
+        if (wrap != null)  return wrap;
+        return dst.cast(value);
+    }
+
+    static Object castToWrapperOrNull(long value, Class<?> dst) {
+        if (dst == int.class || dst == Integer.class)
+            return (int)(value);
+        if (dst == long.class || dst == Long.class)
+            return (long)(value);
+        if (dst == char.class || dst == Character.class)
+            return (char)(value);
+        if (dst == short.class || dst == Short.class)
+            return (short)(value);
+        if (dst == float.class || dst == Float.class)
+            return (float)(value);
+        if (dst == double.class || dst == Double.class)
+            return (double)(value);
+        if (dst == byte.class || dst == Byte.class)
+            return (byte)(value);
+        if (dst == boolean.class || dst == boolean.class)
+            return ((value % 29) & 1) == 0;
+        return null;
+    }
+
+    static final int ONE_MILLION = (1000*1000),  // first int value
+                     TEN_BILLION = (10*1000*1000*1000),  // scale factor to reach upper 32 bits
+                     INITIAL_ARG_VAL = ONE_MILLION << 1;  // <<1 makes space for sign bit;
+    static long nextArgVal;
+    static long nextArg(boolean moreBits) {
+        long val = nextArgVal++;
+        long sign = -(val & 1); // alternate signs
+        val >>= 1;
+        if (moreBits)
+            // Guarantee some bits in the high word.
+            // In any case keep the decimal representation simple-looking,
+            // with lots of zeroes, so as not to make the printed decimal
+            // strings unnecessarily noisy.
+            val += (val % ONE_MILLION) * TEN_BILLION;
+        return val ^ sign;
+    }
+    static int nextArg() {
+        // Produce a 32-bit result something like ONE_MILLION+(smallint).
+        // Example: 1_000_042.
+        return (int) nextArg(false);
+    }
+    static long nextArg(Class<?> kind) {
+        if (kind == long.class   || kind == Long.class ||
+            kind == double.class || kind == Double.class)
+            // produce a 64-bit result something like
+            // ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
+            // Example: 10_000_420_001_000_042.
+            return nextArg(true);
+        return (long) nextArg();
+    }
+
+    static Object randomArg(Class<?> param) {
+        Object wrap = castToWrapperOrNull(nextArg(param), param);
+        if (wrap != null) {
+            return wrap;
+        }
+//        import sun.invoke.util.Wrapper;
+//        Wrapper wrap = Wrapper.forBasicType(dst);
+//        if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
+//            wrap = Wrapper.forWrapperType(dst);
+//        if (wrap != Wrapper.OBJECT)
+//            return wrap.wrap(nextArg++);
+        if (param.isInterface()) {
+            for (Class<?> c : param.getClasses()) {
+                if (param.isAssignableFrom(c) && !c.isInterface())
+                    { param = c; break; }
+            }
+        }
+        if (param.isInterface() || param.isAssignableFrom(String.class))
+            return "#"+nextArg();
+        else
+            try {
+                return param.newInstance();
+            } catch (InstantiationException ex) {
+            } catch (IllegalAccessException ex) {
+            }
+        return null;  // random class not Object, String, Integer, etc.
+    }
+    static Object[] randomArgs(Class<?>... params) {
+        Object[] args = new Object[params.length];
+        for (int i = 0; i < args.length; i++)
+            args[i] = randomArg(params[i]);
+        return args;
+    }
+    static Object[] randomArgs(int nargs, Class<?> param) {
+        Object[] args = new Object[nargs];
+        for (int i = 0; i < args.length; i++)
+            args[i] = randomArg(param);
+        return args;
+    }
+
+    static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
+        return Arrays.copyOf(a, a.length, atype);
+    }
+    static <T> T[] cat(T[] a, T... b) {
+        int alen = a.length, blen = b.length;
+        if (blen == 0)  return a;
+        T[] c = Arrays.copyOf(a, alen + blen);
+        System.arraycopy(b, 0, c, alen, blen);
+        return c;
+    }
+    static Integer[] boxAll(int... vx) {
+        Integer[] res = new Integer[vx.length];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = vx[i];
+        }
+        return res;
+    }
+    static Object getClasses(Object x) {
+        if (x == null)  return x;
+        if (x instanceof String)  return x;  // keep the name
+        if (x instanceof List) {
+            // recursively report classes of the list elements
+            Object[] xa = ((List)x).toArray();
+            for (int i = 0; i < xa.length; i++)
+                xa[i] = getClasses(xa[i]);
+            return Arrays.asList(xa);
+        }
+        return x.getClass().getSimpleName();
+    }
+
+    /** Return lambda(arg...[arity]) { new Object[]{ arg... } } */
+    static MethodHandle varargsList(int arity) {
+        return ValueConversions.varargsList(arity);
+    }
+    /** Return lambda(arg...[arity]) { Arrays.asList(arg...) } */
+    static MethodHandle varargsArray(int arity) {
+        return ValueConversions.varargsArray(arity);
+    }
+    /** Variation of varargsList, but with the given rtype. */
+    static MethodHandle varargsList(int arity, Class<?> rtype) {
+        MethodHandle list = varargsList(arity);
+        MethodType listType = list.type().changeReturnType(rtype);
+        if (List.class.isAssignableFrom(rtype) || rtype == void.class || rtype == Object.class) {
+            // OK
+        } else if (rtype.isAssignableFrom(String.class)) {
+            if (LIST_TO_STRING == null)
+                try {
+                    LIST_TO_STRING = PRIVATE.findStatic(PRIVATE.lookupClass(), "listToString",
+                                                        MethodType.methodType(String.class, List.class));
+                } catch (Exception ex) { throw new RuntimeException(ex); }
+            list = MethodHandles.filterReturnValue(list, LIST_TO_STRING);
+        } else if (rtype.isPrimitive()) {
+            if (LIST_TO_INT == null)
+                try {
+                    LIST_TO_INT = PRIVATE.findStatic(PRIVATE.lookupClass(), "listToInt",
+                                                     MethodType.methodType(int.class, List.class));
+                } catch (Exception ex) { throw new RuntimeException(ex); }
+            list = MethodHandles.filterReturnValue(list, LIST_TO_INT);
+            list = MethodHandles.explicitCastArguments(list, listType);
+        } else {
+            throw new RuntimeException("varargsList: "+rtype);
+        }
+        return list.asType(listType);
+    }
+    private static MethodHandle LIST_TO_STRING, LIST_TO_INT;
+    private static String listToString(List x) { return x.toString(); }
+    private static int listToInt(List x) { return x.toString().hashCode(); }
+
+    static MethodHandle changeArgTypes(MethodHandle target, Class<?> argType) {
+        return changeArgTypes(target, 0, 999, argType);
+    }
+    static MethodHandle changeArgTypes(MethodHandle target,
+            int beg, int end, Class<?> argType) {
+        MethodType targetType = target.type();
+        end = Math.min(end, targetType.parameterCount());
+        ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>(targetType.parameterList());
+        Collections.fill(argTypes.subList(beg, end), argType);
+        MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
+        return MethodHandles.convertArguments(target, ttype2);
+    }
+
+    // This lookup is good for all members in and under MethodHandlesTest.
+    static final Lookup PRIVATE = MethodHandles.lookup();
+    // This lookup is good for package-private members but not private ones.
+    static final Lookup PACKAGE = PackageSibling.lookup();
+    // This lookup is good only for public members.
+    static final Lookup PUBLIC  = MethodHandles.publicLookup();
+
+    // Subject methods...
+    static class Example implements IntExample {
+        final String name;
+        public Example() { name = "Example#"+nextArg(); }
+        protected Example(String name) { this.name = name; }
+        protected Example(int x) { this(); called("protected <init>", this, x); }
+        @Override public String toString() { return name; }
+
+        public void            v0()     { called("v0", this); }
+        void                   pkg_v0() { called("pkg_v0", this); }
+        private void           pri_v0() { called("pri_v0", this); }
+        public static void     s0()     { called("s0"); }
+        static void            pkg_s0() { called("pkg_s0"); }
+        private static void    pri_s0() { called("pri_s0"); }
+
+        public Object          v1(Object x) { return called("v1", this, x); }
+        public Object          v2(Object x, Object y) { return called("v2", this, x, y); }
+        public Object          v2(Object x, int    y) { return called("v2", this, x, y); }
+        public Object          v2(int    x, Object y) { return called("v2", this, x, y); }
+        public Object          v2(int    x, int    y) { return called("v2", this, x, y); }
+        public static Object   s1(Object x) { return called("s1", x); }
+        public static Object   s2(int x)    { return called("s2", x); }
+        public static Object   s3(long x)   { return called("s3", x); }
+        public static Object   s4(int x, int y) { return called("s4", x, y); }
+        public static Object   s5(long x, int y) { return called("s5", x, y); }
+        public static Object   s6(int x, long y) { return called("s6", x, y); }
+        public static Object   s7(float x, double y) { return called("s7", x, y); }
+
+        static final Lookup EXAMPLE = MethodHandles.lookup();  // for testing findSpecial
+    }
+    static final Lookup EXAMPLE = Example.EXAMPLE;
+    public static class PubExample extends Example {
+        public PubExample() { super("PubExample#"+nextArg()); }
+    }
+    static class SubExample extends Example {
+        @Override public void  v0()     { called("Sub/v0", this); }
+        @Override void         pkg_v0() { called("Sub/pkg_v0", this); }
+        private      SubExample(int x)  { called("<init>", this, x); }
+        public SubExample() { super("SubExample#"+nextArg()); }
+    }
+    public static interface IntExample {
+        public void            v0();
+        public static class Impl implements IntExample {
+            public void        v0()     { called("Int/v0", this); }
+            final String name;
+            public Impl() { name = "Impl#"+nextArg(); }
+            @Override public String toString() { return name; }
+        }
+    }
+
+    static final Object[][][] ACCESS_CASES = {
+        { { false, PUBLIC }, { false, PACKAGE }, { false, PRIVATE }, { false, EXAMPLE } }, //[0]: all false
+        { { false, PUBLIC }, { false, PACKAGE }, { true,  PRIVATE }, { true,  EXAMPLE } }, //[1]: only PRIVATE
+        { { false, PUBLIC }, { true,  PACKAGE }, { true,  PRIVATE }, { true,  EXAMPLE } }, //[2]: PUBLIC false
+        { { true,  PUBLIC }, { true,  PACKAGE }, { true,  PRIVATE }, { true,  EXAMPLE } }, //[3]: all true
+    };
+
+    static Object[][] accessCases(Class<?> defc, String name, boolean isSpecial) {
+        Object[][] cases;
+        if (name.contains("pri_") || isSpecial) {
+            cases = ACCESS_CASES[1]; // PRIVATE only
+        } else if (name.contains("pkg_") || !Modifier.isPublic(defc.getModifiers())) {
+            cases = ACCESS_CASES[2]; // not PUBLIC
+        } else {
+            assertTrue(name.indexOf('_') < 0);
+            boolean pubc = Modifier.isPublic(defc.getModifiers());
+            if (pubc)
+                cases = ACCESS_CASES[3]; // all access levels
+            else
+                cases = ACCESS_CASES[2]; // PACKAGE but not PUBLIC
+        }
+        if (defc != Example.class && cases[cases.length-1][1] == EXAMPLE)
+            cases = Arrays.copyOfRange(cases, 0, cases.length-1);
+        return cases;
+    }
+    static Object[][] accessCases(Class<?> defc, String name) {
+        return accessCases(defc, name, false);
+    }
+
+    @Test
+    public void testFindStatic() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("findStatic");
+        testFindStatic(PubExample.class, void.class, "s0");
+        testFindStatic(Example.class, void.class, "s0");
+        testFindStatic(Example.class, void.class, "pkg_s0");
+        testFindStatic(Example.class, void.class, "pri_s0");
+
+        testFindStatic(Example.class, Object.class, "s1", Object.class);
+        testFindStatic(Example.class, Object.class, "s2", int.class);
+        testFindStatic(Example.class, Object.class, "s3", long.class);
+        testFindStatic(Example.class, Object.class, "s4", int.class, int.class);
+        testFindStatic(Example.class, Object.class, "s5", long.class, int.class);
+        testFindStatic(Example.class, Object.class, "s6", int.class, long.class);
+        testFindStatic(Example.class, Object.class, "s7", float.class, double.class);
+
+        testFindStatic(false, PRIVATE, Example.class, void.class, "bogus");
+    }
+
+    void testFindStatic(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        for (Object[] ac : accessCases(defc, name)) {
+            testFindStatic((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params);
+        }
+    }
+    void testFindStatic(Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        testFindStatic(true, lookup, defc, ret, name, params);
+    }
+    void testFindStatic(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        countTest(positive);
+        MethodType type = MethodType.methodType(ret, params);
+        MethodHandle target = null;
+        Exception noAccess = null;
+        try {
+            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
+            target = lookup.in(defc).findStatic(defc, name, type);
+        } catch (ReflectiveOperationException ex) {
+            noAccess = ex;
+            if (name.contains("bogus"))
+                assertTrue(noAccess instanceof NoSuchMethodException);
+            else
+                assertTrue(noAccess instanceof IllegalAccessException);
+        }
+        if (verbosity >= 3)
+            System.out.println("findStatic "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
+                    +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(type, target.type());
+        assertNameStringContains(target, name);
+        if (!DO_MORE_CALLS && lookup != PRIVATE)  return;
+        Object[] args = randomArgs(params);
+        printCalled(target, name, args);
+        target.invokeWithArguments(args);
+        assertCalled(name, args);
+        if (verbosity >= 1)
+            System.out.print(':');
+    }
+
+    // rough check of name string
+    static void assertNameStringContains(Object x, String s) {
+        if (x.toString().contains(s))  return;
+        assertEquals(s, x);
+    }
+
+    @Test
+    public void testFindVirtual() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("findVirtual");
+        testFindVirtual(Example.class, void.class, "v0");
+        testFindVirtual(Example.class, void.class, "pkg_v0");
+        testFindVirtual(Example.class, void.class, "pri_v0");
+        testFindVirtual(Example.class, Object.class, "v1", Object.class);
+        testFindVirtual(Example.class, Object.class, "v2", Object.class, Object.class);
+        testFindVirtual(Example.class, Object.class, "v2", Object.class, int.class);
+        testFindVirtual(Example.class, Object.class, "v2", int.class, Object.class);
+        testFindVirtual(Example.class, Object.class, "v2", int.class, int.class);
+        testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus");
+        // test dispatch
+        testFindVirtual(SubExample.class,      SubExample.class, void.class, "Sub/v0");
+        testFindVirtual(SubExample.class,         Example.class, void.class, "Sub/v0");
+        testFindVirtual(SubExample.class,      IntExample.class, void.class, "Sub/v0");
+        testFindVirtual(SubExample.class,      SubExample.class, void.class, "Sub/pkg_v0");
+        testFindVirtual(SubExample.class,         Example.class, void.class, "Sub/pkg_v0");
+        testFindVirtual(Example.class,         IntExample.class, void.class, "v0");
+        testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0");
+    }
+
+    void testFindVirtual(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        Class<?> rcvc = defc;
+        testFindVirtual(rcvc, defc, ret, name, params);
+    }
+    void testFindVirtual(Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        for (Object[] ac : accessCases(defc, name)) {
+            testFindVirtual((Boolean)ac[0], (Lookup)ac[1], rcvc, defc, ret, name, params);
+        }
+    }
+    void testFindVirtual(Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        testFindVirtual(true, lookup, rcvc, defc, ret, name, params);
+    }
+    void testFindVirtual(boolean positive, Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        countTest(positive);
+        String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
+        MethodType type = MethodType.methodType(ret, params);
+        MethodHandle target = null;
+        Exception noAccess = null;
+        try {
+            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
+            target = lookup.in(defc).findVirtual(defc, methodName, type);
+        } catch (ReflectiveOperationException ex) {
+            noAccess = ex;
+            if (name.contains("bogus"))
+                assertTrue(noAccess instanceof NoSuchMethodException);
+            else
+                assertTrue(noAccess instanceof IllegalAccessException);
+        }
+        if (verbosity >= 3)
+            System.out.println("findVirtual "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
+                    +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)defc), params);
+        MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf);
+        assertEquals(typeWithSelf, target.type());
+        assertNameStringContains(target, methodName);
+        if (!DO_MORE_CALLS && lookup != PRIVATE)  return;
+        Object[] argsWithSelf = randomArgs(paramsWithSelf);
+        if (rcvc != defc)  argsWithSelf[0] = randomArg(rcvc);
+        printCalled(target, name, argsWithSelf);
+        target.invokeWithArguments(argsWithSelf);
+        assertCalled(name, argsWithSelf);
+        if (verbosity >= 1)
+            System.out.print(':');
+    }
+
+    @Test
+    public void testFindSpecial() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("findSpecial");
+        testFindSpecial(SubExample.class, Example.class, void.class, "v0");
+        testFindSpecial(SubExample.class, Example.class, void.class, "pkg_v0");
+        // Do some negative testing:
+        testFindSpecial(false, EXAMPLE, SubExample.class, Example.class, void.class, "bogus");
+        testFindSpecial(false, PRIVATE, SubExample.class, Example.class, void.class, "bogus");
+        for (Lookup lookup : new Lookup[]{ PRIVATE, EXAMPLE, PACKAGE, PUBLIC }) {
+            testFindSpecial(false, lookup, Object.class, Example.class, void.class, "v0");
+            testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", int.class);
+            testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "s0");
+        }
+    }
+
+    void testFindSpecial(Class<?> specialCaller,
+                         Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        testFindSpecial(true,  EXAMPLE, specialCaller, defc, ret, name, params);
+        testFindSpecial(true,  PRIVATE, specialCaller, defc, ret, name, params);
+        testFindSpecial(false, PACKAGE, specialCaller, defc, ret, name, params);
+        testFindSpecial(false, PUBLIC,  specialCaller, defc, ret, name, params);
+    }
+    void testFindSpecial(boolean positive, Lookup lookup, Class<?> specialCaller,
+                         Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        countTest(positive);
+        MethodType type = MethodType.methodType(ret, params);
+        MethodHandle target = null;
+        Exception noAccess = null;
+        try {
+            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
+            if (verbosity >= 5)  System.out.println("  lookup => "+lookup.in(specialCaller));
+            target = lookup.in(specialCaller).findSpecial(defc, name, type, specialCaller);
+        } catch (ReflectiveOperationException ex) {
+            noAccess = ex;
+            if (name.contains("bogus"))
+                assertTrue(noAccess instanceof NoSuchMethodException);
+            else
+                assertTrue(noAccess instanceof IllegalAccessException);
+        }
+        if (verbosity >= 3)
+            System.out.println("findSpecial from "+specialCaller.getName()+" to "+defc.getName()+"."+name+"/"+type+" => "+target
+                               +(target == null ? "" : target.type())
+                               +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(specialCaller, target.type().parameterType(0));
+        assertEquals(type,          target.type().dropParameterTypes(0,1));
+        Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)specialCaller), params);
+        MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf);
+        assertNameStringContains(target, name);
+        if (!DO_MORE_CALLS && lookup != PRIVATE && lookup != EXAMPLE)  return;
+        Object[] args = randomArgs(paramsWithSelf);
+        printCalled(target, name, args);
+        target.invokeWithArguments(args);
+        assertCalled(name, args);
+    }
+
+    @Test
+    public void testBind() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("bind");
+        testBind(Example.class, void.class, "v0");
+        testBind(Example.class, void.class, "pkg_v0");
+        testBind(Example.class, void.class, "pri_v0");
+        testBind(Example.class, Object.class, "v1", Object.class);
+        testBind(Example.class, Object.class, "v2", Object.class, Object.class);
+        testBind(Example.class, Object.class, "v2", Object.class, int.class);
+        testBind(Example.class, Object.class, "v2", int.class, Object.class);
+        testBind(Example.class, Object.class, "v2", int.class, int.class);
+        testBind(false, PRIVATE, Example.class, void.class, "bogus");
+        testBind(SubExample.class, void.class, "Sub/v0");
+        testBind(SubExample.class, void.class, "Sub/pkg_v0");
+        testBind(IntExample.Impl.class, void.class, "Int/v0");
+    }
+
+    void testBind(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        for (Object[] ac : accessCases(defc, name)) {
+            testBind((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params);
+        }
+    }
+
+    void testBind(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        countTest(positive);
+        String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
+        MethodType type = MethodType.methodType(ret, params);
+        Object receiver = randomArg(defc);
+        MethodHandle target = null;
+        Exception noAccess = null;
+        try {
+            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
+            target = lookup.in(defc).bind(receiver, methodName, type);
+        } catch (ReflectiveOperationException ex) {
+            noAccess = ex;
+            if (name.contains("bogus"))
+                assertTrue(noAccess instanceof NoSuchMethodException);
+            else
+                assertTrue(noAccess instanceof IllegalAccessException);
+        }
+        if (verbosity >= 3)
+            System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target
+                    +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(type, target.type());
+        Object[] args = randomArgs(params);
+        printCalled(target, name, args);
+        target.invokeWithArguments(args);
+        Object[] argsWithReceiver = cat(array(Object[].class, receiver), args);
+        assertCalled(name, argsWithReceiver);
+        if (verbosity >= 1)
+            System.out.print(':');
+    }
+
+    @Test
+    public void testUnreflect() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("unreflect");
+        testUnreflect(Example.class, true, void.class, "s0");
+        testUnreflect(Example.class, true, void.class, "pkg_s0");
+        testUnreflect(Example.class, true, void.class, "pri_s0");
+
+        testUnreflect(Example.class, true, Object.class, "s1", Object.class);
+        testUnreflect(Example.class, true, Object.class, "s2", int.class);
+        testUnreflect(Example.class, true, Object.class, "s3", long.class);
+        testUnreflect(Example.class, true, Object.class, "s4", int.class, int.class);
+        testUnreflect(Example.class, true, Object.class, "s5", long.class, int.class);
+        testUnreflect(Example.class, true, Object.class, "s6", int.class, long.class);
+
+        testUnreflect(Example.class, false, void.class, "v0");
+        testUnreflect(Example.class, false, void.class, "pkg_v0");
+        testUnreflect(Example.class, false, void.class, "pri_v0");
+        testUnreflect(Example.class, false, Object.class, "v1", Object.class);
+        testUnreflect(Example.class, false, Object.class, "v2", Object.class, Object.class);
+        testUnreflect(Example.class, false, Object.class, "v2", Object.class, int.class);
+        testUnreflect(Example.class, false, Object.class, "v2", int.class, Object.class);
+        testUnreflect(Example.class, false, Object.class, "v2", int.class, int.class);
+    }
+
+    void testUnreflect(Class<?> defc, boolean isStatic, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        for (Object[] ac : accessCases(defc, name)) {
+            testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, (isStatic ? null : defc), ret, name, params);
+        }
+    }
+    void testUnreflect(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        for (Object[] ac : accessCases(defc, name)) {
+            testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params);
+        }
+    }
+    void testUnreflectMaybeSpecial(Class<?> specialCaller,
+                                   boolean positive, Lookup lookup,
+                                   Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        countTest(positive);
+        MethodType type = MethodType.methodType(ret, params);
+        Method rmethod = defc.getDeclaredMethod(name, params);
+        MethodHandle target = null;
+        Exception noAccess = null;
+        boolean isStatic = (rcvc == null);
+        boolean isSpecial = (specialCaller != null);
+        try {
+            if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
+            if (isSpecial)
+                target = lookup.in(specialCaller).unreflectSpecial(rmethod, specialCaller);
+            else
+                target = lookup.in(defc).unreflect(rmethod);
+        } catch (ReflectiveOperationException ex) {
+            noAccess = ex;
+            if (name.contains("bogus"))
+                assertTrue(noAccess instanceof NoSuchMethodException);
+            else
+                assertTrue(noAccess instanceof IllegalAccessException);
+        }
+        if (verbosity >= 3)
+            System.out.println("unreflect"+(isSpecial?"Special":"")+" "+defc.getName()+"."+name+"/"+type
+                               +(!isSpecial ? "" : " specialCaller="+specialCaller)
+                               +( isStatic  ? "" : " receiver="+rcvc)
+                               +" => "+target
+                               +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(isStatic, Modifier.isStatic(rmethod.getModifiers()));
+        Class<?>[] paramsMaybeWithSelf = params;
+        if (!isStatic) {
+            paramsMaybeWithSelf = cat(array(Class[].class, (Class)rcvc), params);
+        }
+        MethodType typeMaybeWithSelf = MethodType.methodType(ret, paramsMaybeWithSelf);
+        if (isStatic) {
+            assertEquals(typeMaybeWithSelf, target.type());
+        } else {
+            if (isSpecial)
+                assertEquals(specialCaller, target.type().parameterType(0));
+            else
+                assertEquals(defc, target.type().parameterType(0));
+            assertEquals(typeMaybeWithSelf, target.type().changeParameterType(0, rcvc));
+        }
+        Object[] argsMaybeWithSelf = randomArgs(paramsMaybeWithSelf);
+        printCalled(target, name, argsMaybeWithSelf);
+        target.invokeWithArguments(argsMaybeWithSelf);
+        assertCalled(name, argsMaybeWithSelf);
+        if (verbosity >= 1)
+            System.out.print(':');
+    }
+
+    void testUnreflectSpecial(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        for (Object[] ac : accessCases(defc, name, true)) {
+            Class<?> specialCaller = rcvc;
+            testUnreflectMaybeSpecial(specialCaller, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params);
+        }
+    }
+
+    @Test
+    public void testUnreflectSpecial() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("unreflectSpecial");
+        testUnreflectSpecial(Example.class,    Example.class, void.class, "v0");
+        testUnreflectSpecial(Example.class, SubExample.class, void.class, "v0");
+        testUnreflectSpecial(Example.class,    Example.class, void.class, "pkg_v0");
+        testUnreflectSpecial(Example.class, SubExample.class, void.class, "pkg_v0");
+        testUnreflectSpecial(Example.class,    Example.class, Object.class, "v2", int.class, int.class);
+        testUnreflectSpecial(Example.class, SubExample.class, Object.class, "v2", int.class, int.class);
+        testUnreflectMaybeSpecial(Example.class, false, PRIVATE, Example.class, Example.class, void.class, "s0");
+    }
+
+    public static class HasFields {
+        boolean fZ = false;
+        byte fB = (byte)'B';
+        short fS = (short)'S';
+        char fC = 'C';
+        int fI = 'I';
+        long fJ = 'J';
+        float fF = 'F';
+        double fD = 'D';
+        static boolean sZ = true;
+        static byte sB = 1+(byte)'B';
+        static short sS = 1+(short)'S';
+        static char sC = 1+'C';
+        static int sI = 1+'I';
+        static long sJ = 1+'J';
+        static float sF = 1+'F';
+        static double sD = 1+'D';
+
+        Object fL = 'L';
+        String fR = "R";
+        static Object sL = 'M';
+        static String sR = "S";
+
+        static final Object[][] CASES;
+        static {
+            ArrayList<Object[]> cases = new ArrayList<Object[]>();
+            Object types[][] = {
+                {'L',Object.class}, {'R',String.class},
+                {'I',int.class}, {'J',long.class},
+                {'F',float.class}, {'D',double.class},
+                {'Z',boolean.class}, {'B',byte.class},
+                {'S',short.class}, {'C',char.class},
+            };
+            HasFields fields = new HasFields();
+            for (Object[] t : types) {
+                for (int kind = 0; kind <= 1; kind++) {
+                    boolean isStatic = (kind != 0);
+                    char btc = (Character)t[0];
+                    String name = (isStatic ? "s" : "f") + btc;
+                    Class<?> type = (Class<?>) t[1];
+                    Object value;
+                    Field field;
+                    try {
+                        field = HasFields.class.getDeclaredField(name);
+                    } catch (Exception ex) {
+                        throw new InternalError("no field HasFields."+name);
+                    }
+                    try {
+                        value = field.get(fields);
+                    } catch (Exception ex) {
+                        throw new InternalError("cannot fetch field HasFields."+name);
+                    }
+                    if (type == float.class) {
+                        float v = 'F';
+                        if (isStatic)  v++;
+                        assertTrue(value.equals(v));
+                    }
+                    assertTrue(name.equals(field.getName()));
+                    assertTrue(type.equals(field.getType()));
+                    assertTrue(isStatic == (Modifier.isStatic(field.getModifiers())));
+                    cases.add(new Object[]{ field, value });
+                }
+            }
+            cases.add(new Object[]{ new Object[]{ false, HasFields.class, "bogus_fD", double.class }, Error.class });
+            cases.add(new Object[]{ new Object[]{ true,  HasFields.class, "bogus_sL", Object.class }, Error.class });
+            CASES = cases.toArray(new Object[0][]);
+        }
+    }
+
+    static final int TEST_UNREFLECT = 1, TEST_FIND_FIELD = 2, TEST_FIND_STATIC = 3, TEST_SETTER = 0x10;
+    static boolean testModeMatches(int testMode, boolean isStatic) {
+        switch (testMode) {
+        case TEST_FIND_STATIC:          return isStatic;
+        case TEST_FIND_FIELD:           return !isStatic;
+        case TEST_UNREFLECT:            return true;  // unreflect matches both
+        }
+        throw new InternalError("testMode="+testMode);
+    }
+
+    @Test
+    public void testUnreflectGetter() throws Throwable {
+        startTest("unreflectGetter");
+        testGetter(TEST_UNREFLECT);
+    }
+    @Test
+    public void testFindGetter() throws Throwable {
+        startTest("findGetter");
+        testGetter(TEST_FIND_FIELD);
+    }
+    @Test
+    public void testFindStaticGetter() throws Throwable {
+        startTest("findStaticGetter");
+        testGetter(TEST_FIND_STATIC);
+    }
+    public void testGetter(int testMode) throws Throwable {
+        Lookup lookup = PRIVATE;  // FIXME: test more lookups than this one
+        for (Object[] c : HasFields.CASES) {
+            boolean positive = (c[1] != Error.class);
+            testGetter(positive, lookup, c[0], c[1], testMode);
+        }
+        testGetter(true, lookup,
+                   new Object[]{ true,  System.class, "out", java.io.PrintStream.class },
+                   System.out, testMode);
+        for (int isStaticN = 0; isStaticN <= 1; isStaticN++) {
+            testGetter(false, lookup,
+                       new Object[]{ (isStaticN != 0), System.class, "bogus", char.class },
+                       null, testMode);
+        }
+    }
+    public void testGetter(boolean positive, MethodHandles.Lookup lookup,
+                           Object fieldRef, Object value, int testMode) throws Throwable {
+        testAccessor(positive, lookup, fieldRef, value, testMode);
+    }
+
+    public void testAccessor(boolean positive, MethodHandles.Lookup lookup,
+                             Object fieldRef, Object value, int testMode0) throws Throwable {
+        boolean isGetter = ((testMode0 & TEST_SETTER) == 0);
+        int testMode = testMode0 & ~TEST_SETTER;
+        boolean isStatic;
+        Class<?> fclass;
+        String   fname;
+        Class<?> ftype;
+        Field f = (fieldRef instanceof Field ? (Field)fieldRef : null);
+        if (f != null) {
+            isStatic = Modifier.isStatic(f.getModifiers());
+            fclass   = f.getDeclaringClass();
+            fname    = f.getName();
+            ftype    = f.getType();
+        } else {
+            Object[] scnt = (Object[]) fieldRef;
+            isStatic = (Boolean)  scnt[0];
+            fclass   = (Class<?>) scnt[1];
+            fname    = (String)   scnt[2];
+            ftype    = (Class<?>) scnt[3];
+            try {
+                f = fclass.getDeclaredField(fname);
+            } catch (ReflectiveOperationException ex) {
+                f = null;
+            }
+        }
+        if (!testModeMatches(testMode, isStatic))  return;
+        if (f == null && testMode == TEST_UNREFLECT)  return;
+        countTest(positive);
+        MethodType expType;
+        if (isGetter)
+            expType = MethodType.methodType(ftype, HasFields.class);
+        else
+            expType = MethodType.methodType(void.class, HasFields.class, ftype);
+        if (isStatic)  expType = expType.dropParameterTypes(0, 1);
+        Exception noAccess = null;
+        MethodHandle mh;
+        try {
+            switch (testMode0) {
+            case TEST_UNREFLECT:   mh = lookup.unreflectGetter(f);                      break;
+            case TEST_FIND_FIELD:  mh = lookup.findGetter(fclass, fname, ftype);        break;
+            case TEST_FIND_STATIC: mh = lookup.findStaticGetter(fclass, fname, ftype);  break;
+            case TEST_SETTER|
+                 TEST_UNREFLECT:   mh = lookup.unreflectSetter(f);                      break;
+            case TEST_SETTER|
+                 TEST_FIND_FIELD:  mh = lookup.findSetter(fclass, fname, ftype);        break;
+            case TEST_SETTER|
+                 TEST_FIND_STATIC: mh = lookup.findStaticSetter(fclass, fname, ftype);  break;
+            default:
+                throw new InternalError("testMode="+testMode);
+            }
+        } catch (ReflectiveOperationException ex) {
+            mh = null;
+            noAccess = ex;
+            if (fname.contains("bogus"))
+                assertTrue(noAccess instanceof NoSuchFieldException);
+            else
+                assertTrue(noAccess instanceof IllegalAccessException);
+        }
+        if (verbosity >= 3)
+            System.out.println("find"+(isStatic?"Static":"")+(isGetter?"Getter":"Setter")+" "+fclass.getName()+"."+fname+"/"+ftype
+                               +" => "+mh
+                               +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw new RuntimeException(noAccess);
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, mh != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals((isStatic ? 0 : 1)+(isGetter ? 0 : 1), mh.type().parameterCount());
+
+
+        assertSame(mh.type(), expType);
+        assertNameStringContains(mh, fname);
+        HasFields fields = new HasFields();
+        Object sawValue;
+        Class<?> vtype = ftype;
+        if (ftype != int.class)  vtype = Object.class;
+        if (isGetter) {
+            mh = MethodHandles.convertArguments(mh, mh.type().generic()
+                                                .changeReturnType(vtype));
+        } else {
+            int last = mh.type().parameterCount() - 1;
+            mh = MethodHandles.convertArguments(mh, mh.type().generic()
+                                                .changeReturnType(void.class)
+                                                .changeParameterType(last, vtype));
+        }
+        if (f != null && f.getDeclaringClass() == HasFields.class) {
+            assertEquals(f.get(fields), value);  // clean to start with
+        }
+        if (isGetter) {
+            Object expValue = value;
+            for (int i = 0; i <= 1; i++) {
+                if (isStatic) {
+                    if (ftype == int.class)
+                        sawValue = (int) mh.invokeExact();  // do these exactly
+                    else
+                        sawValue = mh.invokeExact();
+                } else {
+                    if (ftype == int.class)
+                        sawValue = (int) mh.invokeExact((Object) fields);
+                    else
+                        sawValue = mh.invokeExact((Object) fields);
+                }
+                assertEquals(sawValue, expValue);
+                if (f != null && f.getDeclaringClass() == HasFields.class
+                    && !Modifier.isFinal(f.getModifiers())) {
+                    Object random = randomArg(ftype);
+                    f.set(fields, random);
+                    expValue = random;
+                } else {
+                    break;
+                }
+            }
+        } else {
+            for (int i = 0; i <= 1; i++) {
+                Object putValue = randomArg(ftype);
+                if (isStatic) {
+                    if (ftype == int.class)
+                        mh.invokeExact((int)putValue);  // do these exactly
+                    else
+                        mh.invokeExact(putValue);
+                } else {
+                    if (ftype == int.class)
+                        mh.invokeExact((Object) fields, (int)putValue);
+                    else
+                        mh.invokeExact((Object) fields, putValue);
+                }
+                if (f != null && f.getDeclaringClass() == HasFields.class) {
+                    assertEquals(f.get(fields), putValue);
+                }
+            }
+        }
+        if (f != null && f.getDeclaringClass() == HasFields.class) {
+            f.set(fields, value);  // put it back
+        }
+    }
+
+
+    @Test
+    public void testUnreflectSetter() throws Throwable {
+        startTest("unreflectSetter");
+        testSetter(TEST_UNREFLECT);
+    }
+    @Test
+    public void testFindSetter() throws Throwable {
+        startTest("findSetter");
+        testSetter(TEST_FIND_FIELD);
+    }
+    @Test
+    public void testFindStaticSetter() throws Throwable {
+        startTest("findStaticSetter");
+        testSetter(TEST_FIND_STATIC);
+    }
+    public void testSetter(int testMode) throws Throwable {
+        Lookup lookup = PRIVATE;  // FIXME: test more lookups than this one
+        startTest("unreflectSetter");
+        for (Object[] c : HasFields.CASES) {
+            boolean positive = (c[1] != Error.class);
+            testSetter(positive, lookup, c[0], c[1], testMode);
+        }
+        for (int isStaticN = 0; isStaticN <= 1; isStaticN++) {
+            testSetter(false, lookup,
+                       new Object[]{ (isStaticN != 0), System.class, "bogus", char.class },
+                       null, testMode);
+        }
+    }
+    public void testSetter(boolean positive, MethodHandles.Lookup lookup,
+                           Object fieldRef, Object value, int testMode) throws Throwable {
+        testAccessor(positive, lookup, fieldRef, value, testMode | TEST_SETTER);
+    }
+
+    @Test
+    public void testArrayElementGetter() throws Throwable {
+        startTest("arrayElementGetter");
+        testArrayElementGetterSetter(false);
+    }
+
+    @Test
+    public void testArrayElementSetter() throws Throwable {
+        startTest("arrayElementSetter");
+        testArrayElementGetterSetter(true);
+    }
+
+    public void testArrayElementGetterSetter(boolean testSetter) throws Throwable {
+        testArrayElementGetterSetter(new Object[10], testSetter);
+        testArrayElementGetterSetter(new String[10], testSetter);
+        testArrayElementGetterSetter(new boolean[10], testSetter);
+        testArrayElementGetterSetter(new byte[10], testSetter);
+        testArrayElementGetterSetter(new char[10], testSetter);
+        testArrayElementGetterSetter(new short[10], testSetter);
+        testArrayElementGetterSetter(new int[10], testSetter);
+        testArrayElementGetterSetter(new float[10], testSetter);
+        testArrayElementGetterSetter(new long[10], testSetter);
+        testArrayElementGetterSetter(new double[10], testSetter);
+    }
+
+    public void testArrayElementGetterSetter(Object array, boolean testSetter) throws Throwable {
+        countTest(true);
+        if (verbosity >= 2)  System.out.println("array type = "+array.getClass().getComponentType().getName()+"["+Array.getLength(array)+"]");
+        Class<?> arrayType = array.getClass();
+        Class<?> elemType = arrayType.getComponentType();
+        MethodType expType = !testSetter
+                ? MethodType.methodType(elemType,   arrayType, int.class)
+                : MethodType.methodType(void.class, arrayType, int.class, elemType);
+        MethodHandle mh = !testSetter
+                ? MethodHandles.arrayElementGetter(arrayType)
+                : MethodHandles.arrayElementSetter(arrayType);
+        assertSame(mh.type(), expType);
+        if (elemType != int.class && elemType != boolean.class) {
+            MethodType gtype;
+            if (true) { // FIXME: remove this path (and remove <void> below in the mh.invokes)
+                gtype = mh.type().changeParameterType(0, Object.class);
+                if (testSetter)
+                    gtype = gtype.changeParameterType(2, Object.class);
+                else
+                    gtype = gtype.changeReturnType(Object.class);
+            } else
+                // FIXME: This simpler path hits a bug in convertArguments => ToGeneric
+                gtype = mh.type().generic().changeParameterType(1, int.class);
+            mh = MethodHandles.convertArguments(mh, gtype);
+        }
+        Object sawValue, expValue;
+        List<Object> model = array2list(array);
+        int length = Array.getLength(array);
+        for (int i = 0; i < length; i++) {
+            // update array element
+            Object random = randomArg(elemType);
+            model.set(i, random);
+            if (testSetter) {
+                if (elemType == int.class)
+                    mh.invokeExact((int[]) array, i, (int)random);
+                else if (elemType == boolean.class)
+                    mh.invokeExact((boolean[]) array, i, (boolean)random);
+                else
+                    mh.invokeExact(array, i, random);
+                assertEquals(model, array2list(array));
+            } else {
+                Array.set(array, i, random);
+            }
+            if (verbosity >= 5) {
+                List<Object> array2list = array2list(array);
+                System.out.println("a["+i+"]="+random+" => "+array2list);
+                if (!array2list.equals(model))
+                    System.out.println("***   != "+model);
+            }
+            // observe array element
+            sawValue = Array.get(array, i);
+            if (!testSetter) {
+                expValue = sawValue;
+                if (elemType == int.class)
+                    sawValue = (int) mh.invokeExact((int[]) array, i);
+                else if (elemType == boolean.class)
+                    sawValue = (boolean) mh.invokeExact((boolean[]) array, i);
+                else
+                    sawValue = mh.invokeExact(array, i);
+                assertEquals(sawValue, expValue);
+                assertEquals(model, array2list(array));
+            }
+        }
+    }
+
+    List<Object> array2list(Object array) {
+        int length = Array.getLength(array);
+        ArrayList<Object> model = new ArrayList<Object>(length);
+        for (int i = 0; i < length; i++)
+            model.add(Array.get(array, i));
+        return model;
+    }
+
+    static class Callee {
+        static Object id() { return called("id"); }
+        static Object id(Object x) { return called("id", x); }
+        static Object id(Object x, Object y) { return called("id", x, y); }
+        static Object id(Object x, Object y, Object z) { return called("id", x, y, z); }
+        static Object id(Object... vx) { return called("id", vx); }
+        static MethodHandle ofType(int n) {
+            return ofType(Object.class, n);
+        }
+        static MethodHandle ofType(Class<?> rtype, int n) {
+            if (n == -1)
+                return ofType(MethodType.methodType(rtype, Object[].class));
+            return ofType(MethodType.genericMethodType(n).changeReturnType(rtype));
+        }
+        static MethodHandle ofType(Class<?> rtype, Class<?>... ptypes) {
+            return ofType(MethodType.methodType(rtype, ptypes));
+        }
+        static MethodHandle ofType(MethodType type) {
+            Class<?> rtype = type.returnType();
+            String pfx = "";
+            if (rtype != Object.class)
+                pfx = rtype.getSimpleName().substring(0, 1).toLowerCase();
+            String name = pfx+"id";
+            try {
+                return PRIVATE.findStatic(Callee.class, name, type);
+            } catch (Exception ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+    }
+
+    @Test
+    public void testConvertArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("convertArguments");
+        testConvert(Callee.ofType(1), null, "id", int.class);
+        testConvert(Callee.ofType(1), null, "id", String.class);
+        testConvert(Callee.ofType(1), null, "id", Integer.class);
+        testConvert(Callee.ofType(1), null, "id", short.class);
+        testConvert(Callee.ofType(1), null, "id", char.class);
+        testConvert(Callee.ofType(1), null, "id", byte.class);
+    }
+
+    void testConvert(MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable {
+        testConvert(true, false, id, rtype, name, params);
+        testConvert(true, true,  id, rtype, name, params);
+    }
+
+    void testConvert(boolean positive, boolean useAsType,
+                     MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable {
+        countTest(positive);
+        MethodType idType = id.type();
+        if (rtype == null)  rtype = idType.returnType();
+        for (int i = 0; i < params.length; i++) {
+            if (params[i] == null)  params[i] = idType.parameterType(i);
+        }
+        // simulate the pairwise conversion
+        MethodType newType = MethodType.methodType(rtype, params);
+        Object[] args = randomArgs(newType.parameterArray());
+        Object[] convArgs = args.clone();
+        for (int i = 0; i < args.length; i++) {
+            Class<?> src = newType.parameterType(i);
+            Class<?> dst = idType.parameterType(i);
+            if (src != dst)
+                convArgs[i] = castToWrapper(convArgs[i], dst);
+        }
+        Object convResult = id.invokeWithArguments(convArgs);
+        {
+            Class<?> dst = newType.returnType();
+            Class<?> src = idType.returnType();
+            if (src != dst)
+                convResult = castToWrapper(convResult, dst);
+        }
+        MethodHandle target = null;
+        RuntimeException error = null;
+        try {
+            if (useAsType)
+                target = id.asType(newType);
+            else
+                target = MethodHandles.convertArguments(id, newType);
+        } catch (RuntimeException ex) {
+            error = ex;
+        }
+        if (verbosity >= 3)
+            System.out.println("convert "+id+ " to "+newType+" => "+target
+                    +(error == null ? "" : " !! "+error));
+        if (positive && error != null)  throw error;
+        assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(newType, target.type());
+        printCalled(target, id.toString(), args);
+        Object result = target.invokeWithArguments(args);
+        assertCalled(name, convArgs);
+        assertEquals(convResult, result);
+        if (verbosity >= 1)
+            System.out.print(':');
+    }
+
+    @Test
+    public void testVarargsCollector() throws Throwable {
+        MethodHandle vac0 = PRIVATE.findStatic(MethodHandlesTest.class, "called",
+                               MethodType.methodType(Object.class, String.class, Object[].class));
+        vac0 = vac0.bindTo("vac");
+        MethodHandle vac = vac0.asVarargsCollector(Object[].class);
+        testConvert(true,  true,  vac.asType(MethodType.genericMethodType(0)), null, "vac");
+        testConvert(true,  true,  vac.asType(MethodType.genericMethodType(0)), null, "vac");
+        for (Class<?> at : new Class[] { Object.class, String.class, Integer.class }) {
+            testConvert(true,  true,  vac.asType(MethodType.genericMethodType(1)), null, "vac", at);
+            testConvert(true,  true,  vac.asType(MethodType.genericMethodType(2)), null, "vac", at, at);
+        }
+    }
+
+    @Test
+    public void testPermuteArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("permuteArguments");
+        testPermuteArguments(4, Integer.class,  2, String.class,  0);
+        //testPermuteArguments(6, Integer.class,  0, null,         30);
+        //testPermuteArguments(4, Integer.class,  1, int.class,     6);
+    }
+    public void testPermuteArguments(int max, Class<?> type1, int t2c, Class<?> type2, int dilution) throws Throwable {
+        if (verbosity >= 2)
+            System.out.println("permuteArguments "+max+"*"+type1.getName()
+                    +(t2c==0?"":"/"+t2c+"*"+type2.getName())
+                    +(dilution > 0 ? " with dilution "+dilution : ""));
+        int t2pos = t2c == 0 ? 0 : 1;
+        for (int inargs = t2pos+1; inargs <= max; inargs++) {
+            Class<?>[] types = new Class<?>[inargs];
+            Arrays.fill(types, type1);
+            if (t2c != 0) {
+                // Fill in a middle range with type2:
+                Arrays.fill(types, t2pos, Math.min(t2pos+t2c, inargs), type2);
+            }
+            Object[] args = randomArgs(types);
+            int numcases = 1;
+            for (int outargs = 0; outargs <= max; outargs++) {
+                if (outargs - inargs >= MAX_ARG_INCREASE)  continue;
+                int[] reorder = new int[outargs];
+                int casStep = dilution + 1;
+                // Avoid some common factors:
+                while ((casStep > 2 && casStep % 2 == 0 && inargs % 2 == 0) ||
+                       (casStep > 3 && casStep % 3 == 0 && inargs % 3 == 0))
+                    casStep++;
+                for (int cas = 0; cas < numcases; cas += casStep) {
+                    for (int i = 0, c = cas; i < outargs; i++) {
+                        reorder[i] = c % inargs;
+                        c /= inargs;
+                    }
+                    testPermuteArguments(args, types, reorder);
+                }
+                numcases *= inargs;
+                if (dilution > 10 && outargs >= 4) {
+                    // Do some special patterns, which we probably missed.
+                    // Replication of a single argument or argument pair.
+                    for (int i = 0; i < inargs; i++) {
+                        Arrays.fill(reorder, i);
+                        testPermuteArguments(args, types, reorder);
+                        for (int d = 1; d <= 2; d++) {
+                            if (i + d >= inargs)  continue;
+                            for (int j = 1; j < outargs; j += 2)
+                                reorder[j] += 1;
+                            testPermuteArguments(args, types, reorder);
+                            testPermuteArguments(args, types, reverse(reorder));
+                        }
+                    }
+                    // Repetition of a sequence of 3 or more arguments.
+                    for (int i = 1; i < inargs; i++) {
+                        for (int len = 3; len <= inargs; len++) {
+                            for (int j = 0; j < outargs; j++)
+                                reorder[j] = (i + (j % len)) % inargs;
+                            testPermuteArguments(args, types, reorder);
+                            testPermuteArguments(args, types, reverse(reorder));
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    static int[] reverse(int[] reorder) {
+        reorder = reorder.clone();
+        for (int i = 0, imax = reorder.length / 2; i < imax; i++) {
+            int j = reorder.length - 1 - i;
+            int tem = reorder[i];
+            reorder[i] = reorder[j];
+            reorder[j] = tem;
+        }
+        return reorder;
+    }
+
+    void testPermuteArguments(Object[] args, Class<?>[] types, int[] reorder) throws Throwable {
+        countTest();
+        if (args == null && types == null) {
+            int max = 0;
+            for (int j : reorder) {
+                if (max < j)  max = j;
+            }
+            args = randomArgs(max+1, Integer.class);
+        }
+        if (args == null) {
+            args = randomArgs(types);
+        }
+        if (types == null) {
+            types = new Class<?>[args.length];
+            for (int i = 0; i < args.length; i++)
+                types[i] = args[i].getClass();
+        }
+        int inargs = args.length, outargs = reorder.length;
+        assertTrue(inargs == types.length);
+        if (verbosity >= 3)
+            System.out.println("permuteArguments "+Arrays.toString(reorder));
+        Object[] permArgs = new Object[outargs];
+        Class<?>[] permTypes = new Class<?>[outargs];
+        for (int i = 0; i < outargs; i++) {
+            permArgs[i] = args[reorder[i]];
+            permTypes[i] = types[reorder[i]];
+        }
+        if (verbosity >= 4) {
+            System.out.println("in args:   "+Arrays.asList(args));
+            System.out.println("out args:  "+Arrays.asList(permArgs));
+            System.out.println("in types:  "+Arrays.asList(types));
+            System.out.println("out types: "+Arrays.asList(permTypes));
+        }
+        MethodType inType  = MethodType.methodType(Object.class, types);
+        MethodType outType = MethodType.methodType(Object.class, permTypes);
+        MethodHandle target = MethodHandles.convertArguments(varargsList(outargs), outType);
+        MethodHandle newTarget = MethodHandles.permuteArguments(target, inType, reorder);
+        Object result = newTarget.invokeWithArguments(args);
+        Object expected = Arrays.asList(permArgs);
+        assertEquals(expected, result);
+    }
+
+
+    @Test
+    public void testSpreadArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("spreadArguments");
+        for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
+            if (verbosity >= 3)
+                System.out.println("spreadArguments "+argType);
+            // FIXME: enable _adapter_spread_args and fix Fail_2
+            for (int nargs = 0; nargs < 10; nargs++) {
+                if (argType == int.class && nargs >= 6)  continue; // FIXME Fail_1
+                for (int pos = 0; pos < nargs; pos++) {
+                    if (argType == int.class && pos > 0)  continue; // FIXME Fail_3
+                     testSpreadArguments(argType, pos, nargs);
+                }
+            }
+        }
+    }
+    public void testSpreadArguments(Class<?> argType, int pos, int nargs) throws Throwable {
+        countTest();
+        MethodHandle target = varargsArray(nargs);
+        MethodHandle target2 = changeArgTypes(target, argType);
+        if (verbosity >= 3)
+            System.out.println("spread into "+target2+" ["+pos+".."+nargs+"]");
+        Object[] args = randomArgs(target2.type().parameterArray());
+        // make sure the target does what we think it does:
+        if (pos == 0 && nargs < 5) {
+            Object[] check = (Object[]) target.invokeWithArguments(args);
+            assertArrayEquals(args, check);
+            switch (nargs) {
+                case 0:
+                    check = (Object[]) target.invokeExact();
+                    assertArrayEquals(args, check);
+                    break;
+                case 1:
+                    check = (Object[]) target.invokeExact(args[0]);
+                    assertArrayEquals(args, check);
+                    break;
+                case 2:
+                    check = (Object[]) target.invokeExact(args[0], args[1]);
+                    assertArrayEquals(args, check);
+                    break;
+            }
+        }
+        List<Class<?>> newParams = new ArrayList<Class<?>>(target2.type().parameterList());
+        {   // modify newParams in place
+            List<Class<?>> spreadParams = newParams.subList(pos, nargs);
+            spreadParams.clear(); spreadParams.add(Object[].class);
+        }
+        MethodType newType = MethodType.methodType(Object.class, newParams);
+        MethodHandle result = target2.asSpreader(Object[].class, nargs-pos).asType(newType);
+        Object[] returnValue;
+        if (pos == 0) {
+            // In the following line, the first cast implies
+            // normal Object return value for the MH call (Object[])->Object,
+            // while the second cast dynamically converts to an Object array.
+            // Such a double cast is typical of MH.invokeExact.
+            returnValue = (Object[]) (Object) result.invokeExact(args);
+        } else {
+            Object[] args1 = Arrays.copyOfRange(args, 0, pos+1);
+            args1[pos] = Arrays.copyOfRange(args, pos, args.length);
+            returnValue = (Object[]) result.invokeWithArguments(args1);
+        }
+        assertArrayEquals(args, returnValue);
+    }
+
+    @Test
+    public void testCollectArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("collectArguments");
+        for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
+            if (verbosity >= 3)
+                System.out.println("collectArguments "+argType);
+            for (int nargs = 0; nargs < 10; nargs++) {
+                for (int pos = 0; pos < nargs; pos++) {
+                    if (argType == int.class)  continue; // FIXME Fail_4
+                    testCollectArguments(argType, pos, nargs);
+                }
+            }
+        }
+    }
+    public void testCollectArguments(Class<?> argType, int pos, int nargs) throws Throwable {
+        countTest();
+        // fake up a MH with the same type as the desired adapter:
+        MethodHandle fake = varargsArray(nargs);
+        fake = changeArgTypes(fake, argType);
+        MethodType newType = fake.type();
+        Object[] args = randomArgs(newType.parameterArray());
+        // here is what should happen:
+        Object[] collectedArgs = Arrays.copyOfRange(args, 0, pos+1);
+        collectedArgs[pos] = Arrays.copyOfRange(args, pos, args.length);
+        // here is the MH which will witness the collected argument tail:
+        MethodHandle target = varargsArray(pos+1);
+        target = changeArgTypes(target, 0, pos, argType);
+        target = changeArgTypes(target, pos, pos+1, Object[].class);
+        if (verbosity >= 3)
+            System.out.println("collect from "+Arrays.asList(args)+" ["+pos+".."+nargs+"]");
+        MethodHandle result = target.asCollector(Object[].class, nargs-pos).asType(newType);
+        Object[] returnValue = (Object[]) result.invokeWithArguments(args);
+//        assertTrue(returnValue.length == pos+1 && returnValue[pos] instanceof Object[]);
+//        returnValue[pos] = Arrays.asList((Object[]) returnValue[pos]);
+//        collectedArgs[pos] = Arrays.asList((Object[]) collectedArgs[pos]);
+        assertArrayEquals(collectedArgs, returnValue);
+    }
+
+    @Test
+    public void testInsertArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("insertArguments");
+        for (int nargs = 0; nargs <= 4; nargs++) {
+            for (int ins = 0; ins <= 4; ins++) {
+                if (ins > MAX_ARG_INCREASE)  continue;  // FIXME Fail_6
+                for (int pos = 0; pos <= nargs; pos++) {
+                    testInsertArguments(nargs, pos, ins);
+                }
+            }
+        }
+    }
+
+    void testInsertArguments(int nargs, int pos, int ins) throws Throwable {
+        countTest();
+        MethodHandle target = varargsArray(nargs + ins);
+        Object[] args = randomArgs(target.type().parameterArray());
+        List<Object> resList = Arrays.asList(args);
+        List<Object> argsToPass = new ArrayList<Object>(resList);
+        List<Object> argsToInsert = argsToPass.subList(pos, pos + ins);
+        if (verbosity >= 3)
+            System.out.println("insert: "+argsToInsert+" into "+target);
+        MethodHandle target2 = MethodHandles.insertArguments(target, pos,
+                (Object[]) argsToInsert.toArray());
+        argsToInsert.clear();  // remove from argsToInsert
+        Object res2 = target2.invokeWithArguments(argsToPass);
+        Object res2List = Arrays.asList((Object[])res2);
+        if (verbosity >= 3)
+            System.out.println("result: "+res2List);
+        //if (!resList.equals(res2List))
+        //    System.out.println("*** fail at n/p/i = "+nargs+"/"+pos+"/"+ins+": "+resList+" => "+res2List);
+        assertEquals(resList, res2List);
+    }
+
+    @Test
+    public void testFilterReturnValue() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("filterReturnValue");
+        Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass();
+        assertTrue(List.class.isAssignableFrom(classOfVCList));
+        for (int nargs = 0; nargs <= 3; nargs++) {
+            for (Class<?> rtype : new Class[] { Object.class,
+                                                List.class,
+                                                int.class,
+                                                //byte.class, //FIXME: add this
+                                                //long.class, //FIXME: add this
+                                                CharSequence.class,
+                                                String.class }) {
+                testFilterReturnValue(nargs, rtype);
+            }
+        }
+    }
+
+    void testFilterReturnValue(int nargs, Class<?> rtype) throws Throwable {
+        countTest();
+        MethodHandle target = varargsList(nargs, rtype);
+        MethodHandle filter;
+        if (List.class.isAssignableFrom(rtype) || rtype.isAssignableFrom(List.class))
+            filter = varargsList(1);  // add another layer of list-ness
+        else
+            filter = MethodHandles.identity(rtype);
+        filter = filter.asType(MethodType.methodType(target.type().returnType(), rtype));
+        Object[] argsToPass = randomArgs(nargs, Object.class);
+        if (verbosity >= 3)
+            System.out.println("filter "+target+" to "+rtype.getSimpleName()+" with "+filter);
+        MethodHandle target2 = MethodHandles.filterReturnValue(target, filter);
+        if (verbosity >= 4)
+            System.out.println("filtered target: "+target2);
+        // Simulate expected effect of filter on return value:
+        Object unfiltered = target.invokeWithArguments(argsToPass);
+        Object expected = filter.invokeWithArguments(unfiltered);
+        if (verbosity >= 4)
+            System.out.println("unfiltered: "+unfiltered+" : "+unfiltered.getClass().getSimpleName());
+        if (verbosity >= 4)
+            System.out.println("expected: "+expected+" : "+expected.getClass().getSimpleName());
+        Object result = target2.invokeWithArguments(argsToPass);
+        if (verbosity >= 3)
+            System.out.println("result: "+result+" : "+result.getClass().getSimpleName());
+        if (!expected.equals(result))
+            System.out.println("*** fail at n/rt = "+nargs+"/"+rtype.getSimpleName()+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected);
+        assertEquals(expected, result);
+    }
+
+    @Test
+    public void testFilterArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("filterArguments");
+        for (int nargs = 1; nargs <= 6; nargs++) {
+            for (int pos = 0; pos < nargs; pos++) {
+                testFilterArguments(nargs, pos);
+            }
+        }
+    }
+
+    void testFilterArguments(int nargs, int pos) throws Throwable {
+        countTest();
+        MethodHandle target = varargsList(nargs);
+        MethodHandle filter = varargsList(1);
+        filter = MethodHandles.convertArguments(filter, filter.type().generic());
+        Object[] argsToPass = randomArgs(nargs, Object.class);
+        if (verbosity >= 3)
+            System.out.println("filter "+target+" at "+pos+" with "+filter);
+        MethodHandle target2 = MethodHandles.filterArguments(target, pos, filter);
+        // Simulate expected effect of filter on arglist:
+        Object[] filteredArgs = argsToPass.clone();
+        filteredArgs[pos] = filter.invokeExact(filteredArgs[pos]);
+        List<Object> expected = Arrays.asList(filteredArgs);
+        Object result = target2.invokeWithArguments(argsToPass);
+        if (verbosity >= 3)
+            System.out.println("result: "+result);
+        if (!expected.equals(result))
+            System.out.println("*** fail at n/p = "+nargs+"/"+pos+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected);
+        assertEquals(expected, result);
+    }
+
+    @Test
+    public void testFoldArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("foldArguments");
+        for (int nargs = 0; nargs <= 4; nargs++) {
+            for (int fold = 0; fold <= nargs; fold++) {
+                for (int pos = 0; pos <= nargs; pos++) {
+                    testFoldArguments(nargs, pos, fold);
+                }
+            }
+        }
+    }
+
+    void testFoldArguments(int nargs, int pos, int fold) throws Throwable {
+        if (pos != 0)  return;  // can fold only at pos=0 for now
+        countTest();
+        MethodHandle target = varargsList(1 + nargs);
+        MethodHandle combine = varargsList(fold).asType(MethodType.genericMethodType(fold));
+        List<Object> argsToPass = Arrays.asList(randomArgs(nargs, Object.class));
+        if (verbosity >= 3)
+            System.out.println("fold "+target+" with "+combine);
+        MethodHandle target2 = MethodHandles.foldArguments(target, combine);
+        // Simulate expected effect of combiner on arglist:
+        List<Object> expected = new ArrayList<Object>(argsToPass);
+        List<Object> argsToFold = expected.subList(pos, pos + fold);
+        if (verbosity >= 3)
+            System.out.println("fold: "+argsToFold+" into "+target2);
+        Object foldedArgs = combine.invokeWithArguments(argsToFold);
+        argsToFold.add(0, foldedArgs);
+        Object result = target2.invokeWithArguments(argsToPass);
+        if (verbosity >= 3)
+            System.out.println("result: "+result);
+        if (!expected.equals(result))
+            System.out.println("*** fail at n/p/f = "+nargs+"/"+pos+"/"+fold+": "+argsToPass+" => "+result+" != "+expected);
+        assertEquals(expected, result);
+    }
+
+    @Test
+    public void testDropArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("dropArguments");
+        for (int nargs = 0; nargs <= 4; nargs++) {
+            for (int drop = 1; drop <= 4; drop++) {
+                for (int pos = 0; pos <= nargs; pos++) {
+                    testDropArguments(nargs, pos, drop);
+                }
+            }
+        }
+    }
+
+    void testDropArguments(int nargs, int pos, int drop) throws Throwable {
+        countTest();
+        MethodHandle target = varargsArray(nargs);
+        Object[] args = randomArgs(target.type().parameterArray());
+        MethodHandle target2 = MethodHandles.dropArguments(target, pos,
+                Collections.nCopies(drop, Object.class).toArray(new Class[0]));
+        List<Object> resList = Arrays.asList(args);
+        List<Object> argsToDrop = new ArrayList<Object>(resList);
+        for (int i = drop; i > 0; i--) {
+            argsToDrop.add(pos, "blort#"+i);
+        }
+        Object res2 = target2.invokeWithArguments(argsToDrop);
+        Object res2List = Arrays.asList((Object[])res2);
+        //if (!resList.equals(res2List))
+        //    System.out.println("*** fail at n/p/d = "+nargs+"/"+pos+"/"+drop+": "+argsToDrop+" => "+res2List);
+        assertEquals(resList, res2List);
+    }
+
+    @Test
+    public void testInvokers() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker");
+        // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker
+        Set<MethodType> done = new HashSet<MethodType>();
+        for (int i = 0; i <= 6; i++) {
+            MethodType gtype = MethodType.genericMethodType(i);
+            for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
+                for (int j = -1; j < i; j++) {
+                    MethodType type = gtype;
+                    if (j < 0)
+                        type = type.changeReturnType(argType);
+                    else if (argType == void.class)
+                        continue;
+                    else
+                        type = type.changeParameterType(j, argType);
+                    if (argType.isPrimitive() && j != i-1)  continue; // FIXME Fail_5
+                    if (done.add(type))
+                        testInvokers(type);
+                    MethodType vtype = type.changeReturnType(void.class);
+                    if (done.add(vtype))
+                        testInvokers(vtype);
+                }
+            }
+        }
+    }
+
+    public void testInvokers(MethodType type) throws Throwable {
+        if (verbosity >= 3)
+            System.out.println("test invokers for "+type);
+        int nargs = type.parameterCount();
+        boolean testRetCode = type.returnType() != void.class;
+        MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "invokee",
+                                MethodType.genericMethodType(0, true));
+        assertTrue(target.isVarargsCollector());
+        target = target.asType(type);
+        Object[] args = randomArgs(type.parameterArray());
+        List<Object> targetPlusArgs = new ArrayList<Object>(Arrays.asList(args));
+        targetPlusArgs.add(0, target);
+        int code = (Integer) invokee(args);
+        Object log = logEntry("invokee", args);
+        assertEquals(log.hashCode(), code);
+        assertCalled("invokee", args);
+        MethodHandle inv;
+        Object result;
+        // exact invoker
+        countTest();
+        calledLog.clear();
+        inv = MethodHandles.exactInvoker(type);
+        result = inv.invokeWithArguments(targetPlusArgs);
+        if (testRetCode)  assertEquals(code, result);
+        assertCalled("invokee", args);
+        // generic invoker
+        countTest();
+        inv = MethodHandles.genericInvoker(type);
+        if (nargs <= 3) {
+            calledLog.clear();
+            switch (nargs) {
+            case 0:
+                result = inv.invokeExact(target);
+                break;
+            case 1:
+                result = inv.invokeExact(target, args[0]);
+                break;
+            case 2:
+                result = inv.invokeExact(target, args[0], args[1]);
+                break;
+            case 3:
+                result = inv.invokeExact(target, args[0], args[1], args[2]);
+                break;
+            }
+            if (testRetCode)  assertEquals(code, result);
+            assertCalled("invokee", args);
+        }
+        calledLog.clear();
+        result = inv.invokeWithArguments(targetPlusArgs);
+        if (testRetCode)  assertEquals(code, result);
+        assertCalled("invokee", args);
+        // varargs invoker #0
+        calledLog.clear();
+        inv = MethodHandles.spreadInvoker(type, 0);
+        result = inv.invokeExact(target, args);
+        if (testRetCode)  assertEquals(code, result);
+        assertCalled("invokee", args);
+        if (nargs >= 1) {
+            // varargs invoker #1
+            calledLog.clear();
+            inv = MethodHandles.spreadInvoker(type, 1);
+            result = inv.invokeExact(target, args[0], Arrays.copyOfRange(args, 1, nargs));
+            if (testRetCode)  assertEquals(code, result);
+            assertCalled("invokee", args);
+        }
+        if (nargs >= 2) {
+            // varargs invoker #2
+            calledLog.clear();
+            inv = MethodHandles.spreadInvoker(type, 2);
+            result = inv.invokeExact(target, args[0], args[1], Arrays.copyOfRange(args, 2, nargs));
+            if (testRetCode)  assertEquals(code, result);
+            assertCalled("invokee", args);
+        }
+        if (nargs >= 3) {
+            // varargs invoker #3
+            calledLog.clear();
+            inv = MethodHandles.spreadInvoker(type, 3);
+            result = inv.invokeExact(target, args[0], args[1], args[2], Arrays.copyOfRange(args, 3, nargs));
+            if (testRetCode)  assertEquals(code, result);
+            assertCalled("invokee", args);
+        }
+        for (int k = 0; k <= nargs; k++) {
+            // varargs invoker #0..N
+            countTest();
+            calledLog.clear();
+            inv = MethodHandles.spreadInvoker(type, k);
+            List<Object> targetPlusVarArgs = new ArrayList<Object>(targetPlusArgs);
+            List<Object> tailList = targetPlusVarArgs.subList(1+k, 1+nargs);
+            Object[] tail = tailList.toArray();
+            tailList.clear(); tailList.add(tail);
+            result = inv.invokeWithArguments(targetPlusVarArgs);
+            if (testRetCode)  assertEquals(code, result);
+            assertCalled("invokee", args);
+        }
+
+        // dynamic invoker
+        countTest();
+        CallSite site = new MutableCallSite(type);
+        inv = site.dynamicInvoker();
+
+        // see if we get the result of the original target:
+        try {
+            result = inv.invokeWithArguments(args);
+            assertTrue("should not reach here", false);
+        } catch (IllegalStateException ex) {
+            String msg = ex.getMessage();
+            assertTrue(msg, msg.contains("site"));
+        }
+
+        // set new target after invoker is created, to make sure we track target
+        site.setTarget(target);
+        calledLog.clear();
+        result = inv.invokeWithArguments(args);
+        if (testRetCode)  assertEquals(code, result);
+        assertCalled("invokee", args);
+    }
+
+    static Object invokee(Object... args) {
+        return called("invokee", args).hashCode();
+    }
+
+    private static final String MISSING_ARG = "missingArg";
+    static Object targetIfEquals() {
+        return called("targetIfEquals");
+    }
+    static Object fallbackIfNotEquals() {
+        return called("fallbackIfNotEquals");
+    }
+    static Object targetIfEquals(Object x) {
+        assertEquals(x, MISSING_ARG);
+        return called("targetIfEquals", x);
+    }
+    static Object fallbackIfNotEquals(Object x) {
+        assertFalse(x.toString(), x.equals(MISSING_ARG));
+        return called("fallbackIfNotEquals", x);
+    }
+    static Object targetIfEquals(Object x, Object y) {
+        assertEquals(x, y);
+        return called("targetIfEquals", x, y);
+    }
+    static Object fallbackIfNotEquals(Object x, Object y) {
+        assertFalse(x.toString(), x.equals(y));
+        return called("fallbackIfNotEquals", x, y);
+    }
+    static Object targetIfEquals(Object x, Object y, Object z) {
+        assertEquals(x, y);
+        return called("targetIfEquals", x, y, z);
+    }
+    static Object fallbackIfNotEquals(Object x, Object y, Object z) {
+        assertFalse(x.toString(), x.equals(y));
+        return called("fallbackIfNotEquals", x, y, z);
+    }
+
+    @Test
+    public void testGuardWithTest() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("guardWithTest");
+        for (int nargs = 0; nargs <= 3; nargs++) {
+            if (nargs != 2)  continue;  // FIXME: test more later
+            testGuardWithTest(nargs, Object.class);
+            testGuardWithTest(nargs, String.class);
+        }
+    }
+    void testGuardWithTest(int nargs, Class<?> argClass) throws Throwable {
+        countTest();
+        MethodHandle test = PRIVATE.findVirtual(Object.class, "equals", MethodType.methodType(boolean.class, Object.class));
+        MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "targetIfEquals", MethodType.genericMethodType(nargs));
+        MethodHandle fallback = PRIVATE.findStatic(MethodHandlesTest.class, "fallbackIfNotEquals", MethodType.genericMethodType(nargs));
+        while (test.type().parameterCount() < nargs)
+            test = MethodHandles.dropArguments(test, test.type().parameterCount()-1, Object.class);
+        while (test.type().parameterCount() > nargs)
+            test = MethodHandles.insertArguments(test, 0, MISSING_ARG);
+        if (argClass != Object.class) {
+            test = changeArgTypes(test, argClass);
+            target = changeArgTypes(target, argClass);
+            fallback = changeArgTypes(fallback, argClass);
+        }
+        MethodHandle mh = MethodHandles.guardWithTest(test, target, fallback);
+        assertEquals(target.type(), mh.type());
+        Object[][] argLists = {
+            { },
+            { "foo" }, { MISSING_ARG },
+            { "foo", "foo" }, { "foo", "bar" },
+            { "foo", "foo", "baz" }, { "foo", "bar", "baz" }
+        };
+        for (Object[] argList : argLists) {
+            if (argList.length != nargs)  continue;
+            boolean equals;
+            switch (nargs) {
+            case 0:   equals = true; break;
+            case 1:   equals = MISSING_ARG.equals(argList[0]); break;
+            default:  equals = argList[0].equals(argList[1]); break;
+            }
+            String willCall = (equals ? "targetIfEquals" : "fallbackIfNotEquals");
+            if (verbosity >= 3)
+                System.out.println(logEntry(willCall, argList));
+            Object result = mh.invokeWithArguments(argList);
+            assertCalled(willCall, argList);
+        }
+    }
+
+    @Test
+    public void testCatchException() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("catchException");
+        for (int nargs = 2; nargs <= 6; nargs++) {
+            for (int ti = 0; ti <= 1; ti++) {
+                boolean throwIt = (ti != 0);
+                testCatchException(int.class, new ClassCastException("testing"), throwIt, nargs);
+                testCatchException(void.class, new java.io.IOException("testing"), throwIt, nargs);
+                testCatchException(String.class, new LinkageError("testing"), throwIt, nargs);
+            }
+        }
+    }
+
+    private static <T extends Throwable>
+    Object throwOrReturn(Object normal, T exception) throws T {
+        if (exception != null)  throw exception;
+        return normal;
+    }
+
+    void testCatchException(Class<?> returnType, Throwable thrown, boolean throwIt, int nargs) throws Throwable {
+        countTest();
+        if (verbosity >= 3)
+            System.out.println("catchException rt="+returnType+" throw="+throwIt+" nargs="+nargs);
+        Class<? extends Throwable> exType = thrown.getClass();
+        MethodHandle throwOrReturn
+                = PRIVATE.findStatic(MethodHandlesTest.class, "throwOrReturn",
+                    MethodType.methodType(Object.class, Object.class, Throwable.class));
+        MethodHandle thrower = throwOrReturn.asType(MethodType.genericMethodType(2));
+        while (thrower.type().parameterCount() < nargs)
+            thrower = MethodHandles.dropArguments(thrower, thrower.type().parameterCount(), Object.class);
+        MethodHandle catcher = varargsList(1+nargs).asType(MethodType.genericMethodType(1+nargs));
+        MethodHandle target = MethodHandles.catchException(thrower,
+                thrown.getClass(), catcher);
+        assertEquals(thrower.type(), target.type());
+        //System.out.println("catching with "+target+" : "+throwOrReturn);
+        Object[] args = randomArgs(nargs, Object.class);
+        args[1] = (throwIt ? thrown : null);
+        Object returned = target.invokeWithArguments(args);
+        //System.out.println("return from "+target+" : "+returned);
+        if (!throwIt) {
+            assertSame(args[0], returned);
+        } else {
+            List<Object> catchArgs = new ArrayList<Object>(Arrays.asList(args));
+            catchArgs.add(0, thrown);
+            assertEquals(catchArgs, returned);
+        }
+    }
+
+    @Test
+    public void testThrowException() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("throwException");
+        testThrowException(int.class, new ClassCastException("testing"));
+        testThrowException(void.class, new java.io.IOException("testing"));
+        testThrowException(String.class, new LinkageError("testing"));
+    }
+
+    void testThrowException(Class<?> returnType, Throwable thrown) throws Throwable {
+        countTest();
+        Class<? extends Throwable> exType = thrown.getClass();
+        MethodHandle target = MethodHandles.throwException(returnType, exType);
+        //System.out.println("throwing with "+target+" : "+thrown);
+        MethodType expectedType = MethodType.methodType(returnType, exType);
+        assertEquals(expectedType, target.type());
+        target = MethodHandles.convertArguments(target, target.type().generic());
+        Throwable caught = null;
+        try {
+            Object res = target.invokeExact((Object) thrown);
+            fail("got "+res+" instead of throwing "+thrown);
+        } catch (Throwable ex) {
+            if (ex != thrown) {
+                if (ex instanceof Error)  throw (Error)ex;
+                if (ex instanceof RuntimeException)  throw (RuntimeException)ex;
+            }
+            caught = ex;
+        }
+        assertSame(thrown, caught);
+    }
+
+    @Test
+    public void testCastFailure() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("testCastFailure");
+        testCastFailure("cast/argument", 11000);
+        testCastFailure("unbox/argument", 11000);
+        testCastFailure("cast/return", 11000);
+        testCastFailure("unbox/return", 11000);
+    }
+
+    static class Surprise {
+        public MethodHandle asMethodHandle() {
+            return VALUE.bindTo(this);
+        }
+        Object value(Object x) {
+            trace("value", x);
+            if (boo != null)  return boo;
+            return x;
+        }
+        Object boo;
+        void boo(Object x) { boo = x; }
+
+        static void trace(String x, Object y) {
+            if (verbosity > 8) System.out.println(x+"="+y);
+        }
+        static Object  refIdentity(Object x)  { trace("ref.x", x); return x; }
+        static Integer boxIdentity(Integer x) { trace("box.x", x); return x; }
+        static int     intIdentity(int x)     { trace("int.x", x); return x; }
+        static MethodHandle VALUE, REF_IDENTITY, BOX_IDENTITY, INT_IDENTITY;
+        static {
+            try {
+                VALUE = PRIVATE.findVirtual(
+                    Surprise.class, "value",
+                        MethodType.methodType(Object.class, Object.class));
+                REF_IDENTITY = PRIVATE.findStatic(
+                    Surprise.class, "refIdentity",
+                        MethodType.methodType(Object.class, Object.class));
+                BOX_IDENTITY = PRIVATE.findStatic(
+                    Surprise.class, "boxIdentity",
+                        MethodType.methodType(Integer.class, Integer.class));
+                INT_IDENTITY = PRIVATE.findStatic(
+                    Surprise.class, "intIdentity",
+                        MethodType.methodType(int.class, int.class));
+            } catch (Exception ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+    }
+
+    void testCastFailure(String mode, int okCount) throws Throwable {
+        countTest(false);
+        if (verbosity > 2)  System.out.println("mode="+mode);
+        Surprise boo = new Surprise();
+        MethodHandle identity = Surprise.REF_IDENTITY, surprise0 = boo.asMethodHandle(), surprise = surprise0;
+        if (mode.endsWith("/return")) {
+            if (mode.equals("unbox/return")) {
+                // fail on return to ((Integer)surprise).intValue
+                surprise = MethodHandles.convertArguments(surprise, MethodType.methodType(int.class, Object.class));
+                identity = MethodHandles.convertArguments(identity, MethodType.methodType(int.class, Object.class));
+            } else if (mode.equals("cast/return")) {
+                // fail on return to (Integer)surprise
+                surprise = MethodHandles.convertArguments(surprise, MethodType.methodType(Integer.class, Object.class));
+                identity = MethodHandles.convertArguments(identity, MethodType.methodType(Integer.class, Object.class));
+            }
+        } else if (mode.endsWith("/argument")) {
+            MethodHandle callee = null;
+            if (mode.equals("unbox/argument")) {
+                // fail on handing surprise to int argument
+                callee = Surprise.INT_IDENTITY;
+            } else if (mode.equals("cast/argument")) {
+                // fail on handing surprise to Integer argument
+                callee = Surprise.BOX_IDENTITY;
+            }
+            if (callee != null) {
+                callee = MethodHandles.convertArguments(callee, MethodType.genericMethodType(1));
+                surprise = MethodHandles.filterArguments(callee, 0, surprise);
+                identity = MethodHandles.filterArguments(callee, 0, identity);
+            }
+        }
+        assertNotSame(mode, surprise, surprise0);
+        identity = MethodHandles.convertArguments(identity, MethodType.genericMethodType(1));
+        surprise = MethodHandles.convertArguments(surprise, MethodType.genericMethodType(1));
+        Object x = 42;
+        for (int i = 0; i < okCount; i++) {
+            Object y = identity.invokeExact(x);
+            assertEquals(x, y);
+            Object z = surprise.invokeExact(x);
+            assertEquals(x, z);
+        }
+        boo.boo("Boo!");
+        Object y = identity.invokeExact(x);
+        assertEquals(x, y);
+        try {
+            Object z = surprise.invokeExact(x);
+            System.out.println("Failed to throw; got z="+z);
+            assertTrue(false);
+        } catch (Exception ex) {
+            if (verbosity > 2)
+                System.out.println("caught "+ex);
+            if (verbosity > 3)
+                ex.printStackTrace();
+            assertTrue(ex instanceof ClassCastException
+                    // FIXME: accept only one of the two for any given unit test
+                    || ex instanceof WrongMethodTypeException
+                    );
+        }
+    }
+
+    static Example userMethod(Object o, String s, int i) {
+        called("userMethod", o, s, i);
+        return null;
+    }
+
+    @Test
+    public void testUserClassInSignature() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("testUserClassInSignature");
+        Lookup lookup = MethodHandles.lookup();
+        String name; MethodType mt; MethodHandle mh;
+        Object[] args;
+
+        // Try a static method.
+        name = "userMethod";
+        mt = MethodType.methodType(Example.class, Object.class, String.class, int.class);
+        mh = lookup.findStatic(lookup.lookupClass(), name, mt);
+        assertEquals(mt, mh.type());
+        assertEquals(Example.class, mh.type().returnType());
+        args = randomArgs(mh.type().parameterArray());
+        mh.invokeWithArguments(args);
+        assertCalled(name, args);
+
+        // Try a virtual method.
+        name = "v2";
+        mt = MethodType.methodType(Object.class, Object.class, int.class);
+        mh = lookup.findVirtual(Example.class, name, mt);
+        assertEquals(mt, mh.type().dropParameterTypes(0,1));
+        assertTrue(mh.type().parameterList().contains(Example.class));
+        args = randomArgs(mh.type().parameterArray());
+        mh.invokeWithArguments(args);
+        assertCalled(name, args);
+    }
+
+    static void runForRunnable() {
+        called("runForRunnable");
+    }
+    private interface Fooable {
+        Object foo(Fooable x, Object y);
+        // this is for randomArg:
+        public class Impl implements Fooable {
+            public Object foo(Fooable x, Object y) {
+                throw new RuntimeException("do not call");
+            }
+            final String name;
+            public Impl() { name = "Fooable#"+nextArg(); }
+            @Override public String toString() { return name; }
+        }
+    }
+    static Object fooForFooable(Fooable x, Object y) {
+        return called("fooForFooable", x, y);
+    }
+    private static class MyCheckedException extends Exception {
+    }
+    private interface WillThrow {
+        void willThrow() throws MyCheckedException;
+    }
+
+    @Test
+    public void testAsInstance() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        Lookup lookup = MethodHandles.lookup();
+        {
+            MethodType mt = MethodType.methodType(void.class);
+            MethodHandle mh = lookup.findStatic(MethodHandlesTest.class, "runForRunnable", mt);
+            Runnable proxy = MethodHandles.asInstance(mh, Runnable.class);
+            proxy.run();
+            assertCalled("runForRunnable");
+        }
+        {
+            MethodType mt = MethodType.methodType(Object.class, Fooable.class, Object.class);
+            MethodHandle mh = lookup.findStatic(MethodHandlesTest.class, "fooForFooable", mt);
+            Fooable proxy = MethodHandles.asInstance(mh, Fooable.class);
+            Object[] args = randomArgs(mt.parameterArray());
+            Object result = proxy.foo((Fooable) args[0], args[1]);
+            assertCalled("fooForFooable", args);
+            assertEquals(result, logEntry("fooForFooable", args));
+        }
+        for (Throwable ex : new Throwable[] { new NullPointerException("ok"),
+                                              new InternalError("ok"),
+                                              new Throwable("fail"),
+                                              new Exception("fail"),
+                                              new MyCheckedException()
+                                            }) {
+            MethodHandle mh = MethodHandles.throwException(void.class, Throwable.class);
+            mh = MethodHandles.insertArguments(mh, 0, ex);
+            WillThrow proxy = MethodHandles.asInstance(mh, WillThrow.class);
+            try {
+                proxy.willThrow();
+                System.out.println("Failed to throw: "+ex);
+                assertTrue(false);
+            } catch (Throwable ex1) {
+                if (verbosity > 2) {
+                    System.out.println("throw "+ex);
+                    System.out.println("catch "+(ex == ex1 ? "UNWRAPPED" : ex1));
+                }
+                if (ex instanceof RuntimeException ||
+                    ex instanceof Error) {
+                    assertSame("must pass unchecked exception out without wrapping", ex, ex1);
+                } else if (ex instanceof MyCheckedException) {
+                    assertSame("must pass declared exception out without wrapping", ex, ex1);
+                } else {
+                    assertNotSame("must pass undeclared checked exception with wrapping", ex, ex1);
+                    UndeclaredThrowableException utex = (UndeclaredThrowableException) ex1;
+                    assertSame(ex, utex.getCause());
+                }
+            }
+        }
+        // Test error checking:
+        for (Class<?> nonSAM : new Class[] { Object.class,
+                                             String.class,
+                                             CharSequence.class,
+                                             Example.class }) {
+            try {
+                MethodHandles.asInstance(varargsArray(0), nonSAM);
+                System.out.println("Failed to throw");
+                assertTrue(false);
+            } catch (IllegalArgumentException ex) {
+            }
+        }
+    }
+}
+// Local abbreviated copy of sun.invoke.util.ValueConversions
+class ValueConversions {
+    private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
+    private static final Object[] NO_ARGS_ARRAY = {};
+    private static Object[] makeArray(Object... args) { return args; }
+    private static Object[] array() { return NO_ARGS_ARRAY; }
+    private static Object[] array(Object a0)
+                { return makeArray(a0); }
+    private static Object[] array(Object a0, Object a1)
+                { return makeArray(a0, a1); }
+    private static Object[] array(Object a0, Object a1, Object a2)
+                { return makeArray(a0, a1, a2); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3)
+                { return makeArray(a0, a1, a2, a3); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4)
+                { return makeArray(a0, a1, a2, a3, a4); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5)
+                { return makeArray(a0, a1, a2, a3, a4, a5); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8, Object a9)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+    static MethodHandle[] makeArrays() {
+        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
+        MethodHandles.Lookup lookup = IMPL_LOOKUP;
+        for (;;) {
+            int nargs = arrays.size();
+            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(Object[].class);
+            String name = "array";
+            MethodHandle array = null;
+            try {
+                array = lookup.findStatic(ValueConversions.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+                // break from loop!
+            }
+            if (array == null)  break;
+            arrays.add(array);
+        }
+        assertTrue(arrays.size() == 11);  // current number of methods
+        return arrays.toArray(new MethodHandle[0]);
+    }
+    static final MethodHandle[] ARRAYS = makeArrays();
+
+    /** Return a method handle that takes the indicated number of Object
+     *  arguments and returns an Object array of them, as if for varargs.
+     */
+    public static MethodHandle varargsArray(int nargs) {
+        if (nargs < ARRAYS.length)
+            return ARRAYS[nargs];
+        // else need to spin bytecode or do something else fancy
+        throw new UnsupportedOperationException("NYI: cannot form a varargs array of length "+nargs);
+    }
+
+    private static final List<Object> NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY);
+    private static List<Object> makeList(Object... args) { return Arrays.asList(args); }
+    private static List<Object> list() { return NO_ARGS_LIST; }
+    private static List<Object> list(Object a0)
+                { return makeList(a0); }
+    private static List<Object> list(Object a0, Object a1)
+                { return makeList(a0, a1); }
+    private static List<Object> list(Object a0, Object a1, Object a2)
+                { return makeList(a0, a1, a2); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3)
+                { return makeList(a0, a1, a2, a3); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4)
+                { return makeList(a0, a1, a2, a3, a4); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5)
+                { return makeList(a0, a1, a2, a3, a4, a5); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6, Object a7)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6, Object a7,
+                                     Object a8)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
+                                     Object a4, Object a5, Object a6, Object a7,
+                                     Object a8, Object a9)
+                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+    static MethodHandle[] makeLists() {
+        ArrayList<MethodHandle> lists = new ArrayList<MethodHandle>();
+        MethodHandles.Lookup lookup = IMPL_LOOKUP;
+        for (;;) {
+            int nargs = lists.size();
+            MethodType type = MethodType.genericMethodType(nargs).changeReturnType(List.class);
+            String name = "list";
+            MethodHandle list = null;
+            try {
+                list = lookup.findStatic(ValueConversions.class, name, type);
+            } catch (ReflectiveOperationException ex) {
+                // break from loop!
+            }
+            if (list == null)  break;
+            lists.add(list);
+        }
+        assertTrue(lists.size() == 11);  // current number of methods
+        return lists.toArray(new MethodHandle[0]);
+    }
+    static final MethodHandle[] LISTS = makeLists();
+
+    /** Return a method handle that takes the indicated number of Object
+     *  arguments and returns List.
+     */
+    public static MethodHandle varargsList(int nargs) {
+        if (nargs < LISTS.length)
+            return LISTS[nargs];
+        // else need to spin bytecode or do something else fancy
+        throw new UnsupportedOperationException("NYI");
+    }
+}
+// This guy tests access from outside the same package member, but inside
+// the package itself.
+class PackageSibling {
+    static Lookup lookup() {
+        return MethodHandles.lookup();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/MethodTypeTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,567 @@
+/*
+ * Copyright 2008, 2011 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.MethodType
+ * @compile MethodTypeTest.java
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.lang.invoke.MethodTypeTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Method;
+
+import java.util.*;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class MethodTypeTest {
+
+    private Class<?> rtype;
+    private Class<?>[] ptypes;
+    private MethodType mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov;
+    private MethodType mt_iSI, mt_ISi, mt_ISI, mt_iSi;
+    private MethodType mt_viO, mt_iO2, mt_OOi, mt_iOi;
+    private MethodType mt_VIO, mt_IO2, mt_OOI, mt_IOI, mt_VIS;
+    private MethodType mt_vOiSzA, mt_OO99;
+    private MethodType[] GALLERY;
+    private Method compareTo;
+
+    @Before
+    public void setUp() throws Exception {
+        rtype = void.class;
+        ptypes = new Class<?>[] { int.class, String.class };
+
+        mt_viS = MethodType.methodType(void.class, int.class, String.class);
+        mt_OO = MethodType.methodType(Object.class, Object.class);
+        mt_OO2 = MethodType.methodType(Object.class, Object.class, Object.class);
+        mt_vv = MethodType.methodType(void.class);
+        mt_Vv = MethodType.methodType(Void.class);
+        mt_Ov = MethodType.methodType(Object.class);
+        mt_iSI = MethodType.methodType(int.class, String.class, Integer.class);
+        mt_ISi = MethodType.methodType(Integer.class, String.class, int.class);
+        mt_ISI = MethodType.methodType(Integer.class, String.class, Integer.class);
+        mt_iSi = MethodType.methodType(int.class, String.class, int.class);
+
+        compareTo = String.class.getDeclaredMethod("compareTo", String.class);
+
+        mt_viO = MethodType.methodType(void.class, int.class, Object.class);
+        mt_iO2 = MethodType.methodType(int.class, Object.class, Object.class);
+        mt_OOi = MethodType.methodType(Object.class, Object.class, int.class);
+        mt_iOi = MethodType.methodType(int.class, Object.class, int.class);
+
+        mt_VIO = MethodType.methodType(Void.class, Integer.class, Object.class);
+        mt_IO2 = MethodType.methodType(Integer.class, Object.class, Object.class);
+        mt_OOI = MethodType.methodType(Object.class, Object.class, Integer.class);
+        mt_IOI = MethodType.methodType(Integer.class, Object.class, Integer.class);
+        mt_VIS = MethodType.methodType(Void.class, Integer.class, String.class);
+
+        mt_vOiSzA = MethodType.methodType(void.class, Object.class, int.class, String.class, boolean.class, Object[].class);
+        mt_OO99 = MethodType.genericMethodType(99);
+
+        GALLERY = new MethodType[] {
+            mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov,
+            mt_iSI, mt_ISi, mt_ISI, mt_iSi,
+            mt_viO, mt_iO2, mt_OOi, mt_iOi,
+            mt_VIO, mt_IO2, mt_OOI, mt_IOI,
+            mt_VIS, mt_vOiSzA, mt_OO99
+        };
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /** Make sure the method types are all distinct. */
+    @Test
+    public void testDistinct() {
+        List<MethodType> gallery2 = new ArrayList<>();
+        for (MethodType mt : GALLERY) {
+            assertFalse(mt.toString(), gallery2.contains(mt));
+            gallery2.add(mt);
+        }
+        // check self-equality also:
+        assertEquals(Arrays.asList(GALLERY), gallery2);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Class_ClassArr() {
+        System.out.println("make (from type array)");
+        MethodType result = MethodType.methodType(rtype, ptypes);
+        assertSame(mt_viS, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Class_List() {
+        System.out.println("make (from type list)");
+        MethodType result = MethodType.methodType(rtype, Arrays.asList(ptypes));
+        assertSame(mt_viS, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_3args() {
+        System.out.println("make (from type with varargs)");
+        MethodType result = MethodType.methodType(rtype, ptypes[0], ptypes[1]);
+        assertSame(mt_viS, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Class() {
+        System.out.println("make (from single type)");
+        Class<?> rt = Integer.class;
+        MethodType expResult = MethodType.methodType(rt, new Class<?>[0]);
+        MethodType result = MethodType.methodType(rt);
+        assertSame(expResult, result);
+    }
+
+    @Test
+    public void testMakeGeneric() {
+        System.out.println("makeGeneric");
+        int objectArgCount = 2;
+        MethodType expResult = mt_OO2;
+        MethodType result = MethodType.genericMethodType(objectArgCount);
+        assertSame(expResult, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_MethodType() {
+        System.out.println("make (from rtype, MethodType)");
+        MethodType expResult = mt_iO2;
+        MethodType result = MethodType.methodType(int.class, mt_IO2);
+        assertSame(expResult, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_String_ClassLoader() {
+        System.out.println("make (from bytecode signature)");
+        ClassLoader loader = null;
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        String obj = "Ljava/lang/Object;";
+        assertEquals(obj, concat(Object.class));
+        String[] expResults = {
+            "(ILjava/lang/String;)V",
+            concat("(", obj, 2, ")", Object.class),
+            "()V", "()"+obj,
+            concat("(", String.class, Integer.class, ")I"),
+            concat("(", String.class, "I)", Integer.class),
+            concat("(", String.class, Integer.class, ")", Integer.class),
+            concat("(", String.class, "I)I")
+        };
+        for (int i = 0; i < instances.length; i++) {
+            MethodType instance = instances[i];
+            String result = instance.toMethodDescriptorString();
+            assertEquals("#"+i, expResults[i], result);
+            MethodType parsed = MethodType.fromMethodDescriptorString(result, loader);
+            assertSame("--#"+i, instance, parsed);
+        }
+    }
+    private static String concat(Object... parts) {
+        StringBuilder sb = new StringBuilder();
+        Object prevPart = "";
+        for (Object part : parts) {
+            if (part instanceof Class) {
+                part = "L"+((Class)part).getName()+";";
+            }
+            if (part instanceof Integer) {
+                for (int n = (Integer) part; n > 1; n--)
+                    sb.append(prevPart);
+                part = "";
+            }
+            sb.append(part);
+            prevPart = part;
+        }
+        return sb.toString().replace('.', '/');
+    }
+
+    @Test
+    public void testHasPrimitives() {
+        System.out.println("hasPrimitives");
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        boolean[] expResults =   {true,   false,  true,  false, true,   true,   false,  true};
+        for (int i = 0; i < instances.length; i++) {
+            boolean result = instances[i].hasPrimitives();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testHasWrappers() {
+        System.out.println("hasWrappers");
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        boolean[] expResults =   {false,  false,  false, false, true,   true,   true,   false};
+        for (int i = 0; i < instances.length; i++) {
+            System.out.println("  hasWrappers "+instances[i]);
+            boolean result = instances[i].hasWrappers();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testErase() {
+        System.out.println("erase");
+        MethodType[] instances  = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_viO, mt_OO2, mt_vv, mt_Ov, mt_iO2, mt_OOi, mt_OO2, mt_iOi};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].erase();
+            assertSame("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testGeneric() {
+        System.out.println("generic");
+        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_OO2, mt_OO2, mt_Ov, mt_Ov, mt_OO2, mt_OO2, mt_OO2, mt_OO2};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].generic();
+            assertSame("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testWrap() {
+        System.out.println("wrap");
+        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_VIS, mt_OO2, mt_Vv, mt_Ov, mt_ISI, mt_ISI, mt_ISI, mt_ISI};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].wrap();
+            assertSame("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testUnwrap() {
+        System.out.println("unwrap");
+        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSi, mt_iSi, mt_iSi, mt_iSi};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].unwrap();
+            assertSame("#"+i, expResults[i], result);
+        }
+    }
+
+    /**
+     * Test of parameterType method, of class MethodType.
+     */
+    @Test
+    public void testParameterType() {
+        System.out.println("parameterType");
+        for (int num = 0; num < ptypes.length; num++) {
+            MethodType instance = mt_viS;
+            Class<?> expResult = ptypes[num];
+            Class<?> result = instance.parameterType(num);
+            assertSame(expResult, result);
+        }
+    }
+
+    /**
+     * Test of parameterCount method, of class MethodType.
+     */
+    @Test
+    public void testParameterCount() {
+        System.out.println("parameterCount");
+        MethodType instance = mt_viS;
+        int expResult = 2;
+        int result = instance.parameterCount();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of returnType method, of class MethodType.
+     */
+    @Test
+    public void testReturnType() {
+        System.out.println("returnType");
+        MethodType instance = mt_viS;
+        Class<?> expResult = void.class;
+        Class<?> result = instance.returnType();
+        assertSame(expResult, result);
+    }
+
+    /**
+     * Test of parameterList method, of class MethodType.
+     */
+    @Test
+    public void testParameterList() {
+        System.out.println("parameterList");
+        MethodType instance = mt_viS;
+        List<Class<?>> expResult = Arrays.asList(ptypes);
+        List<Class<?>> result = instance.parameterList();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of parameterArray method, of class MethodType.
+     */
+    @Test
+    public void testParameterArray() {
+        System.out.println("parameterArray");
+        MethodType instance = mt_viS;
+        Class<?>[] expResult = ptypes;
+        Class<?>[] result = instance.parameterArray();
+        assertEquals(Arrays.asList(expResult), Arrays.asList(result));
+    }
+
+    /**
+     * Test of equals method, of class MethodType.
+     */
+    @Test
+    public void testEquals_Object() {
+        System.out.println("equals");
+        Object x = null;
+        MethodType instance = mt_viS;
+        boolean expResult = false;
+        boolean result = instance.equals(x);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of equals method, of class MethodType.
+     */
+    @Test
+    public void testEquals_MethodType() {
+        System.out.println("equals");
+        MethodType that = mt_viS;
+        MethodType instance = mt_viS;
+        boolean expResult = true;
+        boolean result = instance.equals(that);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of hashCode method, of class MethodType.
+     */
+    @Test
+    public void testHashCode() {
+        System.out.println("hashCode");
+        MethodType instance = mt_viS;
+        ArrayList<Class<?>> types = new ArrayList<Class<?>>();
+        types.add(instance.returnType());
+        types.addAll(instance.parameterList());
+        int expResult = types.hashCode();
+        int result = instance.hashCode();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of toString method, of class MethodType.
+     */
+    @Test
+    public void testToString() {
+        System.out.println("toString");
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        //String expResult = "void[int, class java.lang.String]";
+        String[] expResults = {
+            "(int,String)void",
+            "(Object,Object)Object",
+            "()void",
+            "()Object",
+            "(String,Integer)int",
+            "(String,int)Integer",
+            "(String,Integer)Integer",
+            "(String,int)int"
+        };
+        for (int i = 0; i < instances.length; i++) {
+            MethodType instance = instances[i];
+            String result = instance.toString();
+            System.out.println("#"+i+":"+result);
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    private static byte[] writeSerial(Object x) throws java.io.IOException {
+        try (java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
+             java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(bout)
+             ) {
+            out.writeObject(x);
+            out.flush();
+            return bout.toByteArray();
+        }
+    }
+    private static Object readSerial(byte[] wire) throws java.io.IOException, ClassNotFoundException {
+        try (java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(wire);
+             java.io.ObjectInputStream in = new java.io.ObjectInputStream(bin)) {
+            return in.readObject();
+        }
+    }
+    private static void testSerializedEquality(Object x) throws java.io.IOException, ClassNotFoundException {
+        if (x instanceof Object[])
+            x = Arrays.asList((Object[]) x);  // has proper equals method
+        byte[] wire = writeSerial(x);
+        Object y = readSerial(wire);
+        assertEquals(x, y);
+    }
+
+    /** Test (de-)serialization. */
+    @Test
+    public void testSerialization() throws Throwable {
+        System.out.println("serialization");
+        for (MethodType mt : GALLERY) {
+            testSerializedEquality(mt);
+        }
+        testSerializedEquality(GALLERY);
+
+        // Make a list of mixed objects:
+        List<Object> stuff = new ArrayList<>();
+        Collections.addAll(stuff, GALLERY);  // copy #1
+        Object[] triples = Arrays.copyOfRange(GALLERY, 0, GALLERY.length/2);
+        Collections.addAll(stuff, triples);  // copy #3 (partial)
+        for (MethodType mt : GALLERY) {
+            Collections.addAll(stuff, mt.parameterArray());
+        }
+        Collections.shuffle(stuff, new Random(292));
+        Collections.addAll(stuff, GALLERY);  // copy #2
+        testSerializedEquality(stuff);
+    }
+
+    /** Test serialization formats. */
+    @Test
+    public void testPortableSerialFormat() throws Throwable {
+        System.out.println("portable serial format");
+        boolean generateData = false;
+        //generateData = true;  // set this true to generate the following input data:
+        Object[][] cases = {
+            { mt_vv, new byte[] {  // ()void
+                    (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x1b,
+                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+                    (byte)0x67, (byte)0x2e, (byte)0x69, (byte)0x6e, (byte)0x76, (byte)0x6f, (byte)0x6b, (byte)0x65,
+                    (byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
+                    (byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+                    (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x04, (byte)0x76, (byte)0x6f, (byte)0x69, (byte)0x64,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x75, (byte)0x72, (byte)0x00,
+                    (byte)0x12, (byte)0x5b, (byte)0x4c, (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e,
+                    (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x43, (byte)0x6c, (byte)0x61,
+                    (byte)0x73, (byte)0x73, (byte)0x3b, (byte)0xab, (byte)0x16, (byte)0xd7, (byte)0xae, (byte)0xcb,
+                    (byte)0xcd, (byte)0x5a, (byte)0x99, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
+                } },
+            { mt_OO, new byte[] {  // (Object)Object
+                    (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x1b,
+                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+                    (byte)0x67, (byte)0x2e, (byte)0x69, (byte)0x6e, (byte)0x76, (byte)0x6f, (byte)0x6b, (byte)0x65,
+                    (byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
+                    (byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+                    (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x10, (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61,
+                    (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x4f, (byte)0x62,
+                    (byte)0x6a, (byte)0x65, (byte)0x63, (byte)0x74, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
+                    (byte)0x70, (byte)0x75, (byte)0x72, (byte)0x00, (byte)0x12, (byte)0x5b, (byte)0x4c, (byte)0x6a,
+                    (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67,
+                    (byte)0x2e, (byte)0x43, (byte)0x6c, (byte)0x61, (byte)0x73, (byte)0x73, (byte)0x3b, (byte)0xab,
+                    (byte)0x16, (byte)0xd7, (byte)0xae, (byte)0xcb, (byte)0xcd, (byte)0x5a, (byte)0x99, (byte)0x02,
+                    (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
+                    (byte)0x71, (byte)0x00, (byte)0x7e, (byte)0x00, (byte)0x03, (byte)0x78,
+                } },
+            { mt_vOiSzA, new byte[] {  // (Object,int,String,boolean,Object[])void
+                    (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x1b,
+                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+                    (byte)0x67, (byte)0x2e, (byte)0x69, (byte)0x6e, (byte)0x76, (byte)0x6f, (byte)0x6b, (byte)0x65,
+                    (byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
+                    (byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+                    (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x04, (byte)0x76, (byte)0x6f, (byte)0x69, (byte)0x64,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x75, (byte)0x72, (byte)0x00,
+                    (byte)0x12, (byte)0x5b, (byte)0x4c, (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e,
+                    (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x43, (byte)0x6c, (byte)0x61,
+                    (byte)0x73, (byte)0x73, (byte)0x3b, (byte)0xab, (byte)0x16, (byte)0xd7, (byte)0xae, (byte)0xcb,
+                    (byte)0xcd, (byte)0x5a, (byte)0x99, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x10,
+                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+                    (byte)0x67, (byte)0x2e, (byte)0x4f, (byte)0x62, (byte)0x6a, (byte)0x65, (byte)0x63, (byte)0x74,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00,
+                    (byte)0x03, (byte)0x69, (byte)0x6e, (byte)0x74, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
+                    (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x10, (byte)0x6a, (byte)0x61, (byte)0x76,
+                    (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x53,
+                    (byte)0x74, (byte)0x72, (byte)0x69, (byte)0x6e, (byte)0x67, (byte)0xa0, (byte)0xf0, (byte)0xa4,
+                    (byte)0x38, (byte)0x7a, (byte)0x3b, (byte)0xb3, (byte)0x42, (byte)0x02, (byte)0x00, (byte)0x00,
+                    (byte)0x78, (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x07, (byte)0x62, (byte)0x6f,
+                    (byte)0x6f, (byte)0x6c, (byte)0x65, (byte)0x61, (byte)0x6e, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+                    (byte)0x78, (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x13, (byte)0x5b, (byte)0x4c,
+                    (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+                    (byte)0x67, (byte)0x2e, (byte)0x4f, (byte)0x62, (byte)0x6a, (byte)0x65, (byte)0x63, (byte)0x74,
+                    (byte)0x3b, (byte)0x90, (byte)0xce, (byte)0x58, (byte)0x9f, (byte)0x10, (byte)0x73, (byte)0x29,
+                    (byte)0x6c, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x78,
+                } },
+        };
+        for (Object[] c : cases) {
+            MethodType mt = (MethodType) c[0];
+            System.out.println("deserialize "+mt);
+            byte[] wire = (byte[]) c[1];
+            if (generateData) {
+                System.out.println("<generateData>");
+                wire = writeSerial(mt);
+                final String INDENT = "                ";
+                System.out.print("{  // "+mt);
+                for (int i = 0; i < wire.length; i++) {
+                    if (i % 8 == 0) { System.out.println(); System.out.print(INDENT+"   "); }
+                    String hex = Integer.toHexString(wire[i] & 0xFF);
+                    if (hex.length() == 1)  hex = "0"+hex;
+                    System.out.print(" (byte)0x"+hex+",");
+                }
+                System.out.println();
+                System.out.println(INDENT+"}");
+                System.out.println("</generateData>");
+                System.out.flush();
+            }
+            Object decode;
+            try {
+                decode = readSerial(wire);
+            } catch (Exception ex) {
+                decode = ex;  // oops!
+            }
+            assertEquals(mt, decode);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/indify/Indify.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,1906 @@
+/*
+ * Copyright (c) 2010, 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 indify;
+
+import java.util.*;
+import java.io.*;
+import java.lang.reflect.Modifier;
+import java.util.regex.*;
+
+/**
+ * Transform one or more class files to incorporate JSR 292 features,
+ * such as {@code invokedynamic}.
+ * <p>
+ * This is a standalone program in a single source file.
+ * In this form, it may be useful for test harnesses, small experiments, and javadoc examples.
+ * Copies of this file may show up in multiple locations for standalone usage.
+ * The primary maintained location of this file is as follows:
+ * <a href="http://kenai.com/projects/ninja/sources/indify-repo/content/src/indify/Indify.java">
+ * http://kenai.com/projects/ninja/sources/indify-repo/content/src/indify/Indify.java</a>
+ * <p>
+ * Static private methods named MH_x and MT_x (where x is arbitrary)
+ * must be stereotyped generators of MethodHandle and MethodType
+ * constants.  All calls to them are transformed to {@code CONSTANT_MethodHandle}
+ * and {@code CONSTANT_MethodType} "ldc" instructions.
+ * The stereotyped code must create method types by calls to {@code methodType} or
+ * {@code fromMethodDescriptorString}.  The "lookup" argument must be created
+ * by calls to {@code java.lang.invoke.MethodHandles#lookup MethodHandles.lookup}.
+ * The class and string arguments must be constant.
+ * The following methods of {@code java.lang.invoke.MethodHandle.Lookup Lookup} are
+ * allowed for method handle creation: {@code findStatic}, {@code findVirtual},
+ * {@code findConstructor}, {@code findSpecial},
+ * {@code findGetter}, {@code findSetter},
+ * {@code findStaticGetter}, or {@code findStaticSetter}.
+ * The call to one of these methods must be followed immediately
+ * by an {@code areturn} instruction.
+ * The net result of the call to the MH_x or MT_x method must be
+ * the creation of a constant method handle.  Thus, replacing calls
+ * to MH_x or MT_x methods by {@code ldc} instructions should leave
+ * the meaning of the program unchanged.
+ * <p>
+ * Static private methods named INDY_x must be stereotyped generators
+ * of {@code invokedynamic} call sites.
+ * All calls to them must be immediately followed by
+ * {@code invokeExact} calls.
+ * All such pairs of calls are transformed to {@code invokedynamic}
+ * instructions.  Each INDY_x method must begin with a call to a
+ * MH_x method, which is taken to be its bootstrap method.
+ * The method must be immediately invoked (via {@code invokeGeneric}
+ * on constant lookup, name, and type arguments.  An object array of
+ * constants may also be appended to the {@code invokeGeneric call}.
+ * This call must be cast to {@code CallSite}, and the result must be
+ * immediately followed by a call to {@code dynamicInvoker}, with the
+ * resulting method handle returned.
+ * <p>
+ * The net result of all of these actions is equivalent to the JVM's
+ * execution of an {@code invokedynamic} instruction in the unlinked state.
+ * Running this code once should produce the same results as running
+ * the corresponding {@code invokedynamic} instruction.
+ * In order to model the caching behavior, the code of an INDY_x
+ * method is allowed to begin with getstatic, aaload, and if_acmpne
+ * instructions which load a static method handle value and return it
+ * if the value is non-null.
+ * <p>
+ * Example usage:
+ * <blockquote><pre>
+$ JAVA_HOME=(some recent OpenJDK 7 build)
+$ ant
+$ $JAVA_HOME/bin/java -cp build/classes indify.Indify --overwrite --dest build/testout build/classes/indify/Example.class
+$ $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp build/classes indify.Example
+MT = (java.lang.Object)java.lang.Object
+MH = adder(int,int)java.lang.Integer
+adder(1,2) = 3
+calling indy:  42
+$ $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp build/testout indify.Example
+(same output as above)
+ * </pre></blockquote>
+ * <p>
+ * Before OpenJDK build b123, the format of {@code CONSTANT_InvokeDynamic} is in transition,
+ * and the switch {@code --transitionalJSR292=yes} is recommended.
+ * It is turned <em>off</em> by default, but users of earlier builds may need to turn it on.
+ * <p>
+ * A version of this transformation built on top of <a href="http://asm.ow2.org/">http://asm.ow2.org/</a> would be welcome.
+ * @author John Rose
+ */
+public class Indify {
+    public static void main(String... av) throws IOException {
+        new Indify().run(av);
+    }
+
+    public File dest;
+    public String[] classpath = {"."};
+    public boolean keepgoing = false;
+    public boolean expandProperties = false;
+    public boolean overwrite = false;
+    public boolean quiet = false;
+    public boolean verbose = false;
+    public boolean transitionalJSR292 = false;  // final version is distributed
+    public boolean all = false;
+    public int verifySpecifierCount = -1;
+
+    public void run(String... av) throws IOException {
+        List<String> avl = new ArrayList<>(Arrays.asList(av));
+        parseOptions(avl);
+        if (avl.isEmpty())
+            throw new IllegalArgumentException("Usage: indify [--dest dir] [option...] file...");
+        if ("--java".equals(avl.get(0))) {
+            avl.remove(0);
+            try {
+                runApplication(avl.toArray(new String[0]));
+            } catch (Exception ex) {
+                if (ex instanceof RuntimeException)  throw (RuntimeException) ex;
+                throw new RuntimeException(ex);
+            }
+            return;
+        }
+        Exception err = null;
+        for (String a : avl) {
+            try {
+                indify(a);
+            } catch (Exception ex) {
+                if (err == null)  err = ex;
+                System.err.println("failure on "+a);
+                if (!keepgoing)  break;
+            }
+        }
+        if (err != null) {
+            if (err instanceof IOException)  throw (IOException) err;
+            throw (RuntimeException) err;
+        }
+    }
+
+    /** Execute the given application under a class loader which indifies all application classes. */
+    public void runApplication(String... av) throws Exception {
+        List<String> avl = new ArrayList<>(Arrays.asList(av));
+        String mainClassName = avl.remove(0);
+        av = avl.toArray(new String[0]);
+        Class<?> mainClass = Class.forName(mainClassName, true, makeClassLoader());
+        java.lang.reflect.Method main = mainClass.getMethod("main", String[].class);
+        try { main.setAccessible(true); } catch (SecurityException ex) { }
+        main.invoke(null, (Object) av);
+    }
+
+    public void parseOptions(List<String> av) throws IOException {
+        for (; !av.isEmpty(); av.remove(0)) {
+            String a = av.get(0);
+            if (a.startsWith("-")) {
+                String a2 = null;
+                int eq = a.indexOf('=');
+                if (eq > 0) {
+                    a2 = maybeExpandProperties(a.substring(eq+1));
+                    a = a.substring(0, eq+1);
+                }
+                switch (a) {
+                case "--java":
+                    return;  // keep this argument
+                case "-d": case "--dest": case "-d=": case "--dest=":
+                    dest = new File(a2 != null ? a2 : maybeExpandProperties(av.remove(1)));
+                    break;
+                case "-cp": case "--classpath":
+                    classpath = maybeExpandProperties(av.remove(1)).split("["+File.pathSeparatorChar+"]");
+                    break;
+                case "-k": case "--keepgoing": case "--keepgoing=":
+                    keepgoing = booleanOption(a2);  // print errors but keep going
+                    break;
+                case "--expand-properties": case "--expand-properties=":
+                    expandProperties = booleanOption(a2);  // expand property references in subsequent arguments
+                    break;
+                case "--verify-specifier-count": case "--verify-specifier-count=":
+                    verifySpecifierCount = Integer.valueOf(a2);
+                    break;
+                case "--overwrite": case "--overwrite=":
+                    overwrite = booleanOption(a2);  // overwrite output files
+                    break;
+                case "--all": case "--all=":
+                    all = booleanOption(a2);  // copy all classes, even if no patterns
+                    break;
+                case "-q": case "--quiet": case "--quiet=":
+                    quiet = booleanOption(a2);  // less output
+                    break;
+                case "-v": case "--verbose": case "--verbose=":
+                    verbose = booleanOption(a2);  // more output
+                    break;
+                case "--transitionalJSR292": case "--transitionalJSR292=":
+                    transitionalJSR292 = booleanOption(a2);  // use older invokedynamic format
+                    break;
+                default:
+                    throw new IllegalArgumentException("unrecognized flag: "+a);
+                }
+                continue;
+            } else {
+                break;
+            }
+        }
+        if (dest == null && !overwrite)
+            throw new RuntimeException("no output specified; need --dest d or --overwrite");
+        if (expandProperties) {
+            for (int i = 0; i < av.size(); i++)
+                av.set(i, maybeExpandProperties(av.get(i)));
+        }
+    }
+
+    private boolean booleanOption(String s) {
+        if (s == null)  return true;
+        switch (s) {
+        case "true":  case "yes": case "on":  case "1": return true;
+        case "false": case "no":  case "off": case "0": return false;
+        }
+        throw new IllegalArgumentException("unrecognized boolean flag="+s);
+    }
+
+    private String maybeExpandProperties(String s) {
+        if (!expandProperties)  return s;
+        Set<String> propsDone = new HashSet<>();
+        while (s.contains("${")) {
+            int lbrk = s.indexOf("${");
+            int rbrk = s.indexOf('}', lbrk);
+            if (rbrk < 0)  break;
+            String prop = s.substring(lbrk+2, rbrk);
+            if (!propsDone.add(prop))  break;
+            String value = System.getProperty(prop);
+            if (verbose)  System.err.println("expanding ${"+prop+"} => "+value);
+            if (value == null)  break;
+            s = s.substring(0, lbrk) + value + s.substring(rbrk+1);
+        }
+        return s;
+    }
+
+    public void indify(String a) throws IOException {
+        File f = new File(a);
+        String fn = f.getName();
+        if (fn.endsWith(".class") && f.isFile())
+            indifyFile(f, dest);
+        else if (fn.endsWith(".jar") && f.isFile())
+            indifyJar(f, dest);
+        else if (f.isDirectory())
+            indifyTree(f, dest);
+        else if (!keepgoing)
+            throw new RuntimeException("unrecognized file: "+a);
+    }
+
+    private void ensureDirectory(File dir) {
+        if (dir.mkdirs() && !quiet)
+            System.err.println("created "+dir);
+    }
+
+    public void indifyFile(File f, File dest) throws IOException {
+        if (verbose)  System.err.println("reading "+f);
+        ClassFile cf = new ClassFile(f);
+        Logic logic = new Logic(cf);
+        boolean changed = logic.transform();
+        logic.reportPatternMethods(quiet, keepgoing);
+        if (changed || all) {
+            File outfile;
+            if (dest != null) {
+                ensureDirectory(dest);
+                outfile = classPathFile(dest, cf.nameString());
+            } else {
+                outfile = f;  // overwrite input file, no matter where it is
+            }
+            cf.writeTo(outfile);
+            if (!quiet)  System.err.println("wrote "+outfile);
+        }
+    }
+
+    File classPathFile(File pathDir, String className) {
+        String qualname = className.replace('.','/')+".class";
+        qualname = qualname.replace('/', File.separatorChar);
+        return new File(pathDir, qualname);
+    }
+
+    public void indifyJar(File f, Object dest) throws IOException {
+        throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    public void indifyTree(File f, File dest) throws IOException {
+        if (verbose)  System.err.println("reading directory: "+f);
+        for (File f2 : f.listFiles(new FilenameFilter() {
+                public boolean accept(File dir, String name) {
+                    if (name.endsWith(".class"))  return true;
+                    if (name.contains("."))  return false;
+                    // return true if it might be a package name:
+                    return Character.isJavaIdentifierStart(name.charAt(0));
+                }})) {
+            if (f2.getName().endsWith(".class"))
+                indifyFile(f2, dest);
+            else if (f2.isDirectory())
+                indifyTree(f2, dest);
+        }
+    }
+
+    public ClassLoader makeClassLoader() {
+        return new Loader();
+    }
+    private class Loader extends ClassLoader {
+        Loader() {
+            this(Indify.class.getClassLoader());
+        }
+        Loader(ClassLoader parent) {
+            super(parent);
+        }
+        public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+            File f = findClassInPath(name);
+            if (f != null) {
+                try {
+                    Class<?> c = transformAndLoadClass(f);
+                    if (c != null) {
+                        if (resolve)  resolveClass(c);
+                        return c;
+                    }
+                } catch (Exception ex) {
+                    if (ex instanceof IllegalArgumentException)
+                        // pass error from reportPatternMethods
+                        throw (IllegalArgumentException) ex;
+                }
+            }
+            return super.loadClass(name, resolve);
+        }
+        private File findClassInPath(String name) {
+            for (String s : classpath) {
+                File f = classPathFile(new File(s), name);
+                //System.out.println("Checking for "+f);
+                if (f.exists() && f.canRead()) {
+                    return f;
+                }
+            }
+            return null;
+        }
+        protected Class<?> findClass(String name) throws ClassNotFoundException {
+            try {
+                File f = findClassInPath(name);
+                if (f != null) {
+                    Class<?> c = transformAndLoadClass(f);
+                    if (c != null)  return c;
+                }
+            } catch (IOException ex) {
+                throw new ClassNotFoundException("IO error", ex);
+            }
+            throw new ClassNotFoundException();
+        }
+        private Class<?> transformAndLoadClass(File f) throws ClassNotFoundException, IOException {
+            if (verbose)  System.err.println("Loading class from "+f);
+            ClassFile cf = new ClassFile(f);
+            Logic logic = new Logic(cf);
+            boolean changed = logic.transform();
+            if (verbose && !changed)  System.err.println("(no change)");
+            logic.reportPatternMethods(!verbose, keepgoing);
+            byte[] bytes = cf.toByteArray();
+            return defineClass(null, bytes, 0, bytes.length);
+        }
+    }
+
+    private class Logic {
+        // Indify logic, per se.
+        ClassFile cf;
+        final char[] poolMarks;
+        final Map<Method,Constant> constants = new HashMap<>();
+        final Map<Method,String> indySignatures = new HashMap<>();
+        Logic(ClassFile cf) {
+            this.cf = cf;
+            poolMarks = new char[cf.pool.size()];
+        }
+        boolean transform() {
+            if (!initializeMarks())  return false;
+            if (!findPatternMethods())  return false;
+            Pool pool = cf.pool;
+            //for (Constant c : cp)  System.out.println("  # "+c);
+            for (Method m : cf.methods) {
+                if (constants.containsKey(m))  continue;  // don't bother
+                // Transform references.
+                int blab = 0;
+                for (Instruction i = m.instructions(); i != null; i = i.next()) {
+                    if (i.bc != opc_invokestatic)  continue;
+                    int methi = i.u2At(1);
+                    if (poolMarks[methi] == 0)  continue;
+                    Short[] ref = pool.getMemberRef((short)methi);
+                    Method conm = findMember(cf.methods, ref[1], ref[2]);
+                    if (conm == null)  continue;
+                    Constant con = constants.get(conm);
+                    if (con == null)  continue;
+                    if (blab++ == 0 && !quiet)
+                        System.err.println("patching "+cf.nameString()+"."+m);
+                    //if (blab == 1) { for (Instruction j = m.instructions(); j != null; j = j.next()) System.out.println("  |"+j); }
+                    if (con.tag == CONSTANT_InvokeDynamic ||
+                        con.tag == CONSTANT_InvokeDynamic_17) {
+                        // need to patch the following instruction too,
+                        // but there are usually intervening argument pushes too
+                        Instruction i2 = findPop(i);
+                        Short[] ref2 = null;
+                        short ref2i = 0;
+                        if (i2 != null && i2.bc == opc_invokevirtual &&
+                                poolMarks[(char)(ref2i = (short) i2.u2At(1))] == 'D')
+                            ref2 = pool.getMemberRef(ref2i);
+                        if (ref2 == null || !"invokeExact".equals(pool.getString(ref2[1]))) {
+                            System.err.println(m+": failed to create invokedynamic at "+i.pc);
+                            continue;
+                        }
+                        String invType = pool.getString(ref2[2]);
+                        String bsmType = indySignatures.get(conm);
+                        if (!invType.equals(bsmType)) {
+                            System.err.println(m+": warning: "+conm+" call type and local invoke type differ: "
+                                    +bsmType+", "+invType);
+                        }
+                        assert(i.len == 3 || i2.len == 3);
+                        if (!quiet)  System.err.println(i+" "+conm+";...; "+i2+" => invokedynamic "+con);
+                        int start = i.pc + 3, end = i2.pc;
+                        System.arraycopy(i.codeBase, start, i.codeBase, i.pc, end-start);
+                        i.forceNext(0);  // force revisit of new instruction
+                        i2.u1AtPut(-3, opc_invokedynamic);
+                        i2.u2AtPut(-2, con.index);
+                        i2.u2AtPut(0, (short)0);
+                        i2.u1AtPut(2, opc_nop);
+                        //System.out.println(new Instruction(i.codeBase, i2.pc-3));
+                    } else {
+                        if (!quiet)  System.err.println(i+" "+conm+" => ldc "+con);
+                        assert(i.len == 3);
+                        i.u1AtPut(0, opc_ldc_w);
+                        i.u2AtPut(1, con.index);
+                    }
+                }
+                //if (blab >= 1) { for (Instruction j = m.instructions(); j != null; j = j.next()) System.out.println("    |"+j); }
+            }
+            cf.methods.removeAll(constants.keySet());
+            return true;
+        }
+
+        // Scan forward from the instruction to find where the stack p
+        // below the current sp at the instruction.
+        Instruction findPop(Instruction i) {
+            //System.out.println("findPop from "+i);
+            Pool pool = cf.pool;
+            JVMState jvm = new JVMState();
+        decode:
+            for (i = i.clone().next(); i != null; i = i.next()) {
+                String pops = INSTRUCTION_POPS[i.bc];
+                //System.out.println("  "+i+" "+jvm.stack+" : "+pops.replace("$", " => "));
+                if (pops == null)  break;
+                if (jvm.stackMotion(i.bc))  continue decode;
+                if (pops.indexOf('Q') >= 0) {
+                    Short[] ref = pool.getMemberRef((short) i.u2At(1));
+                    String type = simplifyType(pool.getString(CONSTANT_Utf8, ref[2]));
+                    switch (i.bc) {
+                    case opc_getstatic:
+                    case opc_getfield:
+                    case opc_putstatic:
+                    case opc_putfield:
+                        pops = pops.replace("Q", type);
+                        break;
+                    default:
+                        if (!type.startsWith("("))
+                            throw new InternalError(i.toString());
+                        pops = pops.replace("Q$Q", type.substring(1).replace(")","$"));
+                        break;
+                    }
+                    //System.out.println("special type: "+type+" => "+pops);
+                }
+                int npops = pops.indexOf('$');
+                if (npops < 0)  throw new InternalError();
+                if (npops > jvm.sp())  return i;
+                List<Object> args = jvm.args(npops);
+                int k = 0;
+                for (Object x : args) {
+                    char have = (Character) x;
+                    char want = pops.charAt(k++);
+                    if (have == 'X' || want == 'X')  continue;
+                    if (have != want)  break decode;
+                }
+                if (pops.charAt(k++) != '$')  break decode;
+                args.clear();
+                while (k < pops.length())
+                    args.add(pops.charAt(k++));
+            }
+            System.err.println("*** bailout on jvm: "+jvm.stack+" "+i);
+            return null;
+        }
+
+        boolean findPatternMethods() {
+            boolean found = false;
+            for (char mark : "THI".toCharArray()) {
+                for (Method m : cf.methods) {
+                    if (!Modifier.isPrivate(m.access))  continue;
+                    if (!Modifier.isStatic(m.access))  continue;
+                    if (nameAndTypeMark(m.name, m.type) == mark) {
+                        Constant con = scanPattern(m, mark);
+                        if (con == null)  continue;
+                        constants.put(m, con);
+                        found = true;
+                    }
+                }
+            }
+            return found;
+        }
+
+        void reportPatternMethods(boolean quietly, boolean allowMatchFailure) {
+            if (!quietly && !constants.keySet().isEmpty())
+                System.err.println("pattern methods removed: "+constants.keySet());
+            for (Method m : cf.methods) {
+                if (nameMark(cf.pool.getString(m.name)) != 0 &&
+                    constants.get(m) == null) {
+                    String failure = "method has special name but fails to match pattern: "+m;
+                    if (!allowMatchFailure)
+                        throw new IllegalArgumentException(failure);
+                    else if (!quietly)
+                        System.err.println("warning: "+failure);
+                }
+            }
+            if (verifySpecifierCount >= 0) {
+                List<Object[]> specs = bootstrapMethodSpecifiers(false);
+                int specsLen = (specs == null ? 0 : specs.size());
+                if (specsLen != verifySpecifierCount) {
+                    throw new IllegalArgumentException("BootstrapMethods length is "+specsLen+" but should be "+verifySpecifierCount);
+                }
+            }
+            if (!quiet)  System.err.flush();
+        }
+
+        // mark constant pool entries according to participation in patterns
+        boolean initializeMarks() {
+            boolean changed = false;
+            for (;;) {
+                boolean changed1 = false;
+                int cpindex = -1;
+                for (Constant e : cf.pool) {
+                    ++cpindex;
+                    if (e == null)  continue;
+                    char mark = poolMarks[cpindex];
+                    if (mark != 0)  continue;
+                    switch (e.tag) {
+                    case CONSTANT_Utf8:
+                        mark = nameMark(e.itemString()); break;
+                    case CONSTANT_NameAndType:
+                        mark = nameAndTypeMark(e.itemIndexes()); break;
+                    case CONSTANT_Class: {
+                        int n1 = e.itemIndex();
+                        char nmark = poolMarks[(char)n1];
+                        if ("DJ".indexOf(nmark) >= 0)
+                            mark = nmark;
+                        break;
+                    }
+                    case CONSTANT_Field:
+                    case CONSTANT_Method: {
+                        Short[] n12 = e.itemIndexes();
+                        short cl = n12[0];
+                        short nt = n12[1];
+                        char cmark = poolMarks[(char)cl];
+                        if (cmark != 0) {
+                            mark = cmark;  // it is a java.dyn.* or java.lang.* method
+                            break;
+                        }
+                        String cls = cf.pool.getString(CONSTANT_Class, cl);
+                        if (cls.equals(cf.nameString())) {
+                            switch (poolMarks[(char)nt]) {
+                            // it is a private MH/MT/INDY method
+                            case 'T': case 'H': case 'I':
+                                mark = poolMarks[(char)nt];
+                                break;
+                            }
+                        }
+                        break;
+                    }
+                    default:  break;
+                    }
+                    if (mark != 0) {
+                        poolMarks[cpindex] = mark;
+                        changed1 = true;
+                    }
+                }
+                if (!changed1)
+                    break;
+                changed = true;
+            }
+            return changed;
+        }
+        char nameMark(String s) {
+            if (s.startsWith("MT_"))                return 'T';
+            else if (s.startsWith("MH_"))           return 'H';
+            else if (s.startsWith("INDY_"))         return 'I';
+            else if (transitionalJSR292 &&
+                     s.startsWith("java/dyn/"))     return 'D';
+            else if (s.startsWith("java/lang/invoke/"))  return 'D';
+            else if (s.startsWith("java/lang/"))    return 'J';
+            return 0;
+        }
+        char nameAndTypeMark(Short[] n12) {
+            return nameAndTypeMark(n12[0], n12[1]);
+        }
+        char nameAndTypeMark(short n1, short n2) {
+            char mark = poolMarks[(char)n1];
+            if (mark == 0)  return 0;
+            String descr = cf.pool.getString(CONSTANT_Utf8, n2);
+            String requiredType;
+            switch (poolMarks[(char)n1]) {
+            case 'H': requiredType = "()Ljava/lang/invoke/MethodHandle;";  break;
+            case 'T': requiredType = "()Ljava/lang/invoke/MethodType;";    break;
+            case 'I': requiredType = "()Ljava/lang/invoke/MethodHandle;";  break;
+            default:  return 0;
+            }
+            if (matchType(descr, requiredType))  return mark;
+            return 0;
+        }
+
+        boolean matchType(String descr, String requiredType) {
+            if (descr.equals(requiredType))  return true;
+            if (transitionalJSR292) {
+                String oldType = requiredType.replace("Ljava/lang/invoke/", "Ljava/dyn/");
+                if (descr.equals(oldType))  return true;
+            }
+            return false;
+        }
+
+        private class JVMState {
+            final List<Object> stack = new ArrayList<>();
+            int sp() { return stack.size(); }
+            void push(Object x) { stack.add(x); }
+            void push2(Object x) { stack.add(EMPTY_SLOT); stack.add(x); }
+            void pushAt(int pos, Object x) { stack.add(stack.size()+pos, x); }
+            Object pop() { return stack.remove(sp()-1); }
+            Object top() { return stack.get(sp()-1); }
+            List<Object> args(boolean hasRecv, String type) {
+                return args(argsize(type) + (hasRecv ? 1 : 0));
+            }
+            List<Object> args(int argsize) {
+                return stack.subList(sp()-argsize, sp());
+            }
+            boolean stackMotion(int bc) {
+                switch (bc) {
+                case opc_pop:    pop();             break;
+                case opc_pop2:   pop(); pop();      break;
+                case opc_swap:   pushAt(-1, pop()); break;
+                case opc_dup:    push(top());       break;
+                case opc_dup_x1: pushAt(-2, top()); break;
+                case opc_dup_x2: pushAt(-3, top()); break;
+                // ? also: dup2{,_x1,_x2}
+                default:  return false;
+                }
+                return true;
+            }
+        }
+        private final String EMPTY_SLOT = "_";
+        private void removeEmptyJVMSlots(List<Object> args) {
+            for (;;) {
+                int i = args.indexOf(EMPTY_SLOT);
+                if (i >= 0 && i+1 < args.size()
+                    && (isConstant(args.get(i+1), CONSTANT_Long) ||
+                        isConstant(args.get(i+1), CONSTANT_Double)))
+                    args.remove(i);
+                else  break;
+            }
+        }
+
+        private Constant scanPattern(Method m, char patternMark) {
+            if (verbose)  System.err.println("scan "+m+" for pattern="+patternMark);
+            int wantTag;
+            switch (patternMark) {
+            case 'T': wantTag = CONSTANT_MethodType; break;
+            case 'H': wantTag = CONSTANT_MethodHandle; break;
+            case 'I': wantTag = CONSTANT_InvokeDynamic; break;
+            default: throw new InternalError();
+            }
+            Instruction i = m.instructions();
+            JVMState jvm = new JVMState();
+            Pool pool = cf.pool;
+            int branchCount = 0;
+            Object arg;
+            List<Object> args;
+            List<Object> bsmArgs = null;  // args to invokeGeneric
+        decode:
+            for (; i != null; i = i.next()) {
+                //System.out.println(jvm.stack+" "+i);
+                int bc = i.bc;
+                switch (bc) {
+                case opc_ldc:           jvm.push(pool.get(i.u1At(1)));   break;
+                case opc_ldc_w:         jvm.push(pool.get(i.u2At(1)));   break;
+                case opc_ldc2_w:        jvm.push2(pool.get(i.u2At(1)));  break;
+                case opc_aconst_null:   jvm.push(null);                  break;
+                case opc_bipush:        jvm.push((int)(byte) i.u1At(1)); break;
+                case opc_sipush:        jvm.push((int)(short)i.u2At(1)); break;
+
+                // these support creation of a restarg array
+                case opc_anewarray:
+                    arg = jvm.pop();
+                    if (!(arg instanceof Integer))  break decode;
+                    arg = Arrays.asList(new Object[(Integer)arg]);
+                    jvm.push(arg);
+                    break;
+                case opc_dup:
+                    jvm.push(jvm.top()); break;
+                case opc_aastore:
+                    args = jvm.args(3);  // array, index, value
+                    if (args.get(0) instanceof List &&
+                        args.get(1) instanceof Integer) {
+                        ((List<Object>)args.get(0)).set( (Integer)args.get(1), args.get(2) );
+                    }
+                    args.clear();
+                    break;
+
+                case opc_new:
+                {
+                    String type = pool.getString(CONSTANT_Class, (short)i.u2At(1));
+                    //System.out.println("new "+type);
+                    switch (type) {
+                    case "java/lang/StringBuilder":
+                        jvm.push("StringBuilder");
+                        continue decode;  // go to next instruction
+                    }
+                    break decode;  // bail out
+                }
+
+                case opc_getstatic:
+                {
+                    // int.class compiles to getstatic Integer.TYPE
+                    int fieldi = i.u2At(1);
+                    char mark = poolMarks[fieldi];
+                    //System.err.println("getstatic "+fieldi+Arrays.asList(pool.getStrings(pool.getMemberRef((short)fieldi)))+mark);
+                    if (mark == 'J') {
+                        Short[] ref = pool.getMemberRef((short) fieldi);
+                        String name = pool.getString(CONSTANT_Utf8, ref[1]);
+                        if ("TYPE".equals(name)) {
+                            String wrapperName = pool.getString(CONSTANT_Class, ref[0]).replace('/', '.');
+                            // a primitive type descriptor
+                            Class<?> primClass;
+                            try {
+                                primClass = (Class<?>) Class.forName(wrapperName).getField(name).get(null);
+                            } catch (Exception ex) {
+                                throw new InternalError("cannot load "+wrapperName+"."+name);
+                            }
+                            jvm.push(primClass);
+                            break;
+                        }
+                    }
+                    // unknown field; keep going...
+                    jvm.push(UNKNOWN_CON);
+                    break;
+                }
+                case opc_putstatic:
+                {
+                    if (patternMark != 'I')  break decode;
+                    jvm.pop();
+                    // unknown field; keep going...
+                    break;
+                }
+
+                case opc_invokestatic:
+                case opc_invokevirtual:
+                case opc_invokespecial:
+                {
+                    boolean hasRecv = (bc != opc_invokestatic);
+                    int methi = i.u2At(1);
+                    char mark = poolMarks[methi];
+                    Short[] ref = pool.getMemberRef((short)methi);
+                    String type = pool.getString(CONSTANT_Utf8, ref[2]);
+                    //System.out.println("invoke "+pool.getString(CONSTANT_Utf8, ref[1])+" "+Arrays.asList(ref)+" : "+type);
+                    args = jvm.args(hasRecv, type);
+                    String intrinsic = null;
+                    Constant con;
+                    if (mark == 'D' || mark == 'J') {
+                        intrinsic = pool.getString(CONSTANT_Utf8, ref[1]);
+                        if (mark == 'J') {
+                            String cls = pool.getString(CONSTANT_Class, ref[0]);
+                            cls = cls.substring(1+cls.lastIndexOf('/'));
+                            intrinsic = cls+"."+intrinsic;
+                        }
+                        //System.out.println("recognized intrinsic "+intrinsic);
+                        byte refKind = -1;
+                        switch (intrinsic) {
+                        case "findGetter":          refKind = REF_getField;         break;
+                        case "findStaticGetter":    refKind = REF_getStatic;        break;
+                        case "findSetter":          refKind = REF_putField;         break;
+                        case "findStaticSetter":    refKind = REF_putStatic;        break;
+                        case "findVirtual":         refKind = REF_invokeVirtual;    break;
+                        case "findStatic":          refKind = REF_invokeStatic;     break;
+                        case "findSpecial":         refKind = REF_invokeSpecial;    break;
+                        case "findConstructor":     refKind = REF_newInvokeSpecial; break;
+                        }
+                        if (refKind >= 0 && (con = parseMemberLookup(refKind, args)) != null) {
+                            args.clear(); args.add(con);
+                            continue;
+                        }
+                    }
+                    Method ownMethod = null;
+                    if (mark == 'T' || mark == 'H' || mark == 'I') {
+                        ownMethod = findMember(cf.methods, ref[1], ref[2]);
+                    }
+                    //if (intrinsic != null)  System.out.println("intrinsic = "+intrinsic);
+                    switch (intrinsic == null ? "" : intrinsic) {
+                    case "fromMethodDescriptorString":
+                        con = makeMethodTypeCon(args.get(0));
+                        args.clear(); args.add(con);
+                        continue;
+                    case "methodType": {
+                        flattenVarargs(args);  // there are several overloadings, some with varargs
+                        StringBuilder buf = new StringBuilder();
+                        String rtype = null;
+                        for (Object typeArg : args) {
+                            if (typeArg instanceof Class) {
+                                Class<?> argClass = (Class<?>) typeArg;
+                                if (argClass.isPrimitive()) {
+                                    char tchar;
+                                    switch (argClass.getName()) {
+                                    case "void":    tchar = 'V'; break;
+                                    case "boolean": tchar = 'Z'; break;
+                                    case "byte":    tchar = 'B'; break;
+                                    case "char":    tchar = 'C'; break;
+                                    case "short":   tchar = 'S'; break;
+                                    case "int":     tchar = 'I'; break;
+                                    case "long":    tchar = 'J'; break;
+                                    case "float":   tchar = 'F'; break;
+                                    case "double":  tchar = 'D'; break;
+                                    default:  throw new InternalError(argClass.toString());
+                                    }
+                                    buf.append(tchar);
+                                } else {
+                                    // should not happen, but...
+                                    buf.append('L').append(argClass.getName().replace('.','/')).append(';');
+                                }
+                            } else if (typeArg instanceof Constant) {
+                                Constant argCon = (Constant) typeArg;
+                                if (argCon.tag == CONSTANT_Class) {
+                                    String cn = pool.get(argCon.itemIndex()).itemString();
+                                    if (cn.endsWith(";"))
+                                        buf.append(cn);
+                                    else
+                                        buf.append('L').append(cn).append(';');
+                                } else {
+                                    break decode;
+                                }
+                            } else {
+                                break decode;
+                            }
+                            if (rtype == null) {
+                                // first arg is treated differently
+                                rtype = buf.toString();
+                                buf.setLength(0);
+                                buf.append('(');
+                            }
+                        }
+                        buf.append(')').append(rtype);
+                        con = con = makeMethodTypeCon(buf.toString());
+                        args.clear(); args.add(con);
+                        continue;
+                    }
+                    case "lookup":
+                    case "dynamicInvoker":
+                        args.clear(); args.add(intrinsic);
+                        continue;
+                    case "lookupClass":
+                        if (args.equals(Arrays.asList("lookup"))) {
+                            // fold lookup().lookupClass() to the enclosing class
+                            args.clear(); args.add(pool.get(cf.thisc));
+                            continue;
+                        }
+                        break;
+                    case "invokeGeneric":
+                    case "invokeWithArguments":
+                        if (patternMark != 'I')  break decode;
+                        if ("invokeWithArguments".equals(intrinsic))
+                            flattenVarargs(args);
+                        bsmArgs = new ArrayList(args);
+                        args.clear(); args.add("invokeGeneric");
+                        continue;
+                    case "Integer.valueOf":
+                    case "Float.valueOf":
+                    case "Long.valueOf":
+                    case "Double.valueOf":
+                        removeEmptyJVMSlots(args);
+                        if (args.size() == 1) {
+                            arg = args.remove(0);
+                            assert(3456 == (CONSTANT_Integer*1000 + CONSTANT_Float*100 + CONSTANT_Long*10 + CONSTANT_Double));
+                            if (isConstant(arg, CONSTANT_Integer + "IFLD".indexOf(intrinsic.charAt(0)))
+                                || arg instanceof Number) {
+                                args.add(arg); continue;
+                            }
+                        }
+                        break decode;
+                    case "StringBuilder.append":
+                        // allow calls like ("value = "+x)
+                        removeEmptyJVMSlots(args);
+                        args.subList(1, args.size()).clear();
+                        continue;
+                    case "StringBuilder.toString":
+                        args.clear();
+                        args.add(intrinsic);
+                        continue;
+                    }
+                    if (!hasRecv && ownMethod != null && patternMark != 0) {
+                        con = constants.get(ownMethod);
+                        if (con == null)  break decode;
+                        args.clear(); args.add(con);
+                        continue;
+                    } else if (type.endsWith(")V")) {
+                        // allow calls like println("reached the pattern method")
+                        args.clear();
+                        continue;
+                    }
+                    break decode;  // bail out for most calls
+                }
+                case opc_areturn:
+                {
+                    ++branchCount;
+                    if (bsmArgs != null) {
+                        // parse bsmArgs as (MH, lookup, String, MT, [extra])
+                        Constant indyCon = makeInvokeDynamicCon(bsmArgs);
+                        if (indyCon != null) {
+                            Constant typeCon = (Constant) bsmArgs.get(3);
+                            indySignatures.put(m, pool.getString(typeCon.itemIndex()));
+                            return indyCon;
+                        }
+                        System.err.println(m+": inscrutable bsm arguments: "+bsmArgs);
+                        break decode;  // bail out
+                    }
+                    arg = jvm.pop();
+                    if (branchCount == 2 && UNKNOWN_CON.equals(arg))
+                        break;  // merge to next path
+                    if (isConstant(arg, wantTag))
+                        return (Constant) arg;
+                    break decode;  // bail out
+                }
+                default:
+                    if (jvm.stackMotion(i.bc))  break;
+                    if (bc >= opc_nconst_MIN && bc <= opc_nconst_MAX)
+                        { jvm.push(INSTRUCTION_CONSTANTS[bc - opc_nconst_MIN]); break; }
+                    if (patternMark == 'I') {
+                        // these support caching paths in INDY_x methods
+                        if (bc == opc_aload || bc >= opc_aload_0 && bc <= opc_aload_MAX)
+                            { jvm.push(UNKNOWN_CON); break; }
+                        if (bc == opc_astore || bc >= opc_astore_0 && bc <= opc_astore_MAX)
+                            { jvm.pop(); break; }
+                        switch (bc) {
+                        case opc_getfield:
+                        case opc_aaload:
+                            jvm.push(UNKNOWN_CON); break;
+                        case opc_ifnull:
+                        case opc_ifnonnull:
+                            // ignore branch target
+                            if (++branchCount != 1)  break decode;
+                            jvm.pop();
+                            break;
+                        case opc_checkcast:
+                            arg = jvm.top();
+                            if ("invokeWithArguments".equals(arg) ||
+                                "invokeGeneric".equals(arg))
+                                break;  // assume it is a helpful cast
+                            break decode;
+                        default:
+                            break decode;  // bail out
+                        }
+                        continue decode; // go to next instruction
+                    }
+                    break decode;  // bail out
+                } //end switch
+            }
+            System.err.println(m+": bailout on "+i+" jvm stack: "+jvm.stack);
+            return null;
+        }
+        private final String UNKNOWN_CON = "<unknown>";
+
+        private void flattenVarargs(List<Object> args) {
+            int size = args.size();
+            if (size > 0 && args.get(size-1) instanceof List)
+                args.addAll((List<Object>) args.remove(size-1));
+        }
+
+        private boolean isConstant(Object x, int tag) {
+            return x instanceof Constant && ((Constant)x).tag == tag;
+        }
+        private Constant makeMethodTypeCon(Object x) {
+            short utfIndex;
+            if (x instanceof String)
+                utfIndex = (short) cf.pool.addConstant(CONSTANT_Utf8, x).index;
+            else if (isConstant(x, CONSTANT_String))
+                utfIndex = ((Constant)x).itemIndex();
+            else  return null;
+            return cf.pool.addConstant(CONSTANT_MethodType, utfIndex);
+        }
+        private Constant parseMemberLookup(byte refKind, List<Object> args) {
+            // E.g.: lookup().findStatic(Foo.class, "name", MethodType)
+            if (args.size() != 4)  return null;
+            int argi = 0;
+            if (!"lookup".equals(args.get(argi++)))  return null;
+            short refindex, cindex, ntindex, nindex, tindex;
+            Object con;
+            if (!isConstant(con = args.get(argi++), CONSTANT_Class))  return null;
+            cindex = (short)((Constant)con).index;
+            if (!isConstant(con = args.get(argi++), CONSTANT_String))  return null;
+            nindex = ((Constant)con).itemIndex();
+            if (isConstant(con = args.get(argi++), CONSTANT_MethodType) ||
+                isConstant(con, CONSTANT_Class)) {
+                tindex = ((Constant)con).itemIndex();
+            } else return null;
+            ntindex = (short) cf.pool.addConstant(CONSTANT_NameAndType,
+                    new Short[]{ nindex, tindex }).index;
+            byte reftag = CONSTANT_Method;
+            if (refKind <= REF_putStatic)
+                reftag = CONSTANT_Field;
+            else if (refKind == REF_invokeInterface)
+                reftag = CONSTANT_InterfaceMethod;
+            Constant ref = cf.pool.addConstant(reftag, new Short[]{ cindex, ntindex });
+            return cf.pool.addConstant(CONSTANT_MethodHandle, new Object[]{ refKind, (short)ref.index });
+        }
+        private Constant makeInvokeDynamicCon(List<Object> args) {
+            // E.g.: MH_bsm.invokeGeneric(lookup(), "name", MethodType, "extraArg")
+            removeEmptyJVMSlots(args);
+            if (args.size() != 4 && args.size() != 5)  return null;
+            int argi = 0;
+            short nindex, tindex, ntindex, bsmindex;
+            Object con;
+            if (!isConstant(con = args.get(argi++), CONSTANT_MethodHandle))  return null;
+            bsmindex = (short) ((Constant)con).index;
+            if (!"lookup".equals(args.get(argi++)))  return null;
+            if (!isConstant(con = args.get(argi++), CONSTANT_String))  return null;
+            nindex = ((Constant)con).itemIndex();
+            if (!isConstant(con = args.get(argi++), CONSTANT_MethodType))  return null;
+            tindex = ((Constant)con).itemIndex();
+            ntindex = (short) cf.pool.addConstant(CONSTANT_NameAndType,
+                                                  new Short[]{ nindex, tindex }).index;
+            if (transitionalJSR292) {
+                if (argi != args.size()) {
+                    System.err.println("BSM specifier has extra arguments but transitionalJSR292=1");
+                    return null;
+                }
+                return cf.pool.addConstant(CONSTANT_InvokeDynamic_17,
+                        new Short[]{ bsmindex, ntindex });
+            }
+            List<Object> extraArgs = Collections.emptyList();
+            if (argi < args.size()) {
+                Object arg = args.get(argi);
+                if (arg instanceof List)
+                    extraArgs = (List<Object>) arg;
+                else
+                    extraArgs = Arrays.asList(arg);
+                removeEmptyJVMSlots(args);
+            }
+            List<Short> extraArgIndexes = new CountedList<>(Short.class);
+            for (Object x : extraArgs) {
+                if (x instanceof Number) {
+                    Object num = null; byte numTag = 0;
+                    if (x instanceof Integer) { num = x; numTag = CONSTANT_Integer; }
+                    if (x instanceof Float)   { num = Float.floatToRawIntBits((Float)x); numTag = CONSTANT_Float; }
+                    if (x instanceof Long)    { num = x; numTag = CONSTANT_Long; }
+                    if (x instanceof Double)  { num = Double.doubleToRawLongBits((Double)x); numTag = CONSTANT_Double; }
+                    if (num != null)  x = cf.pool.addConstant(numTag, x);
+                }
+                if (!(x instanceof Constant))  return null;
+                extraArgIndexes.add((short) ((Constant)x).index);
+            }
+            List<Object[]> specs = bootstrapMethodSpecifiers(true);
+            int specindex = -1;
+            Object[] spec = new Object[]{ bsmindex, extraArgIndexes };
+            for (Object[] spec1 : specs) {
+                if (Arrays.equals(spec1, spec)) {
+                    specindex = specs.indexOf(spec1);
+                    if (verbose)  System.err.println("reusing BSM specifier: "+spec1[0]+spec1[1]);
+                    break;
+                }
+            }
+            if (specindex == -1) {
+                specindex = (short) specs.size();
+                specs.add(spec);
+                if (verbose)  System.err.println("adding BSM specifier: "+spec[0]+spec[1]);
+            }
+            return cf.pool.addConstant(CONSTANT_InvokeDynamic,
+                        new Short[]{ (short)specindex, ntindex });
+        }
+
+        List<Object[]> bootstrapMethodSpecifiers(boolean createIfNotFound) {
+            Attr bsms = cf.findAttr("BootstrapMethods");
+            if (bsms == null) {
+                if (!createIfNotFound)  return null;
+                bsms = new Attr(cf, "BootstrapMethods", new byte[]{0,0});
+                assert(bsms == cf.findAttr("BootstrapMethods"));
+            }
+            if (bsms.item instanceof byte[]) {
+                // unflatten
+                List<Object[]> specs = new CountedList<>(Object[].class);
+                DataInputStream in = new DataInputStream(new ByteArrayInputStream((byte[]) bsms.item));
+                try {
+                    int len = (char) in.readShort();
+                    for (int i = 0; i < len; i++) {
+                        short bsm = in.readShort();
+                        int argc = (char) in.readShort();
+                        List<Short> argv = new CountedList<>(Short.class);
+                        for (int j = 0; j < argc; j++)
+                            argv.add(in.readShort());
+                        specs.add(new Object[]{ bsm, argv });
+                    }
+                } catch (IOException ex) { throw new InternalError(); }
+                bsms.item = specs;
+            }
+            return (List<Object[]>) bsms.item;
+        }
+    }
+
+    private DataInputStream openInput(File f) throws IOException {
+        return new DataInputStream(new BufferedInputStream(new FileInputStream(f)));
+    }
+
+    private DataOutputStream openOutput(File f) throws IOException {
+        if (!overwrite && f.exists())
+            throw new IOException("file already exists: "+f);
+        ensureDirectory(f.getParentFile());
+        return new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
+    }
+
+    static byte[] readRawBytes(DataInputStream in, int size) throws IOException {
+        byte[] bytes = new byte[size];
+        int nr = in.read(bytes);
+        if (nr != size)
+            throw new InternalError("wrong size: "+nr);
+        return bytes;
+    }
+
+    private interface Chunk {
+        void readFrom(DataInputStream in) throws IOException;
+        void writeTo(DataOutputStream out) throws IOException;
+    }
+
+    private static class CountedList<T> extends ArrayList<T> implements Chunk {
+        final Class<? extends T> itemClass;
+        final int rowlen;
+        CountedList(Class<? extends T> itemClass, int rowlen) {
+            this.itemClass = itemClass;
+            this.rowlen = rowlen;
+        }
+        CountedList(Class<? extends T> itemClass) { this(itemClass, -1); }
+        public void readFrom(DataInputStream in) throws IOException {
+            int count = in.readUnsignedShort();
+            while (size() < count) {
+                if (rowlen < 0) {
+                    add(readInput(in, itemClass));
+                } else {
+                    Class<?> elemClass = itemClass.getComponentType();
+                    Object[] row = (Object[]) java.lang.reflect.Array.newInstance(elemClass, rowlen);
+                    for (int i = 0; i < rowlen; i++)
+                        row[i] = readInput(in, elemClass);
+                    add(itemClass.cast(row));
+                }
+            }
+        }
+        public void writeTo(DataOutputStream out) throws IOException {
+            out.writeShort((short)size());
+            for (T item : this) {
+                writeOutput(out, item);
+            }
+        }
+    }
+
+    private static <T> T readInput(DataInputStream in, Class<T> dataClass) throws IOException {
+        Object data;
+        if (dataClass == Integer.class) {
+            data = in.readInt();
+        } else if (dataClass == Short.class) {
+            data = in.readShort();
+        } else if (dataClass == Byte.class) {
+            data = in.readByte();
+        } else if (dataClass == String.class) {
+            data = in.readUTF();
+        } else if (Chunk.class.isAssignableFrom(dataClass)) {
+            T obj;
+            try { obj = dataClass.newInstance(); }
+                catch (Exception ex) { throw new RuntimeException(ex); }
+            ((Chunk)obj).readFrom(in);
+            data = obj;
+        } else {
+            throw new InternalError("bad input datum: "+dataClass);
+        }
+        return dataClass.cast(data);
+    }
+    private static <T> T readInput(byte[] bytes, Class<T> dataClass) {
+        try {
+            return readInput(new DataInputStream(new ByteArrayInputStream(bytes)), dataClass);
+        } catch (IOException ex) {
+            throw new InternalError();
+        }
+    }
+    private static void readInputs(DataInputStream in, Object... data) throws IOException {
+        for (Object x : data)  ((Chunk)x).readFrom(in);
+    }
+
+    private static void writeOutput(DataOutputStream out, Object data) throws IOException {
+        if (data == null) {
+            return;
+        } if (data instanceof Integer) {
+            out.writeInt((Integer)data);
+        } else if (data instanceof Long) {
+            out.writeLong((Long)data);
+        } else if (data instanceof Short) {
+            out.writeShort((Short)data);
+        } else if (data instanceof Byte) {
+            out.writeByte((Byte)data);
+        } else if (data instanceof String) {
+            out.writeUTF((String)data);
+        } else if (data instanceof byte[]) {
+            out.write((byte[])data);
+        } else if (data instanceof Object[]) {
+            for (Object x : (Object[]) data)
+                writeOutput(out, x);
+        } else if (data instanceof Chunk) {
+            Chunk x = (Chunk) data;
+            x.writeTo(out);
+        } else if (data instanceof List) {
+            for (Object x : (List<?>) data)
+                writeOutput(out, x);
+        } else {
+            throw new InternalError("bad output datum: "+data+" : "+data.getClass().getName());
+        }
+    }
+    private static void writeOutputs(DataOutputStream out, Object... data) throws IOException {
+        for (Object x : data)  writeOutput(out, x);
+    }
+
+    public static abstract class Outer {
+        public abstract List<? extends Inner> inners();
+        protected void linkInners() {
+            for (Inner i : inners()) {
+                i.linkOuter(this);
+                if (i instanceof Outer)
+                    ((Outer)i).linkInners();
+            }
+        }
+        public <T extends Outer> T outer(Class<T> c) {
+            for (Outer walk = this;; walk = ((Inner)walk).outer()) {
+                if (c.isInstance(walk))
+                    return c.cast(walk);
+                //if (!(walk instanceof Inner))  return null;
+            }
+        }
+
+        public abstract List<Attr> attrs();
+        public Attr findAttr(String name) {
+            return findAttr(outer(ClassFile.class).pool.stringIndex(name, false));
+        }
+        public Attr findAttr(int name) {
+            if (name == 0)  return null;
+            for (Attr a : attrs()) {
+                if (a.name == name)  return a;
+            }
+            return null;
+        }
+    }
+    public interface Inner { Outer outer(); void linkOuter(Outer o); }
+    public static abstract class InnerOuter extends Outer implements Inner {
+        public Outer outer;
+        public Outer outer() { return outer; }
+        public void linkOuter(Outer o) { assert(outer == null); outer = o; }
+    }
+    public static class Constant<T> implements Chunk {
+        public final byte tag;
+        public final T item;
+        public final int index;
+        public Constant(int index, byte tag, T item) {
+            this.index = index;
+            this.tag = tag;
+            this.item = item;
+        }
+        public Constant checkTag(byte tag) {
+            if (this.tag != tag)  throw new InternalError(this.toString());
+            return this;
+        }
+        public String itemString() { return (String)item; }
+        public Short itemIndex() { return (Short)item; }
+        public Short[] itemIndexes() { return (Short[])item; }
+        public void readFrom(DataInputStream in) throws IOException {
+            throw new InternalError("do not call");
+        }
+        public void writeTo(DataOutputStream out) throws IOException {
+            writeOutputs(out, tag, item);
+        }
+        public boolean equals(Object x) { return (x instanceof Constant && equals((Constant)x)); }
+        public boolean equals(Constant that) {
+            return (this.tag == that.tag && this.itemAsComparable().equals(that.itemAsComparable()));
+        }
+        public int hashCode() { return (tag * 31) + this.itemAsComparable().hashCode(); }
+        public Object itemAsComparable() {
+            switch (tag) {
+            case CONSTANT_Double:   return Double.longBitsToDouble((Long)item);
+            case CONSTANT_Float:    return Float.intBitsToFloat((Integer)item);
+            }
+            return (item instanceof Object[] ? Arrays.asList((Object[])item) : item);
+        }
+        public String toString() {
+            String itstr = String.valueOf(itemAsComparable());
+            return (index + ":" + tagName(tag) + (itstr.startsWith("[")?"":"=") + itstr);
+        }
+        private static String[] TAG_NAMES;
+        public static String tagName(byte tag) {  // used for error messages
+            if (TAG_NAMES == null)
+                TAG_NAMES = ("None Utf8 Unicode Integer Float Long Double Class String"
+                             +" Fieldref Methodref InterfaceMethodref NameAndType #13 #14"
+                             +" MethodHandle MethodType InvokeDynamic#17 InvokeDynamic").split(" ");
+            if ((tag & 0xFF) >= TAG_NAMES.length)  return "#"+(tag & 0xFF);
+            return TAG_NAMES[tag & 0xFF];
+        }
+    }
+
+    public static class Pool extends CountedList<Constant> implements Chunk {
+        private Map<String,Short> strings = new TreeMap<>();
+
+        public Pool() {
+            super(Constant.class);
+        }
+        public void readFrom(DataInputStream in) throws IOException {
+            int count = in.readUnsignedShort();
+            add(null);  // always ignore first item
+            while (size() < count) {
+                readConstant(in);
+            }
+        }
+        public <T> Constant<T> addConstant(byte tag, T item) {
+            Constant<T> con = new Constant<>(size(), tag, item);
+            int idx = indexOf(con);
+            if (idx >= 0)  return get(idx);
+            add(con);
+            if (tag == CONSTANT_Utf8)  strings.put((String)item, (short) con.index);
+            return con;
+        }
+        private void readConstant(DataInputStream in) throws IOException {
+            byte tag = in.readByte();
+            int index = size();
+            Object arg;
+            switch (tag) {
+            case CONSTANT_Utf8:
+                arg = in.readUTF();
+                strings.put((String) arg, (short) size());
+                break;
+            case CONSTANT_Integer:
+            case CONSTANT_Float:
+                arg = in.readInt(); break;
+            case CONSTANT_Long:
+            case CONSTANT_Double:
+                add(new Constant(index, tag, in.readLong()));
+                add(null);
+                return;
+            case CONSTANT_Class:
+            case CONSTANT_String:
+                arg = in.readShort(); break;
+            case CONSTANT_Field:
+            case CONSTANT_Method:
+            case CONSTANT_InterfaceMethod:
+            case CONSTANT_NameAndType:
+            case CONSTANT_InvokeDynamic_17:
+            case CONSTANT_InvokeDynamic:
+                // read an ordered pair
+                arg = new Short[] { in.readShort(), in.readShort() };
+                break;
+            case CONSTANT_MethodHandle:
+                // read an ordered pair; first part is a u1 (not u2)
+                arg = new Object[] { in.readByte(), in.readShort() };
+                break;
+            case CONSTANT_MethodType:
+                arg = in.readShort(); break;
+            default:
+                throw new InternalError("bad CP tag "+tag);
+            }
+            add(new Constant(index, tag, arg));
+        }
+
+        // Access:
+        public Constant get(int index) {
+            // extra 1-bits get into the shorts
+            return super.get((char) index);
+        }
+        String getString(byte tag, short index) {
+            get(index).checkTag(tag);
+            return getString(index);
+        }
+        String getString(short index) {
+            Object v = get(index).item;
+            if (v instanceof Short)
+                v = get((Short)v).checkTag(CONSTANT_Utf8).item;
+            return (String) v;
+        }
+        String[] getStrings(Short[] indexes) {
+            String[] res = new String[indexes.length];
+            for (int i = 0; i < indexes.length; i++)
+                res[i] = getString(indexes[i]);
+            return res;
+        }
+        int stringIndex(String name, boolean createIfNotFound) {
+            Short x = strings.get(name);
+            if (x != null)  return (char)(int) x;
+            if (!createIfNotFound)  return 0;
+            return addConstant(CONSTANT_Utf8, name).index;
+        }
+        Short[] getMemberRef(short index) {
+            Short[] cls_nnt = get(index).itemIndexes();
+            Short[] name_type = get(cls_nnt[1]).itemIndexes();
+            return new Short[]{ cls_nnt[0], name_type[0], name_type[1] };
+        }
+    }
+
+    public class ClassFile extends Outer implements Chunk {
+        ClassFile(File f) throws IOException {
+            DataInputStream in = openInput(f);
+            try {
+                readFrom(in);
+            } finally {
+                if (in != null)  in.close();
+            }
+        }
+
+        public int                magic, version;  // <min:maj>
+        public final Pool         pool       = new Pool();
+        public short              access, thisc, superc;
+        public final List<Short>  interfaces = new CountedList<>(Short.class);
+        public final List<Field>  fields     = new CountedList<>(Field.class);
+        public final List<Method> methods    = new CountedList<>(Method.class);
+        public final List<Attr>   attrs      = new CountedList<>(Attr.class);
+
+        public final void readFrom(DataInputStream in) throws IOException {
+            magic = in.readInt(); version = in.readInt();
+            if (magic != 0xCAFEBABE)  throw new IOException("bad magic number");
+            pool.readFrom(in);
+            Code_index = pool.stringIndex("Code", false);
+            access = in.readShort(); thisc = in.readShort(); superc = in.readShort();
+            readInputs(in, interfaces, fields, methods, attrs);
+            if (in.read() >= 0)  throw new IOException("junk after end of file");
+            linkInners();
+        }
+
+        void writeTo(File f) throws IOException {
+            DataOutputStream out = openOutput(f);
+            try {
+                writeTo(out);
+            } finally {
+                out.close();
+            }
+        }
+
+        public void writeTo(DataOutputStream out) throws IOException {
+            writeOutputs(out, magic, version, pool,
+                         access, thisc, superc, interfaces,
+                         fields, methods, attrs);
+        }
+
+        public byte[] toByteArray() {
+            try {
+                ByteArrayOutputStream buf = new ByteArrayOutputStream();
+                writeTo(new DataOutputStream(buf));
+                return buf.toByteArray();
+            } catch (IOException ex) {
+                throw new InternalError();
+            }
+        }
+
+        public List<Inner> inners() {
+            List<Inner> inns = new ArrayList<>();
+            inns.addAll(fields); inns.addAll(methods); inns.addAll(attrs);
+            return inns;
+        }
+        public List<Attr> attrs() { return attrs; }
+
+        // derived stuff:
+        public String nameString() { return pool.getString(CONSTANT_Class, thisc); }
+        int Code_index;
+    }
+
+    private static <T extends Member> T findMember(List<T> mems, int name, int type) {
+        if (name == 0 || type == 0)  return null;
+        for (T m : mems) {
+            if (m.name == name && m.type == type)  return m;
+        }
+        return null;
+    }
+
+    public static class Member extends InnerOuter implements Chunk {
+        public short access, name, type;
+        public final List<Attr> attrs = new CountedList<>(Attr.class);
+        public void readFrom(DataInputStream in) throws IOException {
+            access = in.readShort(); name = in.readShort(); type = in.readShort();
+            readInputs(in, attrs);
+        }
+        public void writeTo(DataOutputStream out) throws IOException {
+            writeOutputs(out, access, name, type, attrs);
+        }
+        public List<Attr> inners() { return attrs; }
+        public List<Attr> attrs() { return attrs; }
+        public ClassFile outer() { return (ClassFile) outer; }
+        public String nameString() { return outer().pool.getString(CONSTANT_Utf8, name); }
+        public String typeString() { return outer().pool.getString(CONSTANT_Utf8, type); }
+        public String toString() {
+            if (outer == null)  return super.toString();
+            return nameString() + (this instanceof Method ? "" : ":")
+                    + simplifyType(typeString());
+        }
+    }
+    public static class Field extends Member {
+    }
+    public static class Method extends Member {
+        public Code code() {
+            Attr a = findAttr("Code");
+            if (a == null)  return null;
+            return (Code) a.item;
+        }
+        public Instruction instructions() {
+            Code code = code();
+            if (code == null)  return null;
+            return code.instructions();
+        }
+    }
+
+    public static class Attr extends InnerOuter implements Chunk {
+        public short name;
+        public int size = -1;  // no pre-declared size
+        public Object item;
+
+        public Attr() {}
+        public Attr(Outer outer, String name, Object item) {
+            ClassFile cf = outer.outer(ClassFile.class);
+            linkOuter(outer);
+            this.name = (short) cf.pool.stringIndex(name, true);
+            this.item = item;
+            outer.attrs().add(this);
+        }
+        public void readFrom(DataInputStream in) throws IOException {
+            name = in.readShort();
+            size = in.readInt();
+            item = readRawBytes(in, size);
+        }
+        public void writeTo(DataOutputStream out) throws IOException {
+            out.writeShort(name);
+            // write the 4-byte size header and then the contents:
+            byte[] bytes;
+            int trueSize;
+            if (item instanceof byte[]) {
+                bytes = (byte[]) item;
+                out.writeInt(trueSize = bytes.length);
+                out.write(bytes);
+            } else {
+                trueSize = flatten(out);
+                //if (!(item instanceof Code))  System.err.println("wrote complex attr name="+(int)(char)name+" size="+trueSize+" data="+Arrays.toString(flatten()));
+            }
+            if (trueSize != size && size >= 0)
+                System.err.println("warning: attribute size changed "+size+" to "+trueSize);
+        }
+        public void linkOuter(Outer o) {
+            super.linkOuter(o);
+            if (item instanceof byte[] &&
+                outer instanceof Method &&
+                ((Method)outer).outer().Code_index == name) {
+                    item = readInput((byte[])item, Code.class);
+            }
+        }
+        public List<Inner> inners() {
+            if (item instanceof Inner)
+                return Collections.nCopies(1, (Inner)item);
+            return Collections.emptyList();
+        }
+        public List<Attr> attrs() { return null; }  // Code overrides this
+        public byte[] flatten() {
+            ByteArrayOutputStream buf = new ByteArrayOutputStream(Math.max(20, size));
+            flatten(buf);
+            return buf.toByteArray();
+        }
+        public int flatten(DataOutputStream out) throws IOException {
+            ByteArrayOutputStream buf = new ByteArrayOutputStream(Math.max(20, size));
+            int trueSize = flatten(buf);
+            out.writeInt(trueSize);
+            buf.writeTo(out);
+            return trueSize;
+        }
+        private int flatten(ByteArrayOutputStream buf) {
+            try {
+                writeOutput(new DataOutputStream(buf), item);
+                return buf.size();
+            } catch (IOException ex) {
+                throw new InternalError();
+            }
+        }
+        public String nameString() {
+            ClassFile cf = outer(ClassFile.class);
+            if (cf == null)  return "#"+name;
+            return cf.pool.getString(name);
+        }
+        public String toString() {
+            return nameString()+(size < 0 ? "=" : "["+size+"]=")+item;
+        }
+    }
+
+    public static class Code extends InnerOuter implements Chunk {
+        public short stacks, locals;
+        public byte[] bytes;
+        public final List<Short[]> etable = new CountedList<>(Short[].class, 4);
+        public final List<Attr> attrs = new CountedList<>(Attr.class);
+        // etable[N] = (N)*{ startpc, endpc, handlerpc, catchtype }
+        public void readFrom(DataInputStream in) throws IOException {
+            stacks = in.readShort(); locals = in.readShort();
+            bytes = readRawBytes(in, in.readInt());
+            readInputs(in, etable, attrs);
+        }
+        public void writeTo(DataOutputStream out) throws IOException {
+            writeOutputs(out, stacks, locals, bytes.length, bytes, etable, attrs);
+        }
+        public List<Attr> inners() { return attrs; }
+        public List<Attr> attrs() { return attrs; }
+        public Instruction instructions() {
+            return new Instruction(bytes, 0);
+        }
+    }
+
+    // lots of constants
+    private static final byte
+        CONSTANT_Utf8              = 1,
+        CONSTANT_Integer           = 3,
+        CONSTANT_Float             = 4,
+        CONSTANT_Long              = 5,
+        CONSTANT_Double            = 6,
+        CONSTANT_Class             = 7,
+        CONSTANT_String            = 8,
+        CONSTANT_Field             = 9,
+        CONSTANT_Method            = 10,
+        CONSTANT_InterfaceMethod   = 11,
+        CONSTANT_NameAndType       = 12,
+        CONSTANT_MethodHandle      = 15,  // JSR 292
+        CONSTANT_MethodType        = 16,  // JSR 292
+        CONSTANT_InvokeDynamic_17  = 17,  // JSR 292, only occurs in old class files
+        CONSTANT_InvokeDynamic     = 18;  // JSR 292
+    private static final byte
+        REF_getField               = 1,
+        REF_getStatic              = 2,
+        REF_putField               = 3,
+        REF_putStatic              = 4,
+        REF_invokeVirtual          = 5,
+        REF_invokeStatic           = 6,
+        REF_invokeSpecial          = 7,
+        REF_newInvokeSpecial       = 8,
+        REF_invokeInterface        = 9;
+
+    private static final int
+        opc_nop                    = 0,
+        opc_aconst_null            = 1,
+        opc_nconst_MIN             = 2,  // iconst_m1
+        opc_nconst_MAX             = 15, // dconst_1
+        opc_bipush                 = 16,
+        opc_sipush                 = 17,
+        opc_ldc                    = 18,
+        opc_ldc_w                  = 19,
+        opc_ldc2_w                 = 20,
+        opc_aload                  = 25,
+        opc_aload_0                = 42,
+        opc_aload_MAX              = 45,
+        opc_aaload                 = 50,
+        opc_astore                 = 58,
+        opc_astore_0               = 75,
+        opc_astore_MAX             = 78,
+        opc_aastore                = 83,
+        opc_pop                    = 87,
+        opc_pop2                   = 88,
+        opc_dup                    = 89,
+        opc_dup_x1                 = 90,
+        opc_dup_x2                 = 91,
+        opc_dup2                   = 92,
+        opc_dup2_x1                = 93,
+        opc_dup2_x2                = 94,
+        opc_swap                   = 95,
+        opc_tableswitch            = 170,
+        opc_lookupswitch           = 171,
+        opc_areturn                = 176,
+        opc_getstatic              = 178,
+        opc_putstatic              = 179,
+        opc_getfield               = 180,
+        opc_putfield               = 181,
+        opc_invokevirtual          = 182,
+        opc_invokespecial          = 183,
+        opc_invokestatic           = 184,
+        opc_invokeinterface        = 185,
+        opc_invokedynamic          = 186,
+        opc_new                    = 187,
+        opc_anewarray              = 189,
+        opc_checkcast              = 192,
+        opc_ifnull                 = 198,
+        opc_ifnonnull              = 199,
+        opc_wide                   = 196;
+
+    private static final Object[] INSTRUCTION_CONSTANTS = {
+        -1, 0, 1, 2, 3, 4, 5, 0L, 1L, 0.0F, 1.0F, 2.0F, 0.0D, 1.0D
+    };
+
+    private static final String INSTRUCTION_FORMATS =
+        "nop$ aconst_null$L iconst_m1$I iconst_0$I iconst_1$I "+
+        "iconst_2$I iconst_3$I iconst_4$I iconst_5$I lconst_0$J_ "+
+        "lconst_1$J_ fconst_0$F fconst_1$F fconst_2$F dconst_0$D_ "+
+        "dconst_1$D_ bipush=bx$I sipush=bxx$I ldc=bk$X ldc_w=bkk$X "+
+        "ldc2_w=bkk$X_ iload=bl/wbll$I lload=bl/wbll$J_ fload=bl/wbll$F "+
+        "dload=bl/wbll$D_ aload=bl/wbll$L iload_0$I iload_1$I "+
+        "iload_2$I iload_3$I lload_0$J_ lload_1$J_ lload_2$J_ "+
+        "lload_3$J_ fload_0$F fload_1$F fload_2$F fload_3$F dload_0$D_ "+
+        "dload_1$D_ dload_2$D_ dload_3$D_ aload_0$L aload_1$L "+
+        "aload_2$L aload_3$L iaload$LI$I laload$LI$J_ faload$LI$F "+
+        "daload$LI$D_ aaload$LI$L baload$LI$I caload$LI$I saload$LI$I "+
+        "istore=bl/wbll$I$ lstore=bl/wbll$J_$ fstore=bl/wbll$F$ "+
+        "dstore=bl/wbll$D_$ astore=bl/wbll$L$ istore_0$I$ istore_1$I$ "+
+        "istore_2$I$ istore_3$I$ lstore_0$J_$ lstore_1$J_$ "+
+        "lstore_2$J_$ lstore_3$J_$ fstore_0$F$ fstore_1$F$ fstore_2$F$ "+
+        "fstore_3$F$ dstore_0$D_$ dstore_1$D_$ dstore_2$D_$ "+
+        "dstore_3$D_$ astore_0$L$ astore_1$L$ astore_2$L$ astore_3$L$ "+
+        "iastore$LII$ lastore$LIJ_$ fastore$LIF$ dastore$LID_$ "+
+        "aastore$LIL$ bastore$LII$ castore$LII$ sastore$LII$ pop$X$ "+
+        "pop2$XX$ dup$X$XX dup_x1$XX$XXX dup_x2$XXX$XXXX dup2$XX$XXXX "+
+        "dup2_x1$XXX$XXXXX dup2_x2$XXXX$XXXXXX swap$XX$XX "+
+        "iadd$II$I ladd$J_J_$J_ fadd$FF$F dadd$D_D_$D_ isub$II$I "+
+        "lsub$J_J_$J_ fsub$FF$F dsub$D_D_$D_ imul$II$I lmul$J_J_$J_ "+
+        "fmul$FF$F dmul$D_D_$D_ idiv$II$I ldiv$J_J_$J_ fdiv$FF$F "+
+        "ddiv$D_D_$D_ irem$II$I lrem$J_J_$J_ frem$FF$F drem$D_D_$D_ "+
+        "ineg$I$I lneg$J_$J_ fneg$F$F dneg$D_$D_ ishl$II$I lshl$J_I$J_ "+
+        "ishr$II$I lshr$J_I$J_ iushr$II$I lushr$J_I$J_ iand$II$I "+
+        "land$J_J_$J_ ior$II$I lor$J_J_$J_ ixor$II$I lxor$J_J_$J_ "+
+        "iinc=blx/wbllxx$ i2l$I$J_ i2f$I$F i2d$I$D_ l2i$J_$I l2f$J_$F "+
+        "l2d$J_$D_ f2i$F$I f2l$F$J_ f2d$F$D_ d2i$D_$I d2l$D_$J_ "+
+        "d2f$D_$F i2b$I$I i2c$I$I i2s$I$I lcmp fcmpl fcmpg dcmpl dcmpg "+
+        "ifeq=boo ifne=boo iflt=boo ifge=boo ifgt=boo ifle=boo "+
+        "if_icmpeq=boo if_icmpne=boo if_icmplt=boo if_icmpge=boo "+
+        "if_icmpgt=boo if_icmple=boo if_acmpeq=boo if_acmpne=boo "+
+        "goto=boo jsr=boo ret=bl/wbll tableswitch=* lookupswitch=* "+
+        "ireturn lreturn freturn dreturn areturn return "+
+        "getstatic=bkf$Q putstatic=bkf$Q$ getfield=bkf$L$Q "+
+        "putfield=bkf$LQ$ invokevirtual=bkm$LQ$Q "+
+        "invokespecial=bkm$LQ$Q invokestatic=bkm$Q$Q "+
+        "invokeinterface=bkixx$LQ$Q invokedynamic=bkd__$Q$Q new=bkc$L "+
+        "newarray=bx$I$L anewarray=bkc$I$L arraylength$L$I athrow "+
+        "checkcast=bkc$L$L instanceof=bkc$L$I monitorenter$L "+
+        "monitorexit$L wide=* multianewarray=bkcx ifnull=boo "+
+        "ifnonnull=boo goto_w=boooo jsr_w=boooo ";
+    private static final String[] INSTRUCTION_NAMES;
+    private static final String[] INSTRUCTION_POPS;
+    private static final int[] INSTRUCTION_INFO;
+    static {
+        String[] insns = INSTRUCTION_FORMATS.split(" ");
+        assert(insns[opc_lookupswitch].startsWith("lookupswitch"));
+        assert(insns[opc_tableswitch].startsWith("tableswitch"));
+        assert(insns[opc_wide].startsWith("wide"));
+        assert(insns[opc_invokedynamic].startsWith("invokedynamic"));
+        int[] info = new int[256];
+        String[] names = new String[256];
+        String[] pops = new String[256];
+        for (int i = 0; i < insns.length; i++) {
+            String insn = insns[i];
+            int dl = insn.indexOf('$');
+            if (dl > 0) {
+                String p = insn.substring(dl+1);
+                if (p.indexOf('$') < 0)  p = "$" + p;
+                pops[i] = p;
+                insn = insn.substring(0, dl);
+            }
+            int eq = insn.indexOf('=');
+            if (eq < 0) {
+                info[i] = 1;
+                names[i] = insn;
+                continue;
+            }
+            names[i] = insn.substring(0, eq);
+            String fmt = insn.substring(eq+1);
+            if (fmt.equals("*")) {
+                info[i] = 0;
+                continue;
+            }
+            int sl = fmt.indexOf('/');
+            if (sl < 0) {
+                info[i] = (char) fmt.length();
+            } else {
+                String wfmt = fmt.substring(sl+1);
+                fmt = fmt.substring(0, sl);
+                info[i] = (char)( fmt.length() + (wfmt.length() * 16) );
+            }
+        }
+        INSTRUCTION_INFO = info;
+        INSTRUCTION_NAMES = names;
+        INSTRUCTION_POPS = pops;
+    }
+
+    public static class Instruction implements Cloneable {
+        byte[] codeBase;
+        int pc;
+        int bc;
+        int info;
+        int wide;
+        int len;
+        Instruction(byte[] codeBase, int pc) {
+            this.codeBase = codeBase;
+            init(pc);
+        }
+        public Instruction clone() {
+            try {
+                return (Instruction) super.clone();
+            } catch (CloneNotSupportedException ex) {
+                throw new InternalError();
+            }
+        }
+        private Instruction init(int pc) {
+            this.pc = pc;
+            this.bc = codeBase[pc] & 0xFF;
+            this.info = INSTRUCTION_INFO[bc];
+            this.wide = 0;
+            this.len = (info & 0x0F);
+            if (len == 0)
+                computeLength();
+            return this;
+        }
+        Instruction next() {
+            if (len == 0 && bc != 0)  throw new InternalError();
+            int npc = pc + len;
+            if (npc == codeBase.length)
+                return null;
+            return init(npc);
+        }
+        void forceNext(int newLen) {
+            bc = opc_nop;
+            len = newLen;
+        }
+
+        public String toString() {
+            StringBuilder buf = new StringBuilder();
+            buf.append(pc).append(":").append(INSTRUCTION_NAMES[bc]);
+            switch (len) {
+            case 3: buf.append(" ").append(u2At(1)); break;
+            case 5: buf.append(" ").append(u2At(1)).append(" ").append(u2At(3)); break;
+            default:  for (int i = 1; i < len; i++)  buf.append(" ").append(u1At(1));
+            }
+            return buf.toString();
+        }
+
+        // these are the hard parts
+        private void computeLength() {
+            int cases;
+            switch (bc) {
+            case opc_wide:
+                bc = codeBase[pc + 1];
+                info = INSTRUCTION_INFO[bc];
+                len = ((info >> 4) & 0x0F);
+                if (len == 0)  throw new RuntimeException("misplaced wide bytecode: "+bc);
+                return;
+
+            case opc_tableswitch:
+                cases = (u4At(alignedIntOffset(2)) - u4At(alignedIntOffset(1)) + 1);
+                len = alignedIntOffset(3 + cases*1);
+                return;
+
+            case opc_lookupswitch:
+                cases = u4At(alignedIntOffset(1));
+                len = alignedIntOffset(2 + cases*2);
+                return;
+
+            default:
+                throw new RuntimeException("unknown bytecode: "+bc);
+            }
+        }
+        // switch code
+        // clget the Nth int (where 0 is the first after the opcode itself)
+        public int alignedIntOffset(int n) {
+            int pos = pc + 1;
+            pos += ((-pos) & 0x03);  // align it
+            pos += (n * 4);
+            return pos - pc;
+        }
+        public int u1At(int pos) {
+            return (codeBase[pc+pos] & 0xFF);
+        }
+        public int u2At(int pos) {
+            return (u1At(pos+0)<<8) + u1At(pos+1);
+        }
+        public int u4At(int pos) {
+            return (u2At(pos+0)<<16) + u2At(pos+2);
+        }
+        public void u1AtPut(int pos, int x) {
+            codeBase[pc+pos] = (byte)x;
+        }
+        public void u2AtPut(int pos, int x) {
+            codeBase[pc+pos+0] = (byte)(x >> 8);
+            codeBase[pc+pos+1] = (byte)(x >> 0);
+        }
+    }
+
+    static String simplifyType(String type) {
+        String simpleType = OBJ_SIGNATURE.matcher(type).replaceAll("L");
+        assert(simpleType.matches("^\\([A-Z]*\\)[A-Z]$"));
+        // change (DD)D to (D_D_)D_
+        simpleType = WIDE_SIGNATURE.matcher(simpleType).replaceAll("\\0_");
+        return simpleType;
+    }
+    static int argsize(String type) {
+        return simplifyType(type).length()-3;
+    }
+    private static final Pattern OBJ_SIGNATURE = Pattern.compile("\\[*L[^;]*;|\\[+[A-Z]");
+    private static final Pattern WIDE_SIGNATURE = Pattern.compile("[JD]");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JOptionPane/6464022/bug6464022.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6464022
+ * @summary Memory leak in JOptionPane.createDialog
+ * @author Pavel Porvatov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug6464022
+ */
+
+import javax.swing.*;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+public class bug6464022 {
+    private static JOptionPane pane;
+
+    public static void main(String[] args) throws Exception {
+        final List<WeakReference<JDialog>> references = new ArrayList<WeakReference<JDialog>>();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                pane = new JOptionPane(null, JOptionPane.UNDEFINED_CONDITION);
+
+                for (int i = 0; i < 10; i++) {
+                    JDialog dialog = pane.createDialog(null, "Test " + i);
+
+                    references.add(new WeakReference<JDialog>(dialog));
+
+                    dialog.dispose();
+
+                    System.out.println("Disposing Dialog:" + dialog.hashCode());
+                }
+            }
+        });
+
+        Util.generateOOME();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                int allocatedCount = 0;
+
+                for (WeakReference<JDialog> ref : references) {
+                    if (ref.get() != null) {
+                        allocatedCount++;
+
+                        System.out.println(ref.get().hashCode() + " is still allocated");
+                    }
+                }
+
+                if (allocatedCount > 0) {
+                    throw new RuntimeException("Some dialogs still exist in memory. Test failed");
+                } else {
+                    System.out.println("All dialogs were GCed. Test passed.");
+                }
+            }
+        });
+    }
+}
--- a/jdk/test/javax/swing/UIDefaults/6795356/bug6795356.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/test/javax/swing/UIDefaults/6795356/bug6795356.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,6 +26,8 @@
  * @bug 6795356
  * @summary Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
  * @author Alexander Potochkin
+ * @library ../../regtesthelpers
+ * @build Util
  * @run main bug6795356
  */
 
@@ -58,43 +60,11 @@
         weakRef = new WeakReference<ProtectionDomain>(domain);
         domain = null;
 
-        // Generate OutOfMemory and check the weak ref
-        generateOOME();
+        Util.generateOOME();
 
         if (weakRef.get() != null) {
             throw new RuntimeException("Memory leak found!");
         }
         System.out.println("Test passed");
     }
-
-    static void generateOOME() {
-        List<Object> bigLeak = new LinkedList<Object>();
-        boolean oome = false;
-        System.out.print("Filling the heap");
-        try {
-            for(int i = 0; true ; i++) {
-                // Now, use up all RAM
-                bigLeak.add(new byte[1024 * 1024]);
-                System.out.print(".");
-
-                // Give the GC a change at that weakref
-                if (i % 10 == 0) {
-                    System.gc();
-                    try {
-                        Thread.sleep(100);
-                    } catch (InterruptedException e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        } catch (OutOfMemoryError e) {
-            bigLeak = null;
-            oome = true;
-        }
-        System.out.println("");
-        if (!oome) {
-            throw new RuntimeException("Problem with test case - never got OOME");
-        }
-        System.out.println("Got OOME");
-    }
 }
--- a/jdk/test/javax/swing/regtesthelpers/Util.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/test/javax/swing/regtesthelpers/Util.java	Thu Mar 31 22:07:32 2011 -0700
@@ -24,6 +24,8 @@
 import javax.swing.*;
 import java.awt.*;
 import java.awt.image.BufferedImage;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * <p>This class contains utilities useful for regression testing.
@@ -72,4 +74,46 @@
 
         return true;
     }
+
+    /**
+     * Fills the heap until OutOfMemoryError occurs. This method is useful for
+     * WeakReferences removing.
+     */
+    public static void generateOOME() {
+        List<Object> bigLeak = new LinkedList<Object>();
+
+        boolean oome = false;
+
+        System.out.print("Filling the heap");
+
+        try {
+            for(int i = 0; true ; i++) {
+                // Now, use up all RAM
+                bigLeak.add(new byte[1024 * 1024]);
+
+                System.out.print(".");
+
+                // Give the GC a change at that weakref
+                if (i % 10 == 0) {
+                    System.gc();
+                    try {
+                        Thread.sleep(100);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        } catch (OutOfMemoryError e) {
+            bigLeak = null;
+            oome = true;
+        }
+
+        System.out.println("");
+
+        if (!oome) {
+            throw new RuntimeException("Problem with test case - never got OOME");
+        }
+
+        System.out.println("Got OOME");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/pipe/Test7027667.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     7027667, 7023591
+ *
+ * @summary Verifies that aa clipped rectangles are drawn, not filled.
+ *
+ * @run     main Test7027667
+ */
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+import static java.awt.RenderingHints.*;
+
+public class Test7027667 {
+    public static void main(String[] args) throws Exception {
+        BufferedImage bImg = new BufferedImage(512, 512, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = (Graphics2D) bImg.getGraphics();
+        g2d.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);
+        g2d.setClip(new Ellipse2D.Double(0, 0, 100, 100));
+        g2d.drawRect(10, 10, 100, 100);
+        if (new Color(bImg.getRGB(50, 50)).equals(Color.white)) {
+            throw new Exception("Rectangle should be drawn, not filled");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/pisces/Renderer/Test7019861.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     7019861
+ *
+ * @summary Verifies that the last scanline isn't skipped when doing
+ *          antialiased rendering.
+ *
+ * @run     main Test7019861
+ */
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.geom.Path2D;
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static java.awt.RenderingHints.*;
+
+public class Test7019861 {
+
+    public static void main(String[] argv) throws Exception {
+        BufferedImage im = getWhiteImage(30, 30);
+        Graphics2D g2 = (Graphics2D)im.getGraphics();
+        g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);
+        g2.setRenderingHint(KEY_STROKE_CONTROL, VALUE_STROKE_PURE);
+        g2.setStroke(new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+        g2.setBackground(Color.white);
+        g2.setColor(Color.black);
+
+        Path2D p = getPath(0, 0, 20);
+        g2.draw(p);
+
+        if (!(new Color(im.getRGB(20, 19))).equals(Color.black)) {
+            throw new Exception("This pixel should be black");
+        }
+    }
+
+    private static Path2D getPath(int x, int y, int len) {
+        Path2D p = new Path2D.Double();
+        p.moveTo(x, y);
+        p.quadTo(x + len, y, x + len, y + len);
+        return p;
+    }
+
+    private static BufferedImage getWhiteImage(int w, int h) {
+        BufferedImage ret = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        final int[] white = new int[w * h];
+        Arrays.fill(white, 0xffffff);
+        ret.setRGB(0, 0, w, h, white, 0, w);
+        return ret;
+    }
+}
--- a/jdk/test/sun/text/resources/LocaleData	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/test/sun/text/resources/LocaleData	Thu Mar 31 22:07:32 2011 -0700
@@ -6101,3 +6101,258 @@
 
 # bug 6919624
 CalendarData/hu/minimalDaysInFirstWeek=4
+
+# bug 6998391
+CalendarData/sr-Latn/firstDayOfWeek=2
+CalendarData/sr-Latn-BA/firstDayOfWeek=2
+CalendarData/sr-Latn-ME/firstDayOfWeek=2
+CalendarData/sr-Latn-RS/firstDayOfWeek=2
+#
+CalendarData/sr-Latn/minimalDaysInFirstWeek=1
+CalendarData/sr-Latn-BA/minimalDaysInFirstWeek=4
+CalendarData/sr-Latn-ME/minimalDaysInFirstWeek=4
+CalendarData/sr-Latn-RS/minimalDaysInFirstWeek=4
+#
+LocaleNames/sr-Latn/SR=Surinam
+LocaleNames/sr-Latn-BA/SR=Surinam
+LocaleNames/sr-Latn-ME/SR=Surinam
+LocaleNames/sr-Latn-RS/SR=Surinam
+#
+FormatData/sr-Latn/MonthNames/2=mart
+FormatData/sr-Latn-BA/MonthNames/4=maj
+FormatData/sr-Latn-ME/MonthNames/7=avgust
+FormatData/sr-Latn-RS/MonthNames/8=septembar
+#
+FormatData/sr-Latn/DayNames/1=ponedeljak
+FormatData/sr-Latn-BA/DayNames/2=utorak
+FormatData/sr-Latn-ME/DayNames/3=sreda
+FormatData/sr-Latn-RS/DayNames/4=\u010detvrtak
+#
+FormatData/sr-Latn/DayAbbreviations/1=pon
+FormatData/sr-Latn-BA/DayAbbreviations/2=uto
+FormatData/sr-Latn-ME/DayAbbreviations/3=sre
+FormatData/sr-Latn-RS/DayAbbreviations/4=\u010det
+#
+CurrencyNames/sr-Latn/EUR=EUR
+CurrencyNames/sr-Latn-BA/EUR=\u20ac
+CurrencyNames/sr-Latn-BA/BAM=KM
+CurrencyNames/sr-Latn-ME/EUR=\u20ac
+CurrencyNames/sr-Latn-RS/EUR=EUR
+#
+FormatData/sr-Latn/DateTimePatterns/1=HH.mm.ss z
+FormatData/sr-Latn-BA/DateTimePatterns/2=HH.mm.ss
+FormatData/sr-Latn-ME/DateTimePatterns/5=d.MM.yyyy.
+FormatData/sr-Latn-RS/DateTimePatterns/5=dd. MMMM y.
+
+# bug 7019267
+CurrencyNames/pt/adp=Peseta de Andorra
+CurrencyNames/pt/aed=Dir\u00e9m dos Emirados \u00c1rabes Unidos
+CurrencyNames/pt/afa=Afegane (1927-2002)
+CurrencyNames/pt/afn=Afegane
+CurrencyNames/pt/all=Lek Alban\u00eas
+CurrencyNames/pt/amd=Dram arm\u00eanio
+CurrencyNames/pt/ang=Guilder das Antilhas Holandesas
+CurrencyNames/pt/aoa=Cuanza angolano
+CurrencyNames/pt/ars=Peso argentino
+CurrencyNames/pt/ats=Xelim austr\u00edaco
+CurrencyNames/pt/aud=D\u00f3lar australiano
+CurrencyNames/pt/awg=Guilder de Aruba
+CurrencyNames/pt/azm=Manat azerbaijano
+CurrencyNames/pt/azn=Manat do Azerbaij\u00e3o
+CurrencyNames/pt/bam=Marco b\u00f3snio-herzegovino convers\u00edvel
+CurrencyNames/pt/bbd=D\u00f3lar de Barbados
+CurrencyNames/pt/bdt=Taka de Bangladesh
+CurrencyNames/pt/bef=Franco belga
+CurrencyNames/pt/bgl=Lev forte b\u00falgaro
+CurrencyNames/pt/bgn=Lev novo b\u00falgaro
+CurrencyNames/pt/bhd=Dinar bareinita
+CurrencyNames/pt/bif=Franco do Burundi
+CurrencyNames/pt/bmd=D\u00f3lar das Bermudas
+CurrencyNames/pt/bnd=D\u00f3lar do Brunei
+CurrencyNames/pt/bov=Mvdol boliviano
+CurrencyNames/pt/brl=Real brasileiro
+CurrencyNames/pt/bsd=D\u00f3lar das Bahamas
+CurrencyNames/pt/btn=Ngultrum do But\u00e3o
+CurrencyNames/pt/bwp=Pula botsuanesa
+CurrencyNames/pt/byb=Rublo novo bielo-russo (1994-1999)
+CurrencyNames/pt/byr=Rublo bielo-russo
+CurrencyNames/pt/bzd=D\u00f3lar do Belize
+CurrencyNames/pt/cad=D\u00f3lar canadense
+CurrencyNames/pt/cdf=Franco congol\u00eas
+CurrencyNames/pt/chf=Franco su\u00ed\u00e7o
+CurrencyNames/pt/clf=Unidades de Fomento chilenas
+CurrencyNames/pt/clp=Peso chileno
+CurrencyNames/pt/cny=Yuan Renminbi chin\u00eas
+CurrencyNames/pt/cop=Peso colombiano
+CurrencyNames/pt/crc=Colon da Costa Rica
+CurrencyNames/pt/csd=Dinar s\u00e9rvio antigo
+CurrencyNames/pt/cup=Peso cubano
+CurrencyNames/pt/cve=Escudo cabo-verdiano
+CurrencyNames/pt/cyp=Libra cipriota
+CurrencyNames/pt/czk=Coroa checa
+CurrencyNames/pt/dem=Marco alem\u00e3o
+CurrencyNames/pt/djf=Franco do Djibuti
+CurrencyNames/pt/dkk=Coroa dinamarquesa
+CurrencyNames/pt/dop=Peso dominicano
+CurrencyNames/pt/dzd=Dinar argelino
+CurrencyNames/pt/eek=Coroa estoniana
+CurrencyNames/pt/egp=Libra eg\u00edpcia
+CurrencyNames/pt/ern=Nakfa da Eritreia
+CurrencyNames/pt/esp=Peseta espanhola
+CurrencyNames/pt/etb=Birr et\u00edope
+CurrencyNames/pt/fim=Marca finlandesa
+CurrencyNames/pt/fjd=D\u00f3lar de Fiji
+CurrencyNames/pt/fkp=Libra das Malvinas
+CurrencyNames/pt/frf=Franco franc\u00eas
+CurrencyNames/pt/gbp=Libra esterlina brit\u00e2nica
+CurrencyNames/pt/gel=Lari georgiano
+CurrencyNames/pt/ghc=Cedi de Gana (1979-2007)
+CurrencyNames/pt/ghs=Cedi gan\u00eas
+CurrencyNames/pt/gip=Libra de Gibraltar
+CurrencyNames/pt/gmd=Dalasi de G\u00e2mbia
+CurrencyNames/pt/gnf=Franco de Guin\u00e9
+CurrencyNames/pt/grd=Dracma grego
+CurrencyNames/pt/gtq=Quet\u00e7al da Guatemala
+CurrencyNames/pt/gwp=Peso da Guin\u00e9-Bissau
+CurrencyNames/pt/gyd=D\u00f3lar da Guiana
+CurrencyNames/pt/hkd=D\u00f3lar de Hong Kong
+CurrencyNames/pt/hnl=Lempira de Honduras
+CurrencyNames/pt/hrk=Kuna croata
+CurrencyNames/pt/htg=Gurde do Haiti
+CurrencyNames/pt/huf=Forinte h\u00fangaro
+CurrencyNames/pt/idr=Rupia indon\u00e9sia
+CurrencyNames/pt/iep=Libra irlandesa
+CurrencyNames/pt/ils=Sheqel Novo israelita
+CurrencyNames/pt/inr=R\u00fapia indiana
+CurrencyNames/pt/iqd=Dinar iraquiano
+CurrencyNames/pt/irr=Rial iraniano
+CurrencyNames/pt/isk=Coroa islandesa
+CurrencyNames/pt/itl=Lira italiana
+CurrencyNames/pt/jmd=D\u00f3lar jamaicano
+CurrencyNames/pt/jod=Dinar jordaniano
+CurrencyNames/pt/jpy=Iene japon\u00eas
+CurrencyNames/pt/kes=Xelim queniano
+CurrencyNames/pt/kgs=Som quirguiz
+CurrencyNames/pt/khr=Riel cambojano
+CurrencyNames/pt/kmf=Franco de Comores
+CurrencyNames/pt/kpw=Won norte-coreano
+CurrencyNames/pt/krw=Won sul-coreano
+CurrencyNames/pt/kwd=Dinar coveitiano
+CurrencyNames/pt/kyd=D\u00f3lar das Ilhas Caiman
+CurrencyNames/pt/kzt=Tenge do Cazaquist\u00e3o
+CurrencyNames/pt/lak=Kip de Laos
+CurrencyNames/pt/lbp=Libra libanesa
+CurrencyNames/pt/lkr=Rupia do Sri Lanka
+CurrencyNames/pt/lrd=D\u00f3lar liberiano
+CurrencyNames/pt/lsl=Loti do Lesoto
+CurrencyNames/pt/ltl=Lita lituano
+CurrencyNames/pt/luf=Franco luxemburgu\u00eas
+CurrencyNames/pt/lvl=Lats let\u00e3o
+CurrencyNames/pt/lyd=Dinar l\u00edbio
+CurrencyNames/pt/mad=Dir\u00e9m marroquino
+CurrencyNames/pt/mdl=Leu mold\u00e1vio
+CurrencyNames/pt/mga=Ariary de Madagascar
+CurrencyNames/pt/mgf=Franco de Madagascar
+CurrencyNames/pt/mkd=Dinar maced\u00f4nio
+CurrencyNames/pt/mmk=Kyat de Mianmar
+CurrencyNames/pt/mnt=Tugrik mongol
+CurrencyNames/pt/mop=Pataca macaense
+CurrencyNames/pt/mro=Ouguiya da Maurit\u00e2nia
+CurrencyNames/pt/mtl=Lira maltesa
+CurrencyNames/pt/mur=Rupia de Maur\u00edcio
+CurrencyNames/pt/mvr=Rupias das Ilhas Maldivas
+CurrencyNames/pt/mwk=Cuacha do Mal\u00e1ui
+CurrencyNames/pt/mxn=Peso mexicano
+CurrencyNames/pt/mxv=Unidade Mexicana de Investimento (UDI)
+CurrencyNames/pt/myr=Ringgit malaio
+CurrencyNames/pt/mzm=Metical antigo de Mo\u00e7ambique
+CurrencyNames/pt/mzn=Metical do Mo\u00e7ambique
+CurrencyNames/pt/nad=D\u00f3lar da Nam\u00edbia
+CurrencyNames/pt/ngn=Naira nigeriana
+CurrencyNames/pt/nio=C\u00f3rdoba Ouro nicaraguense
+CurrencyNames/pt/nlg=Florim holand\u00eas
+CurrencyNames/pt/nok=Coroa norueguesa
+CurrencyNames/pt/npr=Rupia nepalesa
+CurrencyNames/pt/nzd=D\u00f3lar da Nova Zel\u00e2ndia
+CurrencyNames/pt/omr=Rial de Om\u00e3
+CurrencyNames/pt/pab=Balboa panamenho
+CurrencyNames/pt/pen=Sol Novo peruano
+CurrencyNames/pt/pgk=Kina da Papua-Nova Guin\u00e9
+CurrencyNames/pt/php=Peso filipino
+CurrencyNames/pt/pkr=Rupia paquistanesa
+CurrencyNames/pt/pln=Zloti polon\u00eas
+CurrencyNames/pt/pte=Escudo portugu\u00eas
+CurrencyNames/pt/pyg=Guarani paraguaio
+CurrencyNames/pt/qar=Rial catariano
+CurrencyNames/pt/rol=Leu romeno antigo
+CurrencyNames/pt/ron=Leu romeno
+CurrencyNames/pt/rsd=Dinar s\u00e9rvio
+CurrencyNames/pt/rub=Rublo russo
+CurrencyNames/pt/rur=Rublo russo (1991-1998)
+CurrencyNames/pt/rwf=Franco ruand\u00eas
+CurrencyNames/pt/sar=Rial saudita
+CurrencyNames/pt/sbd=D\u00f3lar das Ilhas Salom\u00e3o
+CurrencyNames/pt/scr=Rupia das Seychelles
+CurrencyNames/pt/sdd=Dinar sudan\u00eas
+CurrencyNames/pt/sdg=Libra sudanesa
+CurrencyNames/pt/sek=Coroa sueca
+CurrencyNames/pt/sgd=D\u00f3lar de Cingapura
+CurrencyNames/pt/shp=Libra de Santa Helena
+CurrencyNames/pt/sit=Tolar Bons esloveno
+CurrencyNames/pt/skk=Coroa eslovaca
+CurrencyNames/pt/sll=Leone de Serra Leoa
+CurrencyNames/pt/sos=Xelim somali
+CurrencyNames/pt/srd=D\u00f3lar do Suriname
+CurrencyNames/pt/srg=Florim do Suriname
+CurrencyNames/pt/std=Dobra de S\u00e3o Tom\u00e9 e Pr\u00edncipe
+CurrencyNames/pt/svc=Colom salvadorenho
+CurrencyNames/pt/syp=Libra s\u00edria
+CurrencyNames/pt/szl=Lilangeni da Suazil\u00e2ndia
+CurrencyNames/pt/thb=Baht tailand\u00eas
+CurrencyNames/pt/tjs=Somoni tadjique
+CurrencyNames/pt/tmm=Manat do Turcomenist\u00e3o
+CurrencyNames/pt/tnd=Dinar tunisiano
+CurrencyNames/pt/top=Pa\u02bbanga de Tonga
+CurrencyNames/pt/tpe=Escudo timorense
+CurrencyNames/pt/trl=Lira turca antiga
+CurrencyNames/pt/try=Lira turca
+CurrencyNames/pt/ttd=D\u00f3lar de Trinidad e Tobago
+CurrencyNames/pt/twd=D\u00f3lar Novo de Taiwan
+CurrencyNames/pt/tzs=Xelim da Tanz\u00e2nia
+CurrencyNames/pt/uah=Hryvnia ucraniano
+CurrencyNames/pt/ugx=Xelim ugandense
+CurrencyNames/pt/usd=D\u00f3lar norte-americano
+CurrencyNames/pt/usn=D\u00f3lar norte-americano (Dia seguinte)
+CurrencyNames/pt/uss=D\u00f3lar norte-americano (Mesmo dia)
+CurrencyNames/pt/uyu=Peso uruguaio
+CurrencyNames/pt/uzs=Sum do Usbequist\u00e3o
+CurrencyNames/pt/veb=Bol\u00edvar venezuelano
+CurrencyNames/pt/vef=Bol\u00edvar v enezuelano forte
+CurrencyNames/pt/vnd=Dong vietnamita
+CurrencyNames/pt/vuv=Vatu de Vanuatu
+CurrencyNames/pt/wst=Tala samoano
+CurrencyNames/pt/xaf=Franco CFA BEAC
+CurrencyNames/pt/xag=Prata
+CurrencyNames/pt/xau=Ouro
+CurrencyNames/pt/xba=Unidade Composta Europeia
+CurrencyNames/pt/xbb=Unidade Monet\u00e1ria Europeia
+CurrencyNames/pt/xbc=Unidade de Conta Europeia (XBC)
+CurrencyNames/pt/xbd=Unidade de Conta Europeia (XBD)
+CurrencyNames/pt/xcd=D\u00f3lar do Caribe Oriental
+CurrencyNames/pt/xdr=Direitos Especiais de Giro
+CurrencyNames/pt/xfo=Franco-ouro franc\u00eas
+CurrencyNames/pt/xfu=Franco UIC franc\u00eas
+CurrencyNames/pt/xof=Franco CFA BCEAO
+CurrencyNames/pt/xpd=Pal\u00e1dio
+CurrencyNames/pt/xpf=Franco CFP
+CurrencyNames/pt/xpt=Platina
+CurrencyNames/pt/xts=C\u00f3digo de Moeda de Teste
+CurrencyNames/pt/xxx=Moeda Desconhecida ou Inv\u00e1lida
+CurrencyNames/pt/yer=Rial iemenita
+CurrencyNames/pt/yum=Dinar noviy iugoslavo
+CurrencyNames/pt/zar=Rand sul-africano
+CurrencyNames/pt/zmk=Cuacha zambiano
+CurrencyNames/pt/zwd=D\u00f3lar do Zimb\u00e1bue
+
+# bug 7020960
+CurrencyNames/sr_RS/RSD=\u0434\u0438\u043d.
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -33,7 +33,7 @@
  *      6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259
  *      6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
  *      6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
- *      6919624
+ *      6919624 6998391 7019267 7020960
  * @summary Verify locale data
  *
  */
@@ -91,6 +91,10 @@
  *        LocaleNames/fr_FR/US=\u00c9tats-Unis
  *        LocaleNames/fr_FR/FR=France</pre>
  *
+ *    You can use language tag with '-' in locale field like this:<pre>
+ *        LocaleNames/sr-Latn/SR=Surinam
+ *        FormatData/sr-Latn-BA/DayNames/2=utorak</pre>
+ *
  *    The command-line syntax of this test is
  *        <tt>java LocaleDataTest [-w] [{ -s | <filename> }]</tt>
  *
@@ -242,7 +246,9 @@
         if (index == -1 || index + 1 == key.length())
             throw new Exception("Malformed input file: \"" + key + "\" is missing locale name");
         localeName = key.substring(oldIndex, index);
-        if (localeName.length() > 0) {
+        boolean use_tag = localeName.indexOf("-") != -1;
+
+        if (use_tag == false && localeName.length() > 0) {
             language = localeName.substring(0, 2);
             if (localeName.length() > 3) {
                 country = localeName.substring(3, 5);
@@ -283,8 +289,14 @@
             } else {
                 fullName = "sun.text.resources." + rbName;
             }
+            Locale locale;
+            if (use_tag) {
+                locale = Locale.forLanguageTag(localeName);
+            } else {
+                locale = new Locale(language, country, variant);
+            }
             ResourceBundle bundle = ResourceBundle.getBundle(fullName,
-                           new Locale(language, country, variant),
+                           locale,
                            ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT));
             resource = bundle.getObject(resTag);
         }
--- a/langtools/.hgtags	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/.hgtags	Thu Mar 31 22:07:32 2011 -0700
@@ -108,3 +108,5 @@
 67221b8643b478c4fceacc89240db876455aae76 jdk7-b131
 e3d011d59a33acef79eff7523bef069557e91002 jdk7-b132
 e77e98f936e83d94c9b56cc7af218dc822a06122 jdk7-b133
+3d7acdbb72cab55deedfd35f60d4732abc9d6ac4 jdk7-b134
+9d0a61ac567b983da7cc8f4a7030f2245bb6dbab jdk7-b135
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -305,11 +305,7 @@
             tr.addContent(tdFirst);
             HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
             tdLast.addStyle(HtmlStyle.colLast);
-            if (pkg != null) {
-                addSummaryComment(pkg, tdLast);
-            } else {
-                tdLast.addContent(getSpace());
-            }
+            addSummaryComment(pkg, tdLast);
             tr.addContent(tdLast);
             tbody.addContent(tr);
         }
@@ -355,10 +351,7 @@
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
-        if (pkg != null)
-            addSummaryComment(pkg, tdLast);
-        else
-            tdLast.addContent(getSpace());
+        addSummaryComment(pkg, tdLast);
         contentTree.addContent(tdLast);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Thu Mar 31 22:07:32 2011 -0700
@@ -283,23 +283,32 @@
         Content framePara = HtmlTree.P(line26);
         liFrame.addContent(framePara);
         ul.addContent(liFrame);
+        Content allclassesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
+                getResource("doclet.All_Classes"));
+        Content liAllClasses = HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
+        Content line27 = getResource("doclet.Help_line_27",
+                getHyperLinkString("allclasses-noframe.html",
+                configuration.getText("doclet.All_Classes")));
+        Content allclassesPara = HtmlTree.P(line27);
+        liAllClasses.addContent(allclassesPara);
+        ul.addContent(liAllClasses);
         Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Serialized_Form"));
         Content liSerial = HtmlTree.LI(HtmlStyle.blockList, sHead);
-        Content line27 = getResource("doclet.Help_line_27");
-        Content serialPara = HtmlTree.P(line27);
+        Content line28 = getResource("doclet.Help_line_28");
+        Content serialPara = HtmlTree.P(line28);
         liSerial.addContent(serialPara);
         ul.addContent(liSerial);
         Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Constants_Summary"));
         Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
-        Content line28 = getResource("doclet.Help_line_28");
-        Content constPara = HtmlTree.P(line28);
+        Content line29 = getResource("doclet.Help_line_29");
+        Content constPara = HtmlTree.P(line29);
         liConst.addContent(constPara);
         ul.addContent(liConst);
         Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
-        Content line29 = HtmlTree.EM(getResource("doclet.Help_line_29"));
-        divContent.addContent(line29);
+        Content line30 = HtmlTree.EM(getResource("doclet.Help_line_30"));
+        divContent.addContent(line30);
         contentTree.addContent(divContent);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -246,10 +246,7 @@
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
-        if (pkg != null)
-            addSummaryComment(pkg, tdLast);
-        else
-            tdLast.addContent(getSpace());
+        addSummaryComment(pkg, tdLast);
         contentTree.addContent(tdLast);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -167,7 +167,7 @@
 doclet.Help_line_1=How This API Document Is Organized
 doclet.Help_line_2=This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
 doclet.Help_line_3=The {0} page is the front page of this API document and provides a list of all packages with a summary for each.  This page can also contain an overall description of the set of packages.
-doclet.Help_line_4=Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
+doclet.Help_line_4=Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
 doclet.Help_line_5=Class/Interface
 doclet.Help_line_6=Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
 doclet.Help_line_7=Class inheritance diagram
@@ -190,9 +190,10 @@
 doclet.Help_line_24=These links take you to the next or previous class, interface, package, or related page.
 doclet.Help_line_25=Frames/No Frames
 doclet.Help_line_26=These links show and hide the HTML frames.  All pages are available with or without frames.
-doclet.Help_line_27=Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
-doclet.Help_line_28=The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.
-doclet.Help_line_29=This help file applies to API documentation generated using the standard doclet.
+doclet.Help_line_27=The {0} link shows all classes and interfaces except non-static nested types.
+doclet.Help_line_28=Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+doclet.Help_line_29=The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.
+doclet.Help_line_30=This help file applies to API documentation generated using the standard doclet.
 doclet.Help_enum_line_1=Each enum has its own separate page with the following sections:
 doclet.Help_enum_line_2=Enum declaration
 doclet.Help_enum_line_3=Enum description
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -129,19 +129,11 @@
 
     public Boolean call() {
         if (!used.getAndSet(true)) {
-            beginContext();
+            initContext();
             notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
-            try {
-                compilerMain.setFatalErrors(true);
-                result = compilerMain.compile(args, context, fileObjects, processors);
-            } finally {
-                endContext();
-            }
-            compilerMain = null;
-            args = null;
-            context = null;
-            fileObjects = null;
-            notYetEntered = null;
+            compilerMain.setFatalErrors(true);
+            result = compilerMain.compile(args, context, fileObjects, processors);
+            cleanup();
             return result == 0;
         } else {
             throw new IllegalStateException("multiple calls to method 'call'");
@@ -163,8 +155,11 @@
     }
 
     private void prepareCompiler() throws IOException {
-        if (!used.getAndSet(true)) {
-            beginContext();
+        if (used.getAndSet(true)) {
+            if (compiler == null)
+                throw new IllegalStateException();
+        } else {
+            initContext();
             compilerMain.setOptions(Options.instance(context));
             compilerMain.filenames = new ListBuffer<File>();
             List<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
@@ -185,13 +180,12 @@
         }
     }
 
-    private void beginContext() {
+    private void initContext() {
         context.put(JavacTaskImpl.class, this);
         if (context.get(TaskListener.class) != null)
             context.put(TaskListener.class, (TaskListener)null);
         if (taskListener != null)
             context.put(TaskListener.class, wrap(taskListener));
-        tool.beginContext(context);
         //initialize compiler's default locale
         JavacMessages.instance(context).setCurrentLocale(locale);
     }
@@ -218,8 +212,15 @@
         };
     }
 
-    private void endContext() {
-        tool.endContext();
+    void cleanup() {
+        if (compiler != null)
+            compiler.close();
+        compiler = null;
+        compilerMain = null;
+        args = null;
+        context = null;
+        fileObjects = null;
+        notYetEntered = null;
     }
 
     /**
@@ -446,12 +447,12 @@
             }
             if (genList.isEmpty()) {
                 compiler.reportDeferredDiagnostics();
-                compiler.log.flush();
-                endContext();
+                cleanup();
             }
         }
         finally {
-            compiler.log.flush();
+            if (compiler != null)
+                compiler.log.flush();
         }
         return results;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Thu Mar 31 22:07:32 2011 -0700
@@ -152,36 +152,6 @@
         return new JavacFileManager(context, true, charset);
     }
 
-    private boolean compilationInProgress = false;
-
-    /**
-     * Register that a compilation is about to start.
-     */
-    void beginContext(Context context) {
-        if (compilationInProgress)
-            throw new IllegalStateException("Compilation in progress");
-        compilationInProgress = true;
-        final JavaFileManager givenFileManager = context.get(JavaFileManager.class);
-        context.put(JavaFileManager.class, (JavaFileManager)null);
-        context.put(JavaFileManager.class, new Context.Factory<JavaFileManager>() {
-            public JavaFileManager make(Context c) {
-                if (givenFileManager != null) {
-                    c.put(JavaFileManager.class, givenFileManager);
-                    return givenFileManager;
-                } else {
-                    return new JavacFileManager(c, true, null);
-                }
-            }
-        });
-    }
-
-    /**
-     * Register that a compilation is completed.
-     */
-    void endContext() {
-        compilationInProgress = false;
-    }
-
     public JavacTask getTask(Writer out,
                              JavaFileManager fileManager,
                              DiagnosticListener<? super JavaFileObject> diagnosticListener,
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Mar 31 22:07:32 2011 -0700
@@ -131,6 +131,12 @@
     public boolean allowMulticatch() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean allowImprovedRethrowAnalysis() {
+        return compareTo(JDK1_7) >= 0;
+    }
+    public boolean allowImprovedCatchAnalysis() {
+        return compareTo(JDK1_7) >= 0;
+    }
     public boolean allowEnums() {
         return compareTo(JDK1_5) >= 0;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Mar 31 22:07:32 2011 -0700
@@ -3004,6 +3004,30 @@
         throw new AssertionError();
     }
 
+    /**
+     * Attribute an env for either a top level tree or class declaration.
+     */
+    public void attrib(Env<AttrContext> env) {
+        if (env.tree.getTag() == JCTree.TOPLEVEL)
+            attribTopLevel(env);
+        else
+            attribClass(env.tree.pos(), env.enclClass.sym);
+    }
+
+    /**
+     * Attribute a top level tree. These trees are encountered when the
+     * package declaration has annotations.
+     */
+    public void attribTopLevel(Env<AttrContext> env) {
+        JCCompilationUnit toplevel = env.toplevel;
+        try {
+            annotate.flush();
+            chk.validateAnnotations(toplevel.packageAnnotations, toplevel.packge);
+        } catch (CompletionFailure ex) {
+            chk.completionError(toplevel.pos(), ex);
+        }
+    }
+
     /** Main method: attribute class definition associated with given class symbol.
      *  reporting completion failures at the given position.
      *  @param pos The source position at which completion errors are to be
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Mar 31 22:07:32 2011 -0700
@@ -190,7 +190,8 @@
     private final Resolve rs;
     private Env<AttrContext> attrEnv;
     private       Lint lint;
-    private final boolean allowRethrowAnalysis;
+    private final boolean allowImprovedRethrowAnalysis;
+    private final boolean allowImprovedCatchAnalysis;
 
     public static Flow instance(Context context) {
         Flow instance = context.get(flowKey);
@@ -209,7 +210,8 @@
         lint = Lint.instance(context);
         rs = Resolve.instance(context);
         Source source = Source.instance(context);
-        allowRethrowAnalysis = source.allowMulticatch();
+        allowImprovedRethrowAnalysis = source.allowImprovedRethrowAnalysis();
+        allowImprovedCatchAnalysis = source.allowImprovedCatchAnalysis();
     }
 
     /** A flag that indicates whether the last statement could
@@ -1046,7 +1048,9 @@
             }
         }
         scanStat(tree.body);
-        List<Type> thrownInTry = thrown;
+        List<Type> thrownInTry = allowImprovedCatchAnalysis ?
+            chk.union(thrown, List.of(syms.runtimeExceptionType, syms.errorType)) :
+            thrown;
         thrown = thrownPrev;
         caught = caughtPrev;
         boolean aliveEnd = alive;
@@ -1081,16 +1085,7 @@
                     ctypes = ctypes.append(exc);
                     if (types.isSameType(exc, syms.objectType))
                         continue;
-                    if (chk.subset(exc, caughtInTry)) {
-                        log.error(l.head.pos(),
-                                  "except.already.caught", exc);
-                    } else if (!chk.isUnchecked(l.head.pos(), exc) &&
-                               exc.tsym != syms.throwableType.tsym &&
-                               exc.tsym != syms.exceptionType.tsym &&
-                               !chk.intersects(exc, thrownInTry)) {
-                        log.error(l.head.pos(),
-                                  "except.never.thrown.in.try", exc);
-                    }
+                    checkCaughtType(l.head.pos(), exc, thrownInTry, caughtInTry);
                     caughtInTry = chk.incl(exc, caughtInTry);
                 }
             }
@@ -1154,6 +1149,29 @@
         uninitsTry.andSet(uninitsTryPrev).andSet(uninits);
     }
 
+    void checkCaughtType(DiagnosticPosition pos, Type exc, List<Type> thrownInTry, List<Type> caughtInTry) {
+        if (chk.subset(exc, caughtInTry)) {
+            log.error(pos, "except.already.caught", exc);
+        } else if (!chk.isUnchecked(pos, exc) &&
+                exc.tsym != syms.throwableType.tsym &&
+                exc.tsym != syms.exceptionType.tsym &&
+                !chk.intersects(exc, thrownInTry)) {
+            log.error(pos, "except.never.thrown.in.try", exc);
+        } else if (allowImprovedCatchAnalysis) {
+            List<Type> catchableThrownTypes = chk.intersect(List.of(exc), thrownInTry);
+            // 'catchableThrownTypes' cannnot possibly be empty - if 'exc' was an
+            // unchecked exception, the result list would not be empty, as the augmented
+            // thrown set includes { RuntimeException, Error }; if 'exc' was a checked
+            // exception, that would have been covered in the branch above
+            if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty()) {
+                String key = catchableThrownTypes.length() == 1 ?
+                        "unreachable.catch" :
+                        "unreachable.catch.1";
+                log.warning(pos, key, catchableThrownTypes);
+            }
+        }
+    }
+
     public void visitConditional(JCConditional tree) {
         scanCond(tree.cond);
         Bits initsBeforeElse = initsWhenFalse;
@@ -1238,7 +1256,7 @@
             sym.kind == VAR &&
             (sym.flags() & (FINAL | EFFECTIVELY_FINAL)) != 0 &&
             preciseRethrowTypes.get(sym) != null &&
-            allowRethrowAnalysis) {
+            allowImprovedRethrowAnalysis) {
             for (Type t : preciseRethrowTypes.get(sym)) {
                 markThrown(tree, t);
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Mar 31 22:07:32 2011 -0700
@@ -89,7 +89,7 @@
 
     private FSInfo fsInfo;
 
-    private boolean useZipFileIndex;
+    private boolean contextUseOptimizedZip;
     private ZipFileIndexCache zipFileIndexCache;
 
     private final File uninited = new File("U N I N I T E D");
@@ -164,8 +164,8 @@
 
         fsInfo = FSInfo.instance(context);
 
-        useZipFileIndex = options.isSet("useOptimizedZip");
-        if (useZipFileIndex)
+        contextUseOptimizedZip = options.getBoolean("useOptimizedZip", true);
+        if (contextUseOptimizedZip)
             zipFileIndexCache = ZipFileIndexCache.getSharedInstance();
 
         mmappedIO = options.isSet("mmappedIO");
@@ -471,9 +471,27 @@
     private static final RelativeDirectory symbolFilePrefix
             = new RelativeDirectory("META-INF/sym/rt.jar/");
 
+    /*
+     * This method looks for a ZipFormatException and takes appropriate
+     * evasive action. If there is a failure in the fast mode then we
+     * fail over to the platform zip, and allow it to deal with a potentially
+     * non compliant zip file.
+     */
+    protected Archive openArchive(File zipFilename) throws IOException {
+        try {
+            return openArchive(zipFilename, contextUseOptimizedZip);
+        } catch (IOException ioe) {
+            if (ioe instanceof ZipFileIndex.ZipFormatException) {
+                return openArchive(zipFilename, false);
+            } else {
+                throw ioe;
+            }
+        }
+    }
+
     /** Open a new zip file directory, and cache it.
      */
-    protected Archive openArchive(File zipFileName) throws IOException {
+    private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
         File origZipFileName = zipFileName;
         if (!ignoreSymbolFile && paths.isDefaultBootClassPathRtJar(zipFileName)) {
             File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
@@ -495,7 +513,7 @@
             boolean usePreindexedCache = false;
             String preindexCacheLocation = null;
 
-            if (!useZipFileIndex) {
+            if (!useOptimizedZip) {
                 zdir = new ZipFile(zipFileName);
             } else {
                 usePreindexedCache = options.isSet("usezipindex");
@@ -524,23 +542,22 @@
             }
 
             if (origZipFileName == zipFileName) {
-                if (!useZipFileIndex) {
+                if (!useOptimizedZip) {
                     archive = new ZipArchive(this, zdir);
                 } else {
                     archive = new ZipFileIndexArchive(this,
-                                zipFileIndexCache.getZipFileIndex(zipFileName,
+                                    zipFileIndexCache.getZipFileIndex(zipFileName,
                                     null,
                                     usePreindexedCache,
                                     preindexCacheLocation,
                                     options.isSet("writezipindexfiles")));
                 }
             } else {
-                if (!useZipFileIndex) {
+                if (!useOptimizedZip) {
                     archive = new SymbolArchive(this, origZipFileName, zdir, symbolFilePrefix);
-                }
-                else {
+                } else {
                     archive = new ZipFileIndexArchive(this,
-                                zipFileIndexCache.getZipFileIndex(zipFileName,
+                                    zipFileIndexCache.getZipFileIndex(zipFileName,
                                     symbolFilePrefix,
                                     usePreindexedCache,
                                     preindexCacheLocation,
@@ -549,6 +566,8 @@
             }
         } catch (FileNotFoundException ex) {
             archive = new MissingArchive(zipFileName);
+        } catch (ZipFileIndex.ZipFormatException zfe) {
+            throw zfe;
         } catch (IOException ex) {
             if (zipFileName.exists())
                 log.error("error.reading.file", zipFileName, getMessage(ex));
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java	Thu Mar 31 22:07:32 2011 -0700
@@ -492,8 +492,30 @@
         public ZipDirectory(RandomAccessFile zipRandomFile, long start, long end, ZipFileIndex index) throws IOException {
             this.zipRandomFile = zipRandomFile;
             this.zipFileIndex = index;
+            hasValidHeader();
+            findCENRecord(start, end);
+        }
 
-            findCENRecord(start, end);
+        /*
+         * the zip entry signature should be at offset 0, otherwise allow the
+         * calling logic to take evasive action by throwing ZipFormatException.
+         */
+        private boolean hasValidHeader() throws IOException {
+            final long pos = zipRandomFile.getFilePointer();
+            try {
+                if (zipRandomFile.read() == 'P') {
+                    if (zipRandomFile.read() == 'K') {
+                        if (zipRandomFile.read() == 0x03) {
+                            if (zipRandomFile.read() == 0x04) {
+                                return true;
+                            }
+                        }
+                    }
+                }
+            } finally {
+                zipRandomFile.seek(pos);
+            }
+            throw new ZipFormatException("invalid zip magic");
         }
 
         /*
@@ -529,7 +551,13 @@
                     zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12) + 2];
                     zipDir[0] = endbuf[i + 10];
                     zipDir[1] = endbuf[i + 11];
-                    zipRandomFile.seek(start + get4ByteLittleEndian(endbuf, i + 16));
+                    int sz = get4ByteLittleEndian(endbuf, i + 16);
+                    // a negative offset or the entries field indicates a
+                    // potential zip64 archive
+                    if (sz < 0 || get2ByteLittleEndian(zipDir, 0) == 0xffff) {
+                        throw new ZipFormatException("detected a zip64 archive");
+                    }
+                    zipRandomFile.seek(start + sz);
                     zipRandomFile.readFully(zipDir, 2, zipDir.length - 2);
                     return;
                 } else {
@@ -1127,4 +1155,18 @@
         }
     }
 
+    /*
+     * Exception primarily used to implement a failover, used exclusively here.
+     */
+
+    static final class ZipFormatException extends IOException {
+        private static final long serialVersionUID = 8000196834066748623L;
+        protected ZipFormatException(String message) {
+            super(message);
+        }
+
+        protected ZipFormatException(String message, Throwable cause) {
+            super(message, cause);
+        }
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Mar 31 22:07:32 2011 -0700
@@ -638,6 +638,19 @@
         }
     }
 
+    /** Resolve an identifier which may be the binary name of a class or
+     * the Java name of a class or package.
+     * @param name      The name to resolve
+     */
+    public Symbol resolveBinaryNameOrIdent(String name) {
+        try {
+            Name flatname = names.fromString(name.replace("/", "."));
+            return reader.loadClass(flatname);
+        } catch (CompletionFailure ignore) {
+            return resolveIdent(name);
+        }
+    }
+
     /** Resolve an identifier.
      * @param name      The identifier to resolve
      */
@@ -1058,7 +1071,7 @@
                 } else {
                     boolean errors = false;
                     for (String nameStr : classnames) {
-                        Symbol sym = resolveIdent(nameStr);
+                        Symbol sym = resolveBinaryNameOrIdent(nameStr);
                         if (sym == null || (sym.kind == Kinds.PCK && !processPcks)) {
                             log.error("proc.cant.find.class", nameStr);
                             errors = true;
@@ -1166,7 +1179,7 @@
                                   env.enclClass.sym.sourcefile :
                                   env.toplevel.sourcefile);
         try {
-            attr.attribClass(env.tree.pos(), env.enclClass.sym);
+            attr.attrib(env);
             if (errorCount() > 0 && !shouldStop(CompileState.ATTR)) {
                 //if in fail-over mode, ensure that AST expression nodes
                 //are correctly initialized (e.g. they have a type/symbol)
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -73,9 +73,14 @@
 
     public Element asElement(TypeMirror t) {
         Type type = cast(Type.class, t);
-        if (type.tag != TypeTags.CLASS && type.tag != TypeTags.TYPEVAR)
-            return null;
-        return type.asElement();
+        switch (type.tag) {
+            case TypeTags.CLASS:
+            case TypeTags.ERROR:
+            case TypeTags.TYPEVAR:
+                return type.asElement();
+            default:
+                return null;
+        }
     }
 
     public boolean isSameType(TypeMirror t1, TypeMirror t2) {
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Mar 31 22:07:32 2011 -0700
@@ -820,13 +820,17 @@
         /** The set of package-info files to be processed this round. */
         List<PackageSymbol> packageInfoFiles;
 
+        /** The number of Messager errors generated in this round. */
+        int nMessagerErrors;
+
         /** Create a round (common code). */
-        private Round(Context context, int number, int priorWarnings) {
+        private Round(Context context, int number, int priorErrors, int priorWarnings) {
             this.context = context;
             this.number = number;
 
             compiler = JavaCompiler.instance(context);
             log = Log.instance(context);
+            log.nerrors = priorErrors;
             log.nwarnings += priorWarnings;
             log.deferDiagnostics = true;
 
@@ -840,7 +844,7 @@
 
         /** Create the first round. */
         Round(Context context, List<JCCompilationUnit> roots, List<ClassSymbol> classSymbols) {
-            this(context, 1, 0);
+            this(context, 1, 0, 0);
             this.roots = roots;
             genClassFiles = new HashMap<String,JavaFileObject>();
 
@@ -860,7 +864,10 @@
         /** Create a new round. */
         private Round(Round prev,
                 Set<JavaFileObject> newSourceFiles, Map<String,JavaFileObject> newClassFiles) {
-            this(prev.nextContext(), prev.number+1, prev.compiler.log.nwarnings);
+            this(prev.nextContext(),
+                    prev.number+1,
+                    prev.nMessagerErrors,
+                    prev.compiler.log.nwarnings);
             this.genClassFiles = prev.genClassFiles;
 
             List<JCCompilationUnit> parsedFiles = compiler.parseFiles(newSourceFiles);
@@ -1014,6 +1021,8 @@
                 if (taskListener != null)
                     taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
             }
+
+            nMessagerErrors = messager.errorCount();
         }
 
         void showDiagnostics(boolean showAll) {
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -1102,6 +1102,16 @@
     cast to {0} for a varargs call\n\
     cast to {1} for a non-varargs call and to suppress this warning
 
+# 0: list of type
+compiler.warn.unreachable.catch=\
+    unreachable catch clause\n\
+    thrown type {0} has already been caught
+
+# 0: list of type
+compiler.warn.unreachable.catch.1=\
+    unreachable catch clause\n\
+    thrown types {0} have already been caught
+
 # 0: symbol
 compiler.warn.long.SVUID=\
     serialVersionUID must be of type long in class {0}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -26,6 +26,7 @@
 package com.sun.tools.javac.util;
 
 import java.util.Collection;
+import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Locale;
@@ -226,17 +227,14 @@
                             DiagnosticPart.SOURCE));
             initFormat();
             initIndentation();
+            if (options.isSet("oldDiags"))
+                initOldFormat();
             String fmt = options.get("diagsFormat");
             if (fmt != null) {
-                String[] formats = fmt.split("\\|");
-                switch (formats.length) {
-                    case 3:
-                        setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, formats[2]);
-                    case 2:
-                        setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, formats[1]);
-                    default:
-                        setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, formats[0]);
-                }
+                if (fmt.equals("OLD"))
+                    initOldFormat();
+                else
+                    initFormats(fmt);
             }
             String srcPos = null;
             if ((((srcPos = options.get("sourcePosition")) != null)) &&
@@ -280,14 +278,35 @@
             initFormat();
             initIndentation();
         }
-        //where
+
         private void initFormat() {
-            availableFormats = new HashMap<BasicFormatKind, String>();
-            setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, "%f:%l:%_%t%L%m");
-            setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, "%p%L%m");
-            setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, "%f:%_%t%L%m");
+            initFormats("%f:%l:%_%p%L%m", "%p%L%m", "%f:%_%p%L%m");
+        }
+
+        private void initOldFormat() {
+            initFormats("%f:%l:%_%t%L%m", "%p%L%m", "%f:%_%t%L%m");
+        }
+
+        private void initFormats(String pos, String nopos, String clazz) {
+            availableFormats = new EnumMap<BasicFormatKind, String>(BasicFormatKind.class);
+            setFormat(BasicFormatKind.DEFAULT_POS_FORMAT,    pos);
+            setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, nopos);
+            setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT,  clazz);
         }
-        //where
+
+        @SuppressWarnings("fallthrough")
+        private void initFormats(String fmt) {
+            String[] formats = fmt.split("\\|");
+            switch (formats.length) {
+                case 3:
+                    setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, formats[2]);
+                case 2:
+                    setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, formats[1]);
+                default:
+                    setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, formats[0]);
+            }
+        }
+
         private void initIndentation() {
             indentationLevels = new HashMap<DiagnosticPart, Integer>();
             setIndentation(DiagnosticPart.SUMMARY, 0);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Options.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Options.java	Thu Mar 31 22:07:32 2011 -0700
@@ -76,6 +76,22 @@
     }
 
     /**
+     * Get the boolean value for an option, patterned after Boolean.getBoolean,
+     * essentially will return true, iff the value exists and is set to "true".
+     */
+    public boolean getBoolean(String name) {
+        return getBoolean(name, false);
+    }
+
+    /**
+     * Get the boolean with a default value if the option is not set.
+     */
+    public boolean getBoolean(String name, boolean defaultValue) {
+        String value = get(name);
+        return (value == null) ? defaultValue : Boolean.parseBoolean(value);
+    }
+
+    /**
      * Check if the value for an undocumented option has been set.
      */
     public boolean isSet(String name) {
--- a/langtools/src/share/classes/javax/lang/model/element/Element.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/javax/lang/model/element/Element.java	Thu Mar 31 22:07:32 2011 -0700
@@ -197,11 +197,12 @@
      * <li> If this is a {@linkplain
      * PackageElement#getEnclosingElement package}, {@code null} is
      * returned.
-
+     *
      * <li> If this is a {@linkplain
      * TypeParameterElement#getEnclosingElement type parameter},
-     * {@code null} is returned.
-
+     * {@linkplain TypeParameterElement#getGenericElement the
+     * generic element} of the type parameter is returned.
+     *
      * </ul>
      *
      * @return the enclosing element, or {@code null} if there is none
--- a/langtools/src/share/classes/javax/lang/model/element/TypeParameterElement.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/src/share/classes/javax/lang/model/element/TypeParameterElement.java	Thu Mar 31 22:07:32 2011 -0700
@@ -64,9 +64,9 @@
     List<? extends TypeMirror> getBounds();
 
     /**
-     * Returns {@code null}.
+     * Returns the {@linkplain TypeParameterElement#getGenericElement generic element} of this type parameter.
      *
-     * @return {@code null}
+     * @return the generic element of this type parameter
      */
     @Override
     Element getEnclosingElement();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testUseOption/C.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Class in an unnamed package.
+ */
+
+public class C {
+
+    /**
+     * Field in C.
+     */
+    public UsedInC fieldInC;
+
+    /**
+     * Method in C.
+     */
+    public UsedInC methodInC(UsedInC p) {
+        return p;
+    }
+}
--- a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4496290 4985072
+ * @bug 4496290 4985072 7006178
  * @summary A simple test to determine if -use works.
  * @author jamieh
  * @library ../lib/
@@ -34,7 +34,7 @@
 
 public class TestUseOption extends JavadocTester {
 
-    private static final String BUG_ID = "4496290-4985072";
+    private static final String BUG_ID = "4496290-4985072-7006178";
 
     //Input for string search tests.
     private static final String[] TEST2 = {
@@ -54,6 +54,16 @@
         "Method in C8.",
     };
 
+    private static final String[][] TEST3 = {
+        {BUG_ID + "-3" + FS + "class-use" + FS + "UsedInC.html", "Uses of <a href=" +
+                 "\"../UsedInC.html\" title=\"class in &lt;Unnamed&gt;\">" +
+                 "UsedInC</a> in <a href=\"../package-summary.html\">&lt;Unnamed&gt;</a>"
+        },
+        {BUG_ID + "-3" + FS + "package-use.html", "<td class=\"colOne\">" +
+                 "<a href=\"class-use/UsedInC.html#&lt;Unnamed&gt;\">UsedInC</a>&nbsp;</td>"
+        }
+    };
+
     private static final String[] ARGS = new String[] {
         "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
     };
@@ -62,6 +72,10 @@
         "-d", BUG_ID+"-2", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
     };
 
+    private static final String[] ARGS3 = new String[] {
+        "-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, "-use", SRC_DIR + FS + "C.java", SRC_DIR + FS + "UsedInC.java"
+    };
+
     /**
      * The entry point of the test.
      * @param args the array of command line arguments.
@@ -93,6 +107,8 @@
             prevIndex = currentIndex;
         }
         tester.printSummary();
+        run(tester, ARGS3, TEST3, NO_TEST);
+        tester.printSummary();
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testUseOption/UsedInC.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class UsedInC
+{
+}
--- a/langtools/test/tools/apt/Compile/golden.txt	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/apt/Compile/golden.txt	Thu Mar 31 22:07:32 2011 -0700
@@ -1,6 +1,6 @@
 error: It's a mad, mad, mad, mad world
 error: Something wicked this way comes
-HelloWorld.java:2: Boring class name
+HelloWorld.java:2: error: Boring class name
 public class HelloWorld {
        ^
 3 errors
--- a/langtools/test/tools/javac/4846262/Test.out	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/4846262/Test.out	Thu Mar 31 22:07:32 2011 -0700
@@ -1,7 +1,7 @@
-Test.java:4: not a statement
+Test.java:4: error: not a statement
         abcdefg
         ^
-Test.java:4: ';' expected
+Test.java:4: error: ';' expected
         abcdefg
                ^
 2 errors
--- a/langtools/test/tools/javac/6508981/TestInferBinaryName.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/6508981/TestInferBinaryName.java	Thu Mar 31 22:07:32 2011 -0700
@@ -139,9 +139,8 @@
             throws IOException {
         Context ctx = new Context();
         Options options = Options.instance(ctx);
-        // uugh, ugly back door, should be cleaned up, someday
-        if (zipFileIndexKind == USE_ZIP_FILE_INDEX)
-            options.put("useOptimizedZip", "true");
+        options.put("useOptimizedZip",
+                Boolean.toString(zipFileIndexKind == USE_ZIP_FILE_INDEX));
 
         if (symFileKind == IGNORE_SYMBOL_FILE)
             options.put("ignore.symbol.file", "true");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6558548/T6558548.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,300 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6558548
+ * @summary The compiler needs to be aligned with clarified specification of throws
+ * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java
+ * @compile/fail/ref=T6558548_6.out -source 6 -XDrawDiagnostics T6558548.java
+ */
+
+class T6558548 {
+
+    void nothing() {}
+    void checked() throws InterruptedException {}
+    void runtime() throws IllegalArgumentException {}
+
+    void m1() {
+        try {
+            throw new java.io.FileNotFoundException();
+        }
+        catch(java.io.FileNotFoundException exc) { }
+        catch(java.io.IOException exc) { } // 6: ok; latest: unreachable
+    }
+
+    void m1a() {
+        try {
+            throw new java.io.IOException();
+        }
+        catch(java.io.FileNotFoundException exc) { }
+        catch(java.io.IOException exc) { } //ok
+    }
+
+    void m2() {
+        try {
+            nothing();
+        }
+        catch(Exception exc) { } // ok
+    }
+
+    void m3() {
+        try {
+            checked();
+        }
+        catch(Exception exc) { } //ok
+    }
+
+    void m4() {
+        try {
+            runtime();
+        }
+        catch(Exception exc) { } //ok
+    }
+
+    void m5() {
+        try {
+            nothing();
+        }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m6() {
+        try {
+            checked();
+        }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m7() {
+        try {
+            runtime();
+        }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m9() {
+        try {
+            checked();
+        }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m10() {
+        try {
+            runtime();
+        }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m11() {
+        try {
+            nothing();
+        }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m12() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(Throwable exc) { } // ok
+    }
+
+    void m13() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(Throwable exc) { } // ok
+    }
+
+    void m14() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(Throwable exc) { } // ok
+    }
+
+    void m15() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(Exception exc) { } //ok
+    }
+
+    void m16() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(Exception exc) { } //6: ok; latest: unreachable
+    }
+
+    void m17() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(Exception exc) { } //6: ok; latest: unreachable
+    }
+
+    void m18() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(InterruptedException exc) { }
+        catch(Exception exc) { } //6: ok; latest: unreachable
+    }
+
+    void m19() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(InterruptedException exc) { } //never thrown in try
+        catch(Exception exc) { } //6: ok; latest: unreachable
+    }
+
+    void m20() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(InterruptedException exc) { } //never thrown in try
+        catch(Exception exc) { } //6: ok; latest: unreachable
+    }
+
+    void m21() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(Exception exc) { } // ok
+    }
+
+    void m22() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(Exception exc) { } // 6: ok; latest: unreachable
+    }
+
+    void m23() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(Exception exc) { } // 6: ok; latest: unreachable
+    }
+
+    void m24() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m25() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m26() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m27() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(InterruptedException exc) { }
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m28() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(InterruptedException exc) { } //never thrown in try
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m29() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(InterruptedException exc) { } //never thrown in try
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m30() {
+        try {
+            checked();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //ok
+    }
+
+    void m31() {
+        try {
+            runtime();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m32() {
+        try {
+            nothing();
+        }
+        catch(RuntimeException exc) { }
+        catch(Error exc) { }
+        catch(Throwable exc) { } //6: ok; latest: unreachable
+    }
+
+    void m33() {
+        try {
+            checked();
+        }
+        catch(InterruptedException exc) { } //ok
+    }
+
+    void m34() {
+        try {
+            runtime();
+        }
+        catch(InterruptedException exc) { } //never thrown in try
+    }
+
+    void m35() {
+        try {
+            nothing();
+        }
+        catch(InterruptedException exc) { } //never thrown in try
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6558548/T6558548_6.out	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,9 @@
+- compiler.warn.source.no.bootclasspath: 1.6
+T6558548.java:159:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:239:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:249:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:291:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:298:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+6 errors
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6558548/T6558548_latest.out	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,23 @@
+T6558548.java:20:9: compiler.warn.unreachable.catch: java.io.FileNotFoundException
+T6558548.java:134:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
+T6558548.java:142:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
+T6558548.java:151:9: compiler.warn.unreachable.catch.1: java.lang.InterruptedException,java.lang.RuntimeException
+T6558548.java:159:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:160:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
+T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:169:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
+T6558548.java:185:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
+T6558548.java:193:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
+T6558548.java:211:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
+T6558548.java:220:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
+T6558548.java:230:9: compiler.warn.unreachable.catch.1: java.lang.InterruptedException,java.lang.RuntimeException,java.lang.Error
+T6558548.java:239:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:240:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
+T6558548.java:249:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:250:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
+T6558548.java:268:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
+T6558548.java:277:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
+T6558548.java:291:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:298:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+6 errors
+15 warnings
--- a/langtools/test/tools/javac/Diagnostics/6769027/T6769027.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/Diagnostics/6769027/T6769027.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
@@ -261,7 +261,7 @@
 
     enum PositionKind {
         NOPOS(Position.NOPOS, "- ", "error: "),
-        POS(5, "Test.java:1:6: ", "/Test.java:1: ");
+        POS(5, "Test.java:1:6: ", "/Test.java:1: error: ");
 
         int pos;
         String rawOutput;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/7010608/Test.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7010608
+ * @summary the string 'error' should appear in error messages
+ */
+
+import java.io.*;
+import java.net.URI;
+import java.util.*;
+import javax.tools.*;
+import javax.tools.JavaCompiler.CompilationTask;
+
+public class Test {
+    public static void main(String... args) throws Exception {
+        new Test().run();
+    }
+
+    void run() throws Exception {
+        Locale prev = Locale.getDefault();
+        Locale.setDefault(Locale.ENGLISH);
+        try {
+            test(Arrays.<String>asList(),
+                    "myfo://test:1: error: cannot find symbol");
+            test(Arrays.asList("-XDdiagsFormat=OLD"),
+                    "myfo://test:1: cannot find symbol");
+            test(Arrays.asList("-XDoldDiags"),
+                    "myfo://test:1: cannot find symbol");
+        } finally {
+            Locale.setDefault(prev);
+        }
+    }
+
+    void test(List<String> options, String expect) throws Exception {
+        System.err.println("test: " + options);
+        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        JavaFileObject f = new MyFileObject("myfo://test", "class Bad { Missing x; }");
+        List<? extends JavaFileObject> files = Arrays.asList(f);
+        CompilationTask task = javac.getTask(pw, null, null, options, null, files);
+        boolean ok = task.call();
+        pw.close();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (ok)
+            throw new Exception("Compilation succeeded unexpectedly");
+        if (!out.contains(expect))
+            throw new Exception("expected text not found: " + expect);
+    }
+
+    class MyFileObject extends SimpleJavaFileObject {
+        MyFileObject(String uri, String text) {
+            super(URI.create(uri), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+        @Override
+        public String getName() {
+            return uri.toString();
+        }
+        @Override
+        public String getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+        final String text;
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/TestAnnotationPackageInfo.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6993311
+ * @summary annotations on packages are not validated
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import javax.tools.*;
+import com.sun.source.util.*;
+
+public class TestAnnotationPackageInfo {
+    public static void main(String... args) throws Exception {
+        new TestAnnotationPackageInfo().run();
+    }
+
+    static class MyFileObject extends SimpleJavaFileObject {
+        private String text;
+        public MyFileObject(String fileName, String text) {
+            super(URI.create("myfo:/" + fileName), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+    }
+
+    public void run() throws Exception {
+        final String bootPath = System.getProperty("sun.boot.class.path");
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        assert tool != null;
+
+        JavaFileObject test_java = new MyFileObject("test/Test.java",
+            "package test; public @interface Test {\n" +
+            "    public int mandatory();\n" +
+            "}\n");
+
+        JavaFileObject package_info_java = new MyFileObject("test/package-info.java",
+            "@Test package test;");
+
+        DiagnosticCollector<JavaFileObject> coll = new DiagnosticCollector<JavaFileObject>();
+
+        List<String> options = Arrays.asList("-bootclasspath",  bootPath);
+        List<? extends JavaFileObject> files = Arrays.asList(test_java, package_info_java);
+        JavacTask ct = (JavacTask)tool.getTask(null, null, coll, options, null, files);
+        ct.analyze();
+
+        String expectedCode = "compiler.err.annotation.missing.default.value";
+        List<Diagnostic<? extends JavaFileObject>> diags = coll.getDiagnostics();
+        switch (diags.size()) {
+            case 0:
+                throw new Exception("no diagnostics reported");
+            case 1:
+                String code = diags.get(0).getCode();
+                if (code.equals(expectedCode))
+                    return;
+                throw new Exception("unexpected diag: " + diags.get(0));
+            default:
+                throw new Exception("unexpected diags reported: " + diags);
+        }
+    }
+}
--- a/langtools/test/tools/javac/annotations/pos/package-info.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/annotations/pos/package-info.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -23,12 +23,12 @@
 
 /*
  * @test
- * @bug 4901290
+ * @bug 4901290 6993311
  * @summary Package annotations
  * @author gafter
  *
  * @compile package-info.java
  */
 
-@java.lang.annotation.Documented
+@Deprecated
 package foo.bar;
--- a/langtools/test/tools/javac/api/6411310/Test.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/api/6411310/Test.java	Thu Mar 31 22:07:32 2011 -0700
@@ -153,14 +153,12 @@
         Context c = new Context();
         Options options = Options.instance(c);
 
-            if (useOptimizedZip) {
-                options.put("useOptimizedZip", "true");
-            }
+        options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
 
-            if (!useSymbolFile) {
-                options.put("ignore.symbol.file", "true");
-            }
-            return new JavacFileManager(c, false, null);
+        if (!useSymbolFile) {
+            options.put("ignore.symbol.file", "true");
+        }
+        return new JavacFileManager(c, false, null);
     }
 
     File createDir(String name, String... entries) throws Exception {
--- a/langtools/test/tools/javac/api/6557752/T6557752.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/api/6557752/T6557752.java	Thu Mar 31 22:07:32 2011 -0700
@@ -118,7 +118,8 @@
 
                 Types types = task.getTypes();
 
-                if (types.asElement(trees.getOriginalType((ErrorType)typeMirror)) != null) {
+                str1 = types.asElement(trees.getOriginalType((ErrorType)typeMirror)).toString();
+                if (!str1.equals("FooBar")) {
                     throw new AssertionError("Types.asElement() error!");
                 }
                 foundError = true;
--- a/langtools/test/tools/javac/api/T6838467.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/api/T6838467.java	Thu Mar 31 22:07:32 2011 -0700
@@ -178,12 +178,10 @@
         return fm;
     }
 
-    JavacFileManager createFileManager(boolean useOptimedZipIndex) {
+    JavacFileManager createFileManager(boolean useOptimizedZip) {
         Context ctx = new Context();
-        if (useOptimedZipIndex) {
-            Options options = Options.instance(ctx);
-            options.put("useOptimizedZip", "true");
-        }
+        Options options = Options.instance(ctx);
+        options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
         return new JavacFileManager(ctx, false, null);
     }
 
--- a/langtools/test/tools/javac/api/T6877206.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/api/T6877206.java	Thu Mar 31 22:07:32 2011 -0700
@@ -168,9 +168,7 @@
     JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) {
         Context ctx = new Context();
         Options options = Options.instance(ctx);
-        if (useOptimizedZip) {
-            options.put("useOptimizedZip", "true");
-        }
+        options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
         if (!useSymbolFile) {
             options.put("ignore.symbol.file", "true");
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/TestJavacTask_Lock.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7026509
+ * @summary Cannot use JavaCompiler to create multiple CompilationTasks for partial compilations
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.tools.*;
+import javax.tools.JavaCompiler.CompilationTask;
+import com.sun.source.util.*;
+
+public class TestJavacTask_Lock {
+    public static void main(String... args) throws Exception {
+        new TestJavacTask_Lock().run();
+    }
+
+    enum MethodKind {
+        CALL {
+            int test(CompilationTask t) {
+                boolean ok = t.call();
+                if (!ok)
+                    throw new Error("compilation failed");
+                return 1;
+            }
+        },
+        PARSE {
+            int test(CompilationTask t) {
+                try {
+                    ((JavacTask) t).parse();
+                return 1;
+                } catch (IOException ex) {
+                    throw new Error(ex);
+                }
+            }
+
+        };
+        abstract int test(CompilationTask t);
+    }
+
+    JavaCompiler comp;
+    StandardJavaFileManager fm;
+
+    void run() throws Exception {
+        comp = ToolProvider.getSystemJavaCompiler();
+        fm = comp.getStandardFileManager(null, null, null);
+
+        for (MethodKind first: MethodKind.values()) {
+            for (MethodKind second: MethodKind.values()) {
+                test(first, second);
+            }
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void test(MethodKind first, MethodKind second) {
+        System.err.println("test: " + first + ", " + second);
+        File testSrc = new File(System.getProperty("test.src"));
+        String thisClassName = TestJavacTask_Lock.class.getName();
+        Iterable<? extends JavaFileObject> files =
+                fm.getJavaFileObjects(new File(testSrc, thisClassName + ".java"));
+        File tmpDir = new File(first + "_" + second);
+        tmpDir.mkdirs();
+        List<String> options = Arrays.asList( "-d", tmpDir.getPath() );
+        CompilationTask t = comp.getTask(null, fm, null, options, null, files);
+
+        try {
+            first.test(t);
+            second.test(t);
+            error("No exception thrown");
+        } catch (IllegalStateException e) {
+            System.err.println("Expected exception caught: " + e);
+        } catch (Exception e) {
+            error("Unexpected exception caught: " + e);
+            e.printStackTrace(System.err);
+        }
+
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/TestJavacTask_Multiple.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7026509
+ * @summary Cannot use JavaCompiler to create multiple CompilationTasks for partial compilations
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.tools.*;
+import javax.tools.JavaCompiler.CompilationTask;
+import com.sun.source.util.*;
+
+public class TestJavacTask_Multiple {
+    public static void main(String... args) throws Exception {
+        new TestJavacTask_Multiple().run();
+    }
+
+    final int MAX_TASKS = 3;
+
+    enum TestKind {
+        CALL {
+            int test(CompilationTask t) {
+                boolean ok = t.call();
+                if (!ok)
+                    throw new Error("compilation failed");
+                return 1;
+            }
+        },
+        PARSE {
+            int test(CompilationTask t) {
+                try {
+                    ((JavacTask) t).parse();
+                return 1;
+                } catch (IOException ex) {
+                    throw new Error(ex);
+                }
+            }
+
+        };
+        abstract int test(CompilationTask t);
+    }
+
+    int count;
+
+    void run() throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+        for (TestKind tk: TestKind.values()) {
+            test(comp, fm, tk);
+        }
+
+        int expect = TestKind.values().length * MAX_TASKS;
+        if (count != expect) {
+            throw new Exception("Unexpected number of tests completed: " + count
+                    + ", expected: " + expect);
+        }
+
+    }
+
+    void test(JavaCompiler comp, StandardJavaFileManager fm, TestKind tk) {
+        System.err.println("test " + tk);
+        File testSrc = new File(System.getProperty("test.src"));
+        String thisClassName = TestJavacTask_Multiple.class.getName();
+        Iterable<? extends JavaFileObject> files =
+                fm.getJavaFileObjects(new File(testSrc, thisClassName + ".java"));
+
+        List<CompilationTask> tasks = new ArrayList<CompilationTask>();
+        for (int i = 1; i <= MAX_TASKS; i++) {
+            File tmpDir = new File(tk + "_" + i);
+            tmpDir.mkdirs();
+            List<String> options = Arrays.asList( "-d", tmpDir.getPath() );
+            CompilationTask t = comp.getTask(null, fm, null, options, null, files);
+            ((JavacTask) t).setTaskListener(createTaskListener(tk, i));
+            tasks.add(t);
+        }
+
+        for (CompilationTask t: tasks)
+            count += tk.test(t);
+
+        System.err.println();
+    }
+
+    TaskListener createTaskListener(final TestKind tk, final int i) {
+        return new TaskListener() {
+
+            public void started(TaskEvent e) {
+                System.err.println(tk + "." + i + ": " + e + " started");
+            }
+
+            public void finished(TaskEvent e) {
+                System.err.println(tk + "." + i + ": " + e + " finished");
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/TestJavacTask_ParseAttrGen.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7026509
+ * @summary Cannot use JavaCompiler to create multiple CompilationTasks for partial compilations
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+import com.sun.source.tree.*;
+import com.sun.source.util.*;
+
+public class TestJavacTask_ParseAttrGen {
+    public static void main(String... args) throws Exception {
+        new TestJavacTask_ParseAttrGen().run();
+    }
+
+    JavaCompiler comp;
+    StandardJavaFileManager fm;
+
+    void run() throws Exception {
+        comp = ToolProvider.getSystemJavaCompiler();
+        fm = comp.getStandardFileManager(null, null, null);
+
+        final boolean[] booleanValues = { false, true };
+        for (boolean pk: booleanValues) {
+            for (boolean ak: booleanValues) {
+                for (boolean gk: booleanValues) {
+                    test(pk, ak, gk);
+                }
+            }
+        }
+    }
+
+    void test(boolean pk, boolean ak, boolean gk) throws Exception {
+        if (!pk && !ak && !gk)  // nothing to do
+            return;
+
+        System.err.println("test: pk:" + pk + ", ak:" + ak + ", gk: " + gk);
+        File testSrc = new File(System.getProperty("test.src"));
+        String thisClassName = TestJavacTask_ParseAttrGen.class.getName();
+        Iterable<? extends JavaFileObject> files =
+                fm.getJavaFileObjects(new File(testSrc, thisClassName + ".java"));
+        File tmpDir = new File((pk ? "p" : "") + (ak ? "a" : "") + (gk ? "g" : ""));
+        tmpDir.mkdirs();
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(tmpDir));
+        JavacTask t = (JavacTask) comp.getTask(null, fm, null, null, null, files);
+        //t.setTaskListener(createTaskListener());
+
+        try {
+            if (pk) {
+                Iterable<? extends CompilationUnitTree> trees = t.parse();
+                System.err.println(count(trees) + " trees parsed");
+            }
+
+            if (ak) {
+                Iterable<? extends Element> elems = t.analyze();
+                System.err.println(count(elems) + " elements analyzed");
+            }
+
+            if (gk) {
+                Iterable<? extends JavaFileObject> classfiles = t.generate();
+                System.err.println(count(classfiles) + " class files generated");
+            }
+        } catch (IOException e) {
+            error("unexpected exception caught: " + e);
+        }
+
+        File[] genFiles = tmpDir.listFiles();
+        int expect = (gk ? 2 : 0); // main class and anon class for TaskListener
+        if (genFiles.length != expect)
+            error("unexpected number of files generated: " + genFiles.length
+                    + ", expected: " + expect);
+
+        System.err.println();
+    }
+
+    TaskListener createTaskListener() {
+        return new TaskListener() {
+            public void started(TaskEvent e) {
+                System.err.println(e + " started");
+            }
+
+            public void finished(TaskEvent e) {
+                System.err.println(e + " finished");
+            }
+        };
+    }
+
+    <T> int count(Iterable<T> items) {
+        int count = 0;
+        for (T item: items)
+            count++;
+        return count;
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- a/langtools/test/tools/javac/diags/examples/CountError.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/CountError.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -23,6 +23,7 @@
 
 // key: compiler.misc.count.error
 // key: compiler.err.unreported.exception.need.to.catch.or.throw
+// key: compiler.err.error
 // run: backdoor
 
 class CountError {
--- a/langtools/test/tools/javac/diags/examples/CountErrorPlural.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/CountErrorPlural.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -23,6 +23,7 @@
 
 // key: compiler.misc.count.error.plural
 // key: compiler.err.unreported.exception.need.to.catch.or.throw
+// key: compiler.err.error
 // run: backdoor
 
 class CountErrorPlural {
--- a/langtools/test/tools/javac/diags/examples/IdentifierExpected.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/IdentifierExpected.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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,7 @@
 // key: compiler.err.expected
 // key: compiler.err.invalid.binary.number
 // key: compiler.misc.count.error.plural
+// key: compiler.err.error
 // run: backdoor
 
 class IdentifierExpected {
--- a/langtools/test/tools/javac/diags/examples/KindnameClass.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/KindnameClass.java	Thu Mar 31 22:07:32 2011 -0700
@@ -25,6 +25,7 @@
 // key: compiler.err.cant.resolve.location
 // key: compiler.misc.location
 // key: compiler.misc.count.error
+// key: compiler.err.error
 // run: backdoor
 
 class KindnameClass {
--- a/langtools/test/tools/javac/diags/examples/KindnameConstructor.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/KindnameConstructor.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -28,6 +28,7 @@
 // key: compiler.misc.arg.length.mismatch
 // key: compiler.misc.no.conforming.assignment.exists
 // key: compiler.misc.count.error.plural
+// key: compiler.err.error
 // run: backdoor
 
 class KindnameConstructor {
--- a/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,6 +26,7 @@
 // key: compiler.err.cant.resolve.location.args
 // key: compiler.misc.location
 // key: compiler.misc.count.error
+// key: compiler.err.error
 // run: backdoor
 
 class KindnameMethod {
--- a/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,6 +26,7 @@
 // key: compiler.err.cant.resolve.location
 // key: compiler.misc.location
 // key: compiler.misc.count.error
+// key: compiler.err.error
 // run: backdoor
 
 class KindnameVariable {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnreachableCatch.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.unreachable.catch
+
+class UnreachableCatch {
+
+    void test() {
+        try {
+            throw new java.io.FileNotFoundException();
+        }
+        catch(java.io.FileNotFoundException exc) { }
+        catch(java.io.IOException exc) { } //unreachable
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnreachableCatch1.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.unreachable.catch.1
+
+class UnreachableCatch1 {
+
+    void test() {
+        try {
+            throw new IllegalArgumentException();
+        }
+        catch(Error err) { }
+        catch(RuntimeException rex) { }
+        catch(Throwable t) { } //unreachable
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/file/zip/T6836682.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6836682 7025988
+ * @summary JavacFileManager handling of zip64 archives (Scenario A and B)
+ * @compile  -XDignore.symbol.file T6836682.java Utils.java
+ * @run main T6836682
+ */
+/*
+ * This test consists of two scenarios:
+ *
+ * Scenario A: create a jar with entries exceeding 64K, and see if the javac
+ * can handle this large jar on the classpath. Generally this test completes
+ * within a minute
+ *
+ * Scenario B: create a jar with a large enough file exceeding 4GB, and
+ * similarly test javac. This test is known to be slow and problematic on
+ * certain operating systems, thus this test can be selected by passing a
+ * property through jtreg as follows:
+ * -javaoptions=-DT6836682.testScenarioB=true.
+ * Note this test will only run iff all the disk requirements are met at runtime.
+ */
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.zip.CRC32;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+public class T6836682 {
+
+    private static final long GIGA = 1024 * 1024 * 1024;
+    private static final int BUFFER_LEN = Short.MAX_VALUE * 2;
+
+    static long getCount(long minlength) {
+        return (minlength / BUFFER_LEN) + 1;
+    }
+
+    static long computeCRC(long minlength) {
+        CRC32 crc = new CRC32();
+        byte[] buffer = new byte[BUFFER_LEN];
+        long count = getCount(minlength);
+        for (long i = 0; i < count; i++) {
+            crc.update(buffer);
+        }
+        return crc.getValue();
+    }
+
+    static long computeCRC(File inFile) throws IOException {
+        byte[] buffer = new byte[8192];
+        CRC32 crc = new CRC32();
+        FileInputStream fis = null;
+        BufferedInputStream bis = null;
+        try {
+            fis = new FileInputStream(inFile);
+            bis = new BufferedInputStream(fis);
+            int n = bis.read(buffer);
+            while (n > 0) {
+                crc.update(buffer, 0, n);
+                n = bis.read(buffer);
+            }
+        } finally {
+            Utils.close(bis);
+            Utils.close(fis);
+        }
+        return crc.getValue();
+    }
+
+    static void createLargeFile(OutputStream os, long minlength) throws IOException {
+        byte[] buffer = new byte[BUFFER_LEN];
+        long count = getCount(minlength);
+        for (long i = 0; i < count; i++) {
+            os.write(buffer);
+        }
+        os.flush();
+    }
+
+    static void createJarWithLargeFile(File jarFile, File javaFile,
+            long minlength) throws IOException {
+        Utils.createClassFile(javaFile, null, true);
+        File classFile = new File(Utils.getClassFileName(javaFile));
+        ZipOutputStream zos = null;
+        BufferedOutputStream bos = null;
+        FileInputStream fis = null;
+        try {
+            zos = new ZipOutputStream(new FileOutputStream(jarFile));
+            zos.setLevel(ZipOutputStream.STORED);
+            zos.setMethod(0);
+            bos = new BufferedOutputStream(zos);
+
+            ZipEntry ze = new ZipEntry("large.data");
+            ze.setCompressedSize(getCount(minlength) * BUFFER_LEN);
+            ze.setSize(getCount(minlength) * BUFFER_LEN);
+            ze.setCrc(computeCRC(minlength));
+            ze.setMethod(ZipEntry.STORED);
+            zos.putNextEntry(ze);
+            createLargeFile(bos, minlength);
+
+            ze = new ZipEntry(classFile.getName());
+            ze.setCompressedSize(classFile.length());
+            ze.setSize(classFile.length());
+            ze.setCrc(computeCRC(classFile));
+            ze.setMethod(ZipEntry.STORED);
+            zos.putNextEntry(ze);
+            fis = new FileInputStream(classFile);
+            Utils.copyStream(fis, bos);
+            bos.flush();
+            zos.closeEntry();
+        } finally {
+            Utils.close(bos);
+            Utils.close(zos);
+            Utils.close(fis);
+        }
+        // deleted to prevent accidental linkage
+        new File(Utils.getClassFileName(javaFile)).delete();
+    }
+
+    static void createLargeJar(File jarFile, File javaFile) throws IOException {
+        File classFile = new File(Utils.getClassFileName(javaFile));
+        Utils.createClassFile(javaFile, null, true);
+        ZipOutputStream zos = null;
+        FileInputStream fis = null;
+        final int MAX = Short.MAX_VALUE * 2 + 10;
+        ZipEntry ze = null;
+        try {
+            zos = new ZipOutputStream(new FileOutputStream(jarFile));
+            zos.setLevel(ZipOutputStream.STORED);
+            zos.setMethod(ZipOutputStream.STORED);
+            for (int i = 0; i < MAX ; i++) {
+                ze = new ZipEntry("X" + i + ".txt");
+                ze.setSize(0);
+                ze.setCompressedSize(0);
+                ze.setCrc(0);
+                zos.putNextEntry(ze);
+            }
+
+            // add a class file
+            ze = new ZipEntry(classFile.getName());
+            ze.setCompressedSize(classFile.length());
+            ze.setSize(classFile.length());
+            ze.setCrc(computeCRC(classFile));
+            zos.putNextEntry(ze);
+            fis = new FileInputStream(classFile);
+            Utils.copyStream(fis, zos);
+        } finally {
+            Utils.close(zos);
+            Utils.close(fis);
+        // deleted to prevent accidental linkage
+        new File(Utils.getClassFileName(javaFile)).delete();
+    }
+    }
+
+    // a jar with entries exceeding 64k + a class file for the existential test
+    public static void testScenarioA(String... args) throws IOException {
+        File largeJar = new File("large.jar");
+        File javaFile = new File("Foo.java");
+        createLargeJar(largeJar, javaFile);
+
+        File testFile = new File("Bar.java");
+        try {
+            Utils.createJavaFile(testFile, javaFile);
+            if (!Utils.compile("-doe", "-verbose", "-cp",
+                    largeJar.getAbsolutePath(), testFile.getAbsolutePath())) {
+                throw new IOException("test failed");
+            }
+        } finally {
+            Utils.deleteFile(largeJar);
+        }
+    }
+
+    // a jar with an enormous file + a class file for the existential test
+    public static void testScenarioB(String... args) throws IOException {
+        final File largeJar = new File("huge.jar");
+        final File javaFile = new File("Foo.java");
+
+        final Path path = largeJar.getAbsoluteFile().getParentFile().toPath();
+        final long available = Files.getFileStore(path).getUsableSpace();
+        final long MAX_VALUE = 0xFFFF_FFFFL;
+
+        final long absolute  = MAX_VALUE + 1L;
+        final long required  = (long)(absolute * 1.1); // pad for sundries
+        System.out.println("\tavailable: " + available / GIGA + " GB");
+        System.out.println("\trequired: " + required / GIGA + " GB");
+
+        if (available > required) {
+            createJarWithLargeFile(largeJar, javaFile, absolute);
+            File testFile = new File("Bar.java");
+            Utils.createJavaFile(testFile, javaFile);
+            try {
+                if (!Utils.compile("-doe", "-verbose", "-cp",
+                        largeJar.getAbsolutePath(), testFile.getAbsolutePath())) {
+                    throw new IOException("test failed");
+                }
+            } finally {
+                Utils.deleteFile(largeJar);
+            }
+        } else {
+            System.out.println("Warning: testScenarioB passes vacuously," +
+                    " requirements exceeds available space");
+        }
+    }
+
+    public static void main(String... args) throws IOException {
+        testScenarioA();
+        System.out.println("testScenarioA: PASS");
+        if (Boolean.getBoolean("T6836682.testScenarioB")) {
+            testScenarioB();
+            System.out.println("testScenarioB: PASS");
+        } else {
+            System.out.println("Warning: testScenarioB, large file test skipped");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/file/zip/T6865530.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6865530
+ * @summary ensure JavacFileManager handles non-standard zipfiles.
+ * @compile  -XDignore.symbol.file T6865530.java
+ * @run main T6865530
+ */
+
+
+import java.io.File;
+
+
+public class T6865530 {
+
+    public static void main(String... args) throws Exception {
+        File badFile = new File("bad.exe");
+        File testJar = new File("test.jar");
+        File fooJava = new File("Foo.java");
+        File barJava = new File("Bar.java");
+
+        // create a jar by compiling a file, and append the jar to some
+        // arbitrary data to offset the start of the zip/jar archive
+        Utils.createJavaFile(fooJava);
+        Utils.compile("-doe", "-verbose", fooJava.getName());
+        String[] jarArgs = {
+            "cvf", testJar.getAbsolutePath(), "Foo.class"
+        };
+        Utils.jarTool.run(jarArgs);
+        Utils.cat(badFile, fooJava, testJar);
+
+        // create test file and use the above file as a classpath
+        Utils.createJavaFile(barJava);
+        try {
+            if (!Utils.compile("-doe", "-verbose", "-cp", badFile.getAbsolutePath(), "Bar.java")) {
+                throw new RuntimeException("test fails javac did not compile");
+            }
+        } finally {
+            Utils.deleteFile(badFile);
+            Utils.deleteFile(testJar);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/file/zip/Utils.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+public class Utils {
+
+    static final sun.tools.jar.Main jarTool =
+            new sun.tools.jar.Main(System.out, System.err, "jar-tool");
+
+    static final com.sun.tools.javac.Main javac =
+            new com.sun.tools.javac.Main();
+
+    private Utils(){}
+
+    public static boolean compile(String... args) {
+        return javac.compile(args) == 0;
+    }
+
+    public static void createClassFile(File javaFile, File superClass,
+            boolean delete) throws IOException {
+        createJavaFile(javaFile, superClass);
+        if (!compile(javaFile.getName())) {
+            throw new RuntimeException("compile failed unexpectedly");
+        }
+        if (delete) javaFile.delete();
+    }
+
+    public static void createJavaFile(File outFile) throws IOException {
+        createJavaFile(outFile, null);
+    }
+
+    public static void createJavaFile(File outFile, File superClass) throws IOException {
+        PrintStream ps = null;
+        String srcStr = "public class " + getSimpleName(outFile) + " ";
+        if (superClass != null) {
+            srcStr = srcStr.concat("extends " + getSimpleName(superClass) + " ");
+        }
+        srcStr = srcStr.concat("{}");
+        try {
+            FileOutputStream fos = new FileOutputStream(outFile);
+            ps = new PrintStream(fos);
+            ps.println(srcStr);
+        } finally {
+            close(ps);
+        }
+    }
+
+    static String getClassFileName(File javaFile) {
+        return javaFile.getName().endsWith(".java")
+                ? javaFile.getName().replace(".java", ".class")
+                : null;
+    }
+
+    static String getSimpleName(File inFile) {
+        String fname = inFile.getName();
+        return fname.substring(0, fname.indexOf("."));
+    }
+
+    public static void copyStream(InputStream in, OutputStream out) throws IOException {
+        byte[] buf = new byte[8192];
+        int n = in.read(buf);
+        while (n > 0) {
+            out.write(buf, 0, n);
+            n = in.read(buf);
+        }
+    }
+
+    public static void close(Closeable c) {
+        if (c != null) {
+            try {
+                c.close();
+            } catch (IOException ignore) {}
+        }
+    }
+
+    public static void deleteFile(File f) {
+        if (!f.delete()) {
+            throw new RuntimeException("could not delete file: " + f.getAbsolutePath());
+        }
+    }
+
+    public static void cat(File output, File... files) throws IOException {
+        BufferedInputStream bis = null;
+        BufferedOutputStream bos = null;
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(output);
+            bos = new BufferedOutputStream(fos);
+            for (File x : files) {
+                FileInputStream fis = new FileInputStream(x);
+                bis = new BufferedInputStream(fis);
+                copyStream(bis, bos);
+                Utils.close(bis);
+            }
+        } finally {
+            Utils.close(bis);
+            Utils.close(bos);
+            Utils.close(fos);
+        }
+    }
+}
--- a/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -24,8 +24,6 @@
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.SourceVersion;
-import static javax.lang.model.SourceVersion.*;
-import javax.lang.model.element.*;
 import javax.lang.model.util.*;
 
 /**
--- a/langtools/test/tools/javac/processing/6430209/b6341534.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/6430209/b6341534.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, 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
@@ -56,7 +56,9 @@
         // on round 1, expect errorRaised == false && processingOver == false
         // on round 2, expect errorRaised == true && processingOver == true
         if( renv.errorRaised() != renv.processingOver()) {
-            messager.printMessage(ERROR, "FAILED");
+            messager.printMessage(ERROR, "FAILED: round:" + r
+                + ", errorRaised:" + renv.errorRaised()
+                + ", processingOver:" + renv.processingOver());
         }
         return true;
     }
--- a/langtools/test/tools/javac/processing/6994946/SemanticErrorTest.2.out	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/6994946/SemanticErrorTest.2.out	Thu Mar 31 22:07:32 2011 -0700
@@ -1,4 +1,4 @@
 SemanticErrorTest.java:11:46: compiler.err.repeated.interface
 - compiler.err.proc.messager: Deliberate Error
 SemanticErrorTest.java:11:46: compiler.err.repeated.interface
-1 error
+2 errors
--- a/langtools/test/tools/javac/processing/environment/round/TestContext.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/environment/round/TestContext.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
-import javax.tools.*;
 import static javax.tools.Diagnostic.Kind.*;
 
 import com.sun.source.util.Trees;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/TestErrorCount.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6988079
+ * @summary Errors reported via Messager.printMessage(ERROR,"error message") are not tallied correctly
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor TestErrorCount
+ * @compile/fail/ref=TestErrorCount.out -XDrawDiagnostics -processor TestErrorCount TestErrorCount.java
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+public class TestErrorCount extends JavacTestingAbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        messager.printMessage(Diagnostic.Kind.ERROR, "intentional error");
+        return true;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/TestErrorCount.out	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,3 @@
+- compiler.err.proc.messager: intentional error
+- compiler.err.proc.messager: intentional error
+2 errors
--- a/langtools/test/tools/javac/processing/filer/TestPackageInfo.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestPackageInfo.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6380018 6392177
+ * @bug 6380018 6392177 6993311
  * @summary Test the ability to create and process package-info.java files
  * @author  Joseph D. Darcy
  * @library ../../lib
@@ -60,7 +60,7 @@
 
         // Verify annotations are as expected
         Set<TypeElement> expectedAnnotations = new HashSet<TypeElement>();
-        expectedAnnotations.add(eltUtils.getTypeElement("java.lang.SuppressWarnings"));
+        expectedAnnotations.add(eltUtils.getTypeElement("java.lang.Deprecated"));
 
         if (!roundEnv.processingOver()) {
             System.out.println("\nRound " + round);
@@ -90,7 +90,7 @@
                     } catch(FilerException fe) {}
 
                     PrintWriter pw = new PrintWriter(filer.createSourceFile("foo.package-info").openWriter());
-                    pw.println("@SuppressWarnings(\"\")");
+                    pw.println("@Deprecated");
                     pw.println("package foo;");
                     pw.close();
 
--- a/langtools/test/tools/javac/processing/filer/foo/bar/package-info.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/filer/foo/bar/package-info.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, 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
@@ -24,5 +24,5 @@
 /**
  * Javadoc for the foo.bar package!
  */
-@SuppressWarnings("deprecation")
+@Deprecated
 package foo.bar;
--- a/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6449781
+ * @bug 6449781 6930508
  * @summary Test that reported names of anonymous classes are non-null.
  * @author  Joseph D. Darcy
  * @library ../../../lib
@@ -93,6 +93,7 @@
             TestAnonClassNames.class,
         };
 
+        List<String> names = new ArrayList<String>();
         for(Class<?> clazz : classes) {
             String name = clazz.getName();
             Nesting anno = clazz.getAnnotation(Nesting.class);
@@ -100,7 +101,14 @@
                               clazz.getName(),
                               anno == null ? "(unset/ANONYMOUS)" : anno.value());
             testClassName(name);
+            names.add(name);
         }
+
+        // test all names together
+        testClassNames(names);
+
+        if (errors > 0)
+            throw new RuntimeException(errors + " errors occurred");
     }
 
     /**
@@ -109,15 +117,23 @@
      * input classes are modeled as elements.
      */
     static void testClassName(String className) {
-        JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
-        List<String> classNames = new ArrayList<String>();
-        classNames.add(className);
+        testClassNames(Arrays.asList(className));
+    }
+
+    /**
+     * Perform annotation processing on a list of class file names and verify
+     * the existence of different flavors of class names when the
+     * input classes are modeled as elements.
+     */
+    static void testClassNames(List<String> classNames) {
+        System.out.println("test: " + classNames);
 
         List<String> options = new ArrayList<String>();
         options.add("-proc:only");
         options.add("-classpath");
         options.add(System.getProperty("test.classes"));
 
+        JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
         JavaCompiler.CompilationTask compileTask =
             javaCompiler.getTask(null, // Output
                                  null, // File manager
@@ -130,9 +146,16 @@
         compileTask.setProcessors(processors);
         Boolean goodResult = compileTask.call();
         if (!goodResult) {
-            throw new RuntimeException("Errors found during compile.");
+            error("Errors found during compile.");
         }
     }
+
+    static int errors = 0;
+
+    static void error(String msg) {
+        System.out.println("Error: " + msg);
+        errors++;
+    }
 }
 
 @Retention(RUNTIME)
--- a/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Thu Mar 31 19:09:02 2011 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Thu Mar 31 22:07:32 2011 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @bug 6639645
+ * @bug 6639645 7026414
  * @summary Modeling type implementing missing interfaces
  * @library ../../../../lib
  * @build JavacTestingAbstractProcessor TestMissingElement
@@ -112,6 +112,7 @@
 
             @Override
             public String visitDeclared(DeclaredType t, Void ignore) {
+                checkEqual(t.asElement(), types.asElement(t));
                 String s = asString(t.asElement());
                 List<? extends TypeMirror> args = t.getTypeArguments();
                 if (!args.isEmpty())
@@ -179,6 +180,13 @@
         return (e != null && e.getKind() == ElementKind.PACKAGE
                 && ((PackageElement) e).isUnnamed());
     }
+
+    void checkEqual(Element e1, Element e2) {
+        if (e1 != e2) {
+            throw new AssertionError("elements not equal as expected: "
+                + e1 + ", " + e2);
+        }
+    }
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/options/testCommandLineClasses/Test.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6930508
+ * @summary Passing nested class names on javac command line interfere with subsequent name -> class lookup
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor p.NestedExamples Test
+ * @run main Test
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.ElementFilter;
+import javax.tools.*;
+
+import p.NestedExamples;
+
+public class Test extends JavacTestingAbstractProcessor {
+    public static void main(String... args) throws Exception {
+        new Test().run();
+    }
+
+    void run() throws Exception {
+        NestedExamples e = new NestedExamples();
+        List<String> names = getNames(e.getClasses());
+        test(names);
+        test(reverse(names));
+        names = Arrays.asList(e.getClassNames());
+        test(names);
+        test(reverse(names));
+
+        if (errors > 0)
+            throw new RuntimeException(errors + " errors occurred");
+    }
+
+    List<String> getNames(Class<?>[] classes) {
+        List<String> names = new ArrayList<String>();
+        for (Class<?> c: classes)
+            names.add(c.getName());
+        return names;
+    }
+
+    void test(List<String> names) throws Exception {
+        System.err.println("test: " + names);
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
+        File testClasses = new File(System.getProperty("test.classes"));
+        fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses));
+        JavaCompiler.CompilationTask task = compiler.getTask(
+                null, null, null, Arrays.asList("-proc:only"), names, null);
+        task.setProcessors(Arrays.asList(new Test()));
+        boolean ok = task.call();
+        if (!ok)
+            error("compilation failed");
+        System.err.println();
+    }
+
+    <T> List<T> reverse(List<T> list) {
+        List<T> newList = new ArrayList<T>(list);
+        Collections.reverse(newList);
+        return newList;
+    }
+
+    int errors = 0;
+
+    void error(String msg) {
+        System.out.println("Error: " + msg);
+        errors++;
+    }
+
+    //----------
+
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            for (TypeElement typeElt : ElementFilter.typesIn(roundEnv.getRootElements())) {
+                messager.printMessage(Diagnostic.Kind.NOTE, "processing " + typeElt);
+            }
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/options/testCommandLineClasses/p/NestedExamples.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public class NestedExamples {
+    static class MemberClass1 { }
+
+    class MemberClass2 { }
+
+    class Win$$AtVegas { } // Class with funny name.
+
+    public Class<?>[] getClasses() {
+        class LocalClass { }
+
+        Object o = new Object() { // An anonymous class
+            @Override
+            public String toString() {
+                return "I have no name!";
+            }
+        };
+
+        return new Class<?>[] {
+            NestedExamples.class,
+            MemberClass1.class,
+            MemberClass2.class,
+            Win$$AtVegas.class,
+            LocalClass.class,
+            o.getClass()
+        };
+    }
+
+    public String[] getClassNames() {
+        return new String[] {
+            "p.NestedExamples",
+            "p.NestedExamples.MemberClass1",
+            "p.NestedExamples.MemberClass2",
+            "p.NestedExamples.Win$$AtVegas"
+        };
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/Test.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6987384
+ * @summary -XprintProcessorRoundsInfo message printed with different timing than previous
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor Test
+ * @compile/fail/ref=Test.out -XDrawDiagnostics -XprintProcessorInfo -Werror -proc:only -processor Test Test.java
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+import javax.tools.*;
+
+public class Test extends JavacTestingAbstractProcessor {
+    final int MAX_ROUNDS = 3;
+    int round = 0;
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        round++;
+        messager.printMessage(Diagnostic.Kind.NOTE, "round " + round);
+        if (round <= MAX_ROUNDS)
+            generateSource("Gen" + round);
+        if (roundEnv.processingOver())
+            messager.printMessage(Diagnostic.Kind.WARNING, "last round");
+        return true;
+    }
+
+    void generateSource(String name) {
+        String text = "class " + name + " { }\n";
+
+        // avoid try-with-resources so test can be run on older builds
+        try {
+            Writer out = filer.createSourceFile(name).openWriter();
+            try {
+                out.write(text);
+            } finally {
+                out.close();
+            }
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/Test.out	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,13 @@
+Processor Test matches [java.lang.Override] and returns true.
+- compiler.note.proc.messager: round 1
+Processor Test matches [] and returns true.
+- compiler.note.proc.messager: round 2
+Processor Test matches [] and returns true.
+- compiler.note.proc.messager: round 3
+Processor Test matches [] and returns true.
+- compiler.note.proc.messager: round 4
+- compiler.note.proc.messager: round 5
+- compiler.warn.proc.messager: last round
+- compiler.err.warnings.and.werror
+1 error
+1 warning