changeset 494:b078b2c12089

meth-lazy: consolidate for review
author jrose
date Mon, 23 Jul 2012 10:36:37 -0700
parents a8cb0e14256a
children 6ca8164f788f b4050524c2ff
files meth-lazy-7023639.patch meth-lazy-7023639.review.patch series
diffstat 3 files changed, 1443 insertions(+), 2929 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.patch	Mon Jul 23 10:12:57 2012 -0700
+++ b/meth-lazy-7023639.patch	Mon Jul 23 10:36:37 2012 -0700
@@ -1,9 +1,469 @@
 7023639: JSR 292 method handle invocation needs a fast path for compiled code
 6984705: JSR 292 method handle creation should not go through JNI
 Summary: remove assembly code for JDK 7 chained method handles
-Reviewed-by: jrose, twisti, mhaupt
+Reviewed-by: jrose, twisti, kvn, mhaupt
 Contributed-by: jrose, twisti, mhaupt
 
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
+--- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
++++ b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
+@@ -93,7 +93,6 @@
+   public boolean isUncommonTrapStub()   { return false; }
+   public boolean isExceptionStub()      { return false; }
+   public boolean isSafepointStub()      { return false; }
+-  public boolean isRicochetBlob()       { return false; }
+   public boolean isAdapterBlob()        { return false; }
+ 
+   // Fine grain nmethod support: isNmethod() == isJavaMethod() || isNativeMethod() || isOSRMethod()
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java b/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java
+--- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java
++++ b/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java
+@@ -57,7 +57,6 @@
+     virtualConstructor.addMapping("BufferBlob", BufferBlob.class);
+     virtualConstructor.addMapping("nmethod", NMethod.class);
+     virtualConstructor.addMapping("RuntimeStub", RuntimeStub.class);
+-    virtualConstructor.addMapping("RicochetBlob", RicochetBlob.class);
+     virtualConstructor.addMapping("AdapterBlob", AdapterBlob.class);
+     virtualConstructor.addMapping("MethodHandlesAdapterBlob", MethodHandlesAdapterBlob.class);
+     virtualConstructor.addMapping("SafepointBlob", SafepointBlob.class);
+@@ -127,10 +126,6 @@
+       Assert.that(result.blobContains(start) || result.blobContains(start.addOffsetTo(8)),
+                                                                     "found wrong CodeBlob");
+     }
+-    if (result.isRicochetBlob()) {
+-      // This should probably be done for other SingletonBlobs
+-      return VM.getVM().ricochetBlob();
+-    }
+     return result;
+   }
+ 
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/RicochetBlob.java b/agent/src/share/classes/sun/jvm/hotspot/code/RicochetBlob.java
+deleted file mode 100644
+--- a/agent/src/share/classes/sun/jvm/hotspot/code/RicochetBlob.java
++++ /dev/null
+@@ -1,70 +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.
+- *
+- * 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.jvm.hotspot.code;
+-
+-import java.util.*;
+-import sun.jvm.hotspot.debugger.*;
+-import sun.jvm.hotspot.runtime.*;
+-import sun.jvm.hotspot.types.*;
+-
+-/** RicochetBlob (currently only used by Compiler 2) */
+-
+-public class RicochetBlob extends SingletonBlob {
+-  static {
+-    VM.registerVMInitializedObserver(new Observer() {
+-        public void update(Observable o, Object data) {
+-          initialize(VM.getVM().getTypeDataBase());
+-        }
+-      });
+-  }
+-
+-  private static void initialize(TypeDataBase db) {
+-    Type type = db.lookupType("RicochetBlob");
+-
+-    bounceOffsetField                = type.getCIntegerField("_bounce_offset");
+-    exceptionOffsetField             = type.getCIntegerField("_exception_offset");
+-  }
+-
+-  private static CIntegerField bounceOffsetField;
+-  private static CIntegerField exceptionOffsetField;
+-
+-  public RicochetBlob(Address addr) {
+-    super(addr);
+-  }
+-
+-  public boolean isRicochetBlob() {
+-    return true;
+-  }
+-
+-  public Address bounceAddr() {
+-    return codeBegin().addOffsetTo(bounceOffsetField.getValue(addr));
+-  }
+-
+-  public boolean returnsToBounceAddr(Address pc) {
+-    Address bouncePc = bounceAddr();
+-    return (pc.equals(bouncePc) || pc.addOffsetTo(Frame.pcReturnOffset()).equals(bouncePc));
+-  }
+-
+-}
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java
+--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java
++++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java
+@@ -147,12 +147,6 @@
+     }
+   }
+ 
+-  public boolean isRicochetFrame() {
+-    CodeBlob cb = VM.getVM().getCodeCache().findBlob(getPC());
+-    RicochetBlob rcb = VM.getVM().ricochetBlob();
+-    return (cb == rcb && rcb != null && rcb.returnsToBounceAddr(getPC()));
+-  }
+-
+   public boolean isCompiledFrame() {
+     if (Assert.ASSERTS_ENABLED) {
+       Assert.that(!VM.getVM().isCore(), "noncore builds only");
+@@ -216,8 +210,7 @@
+   public Frame realSender(RegisterMap map) {
+     if (!VM.getVM().isCore()) {
+       Frame result = sender(map);
+-      while (result.isRuntimeFrame() ||
+-             result.isRicochetFrame()) {
++      while (result.isRuntimeFrame()) {
+         result = result.sender(map);
+       }
+       return result;
+@@ -631,9 +624,6 @@
+     if (Assert.ASSERTS_ENABLED) {
+       Assert.that(cb != null, "sanity check");
+     }
+-    if (cb == VM.getVM().ricochetBlob()) {
+-      oopsRicochetDo(oopVisitor, regMap);
+-    }
+     if (cb.getOopMaps() != null) {
+       OopMapSet.oopsDo(this, cb, regMap, oopVisitor, VM.getVM().isDebugging());
+ 
+@@ -650,10 +640,6 @@
+     //    }
+   }
+ 
+-  private void oopsRicochetDo      (AddressVisitor oopVisitor, RegisterMap regMap) {
+-    // XXX Empty for now
+-  }
+-
+   // FIXME: implement the above routines, plus add
+   // oops_interpreted_arguments_do and oops_compiled_arguments_do
+ }
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
+--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
++++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
+@@ -87,8 +87,6 @@
+   private StubRoutines stubRoutines;
+   private Bytes        bytes;
+ 
+-  private RicochetBlob ricochetBlob;
+-
+   /** Flags indicating whether we are attached to a core, C1, or C2 build */
+   private boolean      usingClientCompiler;
+   private boolean      usingServerCompiler;
+@@ -628,18 +626,6 @@
+     return stubRoutines;
+   }
+ 
+-  public RicochetBlob ricochetBlob() {
+-    if (ricochetBlob == null) {
+-      Type ricochetType  = db.lookupType("SharedRuntime");
+-      AddressField ricochetBlobAddress = ricochetType.getAddressField("_ricochet_blob");
+-      Address addr = ricochetBlobAddress.getValue();
+-      if (addr != null) {
+-        ricochetBlob = new RicochetBlob(addr);
+-      }
+-    }
+-    return ricochetBlob;
+-  }
+-
+   public VMRegImpl getVMRegImplInfo() {
+     if (vmregImpl == null) {
+       vmregImpl = new VMRegImpl();
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java
+--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java
++++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java
+@@ -571,8 +571,6 @@
+     //        registers callee-saved, then we will have to copy over
+     //        the RegisterMap update logic from the Intel code.
+ 
+-    if (isRicochetFrame()) return senderForRicochetFrame(map);
+-
+     // The constructor of the sender must know whether this frame is interpreted so it can set the
+     // sender's _interpreter_sp_adjustment field.
+     if (VM.getVM().getInterpreter().contains(pc)) {
+@@ -945,20 +943,6 @@
+   }
+ 
+ 
+-  private Frame senderForRicochetFrame(SPARCRegisterMap map) {
+-    if (DEBUG) {
+-      System.out.println("senderForRicochetFrame");
+-    }
+-    //RicochetFrame* f = RicochetFrame::from_frame(fr);
+-    // Cf. is_interpreted_frame path of frame::sender
+-    Address youngerSP = getSP();
+-    Address sp        = getSenderSP();
+-    map.makeIntegerRegsUnsaved();
+-    map.shiftWindow(sp, youngerSP);
+-    boolean thisFrameAdjustedStack = true;  // I5_savedSP is live in this RF
+-    return new SPARCFrame(biasSP(sp), biasSP(youngerSP), thisFrameAdjustedStack);
+-  }
+-
+   private Frame senderForEntryFrame(RegisterMap regMap) {
+     SPARCRegisterMap map = (SPARCRegisterMap) regMap;
+ 
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCRicochetFrame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCRicochetFrame.java
+deleted file mode 100644
+--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCRicochetFrame.java
++++ /dev/null
+@@ -1,77 +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.
+- *
+- * 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.jvm.hotspot.runtime.sparc;
+-
+-import java.util.*;
+-import sun.jvm.hotspot.asm.sparc.SPARCRegister;
+-import sun.jvm.hotspot.asm.sparc.SPARCRegisters;
+-import sun.jvm.hotspot.debugger.*;
+-import sun.jvm.hotspot.runtime.*;
+-import sun.jvm.hotspot.types.*;
+-
+-public class SPARCRicochetFrame {
+-  static {
+-    VM.registerVMInitializedObserver(new Observer() {
+-        public void update(Observable o, Object data) {
+-          initialize(VM.getVM().getTypeDataBase());
+-        }
+-      });
+-  }
+-
+-  private SPARCFrame frame;
+-
+-  private static void initialize(TypeDataBase db) {
+-    // Type type = db.lookupType("MethodHandles::RicochetFrame");
+-
+-  }
+-
+-  static SPARCRicochetFrame fromFrame(SPARCFrame f) {
+-    return new SPARCRicochetFrame(f);
+-  }
+-
+-  private SPARCRicochetFrame(SPARCFrame f) {
+-    frame = f;
+-  }
+-
+-  private Address registerValue(SPARCRegister reg) {
+-    return frame.getSP().addOffsetTo(reg.spOffsetInSavedWindow()).getAddressAt(0);
+-  }
+-
+-  public Address savedArgsBase() {
+-    return registerValue(SPARCRegisters.L4);
+-  }
+-  public Address exactSenderSP() {
+-    return registerValue(SPARCRegisters.I5);
+-  }
+-  public Address senderLink() {
+-    return frame.getSenderSP();
+-  }
+-  public Address senderPC() {
+-    return frame.getSenderPC();
+-  }
+-  public Address extendedSenderSP() {
+-    return savedArgsBase();
+-  }
+-}
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
+--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
++++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
+@@ -269,7 +269,6 @@
+ 
+     if (isEntryFrame())       return senderForEntryFrame(map);
+     if (isInterpretedFrame()) return senderForInterpreterFrame(map);
+-    if (isRicochetFrame())    return senderForRicochetFrame(map);
+ 
+     if(cb == null) {
+       cb = VM.getVM().getCodeCache().findBlob(getPC());
+@@ -288,16 +287,6 @@
+     return new X86Frame(getSenderSP(), getLink(), getSenderPC());
+   }
+ 
+-  private Frame senderForRicochetFrame(X86RegisterMap map) {
+-    if (DEBUG) {
+-      System.out.println("senderForRicochetFrame");
+-    }
+-    X86RicochetFrame f = X86RicochetFrame.fromFrame(this);
+-    if (map.getUpdateMap())
+-      updateMapWithSavedLink(map, f.senderLinkAddress());
+-    return new X86Frame(f.extendedSenderSP(), f.exactSenderSP(), f.senderLink(), f.senderPC());
+-  }
+-
+   private Frame senderForEntryFrame(X86RegisterMap map) {
+     if (DEBUG) {
+       System.out.println("senderForEntryFrame");
+diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RicochetFrame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RicochetFrame.java
+deleted file mode 100644
+--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RicochetFrame.java
++++ /dev/null
+@@ -1,81 +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.
+- *
+- * 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.jvm.hotspot.runtime.x86;
+-
+-import java.util.*;
+-import sun.jvm.hotspot.debugger.*;
+-import sun.jvm.hotspot.runtime.*;
+-import sun.jvm.hotspot.types.*;
+-
+-public class X86RicochetFrame extends VMObject {
+-  static {
+-    VM.registerVMInitializedObserver(new Observer() {
+-        public void update(Observable o, Object data) {
+-          initialize(VM.getVM().getTypeDataBase());
+-        }
+-      });
+-  }
+-
+-  private static void initialize(TypeDataBase db) {
+-    Type type = db.lookupType("MethodHandles::RicochetFrame");
+-
+-    senderLinkField    = type.getAddressField("_sender_link");
+-    savedArgsBaseField = type.getAddressField("_saved_args_base");
+-    exactSenderSPField = type.getAddressField("_exact_sender_sp");
+-    senderPCField      = type.getAddressField("_sender_pc");
+-  }
+-
+-  private static AddressField senderLinkField;
+-  private static AddressField savedArgsBaseField;
+-  private static AddressField exactSenderSPField;
+-  private static AddressField senderPCField;
+-
+-  static X86RicochetFrame fromFrame(X86Frame f) {
+-    return new X86RicochetFrame(f.getFP().addOffsetTo(- senderLinkField.getOffset()));
+-  }
+-
+-  private X86RicochetFrame(Address addr) {
+-    super(addr);
+-  }
+-
+-  public Address senderLink() {
+-    return senderLinkField.getValue(addr);
+-  }
+-  public Address senderLinkAddress() {
+-    return addr.addOffsetTo(senderLinkField.getOffset());
+-  }
+-  public Address savedArgsBase() {
+-    return savedArgsBaseField.getValue(addr);
+-  }
+-  public Address extendedSenderSP() {
+-    return savedArgsBase();
+-  }
+-  public Address exactSenderSP() {
+-    return exactSenderSPField.getValue(addr);
+-  }
+-  public Address senderPC() {
+-    return senderPCField.getValue(addr);
+-  }
+-}
+diff --git a/make/solaris/makefiles/fastdebug.make b/make/solaris/makefiles/fastdebug.make
+--- a/make/solaris/makefiles/fastdebug.make
++++ b/make/solaris/makefiles/fastdebug.make
+@@ -36,6 +36,11 @@
+ ifeq ("${Platform_compiler}", "sparcWorks")
+ OPT_CFLAGS/SLOWER = -xO2
+ 
++ifeq ($(COMPILER_REV_NUMERIC), 510)
++# CC 5.10 has bug XXXXX with -xO4
++OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/SLOWER)
++endif # COMPILER_REV_NUMERIC == 510
++
+ ifeq ($(COMPILER_REV_NUMERIC), 509)
+ # To avoid jvm98 crash
+ OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER)
+diff --git a/make/solaris/makefiles/optimized.make b/make/solaris/makefiles/optimized.make
+--- a/make/solaris/makefiles/optimized.make
++++ b/make/solaris/makefiles/optimized.make
+@@ -32,6 +32,11 @@
+ # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
+ ifeq ("${Platform_compiler}", "sparcWorks")
+ 
++ifeq ($(COMPILER_REV_NUMERIC), 510)
++# CC 5.10 has bug XXXXX with -xO4
++OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2)
++endif # COMPILER_REV_NUMERIC == 510
++
+ ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+ # dtrace cannot handle tail call optimization (6672627, 6693876)
+ OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
+diff --git a/make/solaris/makefiles/product.make b/make/solaris/makefiles/product.make
+--- a/make/solaris/makefiles/product.make
++++ b/make/solaris/makefiles/product.make
+@@ -40,6 +40,11 @@
+ # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
+ ifeq ("${Platform_compiler}", "sparcWorks")
+ 
++ifeq ($(COMPILER_REV_NUMERIC), 510)
++# CC 5.10 has bug XXXXX with -xO4
++OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2)
++endif # COMPILER_REV_NUMERIC == 510
++
+ ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+ # dtrace cannot handle tail call optimization (6672627, 6693876)
+ OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
 diff --git a/src/cpu/sparc/vm/assembler_sparc.cpp b/src/cpu/sparc/vm/assembler_sparc.cpp
 --- a/src/cpu/sparc/vm/assembler_sparc.cpp
 +++ b/src/cpu/sparc/vm/assembler_sparc.cpp
@@ -450,7 +910,7 @@
                                               : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
 -    default                                  : ShouldNotReachHere();                                                       break;
 +    default:
-+      ShouldNotReachHere();
++      fatal(err_msg("unexpected method kind: %d", kind));
 +      break;
    }
  
@@ -940,7 +1400,7 @@
    Label L_ok, L_bad;
    BLOCK_COMMENT("verify_klass {");
    __ verify_oop(obj_reg);
-@@ -499,537 +92,416 @@
+@@ -499,537 +92,415 @@
    __ ld_ptr(Address(temp2_reg, 0), temp2_reg);
    __ cmp_and_brx_short(temp_reg, temp2_reg, Assembler::equal, Assembler::pt, L_ok);
    __ BIND(L_bad);
@@ -959,7 +1419,7 @@
 +  __ srl( temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT, temp);
 +  __ and3(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK,  temp);
 +  __ cmp_and_br_short(temp, ref_kind, Assembler::equal, Assembler::pt, L);
-+  { char* buf = NEW_C_HEAP_ARRAY(char, 100);
++  { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
 +    jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
 +    if (ref_kind == JVM_REF_invokeVirtual ||
 +        ref_kind == JVM_REF_invokeSpecial)
@@ -992,12 +1452,11 @@
 -
      const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
      __ ld(interp_only, temp);
-     __ tst(temp);
+-    __ tst(temp);
 -    __ br(Assembler::notZero, true, Assembler::pn, skip_compiled_code);
 -    __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target);
 -    __ bind(skip_compiled_code);
-+    __ br(Assembler::zero, true, Assembler::pt, run_compiled_code);
-+    __ delayed()->nop();
++    __ cmp_and_br_short(temp, 0, Assembler::zero, Assembler::pt, run_compiled_code);
 +    __ ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target);
 +    __ jmp(target, 0);
 +    __ delayed()->nop();
@@ -1166,7 +1625,8 @@
 +  if (TraceMethodHandles) {
 +    const char* name = vmIntrinsics::name_at(iid);
 +    if (*name == '_')  name += 1;
-+    char* qname = NEW_C_HEAP_ARRAY(char, 100);
++    const size_t len = strlen(name) + 50;
++    char* qname = NEW_C_HEAP_ARRAY(char, len, mtInternal);
 +    const char* suffix = "";
 +    if (vmIntrinsics::method_for(iid) == NULL ||
 +        !vmIntrinsics::method_for(iid)->access_flags().is_public()) {
@@ -1175,7 +1635,7 @@
 +      else
 +        suffix = "/private";
 +    }
-+    jio_snprintf(qname, 100, "MethodHandle::interpreter_entry::%s%s", name, suffix);
++    jio_snprintf(qname, len, "MethodHandle::interpreter_entry::%s%s", name, suffix);
 +    if (O0_mh != noreg)
 +      __ mov(O0_mh, G3_method_handle);  // make stub happy
 +    trace_method_handle(_masm, qname);
@@ -1832,7 +2292,7 @@
  
    if (Verbose) {
      // dumping last frame with frame::describe
-@@ -1090,6 +562,7 @@
+@@ -1090,6 +561,7 @@
  
      // mark saved_sp, if seems valid (may not be valid for some adapters)
      intptr_t *unbiased_sp = (intptr_t *)(STACK_BIAS+(uintptr_t)saved_sp);
@@ -1840,7 +2300,7 @@
      if ((unbiased_sp >= dump_sp - UNREASONABLE_STACK_MOVE) && (unbiased_sp < dump_fp)) {
        values.describe(-1, unbiased_sp, "*saved_sp+STACK_BIAS");
      }
-@@ -1097,10 +570,13 @@
+@@ -1097,10 +569,13 @@
      // Note: the unextended_sp may not be correct
      tty->print_cr("  stack layout:");
      values.print(p);
@@ -1858,7 +2318,7 @@
    }
  }
  
-@@ -1143,1260 +619,3 @@
+@@ -1143,1260 +618,3 @@
    BLOCK_COMMENT("} trace_method_handle");
  }
  #endif // PRODUCT
@@ -3331,28 +3791,92 @@
 diff --git a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
 --- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
-@@ -886,6 +886,20 @@
+@@ -400,13 +400,13 @@
+     case T_LONG:                // LP64, longs compete with int args
+       assert(sig_bt[i+1] == T_VOID, "");
+ #ifdef _LP64
+-      if (int_reg_cnt < int_reg_max) int_reg_cnt++;
++      if (int_reg_cnt < int_reg_max)  int_reg_cnt++;
+ #endif
+       break;
+     case T_OBJECT:
+     case T_ARRAY:
+     case T_ADDRESS: // Used, e.g., in slow-path locking for the lock's stack address
+-      if (int_reg_cnt < int_reg_max) int_reg_cnt++;
++      if (int_reg_cnt < int_reg_max)  int_reg_cnt++;
+ #ifndef _LP64
+       else                            stk_reg_pairs++;
+ #endif
+@@ -416,11 +416,11 @@
+     case T_CHAR:
+     case T_BYTE:
+     case T_BOOLEAN:
+-      if (int_reg_cnt < int_reg_max) int_reg_cnt++;
++      if (int_reg_cnt < int_reg_max)  int_reg_cnt++;
+       else                            stk_reg_pairs++;
+       break;
+     case T_FLOAT:
+-      if (flt_reg_cnt < flt_reg_max) flt_reg_cnt++;
++      if (flt_reg_cnt < flt_reg_max)  flt_reg_cnt++;
+       else                            stk_reg_pairs++;
+       break;
+     case T_DOUBLE:
+@@ -436,7 +436,6 @@
+   // This is where the longs/doubles start on the stack.
+   stk_reg_pairs = (stk_reg_pairs+1) & ~1; // Round
+ 
+-  int int_reg_pairs = (int_reg_cnt+1) & ~1; // 32-bit 2-reg longs only
+   int flt_reg_pairs = (flt_reg_cnt+1) & ~1;
+ 
+   // int stk_reg = frame::register_save_words*(wordSize>>2);
+@@ -517,24 +516,15 @@
+           stk_reg_pairs += 2;
+         }
+ #else // COMPILER2
+-        if (int_reg_pairs + 1 < int_reg_max) {
+-          if (is_outgoing) {
+-            regs[i].set_pair(as_oRegister(int_reg_pairs + 1)->as_VMReg(), as_oRegister(int_reg_pairs)->as_VMReg());
+-          } else {
+-            regs[i].set_pair(as_iRegister(int_reg_pairs + 1)->as_VMReg(), as_iRegister(int_reg_pairs)->as_VMReg());
+-          }
+-          int_reg_pairs += 2;
+-        } else {
+           regs[i].set2(VMRegImpl::stack2reg(stk_reg_pairs));
+           stk_reg_pairs += 2;
+-        }
+ #endif // COMPILER2
+ #endif // _LP64
+       break;
+ 
+     case T_FLOAT:
+       if (flt_reg < flt_reg_max) regs[i].set1(as_FloatRegister(flt_reg++)->as_VMReg());
+-      else                       regs[i].set1(    VMRegImpl::stack2reg(stk_reg++));
++      else                       regs[i].set1(VMRegImpl::stack2reg(stk_reg++));
+       break;
+     case T_DOUBLE:
+       assert(sig_bt[i+1] == T_VOID, "expecting half");
+@@ -886,6 +876,20 @@
    __ delayed()->add(SP, G1, Gargs);
  }
  
 +static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg, Register temp2_reg,
 +                        address code_start, address code_end,
-+                        Label& L_ok, Label& L_fail) {
++                        Label& L_ok) {
++  Label L_fail;
 +  __ set(ExternalAddress(code_start), temp_reg);
-+  __ set((int)(intptr_t)(code_end - code_start), temp2_reg);
++  __ set(pointer_delta(code_end, code_start, 1), temp2_reg);
 +  __ cmp(pc_reg, temp_reg);
-+  __ br(Assembler::lessEqualUnsigned, false, Assembler::pn, L_fail);
++  __ brx(Assembler::lessEqualUnsigned, false, Assembler::pn, L_fail);
 +  __ delayed()->add(temp_reg, temp2_reg, temp_reg);
 +  __ cmp(pc_reg, temp_reg);
-+  __ br(Assembler::lessUnsigned, false, Assembler::pt, L_ok);
-+  __ delayed()->nop();
++  __ cmp_and_brx_short(pc_reg, temp_reg, Assembler::lessUnsigned, Assembler::pt, L_ok);
 +  __ bind(L_fail);
 +}
 +
  void AdapterGenerator::gen_i2c_adapter(
                              int total_args_passed,
                              // VMReg max_arg,
-@@ -907,6 +921,54 @@
+@@ -907,6 +911,51 @@
    // This removes all sorts of headaches on the x86 side and also eliminates
    // the possibility of having c2i -> i2c -> c2i -> ... endless transitions.
  
@@ -3381,22 +3905,19 @@
 +    //         StubRoutines::contains($return_addr),
 +    //         "i2c adapter must return to an interpreter frame");
 +    __ block_comment("verify_i2c { ");
-+    Label L_ok, L_fail0, L_fail1, L_fail2;
++    Label L_ok;
 +    if (Interpreter::code() != NULL)
 +      range_check(masm, O7, O0, O1,
 +                  Interpreter::code()->code_start(), Interpreter::code()->code_end(),
-+                  L_ok, L_fail0);
-+    __ bind(L_fail0);
++                  L_ok);
 +    if (StubRoutines::code1() != NULL)
 +      range_check(masm, O7, O0, O1,
 +                  StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
-+                  L_ok, L_fail1);
-+    __ bind(L_fail1);
++                  L_ok);
 +    if (StubRoutines::code2() != NULL)
 +      range_check(masm, O7, O0, O1, 
 +                  StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
-+                  L_ok, L_fail2);
-+    __ bind(L_fail2);
++                  L_ok);
 +    const char* msg = "i2c adapter must return to an interpreter frame";
 +    __ block_comment(msg);
 +    __ stop(msg);
@@ -3407,7 +3928,7 @@
    // As you can see from the list of inputs & outputs there are not a lot
    // of temp registers to work with: mostly G1, G3 & G4.
  
-@@ -1937,20 +1999,156 @@
+@@ -1937,20 +1986,156 @@
    __ bind(done);
  }
  
@@ -3456,7 +3977,7 @@
 +  } else if (special_dispatch == vmIntrinsics::_invokeBasic) {
 +    has_receiver = true;
 +  } else {
-+    guarantee(false, err_msg("special_dispatch=%d", special_dispatch));
++    fatal(err_msg("special_dispatch=%d", special_dispatch));
 +  }
 +
 +  if (member_reg != noreg) {
@@ -5584,7 +6105,7 @@
 +  __ andl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
 +  __ cmpl(temp, ref_kind);
 +  __ jcc(Assembler::equal, L);
-+  { char* buf = NEW_C_HEAP_ARRAY(char, 100);
++  { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
 +    jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
 +    if (ref_kind == JVM_REF_invokeVirtual ||
 +        ref_kind == JVM_REF_invokeSpecial)
@@ -5609,7 +6130,7 @@
      Label run_compiled_code;
      // JVMTI events, such as single-stepping, are implemented partly by avoiding running
      // compiled code in threads for which the event is enabled.  Check here for
-@@ -567,462 +138,379 @@
+@@ -567,462 +138,380 @@
      __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0);
      __ jccb(Assembler::zero, run_compiled_code);
      __ jmp(Address(method, methodOopDesc::interpreter_entry_offset()));
@@ -5771,7 +6292,8 @@
 +  if (TraceMethodHandles) {
 +    const char* name = vmIntrinsics::name_at(iid);
 +    if (*name == '_')  name += 1;
-+    char* qname = NEW_C_HEAP_ARRAY(char, 100);
++    const size_t len = strlen(name) + 50;
++    char* qname = NEW_C_HEAP_ARRAY(char, len, mtInternal);
 +    const char* suffix = "";
 +    if (vmIntrinsics::method_for(iid) == NULL ||
 +        !vmIntrinsics::method_for(iid)->access_flags().is_public()) {
@@ -5780,7 +6302,7 @@
 +      else
 +        suffix = "/private";
 +    }
-+    jio_snprintf(qname, 100, "MethodHandle::interpreter_entry::%s%s", name, suffix);
++    jio_snprintf(qname, len, "MethodHandle::interpreter_entry::%s%s", name, suffix);
 +    // note: stub look for mh in rcx
 +    trace_method_handle(_masm, qname);
 +  }
@@ -6405,7 +6927,7 @@
  
    if (Verbose) {
      tty->print_cr("Registers:");
-@@ -1086,12 +574,18 @@
+@@ -1086,12 +575,18 @@
          values.describe(-1, dump_fp, "fp for #1 <not parsed, cannot trust pc>");
          values.describe(-1, dump_sp, "sp for #1");
        }
@@ -6426,7 +6948,7 @@
    }
  }
  
-@@ -1159,1363 +653,3 @@
+@@ -1159,1363 +654,3 @@
  }
  #endif //PRODUCT
  
@@ -8083,13 +8605,14 @@
 diff --git a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
 --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
-@@ -643,6 +643,18 @@
+@@ -643,6 +643,19 @@
    __ movdbl(r, Address(saved_sp, next_val_off));
  }
  
 +static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
 +                        address code_start, address code_end,
-+                        Label& L_ok, Label& L_fail) {
++                        Label& L_ok) {
++  Label L_fail;
 +  __ lea(temp_reg, ExternalAddress(code_start));
 +  __ cmpptr(pc_reg, temp_reg);
 +  __ jcc(Assembler::belowEqual, L_fail);
@@ -8102,7 +8625,7 @@
  static void gen_i2c_adapter(MacroAssembler *masm,
                              int total_args_passed,
                              int comp_args_on_stack,
-@@ -653,9 +665,56 @@
+@@ -653,9 +666,53 @@
    // we may do a i2c -> c2i transition if we lose a race where compiled
    // code goes non-entrant while we get args ready.
  
@@ -8133,22 +8656,19 @@
 +    //         StubRoutines::contains($return_addr),
 +    //         "i2c adapter must return to an interpreter frame");
 +    __ block_comment("verify_i2c { ");
-+    Label L_ok, L_fail0, L_fail1, L_fail2;
++    Label L_ok;
 +    if (Interpreter::code() != NULL)
 +      range_check(masm, rax, rdi,
 +                  Interpreter::code()->code_start(), Interpreter::code()->code_end(),
-+                  L_ok, L_fail0);
-+    __ bind(L_fail0);
++                  L_ok);
 +    if (StubRoutines::code1() != NULL)
 +      range_check(masm, rax, rdi,
 +                  StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
-+                  L_ok, L_fail1);
-+    __ bind(L_fail1);
++                  L_ok);
 +    if (StubRoutines::code2() != NULL)
 +      range_check(masm, rax, rdi,
 +                  StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
-+                  L_ok, L_fail2);
-+    __ bind(L_fail2);
++                  L_ok);
 +    const char* msg = "i2c adapter must return to an interpreter frame";
 +    __ block_comment(msg);
 +    __ stop(msg);
@@ -8159,7 +8679,7 @@
    // Must preserve original SP for loading incoming arguments because
    // we need to align the outgoing SP for compiled code.
    __ movptr(rdi, rsp);
-@@ -1293,6 +1352,89 @@
+@@ -1293,6 +1350,89 @@
    __ bind(done);
  }
  
@@ -8249,7 +8769,7 @@
  
  // ---------------------------------------------------------------------------
  // Generate a native wrapper for a given method.  The method takes arguments
-@@ -1323,14 +1465,37 @@
+@@ -1323,14 +1463,37 @@
  //    transition back to thread_in_Java
  //    return to caller
  //
@@ -8290,7 +8810,7 @@
    bool is_critical_native = true;
    address native_func = method->critical_native_function();
    if (native_func == NULL) {
-@@ -1436,7 +1601,7 @@
+@@ -1436,7 +1599,7 @@
        if (in_regs[i].first()->is_Register()) {
          const Register reg = in_regs[i].first()->as_Register();
          switch (in_sig_bt[i]) {
@@ -8302,13 +8822,14 @@
 diff --git a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
-@@ -590,6 +590,18 @@
+@@ -590,6 +590,19 @@
    __ jmp(rcx);
  }
  
 +static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
 +                        address code_start, address code_end,
-+                        Label& L_ok, Label& L_fail) {
++                        Label& L_ok) {
++  Label L_fail;
 +  __ lea(temp_reg, ExternalAddress(code_start));
 +  __ cmpptr(pc_reg, temp_reg);
 +  __ jcc(Assembler::belowEqual, L_fail);
@@ -8321,7 +8842,7 @@
  static void gen_i2c_adapter(MacroAssembler *masm,
                              int total_args_passed,
                              int comp_args_on_stack,
-@@ -605,9 +617,56 @@
+@@ -605,9 +618,53 @@
    // save code can segv when fxsave instructions find improperly
    // aligned stack pointer.
  
@@ -8352,22 +8873,19 @@
 +    //         StubRoutines::contains($return_addr),
 +    //         "i2c adapter must return to an interpreter frame");
 +    __ block_comment("verify_i2c { ");
-+    Label L_ok, L_fail0, L_fail1, L_fail2;
++    Label L_ok;
 +    if (Interpreter::code() != NULL)
 +      range_check(masm, rax, r11,
 +                  Interpreter::code()->code_start(), Interpreter::code()->code_end(),
-+                  L_ok, L_fail0);
-+    __ bind(L_fail0);
++                  L_ok);
 +    if (StubRoutines::code1() != NULL)
 +      range_check(masm, rax, r11,
 +                  StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
-+                  L_ok, L_fail1);
-+    __ bind(L_fail1);
++                  L_ok);
 +    if (StubRoutines::code2() != NULL)
 +      range_check(masm, rax, r11,
 +                  StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
-+                  L_ok, L_fail2);
-+    __ bind(L_fail2);
++                  L_ok);
 +    const char* msg = "i2c adapter must return to an interpreter frame";
 +    __ block_comment(msg);
 +    __ stop(msg);
@@ -8378,7 +8896,7 @@
    // Must preserve original SP for loading incoming arguments because
    // we need to align the outgoing SP for compiled code.
    __ movptr(r11, rsp);
-@@ -1366,6 +1425,14 @@
+@@ -1366,6 +1423,14 @@
  }
  
  
@@ -8393,7 +8911,7 @@
  class ComputeMoveOrder: public StackObj {
    class MoveOperation: public ResourceObj {
      friend class ComputeMoveOrder;
-@@ -1532,6 +1599,89 @@
+@@ -1532,6 +1597,89 @@
    }
  };
  
@@ -8483,7 +9001,7 @@
  
  // ---------------------------------------------------------------------------
  // Generate a native wrapper for a given method.  The method takes arguments
-@@ -1539,14 +1689,60 @@
+@@ -1539,14 +1687,60 @@
  // convention (handlizes oops, etc), transitions to native, makes the call,
  // returns to java state (possibly blocking), unhandlizes any result and
  // returns.
@@ -8547,7 +9065,7 @@
    bool is_critical_native = true;
    address native_func = method->critical_native_function();
    if (native_func == NULL) {
-@@ -1658,7 +1854,7 @@
+@@ -1658,7 +1852,7 @@
            case T_SHORT:
            case T_CHAR:
            case T_INT:  single_slots++; break;
@@ -8620,7 +9138,7 @@
                                               : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
 -    default                                  : ShouldNotReachHere();                                                       break;
 +    default:
-+      ShouldNotReachHere();
++      fatal(err_msg("unexpected method kind: %d", kind));
 +      break;
    }
  
@@ -8641,21 +9159,35 @@
  
      __ cmpl(rdx, atos);
      __ jcc(Assembler::notEqual, notObj);
-@@ -1529,7 +1529,6 @@
-   case Interpreter::empty                  : entry_point = ((InterpreterGenerator*) this)->generate_empty_entry();       break;
-   case Interpreter::accessor               : entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry();    break;
-   case Interpreter::abstract               : entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry();    break;
+@@ -1524,12 +1524,11 @@
+   switch (kind) {
+   case Interpreter::zerolocals             :                                                                             break;
+   case Interpreter::zerolocals_synchronized: synchronized = true;                                                        break;
+-  case Interpreter::native                 : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); break;
+-  case Interpreter::native_synchronized    : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(true);  break;
+-  case Interpreter::empty                  : entry_point = ((InterpreterGenerator*) this)->generate_empty_entry();       break;
+-  case Interpreter::accessor               : entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry();    break;
+-  case Interpreter::abstract               : entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry();    break;
 -  case Interpreter::method_handle          : entry_point = ((InterpreterGenerator*) this)->generate_method_handle_entry();break;
++  case Interpreter::native                 : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
++  case Interpreter::native_synchronized    : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true);  break;
++  case Interpreter::empty                  : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry();       break;
++  case Interpreter::accessor               : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry();    break;
++  case Interpreter::abstract               : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry();    break;
  
    case Interpreter::java_lang_math_sin     : // fall thru
    case Interpreter::java_lang_math_cos     : // fall thru
-@@ -1542,7 +1541,9 @@
-   case Interpreter::java_lang_math_exp     : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);    break;
+@@ -1539,10 +1538,12 @@
+   case Interpreter::java_lang_math_log10   : // fall thru
+   case Interpreter::java_lang_math_sqrt    : // fall thru
+   case Interpreter::java_lang_math_pow     : // fall thru
+-  case Interpreter::java_lang_math_exp     : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);    break;
++  case Interpreter::java_lang_math_exp     : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind);    break;
    case Interpreter::java_lang_ref_reference_get
                                             : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
 -  default                                  : ShouldNotReachHere();                                                       break;
 +  default:
-+    ShouldNotReachHere();
++    fatal(err_msg("unexpected method kind: %d", kind));
 +    break;
    }
  
@@ -9751,7 +10283,38 @@
 diff --git a/src/cpu/zero/vm/cppInterpreter_zero.cpp b/src/cpu/zero/vm/cppInterpreter_zero.cpp
 --- a/src/cpu/zero/vm/cppInterpreter_zero.cpp
 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp
-@@ -761,7 +761,7 @@
+@@ -646,16 +646,15 @@
+   oop method_type = (oop) p;
+ 
+   // The MethodHandle is in the slot after the arguments
+-  oop form = java_lang_invoke_MethodType::form(method_type);
+-  int num_vmslots = java_lang_invoke_MethodTypeForm::vmslots(form);
+-  assert(argument_slots == num_vmslots + 1, "should be");
++  int num_vmslots = argument_slots - 1;
+   oop method_handle = VMSLOTS_OBJECT(num_vmslots);
+ 
+   // InvokeGeneric requires some extra shuffling
+   oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
+   bool is_exact = mhtype == method_type;
+   if (!is_exact) {
+-    if (method->intrinsic_id() == vmIntrinsics::_invokeExact) {
++    if (true || // FIXME
++        method->intrinsic_id() == vmIntrinsics::_invokeExact) {
+       CALL_VM_NOCHECK_NOFIX(
+         SharedRuntime::throw_WrongMethodTypeException(
+           thread, method_type, mhtype));
+@@ -670,8 +669,8 @@
+     // NB the x86 code for this (in methodHandles_x86.cpp, search for
+     // "genericInvoker") is really really odd.  I'm hoping it's trying
+     // to accomodate odd VM/class library combinations I can ignore.
+-    oop adapter = java_lang_invoke_MethodTypeForm::genericInvoker(form);
+-    if (adapter == NULL) {
++    oop adapter = NULL; //FIXME: load the adapter from the CP cache
++    IF (adapter == NULL) {
+       CALL_VM_NOCHECK_NOFIX(
+         SharedRuntime::throw_WrongMethodTypeException(
+           thread, method_type, mhtype));
+@@ -761,7 +760,7 @@
            return;
        }
        if (entry_kind != MethodHandles::_invokespecial_mh) {
@@ -9760,6 +10323,16 @@
          instanceKlass* rcvrKlass =
            (instanceKlass *) receiver->klass()->klass_part();
          if (entry_kind == MethodHandles::_invokevirtual_mh) {
+@@ -1179,8 +1178,7 @@
+ intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
+                                               oop method_handle) {
+   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
+-  oop form = java_lang_invoke_MethodType::form(method_type);
+-  int argument_slots = java_lang_invoke_MethodTypeForm::vmslots(form);
++  int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
+ 
+   return stack->sp() + argument_slots;
+ }
 diff --git a/src/cpu/zero/vm/interpreterGenerator_zero.hpp b/src/cpu/zero/vm/interpreterGenerator_zero.hpp
 --- a/src/cpu/zero/vm/interpreterGenerator_zero.hpp
 +++ b/src/cpu/zero/vm/interpreterGenerator_zero.hpp
@@ -9919,13 +10492,39 @@
    );
  }
  
-@@ -211,7 +217,8 @@
+@@ -211,7 +217,34 @@
                                           && e != f && e != g && e != h
                                                     && f != g && f != h
                                                               && g != h,
 -    "registers must be different"
 +    err_msg("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d",
 +            a, b, c, d, e, f, g, h)
++  );
++}
++
++
++inline void assert_different_registers(
++  AbstractRegister a,
++  AbstractRegister b,
++  AbstractRegister c,
++  AbstractRegister d,
++  AbstractRegister e,
++  AbstractRegister f,
++  AbstractRegister g,
++  AbstractRegister h,
++  AbstractRegister i
++) {
++  assert(
++    a != b && a != c && a != d && a != e && a != f && a != g && a != h && a != i
++           && b != c && b != d && b != e && b != f && b != g && b != h && b != i
++                     && c != d && c != e && c != f && c != g && c != h && c != i
++                               && d != e && d != f && d != g && d != h && d != i
++                                         && e != f && e != g && e != h && e != i
++                                                   && f != g && f != h && f != i
++                                                             && g != h && g != i
++                                                                       && h != i,
++    err_msg("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d",
++            a, b, c, d, e, f, g, h, i)
    );
  }
  
@@ -9966,55 +10565,7 @@
 diff --git a/src/share/vm/c1/c1_FrameMap.cpp b/src/share/vm/c1/c1_FrameMap.cpp
 --- a/src/share/vm/c1/c1_FrameMap.cpp
 +++ b/src/share/vm/c1/c1_FrameMap.cpp
-@@ -66,7 +66,7 @@
- }
- 
- 
--CallingConvention* FrameMap::java_calling_convention(const BasicTypeArray* signature, bool outgoing) {
-+CallingConvention* FrameMap::java_calling_convention(const BasicTypeArray* signature, bool outgoing, bool is_method_handle_invoke) {
-   // compute the size of the arguments first.  The signature array
-   // that java_calling_convention takes includes a T_VOID after double
-   // work items but our signatures do not.
-@@ -77,7 +77,6 @@
-   }
- 
-   BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
--  VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
-   int sig_index = 0;
-   for (i = 0; i < sizeargs; i++, sig_index++) {
-     sig_bt[i] = signature->at(sig_index);
-@@ -87,12 +86,36 @@
-     }
-   }
- 
--  intptr_t out_preserve = SharedRuntime::java_calling_convention(sig_bt, regs, sizeargs, outgoing);
-+  VMRegPair* regs;
-+  intptr_t out_preserve;
-+  if (!is_method_handle_invoke) {
-+    regs         = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
-+    out_preserve = SharedRuntime::java_calling_convention(sig_bt, regs, sizeargs, outgoing);
-+  } else {
-+    ShouldNotReachHere();
-+    // Rotate signature one-left into a temporary array for allocation:
-+    // { L, I, J, D } -> { I, J, D, L }
-+    BasicType* temp_sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
-+    for (int i = 0; i < sizeargs - 1; i++) {
-+      temp_sig_bt[i] = sig_bt[i + 1];
-+    }
-+    temp_sig_bt[sizeargs - 1] = sig_bt[0];
-+
-+    VMRegPair* temp_regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
-+    out_preserve = SharedRuntime::java_calling_convention(temp_sig_bt, temp_regs, sizeargs, outgoing);
-+
-+    // Rotate calling convention one-right into final array:
-+    // { a1, a2, a3, a0 } -> { a0, a1, a2, a3 }
-+    regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
-+    regs[0] = temp_regs[sizeargs - 1];
-+    for (int i = 0; i < sizeargs - 1; i++) {
-+      regs[i + 1] = temp_regs[i];
-+    }
-+  }
-   LIR_OprList* args = new LIR_OprList(signature->length());
+@@ -92,7 +92,6 @@
    for (i = 0; i < sizeargs;) {
      BasicType t = sig_bt[i];
      assert(t != T_VOID, "should be skipping these");
@@ -10022,15 +10573,6 @@
      LIR_Opr opr = map_to_opr(t, regs + i, outgoing);
      args->append(opr);
      if (opr->is_address()) {
-@@ -182,7 +205,7 @@
- 
-   _argcount = method->arg_size();
-   _argument_locations = new intArray(_argcount, -1);
--  _incoming_arguments = java_calling_convention(signature_type_array_for(method), false);
-+  _incoming_arguments = java_calling_convention(signature_type_array_for(method), false, method->is_method_handle_intrinsic());
-   _oop_map_arg_count = _incoming_arguments->reserved_stack_slots();
- 
-   int java_index = 0;
 diff --git a/src/share/vm/c1/c1_FrameMap.hpp b/src/share/vm/c1/c1_FrameMap.hpp
 --- a/src/share/vm/c1/c1_FrameMap.hpp
 +++ b/src/share/vm/c1/c1_FrameMap.hpp
@@ -10041,7 +10583,7 @@
 -  CallingConvention* c_calling_convention (const BasicTypeArray* signature);
 -  CallingConvention* java_calling_convention (const BasicTypeArray* signature, bool outgoing);
 +  CallingConvention* c_calling_convention(const BasicTypeArray* signature);
-+  CallingConvention* java_calling_convention(const BasicTypeArray* signature, bool outgoing, bool is_method_handle_invoke);
++  CallingConvention* java_calling_convention(const BasicTypeArray* signature, bool outgoing);
  
    // deopt support
    ByteSize sp_offset_for_orig_pc() { return sp_offset_for_monitor_base(_num_monitors); }
@@ -10181,7 +10723,7 @@
 +    code == Bytecodes::_invokespecial   ||
 +    code == Bytecodes::_invokevirtual   ||
 +    code == Bytecodes::_invokeinterface;
-+  const bool is_invokedynamic = code == Bytecodes::_invokedynamic;
++  const bool is_invokedynamic = (code == Bytecodes::_invokedynamic);
 +
    bool will_link;
 -  ciMethod* target = stream()->get_method(will_link);
@@ -11134,15 +11676,6 @@
  void LIRGenerator::do_Throw(Throw* x) {
    LIRItem exception(x->exception(), this);
    exception.load_item();
-@@ -2736,7 +2744,7 @@
- //   we cannot spill it as it is spill-locked
- //
- void LIRGenerator::do_Invoke(Invoke* x) {
--  CallingConvention* cc = frame_map()->java_calling_convention(x->signature(), true);
-+  CallingConvention* cc = frame_map()->java_calling_convention(x->signature(), true, /*is_method_handle_invoke*/ false);
- 
-   LIR_OprList* arg_list = cc->args();
-   LIRItemList* args = invoke_visit_arguments(x);
 @@ -2767,7 +2775,10 @@
    // JSR 292
    // Preserve the SP over MethodHandle call sites.
@@ -11976,7 +12509,7 @@
 diff --git a/src/share/vm/ci/ciSignature.hpp b/src/share/vm/ci/ciSignature.hpp
 --- a/src/share/vm/ci/ciSignature.hpp
 +++ b/src/share/vm/ci/ciSignature.hpp
-@@ -39,8 +39,8 @@
+@@ -39,10 +39,11 @@
    ciKlass*  _accessing_klass;
  
    GrowableArray<ciType*>* _types;
@@ -11986,7 +12519,10 @@
 +  int _count;  // number of parameter types in the signature
  
    friend class ciMethod;
++  friend class ciBytecodeStream;
    friend class ciObjectFactory;
+ 
+   ciSignature(ciKlass* accessing_klass, constantPoolHandle cpool, ciSymbol* signature);
 diff --git a/src/share/vm/ci/ciStreams.cpp b/src/share/vm/ci/ciStreams.cpp
 --- a/src/share/vm/ci/ciStreams.cpp
 +++ b/src/share/vm/ci/ciStreams.cpp
@@ -12032,7 +12568,32 @@
    return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder);
  }
  
-@@ -434,7 +457,7 @@
+@@ -396,6 +419,24 @@
+ }
+ 
+ // ------------------------------------------------------------------
++// ciBytecodeStream::get_declared_method_signature
++//
++// Get the declared signature of the currently referenced method.
++//
++// This is always the same as the signature of the resolved method
++// itself, except for _invokehandle and _invokedynamic calls.
++//
++ciSignature* ciBytecodeStream::get_declared_method_signature() {
++  int sig_index = get_method_signature_index();
++  VM_ENTRY_MARK;
++  ciEnv* env = CURRENT_ENV;
++  constantPoolHandle cpool(_method->get_methodOop()->constants());
++  Symbol* sig_sym = cpool->symbol_at(sig_index);
++  ciKlass* pool_holder = env->get_object(cpool->pool_holder())->as_klass();
++  return new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym));
++}
++
++// ------------------------------------------------------------------
+ // ciBytecodeStream::get_method_signature_index
+ //
+ // Get the constant pool index of the signature of the method
+@@ -434,7 +475,7 @@
    // Get the CallSite from the constant pool cache.
    int method_index = get_method_index();
    ConstantPoolCacheEntry* cpcache_entry = cpcache->secondary_entry_at(method_index);
@@ -12044,7 +12605,7 @@
 diff --git a/src/share/vm/ci/ciStreams.hpp b/src/share/vm/ci/ciStreams.hpp
 --- a/src/share/vm/ci/ciStreams.hpp
 +++ b/src/share/vm/ci/ciStreams.hpp
-@@ -259,6 +259,8 @@
+@@ -259,8 +259,11 @@
  
    // If this is a method invocation bytecode, get the invoked method.
    ciMethod* get_method(bool& will_link);
@@ -12052,7 +12613,10 @@
 +  ciObject* get_appendix();
    ciKlass*  get_declared_method_holder();
    int       get_method_holder_index();
++  ciSignature* get_declared_method_signature();
    int       get_method_signature_index();
+ 
+   ciCPCache*  get_cpcache() const;
 diff --git a/src/share/vm/ci/ciSymbol.cpp b/src/share/vm/ci/ciSymbol.cpp
 --- a/src/share/vm/ci/ciSymbol.cpp
 +++ b/src/share/vm/ci/ciSymbol.cpp
@@ -12161,17 +12725,7 @@
  }
  
  void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
-@@ -2209,6 +2224,9 @@
-   // Copy byte codes
-   m->set_code(code_start);
- 
-+  // Now we have some bytecodes, compute the bytecode flags.
-+  m->compute_bytecode_flags();
-+
-   // Copy line number table
-   if (linenumber_table != NULL) {
-     memcpy(m->compressed_linenumber_table(),
-@@ -2336,12 +2354,6 @@
+@@ -2336,12 +2351,6 @@
      _has_vanilla_constructor = true;
    }
  
@@ -12235,7 +12789,26 @@
      bt.push(method, bci, CHECK);
      total_count++;
    }
-@@ -2377,8 +2391,7 @@
+@@ -1724,6 +1738,8 @@
+   java_lang_StackTraceElement::set_methodName(element(), methodname);
+   // Fill in source file name
+   Symbol* source = instanceKlass::cast(method->method_holder())->source_file_name();
++  if (ShowHiddenFrames && source == NULL)
++    source = vmSymbols::unknown_class_name();
+   oop filename = StringTable::intern(source, CHECK_0);
+   java_lang_StackTraceElement::set_fileName(element(), filename);
+   // File in source line number
+@@ -1736,6 +1752,9 @@
+   } else {
+     // Returns -1 if no LineNumberTable, and otherwise actual line number
+     line_number = method->line_number_from_bci(bci);
++    if (line_number == -1 && ShowHiddenFrames) {
++      line_number = bci + 1000000;
++    }
+   }
+   java_lang_StackTraceElement::set_lineNumber(element(), line_number);
+ 
+@@ -2377,8 +2396,7 @@
  // Support for java_lang_invoke_MethodHandle
  
  int java_lang_invoke_MethodHandle::_type_offset;
@@ -12245,7 +12818,7 @@
  
  int java_lang_invoke_MemberName::_clazz_offset;
  int java_lang_invoke_MemberName::_name_offset;
-@@ -2387,21 +2400,18 @@
+@@ -2387,21 +2405,16 @@
  int java_lang_invoke_MemberName::_vmtarget_offset;
  int java_lang_invoke_MemberName::_vmindex_offset;
  
@@ -12255,10 +12828,10 @@
 -int java_lang_invoke_BoundMethodHandle::_vmargslot_offset;
 -
 -int java_lang_invoke_AdapterMethodHandle::_conversion_offset;
+-
+-int java_lang_invoke_CountingMethodHandle::_vmcount_offset;
 +int java_lang_invoke_LambdaForm::_vmentry_offset;
  
- int java_lang_invoke_CountingMethodHandle::_vmcount_offset;
- 
  void java_lang_invoke_MethodHandle::compute_offsets() {
    klassOop klass_oop = SystemDictionary::MethodHandle_klass();
    if (klass_oop != NULL && EnableInvokeDynamic) {
@@ -12273,7 +12846,7 @@
    }
  }
  
-@@ -2412,30 +2422,14 @@
+@@ -2412,50 +2425,17 @@
      compute_offset(_name_offset,      klass_oop, vmSymbols::name_name(),      vmSymbols::string_signature());
      compute_offset(_type_offset,      klass_oop, vmSymbols::type_name(),      vmSymbols::object_signature());
      compute_offset(_flags_offset,     klass_oop, vmSymbols::flags_name(),     vmSymbols::int_signature());
@@ -12286,9 +12859,13 @@
 -  klassOop k = SystemDictionary::DirectMethodHandle_klass();
 -  if (k != NULL && EnableInvokeDynamic) {
 -    DIRECTMETHODHANDLE_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
--  }
--}
--
++void java_lang_invoke_LambdaForm::compute_offsets() {
++  klassOop klass_oop = SystemDictionary::LambdaForm_klass();
++  if (klass_oop != NULL && EnableInvokeDynamic) {
++    compute_offset(_vmentry_offset, klass_oop, vmSymbols::vmentry_name(), vmSymbols::java_lang_invoke_MemberName_signature());
+   }
+ }
+ 
 -void java_lang_invoke_BoundMethodHandle::compute_offsets() {
 -  klassOop k = SystemDictionary::BoundMethodHandle_klass();
 -  if (k != NULL && EnableInvokeDynamic) {
@@ -12301,14 +12878,30 @@
 -  klassOop k = SystemDictionary::AdapterMethodHandle_klass();
 -  if (k != NULL && EnableInvokeDynamic) {
 -    compute_offset(_conversion_offset, k, vmSymbols::conversion_name(), vmSymbols::int_signature(), true);
-+void java_lang_invoke_LambdaForm::compute_offsets() {
-+  klassOop klass_oop = SystemDictionary::LambdaForm_klass();
-+  if (klass_oop != NULL && EnableInvokeDynamic) {
-+    compute_offset(_vmentry_offset, klass_oop, vmSymbols::vmentry_name(), vmSymbols::java_lang_invoke_MemberName_signature());
-   }
- }
- 
-@@ -2464,31 +2458,14 @@
+-  }
+-}
+-
+-void java_lang_invoke_CountingMethodHandle::compute_offsets() {
+-  klassOop k = SystemDictionary::CountingMethodHandle_klass();
+-  if (k != NULL && EnableInvokeDynamic) {
+-    compute_offset(_vmcount_offset, k, vmSymbols::vmcount_name(), vmSymbols::int_signature(), true);
+-  }
+-}
+-
+-int java_lang_invoke_CountingMethodHandle::vmcount(oop mh) {
+-  assert(is_instance(mh), "CMH only");
+-  return mh->int_field(_vmcount_offset);
+-}
+-
+-void java_lang_invoke_CountingMethodHandle::set_vmcount(oop mh, int count) {
+-  assert(is_instance(mh), "CMH only");
+-  mh->int_field_put(_vmcount_offset, count);
+-}
+-
+ oop java_lang_invoke_MethodHandle::type(oop mh) {
+   return mh->obj_field(_type_offset);
+ }
+@@ -2464,31 +2444,14 @@
    mh->obj_field_put(_type_offset, mtype);
  }
  
@@ -12346,7 +12939,7 @@
  }
  
  /// MemberName accessors
-@@ -2540,57 +2517,40 @@
+@@ -2540,57 +2503,40 @@
  
  void java_lang_invoke_MemberName::set_vmtarget(oop mname, oop ref) {
    assert(is_instance(mname), "wrong type");
@@ -12429,7 +13022,22 @@
  }
  
  
-@@ -2635,6 +2595,8 @@
+@@ -2598,14 +2544,12 @@
+ 
+ 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_lang_invoke_MethodTypeForm_signature());
+   }
+ }
+ 
+@@ -2635,6 +2579,8 @@
  }
  
  bool java_lang_invoke_MethodType::equals(oop mt1, oop mt2) {
@@ -12438,25 +13046,33 @@
    if (rtype(mt1) != rtype(mt2))
      return false;
    if (ptype_count(mt1) != ptype_count(mt2))
-@@ -2669,62 +2631,25 @@
+@@ -2656,11 +2602,6 @@
+   return (objArrayOop) mt->obj_field(_ptypes_offset);
+ }
+ 
+-oop java_lang_invoke_MethodType::form(oop mt) {
+-  assert(is_instance(mt), "must be a MethodType");
+-  return mt->obj_field(_form_offset);
+-}
+-
+ oop java_lang_invoke_MethodType::ptype(oop mt, int idx) {
+   return ptypes(mt)->obj_at(idx);
+ }
+@@ -2669,62 +2610,20 @@
    return ptypes(mt)->length();
  }
  
-+oop java_lang_invoke_MethodType::basic_type(oop mt) {
-+  return java_lang_invoke_MethodTypeForm::basicType(form(mt));
-+}
- 
- 
- // Support for java_lang_invoke_MethodTypeForm
- 
+-
+-
+-// Support for java_lang_invoke_MethodTypeForm
+-
 -int java_lang_invoke_MethodTypeForm::_vmslots_offset;
 -int java_lang_invoke_MethodTypeForm::_vmlayout_offset;
 -int java_lang_invoke_MethodTypeForm::_erasedType_offset;
 -int java_lang_invoke_MethodTypeForm::_genericInvoker_offset;
-+int java_lang_invoke_MethodTypeForm::_basicType_offset;
- 
- void java_lang_invoke_MethodTypeForm::compute_offsets() {
-   klassOop k = SystemDictionary::MethodTypeForm_klass();
+-
+-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(_vmlayout_offset,   k, vmSymbols::vmlayout_name(),   vmSymbols::object_signature());
@@ -12464,14 +13080,19 @@
 -    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
 -    METHODTYPEFORM_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
-+  if (k != NULL && EnableInvokeDynamic) {
-+    compute_offset(_basicType_offset, k, vmSymbols::basicType_name(), vmSymbols::java_lang_invoke_MethodType_signature());
-   }
++int java_lang_invoke_MethodType::ptype_slot_count(oop mt) {
++  objArrayOop pts = ptypes(mt);
++  int count = pts->length();
++  int slots = 0;
++  for (int i = 0; i < count; i++) {
++    BasicType bt = java_lang_Class::as_BasicType(pts->obj_at(i));
++    slots += type2size[bt];
+   }
++  return slots;
  }
  
 -int java_lang_invoke_MethodTypeForm::vmslots(oop mtform) {
-+oop java_lang_invoke_MethodTypeForm::basicType(oop mtform) {
-   assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
+-  assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
 -  assert(_vmslots_offset > 0, "");
 -  return mtform->int_field(_vmslots_offset);
 -}
@@ -12505,11 +13126,13 @@
 -oop java_lang_invoke_MethodTypeForm::genericInvoker(oop mtform) {
 -  assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
 -  return mtform->obj_field(_genericInvoker_offset);
-+  return mtform->obj_field(_basicType_offset);
- }
- 
- 
-@@ -2798,10 +2723,26 @@
++int java_lang_invoke_MethodType::rtype_slot_count(oop mt) {
++  BasicType bt = java_lang_Class::as_BasicType(rtype(mt));
++  return type2size[bt];
+ }
+ 
+ 
+@@ -2798,10 +2697,26 @@
  }
  
  oop java_lang_ClassLoader::parent(oop loader) {
@@ -12537,7 +13160,7 @@
  
  // For class loader classes, parallelCapable defined
  // based on non-null field
-@@ -3061,9 +3002,7 @@
+@@ -3061,13 +2976,9 @@
    if (EnableInvokeDynamic) {
      java_lang_invoke_MethodHandle::compute_offsets();
      java_lang_invoke_MemberName::compute_offsets();
@@ -12546,9 +13169,13 @@
 -    java_lang_invoke_AdapterMethodHandle::compute_offsets();
 +    java_lang_invoke_LambdaForm::compute_offsets();
      java_lang_invoke_MethodType::compute_offsets();
-     java_lang_invoke_MethodTypeForm::compute_offsets();
+-    java_lang_invoke_MethodTypeForm::compute_offsets();
      java_lang_invoke_CallSite::compute_offsets();
-@@ -3295,7 +3234,14 @@
+-    java_lang_invoke_CountingMethodHandle::compute_offsets();
+   }
+   java_security_AccessControlContext::compute_offsets();
+   // Initialize reflection classes. The layouts of these classes
+@@ -3295,7 +3206,14 @@
      }
    }
    ResourceMark rm;
@@ -12605,7 +13232,7 @@
  
    // Testers
    static bool is_subclass(klassOop klass) {
-@@ -922,116 +912,9 @@
+@@ -922,149 +912,45 @@
  
    // Accessors for code generation:
    static int type_offset_in_bytes()             { return _type_offset; }
@@ -12616,31 +13243,41 @@
  
 -#define DIRECTMETHODHANDLE_INJECTED_FIELDS(macro)                          \
 -  macro(java_lang_invoke_DirectMethodHandle, vmindex, int_signature, true)
--
++// Interface to java.lang.invoke.LambdaForm objects
++// (These are a private interface for managing adapter code generation.)
+ 
 -class java_lang_invoke_DirectMethodHandle: public java_lang_invoke_MethodHandle {
--  friend class JavaClasses;
--
-- private:
++class java_lang_invoke_LambdaForm: AllStatic {
+   friend class JavaClasses;
+ 
+  private:
 -  static int _vmindex_offset;           // negative or vtable idx or itable idx
--  static void compute_offsets();
--
-- public:
--  // Accessors
++  static int _vmentry_offset;  // type is MemberName
++
+   static void compute_offsets();
+ 
+  public:
+   // Accessors
 -  static int            vmindex(oop mh);
 -  static void       set_vmindex(oop mh, int index);
--
--  // Testers
--  static bool is_subclass(klassOop klass) {
++  static oop            vmentry(oop lform);
++  static void       set_vmentry(oop lform, oop invoker);
+ 
+   // Testers
+   static bool is_subclass(klassOop klass) {
 -    return Klass::cast(klass)->is_subclass_of(SystemDictionary::DirectMethodHandle_klass());
--  }
--  static bool is_instance(oop obj) {
--    return obj != NULL && is_subclass(obj->klass());
--  }
--
--  // Accessors for code generation:
++    return SystemDictionary::LambdaForm_klass() != NULL &&
++      Klass::cast(klass)->is_subclass_of(SystemDictionary::LambdaForm_klass());
+   }
+   static bool is_instance(oop obj) {
+     return obj != NULL && is_subclass(obj->klass());
+   }
+ 
+   // Accessors for code generation:
 -  static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
--};
--
++  static int vmentry_offset_in_bytes()          { return _vmentry_offset; }
+ };
+ 
 -class java_lang_invoke_BoundMethodHandle: public java_lang_invoke_MethodHandle {
 -  friend class JavaClasses;
 -
@@ -12720,43 +13357,34 @@
 -};
 -
 -
- // A simple class that maintains an invocation count
- class java_lang_invoke_CountingMethodHandle: public java_lang_invoke_MethodHandle {
-   friend class JavaClasses;
-@@ -1060,11 +943,42 @@
- 
- 
- 
-+// Interface to java.lang.invoke.LambdaForm objects
-+// (These are a private interface for managing adapter code generation.)
-+
-+class java_lang_invoke_LambdaForm: AllStatic {
-+  friend class JavaClasses;
-+
-+ private:
-+  static int _vmentry_offset;  // type is MemberName
-+
-+  static void compute_offsets();
-+
-+ public:
-+  // Accessors
-+  static oop            vmentry(oop lform);
-+  static void       set_vmentry(oop lform, oop invoker);
-+
-+  // Testers
-+  static bool is_subclass(klassOop klass) {
-+    return SystemDictionary::LambdaForm_klass() != NULL &&
-+      Klass::cast(klass)->is_subclass_of(SystemDictionary::LambdaForm_klass());
-+  }
-+  static bool is_instance(oop obj) {
-+    return obj != NULL && is_subclass(obj->klass());
-+  }
-+
-+  // Accessors for code generation:
-+  static int vmentry_offset_in_bytes()          { return _vmentry_offset; }
-+};
-+
-+
+-// A simple class that maintains an invocation count
+-class java_lang_invoke_CountingMethodHandle: public java_lang_invoke_MethodHandle {
+-  friend class JavaClasses;
+-
+- private:
+-  static int _vmcount_offset;
+-  static void compute_offsets();
+-
+- public:
+-  // Accessors
+-  static int            vmcount(oop mh);
+-  static void       set_vmcount(oop mh, int count);
+-
+-  // Testers
+-  static bool is_subclass(klassOop klass) {
+-    return SystemDictionary::CountingMethodHandle_klass() != NULL &&
+-      Klass::cast(klass)->is_subclass_of(SystemDictionary::CountingMethodHandle_klass());
+-  }
+-  static bool is_instance(oop obj) {
+-    return obj != NULL && is_subclass(obj->klass());
+-  }
+-
+-  // Accessors for code generation:
+-  static int vmcount_offset_in_bytes()          { return _vmcount_offset; }
+-};
+-
+-
+ 
  // Interface to java.lang.invoke.MemberName objects
  // (These are a private interface for Java code to query the class hierarchy.)
  
@@ -12768,7 +13396,7 @@
  
  class java_lang_invoke_MemberName: AllStatic {
    friend class JavaClasses;
-@@ -1076,7 +990,7 @@
+@@ -1076,7 +962,7 @@
    //    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
@@ -12777,7 +13405,7 @@
    static int _clazz_offset;
    static int _name_offset;
    static int _type_offset;
-@@ -1100,15 +1014,11 @@
+@@ -1100,15 +986,11 @@
    static int            flags(oop mname);
    static void       set_flags(oop mname, int flags);
  
@@ -12795,7 +13423,7 @@
  
    // Testers
    static bool is_subclass(klassOop klass) {
-@@ -1124,9 +1034,11 @@
+@@ -1124,9 +1006,11 @@
      MN_IS_CONSTRUCTOR      = 0x00020000, // constructor
      MN_IS_FIELD            = 0x00040000, // field
      MN_IS_TYPE             = 0x00080000, // nested type
@@ -12810,55 +13438,71 @@
    };
  
    // Accessors for code generation:
-@@ -1169,23 +1081,24 @@
- 
-   static bool equals(oop mt1, oop mt2);
- 
-+  static oop basic_type(oop mt);  // java_lang_invoke_MethodTypeForm::basicType(form(mt))
-+  static bool same_basic_type(oop mt1, oop mt2) {
-+    return equals(basic_type(mt1), basic_type(mt2));
-+  }
-+
+@@ -1147,7 +1031,6 @@
+  private:
+   static int _rtype_offset;
+   static int _ptypes_offset;
+-  static int _form_offset;
+ 
+   static void compute_offsets();
+ 
+@@ -1155,11 +1038,13 @@
+   // Accessors
+   static oop            rtype(oop mt);
+   static objArrayOop    ptypes(oop mt);
+-  static oop            form(oop mt);
+ 
+   static oop            ptype(oop mt, int index);
+   static int            ptype_count(oop mt);
+ 
++  static int            ptype_slot_count(oop mt);  // extra counts for long/double
++  static int            rtype_slot_count(oop mt);  // extra counts for long/double
++
+   static Symbol*        as_signature(oop mt, bool intern_if_not_found, TRAPS);
+   static void           print_signature(oop mt, outputStream* st);
+ 
+@@ -1172,40 +1057,6 @@
    // Accessors for code generation:
    static int rtype_offset_in_bytes()            { return _rtype_offset; }
    static int ptypes_offset_in_bytes()           { return _ptypes_offset; }
-   static int form_offset_in_bytes()             { return _form_offset; }
- };
- 
+-  static int form_offset_in_bytes()             { return _form_offset; }
+-};
+-
 -#define METHODTYPEFORM_INJECTED_FIELDS(macro)                              \
 -  macro(java_lang_invoke_MethodTypeForm, vmslots,  int_signature,    true) \
 -  macro(java_lang_invoke_MethodTypeForm, vmlayout, object_signature, true)
 -
- class java_lang_invoke_MethodTypeForm: AllStatic {
-   friend class JavaClasses;
- 
-  private:
-   static int _vmslots_offset;           // number of argument slots needed
-   static int _vmlayout_offset;          // object describing internal calling sequence
+-class java_lang_invoke_MethodTypeForm: AllStatic {
+-  friend class JavaClasses;
+-
+- private:
+-  static int _vmslots_offset;           // number of argument slots needed
+-  static int _vmlayout_offset;          // object describing internal calling sequence
 -  static int _erasedType_offset;        // erasedType = canonical MethodType
-+  static int _basicType_offset;         // basicType = canonical MethodType (normalizing subwords)
-   static int _genericInvoker_offset;    // genericInvoker = adapter for invokeGeneric
- 
-   static void compute_offsets();
-@@ -1195,7 +1108,7 @@
-   static int            vmslots(oop mtform);
-   static void       set_vmslots(oop mtform, int vmslots);
- 
+-  static int _genericInvoker_offset;    // genericInvoker = adapter for invokeGeneric
+-
+-  static void compute_offsets();
+-
+- public:
+-  // Accessors
+-  static int            vmslots(oop mtform);
+-  static void       set_vmslots(oop mtform, int vmslots);
+-
 -  static oop            erasedType(oop mtform);
-+  static oop            basicType(oop mtform);
-   static oop            genericInvoker(oop mtform);
- 
-   static oop            vmlayout(oop mtform);
-@@ -1204,7 +1117,7 @@
-   // Accessors for code generation:
-   static int vmslots_offset_in_bytes()          { return _vmslots_offset; }
-   static int vmlayout_offset_in_bytes()         { return _vmlayout_offset; }
+-  static oop            genericInvoker(oop mtform);
+-
+-  static oop            vmlayout(oop mtform);
+-  static oop       init_vmlayout(oop mtform, oop cookie);
+-
+-  // Accessors for code generation:
+-  static int vmslots_offset_in_bytes()          { return _vmslots_offset; }
+-  static int vmlayout_offset_in_bytes()         { return _vmlayout_offset; }
 -  static int erasedType_offset_in_bytes()       { return _erasedType_offset; }
-+  static int basicType_offset_in_bytes()        { return _basicType_offset; }
-   static int genericInvoker_offset_in_bytes()   { return _genericInvoker_offset; }
+-  static int genericInvoker_offset_in_bytes()   { return _genericInvoker_offset; }
  };
  
-@@ -1275,6 +1188,7 @@
+ 
+@@ -1275,6 +1126,7 @@
  
   public:
    static oop parent(oop loader);
@@ -12866,7 +13510,7 @@
  
    // Support for parallelCapable field
    static bool parallelCapable(oop the_class_mirror);
-@@ -1284,6 +1198,14 @@
+@@ -1284,6 +1136,14 @@
    // Fix for 4474172
    static oop  non_reflection_class_loader(oop loader);
  
@@ -12881,7 +13525,7 @@
    // Debugging
    friend class JavaClasses;
  };
-@@ -1425,10 +1347,7 @@
+@@ -1425,10 +1285,7 @@
  
  #define ALL_INJECTED_FIELDS(macro)          \
    CLASS_INJECTED_FIELDS(macro)              \
@@ -13342,7 +13986,7 @@
 diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
 --- a/src/share/vm/classfile/systemDictionary.hpp
 +++ b/src/share/vm/classfile/systemDictionary.hpp
-@@ -148,13 +148,10 @@
+@@ -148,15 +148,10 @@
    template(MethodHandle_klass,             java_lang_invoke_MethodHandle,             Pre_JSR292) \
    template(MemberName_klass,               java_lang_invoke_MemberName,               Pre_JSR292) \
    template(MethodHandleNatives_klass,      java_lang_invoke_MethodHandleNatives,      Pre_JSR292) \
@@ -13351,13 +13995,15 @@
 -  template(DirectMethodHandle_klass,       java_lang_invoke_DirectMethodHandle,       Pre_JSR292) \
 +  template(LambdaForm_klass,               java_lang_invoke_LambdaForm,               Opt)        \
    template(MethodType_klass,               java_lang_invoke_MethodType,               Pre_JSR292) \
-   template(MethodTypeForm_klass,           java_lang_invoke_MethodTypeForm,           Pre_JSR292) \
+-  template(MethodTypeForm_klass,           java_lang_invoke_MethodTypeForm,           Pre_JSR292) \
    template(BootstrapMethodError_klass,     java_lang_BootstrapMethodError,            Pre_JSR292) \
 -  template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
    template(CallSite_klass,                 java_lang_invoke_CallSite,                 Pre_JSR292) \
-   template(CountingMethodHandle_klass,     java_lang_invoke_CountingMethodHandle,     Opt)        \
+-  template(CountingMethodHandle_klass,     java_lang_invoke_CountingMethodHandle,     Opt)        \
    template(ConstantCallSite_klass,         java_lang_invoke_ConstantCallSite,         Pre_JSR292) \
-@@ -485,17 +482,24 @@
+   template(MutableCallSite_klass,          java_lang_invoke_MutableCallSite,          Pre_JSR292) \
+   template(VolatileCallSite_klass,         java_lang_invoke_VolatileCallSite,         Pre_JSR292) \
+@@ -485,17 +480,24 @@
                                         Handle loader2, bool is_method, TRAPS);
  
    // JSR 292
@@ -13390,7 +14036,7 @@
    // 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
-@@ -503,23 +507,14 @@
+@@ -503,23 +505,14 @@
                                                 Symbol* name,
                                                 Symbol* signature,
                                                 TRAPS);
@@ -13460,7 +14106,7 @@
    template(star_name,                                 "*") /*not really a name*/                  \
    template(invoke_name,                               "invoke")                                   \
    template(override_name,                             "override")                                 \
-@@ -236,37 +238,36 @@
+@@ -236,37 +238,33 @@
    template(base_name,                                 "base")                                     \
                                                                                                    \
    /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */                                   \
@@ -13478,16 +14124,16 @@
 +  template(java_lang_invoke_LambdaForm_signature,     "Ljava/lang/invoke/LambdaForm;")            \
    template(java_lang_invoke_MethodHandle_signature,   "Ljava/lang/invoke/MethodHandle;")          \
    /* internal classes known only to the JVM: */                                                   \
-   template(java_lang_invoke_MethodTypeForm,           "java/lang/invoke/MethodTypeForm")          \
-   template(java_lang_invoke_MethodTypeForm_signature, "Ljava/lang/invoke/MethodTypeForm;")        \
+-  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_MethodHandleImpl,         "java/lang/invoke/MethodHandleImpl")        \
 -  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")      \
+-  template(java_lang_invoke_CountingMethodHandle,     "java/lang/invoke/CountingMethodHandle")    \
 +  template(java_lang_invoke_LambdaForm,               "java/lang/invoke/LambdaForm")              \
-   template(java_lang_invoke_CountingMethodHandle,     "java/lang/invoke/CountingMethodHandle")    \
    template(java_lang_invoke_ForceInline_signature,    "Ljava/lang/invoke/ForceInline;")           \
 +  template(java_lang_invoke_DontInline_signature,     "Ljava/lang/invoke/DontInline;")            \
 +  template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
@@ -13508,7 +14154,7 @@
    template(setTargetNormal_name,                      "setTargetNormal")                          \
    template(setTargetVolatile_name,                    "setTargetVolatile")                        \
    template(setTarget_signature,                       "(Ljava/lang/invoke/MethodHandle;)V")       \
-@@ -359,22 +360,15 @@
+@@ -359,22 +357,15 @@
    template(toString_name,                             "toString")                                 \
    template(values_name,                               "values")                                   \
    template(receiver_name,                             "receiver")                                 \
@@ -13534,7 +14180,7 @@
    template(append_name,                               "append")                                   \
    template(klass_name,                                "klass")                                    \
    template(resolved_constructor_name,                 "resolved_constructor")                     \
-@@ -922,15 +916,15 @@
+@@ -922,15 +913,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) */                                                      \
@@ -13559,7 +14205,7 @@
                                                                                                                          \
    /* unboxing methods: */                                                                                               \
    do_intrinsic(_booleanValue,             java_lang_Boolean,      booleanValue_name, void_boolean_signature, F_R)       \
-@@ -1063,6 +1057,10 @@
+@@ -1063,6 +1054,10 @@
  
      ID_LIMIT,
      LAST_COMPILER_INLINE = _prefetchWriteStatic,
@@ -13755,22 +14401,6 @@
    }
    if (PrintDebugInfo) {
      print_scopes();
-@@ -2383,6 +2389,7 @@
-     if (on_scavenge_root_list())  tty->print("scavenge_root ");
-     tty->print_cr("}:");
-   }
-+  if (Verbose) {
-   if (size              () > 0) tty->print_cr(" total in heap  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
-                                               (address)this,
-                                               (address)this + size(),
-@@ -2427,6 +2434,7 @@
-                                               nul_chk_table_begin(),
-                                               nul_chk_table_end(),
-                                               nul_chk_table_size());
-+  }
- }
- 
- void nmethod::print_code() {
 diff --git a/src/share/vm/code/vtableStubs.hpp b/src/share/vm/code/vtableStubs.hpp
 --- a/src/share/vm/code/vtableStubs.hpp
 +++ b/src/share/vm/code/vtableStubs.hpp
@@ -14243,6 +14873,17 @@
      _shouldnotreachhere,      // For debugging
  
      // Platform specific JVM bytecodes
+@@ -356,8 +359,8 @@
+ 
+  public:
+   // Conversion
+-  static void        check          (Code code)    { assert(is_defined(code), "illegal code"); }
+-  static void        wide_check     (Code code)    { assert(wide_is_defined(code), "illegal code"); }
++  static void        check          (Code code)    { assert(is_defined(code),      err_msg("illegal code: %d", (int)code)); }
++  static void        wide_check     (Code code)    { assert(wide_is_defined(code), err_msg("illegal code: %d", (int)code)); }
+   static Code        cast           (int  code)    { return (Code)code; }
+ 
+ 
 diff --git a/src/share/vm/interpreter/interpreter.cpp b/src/share/vm/interpreter/interpreter.cpp
 --- a/src/share/vm/interpreter/interpreter.cpp
 +++ b/src/share/vm/interpreter/interpreter.cpp
@@ -14819,7 +15460,7 @@
      case Bytecodes::_invokedynamic  : resolve_invokedynamic  (result,       pool, index, CHECK); break;
      case Bytecodes::_invokeinterface: resolve_invokeinterface(result, recv, pool, index, CHECK); break;
    }
-@@ -1116,22 +1186,96 @@
+@@ -1116,22 +1186,91 @@
  }
  
  
@@ -14874,26 +15515,21 @@
 +
 +  // Resolve the bootstrap specifier (BSM + optional arguments).
 +  Handle bootstrap_specifier;
-+  for (;;) {
-+    { // Short circuit if CallSite has been bound already:
-+      ConstantPoolCacheEntry* cpce = pool->cache()->secondary_entry_at(index);
-+      if (!cpce->is_f1_null()) {
-+        methodHandle method(THREAD, cpce->f2_as_vfinal_method());
-+        Handle appendix(THREAD, cpce->has_appendix() ? cpce->f1_appendix() : (oop)NULL);
-+        result.set_handle(method, appendix, CHECK);
-+        return;
-+      }
-+      if (bootstrap_specifier.not_null())
-+        break;
-+    }
-+
-+    // Just one time through this code:
++  // Check if CallSite has been bound already:
++  ConstantPoolCacheEntry* cpce = pool->cache()->secondary_entry_at(index);
++  if (cpce->is_f1_null()) {
 +    int pool_index = pool->cache()->main_entry_at(index)->constant_pool_index();
 +    oop bsm_info = pool->resolve_bootstrap_specifier_at(pool_index, CHECK);
 +    assert(bsm_info != NULL, "");
 +    // FIXME: Cache this once per BootstrapMethods entry, not once per CONSTANT_InvokeDynamic.
 +    bootstrap_specifier = Handle(THREAD, bsm_info);
 +  }
++  if (!cpce->is_f1_null()) {
++    methodHandle method(THREAD, cpce->f2_as_vfinal_method());
++    Handle appendix(THREAD, cpce->has_appendix() ? cpce->f1_appendix() : (oop)NULL);
++    result.set_handle(method, appendix, CHECK);
++    return;
++  }
 +
 +  if (TraceMethodHandles) {
 +    tty->print_cr("resolve_invokedynamic #%d %s %s",
@@ -14927,7 +15563,7 @@
      if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
        // throw these guys, since they are already wrapped
        return;
-@@ -1141,17 +1285,12 @@
+@@ -1141,17 +1280,12 @@
        return;
      }
      // See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS.
@@ -15188,16 +15824,14 @@
    method_entry(java_lang_math_sin  )
    method_entry(java_lang_math_cos  )
    method_entry(java_lang_math_tan  )
-@@ -374,6 +373,14 @@
+@@ -374,6 +373,12 @@
    method_entry(java_lang_math_pow  )
    method_entry(java_lang_ref_reference_get)
  
 +  // method handle entry kinds are generated later in MethodHandlesAdapterGenerator::generate:
-+  {
-+    for (int i = Interpreter::method_handle_invoke_FIRST; i <= Interpreter::method_handle_invoke_LAST; i++) {
-+      Interpreter::MethodKind kind = (Interpreter::MethodKind) i;
-+      Interpreter::_entry_table[kind] = Interpreter::_entry_table[Interpreter::abstract];
-+    }
++  for (int i = Interpreter::method_handle_invoke_FIRST; i <= Interpreter::method_handle_invoke_LAST; i++) {
++    Interpreter::MethodKind kind = (Interpreter::MethodKind) i;
++    Interpreter::_entry_table[kind] = Interpreter::_entry_table[Interpreter::abstract];
 +  }
 +
    // all native method kinds (must be one contiguous block)
@@ -15898,7 +16532,7 @@
  class LocalOopClosure: public OopClosure {
   private:
    void (*_f)(oop*);
-@@ -419,10 +483,10 @@
+@@ -419,9 +483,10 @@
         methodOop new_method, bool * trace_name_printed) {
  
    if (is_vfinal()) {
@@ -15907,12 +16541,11 @@
 +    // virtual and final so _f2 contains method ptr instead of vtable index
 +    if (f2_as_vfinal_method() == old_method) {
        // match old_method so need an update
--      _f2 = (intptr_t)new_method;
-+      set_f2_as_vfinal_method(new_method);
++      // NOTE: can't use set_f2_as_vfinal_method as it asserts on different values
+       _f2 = (intptr_t)new_method;
        if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
          if (!(*trace_name_printed)) {
-           // RC_TRACE_MESG macro has an embedded ResourceMark
-@@ -479,16 +543,17 @@
+@@ -479,16 +544,17 @@
    methodOop m = NULL;
    if (is_vfinal()) {
      // virtual and final so _f2 contains method ptr instead of vtable index
@@ -16354,76 +16987,7 @@
  #include "prims/nativeLookup.hpp"
  #include "runtime/arguments.hpp"
  #include "runtime/compilationPolicy.hpp"
-@@ -396,41 +396,39 @@
- }
- 
- 
--bool methodOopDesc::compute_has_loops_flag() {
-+void methodOopDesc::compute_bytecode_flags() {
-   BytecodeStream bcs(methodOop(this));
-   Bytecodes::Code bc;
- 
--  while ((bc = bcs.next()) >= 0) {
--    switch( bc ) {
--      case Bytecodes::_ifeq:
--      case Bytecodes::_ifnull:
--      case Bytecodes::_iflt:
--      case Bytecodes::_ifle:
--      case Bytecodes::_ifne:
--      case Bytecodes::_ifnonnull:
--      case Bytecodes::_ifgt:
--      case Bytecodes::_ifge:
--      case Bytecodes::_if_icmpeq:
--      case Bytecodes::_if_icmpne:
--      case Bytecodes::_if_icmplt:
--      case Bytecodes::_if_icmpgt:
--      case Bytecodes::_if_icmple:
--      case Bytecodes::_if_icmpge:
--      case Bytecodes::_if_acmpeq:
--      case Bytecodes::_if_acmpne:
--      case Bytecodes::_goto:
--      case Bytecodes::_jsr:
--        if( bcs.dest() < bcs.next_bci() ) _access_flags.set_has_loops();
--        break;
-+  while ((bc = bcs.next()) != Bytecodes::_illegal) {
-+    switch (bc) {
-+    case Bytecodes::_ifeq:
-+    case Bytecodes::_ifnull:
-+    case Bytecodes::_iflt:
-+    case Bytecodes::_ifle:
-+    case Bytecodes::_ifne:
-+    case Bytecodes::_ifnonnull:
-+    case Bytecodes::_ifgt:
-+    case Bytecodes::_ifge:
-+    case Bytecodes::_if_icmpeq:
-+    case Bytecodes::_if_icmpne:
-+    case Bytecodes::_if_icmplt:
-+    case Bytecodes::_if_icmpgt:
-+    case Bytecodes::_if_icmple:
-+    case Bytecodes::_if_icmpge:
-+    case Bytecodes::_if_acmpeq:
-+    case Bytecodes::_if_acmpne:
-+    case Bytecodes::_goto:
-+    case Bytecodes::_jsr:
-+      if (bcs.dest()   < bcs.next_bci())  _access_flags.set_has_loops();
-+      break;
- 
--      case Bytecodes::_goto_w:
--      case Bytecodes::_jsr_w:
--        if( bcs.dest_w() < bcs.next_bci() ) _access_flags.set_has_loops();
--        break;
-+    case Bytecodes::_goto_w:
-+    case Bytecodes::_jsr_w:
-+      if (bcs.dest_w() < bcs.next_bci())  _access_flags.set_has_loops();
-+      break;
-     }
-   }
--  _access_flags.set_loops_flag_init();
--  return _access_flags.has_loops();
- }
- 
- 
-@@ -552,6 +550,7 @@
+@@ -552,6 +552,7 @@
  
  void methodOopDesc::set_native_function(address function, bool post_event_flag) {
    assert(function != NULL, "use clear_native_function to unregister natives");
@@ -16431,7 +16995,7 @@
    address* native_function = native_function_addr();
  
    // We can see racers trying to place the same native function into place. Once
-@@ -581,12 +580,14 @@
+@@ -581,12 +582,14 @@
  
  
  bool methodOopDesc::has_native_function() const {
@@ -16446,7 +17010,7 @@
    set_native_function(
      SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
      !native_bind_event_is_interesting);
-@@ -606,10 +607,6 @@
+@@ -606,10 +609,6 @@
  
  
  bool methodOopDesc::is_not_compilable(int comp_level) const {
@@ -16457,7 +17021,7 @@
    if (number_of_breakpoints() > 0) {
      return true;
    }
-@@ -709,7 +706,7 @@
+@@ -709,7 +708,7 @@
    assert(entry != NULL, "interpreter entry must be non-null");
    // Sets both _i2i_entry and _from_interpreted_entry
    set_interpreter_entry(entry);
@@ -16466,7 +17030,7 @@
      set_native_function(
        SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
        !native_bind_event_is_interesting);
-@@ -797,13 +794,13 @@
+@@ -797,13 +796,13 @@
    OrderAccess::storestore();
  #ifdef SHARK
    mh->_from_interpreted_entry = code->insts_begin();
@@ -16484,7 +17048,7 @@
  }
  
  
-@@ -855,106 +852,51 @@
+@@ -855,106 +854,51 @@
    return false;
  }
  
@@ -16614,7 +17178,7 @@
    constantPoolHandle cp;
    {
      constantPoolOop cp_oop = oopFactory::new_constantPool(cp_length, IsSafeConc, CHECK_(empty));
-@@ -962,19 +904,17 @@
+@@ -962,19 +906,17 @@
    }
    cp->symbol_at_put(_imcp_invoke_name,       name);
    cp->symbol_at_put(_imcp_invoke_signature,  signature);
@@ -16640,7 +17204,7 @@
      methodOop m_oop = oopFactory::new_method(0, accessFlags_from(flags_bits),
                                               0, 0, 0, 0, IsSafeConc, CHECK_(empty));
      m = methodHandle(THREAD, m_oop);
-@@ -982,33 +922,26 @@
+@@ -982,33 +924,26 @@
    m->set_constants(cp());
    m->set_name_index(_imcp_invoke_name);
    m->set_signature_index(_imcp_invoke_signature);
@@ -16681,7 +17245,7 @@
    if (TraceMethodHandles && (Verbose || WizardMode))
      m->print_on(tty);
  
-@@ -1025,7 +958,7 @@
+@@ -1025,7 +960,7 @@
  }
  
  
@@ -16690,7 +17254,7 @@
                                                  u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) {
    // Code below does not work for native methods - they should never get rewritten anyway
    assert(!m->is_native(), "cannot rewrite native methods");
-@@ -1142,7 +1075,9 @@
+@@ -1142,7 +1077,9 @@
  
    // ditto for method and signature:
    vmSymbols::SID  name_id = vmSymbols::find_sid(name());
@@ -16701,7 +17265,7 @@
    vmSymbols::SID   sig_id = vmSymbols::find_sid(signature());
    if (klass_id != vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle)
        && sig_id == vmSymbols::NO_SID)  return;
-@@ -1171,21 +1106,10 @@
+@@ -1171,21 +1108,10 @@
  
    // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
    case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
@@ -16727,7 +17291,7 @@
      break;
    }
  
-@@ -1198,6 +1122,12 @@
+@@ -1198,6 +1124,12 @@
  
  // These two methods are static since a GC may move the methodOopDesc
  bool methodOopDesc::load_signature_classes(methodHandle m, TRAPS) {
@@ -16740,17 +17304,12 @@
    bool sig_is_loaded = true;
    Handle class_loader(THREAD, instanceKlass::cast(m->method_holder())->class_loader());
    Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain());
-@@ -1251,6 +1181,13 @@
+@@ -1251,6 +1183,8 @@
  #endif
    name()->print_symbol_on(st);
    if (WizardMode) signature()->print_symbol_on(st);
-+  else if (MethodHandles::is_signature_polymorphic(intrinsic_id())) {
-+    st->print("(");
-+    for (SignatureStream ss(signature()); !ss.is_done(); ss.next()) {
-+      if (ss.at_return_type())  st->print(")");
-+      st->print("%c", type2char(ss.type()));
-+    }
-+  }
++  else if (MethodHandles::is_signature_polymorphic(intrinsic_id()))
++    MethodHandles::print_as_basic_type_signature_on(st, signature(), true);
  }
  
  // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
@@ -16777,32 +17336,7 @@
    void set_max_stack(int size)                   { _max_stack = size; }
  
    // max locals
-@@ -490,19 +492,13 @@
-   // true if method needs no dynamic dispatch (final and/or no vtable entry)
-   bool can_be_statically_bound() const;
- 
-+  void compute_bytecode_flags();
-+
-   // returns true if the method has any backward branches.
--  bool has_loops() {
--    return access_flags().loops_flag_init() ? access_flags().has_loops() : compute_has_loops_flag();
--  };
-+  bool has_loops()          const { return access_flags().has_loops();          }
- 
--  bool compute_has_loops_flag();
--
--  bool has_jsrs() {
--    return access_flags().has_jsrs();
--  };
--  void set_has_jsrs() {
--    _access_flags.set_has_jsrs();
--  }
-+  bool has_jsrs()                 { return access_flags().has_jsrs();           }
-+  void set_has_jsrs()             {       _access_flags.set_has_jsrs();         }
- 
-   // returns true if the method has any monitors.
-   bool has_monitors() const                      { return is_synchronized() || access_flags().has_monitor_bytecodes(); }
-@@ -590,28 +586,19 @@
+@@ -590,28 +592,19 @@
    bool is_overridden_in(klassOop k) const;
  
    // JSR 292 support
@@ -16838,7 +17372,7 @@
    static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize()
  
    // RedefineClasses() support:
-@@ -656,8 +643,12 @@
+@@ -656,8 +649,12 @@
    bool jfr_towrite()                 { return _jfr_towrite; }
    void set_jfr_towrite(bool towrite) { _jfr_towrite = towrite; }
  
@@ -16853,7 +17387,7 @@
  
    // On-stack replacement support
    bool has_osr_nmethod(int level, bool match_level) {
-@@ -704,8 +695,8 @@
+@@ -704,8 +701,8 @@
    static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS);
  
    // Printing
@@ -16867,13 +17401,22 @@
 diff --git a/src/share/vm/oops/symbol.cpp b/src/share/vm/oops/symbol.cpp
 --- a/src/share/vm/oops/symbol.cpp
 +++ b/src/share/vm/oops/symbol.cpp
-@@ -103,6 +103,7 @@
-     assert(scan >= bytes+i && scan <= limit, "scan oob");
+@@ -96,7 +96,7 @@
+   address scan = bytes + i;
+   if (scan > limit)
+     return -1;
+-  for (;;) {
++  for (; scan <= limit; scan++) {
+     scan = (address) memchr(scan, first_char, (limit + 1 - scan));
+     if (scan == NULL)
+       return -1;  // not found
+@@ -104,6 +104,7 @@
      if (memcmp(scan, str, len) == 0)
        return (int)(scan - bytes);
-+    ++scan;  // skip the initial matching character
-   }
- }
+   }
++  return -1;
+ }
+ 
  
 diff --git a/src/share/vm/opto/bytecodeInfo.cpp b/src/share/vm/opto/bytecodeInfo.cpp
 --- a/src/share/vm/opto/bytecodeInfo.cpp
@@ -16990,6 +17533,24 @@
  
    // don't inline exception code unless the top method belongs to an
    // exception class
+@@ -270,7 +244,7 @@
+   }
+ 
+   // use frequency-based objections only for non-trivial methods
+-  if (callee_method->code_size_for_inlining() <= MaxTrivialSize) return NULL;
++  if (callee_method->code_size() <= MaxTrivialSize) return NULL;
+ 
+   // don't use counts with -Xcomp or CTW
+   if (UseInterpreter && !CompileTheWorld) {
+@@ -319,7 +293,7 @@
+   }
+ 
+   // suppress a few checks for accessors and trivial methods
+-  if (callee_method->code_size_for_inlining() > MaxTrivialSize) {
++  if (callee_method->code_size() > MaxTrivialSize) {
+ 
+     // don't inline into giant methods
+     if (C->unique() > (uint)NodeCountInliningCutoff) {
 @@ -346,7 +320,7 @@
    }
  
@@ -17028,21 +17589,7 @@
      return NULL;
    }
  
-@@ -463,6 +435,13 @@
-     return NULL;
-   }
- 
-+  // XXX this is probably to much
-+//  // Always inline ForceInline methods.
-+//  if (callee_method->force_inline()) {
-+//    if (PrintInlining)  print_inlining(callee_method, caller_bci, "force inline by annotation");
-+//    return WarmCallInfo::always_hot();
-+//  }
-+
-   // Check if inlining policy says no.
-   WarmCallInfo wci = *(initial_wci);
-   failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci);
-@@ -539,9 +518,10 @@
+@@ -539,9 +511,10 @@
    }
    int max_inline_level_adjust = 0;
    if (caller_jvms->method() != NULL) {
@@ -17055,7 +17602,7 @@
        max_inline_level_adjust += 1;  // don't count method handle calls from java.lang.invoke implem
      }
      if (max_inline_level_adjust != 0 && PrintInlining && (Verbose || WizardMode)) {
-@@ -590,7 +570,7 @@
+@@ -590,7 +563,7 @@
  // Given a jvms, which determines a call chain from the root method,
  // find the corresponding inline tree.
  // Note: This method will be removed or replaced as InlineTree goes away.
@@ -17064,7 +17611,7 @@
    InlineTree* iltp = root;
    uint depth = jvms && jvms->has_method() ? jvms->depth() : 0;
    for (uint d = 1; d <= depth; d++) {
-@@ -599,12 +579,12 @@
+@@ -599,12 +572,12 @@
      assert(jvmsp->method() == iltp->method(), "tree still in sync");
      ciMethod* d_callee = (d == depth) ? callee : jvms->of_depth(d+1)->method();
      InlineTree* sub = iltp->callee_at(jvmsp->bci(), d_callee);
@@ -17136,56 +17683,45 @@
    return new DynamicCallGenerator(m);
  }
  
-@@ -658,131 +658,122 @@
- // Internal class which handles all out-of-line calls checking receiver type.
- class PredictedDynamicCallGenerator : public CallGenerator {
-   ciMethodHandle* _predicted_method_handle;
+@@ -654,271 +654,95 @@
+ }
+ 
+ 
+-//------------------------PredictedDynamicCallGenerator-----------------------
+-// Internal class which handles all out-of-line calls checking receiver type.
+-class PredictedDynamicCallGenerator : public CallGenerator {
+-  ciMethodHandle* _predicted_method_handle;
 -  CallGenerator*  _if_missed;
 -  CallGenerator*  _if_hit;
-+  CallGenerator*  _hit_cg;
-+  CallGenerator*  _missed_cg;
-   float           _hit_prob;
- 
- public:
-   PredictedDynamicCallGenerator(ciMethodHandle* predicted_method_handle,
+-  float           _hit_prob;
+-
+-public:
+-  PredictedDynamicCallGenerator(ciMethodHandle* predicted_method_handle,
 -                                CallGenerator* if_missed,
 -                                CallGenerator* if_hit,
-+                                CallGenerator*  hit_cg,
-+                                CallGenerator*  missed_cg,
-                                 float hit_prob)
+-                                float hit_prob)
 -    : CallGenerator(if_missed->method()),
-+    : CallGenerator(missed_cg->method()),
-       _predicted_method_handle(predicted_method_handle),
+-      _predicted_method_handle(predicted_method_handle),
 -      _if_missed(if_missed),
 -      _if_hit(if_hit),
-+      _hit_cg(     hit_cg),
-+      _missed_cg(  missed_cg),
-       _hit_prob(hit_prob)
-   {}
- 
+-      _hit_prob(hit_prob)
+-  {}
+-
 -  virtual bool is_inline()   const { return _if_hit->is_inline(); }
 -  virtual bool is_deferred() const { return _if_hit->is_deferred(); }
-+  virtual bool is_inline()   const { return _hit_cg->is_inline() || _missed_cg->is_inline(); }
-+  virtual bool is_deferred() const { return _hit_cg->is_deferred(); }
- 
-   virtual JVMState* generate(JVMState* jvms);
- };
- 
- 
+-
+-  virtual JVMState* generate(JVMState* jvms);
+-};
+-
+-
 -CallGenerator* CallGenerator::for_predicted_dynamic_call(ciMethodHandle* predicted_method_handle,
 -                                                         CallGenerator* if_missed,
 -                                                         CallGenerator* if_hit,
 -                                                         float hit_prob) {
 -  return new PredictedDynamicCallGenerator(predicted_method_handle, if_missed, if_hit, hit_prob);
 -}
-+// CallGenerator* CallGenerator::for_predicted_dynamic_call(ciMethodHandle* predicted_method_handle,
-+//                                                          CallGenerator* if_missed,
-+//                                                          CallGenerator* if_hit,
-+//                                                          float hit_prob) {
-+//   return new PredictedDynamicCallGenerator(predicted_method_handle, if_missed, if_hit, hit_prob);
-+// }
- 
- 
+-
+-
 -CallGenerator* CallGenerator::for_method_handle_call(Node* method_handle, JVMState* jvms,
 -                                                     ciMethod* caller, ciMethod* callee, ciCallProfile profile) {
 -  assert(callee->is_method_handle_invoke() || callee->is_method_handle_adapter(), "for_method_handle_call mismatch");
@@ -17313,10 +17849,14 @@
 +          return cg;
 +      }
      }
--  }
--  return NULL;
--}
 +    break;
++
++  default:
++    fatal(err_msg("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)));
++    break;
+   }
+   return NULL;
+ }
  
 -CallGenerator* CallGenerator::for_invokedynamic_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, ciCallProfile profile) {
 -  assert(callee->is_method_handle_invoke() || callee->is_method_handle_adapter(), "for_invokedynamic_call mismatch");
@@ -17352,137 +17892,145 @@
 -      }
 -      return cg;
 -    }
-+  default:
-+    fatal(err_msg("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)));
-+    break;
-   }
-   return NULL;
- }
-@@ -841,17 +832,20 @@
-     bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) );
-   }
-   IfNode* iff = kit.create_and_xform_if(kit.control(), bol, _hit_prob, COUNT_UNKNOWN);
+-  }
+-  return NULL;
+-}
+-
+-
+-JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) {
+-  GraphKit kit(jvms);
+-  Compile* C = kit.C;
+-  PhaseGVN& gvn = kit.gvn();
+-
+-  CompileLog* log = C->log();
+-  if (log != NULL) {
+-    log->elem("predicted_dynamic_call bci='%d'", jvms->bci());
+-  }
+-
+-  const TypeOopPtr* predicted_mh_ptr = TypeOopPtr::make_from_constant(_predicted_method_handle, true);
+-  Node* predicted_mh = kit.makecon(predicted_mh_ptr);
+-
+-  Node* bol = NULL;
+-  int bc = jvms->method()->java_code_at_bci(jvms->bci());
+-  if (bc != Bytecodes::_invokedynamic) {
+-    // This is the selectAlternative idiom for guardWithTest or
+-    // similar idioms.
+-    Node* receiver = kit.argument(0);
+-
+-    // Check if the MethodHandle is the expected one
+-    Node* cmp = gvn.transform(new (C, 3) CmpPNode(receiver, predicted_mh));
+-    bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) );
+-  } else {
+-    // Get the constant pool cache from the caller class.
+-    ciMethod* caller_method = jvms->method();
+-    ciBytecodeStream str(caller_method);
+-    str.force_bci(jvms->bci());  // Set the stream to the invokedynamic bci.
+-    ciCPCache* cpcache = str.get_cpcache();
+-
+-    // Get the offset of the CallSite from the constant pool cache
+-    // pointer.
+-    int index = str.get_method_index();
+-    size_t call_site_offset = cpcache->get_f1_offset(index);
+-
+-    // Load the CallSite object from the constant pool cache.
+-    const TypeOopPtr* cpcache_type   = TypeOopPtr::make_from_constant(cpcache);  // returns TypeAryPtr of type T_OBJECT
+-    const TypeOopPtr* call_site_type = TypeOopPtr::make_from_klass(C->env()->CallSite_klass());
+-    Node* cpcache_adr   = kit.makecon(cpcache_type);
+-    Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, call_site_offset);
+-    // The oops in the constant pool cache are not compressed; load then as raw pointers.
+-    Node* call_site     = kit.make_load(kit.control(), call_site_adr, call_site_type, T_ADDRESS, Compile::AliasIdxRaw);
+-
+-    // Load the target MethodHandle from the CallSite object.
+-    const TypeOopPtr* target_type = TypeOopPtr::make_from_klass(C->env()->MethodHandle_klass());
+-    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, target_type, T_OBJECT);
+-
+-    // Check if the MethodHandle is still the same.
+-    Node* cmp = gvn.transform(new (C, 3) CmpPNode(target_mh, predicted_mh));
+-    bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) );
+-  }
+-  IfNode* iff = kit.create_and_xform_if(kit.control(), bol, _hit_prob, COUNT_UNKNOWN);
 -  kit.set_control( gvn.transform(new (C, 1) IfTrueNode (iff)));
 -  Node* slow_ctl = gvn.transform(new (C, 1) IfFalseNode(iff));
-+  kit.set_control(   gvn.transform(new (C, 1) IfTrueNode (iff)));
-+  Node* missed_ctl = gvn.transform(new (C, 1) IfFalseNode(iff));
- 
-+#if 1
-+  // Make the missed call:
-   SafePointNode* slow_map = NULL;
-   JVMState* slow_jvms;
-   { PreserveJVMState pjvms(&kit);
+-
+-  SafePointNode* slow_map = NULL;
+-  JVMState* slow_jvms;
+-  { PreserveJVMState pjvms(&kit);
 -    kit.set_control(slow_ctl);
-+    kit.set_control(missed_ctl);
-     if (!kit.stopped()) {
+-    if (!kit.stopped()) {
 -      slow_jvms = _if_missed->generate(kit.sync_jvms());
 -      if (kit.failing())
-+      slow_jvms = _missed_cg->generate(kit.sync_jvms());
-+      if (kit.failing()) {
-         return NULL;  // might happen because of NodeCountInliningCutoff
-+      }
-       assert(slow_jvms != NULL, "must be");
-       kit.add_exception_states_from(slow_jvms);
-       kit.set_map(slow_jvms->map());
-@@ -866,12 +860,12 @@
-     return kit.transfer_exceptions_into_jvms();
-   }
- 
+-        return NULL;  // might happen because of NodeCountInliningCutoff
+-      assert(slow_jvms != NULL, "must be");
+-      kit.add_exception_states_from(slow_jvms);
+-      kit.set_map(slow_jvms->map());
+-      if (!kit.stopped())
+-        slow_map = kit.stop();
+-    }
+-  }
+-
+-  if (kit.stopped()) {
+-    // Instance exactly does not matches the desired type.
+-    kit.set_jvms(slow_jvms);
+-    return kit.transfer_exceptions_into_jvms();
+-  }
+-
 -  // Make the hot call:
 -  JVMState* new_jvms = _if_hit->generate(kit.sync_jvms());
-+  // Make the hit call:
-+  JVMState* new_jvms = _hit_cg->generate(kit.sync_jvms());
-   if (new_jvms == NULL) {
-     // Inline failed, so make a direct call.
+-  if (new_jvms == NULL) {
+-    // Inline failed, so make a direct call.
 -    assert(_if_hit->is_inline(), "must have been a failed inline");
 -    CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method());
-+    assert(_hit_cg->is_inline(), "must have been a failed inline");
-+    CallGenerator* cg = CallGenerator::for_direct_call(_hit_cg->method());
-     new_jvms = cg->generate(kit.sync_jvms());
-   }
-   kit.add_exception_states_from(new_jvms);
-@@ -888,27 +882,75 @@
-     kit.set_jvms(slow_jvms);
-     return kit.transfer_exceptions_into_jvms();
-   }
-+  SafePointNode* missed_map = slow_map;
-+#else
-+  // Make the hit call:
-+  JVMState* new_hit_jvms = _hit_cg->generate(kit.sync_jvms());
-+  if (new_hit_jvms == NULL) {
-+    // Inline failed, so make a direct call.
-+    assert(_hit_cg->is_inline(), "must have been a failed inline");
-+    CallGenerator* cg = CallGenerator::for_direct_call(_hit_cg->method());
-+    new_hit_jvms = cg->generate(kit.sync_jvms());
-+    if (new_hit_jvms == NULL) {
-+      return NULL;
-+    }
-+  }
-+  kit.add_exception_states_from(new_hit_jvms);
-+  kit.set_jvms(new_hit_jvms);
-+
-+  if (kit.stopped()) {
-+    return NULL;
-+  }
-+
-+  // Make the missed call:
-+  SafePointNode* missed_map = NULL;
-+  { PreserveJVMState pjvms(&kit);
-+    kit.set_control(missed_ctl);
-+    JVMState* new_missed_jvms = _missed_cg->generate(kit.sync_jvms());
-+    if (new_missed_jvms == NULL) {
-+      // Inline failed, so make a direct call.
-+      assert(_missed_cg->is_inline(), "must have been a failed inline");
-+      CallGenerator* cg = CallGenerator::for_direct_call(_missed_cg->method());
-+      new_missed_jvms = cg->generate(kit.sync_jvms());
-+      if (new_missed_jvms == NULL) {
-+        return NULL;
-+      }
-+    }
-+    kit.add_exception_states_from(new_missed_jvms);
-+    kit.set_map(new_missed_jvms->map());
-+    if (!kit.stopped()) {
-+      missed_map = kit.stop();
-+    }
-+    if (missed_map == NULL) {
-+      return NULL;
-+    }
-+  }
-+
-+  if (kit.stopped()) {
-+    return NULL;
-+  }
-+#endif
- 
-   // Finish the diamond.
-   kit.C->set_has_split_ifs(true); // Has chance for split-if optimization
-   RegionNode* region = new (C, 3) RegionNode(3);
-   region->init_req(1, kit.control());
+-    new_jvms = cg->generate(kit.sync_jvms());
+-  }
+-  kit.add_exception_states_from(new_jvms);
+-  kit.set_jvms(new_jvms);
+-
+-  // Need to merge slow and fast?
+-  if (slow_map == NULL) {
+-    // The fast path is the only path remaining.
+-    return kit.transfer_exceptions_into_jvms();
+-  }
+-
+-  if (kit.stopped()) {
+-    // Inlined method threw an exception, so it's just the slow path after all.
+-    kit.set_jvms(slow_jvms);
+-    return kit.transfer_exceptions_into_jvms();
+-  }
+-
+-  // Finish the diamond.
+-  kit.C->set_has_split_ifs(true); // Has chance for split-if optimization
+-  RegionNode* region = new (C, 3) RegionNode(3);
+-  region->init_req(1, kit.control());
 -  region->init_req(2, slow_map->control());
-+  region->init_req(2, missed_map->control());
-   kit.set_control(gvn.transform(region));
-   Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO);
+-  kit.set_control(gvn.transform(region));
+-  Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO);
 -  iophi->set_req(2, slow_map->i_o());
-+  iophi->set_req(2, missed_map->i_o());
-   kit.set_i_o(gvn.transform(iophi));
+-  kit.set_i_o(gvn.transform(iophi));
 -  kit.merge_memory(slow_map->merged_memory(), region, 2);
-+  kit.merge_memory(missed_map->merged_memory(), region, 2);
-   uint tos = kit.jvms()->stkoff() + kit.sp();
+-  uint tos = kit.jvms()->stkoff() + kit.sp();
 -  uint limit = slow_map->req();
-+  uint limit = missed_map->req();
-   for (uint i = TypeFunc::Parms; i < limit; i++) {
-     // Skip unused stack slots; fast forward to monoff();
-     if (i == tos) {
-       i = kit.jvms()->monoff();
+-  for (uint i = TypeFunc::Parms; i < limit; i++) {
+-    // Skip unused stack slots; fast forward to monoff();
+-    if (i == tos) {
+-      i = kit.jvms()->monoff();
 -      if( i >= limit ) break;
-+      if (i >= limit)  break;
-     }
-     Node* m = kit.map()->in(i);
+-    }
+-    Node* m = kit.map()->in(i);
 -    Node* n = slow_map->in(i);
-+    Node* n = missed_map->in(i);
-     if (m != n) {
-       const Type* t = gvn.type(m)->meet(gvn.type(n));
-       Node* phi = PhiNode::make(region, m, t);
+-    if (m != n) {
+-      const Type* t = gvn.type(m)->meet(gvn.type(n));
+-      Node* phi = PhiNode::make(region, m, t);
+-      phi->set_req(2, n);
+-      kit.map()->set_req(i, gvn.transform(phi));
+-    }
+-  }
+-  return kit.transfer_exceptions_into_jvms();
+-}
+-
+ 
+ //-------------------------UncommonTrapCallGenerator-----------------------------
+ // Internal class which handles all out-of-line calls checking receiver type.
 diff --git a/src/share/vm/opto/callGenerator.hpp b/src/share/vm/opto/callGenerator.hpp
 --- a/src/share/vm/opto/callGenerator.hpp
 +++ b/src/share/vm/opto/callGenerator.hpp
@@ -17901,17 +18449,71 @@
    }
  
    // Reset parser state from [new_]jvms, which now carries results of the call.
-@@ -492,20 +494,20 @@
+@@ -492,20 +494,74 @@
      }
  
      // Round double result after a call from strict to non-strict code
 -    round_double_result(dest_method);
 +    round_double_result(cg->method());
++
++    ciType* rtype = cg->method()->return_type();
++    if (iter().cur_bc_raw() == Bytecodes::_invokehandle || is_invokedynamic) {
++      // Be careful here with return types.
++      ciType* ctype = iter().get_declared_method_signature()->return_type();
++      if (ctype != rtype) {
++        BasicType rt = rtype->basic_type();
++        BasicType ct = ctype->basic_type();
++        Node* retnode = peek();
++        if (ct == T_VOID) {
++          // It's OK for a method  to return a value that is discarded.
++          // The discarding does not require any special action from the caller.
++          // The Java code knows this, at VerifyType.isNullConversion.
++          pop_node(rt);  // whatever it was, pop it
++          retnode = top();
++        } else if (rt == T_INT || is_subword_type(rt)) {
++          // FIXME: This logic should be factored out.
++          if (ct == T_BOOLEAN) {
++            retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0x1)) );
++          } else if (ct == T_CHAR) {
++            retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFFFF)) );
++          } else if (ct == T_BYTE) {
++            retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(24)) );
++            retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(24)) );
++          } else if (ct == T_SHORT) {
++            retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(16)) );
++            retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(16)) );
++          } else {
++            assert(ct == T_INT, err_msg("rt=%d, ct=%d", rt, ct));
++          }
++        } else if (rt == T_OBJECT) {
++          assert(ct == T_OBJECT, err_msg("rt=T_OBJECT, ct=%d", ct));
++          if (ctype->is_loaded()) {
++            Node* if_fail = top();
++            retnode = gen_checkcast(retnode, makecon(TypeKlassPtr::make(ctype->as_klass())), &if_fail);
++            if (if_fail != top()) {
++              PreserveJVMState pjvms(this);
++              set_control(if_fail);
++              builtin_throw(Deoptimization::Reason_class_check);
++            }
++            pop();
++            push(retnode);
++          }
++        } else {
++          assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
++          // push a zero; it's better than getting an oop/int mismatch
++          retnode = pop_node(rt);
++          retnode = zerocon(ct);
++          push_node(ct, retnode);
++        }
++        // Now that the value is well-behaved, continue with the call-site type.
++        rtype = ctype;
++      }
++    }
  
      // If the return type of the method is not loaded, assert that the
      // value we got is a null.  Otherwise, we need to recompile.
 -    if (!dest_method->return_type()->is_loaded()) {
-+    if (!cg->method()->return_type()->is_loaded()) {
++    if (!rtype->is_loaded()) {
  #ifndef PRODUCT
        if (PrintOpto && (Verbose || WizardMode)) {
          method()->print_name(); tty->print_cr(" asserting nullness of result at bci: %d", bci());
@@ -17922,18 +18524,88 @@
        if (C->log() != NULL) {
          C->log()->elem("assert_null reason='return' klass='%d'",
 -                       C->log()->identify(dest_method->return_type()));
-+                       C->log()->identify(cg->method()->return_type()));
++                       C->log()->identify(rtype));
        }
        // If there is going to be a trap, put it at the next bytecode:
        set_bci(iter().next_bci());
+diff --git a/src/share/vm/opto/escape.cpp b/src/share/vm/opto/escape.cpp
+--- a/src/share/vm/opto/escape.cpp
++++ b/src/share/vm/opto/escape.cpp
+@@ -1768,8 +1768,12 @@
+     assert(ptadr->is_Field() && ptadr->ideal_node() == n, "sanity");
+     return;
+   }
++  bool unsafe = false;
++  bool is_oop = is_oop_field(n, offset, &unsafe);
++  if (unsafe) {
++    es = PointsToNode::GlobalEscape;
++  }
+   Compile* C = _compile;
+-  bool is_oop = is_oop_field(n, offset);
+   FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop);
+   _nodes.at_put(n->_idx, field);
+ }
+@@ -1794,7 +1798,7 @@
+   dst->set_arraycopy_dst();
+ }
+ 
+-bool ConnectionGraph::is_oop_field(Node* n, int offset) {
++bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) {
+   const Type* adr_type = n->as_AddP()->bottom_type();
+   BasicType bt = T_INT;
+   if (offset == Type::OffsetBot) {
+@@ -1813,7 +1817,16 @@
+       if (field != NULL) {
+         bt = field->layout_type();
+       } else {
+-        // Ignore non field load (for example, klass load)
++        // Check for unsafe oop field access
++        for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
++          int opcode = n->fast_out(i)->Opcode();
++          if (opcode == Op_StoreP || opcode == Op_LoadP ||
++              opcode == Op_StoreN || opcode == Op_LoadN) {
++            bt = T_OBJECT;
++            (*unsafe) = true;
++            break;
++          }
++        }
+       }
+     } else if (adr_type->isa_aryptr()) {
+       if (offset == arrayOopDesc::length_offset_in_bytes()) {
+@@ -1831,6 +1844,7 @@
+         if (opcode == Op_StoreP || opcode == Op_LoadP ||
+             opcode == Op_StoreN || opcode == Op_LoadN) {
+           bt = T_OBJECT;
++          break;
+         }
+       }
+     }
+diff --git a/src/share/vm/opto/escape.hpp b/src/share/vm/opto/escape.hpp
+--- a/src/share/vm/opto/escape.hpp
++++ b/src/share/vm/opto/escape.hpp
+@@ -512,13 +512,11 @@
+       assert(ptn != NULL, "node should be registered");
+     }
+     add_edge(ptnode_adr(n->_idx), ptn);
+-  }
+-
++ }
+   // Helper functions
+-  bool   is_oop_field(Node* n, int offset);
+-  static Node* get_addp_base(Node *addp);
+-  static Node* find_second_addp(Node* addp, Node* n);
+-
++  bool   is_oop_field(Node* n, int offset, bool* unsafe);
++ static Node* get_addp_base(Node *addp);
++ static Node* find_second_addp(Node* addp, Node* n);
+   // offset of a field reference
+   int address_offset(Node* adr, PhaseTransform *phase);
+ 
 diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp
 --- a/src/share/vm/opto/graphKit.cpp
 +++ b/src/share/vm/opto/graphKit.cpp
-@@ -963,9 +963,10 @@
-   assert(call->jvms()->debug_start() == non_debug_edges, "");
-   assert(call->jvms()->debug_end()   == call->req(), "");
+@@ -965,7 +965,7 @@
    assert(call->jvms()->debug_depth() == call->req() - non_debug_edges, "");
-+//  tty->print("debug info: "); call->dump();
  }
  
 -bool GraphKit::compute_stack_effects(int& inputs, int& depth) {
@@ -17941,7 +18613,7 @@
    Bytecodes::Code code = java_bc();
    if (code == Bytecodes::_wide) {
      code = method()->java_code_at_bci(bci() + 1);
-@@ -1032,12 +1033,21 @@
+@@ -1032,12 +1032,21 @@
        ciBytecodeStream iter(method());
        iter.reset_to_bci(bci());
        iter.next();
@@ -17966,36 +18638,14 @@
        depth = size - inputs;
      }
      break;
-@@ -1373,6 +1383,29 @@
- }
- 
- 
-+//--------------------------insert_argument------------------------------------
-+void GraphKit::insert_argument(ciMethod* callee, uint idx, Node* c) {
-+  const uint nargs = callee->arg_size();
-+  assert(0 <= idx && idx < nargs, err_msg("oob: idx=%d, nargs=%d", idx, nargs));
-+  assert(nargs <= (uint) jvms()->arg_size(), "must have argument stack space");
-+  for (uint i = (nargs - 1); i > idx; i--) {
-+    Node* arg = argument(i - 1);
-+    set_argument(i, arg);
-+  }
-+  set_argument(idx, c);
-+}
-+
-+//--------------------------remove_argument------------------------------------
-+void GraphKit::remove_argument(ciMethod* callee, uint idx) {
-+  const uint nargs = callee->arg_size();
-+  assert(0 <= idx && idx < nargs, err_msg("oob: idx=%d, nargs=%d", idx, nargs));
-+  for (uint i = idx; i < (nargs - 1); i++) {
-+    Node* arg = argument(i + 1);
-+    set_argument(i, arg);
-+  }
-+  set_argument(nargs - 1, top());
-+}
-+
- 
+@@ -1373,7 +1382,6 @@
+ }
+ 
+ 
+-
  //=============================================================================
  //--------------------------------memory---------------------------------------
+ Node* GraphKit::memory(uint alias_idx) {
 diff --git a/src/share/vm/opto/graphKit.hpp b/src/share/vm/opto/graphKit.hpp
 --- a/src/share/vm/opto/graphKit.hpp
 +++ b/src/share/vm/opto/graphKit.hpp
@@ -18029,16 +18679,6 @@
  
    void push_pair(Node* ldval) {
      push(ldval);
-@@ -429,6 +430,9 @@
-   void set_argument(uint idx, Node* c){ map_not_null(); _map->set_argument(_map->_jvms, idx, c); }
-   void ensure_stack(uint stk_size)    { map_not_null(); _map->ensure_stack(_map->_jvms, stk_size); }
- 
-+  void insert_argument(ciMethod* callee, uint idx, Node *c);
-+  void remove_argument(ciMethod* callee, uint idx);
-+
-   // Access unaliased memory
-   Node* memory(uint alias_idx);
-   Node* memory(const TypePtr *tp) { return memory(C->get_alias_index(tp)); }
 diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp
 --- a/src/share/vm/opto/library_call.cpp
 +++ b/src/share/vm/opto/library_call.cpp
@@ -21516,7 +22156,7 @@
        return java_lang_String::as_symbol(type_str, CHECK_NULL);
      } else {
        return java_lang_String::as_symbol_or_null(type_str);
-@@ -560,121 +391,238 @@
+@@ -560,121 +391,303 @@
    }
  }
  
@@ -21597,10 +22237,75 @@
 +  return bsig;
 +}
 +
-+oop MethodHandles::method_type_basic_type(oop method_type) {
-+  oop form = java_lang_invoke_MethodType::form(method_type);
-+  return java_lang_invoke_MethodTypeForm::basicType(form);
-+}
++void MethodHandles::print_as_basic_type_signature_on(outputStream* st,
++                                                     Symbol* sig,
++                                                     bool keep_arrays,
++                                                     bool keep_basic_names) {
++  st = st ? st : tty;
++  int len  = sig->utf8_length();
++  int array = 0;
++  bool prev_type = false;
++  for (int i = 0; i < len; i++) {
++    char ch = sig->byte_at(i);
++    switch (ch) {
++    case '(': case ')':
++      prev_type = false;
++      st->put(ch);
++      continue;
++    case '[':
++      if (!keep_basic_names && keep_arrays)
++        st->put(ch);
++      array++;
++      continue;
++    case 'L':
++      {
++        if (prev_type)  st->put(',');
++        int start = i+1, slash = start;
++        while (++i < len && (ch = sig->byte_at(i)) != ';') {
++          if (ch == '/' || ch == '.' || ch == '$')  slash = i+1;
++        }
++        if (slash < i)  start = slash;
++        if (!keep_basic_names) {
++          st->put('L');
++        } else {
++          for (int j = start; j < i; j++)
++            st->put(sig->byte_at(j));
++          prev_type = true;
++        }
++        break;
++      }
++    default:
++      {
++        if (array && char2type(ch) != T_ILLEGAL && !keep_arrays) {
++          ch = '[';
++          array = 0;
++        }
++        if (prev_type)  st->put(',');
++        const char* n = NULL;
++        if (keep_basic_names)
++          n = type2name(char2type(ch));
++        if (n == NULL) {
++          // unknown letter, or we don't want to know its name
++          st->put(ch);
++        } else {
++          st->print(n);
++          prev_type = true;
++        }
++        break;
++      }
++    }
++    // Switch break goes here to take care of array suffix:
++    if (prev_type) {
++      while (array > 0) {
++        st->print("[]");
++        --array;
++      }
++    }
++    array = 0;
++  }
++}
++
++
 +
 +static oop object_java_mirror() {
 +  return Klass::cast(SystemDictionary::Object_klass())->java_mirror();
@@ -21817,7 +22522,7 @@
          if (name == vmSymbols::object_initializer_name()) {
            LinkResolver::resolve_special_call(result,
                          defc, name, type, KlassHandle(), false, THREAD);
-@@ -682,22 +630,11 @@
+@@ -682,22 +695,11 @@
            break;                // will throw after end of switch
          }
          if (HAS_PENDING_EXCEPTION) {
@@ -21842,7 +22547,7 @@
      }
    case IS_FIELD:
      {
-@@ -705,54 +642,20 @@
+@@ -705,54 +707,20 @@
        fieldDescriptor fd; // find_field initializes fd if found
        KlassHandle sel_klass(THREAD, instanceKlass::cast(defc())->find_field(name, type, &fd));
        // check if field exists; i.e., if a klass containing the field def has been selected
@@ -21907,7 +22612,7 @@
  }
  
  // Conversely, a member name which is only initialized from JVM internals
-@@ -763,7 +666,7 @@
+@@ -763,7 +731,7 @@
    assert(java_lang_invoke_MemberName::is_instance(mname()), "");
    oop vmtarget = java_lang_invoke_MemberName::vmtarget(mname());
    int vmindex  = java_lang_invoke_MemberName::vmindex(mname());
@@ -21916,7 +22621,7 @@
      THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "nothing to expand");
    }
  
-@@ -784,14 +687,12 @@
+@@ -784,14 +752,12 @@
    case IS_METHOD:
    case IS_CONSTRUCTOR:
      {
@@ -21934,7 +22639,7 @@
          java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror());
        }
        if (!have_name) {
-@@ -808,9 +709,10 @@
+@@ -808,9 +774,10 @@
    case IS_FIELD:
      {
        // This is taken from LinkResolver::resolve_field, sans access checks.
@@ -21946,7 +22651,7 @@
        bool is_static = ((flags & JVM_ACC_STATIC) != 0);
        fieldDescriptor fd; // find_field initializes fd if found
        if (!defc->find_field_from_offset(vmindex, is_static, &fd))
-@@ -824,7 +726,11 @@
+@@ -824,7 +791,11 @@
          java_lang_invoke_MemberName::set_name(mname(), name());
        }
        if (!have_type) {
@@ -21959,7 +22664,7 @@
          java_lang_invoke_MemberName::set_type(mname(), type());
        }
        return;
-@@ -882,7 +788,13 @@
+@@ -882,7 +853,13 @@
          oop result = results->obj_at(rfill++);
          if (!java_lang_invoke_MemberName::is_instance(result))
            return -99;  // caller bug!
@@ -21974,7 +22679,7 @@
        } else if (++overflow >= overflow_limit) {
          match_flags = 0; break; // got tired of looking at overflow
        }
-@@ -930,7 +842,9 @@
+@@ -930,7 +907,9 @@
          oop result = results->obj_at(rfill++);
          if (!java_lang_invoke_MemberName::is_instance(result))
            return -99;  // caller bug!
@@ -21985,7 +22690,7 @@
        } else if (++overflow >= overflow_limit) {
          match_flags = 0; break; // got tired of looking at overflow
        }
-@@ -941,1925 +855,16 @@
+@@ -941,1925 +920,16 @@
    return rfill + overflow;
  }
  
@@ -23912,7 +24617,7 @@
    case MethodHandles::GC_COUNT_GWT:
  #ifdef COMPILER2
      return true;
-@@ -2872,64 +877,54 @@
+@@ -2872,64 +942,54 @@
  JVM_END
  
  #ifndef PRODUCT
@@ -24006,7 +24711,7 @@
      int con = con_values[which];
      objArrayHandle box(THREAD, (objArrayOop) JNIHandles::resolve(box_jh));
      if (box.not_null() && box->klass() == Universe::objectArrayKlassObj() && box->length() > 0) {
-@@ -2965,13 +960,14 @@
+@@ -2965,13 +1025,14 @@
  JVM_END
  
  // void resolve(MemberName self, Class<?> caller)
@@ -24024,7 +24729,7 @@
      klassOop reference_klass = java_lang_Class::as_klassOop(java_lang_invoke_MemberName::clazz(mname()));
      if (reference_klass != NULL) {
        // Emulate LinkResolver::check_klass_accessability.
-@@ -2979,15 +975,97 @@
+@@ -2979,15 +1040,97 @@
        if (!Reflection::verify_class_access(caller,
                                             reference_klass,
                                             true)) {
@@ -24124,7 +24829,7 @@
  //  static native int getMembers(Class<?> defc, String matchName, String matchSig,
  //          int matchFlags, Class<?> caller, int skip, MemberName[] results);
  JVM_ENTRY(jint, MHN_getMembers(JNIEnv *env, jobject igcls,
-@@ -3053,45 +1131,6 @@
+@@ -3053,45 +1196,6 @@
  }
  JVM_END
  
@@ -24170,7 +24875,7 @@
  JVM_ENTRY(jobject, MH_invoke_UOE(JNIEnv *env, jobject igmh, jobjectArray igargs)) {
      TempNewSymbol UOE_name = SymbolTable::new_symbol("java/lang/UnsupportedOperationException", CHECK_NULL);
      THROW_MSG_NULL(UOE_name, "MethodHandle.invoke cannot be invoked reflectively");
-@@ -3121,39 +1160,30 @@
+@@ -3121,39 +1225,30 @@
  #define MT    JLINV"MethodType;"
  #define MH    JLINV"MethodHandle;"
  #define MEM   JLINV"MemberName;"
@@ -24218,7 +24923,7 @@
    {CC"invoke",                    CC"(["OBJ")"OBJ,                       FN_PTR(MH_invoke_UOE)},
    {CC"invokeExact",               CC"(["OBJ")"OBJ,                       FN_PTR(MH_invokeExact_UOE)}
  };
-@@ -3161,8 +1191,6 @@
+@@ -3161,8 +1256,6 @@
  // This one function is exported, used by NativeLookup.
  
  JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
@@ -24227,7 +24932,7 @@
    if (!EnableInvokeDynamic) {
      warning("JSR 292 is disabled in this JVM.  Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
      return;  // bind nothing
-@@ -3171,34 +1199,32 @@
+@@ -3171,34 +1264,32 @@
    assert(!MethodHandles::enabled(), "must not be enabled");
    bool enable_MH = true;
  
@@ -24816,7 +25521,7 @@
    static int find_MemberNames(klassOop k, Symbol* name, Symbol* sig,
                                int mflags, klassOop caller,
                                int skip, objArrayOop results);
-@@ -559,169 +72,109 @@
+@@ -559,169 +72,113 @@
    // Generate MethodHandles adapters.
    static void generate_adapters();
  
@@ -24929,9 +25634,13 @@
 +  }
 +  static bool is_basic_type_signature(Symbol* sig);
 +
-+  static oop method_type_basic_type(oop method_type);
 +  static Symbol* lookup_method_type(Symbol* msig, Handle mtype, TRAPS);
 +
++  static void print_as_method_type_on(outputStream* st, Symbol* sig) {
++    print_as_basic_type_signature_on(st, sig, true, true);
++  }
++  static void print_as_basic_type_signature_on(outputStream* st, Symbol* sig, bool keep_arrays = false, bool keep_basic_names = false);
++
 +  // decoding CONSTANT_MethodHandle constants
 +  enum { JVM_REF_MIN = JVM_REF_getField, JVM_REF_MAX = JVM_REF_invokeInterface };
 +  static bool ref_kind_is_valid(int ref_kind) {
@@ -25079,7 +25788,7 @@
  
  #ifdef TARGET_ARCH_x86
  # include "methodHandles_x86.hpp"
-@@ -738,63 +191,11 @@
+@@ -738,63 +195,11 @@
  #ifdef TARGET_ARCH_ppc
  # include "methodHandles_ppc.hpp"
  #endif
@@ -25254,6 +25963,25 @@
    void print_on(outputStream* st) const         PRODUCT_RETURN;
    void print_on_for(outputStream* st, oop obj)  PRODUCT_RETURN;
  };
+diff --git a/src/share/vm/runtime/fprofiler.cpp b/src/share/vm/runtime/fprofiler.cpp
+--- a/src/share/vm/runtime/fprofiler.cpp
++++ b/src/share/vm/runtime/fprofiler.cpp
+@@ -337,11 +337,13 @@
+       char c = (char) n->byte_at(i);
+       st->print("%c", c);
+     }
+-    if( Verbose ) {
++    if (Verbose || WizardMode) {
+       // Disambiguate overloaded methods
+       Symbol* sig = m->signature();
+       sig->print_symbol_on(st);
+-    }
++    } else if (MethodHandles::is_signature_polymorphic(m->intrinsic_id()))
++      // compare with methodOopDesc::print_short_name
++      MethodHandles::print_as_basic_type_signature_on(st, m->signature(), true);
+   }
+ 
+   virtual void print(outputStream* st, int total_ticks) {
 diff --git a/src/share/vm/runtime/frame.cpp b/src/share/vm/runtime/frame.cpp
 --- a/src/share/vm/runtime/frame.cpp
 +++ b/src/share/vm/runtime/frame.cpp
@@ -26320,15 +27048,6 @@
    declare_c2_type(ExceptionBlob,         SingletonBlob)                   \
    declare_c2_type(UncommonTrapBlob,      CodeBlob)                        \
                                                                            \
-@@ -2243,7 +2231,7 @@
-   declare_constant(JVM_ACC_MONITOR_MATCH)                                 \
-   declare_constant(JVM_ACC_HAS_MONITOR_BYTECODES)                         \
-   declare_constant(JVM_ACC_HAS_LOOPS)                                     \
--  declare_constant(JVM_ACC_LOOPS_FLAG_INIT)                               \
-+  declare_constant(JVM_ACC_UNUSED)                                        \
-   declare_constant(JVM_ACC_QUEUED)                                        \
-   declare_constant(JVM_ACC_NOT_OSR_COMPILABLE)                            \
-   declare_constant(JVM_ACC_HAS_LINE_NUMBER_TABLE)                         \
 @@ -2347,7 +2335,7 @@
    declare_constant(instanceKlass::initialization_error)                   \
                                                                            \
@@ -26385,15 +27104,6 @@
 diff --git a/src/share/vm/utilities/accessFlags.hpp b/src/share/vm/utilities/accessFlags.hpp
 --- a/src/share/vm/utilities/accessFlags.hpp
 +++ b/src/share/vm/utilities/accessFlags.hpp
-@@ -43,7 +43,7 @@
-   JVM_ACC_MONITOR_MATCH           = 0x10000000,     // True if we know that monitorenter/monitorexit bytecodes match
-   JVM_ACC_HAS_MONITOR_BYTECODES   = 0x20000000,     // Method contains monitorenter/monitorexit bytecodes
-   JVM_ACC_HAS_LOOPS               = 0x40000000,     // Method has loops
--  JVM_ACC_LOOPS_FLAG_INIT         = (int)0x80000000,// The loop flag has been initialized
-+  JVM_ACC_UNUSED                  = (int)0x80000000,// currently unused
-   JVM_ACC_QUEUED                  = 0x01000000,     // Queued for compilation
-   JVM_ACC_NOT_C2_COMPILABLE       = 0x02000000,
-   JVM_ACC_NOT_C1_COMPILABLE       = 0x04000000,
 @@ -55,9 +55,6 @@
    JVM_ACC_IS_OBSOLETE             = 0x00020000,     // RedefineClasses() has made method obsolete
    JVM_ACC_IS_PREFIXED_NATIVE      = 0x00040000,     // JVMTI has prefixed this native method
@@ -26404,15 +27114,7 @@
    // klassOop flags
    JVM_ACC_HAS_MIRANDA_METHODS     = 0x10000000,     // True if this class has miranda methods in it's vtable
    JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000,     // True if klass has a vanilla default constructor
-@@ -121,7 +118,6 @@
-   bool is_monitor_matching     () const { return (_flags & JVM_ACC_MONITOR_MATCH          ) != 0; }
-   bool has_monitor_bytecodes   () const { return (_flags & JVM_ACC_HAS_MONITOR_BYTECODES  ) != 0; }
-   bool has_loops               () const { return (_flags & JVM_ACC_HAS_LOOPS              ) != 0; }
--  bool loops_flag_init         () const { return (_flags & JVM_ACC_LOOPS_FLAG_INIT        ) != 0; }
-   bool queued_for_compilation  () const { return (_flags & JVM_ACC_QUEUED                 ) != 0; }
-   bool is_not_c1_compilable () const    { return (_flags & JVM_ACC_NOT_C1_COMPILABLE      ) != 0; }
-   bool is_not_c2_compilable () const    { return (_flags & JVM_ACC_NOT_C2_COMPILABLE      ) != 0; }
-@@ -133,15 +129,6 @@
+@@ -133,15 +130,6 @@
    bool is_obsolete             () const { return (_flags & JVM_ACC_IS_OBSOLETE            ) != 0; }
    bool is_prefixed_native      () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE     ) != 0; }
  
@@ -26428,14 +27130,6 @@
    // klassOop flags
    bool has_miranda_methods     () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS    ) != 0; }
    bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
-@@ -193,7 +180,6 @@
-   void set_monitor_matching()          { atomic_set_bits(JVM_ACC_MONITOR_MATCH);           }
-   void set_has_monitor_bytecodes()     { atomic_set_bits(JVM_ACC_HAS_MONITOR_BYTECODES);   }
-   void set_has_loops()                 { atomic_set_bits(JVM_ACC_HAS_LOOPS);               }
--  void set_loops_flag_init()           { atomic_set_bits(JVM_ACC_LOOPS_FLAG_INIT);         }
-   void set_not_c1_compilable()         { atomic_set_bits(JVM_ACC_NOT_C1_COMPILABLE);       }
-   void set_not_c2_compilable()         { atomic_set_bits(JVM_ACC_NOT_C2_COMPILABLE);       }
-   void set_not_osr_compilable()        { atomic_set_bits(JVM_ACC_NOT_OSR_COMPILABLE);      }
 diff --git a/src/share/vm/utilities/exceptions.hpp b/src/share/vm/utilities/exceptions.hpp
 --- a/src/share/vm/utilities/exceptions.hpp
 +++ b/src/share/vm/utilities/exceptions.hpp
--- a/meth-lazy-7023639.review.patch	Mon Jul 23 10:12:57 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2179 +0,0 @@
-# HG changeset patch
-# Parent fe6edd334f2d863f8b842505ef37ea0b4c608f68
-
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
---- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
-+++ b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
-@@ -93,7 +93,6 @@
-   public boolean isUncommonTrapStub()   { return false; }
-   public boolean isExceptionStub()      { return false; }
-   public boolean isSafepointStub()      { return false; }
--  public boolean isRicochetBlob()       { return false; }
-   public boolean isAdapterBlob()        { return false; }
- 
-   // Fine grain nmethod support: isNmethod() == isJavaMethod() || isNativeMethod() || isOSRMethod()
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java b/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java
---- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java
-+++ b/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java
-@@ -57,7 +57,6 @@
-     virtualConstructor.addMapping("BufferBlob", BufferBlob.class);
-     virtualConstructor.addMapping("nmethod", NMethod.class);
-     virtualConstructor.addMapping("RuntimeStub", RuntimeStub.class);
--    virtualConstructor.addMapping("RicochetBlob", RicochetBlob.class);
-     virtualConstructor.addMapping("AdapterBlob", AdapterBlob.class);
-     virtualConstructor.addMapping("MethodHandlesAdapterBlob", MethodHandlesAdapterBlob.class);
-     virtualConstructor.addMapping("SafepointBlob", SafepointBlob.class);
-@@ -127,10 +126,6 @@
-       Assert.that(result.blobContains(start) || result.blobContains(start.addOffsetTo(8)),
-                                                                     "found wrong CodeBlob");
-     }
--    if (result.isRicochetBlob()) {
--      // This should probably be done for other SingletonBlobs
--      return VM.getVM().ricochetBlob();
--    }
-     return result;
-   }
- 
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/RicochetBlob.java b/agent/src/share/classes/sun/jvm/hotspot/code/RicochetBlob.java
-deleted file mode 100644
---- a/agent/src/share/classes/sun/jvm/hotspot/code/RicochetBlob.java
-+++ /dev/null
-@@ -1,70 +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.
-- *
-- * 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.jvm.hotspot.code;
--
--import java.util.*;
--import sun.jvm.hotspot.debugger.*;
--import sun.jvm.hotspot.runtime.*;
--import sun.jvm.hotspot.types.*;
--
--/** RicochetBlob (currently only used by Compiler 2) */
--
--public class RicochetBlob extends SingletonBlob {
--  static {
--    VM.registerVMInitializedObserver(new Observer() {
--        public void update(Observable o, Object data) {
--          initialize(VM.getVM().getTypeDataBase());
--        }
--      });
--  }
--
--  private static void initialize(TypeDataBase db) {
--    Type type = db.lookupType("RicochetBlob");
--
--    bounceOffsetField                = type.getCIntegerField("_bounce_offset");
--    exceptionOffsetField             = type.getCIntegerField("_exception_offset");
--  }
--
--  private static CIntegerField bounceOffsetField;
--  private static CIntegerField exceptionOffsetField;
--
--  public RicochetBlob(Address addr) {
--    super(addr);
--  }
--
--  public boolean isRicochetBlob() {
--    return true;
--  }
--
--  public Address bounceAddr() {
--    return codeBegin().addOffsetTo(bounceOffsetField.getValue(addr));
--  }
--
--  public boolean returnsToBounceAddr(Address pc) {
--    Address bouncePc = bounceAddr();
--    return (pc.equals(bouncePc) || pc.addOffsetTo(Frame.pcReturnOffset()).equals(bouncePc));
--  }
--
--}
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java
---- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java
-+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Frame.java
-@@ -147,12 +147,6 @@
-     }
-   }
- 
--  public boolean isRicochetFrame() {
--    CodeBlob cb = VM.getVM().getCodeCache().findBlob(getPC());
--    RicochetBlob rcb = VM.getVM().ricochetBlob();
--    return (cb == rcb && rcb != null && rcb.returnsToBounceAddr(getPC()));
--  }
--
-   public boolean isCompiledFrame() {
-     if (Assert.ASSERTS_ENABLED) {
-       Assert.that(!VM.getVM().isCore(), "noncore builds only");
-@@ -216,8 +210,7 @@
-   public Frame realSender(RegisterMap map) {
-     if (!VM.getVM().isCore()) {
-       Frame result = sender(map);
--      while (result.isRuntimeFrame() ||
--             result.isRicochetFrame()) {
-+      while (result.isRuntimeFrame()) {
-         result = result.sender(map);
-       }
-       return result;
-@@ -631,9 +624,6 @@
-     if (Assert.ASSERTS_ENABLED) {
-       Assert.that(cb != null, "sanity check");
-     }
--    if (cb == VM.getVM().ricochetBlob()) {
--      oopsRicochetDo(oopVisitor, regMap);
--    }
-     if (cb.getOopMaps() != null) {
-       OopMapSet.oopsDo(this, cb, regMap, oopVisitor, VM.getVM().isDebugging());
- 
-@@ -650,10 +640,6 @@
-     //    }
-   }
- 
--  private void oopsRicochetDo      (AddressVisitor oopVisitor, RegisterMap regMap) {
--    // XXX Empty for now
--  }
--
-   // FIXME: implement the above routines, plus add
-   // oops_interpreted_arguments_do and oops_compiled_arguments_do
- }
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
---- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
-+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
-@@ -87,8 +87,6 @@
-   private StubRoutines stubRoutines;
-   private Bytes        bytes;
- 
--  private RicochetBlob ricochetBlob;
--
-   /** Flags indicating whether we are attached to a core, C1, or C2 build */
-   private boolean      usingClientCompiler;
-   private boolean      usingServerCompiler;
-@@ -628,18 +626,6 @@
-     return stubRoutines;
-   }
- 
--  public RicochetBlob ricochetBlob() {
--    if (ricochetBlob == null) {
--      Type ricochetType  = db.lookupType("SharedRuntime");
--      AddressField ricochetBlobAddress = ricochetType.getAddressField("_ricochet_blob");
--      Address addr = ricochetBlobAddress.getValue();
--      if (addr != null) {
--        ricochetBlob = new RicochetBlob(addr);
--      }
--    }
--    return ricochetBlob;
--  }
--
-   public VMRegImpl getVMRegImplInfo() {
-     if (vmregImpl == null) {
-       vmregImpl = new VMRegImpl();
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java
---- a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java
-+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java
-@@ -571,8 +571,6 @@
-     //        registers callee-saved, then we will have to copy over
-     //        the RegisterMap update logic from the Intel code.
- 
--    if (isRicochetFrame()) return senderForRicochetFrame(map);
--
-     // The constructor of the sender must know whether this frame is interpreted so it can set the
-     // sender's _interpreter_sp_adjustment field.
-     if (VM.getVM().getInterpreter().contains(pc)) {
-@@ -945,20 +943,6 @@
-   }
- 
- 
--  private Frame senderForRicochetFrame(SPARCRegisterMap map) {
--    if (DEBUG) {
--      System.out.println("senderForRicochetFrame");
--    }
--    //RicochetFrame* f = RicochetFrame::from_frame(fr);
--    // Cf. is_interpreted_frame path of frame::sender
--    Address youngerSP = getSP();
--    Address sp        = getSenderSP();
--    map.makeIntegerRegsUnsaved();
--    map.shiftWindow(sp, youngerSP);
--    boolean thisFrameAdjustedStack = true;  // I5_savedSP is live in this RF
--    return new SPARCFrame(biasSP(sp), biasSP(youngerSP), thisFrameAdjustedStack);
--  }
--
-   private Frame senderForEntryFrame(RegisterMap regMap) {
-     SPARCRegisterMap map = (SPARCRegisterMap) regMap;
- 
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCRicochetFrame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCRicochetFrame.java
-deleted file mode 100644
---- a/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCRicochetFrame.java
-+++ /dev/null
-@@ -1,77 +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.
-- *
-- * 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.jvm.hotspot.runtime.sparc;
--
--import java.util.*;
--import sun.jvm.hotspot.asm.sparc.SPARCRegister;
--import sun.jvm.hotspot.asm.sparc.SPARCRegisters;
--import sun.jvm.hotspot.debugger.*;
--import sun.jvm.hotspot.runtime.*;
--import sun.jvm.hotspot.types.*;
--
--public class SPARCRicochetFrame {
--  static {
--    VM.registerVMInitializedObserver(new Observer() {
--        public void update(Observable o, Object data) {
--          initialize(VM.getVM().getTypeDataBase());
--        }
--      });
--  }
--
--  private SPARCFrame frame;
--
--  private static void initialize(TypeDataBase db) {
--    // Type type = db.lookupType("MethodHandles::RicochetFrame");
--
--  }
--
--  static SPARCRicochetFrame fromFrame(SPARCFrame f) {
--    return new SPARCRicochetFrame(f);
--  }
--
--  private SPARCRicochetFrame(SPARCFrame f) {
--    frame = f;
--  }
--
--  private Address registerValue(SPARCRegister reg) {
--    return frame.getSP().addOffsetTo(reg.spOffsetInSavedWindow()).getAddressAt(0);
--  }
--
--  public Address savedArgsBase() {
--    return registerValue(SPARCRegisters.L4);
--  }
--  public Address exactSenderSP() {
--    return registerValue(SPARCRegisters.I5);
--  }
--  public Address senderLink() {
--    return frame.getSenderSP();
--  }
--  public Address senderPC() {
--    return frame.getSenderPC();
--  }
--  public Address extendedSenderSP() {
--    return savedArgsBase();
--  }
--}
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
---- a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
-+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
-@@ -269,7 +269,6 @@
- 
-     if (isEntryFrame())       return senderForEntryFrame(map);
-     if (isInterpretedFrame()) return senderForInterpreterFrame(map);
--    if (isRicochetFrame())    return senderForRicochetFrame(map);
- 
-     if(cb == null) {
-       cb = VM.getVM().getCodeCache().findBlob(getPC());
-@@ -288,16 +287,6 @@
-     return new X86Frame(getSenderSP(), getLink(), getSenderPC());
-   }
- 
--  private Frame senderForRicochetFrame(X86RegisterMap map) {
--    if (DEBUG) {
--      System.out.println("senderForRicochetFrame");
--    }
--    X86RicochetFrame f = X86RicochetFrame.fromFrame(this);
--    if (map.getUpdateMap())
--      updateMapWithSavedLink(map, f.senderLinkAddress());
--    return new X86Frame(f.extendedSenderSP(), f.exactSenderSP(), f.senderLink(), f.senderPC());
--  }
--
-   private Frame senderForEntryFrame(X86RegisterMap map) {
-     if (DEBUG) {
-       System.out.println("senderForEntryFrame");
-diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RicochetFrame.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RicochetFrame.java
-deleted file mode 100644
---- a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RicochetFrame.java
-+++ /dev/null
-@@ -1,81 +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.
-- *
-- * 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.jvm.hotspot.runtime.x86;
--
--import java.util.*;
--import sun.jvm.hotspot.debugger.*;
--import sun.jvm.hotspot.runtime.*;
--import sun.jvm.hotspot.types.*;
--
--public class X86RicochetFrame extends VMObject {
--  static {
--    VM.registerVMInitializedObserver(new Observer() {
--        public void update(Observable o, Object data) {
--          initialize(VM.getVM().getTypeDataBase());
--        }
--      });
--  }
--
--  private static void initialize(TypeDataBase db) {
--    Type type = db.lookupType("MethodHandles::RicochetFrame");
--
--    senderLinkField    = type.getAddressField("_sender_link");
--    savedArgsBaseField = type.getAddressField("_saved_args_base");
--    exactSenderSPField = type.getAddressField("_exact_sender_sp");
--    senderPCField      = type.getAddressField("_sender_pc");
--  }
--
--  private static AddressField senderLinkField;
--  private static AddressField savedArgsBaseField;
--  private static AddressField exactSenderSPField;
--  private static AddressField senderPCField;
--
--  static X86RicochetFrame fromFrame(X86Frame f) {
--    return new X86RicochetFrame(f.getFP().addOffsetTo(- senderLinkField.getOffset()));
--  }
--
--  private X86RicochetFrame(Address addr) {
--    super(addr);
--  }
--
--  public Address senderLink() {
--    return senderLinkField.getValue(addr);
--  }
--  public Address senderLinkAddress() {
--    return addr.addOffsetTo(senderLinkField.getOffset());
--  }
--  public Address savedArgsBase() {
--    return savedArgsBaseField.getValue(addr);
--  }
--  public Address extendedSenderSP() {
--    return savedArgsBase();
--  }
--  public Address exactSenderSP() {
--    return exactSenderSPField.getValue(addr);
--  }
--  public Address senderPC() {
--    return senderPCField.getValue(addr);
--  }
--}
-diff --git a/make/solaris/makefiles/fastdebug.make b/make/solaris/makefiles/fastdebug.make
---- a/make/solaris/makefiles/fastdebug.make
-+++ b/make/solaris/makefiles/fastdebug.make
-@@ -36,6 +36,11 @@
- ifeq ("${Platform_compiler}", "sparcWorks")
- OPT_CFLAGS/SLOWER = -xO2
- 
-+ifeq ($(COMPILER_REV_NUMERIC), 510)
-+# CC 5.10 has bug XXXXX with -xO4
-+OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/SLOWER)
-+endif # COMPILER_REV_NUMERIC == 510
-+
- ifeq ($(COMPILER_REV_NUMERIC), 509)
- # To avoid jvm98 crash
- OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER)
-diff --git a/make/solaris/makefiles/optimized.make b/make/solaris/makefiles/optimized.make
---- a/make/solaris/makefiles/optimized.make
-+++ b/make/solaris/makefiles/optimized.make
-@@ -32,6 +32,11 @@
- # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
- ifeq ("${Platform_compiler}", "sparcWorks")
- 
-+ifeq ($(COMPILER_REV_NUMERIC), 510)
-+# CC 5.10 has bug XXXXX with -xO4
-+OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2)
-+endif # COMPILER_REV_NUMERIC == 510
-+
- ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
- # dtrace cannot handle tail call optimization (6672627, 6693876)
- OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
-diff --git a/make/solaris/makefiles/product.make b/make/solaris/makefiles/product.make
---- a/make/solaris/makefiles/product.make
-+++ b/make/solaris/makefiles/product.make
-@@ -40,6 +40,11 @@
- # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
- ifeq ("${Platform_compiler}", "sparcWorks")
- 
-+ifeq ($(COMPILER_REV_NUMERIC), 510)
-+# CC 5.10 has bug XXXXX with -xO4
-+OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2)
-+endif # COMPILER_REV_NUMERIC == 510
-+
- ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
- # dtrace cannot handle tail call optimization (6672627, 6693876)
- OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
-diff --git a/src/cpu/sparc/vm/interpreter_sparc.cpp b/src/cpu/sparc/vm/interpreter_sparc.cpp
---- a/src/cpu/sparc/vm/interpreter_sparc.cpp
-+++ b/src/cpu/sparc/vm/interpreter_sparc.cpp
-@@ -397,7 +397,7 @@
-     case Interpreter::java_lang_ref_reference_get
-                                              : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
-     default:
--      ShouldNotReachHere();
-+      fatal(err_msg("unexpected method kind: %d", kind));
-       break;
-   }
- 
-diff --git a/src/cpu/sparc/vm/methodHandles_sparc.cpp b/src/cpu/sparc/vm/methodHandles_sparc.cpp
---- a/src/cpu/sparc/vm/methodHandles_sparc.cpp
-+++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp
-@@ -106,7 +106,7 @@
-   __ srl( temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT, temp);
-   __ and3(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK,  temp);
-   __ cmp_and_br_short(temp, ref_kind, Assembler::equal, Assembler::pt, L);
--  { char* buf = NEW_C_HEAP_ARRAY(char, 100);
-+  { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
-     jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
-     if (ref_kind == JVM_REF_invokeVirtual ||
-         ref_kind == JVM_REF_invokeSpecial)
-@@ -133,9 +133,7 @@
-     __ verify_thread();
-     const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
-     __ ld(interp_only, temp);
--    __ tst(temp);
--    __ br(Assembler::zero, true, Assembler::pt, run_compiled_code);
--    __ delayed()->nop();
-+    __ cmp_and_br_short(temp, 0, Assembler::zero, Assembler::pt, run_compiled_code);
-     __ ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target);
-     __ jmp(target, 0);
-     __ delayed()->nop();
-@@ -259,7 +257,8 @@
-   if (TraceMethodHandles) {
-     const char* name = vmIntrinsics::name_at(iid);
-     if (*name == '_')  name += 1;
--    char* qname = NEW_C_HEAP_ARRAY(char, 100);
-+    const size_t len = strlen(name) + 50;
-+    char* qname = NEW_C_HEAP_ARRAY(char, len, mtInternal);
-     const char* suffix = "";
-     if (vmIntrinsics::method_for(iid) == NULL ||
-         !vmIntrinsics::method_for(iid)->access_flags().is_public()) {
-@@ -268,7 +267,7 @@
-       else
-         suffix = "/private";
-     }
--    jio_snprintf(qname, 100, "MethodHandle::interpreter_entry::%s%s", name, suffix);
-+    jio_snprintf(qname, len, "MethodHandle::interpreter_entry::%s%s", name, suffix);
-     if (O0_mh != noreg)
-       __ mov(O0_mh, G3_method_handle);  // make stub happy
-     trace_method_handle(_masm, qname);
-diff --git a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
---- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
-+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
-@@ -400,13 +400,13 @@
-     case T_LONG:                // LP64, longs compete with int args
-       assert(sig_bt[i+1] == T_VOID, "");
- #ifdef _LP64
--      if (int_reg_cnt < int_reg_max) int_reg_cnt++;
-+      if (int_reg_cnt < int_reg_max)  int_reg_cnt++;
- #endif
-       break;
-     case T_OBJECT:
-     case T_ARRAY:
-     case T_ADDRESS: // Used, e.g., in slow-path locking for the lock's stack address
--      if (int_reg_cnt < int_reg_max) int_reg_cnt++;
-+      if (int_reg_cnt < int_reg_max)  int_reg_cnt++;
- #ifndef _LP64
-       else                            stk_reg_pairs++;
- #endif
-@@ -416,11 +416,11 @@
-     case T_CHAR:
-     case T_BYTE:
-     case T_BOOLEAN:
--      if (int_reg_cnt < int_reg_max) int_reg_cnt++;
-+      if (int_reg_cnt < int_reg_max)  int_reg_cnt++;
-       else                            stk_reg_pairs++;
-       break;
-     case T_FLOAT:
--      if (flt_reg_cnt < flt_reg_max) flt_reg_cnt++;
-+      if (flt_reg_cnt < flt_reg_max)  flt_reg_cnt++;
-       else                            stk_reg_pairs++;
-       break;
-     case T_DOUBLE:
-@@ -436,7 +436,6 @@
-   // This is where the longs/doubles start on the stack.
-   stk_reg_pairs = (stk_reg_pairs+1) & ~1; // Round
- 
--  int int_reg_pairs = (int_reg_cnt+1) & ~1; // 32-bit 2-reg longs only
-   int flt_reg_pairs = (flt_reg_cnt+1) & ~1;
- 
-   // int stk_reg = frame::register_save_words*(wordSize>>2);
-@@ -517,24 +516,15 @@
-           stk_reg_pairs += 2;
-         }
- #else // COMPILER2
--        if (int_reg_pairs + 1 < int_reg_max) {
--          if (is_outgoing) {
--            regs[i].set_pair(as_oRegister(int_reg_pairs + 1)->as_VMReg(), as_oRegister(int_reg_pairs)->as_VMReg());
--          } else {
--            regs[i].set_pair(as_iRegister(int_reg_pairs + 1)->as_VMReg(), as_iRegister(int_reg_pairs)->as_VMReg());
--          }
--          int_reg_pairs += 2;
--        } else {
-           regs[i].set2(VMRegImpl::stack2reg(stk_reg_pairs));
-           stk_reg_pairs += 2;
--        }
- #endif // COMPILER2
- #endif // _LP64
-       break;
- 
-     case T_FLOAT:
-       if (flt_reg < flt_reg_max) regs[i].set1(as_FloatRegister(flt_reg++)->as_VMReg());
--      else                       regs[i].set1(    VMRegImpl::stack2reg(stk_reg++));
-+      else                       regs[i].set1(VMRegImpl::stack2reg(stk_reg++));
-       break;
-     case T_DOUBLE:
-       assert(sig_bt[i+1] == T_VOID, "expecting half");
-@@ -888,15 +878,15 @@
- 
- static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg, Register temp2_reg,
-                         address code_start, address code_end,
--                        Label& L_ok, Label& L_fail) {
-+                        Label& L_ok) {
-+  Label L_fail;
-   __ set(ExternalAddress(code_start), temp_reg);
--  __ set((int)(intptr_t)(code_end - code_start), temp2_reg);
-+  __ set(pointer_delta(code_end, code_start, 1), temp2_reg);
-   __ cmp(pc_reg, temp_reg);
--  __ br(Assembler::lessEqualUnsigned, false, Assembler::pn, L_fail);
-+  __ brx(Assembler::lessEqualUnsigned, false, Assembler::pn, L_fail);
-   __ delayed()->add(temp_reg, temp2_reg, temp_reg);
-   __ cmp(pc_reg, temp_reg);
--  __ br(Assembler::lessUnsigned, false, Assembler::pt, L_ok);
--  __ delayed()->nop();
-+  __ cmp_and_brx_short(pc_reg, temp_reg, Assembler::lessUnsigned, Assembler::pt, L_ok);
-   __ bind(L_fail);
- }
- 
-@@ -946,22 +936,19 @@
-     //         StubRoutines::contains($return_addr),
-     //         "i2c adapter must return to an interpreter frame");
-     __ block_comment("verify_i2c { ");
--    Label L_ok, L_fail0, L_fail1, L_fail2;
-+    Label L_ok;
-     if (Interpreter::code() != NULL)
-       range_check(masm, O7, O0, O1,
-                   Interpreter::code()->code_start(), Interpreter::code()->code_end(),
--                  L_ok, L_fail0);
--    __ bind(L_fail0);
-+                  L_ok);
-     if (StubRoutines::code1() != NULL)
-       range_check(masm, O7, O0, O1,
-                   StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
--                  L_ok, L_fail1);
--    __ bind(L_fail1);
-+                  L_ok);
-     if (StubRoutines::code2() != NULL)
-       range_check(masm, O7, O0, O1, 
-                   StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
--                  L_ok, L_fail2);
--    __ bind(L_fail2);
-+                  L_ok);
-     const char* msg = "i2c adapter must return to an interpreter frame";
-     __ block_comment(msg);
-     __ stop(msg);
-@@ -2044,7 +2031,7 @@
-   } else if (special_dispatch == vmIntrinsics::_invokeBasic) {
-     has_receiver = true;
-   } else {
--    guarantee(false, err_msg("special_dispatch=%d", special_dispatch));
-+    fatal(err_msg("special_dispatch=%d", special_dispatch));
-   }
- 
-   if (member_reg != noreg) {
-diff --git a/src/cpu/x86/vm/methodHandles_x86.cpp b/src/cpu/x86/vm/methodHandles_x86.cpp
---- a/src/cpu/x86/vm/methodHandles_x86.cpp
-+++ b/src/cpu/x86/vm/methodHandles_x86.cpp
-@@ -103,7 +103,7 @@
-   __ andl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
-   __ cmpl(temp, ref_kind);
-   __ jcc(Assembler::equal, L);
--  { char* buf = NEW_C_HEAP_ARRAY(char, 100);
-+  { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
-     jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
-     if (ref_kind == JVM_REF_invokeVirtual ||
-         ref_kind == JVM_REF_invokeSpecial)
-@@ -257,7 +257,8 @@
-   if (TraceMethodHandles) {
-     const char* name = vmIntrinsics::name_at(iid);
-     if (*name == '_')  name += 1;
--    char* qname = NEW_C_HEAP_ARRAY(char, 100);
-+    const size_t len = strlen(name) + 50;
-+    char* qname = NEW_C_HEAP_ARRAY(char, len, mtInternal);
-     const char* suffix = "";
-     if (vmIntrinsics::method_for(iid) == NULL ||
-         !vmIntrinsics::method_for(iid)->access_flags().is_public()) {
-@@ -266,7 +267,7 @@
-       else
-         suffix = "/private";
-     }
--    jio_snprintf(qname, 100, "MethodHandle::interpreter_entry::%s%s", name, suffix);
-+    jio_snprintf(qname, len, "MethodHandle::interpreter_entry::%s%s", name, suffix);
-     // note: stub look for mh in rcx
-     trace_method_handle(_masm, qname);
-   }
-diff --git a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
---- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
-+++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
-@@ -645,7 +645,8 @@
- 
- static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
-                         address code_start, address code_end,
--                        Label& L_ok, Label& L_fail) {
-+                        Label& L_ok) {
-+  Label L_fail;
-   __ lea(temp_reg, ExternalAddress(code_start));
-   __ cmpptr(pc_reg, temp_reg);
-   __ jcc(Assembler::belowEqual, L_fail);
-@@ -692,22 +693,19 @@
-     //         StubRoutines::contains($return_addr),
-     //         "i2c adapter must return to an interpreter frame");
-     __ block_comment("verify_i2c { ");
--    Label L_ok, L_fail0, L_fail1, L_fail2;
-+    Label L_ok;
-     if (Interpreter::code() != NULL)
-       range_check(masm, rax, rdi,
-                   Interpreter::code()->code_start(), Interpreter::code()->code_end(),
--                  L_ok, L_fail0);
--    __ bind(L_fail0);
-+                  L_ok);
-     if (StubRoutines::code1() != NULL)
-       range_check(masm, rax, rdi,
-                   StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
--                  L_ok, L_fail1);
--    __ bind(L_fail1);
-+                  L_ok);
-     if (StubRoutines::code2() != NULL)
-       range_check(masm, rax, rdi,
-                   StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
--                  L_ok, L_fail2);
--    __ bind(L_fail2);
-+                  L_ok);
-     const char* msg = "i2c adapter must return to an interpreter frame";
-     __ block_comment(msg);
-     __ stop(msg);
-diff --git a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
---- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
-+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
-@@ -592,7 +592,8 @@
- 
- static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
-                         address code_start, address code_end,
--                        Label& L_ok, Label& L_fail) {
-+                        Label& L_ok) {
-+  Label L_fail;
-   __ lea(temp_reg, ExternalAddress(code_start));
-   __ cmpptr(pc_reg, temp_reg);
-   __ jcc(Assembler::belowEqual, L_fail);
-@@ -644,22 +645,19 @@
-     //         StubRoutines::contains($return_addr),
-     //         "i2c adapter must return to an interpreter frame");
-     __ block_comment("verify_i2c { ");
--    Label L_ok, L_fail0, L_fail1, L_fail2;
-+    Label L_ok;
-     if (Interpreter::code() != NULL)
-       range_check(masm, rax, r11,
-                   Interpreter::code()->code_start(), Interpreter::code()->code_end(),
--                  L_ok, L_fail0);
--    __ bind(L_fail0);
-+                  L_ok);
-     if (StubRoutines::code1() != NULL)
-       range_check(masm, rax, r11,
-                   StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
--                  L_ok, L_fail1);
--    __ bind(L_fail1);
-+                  L_ok);
-     if (StubRoutines::code2() != NULL)
-       range_check(masm, rax, r11,
-                   StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
--                  L_ok, L_fail2);
--    __ bind(L_fail2);
-+                  L_ok);
-     const char* msg = "i2c adapter must return to an interpreter frame";
-     __ block_comment(msg);
-     __ stop(msg);
-diff --git a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
---- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
-+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
-@@ -1526,7 +1526,7 @@
-     case Interpreter::java_lang_ref_reference_get
-                                              : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
-     default:
--      ShouldNotReachHere();
-+      fatal(err_msg("unexpected method kind: %d", kind));
-       break;
-   }
- 
-diff --git a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
---- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
-+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
-@@ -1524,11 +1524,11 @@
-   switch (kind) {
-   case Interpreter::zerolocals             :                                                                             break;
-   case Interpreter::zerolocals_synchronized: synchronized = true;                                                        break;
--  case Interpreter::native                 : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); break;
--  case Interpreter::native_synchronized    : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(true);  break;
--  case Interpreter::empty                  : entry_point = ((InterpreterGenerator*) this)->generate_empty_entry();       break;
--  case Interpreter::accessor               : entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry();    break;
--  case Interpreter::abstract               : entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry();    break;
-+  case Interpreter::native                 : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
-+  case Interpreter::native_synchronized    : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true);  break;
-+  case Interpreter::empty                  : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry();       break;
-+  case Interpreter::accessor               : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry();    break;
-+  case Interpreter::abstract               : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry();    break;
- 
-   case Interpreter::java_lang_math_sin     : // fall thru
-   case Interpreter::java_lang_math_cos     : // fall thru
-@@ -1538,11 +1538,11 @@
-   case Interpreter::java_lang_math_log10   : // fall thru
-   case Interpreter::java_lang_math_sqrt    : // fall thru
-   case Interpreter::java_lang_math_pow     : // fall thru
--  case Interpreter::java_lang_math_exp     : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);    break;
-+  case Interpreter::java_lang_math_exp     : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind);    break;
-   case Interpreter::java_lang_ref_reference_get
-                                            : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
-   default:
--    ShouldNotReachHere();
-+    fatal(err_msg("unexpected method kind: %d", kind));
-     break;
-   }
- 
-diff --git a/src/cpu/zero/vm/cppInterpreter_zero.cpp b/src/cpu/zero/vm/cppInterpreter_zero.cpp
---- a/src/cpu/zero/vm/cppInterpreter_zero.cpp
-+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp
-@@ -646,16 +646,15 @@
-   oop method_type = (oop) p;
- 
-   // The MethodHandle is in the slot after the arguments
--  oop form = java_lang_invoke_MethodType::form(method_type);
--  int num_vmslots = java_lang_invoke_MethodTypeForm::vmslots(form);
--  assert(argument_slots == num_vmslots + 1, "should be");
-+  int num_vmslots = argument_slots - 1;
-   oop method_handle = VMSLOTS_OBJECT(num_vmslots);
- 
-   // InvokeGeneric requires some extra shuffling
-   oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
-   bool is_exact = mhtype == method_type;
-   if (!is_exact) {
--    if (method->intrinsic_id() == vmIntrinsics::_invokeExact) {
-+    if (true || // FIXME
-+        method->intrinsic_id() == vmIntrinsics::_invokeExact) {
-       CALL_VM_NOCHECK_NOFIX(
-         SharedRuntime::throw_WrongMethodTypeException(
-           thread, method_type, mhtype));
-@@ -670,8 +669,8 @@
-     // NB the x86 code for this (in methodHandles_x86.cpp, search for
-     // "genericInvoker") is really really odd.  I'm hoping it's trying
-     // to accomodate odd VM/class library combinations I can ignore.
--    oop adapter = java_lang_invoke_MethodTypeForm::genericInvoker(form);
--    if (adapter == NULL) {
-+    oop adapter = NULL; //FIXME: load the adapter from the CP cache
-+    IF (adapter == NULL) {
-       CALL_VM_NOCHECK_NOFIX(
-         SharedRuntime::throw_WrongMethodTypeException(
-           thread, method_type, mhtype));
-@@ -1179,8 +1178,7 @@
- intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
-                                               oop method_handle) {
-   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
--  oop form = java_lang_invoke_MethodType::form(method_type);
--  int argument_slots = java_lang_invoke_MethodTypeForm::vmslots(form);
-+  int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
- 
-   return stack->sp() + argument_slots;
- }
-diff --git a/src/share/vm/asm/register.hpp b/src/share/vm/asm/register.hpp
---- a/src/share/vm/asm/register.hpp
-+++ b/src/share/vm/asm/register.hpp
-@@ -222,4 +222,30 @@
-   );
- }
- 
-+
-+inline void assert_different_registers(
-+  AbstractRegister a,
-+  AbstractRegister b,
-+  AbstractRegister c,
-+  AbstractRegister d,
-+  AbstractRegister e,
-+  AbstractRegister f,
-+  AbstractRegister g,
-+  AbstractRegister h,
-+  AbstractRegister i
-+) {
-+  assert(
-+    a != b && a != c && a != d && a != e && a != f && a != g && a != h && a != i
-+           && b != c && b != d && b != e && b != f && b != g && b != h && b != i
-+                     && c != d && c != e && c != f && c != g && c != h && c != i
-+                               && d != e && d != f && d != g && d != h && d != i
-+                                         && e != f && e != g && e != h && e != i
-+                                                   && f != g && f != h && f != i
-+                                                             && g != h && g != i
-+                                                                       && h != i,
-+    err_msg("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d",
-+            a, b, c, d, e, f, g, h, i)
-+  );
-+}
-+
- #endif // SHARE_VM_ASM_REGISTER_HPP
-diff --git a/src/share/vm/c1/c1_FrameMap.cpp b/src/share/vm/c1/c1_FrameMap.cpp
---- a/src/share/vm/c1/c1_FrameMap.cpp
-+++ b/src/share/vm/c1/c1_FrameMap.cpp
-@@ -66,7 +66,7 @@
- }
- 
- 
--CallingConvention* FrameMap::java_calling_convention(const BasicTypeArray* signature, bool outgoing, bool is_method_handle_invoke) {
-+CallingConvention* FrameMap::java_calling_convention(const BasicTypeArray* signature, bool outgoing) {
-   // compute the size of the arguments first.  The signature array
-   // that java_calling_convention takes includes a T_VOID after double
-   // work items but our signatures do not.
-@@ -77,6 +77,7 @@
-   }
- 
-   BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
-+  VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
-   int sig_index = 0;
-   for (i = 0; i < sizeargs; i++, sig_index++) {
-     sig_bt[i] = signature->at(sig_index);
-@@ -86,32 +87,7 @@
-     }
-   }
- 
--  VMRegPair* regs;
--  intptr_t out_preserve;
--  if (!is_method_handle_invoke) {
--    regs         = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
--    out_preserve = SharedRuntime::java_calling_convention(sig_bt, regs, sizeargs, outgoing);
--  } else {
--    ShouldNotReachHere();
--    // Rotate signature one-left into a temporary array for allocation:
--    // { L, I, J, D } -> { I, J, D, L }
--    BasicType* temp_sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
--    for (int i = 0; i < sizeargs - 1; i++) {
--      temp_sig_bt[i] = sig_bt[i + 1];
--    }
--    temp_sig_bt[sizeargs - 1] = sig_bt[0];
--
--    VMRegPair* temp_regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
--    out_preserve = SharedRuntime::java_calling_convention(temp_sig_bt, temp_regs, sizeargs, outgoing);
--
--    // Rotate calling convention one-right into final array:
--    // { a1, a2, a3, a0 } -> { a0, a1, a2, a3 }
--    regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
--    regs[0] = temp_regs[sizeargs - 1];
--    for (int i = 0; i < sizeargs - 1; i++) {
--      regs[i + 1] = temp_regs[i];
--    }
--  }
-+  intptr_t out_preserve = SharedRuntime::java_calling_convention(sig_bt, regs, sizeargs, outgoing);
-   LIR_OprList* args = new LIR_OprList(signature->length());
-   for (i = 0; i < sizeargs;) {
-     BasicType t = sig_bt[i];
-@@ -205,7 +181,7 @@
- 
-   _argcount = method->arg_size();
-   _argument_locations = new intArray(_argcount, -1);
--  _incoming_arguments = java_calling_convention(signature_type_array_for(method), false, method->is_method_handle_intrinsic());
-+  _incoming_arguments = java_calling_convention(signature_type_array_for(method), false);
-   _oop_map_arg_count = _incoming_arguments->reserved_stack_slots();
- 
-   int java_index = 0;
-diff --git a/src/share/vm/c1/c1_FrameMap.hpp b/src/share/vm/c1/c1_FrameMap.hpp
---- a/src/share/vm/c1/c1_FrameMap.hpp
-+++ b/src/share/vm/c1/c1_FrameMap.hpp
-@@ -182,7 +182,7 @@
-   // for outgoing calls, these also update the reserved area to
-   // include space for arguments and any ABI area.
-   CallingConvention* c_calling_convention(const BasicTypeArray* signature);
--  CallingConvention* java_calling_convention(const BasicTypeArray* signature, bool outgoing, bool is_method_handle_invoke);
-+  CallingConvention* java_calling_convention(const BasicTypeArray* signature, bool outgoing);
- 
-   // deopt support
-   ByteSize sp_offset_for_orig_pc() { return sp_offset_for_monitor_base(_num_monitors); }
-diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp
---- a/src/share/vm/c1/c1_GraphBuilder.cpp
-+++ b/src/share/vm/c1/c1_GraphBuilder.cpp
-@@ -1648,7 +1648,7 @@
-     code == Bytecodes::_invokespecial   ||
-     code == Bytecodes::_invokevirtual   ||
-     code == Bytecodes::_invokeinterface;
--  const bool is_invokedynamic = code == Bytecodes::_invokedynamic;
-+  const bool is_invokedynamic = (code == Bytecodes::_invokedynamic);
- 
-   bool will_link;
-   ciMethod*             target = stream()->get_method(will_link);
-diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp
---- a/src/share/vm/c1/c1_LIRGenerator.cpp
-+++ b/src/share/vm/c1/c1_LIRGenerator.cpp
-@@ -2744,7 +2744,7 @@
- //   we cannot spill it as it is spill-locked
- //
- void LIRGenerator::do_Invoke(Invoke* x) {
--  CallingConvention* cc = frame_map()->java_calling_convention(x->signature(), true, /*is_method_handle_invoke*/ false);
-+  CallingConvention* cc = frame_map()->java_calling_convention(x->signature(), true);
- 
-   LIR_OprList* arg_list = cc->args();
-   LIRItemList* args = invoke_visit_arguments(x);
-diff --git a/src/share/vm/ci/ciSignature.hpp b/src/share/vm/ci/ciSignature.hpp
---- a/src/share/vm/ci/ciSignature.hpp
-+++ b/src/share/vm/ci/ciSignature.hpp
-@@ -43,6 +43,7 @@
-   int _count;  // number of parameter types in the signature
- 
-   friend class ciMethod;
-+  friend class ciBytecodeStream;
-   friend class ciObjectFactory;
- 
-   ciSignature(ciKlass* accessing_klass, constantPoolHandle cpool, ciSymbol* signature);
-diff --git a/src/share/vm/ci/ciStreams.cpp b/src/share/vm/ci/ciStreams.cpp
---- a/src/share/vm/ci/ciStreams.cpp
-+++ b/src/share/vm/ci/ciStreams.cpp
-@@ -419,6 +419,24 @@
- }
- 
- // ------------------------------------------------------------------
-+// ciBytecodeStream::get_declared_method_signature
-+//
-+// Get the declared signature of the currently referenced method.
-+//
-+// This is always the same as the signature of the resolved method
-+// itself, except for _invokehandle and _invokedynamic calls.
-+//
-+ciSignature* ciBytecodeStream::get_declared_method_signature() {
-+  int sig_index = get_method_signature_index();
-+  VM_ENTRY_MARK;
-+  ciEnv* env = CURRENT_ENV;
-+  constantPoolHandle cpool(_method->get_methodOop()->constants());
-+  Symbol* sig_sym = cpool->symbol_at(sig_index);
-+  ciKlass* pool_holder = env->get_object(cpool->pool_holder())->as_klass();
-+  return new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym));
-+}
-+
-+// ------------------------------------------------------------------
- // ciBytecodeStream::get_method_signature_index
- //
- // Get the constant pool index of the signature of the method
-diff --git a/src/share/vm/ci/ciStreams.hpp b/src/share/vm/ci/ciStreams.hpp
---- a/src/share/vm/ci/ciStreams.hpp
-+++ b/src/share/vm/ci/ciStreams.hpp
-@@ -263,6 +263,7 @@
-   ciObject* get_appendix();
-   ciKlass*  get_declared_method_holder();
-   int       get_method_holder_index();
-+  ciSignature* get_declared_method_signature();
-   int       get_method_signature_index();
- 
-   ciCPCache*  get_cpcache() const;
-diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp
---- a/src/share/vm/classfile/classFileParser.cpp
-+++ b/src/share/vm/classfile/classFileParser.cpp
-@@ -2224,9 +2224,6 @@
-   // Copy byte codes
-   m->set_code(code_start);
- 
--  // Now we have some bytecodes, compute the bytecode flags.
--  m->compute_bytecode_flags();
--
-   // Copy line number table
-   if (linenumber_table != NULL) {
-     memcpy(m->compressed_linenumber_table(),
-diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp
---- a/src/share/vm/classfile/javaClasses.cpp
-+++ b/src/share/vm/classfile/javaClasses.cpp
-@@ -1738,6 +1738,8 @@
-   java_lang_StackTraceElement::set_methodName(element(), methodname);
-   // Fill in source file name
-   Symbol* source = instanceKlass::cast(method->method_holder())->source_file_name();
-+  if (ShowHiddenFrames && source == NULL)
-+    source = vmSymbols::unknown_class_name();
-   oop filename = StringTable::intern(source, CHECK_0);
-   java_lang_StackTraceElement::set_fileName(element(), filename);
-   // File in source line number
-@@ -1750,6 +1752,9 @@
-   } else {
-     // Returns -1 if no LineNumberTable, and otherwise actual line number
-     line_number = method->line_number_from_bci(bci);
-+    if (line_number == -1 && ShowHiddenFrames) {
-+      line_number = bci + 1000000;
-+    }
-   }
-   java_lang_StackTraceElement::set_lineNumber(element(), line_number);
- 
-@@ -2402,8 +2407,6 @@
- 
- int java_lang_invoke_LambdaForm::_vmentry_offset;
- 
--int java_lang_invoke_CountingMethodHandle::_vmcount_offset;
--
- void java_lang_invoke_MethodHandle::compute_offsets() {
-   klassOop klass_oop = SystemDictionary::MethodHandle_klass();
-   if (klass_oop != NULL && EnableInvokeDynamic) {
-@@ -2433,23 +2436,6 @@
-   }
- }
- 
--void java_lang_invoke_CountingMethodHandle::compute_offsets() {
--  klassOop k = SystemDictionary::CountingMethodHandle_klass();
--  if (k != NULL && EnableInvokeDynamic) {
--    compute_offset(_vmcount_offset, k, vmSymbols::vmcount_name(), vmSymbols::int_signature(), true);
--  }
--}
--
--int java_lang_invoke_CountingMethodHandle::vmcount(oop mh) {
--  assert(is_instance(mh), "CMH only");
--  return mh->int_field(_vmcount_offset);
--}
--
--void java_lang_invoke_CountingMethodHandle::set_vmcount(oop mh, int count) {
--  assert(is_instance(mh), "CMH only");
--  mh->int_field_put(_vmcount_offset, count);
--}
--
- oop java_lang_invoke_MethodHandle::type(oop mh) {
-   return mh->obj_field(_type_offset);
- }
-@@ -2558,14 +2544,12 @@
- 
- 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_lang_invoke_MethodTypeForm_signature());
-   }
- }
- 
-@@ -2618,11 +2602,6 @@
-   return (objArrayOop) mt->obj_field(_ptypes_offset);
- }
- 
--oop java_lang_invoke_MethodType::form(oop mt) {
--  assert(is_instance(mt), "must be a MethodType");
--  return mt->obj_field(_form_offset);
--}
--
- oop java_lang_invoke_MethodType::ptype(oop mt, int idx) {
-   return ptypes(mt)->obj_at(idx);
- }
-@@ -2631,25 +2610,20 @@
-   return ptypes(mt)->length();
- }
- 
--oop java_lang_invoke_MethodType::basic_type(oop mt) {
--  return java_lang_invoke_MethodTypeForm::basicType(form(mt));
-+int java_lang_invoke_MethodType::ptype_slot_count(oop mt) {
-+  objArrayOop pts = ptypes(mt);
-+  int count = pts->length();
-+  int slots = 0;
-+  for (int i = 0; i < count; i++) {
-+    BasicType bt = java_lang_Class::as_BasicType(pts->obj_at(i));
-+    slots += type2size[bt];
-+  }
-+  return slots;
- }
- 
--
--// Support for java_lang_invoke_MethodTypeForm
--
--int java_lang_invoke_MethodTypeForm::_basicType_offset;
--
--void java_lang_invoke_MethodTypeForm::compute_offsets() {
--  klassOop k = SystemDictionary::MethodTypeForm_klass();
--  if (k != NULL && EnableInvokeDynamic) {
--    compute_offset(_basicType_offset, k, vmSymbols::basicType_name(), vmSymbols::java_lang_invoke_MethodType_signature());
--  }
--}
--
--oop java_lang_invoke_MethodTypeForm::basicType(oop mtform) {
--  assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
--  return mtform->obj_field(_basicType_offset);
-+int java_lang_invoke_MethodType::rtype_slot_count(oop mt) {
-+  BasicType bt = java_lang_Class::as_BasicType(rtype(mt));
-+  return type2size[bt];
- }
- 
- 
-@@ -3004,9 +2978,7 @@
-     java_lang_invoke_MemberName::compute_offsets();
-     java_lang_invoke_LambdaForm::compute_offsets();
-     java_lang_invoke_MethodType::compute_offsets();
--    java_lang_invoke_MethodTypeForm::compute_offsets();
-     java_lang_invoke_CallSite::compute_offsets();
--    java_lang_invoke_CountingMethodHandle::compute_offsets();
-   }
-   java_security_AccessControlContext::compute_offsets();
-   // Initialize reflection classes. The layouts of these classes
-diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp
---- a/src/share/vm/classfile/javaClasses.hpp
-+++ b/src/share/vm/classfile/javaClasses.hpp
-@@ -915,34 +915,6 @@
-   static int form_offset_in_bytes()             { return _form_offset; }
- };
- 
--// A simple class that maintains an invocation count
--class java_lang_invoke_CountingMethodHandle: public java_lang_invoke_MethodHandle {
--  friend class JavaClasses;
--
-- private:
--  static int _vmcount_offset;
--  static void compute_offsets();
--
-- public:
--  // Accessors
--  static int            vmcount(oop mh);
--  static void       set_vmcount(oop mh, int count);
--
--  // Testers
--  static bool is_subclass(klassOop klass) {
--    return SystemDictionary::CountingMethodHandle_klass() != NULL &&
--      Klass::cast(klass)->is_subclass_of(SystemDictionary::CountingMethodHandle_klass());
--  }
--  static bool is_instance(oop obj) {
--    return obj != NULL && is_subclass(obj->klass());
--  }
--
--  // Accessors for code generation:
--  static int vmcount_offset_in_bytes()          { return _vmcount_offset; }
--};
--
--
--
- // Interface to java.lang.invoke.LambdaForm objects
- // (These are a private interface for managing adapter code generation.)
- 
-@@ -1059,7 +1031,6 @@
-  private:
-   static int _rtype_offset;
-   static int _ptypes_offset;
--  static int _form_offset;
- 
-   static void compute_offsets();
- 
-@@ -1067,11 +1038,13 @@
-   // Accessors
-   static oop            rtype(oop mt);
-   static objArrayOop    ptypes(oop mt);
--  static oop            form(oop mt);
- 
-   static oop            ptype(oop mt, int index);
-   static int            ptype_count(oop mt);
- 
-+  static int            ptype_slot_count(oop mt);  // extra counts for long/double
-+  static int            rtype_slot_count(oop mt);  // extra counts for long/double
-+
-   static Symbol*        as_signature(oop mt, bool intern_if_not_found, TRAPS);
-   static void           print_signature(oop mt, outputStream* st);
- 
-@@ -1081,44 +1054,9 @@
- 
-   static bool equals(oop mt1, oop mt2);
- 
--  static oop basic_type(oop mt);  // java_lang_invoke_MethodTypeForm::basicType(form(mt))
--  static bool same_basic_type(oop mt1, oop mt2) {
--    return equals(basic_type(mt1), basic_type(mt2));
--  }
--
-   // Accessors for code generation:
-   static int rtype_offset_in_bytes()            { return _rtype_offset; }
-   static int ptypes_offset_in_bytes()           { return _ptypes_offset; }
--  static int form_offset_in_bytes()             { return _form_offset; }
--};
--
--class java_lang_invoke_MethodTypeForm: AllStatic {
--  friend class JavaClasses;
--
-- private:
--  static int _vmslots_offset;           // number of argument slots needed
--  static int _vmlayout_offset;          // object describing internal calling sequence
--  static int _basicType_offset;         // basicType = canonical MethodType (normalizing subwords)
--  static int _genericInvoker_offset;    // genericInvoker = adapter for invokeGeneric
--
--  static void compute_offsets();
--
-- public:
--  // Accessors
--  static int            vmslots(oop mtform);
--  static void       set_vmslots(oop mtform, int vmslots);
--
--  static oop            basicType(oop mtform);
--  static oop            genericInvoker(oop mtform);
--
--  static oop            vmlayout(oop mtform);
--  static oop       init_vmlayout(oop mtform, oop cookie);
--
--  // Accessors for code generation:
--  static int vmslots_offset_in_bytes()          { return _vmslots_offset; }
--  static int vmlayout_offset_in_bytes()         { return _vmlayout_offset; }
--  static int basicType_offset_in_bytes()        { return _basicType_offset; }
--  static int genericInvoker_offset_in_bytes()   { return _genericInvoker_offset; }
- };
- 
- 
-diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
---- a/src/share/vm/classfile/systemDictionary.hpp
-+++ b/src/share/vm/classfile/systemDictionary.hpp
-@@ -150,10 +150,8 @@
-   template(MethodHandleNatives_klass,      java_lang_invoke_MethodHandleNatives,      Pre_JSR292) \
-   template(LambdaForm_klass,               java_lang_invoke_LambdaForm,               Opt)        \
-   template(MethodType_klass,               java_lang_invoke_MethodType,               Pre_JSR292) \
--  template(MethodTypeForm_klass,           java_lang_invoke_MethodTypeForm,           Pre_JSR292) \
-   template(BootstrapMethodError_klass,     java_lang_BootstrapMethodError,            Pre_JSR292) \
-   template(CallSite_klass,                 java_lang_invoke_CallSite,                 Pre_JSR292) \
--  template(CountingMethodHandle_klass,     java_lang_invoke_CountingMethodHandle,     Opt)        \
-   template(ConstantCallSite_klass,         java_lang_invoke_ConstantCallSite,         Pre_JSR292) \
-   template(MutableCallSite_klass,          java_lang_invoke_MutableCallSite,          Pre_JSR292) \
-   template(VolatileCallSite_klass,         java_lang_invoke_VolatileCallSite,         Pre_JSR292) \
-diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp
---- a/src/share/vm/classfile/vmSymbols.hpp
-+++ b/src/share/vm/classfile/vmSymbols.hpp
-@@ -249,12 +249,9 @@
-   template(java_lang_invoke_LambdaForm_signature,     "Ljava/lang/invoke/LambdaForm;")            \
-   template(java_lang_invoke_MethodHandle_signature,   "Ljava/lang/invoke/MethodHandle;")          \
-   /* internal classes known only to the JVM: */                                                   \
--  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_LambdaForm,               "java/lang/invoke/LambdaForm")              \
--  template(java_lang_invoke_CountingMethodHandle,     "java/lang/invoke/CountingMethodHandle")    \
-   template(java_lang_invoke_ForceInline_signature,    "Ljava/lang/invoke/ForceInline;")           \
-   template(java_lang_invoke_DontInline_signature,     "Ljava/lang/invoke/DontInline;")            \
-   template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
-diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp
---- a/src/share/vm/code/nmethod.cpp
-+++ b/src/share/vm/code/nmethod.cpp
-@@ -2389,7 +2389,6 @@
-     if (on_scavenge_root_list())  tty->print("scavenge_root ");
-     tty->print_cr("}:");
-   }
--  if (Verbose) {
-   if (size              () > 0) tty->print_cr(" total in heap  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
-                                               (address)this,
-                                               (address)this + size(),
-@@ -2434,7 +2433,6 @@
-                                               nul_chk_table_begin(),
-                                               nul_chk_table_end(),
-                                               nul_chk_table_size());
--  }
- }
- 
- void nmethod::print_code() {
-diff --git a/src/share/vm/interpreter/bytecodes.hpp b/src/share/vm/interpreter/bytecodes.hpp
---- a/src/share/vm/interpreter/bytecodes.hpp
-+++ b/src/share/vm/interpreter/bytecodes.hpp
-@@ -359,8 +359,8 @@
- 
-  public:
-   // Conversion
--  static void        check          (Code code)    { assert(is_defined(code), "illegal code"); }
--  static void        wide_check     (Code code)    { assert(wide_is_defined(code), "illegal code"); }
-+  static void        check          (Code code)    { assert(is_defined(code),      err_msg("illegal code: %d", (int)code)); }
-+  static void        wide_check     (Code code)    { assert(wide_is_defined(code), err_msg("illegal code: %d", (int)code)); }
-   static Code        cast           (int  code)    { return (Code)code; }
- 
- 
-diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp
---- a/src/share/vm/interpreter/linkResolver.cpp
-+++ b/src/share/vm/interpreter/linkResolver.cpp
-@@ -1226,26 +1226,21 @@
- 
-   // Resolve the bootstrap specifier (BSM + optional arguments).
-   Handle bootstrap_specifier;
--  for (;;) {
--    { // Short circuit if CallSite has been bound already:
--      ConstantPoolCacheEntry* cpce = pool->cache()->secondary_entry_at(index);
--      if (!cpce->is_f1_null()) {
--        methodHandle method(THREAD, cpce->f2_as_vfinal_method());
--        Handle appendix(THREAD, cpce->has_appendix() ? cpce->f1_appendix() : (oop)NULL);
--        result.set_handle(method, appendix, CHECK);
--        return;
--      }
--      if (bootstrap_specifier.not_null())
--        break;
--    }
--
--    // Just one time through this code:
-+  // Check if CallSite has been bound already:
-+  ConstantPoolCacheEntry* cpce = pool->cache()->secondary_entry_at(index);
-+  if (cpce->is_f1_null()) {
-     int pool_index = pool->cache()->main_entry_at(index)->constant_pool_index();
-     oop bsm_info = pool->resolve_bootstrap_specifier_at(pool_index, CHECK);
-     assert(bsm_info != NULL, "");
-     // FIXME: Cache this once per BootstrapMethods entry, not once per CONSTANT_InvokeDynamic.
-     bootstrap_specifier = Handle(THREAD, bsm_info);
-   }
-+  if (!cpce->is_f1_null()) {
-+    methodHandle method(THREAD, cpce->f2_as_vfinal_method());
-+    Handle appendix(THREAD, cpce->has_appendix() ? cpce->f1_appendix() : (oop)NULL);
-+    result.set_handle(method, appendix, CHECK);
-+    return;
-+  }
- 
-   if (TraceMethodHandles) {
-     tty->print_cr("resolve_invokedynamic #%d %s %s",
-diff --git a/src/share/vm/interpreter/templateInterpreter.cpp b/src/share/vm/interpreter/templateInterpreter.cpp
---- a/src/share/vm/interpreter/templateInterpreter.cpp
-+++ b/src/share/vm/interpreter/templateInterpreter.cpp
-@@ -374,11 +374,9 @@
-   method_entry(java_lang_ref_reference_get)
- 
-   // method handle entry kinds are generated later in MethodHandlesAdapterGenerator::generate:
--  {
--    for (int i = Interpreter::method_handle_invoke_FIRST; i <= Interpreter::method_handle_invoke_LAST; i++) {
--      Interpreter::MethodKind kind = (Interpreter::MethodKind) i;
--      Interpreter::_entry_table[kind] = Interpreter::_entry_table[Interpreter::abstract];
--    }
-+  for (int i = Interpreter::method_handle_invoke_FIRST; i <= Interpreter::method_handle_invoke_LAST; i++) {
-+    Interpreter::MethodKind kind = (Interpreter::MethodKind) i;
-+    Interpreter::_entry_table[kind] = Interpreter::_entry_table[Interpreter::abstract];
-   }
- 
-   // all native method kinds (must be one contiguous block)
-diff --git a/src/share/vm/oops/cpCacheOop.cpp b/src/share/vm/oops/cpCacheOop.cpp
---- a/src/share/vm/oops/cpCacheOop.cpp
-+++ b/src/share/vm/oops/cpCacheOop.cpp
-@@ -486,7 +486,8 @@
-     // virtual and final so _f2 contains method ptr instead of vtable index
-     if (f2_as_vfinal_method() == old_method) {
-       // match old_method so need an update
--      set_f2_as_vfinal_method(new_method);
-+      // NOTE: can't use set_f2_as_vfinal_method as it asserts on different values
-+      _f2 = (intptr_t)new_method;
-       if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
-         if (!(*trace_name_printed)) {
-           // RC_TRACE_MESG macro has an embedded ResourceMark
-diff --git a/src/share/vm/oops/methodOop.cpp b/src/share/vm/oops/methodOop.cpp
---- a/src/share/vm/oops/methodOop.cpp
-+++ b/src/share/vm/oops/methodOop.cpp
-@@ -396,39 +396,41 @@
- }
- 
- 
--void methodOopDesc::compute_bytecode_flags() {
-+bool methodOopDesc::compute_has_loops_flag() {
-   BytecodeStream bcs(methodOop(this));
-   Bytecodes::Code bc;
- 
--  while ((bc = bcs.next()) != Bytecodes::_illegal) {
--    switch (bc) {
--    case Bytecodes::_ifeq:
--    case Bytecodes::_ifnull:
--    case Bytecodes::_iflt:
--    case Bytecodes::_ifle:
--    case Bytecodes::_ifne:
--    case Bytecodes::_ifnonnull:
--    case Bytecodes::_ifgt:
--    case Bytecodes::_ifge:
--    case Bytecodes::_if_icmpeq:
--    case Bytecodes::_if_icmpne:
--    case Bytecodes::_if_icmplt:
--    case Bytecodes::_if_icmpgt:
--    case Bytecodes::_if_icmple:
--    case Bytecodes::_if_icmpge:
--    case Bytecodes::_if_acmpeq:
--    case Bytecodes::_if_acmpne:
--    case Bytecodes::_goto:
--    case Bytecodes::_jsr:
--      if (bcs.dest()   < bcs.next_bci())  _access_flags.set_has_loops();
--      break;
-+  while ((bc = bcs.next()) >= 0) {
-+    switch( bc ) {
-+      case Bytecodes::_ifeq:
-+      case Bytecodes::_ifnull:
-+      case Bytecodes::_iflt:
-+      case Bytecodes::_ifle:
-+      case Bytecodes::_ifne:
-+      case Bytecodes::_ifnonnull:
-+      case Bytecodes::_ifgt:
-+      case Bytecodes::_ifge:
-+      case Bytecodes::_if_icmpeq:
-+      case Bytecodes::_if_icmpne:
-+      case Bytecodes::_if_icmplt:
-+      case Bytecodes::_if_icmpgt:
-+      case Bytecodes::_if_icmple:
-+      case Bytecodes::_if_icmpge:
-+      case Bytecodes::_if_acmpeq:
-+      case Bytecodes::_if_acmpne:
-+      case Bytecodes::_goto:
-+      case Bytecodes::_jsr:
-+        if( bcs.dest() < bcs.next_bci() ) _access_flags.set_has_loops();
-+        break;
- 
--    case Bytecodes::_goto_w:
--    case Bytecodes::_jsr_w:
--      if (bcs.dest_w() < bcs.next_bci())  _access_flags.set_has_loops();
--      break;
-+      case Bytecodes::_goto_w:
-+      case Bytecodes::_jsr_w:
-+        if( bcs.dest_w() < bcs.next_bci() ) _access_flags.set_has_loops();
-+        break;
-     }
-   }
-+  _access_flags.set_loops_flag_init();
-+  return _access_flags.has_loops();
- }
- 
- 
-@@ -1181,13 +1183,8 @@
- #endif
-   name()->print_symbol_on(st);
-   if (WizardMode) signature()->print_symbol_on(st);
--  else if (MethodHandles::is_signature_polymorphic(intrinsic_id())) {
--    st->print("(");
--    for (SignatureStream ss(signature()); !ss.is_done(); ss.next()) {
--      if (ss.at_return_type())  st->print(")");
--      st->print("%c", type2char(ss.type()));
--    }
--  }
-+  else if (MethodHandles::is_signature_polymorphic(intrinsic_id()))
-+    MethodHandles::print_as_basic_type_signature_on(st, signature(), true);
- }
- 
- // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
-diff --git a/src/share/vm/oops/methodOop.hpp b/src/share/vm/oops/methodOop.hpp
---- a/src/share/vm/oops/methodOop.hpp
-+++ b/src/share/vm/oops/methodOop.hpp
-@@ -492,13 +492,19 @@
-   // true if method needs no dynamic dispatch (final and/or no vtable entry)
-   bool can_be_statically_bound() const;
- 
--  void compute_bytecode_flags();
-+  // returns true if the method has any backward branches.
-+  bool has_loops() {
-+    return access_flags().loops_flag_init() ? access_flags().has_loops() : compute_has_loops_flag();
-+  };
- 
--  // returns true if the method has any backward branches.
--  bool has_loops()          const { return access_flags().has_loops();          }
-+  bool compute_has_loops_flag();
- 
--  bool has_jsrs()                 { return access_flags().has_jsrs();           }
--  void set_has_jsrs()             {       _access_flags.set_has_jsrs();         }
-+  bool has_jsrs() {
-+    return access_flags().has_jsrs();
-+  };
-+  void set_has_jsrs() {
-+    _access_flags.set_has_jsrs();
-+  }
- 
-   // returns true if the method has any monitors.
-   bool has_monitors() const                      { return is_synchronized() || access_flags().has_monitor_bytecodes(); }
-diff --git a/src/share/vm/oops/symbol.cpp b/src/share/vm/oops/symbol.cpp
---- a/src/share/vm/oops/symbol.cpp
-+++ b/src/share/vm/oops/symbol.cpp
-@@ -96,15 +96,15 @@
-   address scan = bytes + i;
-   if (scan > limit)
-     return -1;
--  for (;;) {
-+  for (; scan <= limit; scan++) {
-     scan = (address) memchr(scan, first_char, (limit + 1 - scan));
-     if (scan == NULL)
-       return -1;  // not found
-     assert(scan >= bytes+i && scan <= limit, "scan oob");
-     if (memcmp(scan, str, len) == 0)
-       return (int)(scan - bytes);
--    ++scan;  // skip the initial matching character
-   }
-+  return -1;
- }
- 
- 
-diff --git a/src/share/vm/opto/bytecodeInfo.cpp b/src/share/vm/opto/bytecodeInfo.cpp
---- a/src/share/vm/opto/bytecodeInfo.cpp
-+++ b/src/share/vm/opto/bytecodeInfo.cpp
-@@ -244,7 +244,7 @@
-   }
- 
-   // use frequency-based objections only for non-trivial methods
--  if (callee_method->code_size_for_inlining() <= MaxTrivialSize) return NULL;
-+  if (callee_method->code_size() <= MaxTrivialSize) return NULL;
- 
-   // don't use counts with -Xcomp or CTW
-   if (UseInterpreter && !CompileTheWorld) {
-@@ -293,7 +293,7 @@
-   }
- 
-   // suppress a few checks for accessors and trivial methods
--  if (callee_method->code_size_for_inlining() > MaxTrivialSize) {
-+  if (callee_method->code_size() > MaxTrivialSize) {
- 
-     // don't inline into giant methods
-     if (C->unique() > (uint)NodeCountInliningCutoff) {
-@@ -435,13 +435,6 @@
-     return NULL;
-   }
- 
--  // XXX this is probably to much
--//  // Always inline ForceInline methods.
--//  if (callee_method->force_inline()) {
--//    if (PrintInlining)  print_inlining(callee_method, caller_bci, "force inline by annotation");
--//    return WarmCallInfo::always_hot();
--//  }
--
-   // Check if inlining policy says no.
-   WarmCallInfo wci = *(initial_wci);
-   failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci);
-diff --git a/src/share/vm/opto/callGenerator.cpp b/src/share/vm/opto/callGenerator.cpp
---- a/src/share/vm/opto/callGenerator.cpp
-+++ b/src/share/vm/opto/callGenerator.cpp
-@@ -654,41 +654,6 @@
- }
- 
- 
--//------------------------PredictedDynamicCallGenerator-----------------------
--// Internal class which handles all out-of-line calls checking receiver type.
--class PredictedDynamicCallGenerator : public CallGenerator {
--  ciMethodHandle* _predicted_method_handle;
--  CallGenerator*  _hit_cg;
--  CallGenerator*  _missed_cg;
--  float           _hit_prob;
--
--public:
--  PredictedDynamicCallGenerator(ciMethodHandle* predicted_method_handle,
--                                CallGenerator*  hit_cg,
--                                CallGenerator*  missed_cg,
--                                float hit_prob)
--    : CallGenerator(missed_cg->method()),
--      _predicted_method_handle(predicted_method_handle),
--      _hit_cg(     hit_cg),
--      _missed_cg(  missed_cg),
--      _hit_prob(hit_prob)
--  {}
--
--  virtual bool is_inline()   const { return _hit_cg->is_inline() || _missed_cg->is_inline(); }
--  virtual bool is_deferred() const { return _hit_cg->is_deferred(); }
--
--  virtual JVMState* generate(JVMState* jvms);
--};
--
--
--// CallGenerator* CallGenerator::for_predicted_dynamic_call(ciMethodHandle* predicted_method_handle,
--//                                                          CallGenerator* if_missed,
--//                                                          CallGenerator* if_hit,
--//                                                          float hit_prob) {
--//   return new PredictedDynamicCallGenerator(predicted_method_handle, if_missed, if_hit, hit_prob);
--// }
--
--
- CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee) {
-   assert(callee->is_method_handle_intrinsic() ||
-          callee->is_compiled_lambda_form(), "for_method_handle_call mismatch");
-@@ -779,189 +744,6 @@
- }
- 
- 
--JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) {
--  GraphKit kit(jvms);
--  Compile* C = kit.C;
--  PhaseGVN& gvn = kit.gvn();
--
--  CompileLog* log = C->log();
--  if (log != NULL) {
--    log->elem("predicted_dynamic_call bci='%d'", jvms->bci());
--  }
--
--  const TypeOopPtr* predicted_mh_ptr = TypeOopPtr::make_from_constant(_predicted_method_handle, true);
--  Node* predicted_mh = kit.makecon(predicted_mh_ptr);
--
--  Node* bol = NULL;
--  int bc = jvms->method()->java_code_at_bci(jvms->bci());
--  if (bc != Bytecodes::_invokedynamic) {
--    // This is the selectAlternative idiom for guardWithTest or
--    // similar idioms.
--    Node* receiver = kit.argument(0);
--
--    // Check if the MethodHandle is the expected one
--    Node* cmp = gvn.transform(new (C, 3) CmpPNode(receiver, predicted_mh));
--    bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) );
--  } else {
--    // Get the constant pool cache from the caller class.
--    ciMethod* caller_method = jvms->method();
--    ciBytecodeStream str(caller_method);
--    str.force_bci(jvms->bci());  // Set the stream to the invokedynamic bci.
--    ciCPCache* cpcache = str.get_cpcache();
--
--    // Get the offset of the CallSite from the constant pool cache
--    // pointer.
--    int index = str.get_method_index();
--    size_t call_site_offset = cpcache->get_f1_offset(index);
--
--    // Load the CallSite object from the constant pool cache.
--    const TypeOopPtr* cpcache_type   = TypeOopPtr::make_from_constant(cpcache);  // returns TypeAryPtr of type T_OBJECT
--    const TypeOopPtr* call_site_type = TypeOopPtr::make_from_klass(C->env()->CallSite_klass());
--    Node* cpcache_adr   = kit.makecon(cpcache_type);
--    Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, call_site_offset);
--    // The oops in the constant pool cache are not compressed; load then as raw pointers.
--    Node* call_site     = kit.make_load(kit.control(), call_site_adr, call_site_type, T_ADDRESS, Compile::AliasIdxRaw);
--
--    // Load the target MethodHandle from the CallSite object.
--    const TypeOopPtr* target_type = TypeOopPtr::make_from_klass(C->env()->MethodHandle_klass());
--    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, target_type, T_OBJECT);
--
--    // Check if the MethodHandle is still the same.
--    Node* cmp = gvn.transform(new (C, 3) CmpPNode(target_mh, predicted_mh));
--    bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) );
--  }
--  IfNode* iff = kit.create_and_xform_if(kit.control(), bol, _hit_prob, COUNT_UNKNOWN);
--  kit.set_control(   gvn.transform(new (C, 1) IfTrueNode (iff)));
--  Node* missed_ctl = gvn.transform(new (C, 1) IfFalseNode(iff));
--
--#if 1
--  // Make the missed call:
--  SafePointNode* slow_map = NULL;
--  JVMState* slow_jvms;
--  { PreserveJVMState pjvms(&kit);
--    kit.set_control(missed_ctl);
--    if (!kit.stopped()) {
--      slow_jvms = _missed_cg->generate(kit.sync_jvms());
--      if (kit.failing()) {
--        return NULL;  // might happen because of NodeCountInliningCutoff
--      }
--      assert(slow_jvms != NULL, "must be");
--      kit.add_exception_states_from(slow_jvms);
--      kit.set_map(slow_jvms->map());
--      if (!kit.stopped())
--        slow_map = kit.stop();
--    }
--  }
--
--  if (kit.stopped()) {
--    // Instance exactly does not matches the desired type.
--    kit.set_jvms(slow_jvms);
--    return kit.transfer_exceptions_into_jvms();
--  }
--
--  // Make the hit call:
--  JVMState* new_jvms = _hit_cg->generate(kit.sync_jvms());
--  if (new_jvms == NULL) {
--    // Inline failed, so make a direct call.
--    assert(_hit_cg->is_inline(), "must have been a failed inline");
--    CallGenerator* cg = CallGenerator::for_direct_call(_hit_cg->method());
--    new_jvms = cg->generate(kit.sync_jvms());
--  }
--  kit.add_exception_states_from(new_jvms);
--  kit.set_jvms(new_jvms);
--
--  // Need to merge slow and fast?
--  if (slow_map == NULL) {
--    // The fast path is the only path remaining.
--    return kit.transfer_exceptions_into_jvms();
--  }
--
--  if (kit.stopped()) {
--    // Inlined method threw an exception, so it's just the slow path after all.
--    kit.set_jvms(slow_jvms);
--    return kit.transfer_exceptions_into_jvms();
--  }
--  SafePointNode* missed_map = slow_map;
--#else
--  // Make the hit call:
--  JVMState* new_hit_jvms = _hit_cg->generate(kit.sync_jvms());
--  if (new_hit_jvms == NULL) {
--    // Inline failed, so make a direct call.
--    assert(_hit_cg->is_inline(), "must have been a failed inline");
--    CallGenerator* cg = CallGenerator::for_direct_call(_hit_cg->method());
--    new_hit_jvms = cg->generate(kit.sync_jvms());
--    if (new_hit_jvms == NULL) {
--      return NULL;
--    }
--  }
--  kit.add_exception_states_from(new_hit_jvms);
--  kit.set_jvms(new_hit_jvms);
--
--  if (kit.stopped()) {
--    return NULL;
--  }
--
--  // Make the missed call:
--  SafePointNode* missed_map = NULL;
--  { PreserveJVMState pjvms(&kit);
--    kit.set_control(missed_ctl);
--    JVMState* new_missed_jvms = _missed_cg->generate(kit.sync_jvms());
--    if (new_missed_jvms == NULL) {
--      // Inline failed, so make a direct call.
--      assert(_missed_cg->is_inline(), "must have been a failed inline");
--      CallGenerator* cg = CallGenerator::for_direct_call(_missed_cg->method());
--      new_missed_jvms = cg->generate(kit.sync_jvms());
--      if (new_missed_jvms == NULL) {
--        return NULL;
--      }
--    }
--    kit.add_exception_states_from(new_missed_jvms);
--    kit.set_map(new_missed_jvms->map());
--    if (!kit.stopped()) {
--      missed_map = kit.stop();
--    }
--    if (missed_map == NULL) {
--      return NULL;
--    }
--  }
--
--  if (kit.stopped()) {
--    return NULL;
--  }
--#endif
--
--  // Finish the diamond.
--  kit.C->set_has_split_ifs(true); // Has chance for split-if optimization
--  RegionNode* region = new (C, 3) RegionNode(3);
--  region->init_req(1, kit.control());
--  region->init_req(2, missed_map->control());
--  kit.set_control(gvn.transform(region));
--  Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO);
--  iophi->set_req(2, missed_map->i_o());
--  kit.set_i_o(gvn.transform(iophi));
--  kit.merge_memory(missed_map->merged_memory(), region, 2);
--  uint tos = kit.jvms()->stkoff() + kit.sp();
--  uint limit = missed_map->req();
--  for (uint i = TypeFunc::Parms; i < limit; i++) {
--    // Skip unused stack slots; fast forward to monoff();
--    if (i == tos) {
--      i = kit.jvms()->monoff();
--      if (i >= limit)  break;
--    }
--    Node* m = kit.map()->in(i);
--    Node* n = missed_map->in(i);
--    if (m != n) {
--      const Type* t = gvn.type(m)->meet(gvn.type(n));
--      Node* phi = PhiNode::make(region, m, t);
--      phi->set_req(2, n);
--      kit.map()->set_req(i, gvn.transform(phi));
--    }
--  }
--  return kit.transfer_exceptions_into_jvms();
--}
--
--
- //-------------------------UncommonTrapCallGenerator-----------------------------
- // Internal class which handles all out-of-line calls checking receiver type.
- class UncommonTrapCallGenerator : public CallGenerator {
-diff --git a/src/share/vm/opto/doCall.cpp b/src/share/vm/opto/doCall.cpp
---- a/src/share/vm/opto/doCall.cpp
-+++ b/src/share/vm/opto/doCall.cpp
-@@ -496,9 +496,63 @@
-     // Round double result after a call from strict to non-strict code
-     round_double_result(cg->method());
- 
-+    ciType* rtype = cg->method()->return_type();
-+    if (iter().cur_bc_raw() == Bytecodes::_invokehandle || is_invokedynamic) {
-+      // Be careful here with return types.
-+      ciType* ctype = iter().get_declared_method_signature()->return_type();
-+      if (ctype != rtype) {
-+        BasicType rt = rtype->basic_type();
-+        BasicType ct = ctype->basic_type();
-+        Node* retnode = peek();
-+        if (ct == T_VOID) {
-+          // It's OK for a method  to return a value that is discarded.
-+          // The discarding does not require any special action from the caller.
-+          // The Java code knows this, at VerifyType.isNullConversion.
-+          pop_node(rt);  // whatever it was, pop it
-+          retnode = top();
-+        } else if (rt == T_INT || is_subword_type(rt)) {
-+          // FIXME: This logic should be factored out.
-+          if (ct == T_BOOLEAN) {
-+            retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0x1)) );
-+          } else if (ct == T_CHAR) {
-+            retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFFFF)) );
-+          } else if (ct == T_BYTE) {
-+            retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(24)) );
-+            retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(24)) );
-+          } else if (ct == T_SHORT) {
-+            retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(16)) );
-+            retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(16)) );
-+          } else {
-+            assert(ct == T_INT, err_msg("rt=%d, ct=%d", rt, ct));
-+          }
-+        } else if (rt == T_OBJECT) {
-+          assert(ct == T_OBJECT, err_msg("rt=T_OBJECT, ct=%d", ct));
-+          if (ctype->is_loaded()) {
-+            Node* if_fail = top();
-+            retnode = gen_checkcast(retnode, makecon(TypeKlassPtr::make(ctype->as_klass())), &if_fail);
-+            if (if_fail != top()) {
-+              PreserveJVMState pjvms(this);
-+              set_control(if_fail);
-+              builtin_throw(Deoptimization::Reason_class_check);
-+            }
-+            pop();
-+            push(retnode);
-+          }
-+        } else {
-+          assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
-+          // push a zero; it's better than getting an oop/int mismatch
-+          retnode = pop_node(rt);
-+          retnode = zerocon(ct);
-+          push_node(ct, retnode);
-+        }
-+        // Now that the value is well-behaved, continue with the call-site type.
-+        rtype = ctype;
-+      }
-+    }
-+
-     // If the return type of the method is not loaded, assert that the
-     // value we got is a null.  Otherwise, we need to recompile.
--    if (!cg->method()->return_type()->is_loaded()) {
-+    if (!rtype->is_loaded()) {
- #ifndef PRODUCT
-       if (PrintOpto && (Verbose || WizardMode)) {
-         method()->print_name(); tty->print_cr(" asserting nullness of result at bci: %d", bci());
-@@ -507,7 +561,7 @@
- #endif
-       if (C->log() != NULL) {
-         C->log()->elem("assert_null reason='return' klass='%d'",
--                       C->log()->identify(cg->method()->return_type()));
-+                       C->log()->identify(rtype));
-       }
-       // If there is going to be a trap, put it at the next bytecode:
-       set_bci(iter().next_bci());
-diff --git a/src/share/vm/opto/escape.cpp b/src/share/vm/opto/escape.cpp
---- a/src/share/vm/opto/escape.cpp
-+++ b/src/share/vm/opto/escape.cpp
-@@ -1768,8 +1768,12 @@
-     assert(ptadr->is_Field() && ptadr->ideal_node() == n, "sanity");
-     return;
-   }
-+  bool unsafe = false;
-+  bool is_oop = is_oop_field(n, offset, &unsafe);
-+  if (unsafe) {
-+    es = PointsToNode::GlobalEscape;
-+  }
-   Compile* C = _compile;
--  bool is_oop = is_oop_field(n, offset);
-   FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop);
-   _nodes.at_put(n->_idx, field);
- }
-@@ -1794,7 +1798,7 @@
-   dst->set_arraycopy_dst();
- }
- 
--bool ConnectionGraph::is_oop_field(Node* n, int offset) {
-+bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) {
-   const Type* adr_type = n->as_AddP()->bottom_type();
-   BasicType bt = T_INT;
-   if (offset == Type::OffsetBot) {
-@@ -1813,7 +1817,16 @@
-       if (field != NULL) {
-         bt = field->layout_type();
-       } else {
--        // Ignore non field load (for example, klass load)
-+        // Check for unsafe oop field access
-+        for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
-+          int opcode = n->fast_out(i)->Opcode();
-+          if (opcode == Op_StoreP || opcode == Op_LoadP ||
-+              opcode == Op_StoreN || opcode == Op_LoadN) {
-+            bt = T_OBJECT;
-+            (*unsafe) = true;
-+            break;
-+          }
-+        }
-       }
-     } else if (adr_type->isa_aryptr()) {
-       if (offset == arrayOopDesc::length_offset_in_bytes()) {
-@@ -1831,6 +1844,7 @@
-         if (opcode == Op_StoreP || opcode == Op_LoadP ||
-             opcode == Op_StoreN || opcode == Op_LoadN) {
-           bt = T_OBJECT;
-+          break;
-         }
-       }
-     }
-diff --git a/src/share/vm/opto/escape.hpp b/src/share/vm/opto/escape.hpp
---- a/src/share/vm/opto/escape.hpp
-+++ b/src/share/vm/opto/escape.hpp
-@@ -512,13 +512,11 @@
-       assert(ptn != NULL, "node should be registered");
-     }
-     add_edge(ptnode_adr(n->_idx), ptn);
--  }
--
-+ }
-   // Helper functions
--  bool   is_oop_field(Node* n, int offset);
--  static Node* get_addp_base(Node *addp);
--  static Node* find_second_addp(Node* addp, Node* n);
--
-+  bool   is_oop_field(Node* n, int offset, bool* unsafe);
-+ static Node* get_addp_base(Node *addp);
-+ static Node* find_second_addp(Node* addp, Node* n);
-   // offset of a field reference
-   int address_offset(Node* adr, PhaseTransform *phase);
- 
-diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp
---- a/src/share/vm/opto/graphKit.cpp
-+++ b/src/share/vm/opto/graphKit.cpp
-@@ -963,7 +963,6 @@
-   assert(call->jvms()->debug_start() == non_debug_edges, "");
-   assert(call->jvms()->debug_end()   == call->req(), "");
-   assert(call->jvms()->debug_depth() == call->req() - non_debug_edges, "");
--//  tty->print("debug info: "); call->dump();
- }
- 
- bool GraphKit::compute_stack_effects(int& inputs, int& depth, bool for_parse) {
-@@ -1383,30 +1382,6 @@
- }
- 
- 
--//--------------------------insert_argument------------------------------------
--void GraphKit::insert_argument(ciMethod* callee, uint idx, Node* c) {
--  const uint nargs = callee->arg_size();
--  assert(0 <= idx && idx < nargs, err_msg("oob: idx=%d, nargs=%d", idx, nargs));
--  assert(nargs <= (uint) jvms()->arg_size(), "must have argument stack space");
--  for (uint i = (nargs - 1); i > idx; i--) {
--    Node* arg = argument(i - 1);
--    set_argument(i, arg);
--  }
--  set_argument(idx, c);
--}
--
--//--------------------------remove_argument------------------------------------
--void GraphKit::remove_argument(ciMethod* callee, uint idx) {
--  const uint nargs = callee->arg_size();
--  assert(0 <= idx && idx < nargs, err_msg("oob: idx=%d, nargs=%d", idx, nargs));
--  for (uint i = idx; i < (nargs - 1); i++) {
--    Node* arg = argument(i + 1);
--    set_argument(i, arg);
--  }
--  set_argument(nargs - 1, top());
--}
--
--
- //=============================================================================
- //--------------------------------memory---------------------------------------
- Node* GraphKit::memory(uint alias_idx) {
-diff --git a/src/share/vm/opto/graphKit.hpp b/src/share/vm/opto/graphKit.hpp
---- a/src/share/vm/opto/graphKit.hpp
-+++ b/src/share/vm/opto/graphKit.hpp
-@@ -430,9 +430,6 @@
-   void set_argument(uint idx, Node* c){ map_not_null(); _map->set_argument(_map->_jvms, idx, c); }
-   void ensure_stack(uint stk_size)    { map_not_null(); _map->ensure_stack(_map->_jvms, stk_size); }
- 
--  void insert_argument(ciMethod* callee, uint idx, Node *c);
--  void remove_argument(ciMethod* callee, uint idx);
--
-   // Access unaliased memory
-   Node* memory(uint alias_idx);
-   Node* memory(const TypePtr *tp) { return memory(C->get_alias_index(tp)); }
-diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
---- a/src/share/vm/prims/methodHandles.cpp
-+++ b/src/share/vm/prims/methodHandles.cpp
-@@ -468,11 +468,76 @@
-   return bsig;
- }
- 
--oop MethodHandles::method_type_basic_type(oop method_type) {
--  oop form = java_lang_invoke_MethodType::form(method_type);
--  return java_lang_invoke_MethodTypeForm::basicType(form);
-+void MethodHandles::print_as_basic_type_signature_on(outputStream* st,
-+                                                     Symbol* sig,
-+                                                     bool keep_arrays,
-+                                                     bool keep_basic_names) {
-+  st = st ? st : tty;
-+  int len  = sig->utf8_length();
-+  int array = 0;
-+  bool prev_type = false;
-+  for (int i = 0; i < len; i++) {
-+    char ch = sig->byte_at(i);
-+    switch (ch) {
-+    case '(': case ')':
-+      prev_type = false;
-+      st->put(ch);
-+      continue;
-+    case '[':
-+      if (!keep_basic_names && keep_arrays)
-+        st->put(ch);
-+      array++;
-+      continue;
-+    case 'L':
-+      {
-+        if (prev_type)  st->put(',');
-+        int start = i+1, slash = start;
-+        while (++i < len && (ch = sig->byte_at(i)) != ';') {
-+          if (ch == '/' || ch == '.' || ch == '$')  slash = i+1;
-+        }
-+        if (slash < i)  start = slash;
-+        if (!keep_basic_names) {
-+          st->put('L');
-+        } else {
-+          for (int j = start; j < i; j++)
-+            st->put(sig->byte_at(j));
-+          prev_type = true;
-+        }
-+        break;
-+      }
-+    default:
-+      {
-+        if (array && char2type(ch) != T_ILLEGAL && !keep_arrays) {
-+          ch = '[';
-+          array = 0;
-+        }
-+        if (prev_type)  st->put(',');
-+        const char* n = NULL;
-+        if (keep_basic_names)
-+          n = type2name(char2type(ch));
-+        if (n == NULL) {
-+          // unknown letter, or we don't want to know its name
-+          st->put(ch);
-+        } else {
-+          st->print(n);
-+          prev_type = true;
-+        }
-+        break;
-+      }
-+    }
-+    // Switch break goes here to take care of array suffix:
-+    if (prev_type) {
-+      while (array > 0) {
-+        st->print("[]");
-+        --array;
-+      }
-+    }
-+    array = 0;
-+  }
- }
- 
-+
-+
- static oop object_java_mirror() {
-   return Klass::cast(SystemDictionary::Object_klass())->java_mirror();
- }
-diff --git a/src/share/vm/prims/methodHandles.hpp b/src/share/vm/prims/methodHandles.hpp
---- a/src/share/vm/prims/methodHandles.hpp
-+++ b/src/share/vm/prims/methodHandles.hpp
-@@ -141,9 +141,13 @@
-   }
-   static bool is_basic_type_signature(Symbol* sig);
- 
--  static oop method_type_basic_type(oop method_type);
-   static Symbol* lookup_method_type(Symbol* msig, Handle mtype, TRAPS);
- 
-+  static void print_as_method_type_on(outputStream* st, Symbol* sig) {
-+    print_as_basic_type_signature_on(st, sig, true, true);
-+  }
-+  static void print_as_basic_type_signature_on(outputStream* st, Symbol* sig, bool keep_arrays = false, bool keep_basic_names = false);
-+
-   // decoding CONSTANT_MethodHandle constants
-   enum { JVM_REF_MIN = JVM_REF_getField, JVM_REF_MAX = JVM_REF_invokeInterface };
-   static bool ref_kind_is_valid(int ref_kind) {
-diff --git a/src/share/vm/runtime/fprofiler.cpp b/src/share/vm/runtime/fprofiler.cpp
---- a/src/share/vm/runtime/fprofiler.cpp
-+++ b/src/share/vm/runtime/fprofiler.cpp
-@@ -337,11 +337,13 @@
-       char c = (char) n->byte_at(i);
-       st->print("%c", c);
-     }
--    if( Verbose ) {
-+    if (Verbose || WizardMode) {
-       // Disambiguate overloaded methods
-       Symbol* sig = m->signature();
-       sig->print_symbol_on(st);
--    }
-+    } else if (MethodHandles::is_signature_polymorphic(m->intrinsic_id()))
-+      // compare with methodOopDesc::print_short_name
-+      MethodHandles::print_as_basic_type_signature_on(st, m->signature(), true);
-   }
- 
-   virtual void print(outputStream* st, int total_ticks) {
-diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
---- a/src/share/vm/runtime/vmStructs.cpp
-+++ b/src/share/vm/runtime/vmStructs.cpp
-@@ -2231,7 +2231,7 @@
-   declare_constant(JVM_ACC_MONITOR_MATCH)                                 \
-   declare_constant(JVM_ACC_HAS_MONITOR_BYTECODES)                         \
-   declare_constant(JVM_ACC_HAS_LOOPS)                                     \
--  declare_constant(JVM_ACC_UNUSED)                                        \
-+  declare_constant(JVM_ACC_LOOPS_FLAG_INIT)                               \
-   declare_constant(JVM_ACC_QUEUED)                                        \
-   declare_constant(JVM_ACC_NOT_OSR_COMPILABLE)                            \
-   declare_constant(JVM_ACC_HAS_LINE_NUMBER_TABLE)                         \
-diff --git a/src/share/vm/utilities/accessFlags.hpp b/src/share/vm/utilities/accessFlags.hpp
---- a/src/share/vm/utilities/accessFlags.hpp
-+++ b/src/share/vm/utilities/accessFlags.hpp
-@@ -43,7 +43,7 @@
-   JVM_ACC_MONITOR_MATCH           = 0x10000000,     // True if we know that monitorenter/monitorexit bytecodes match
-   JVM_ACC_HAS_MONITOR_BYTECODES   = 0x20000000,     // Method contains monitorenter/monitorexit bytecodes
-   JVM_ACC_HAS_LOOPS               = 0x40000000,     // Method has loops
--  JVM_ACC_UNUSED                  = (int)0x80000000,// currently unused
-+  JVM_ACC_LOOPS_FLAG_INIT         = (int)0x80000000,// The loop flag has been initialized
-   JVM_ACC_QUEUED                  = 0x01000000,     // Queued for compilation
-   JVM_ACC_NOT_C2_COMPILABLE       = 0x02000000,
-   JVM_ACC_NOT_C1_COMPILABLE       = 0x04000000,
-@@ -118,6 +118,7 @@
-   bool is_monitor_matching     () const { return (_flags & JVM_ACC_MONITOR_MATCH          ) != 0; }
-   bool has_monitor_bytecodes   () const { return (_flags & JVM_ACC_HAS_MONITOR_BYTECODES  ) != 0; }
-   bool has_loops               () const { return (_flags & JVM_ACC_HAS_LOOPS              ) != 0; }
-+  bool loops_flag_init         () const { return (_flags & JVM_ACC_LOOPS_FLAG_INIT        ) != 0; }
-   bool queued_for_compilation  () const { return (_flags & JVM_ACC_QUEUED                 ) != 0; }
-   bool is_not_c1_compilable () const    { return (_flags & JVM_ACC_NOT_C1_COMPILABLE      ) != 0; }
-   bool is_not_c2_compilable () const    { return (_flags & JVM_ACC_NOT_C2_COMPILABLE      ) != 0; }
-@@ -180,6 +181,7 @@
-   void set_monitor_matching()          { atomic_set_bits(JVM_ACC_MONITOR_MATCH);           }
-   void set_has_monitor_bytecodes()     { atomic_set_bits(JVM_ACC_HAS_MONITOR_BYTECODES);   }
-   void set_has_loops()                 { atomic_set_bits(JVM_ACC_HAS_LOOPS);               }
-+  void set_loops_flag_init()           { atomic_set_bits(JVM_ACC_LOOPS_FLAG_INIT);         }
-   void set_not_c1_compilable()         { atomic_set_bits(JVM_ACC_NOT_C1_COMPILABLE);       }
-   void set_not_c2_compilable()         { atomic_set_bits(JVM_ACC_NOT_C2_COMPILABLE);       }
-   void set_not_osr_compilable()        { atomic_set_bits(JVM_ACC_NOT_OSR_COMPILABLE);      }
--- a/series	Mon Jul 23 10:12:57 2012 -0700
+++ b/series	Mon Jul 23 10:36:37 2012 -0700
@@ -2,7 +2,6 @@
 
 # review pending before push to hotspot-comp:
 meth-lazy-7023639.patch         #-/meth #+dd785aabe02b
-meth-lazy-7023639.review.patch  #-/meth #+dd785aabe02b
 
 # non-pushed files are under review or development, or merely experimental:
 meth.patch                      #-/meth #+dd785aabe02b